@@ -2121,6 +2121,7 @@ Object* OcdFileImport::importRectangleObject(const Ocd::OcdPoint32* ocd_points,
21212121void OcdFileImport::fillPathCoords (OcdImportedPathObject *object, bool is_area, quint32 num_points, const Ocd::OcdPoint32* ocd_points) const
21222122{
21232123 object->coords .resize (num_points);
2124+ quint32 ignore_hole_points = 2 ;
21242125 for (auto i = 0u ; i < num_points; i++)
21252126 {
21262127 const auto & ocd_point = ocd_points[i];
@@ -2134,17 +2135,20 @@ void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area,
21342135 {
21352136 // CurveStart needs to be applied to the start point
21362137 object->coords [i-1 ].setCurveStart (true );
2138+ ignore_hole_points = 2 ; // 2nd control point + end point
21372139 }
2138- else if (ocd_point. y & Ocd::OcdPoint32::FlagHole && is_area && i > 1 )
2140+ else if (is_area)
21392141 {
2140- // Look for curve start points before the current point and apply hole point only if no such point is there.
2141- // This prevents hole points in the middle of a curve caused by incorrect map objects.
2142- if (i >= 3 && object->coords [i-2 ].isCurveStart ())
2143- ; // object->coords[i-2].setHolePoint(true);
2144- else if (i >= 4 && object->coords [i-3 ].isCurveStart ())
2145- ; // object->coords[i-3].setHolePoint(true);
2146- else
2142+ if (ignore_hole_points)
2143+ {
2144+ --ignore_hole_points;
2145+ }
2146+ else if (ocd_point.y & Ocd::OcdPoint32::FlagHole)
2147+ {
2148+ Q_ASSERT (i >= 2 ); // implied by initialization of ignore_hole_points
2149+ // HolePoint needs to be applied to the last point of a part
21472150 object->coords [i-1 ].setHolePoint (true );
2151+ }
21482152 }
21492153 };
21502154
0 commit comments