Page layout: rework and fix a few issues.

* rename WS_DRAW_ITEM_POLYGON to WS_DRAW_ITEM_POLYPOLYGONS (better name)
* use SHAPE_POLY_SET instead of std::vector(<wxPoint> to manage the set of polygons.
It also remove duplicate code related to HitTest and bounding box.
* fix HitTest and WS_DRAW_ITEM_POLYGON highlight.
This commit is contained in:
jean-pierre charras
2019-06-13 13:23:39 +02:00
parent c47f97e02f
commit f135ec47fa
7 changed files with 96 additions and 88 deletions
+14 -3
View File
@@ -117,9 +117,20 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
case WSG_POLY_T:
{
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
plotter->PlotPoly( poly->m_Corners, poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
poly->GetPenWidth() );
WS_DRAW_ITEM_POLYPOLYGONS* poly = (WS_DRAW_ITEM_POLYPOLYGONS*) item;
std::vector<wxPoint> points;
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
{
points.clear();
SHAPE_LINE_CHAIN& outline = poly->GetPolygons().Outline( idx );
for( int ii = 0; ii < outline.PointCount(); ii++ )
points.push_back( wxPoint( outline.Point( ii ).x ,
outline.Point( ii ).y ) );
plotter->PlotPoly( points, FILLED_SHAPE, poly->GetPenWidth() );
}
}
break;