Skip to content

Commit aa63060

Browse files
committed
OcdFileImport: Simplify fillPathCoords
1 parent 82e8164 commit aa63060

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/fileformats/ocd_file_import.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,7 @@ Object* OcdFileImport::importRectangleObject(const Ocd::OcdPoint32* ocd_points,
21292129

21302130
/** Translates the OC*D path given in the last two arguments into an Object.
21312131
*/
2132-
void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area, quint32 num_points, const Ocd::OcdPoint32* ocd_points)
2132+
void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area, quint32 num_points, const Ocd::OcdPoint32* ocd_points) const
21332133
{
21342134
object->coords.resize(num_points);
21352135
for (auto i = 0u; i < num_points; i++)
@@ -2146,18 +2146,15 @@ void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area,
21462146
// CurveStart needs to be applied to the start point
21472147
object->coords[i-1].setCurveStart(true);
21482148
}
2149-
2150-
if (ocd_point.y & Ocd::OcdPoint32::FlagHole && is_area && i > 1)
2149+
else if (ocd_point.y & Ocd::OcdPoint32::FlagHole && is_area && i > 1)
21512150
{
21522151
// Look for curve start points before the current point and apply hole point only if no such point is there.
21532152
// 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())
2153+
if (i >= 3 && object->coords[i-2].isCurveStart())
21572154
; //object->coords[i-2].setHolePoint(true);
21582155
else if (i >= 4 && object->coords[i-3].isCurveStart())
21592156
; //object->coords[i-3].setHolePoint(true);
2160-
else if (i > 1) // Don't start with hole point.
2157+
else
21612158
object->coords[i-1].setHolePoint(true);
21622159
}
21632160
};

src/fileformats/ocd_file_import.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class OcdFileImport : public Importer
317317

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

320-
void fillPathCoords(OcdFileImport::OcdImportedPathObject* object, bool is_area, quint32 num_points, const Ocd::OcdPoint32* ocd_points);
320+
void fillPathCoords(OcdFileImport::OcdImportedPathObject* object, bool is_area, quint32 num_points, const Ocd::OcdPoint32* ocd_points) const;
321321

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

0 commit comments

Comments
 (0)