Pcbnew: DRAWSEGMENT polygonal shape: fix drawings in Legacy mode. Add IsPolygonFilled() to know if the polygon is filled or not.

IsPolygonFilled() replaces the hard coded comparisob with Edge_Cut in code.
For now the polygon is not filled only on Edge_Cut layer.

But in the future, it could be an option for other layers.
This commit is contained in:
jean-pierre charras 2018-12-05 09:57:59 +01:00
parent b8309e2a70
commit 754837f947
4 changed files with 10 additions and 9 deletions

View File

@ -412,9 +412,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
for( int jj = 0; jj < outline.OutlineCount(); ++jj )
{
SHAPE_LINE_CHAIN& poly = outline.Outline( jj );
GRClosedPoly( panel->GetClipBox(), DC, poly.PointCount(),
(wxPoint*)&poly.Point( 0 ), FILLED, GetWidth(),
(wxPoint*)&poly.Point( 0 ), IsPolygonFilled(), GetWidth(),
color, color );
}
}
@ -644,7 +643,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const
#define MAX_DIST_IN_MM 0.25
int distmax = std::max( m_Width, Millimeter2iu( MAX_DIST_IN_MM ) );
if( m_Layer == Edge_Cuts )
if( !IsPolygonFilled() )
{
SHAPE_POLY_SET::VERTEX_INDEX i;
auto poly = m_Poly; //todo: Fix CollideEdge to be const

View File

@ -76,6 +76,11 @@ public:
return aItem && PCB_LINE_T == aItem->Type();
}
/** Polygonal shape is not always filled.
* For now it is filled on all layers but Edge_Cut layer
*/
bool IsPolygonFilled() const { return m_Layer != Edge_Cuts; }
void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; }

View File

@ -996,10 +996,7 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
m_gal->SetLineWidth( thickness );
if( aLayer != Edge_Cuts )
m_gal->SetIsFill( true );
else
m_gal->SetIsFill( false );
m_gal->SetIsFill( aSegment->IsPolygonFilled );
m_gal->SetIsStroke( true );
m_gal->DrawPolygon( shape );

View File

@ -534,7 +534,7 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge )
cornerList.push_back( corner );
}
if( m_layerMask[ Edge_Cuts ] )
if( !aEdge->IsPolygonFilled() )
{
for( size_t i = 1; i < cornerList.size(); i++ )
{
@ -777,7 +777,7 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
case S_POLYGON:
{
if( m_layerMask[ Edge_Cuts ] )
if( !aSeg->IsPolygonFilled() )
{
for( auto it = aSeg->GetPolyShape().IterateSegments( 0 ); it; it++ )
{