Skip to content

Commit 82e8164

Browse files
committed
OcdFileImport: Factor-in setPathHolePoint
Preparation for improved state handling and bug fixes. No observable change of behavior intented.
1 parent 7144415 commit 82e8164

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

src/fileformats/ocd_file_import.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,20 +2127,6 @@ Object* OcdFileImport::importRectangleObject(const Ocd::OcdPoint32* ocd_points,
21272127
return border_path;
21282128
}
21292129

2130-
void OcdFileImport::setPathHolePoint(OcdImportedPathObject *object, quint32 pos)
2131-
{
2132-
// Look for curve start points before the current point and apply hole point only if no such point is there.
2133-
// This prevents hole points in the middle of a curve caused by incorrect map objects.
2134-
if (pos >= 1 && object->coords[pos].isCurveStart())
2135-
; //object->coords[i-1].setHolePoint(true);
2136-
else if (pos >= 2 && object->coords[pos-1].isCurveStart())
2137-
; //object->coords[i-2].setHolePoint(true);
2138-
else if (pos >= 3 && object->coords[pos-2].isCurveStart())
2139-
; //object->coords[i-3].setHolePoint(true);
2140-
else if (pos > 0) // Don't start with hole point.
2141-
object->coords[pos].setHolePoint(true);
2142-
}
2143-
21442130
/** Translates the OC*D path given in the last two arguments into an Object.
21452131
*/
21462132
void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area, quint32 num_points, const Ocd::OcdPoint32* ocd_points)
@@ -2163,7 +2149,16 @@ void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area,
21632149

21642150
if (ocd_point.y & Ocd::OcdPoint32::FlagHole && is_area && i > 1)
21652151
{
2166-
setPathHolePoint(object, i - 1);
2152+
// Look for curve start points before the current point and apply hole point only if no such point is there.
2153+
// This prevents hole points in the middle of a curve caused by incorrect map objects.
2154+
if (i >= 2 && object->coords[i-1].isCurveStart())
2155+
; //object->coords[i-1].setHolePoint(true);
2156+
else if (i >= 3 && object->coords[i-2].isCurveStart())
2157+
; //object->coords[i-2].setHolePoint(true);
2158+
else if (i >= 4 && object->coords[i-3].isCurveStart())
2159+
; //object->coords[i-3].setHolePoint(true);
2160+
else if (i > 1) // Don't start with hole point.
2161+
object->coords[i-1].setHolePoint(true);
21672162
}
21682163
};
21692164

src/fileformats/ocd_file_import.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,6 @@ class OcdFileImport : public Importer
317317

318318
// Some helper functions that are used in multiple places
319319

320-
void setPathHolePoint(OcdImportedPathObject *object, quint32 pos);
321-
322320
void fillPathCoords(OcdFileImport::OcdImportedPathObject* object, bool is_area, quint32 num_points, const Ocd::OcdPoint32* ocd_points);
323321

324322
bool fillTextPathCoords(TextObject* object, TextSymbol* symbol, quint32 npts, const Ocd::OcdPoint32* ocd_points);

0 commit comments

Comments
 (0)