Apply a workaround in 3D_draw.cpp to avoid crash in boost::polygon (try to fix Bug #1322804)
This workaround was already used (bzr 4301, in file plot_board_layers.cpp) also to avoid similar crashes (uses 18 segments instead of 16 to approximate a circle by segments). Minor code cleanup in dialog_plot.
This commit is contained in:
parent
3802629adc
commit
afc5d13172
|
@ -240,7 +240,12 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
|
||||
|
||||
// Number of segments to convert a circle to polygon
|
||||
const int segcountforcircle = 16;
|
||||
// Boost polygon (at least v 1.54, v1.55 and previous) in very rare cases crashes
|
||||
// when using 16 segments to approximate a circle.
|
||||
// So using 18 segments is a workaround to try to avoid these crashes
|
||||
// ( We already used this trick in plot_board_layers.cpp,
|
||||
// see PlotSolderMaskLayer() )
|
||||
const int segcountforcircle = 18;
|
||||
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
|
||||
const int segcountLowQuality = 12; // segments to draw a circle with low quality
|
||||
// to reduce time calculations
|
||||
|
@ -355,11 +360,13 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
LAYER_NUM zonelayer = zone->GetLayer();
|
||||
|
||||
if( zonelayer == layer )
|
||||
{
|
||||
zone->TransformSolidAreasShapesToPolygonSet(
|
||||
hightQualityMode ? bufferPolys : bufferZonesPolys,
|
||||
segcountLowQuality, correctionFactorLQ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw graphic items on copper layers (texts)
|
||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||
|
|
|
@ -46,8 +46,6 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
|
|||
m_plotOpts( aParent->GetPlotSettings() )
|
||||
{
|
||||
m_config = Kiface().KifaceSettings();
|
||||
m_brdSettings = m_board->GetDesignSettings();
|
||||
|
||||
Init_Dialog();
|
||||
|
||||
GetSizer()->Fit( this );
|
||||
|
@ -101,9 +99,9 @@ void DIALOG_PLOT::Init_Dialog()
|
|||
break;
|
||||
}
|
||||
|
||||
msg = StringFromValue( g_UserUnit, m_brdSettings.m_SolderMaskMargin, true );
|
||||
msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMargin, true );
|
||||
m_SolderMaskMarginCurrValue->SetLabel( msg );
|
||||
msg = StringFromValue( g_UserUnit, m_brdSettings.m_SolderMaskMinWidth, true );
|
||||
msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMinWidth, true );
|
||||
m_SolderMaskMinWidthCurrValue->SetLabel( msg );
|
||||
|
||||
// Set units and value for HPGL pen size (this param in in mils).
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
private:
|
||||
PCB_EDIT_FRAME* m_parent;
|
||||
BOARD* m_board;
|
||||
BOARD_DESIGN_SETTINGS m_brdSettings;
|
||||
wxConfigBase* m_config;
|
||||
std::vector<LAYER_NUM> m_layerList; // List to hold CheckListBox layer numbers
|
||||
double m_XScaleAdjust; // X scale factor adjust to compensate
|
||||
|
|
|
@ -1222,7 +1222,7 @@ int CPolyLine::HitTestForCorner( const wxPoint& aPos, int aDistMax ) const
|
|||
* Copy the contours to a KI_POLYGON_WITH_HOLES
|
||||
* The first contour is the main outline, others are holes
|
||||
*/
|
||||
void CPOLYGONS_LIST::ExportTo( KI_POLYGON_WITH_HOLES& aPolygoneWithHole )
|
||||
void CPOLYGONS_LIST::ExportTo( KI_POLYGON_WITH_HOLES& aPolygoneWithHole ) const
|
||||
{
|
||||
unsigned corners_count = m_cornersList.size();
|
||||
|
||||
|
@ -1273,7 +1273,7 @@ void CPOLYGONS_LIST::ExportTo( KI_POLYGON_WITH_HOLES& aPolygoneWithHole )
|
|||
* Each contour is copied into a KI_POLYGON, and each KI_POLYGON
|
||||
* is append to aPolygons
|
||||
*/
|
||||
void CPOLYGONS_LIST::ExportTo( KI_POLYGON_SET& aPolygons )
|
||||
void CPOLYGONS_LIST::ExportTo( KI_POLYGON_SET& aPolygons ) const
|
||||
{
|
||||
std::vector<KI_POLY_POINT> cornerslist;
|
||||
unsigned corners_count = GetCornersCount();
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
* Copy all contours to a KI_POLYGON_SET
|
||||
* @param aPolygons = the KI_POLYGON_WITH_HOLES to populate
|
||||
*/
|
||||
void ExportTo( KI_POLYGON_SET& aPolygons );
|
||||
void ExportTo( KI_POLYGON_SET& aPolygons ) const;
|
||||
|
||||
/**
|
||||
* Function ExportTo
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
* The first contour is the main outline, others are holes
|
||||
* @param aPolygoneWithHole = the KI_POLYGON_WITH_HOLES to populate
|
||||
*/
|
||||
void ExportTo( KI_POLYGON_WITH_HOLES& aPolygoneWithHole );
|
||||
void ExportTo( KI_POLYGON_WITH_HOLES& aPolygoneWithHole ) const;
|
||||
|
||||
/**
|
||||
* Function ImportFrom
|
||||
|
|
Loading…
Reference in New Issue