Resync with main branch r6383

This commit is contained in:
Cirilo Bernardo 2015-12-19 15:02:52 +11:00
commit 2c4b220f3c
27 changed files with 366 additions and 245 deletions

View File

@ -62,7 +62,7 @@
#include <reporter.h>
extern bool useFastModeForPolygons;
extern SHAPE_POLY_SET::POLYGON_MODE polygonsCalcMode;
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
* Z orientation is 1.0 for all layers but "back" layers:
@ -705,7 +705,7 @@ void EDA_3D_CANVAS::buildBoard3DAuxLayers( REPORTER* aErrorMessages, REPORTER* a
if( bufferPolys.IsEmpty() )
continue;
bufferPolys.Simplify( useFastModeForPolygons );
bufferPolys.Simplify( polygonsCalcMode );
int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer );
int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer );

View File

@ -64,13 +64,13 @@
#include <reporter.h>
// An option for all operations on polygons:
// when useFastModeForPolygons = true, calculations can be *a lot* faster.
// when polygonsCalcMode = true, calculations can be *a lot* faster.
// but created polygons can be not stricty simple (can share edges)
// Although stricty simple are better for glu tesselation functions, I do not see
// any issue when allowing not stricty simple polygons.
// But I see *very* long calculations when setting useFastMode to false.
// So, be careful if changing thie option
bool useFastModeForPolygons = true;
SHAPE_POLY_SET::POLYGON_MODE polygonsCalcMode = SHAPE_POLY_SET::PM_FAST;
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
* Z orientation is 1.0 for all layers but "back" layers:
@ -148,7 +148,7 @@ void EDA_3D_CANVAS::buildBoardThroughHolesPolygonList( SHAPE_POLY_SET& allBoardH
}
}
allBoardHoles.Simplify( useFastModeForPolygons );
allBoardHoles.Simplify( polygonsCalcMode );
}
@ -323,11 +323,11 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
if( currLayerHoles.OutlineCount() )
{
currLayerHoles.Append(allLayerHoles);
currLayerHoles.Simplify( useFastModeForPolygons );
bufferPolys.BooleanSubtract( currLayerHoles, useFastModeForPolygons );
currLayerHoles.Simplify( polygonsCalcMode );
bufferPolys.BooleanSubtract( currLayerHoles, polygonsCalcMode );
}
else
bufferPolys.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
bufferPolys.BooleanSubtract( allLayerHoles, polygonsCalcMode );
int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer );
int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer );
@ -423,7 +423,7 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
zpos += (copper_thickness + epsilon) / 2.0f;
board_thickness -= copper_thickness + epsilon;
bufferPcbOutlines.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
bufferPcbOutlines.BooleanSubtract( allLayerHoles, polygonsCalcMode );
if( !bufferPcbOutlines.IsEmpty() )
{
@ -583,15 +583,15 @@ void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* a
bufferPolys = bufferPcbOutlines;
cuts.Append(allLayerHoles);
cuts.Simplify( useFastModeForPolygons );
cuts.Simplify( polygonsCalcMode );
bufferPolys.BooleanSubtract( cuts, useFastModeForPolygons );
bufferPolys.BooleanSubtract( cuts, polygonsCalcMode );
}
// Remove holes from Solder paste layers and silkscreen
else if( layer == B_Paste || layer == F_Paste
|| layer == B_SilkS || layer == F_SilkS )
{
bufferPolys.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
bufferPolys.BooleanSubtract( allLayerHoles, polygonsCalcMode );
}
int thickness = 0;

View File

@ -42,7 +42,6 @@
// include this after shape_poly_set.h to avoid redefinition of min, max ...
#include <potracelib.h>
#include <auxiliary.h>
/* free a potrace bitmap */
static void bm_free( potrace_bitmap_t* bm )
@ -493,10 +492,10 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer )
if( paths->next == NULL || paths->next->sign == '+' )
{
// Substract holes to main polygon:
polyset_areas.Simplify();
polyset_holes.Simplify();
polyset_areas.BooleanSubtract( polyset_holes );
polyset_areas.Fracture();
polyset_areas.Simplify( SHAPE_POLY_SET::PM_FAST );
polyset_holes.Simplify( SHAPE_POLY_SET::PM_FAST );
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_FAST );
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Output current resulting polygon(s)
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
@ -515,6 +514,17 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer )
OuputFileEnd();
}
// a helper function to calculate a square value
inline double square( double x )
{
return x*x;
}
// a helper function to calculate a cube value
inline double cube( double x )
{
return x*x*x;
}
/* render a Bezier curve. */
void BezierToPolyline( std::vector <potrace_dpoint_t>& aCornersBuffer,
@ -536,23 +546,23 @@ void BezierToPolyline( std::vector <potrace_dpoint_t>& aCornersBuffer,
/* let dd = maximal value of 2nd derivative over curve - this must
* occur at an endpoint. */
dd0 = sq( p1.x - 2 * p2.x + p3.x ) + sq( p1.y - 2 * p2.y + p3.y );
dd1 = sq( p2.x - 2 * p3.x + p4.x ) + sq( p2.y - 2 * p3.y + p4.y );
dd = 6 * sqrt( max( dd0, dd1 ) );
dd0 = square( p1.x - 2 * p2.x + p3.x ) + square( p1.y - 2 * p2.y + p3.y );
dd1 = square( p2.x - 2 * p3.x + p4.x ) + square( p2.y - 2 * p3.y + p4.y );
dd = 6 * sqrt( std::max( dd0, dd1 ) );
e2 = 8 * delta <= dd ? 8 * delta / dd : 1;
epsilon = sqrt( e2 ); /* necessary interval size */
for( t = epsilon; t<1; t += epsilon )
{
potrace_dpoint_t intermediate_point;
intermediate_point.x = p1.x * cu( 1 - t ) +
3* p2.x* sq( 1 - t ) * t +
3 * p3.x * (1 - t) * sq( t ) +
p4.x* cu( t );
intermediate_point.x = p1.x * cube( 1 - t ) +
3* p2.x* square( 1 - t ) * t +
3 * p3.x * (1 - t) * square( t ) +
p4.x* cube( t );
intermediate_point.y = p1.y * cu( 1 - t ) +
3* p2.y* sq( 1 - t ) * t +
3 * p3.y * (1 - t) * sq( t ) + p4.y* cu( t );
intermediate_point.y = p1.y * cube( 1 - t ) +
3* p2.y* square( 1 - t ) * t +
3 * p3.y * (1 - t) * square( t ) + p4.y* cube( t );
aCornersBuffer.push_back( intermediate_point );
}

View File

@ -8,69 +8,71 @@
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
0xce, 0x00, 0x00, 0x03, 0xe2, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xb5, 0x95, 0x5b, 0x4c, 0x1c,
0x55, 0x18, 0xc7, 0x17, 0x86, 0x65, 0x59, 0x96, 0xe5, 0xb6, 0x96, 0x94, 0x70, 0x09, 0x5a, 0x1e,
0xec, 0x83, 0x24, 0x0a, 0x18, 0xa5, 0xd4, 0x27, 0x6d, 0xc0, 0x5b, 0x63, 0x43, 0x13, 0x1a, 0x23,
0xd1, 0x90, 0xa6, 0x11, 0x1e, 0x2a, 0x0f, 0x5a, 0x48, 0x37, 0xb0, 0x4b, 0x40, 0x36, 0x43, 0x9b,
0x46, 0xc1, 0xe0, 0x72, 0xe9, 0x83, 0xc5, 0x18, 0x78, 0x30, 0x36, 0x28, 0x89, 0xed, 0x43, 0xfb,
0xd2, 0x9a, 0x1a, 0x74, 0x37, 0x69, 0x6d, 0x61, 0x4b, 0x69, 0xa1, 0x5c, 0xbb, 0x4b, 0x8a, 0x54,
0xd7, 0x86, 0x86, 0xfe, 0xfd, 0x9f, 0x99, 0xb3, 0x66, 0x84, 0x96, 0xd4, 0xb8, 0x7b, 0x92, 0x5f,
0x32, 0x33, 0x67, 0xe6, 0xfc, 0xce, 0xf9, 0xbe, 0xef, 0x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0x11, 0x04, 0x14, 0x09, 0x41, 0x54, 0x54, 0x14, 0x4a, 0x4a, 0x4a, 0x74, 0xc1, 0x32,
0x77, 0xfb, 0xa5, 0xd3, 0xe9, 0x34, 0x3f, 0x89, 0xc4, 0x5f, 0x34, 0x96, 0x91, 0x91, 0xd1, 0xe7,
0x70, 0x38, 0x74, 0x49, 0x1f, 0xc3, 0x9a, 0xf1, 0xa4, 0x82, 0x40, 0xa2, 0xcd, 0x22, 0x57, 0x14,
0xdc, 0x66, 0xb2, 0x0f, 0x74, 0x75, 0x75, 0x19, 0xd6, 0x4b, 0xb2, 0xe2, 0x3f, 0x03, 0x25, 0x3b,
0x29, 0x4b, 0x5c, 0x4f, 0x81, 0xce, 0xbf, 0x65, 0x0b, 0xe0, 0x0d, 0x50, 0x11, 0x6a, 0x52, 0x00,
0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};

View File

@ -413,9 +413,9 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
// Merge polygons to build the polygon which contains the initial
// polygon and its thick outline
bufferPolybase.BooleanAdd( bufferOutline ); // create the outline which contains thick outline
bufferPolybase.Fracture();
// create the outline which contains thick outline:
bufferPolybase.BooleanAdd( bufferOutline, SHAPE_POLY_SET::PM_FAST );
bufferPolybase.Fracture( SHAPE_POLY_SET::PM_FAST );
if( bufferPolybase.OutlineCount() < 1 ) // should not happen
return;

View File

@ -207,11 +207,11 @@ const SHAPE_LINE_CHAIN SHAPE_POLY_SET::convertFromClipper( const Path& aPath )
}
void SHAPE_POLY_SET::booleanOp( ClipType aType, const SHAPE_POLY_SET& aOtherShape,
bool aFastMode )
POLYGON_MODE aFastMode )
{
Clipper c;
if( !aFastMode )
if( aFastMode == PM_STRICTLY_SIMPLE )
c.StrictlySimple( true );
BOOST_FOREACH( const POLYGON& poly, m_polys )
@ -237,11 +237,11 @@ void SHAPE_POLY_SET::booleanOp( ClipType aType, const SHAPE_POLY_SET& aOtherShap
void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType,
const SHAPE_POLY_SET& aShape,
const SHAPE_POLY_SET& aOtherShape,
bool aFastMode )
POLYGON_MODE aFastMode )
{
Clipper c;
if( !aFastMode )
if( aFastMode == PM_STRICTLY_SIMPLE )
c.StrictlySimple( true );
BOOST_FOREACH( const POLYGON& poly, aShape.m_polys )
@ -264,37 +264,37 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType,
}
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& b, bool aFastMode )
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctUnion, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& b, bool aFastMode )
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctDifference, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& b, bool aFastMode )
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctIntersection, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode )
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctUnion, a, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode )
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctDifference, a, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode )
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctIntersection, a, b, aFastMode );
}
@ -550,7 +550,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
}
void SHAPE_POLY_SET::Fracture( bool aFastMode )
void SHAPE_POLY_SET::Fracture( POLYGON_MODE aFastMode )
{
Simplify( aFastMode ); // remove overlapping holes/degeneracy
@ -561,7 +561,7 @@ void SHAPE_POLY_SET::Fracture( bool aFastMode )
}
void SHAPE_POLY_SET::Simplify( bool aFastMode )
void SHAPE_POLY_SET::Simplify( POLYGON_MODE aFastMode )
{
SHAPE_POLY_SET empty;

View File

@ -63,9 +63,11 @@
#include <vector>
#include <algorithm>
#define FIELD_V_SPACING 100
#define FIELD_PADDING 10 // arbitrarily chosen for aesthetics
#define FIELD_PADDING_ALIGNED 18 // aligns 50 mil text to a 100 mil grid
#define WIRE_V_SPACING 100
#define HPADDING 25
#define VPADDING 50
#define VPADDING 25
/**
* Function round_n
@ -127,7 +129,7 @@ public:
Kiface().KifaceSettings()->Read( AUTOPLACE_ALIGN_KEY, &m_align_to_grid, false );
m_comp_bbox = m_component->GetBodyBoundingBox();
m_fbox_size = ComputeFBoxSize();
m_fbox_size = ComputeFBoxSize( /* aDynamic */ true );
m_power_symbol = ! m_component->IsInNetlist();
@ -143,18 +145,17 @@ public:
*/
void DoAutoplace( bool aManual )
{
bool force_wire_spacing = false;
SIDE field_side = choose_side_for_fields( aManual );
wxPoint fbox_pos = field_box_placement( field_side );
EDA_RECT field_box( fbox_pos, m_fbox_size );
if( aManual )
{
fbox_pos = fit_fields_between_wires( field_box, field_side );
field_box.SetOrigin( fbox_pos );
}
force_wire_spacing = fit_fields_between_wires( &field_box, field_side );
// Move the fields
for( int field_idx = 0; field_idx < m_fields.size(); ++field_idx )
int last_y_coord = field_box.GetTop();
for( unsigned field_idx = 0; field_idx < m_fields.size(); ++field_idx )
{
SCH_FIELD* field = m_fields[field_idx];
@ -163,7 +164,7 @@ public:
wxPoint pos(
field_horiz_placement( field, field_box ),
field_box.GetY() + (FIELD_V_SPACING * field_idx) );
field_vert_placement( field, field_box, &last_y_coord, !force_wire_spacing ) );
if( m_align_to_grid )
{
@ -179,29 +180,40 @@ public:
protected:
/**
* Compute and return the size of the fields' bounding box.
* @param aDynamic - if true, use dynamic spacing
*/
wxSize ComputeFBoxSize()
wxSize ComputeFBoxSize( bool aDynamic )
{
int max_field_width = 0;
int total_height = 0;
BOOST_FOREACH( SCH_FIELD* field, m_fields )
{
int field_width;
int field_height;
if( m_component->GetTransform().y1 )
{
field->SetOrientation( TEXT_ORIENT_VERT );
field_width = field->GetBoundingBox().GetHeight();
}
else
{
field->SetOrientation( TEXT_ORIENT_HORIZ );
field_width = field->GetBoundingBox().GetWidth();
}
field_width = field->GetBoundingBox().GetWidth();
field_height = field->GetBoundingBox().GetHeight();
max_field_width = std::max( max_field_width, field_width );
if( aDynamic )
total_height += field_height + get_field_padding();
else
total_height += WIRE_V_SPACING;
}
return wxSize( max_field_width, int( FIELD_V_SPACING * (m_fields.size() - 1) ) );
return wxSize( max_field_width, total_height );
}
@ -519,16 +531,16 @@ protected:
/**
* Function fit_fields_between_wires
* Shift a field box up or down a bit to make the fields fit between some wires.
* Returns the new position of the field bounding box.
* Returns true if a shift was made.
*/
wxPoint fit_fields_between_wires( const EDA_RECT& aBox, SIDE aSide )
bool fit_fields_between_wires( EDA_RECT* aBox, SIDE aSide )
{
if( aSide != SIDE_TOP && aSide != SIDE_BOTTOM )
return aBox.GetPosition();
return false;
std::vector<SCH_ITEM*> colliders = filtered_colliders( aBox );
std::vector<SCH_ITEM*> colliders = filtered_colliders( *aBox );
if( colliders.empty() )
return aBox.GetPosition();
return false;
// Find the offset of the wires for proper positioning
int offset = 0;
@ -537,24 +549,38 @@ protected:
{
SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
if( !line )
return aBox.GetPosition();
return false;
wxPoint start = line->GetStartPoint(), end = line->GetEndPoint();
if( start.y != end.y )
return aBox.GetPosition();
return false;
int this_offset = (3 * FIELD_V_SPACING / 2) - ( start.y % FIELD_V_SPACING );
int this_offset = (3 * WIRE_V_SPACING / 2) - ( start.y % WIRE_V_SPACING );
if( offset == 0 )
offset = this_offset;
else if( offset != this_offset )
return aBox.GetPosition();
return false;
}
if( aSide == SIDE_TOP )
offset = -offset;
// At this point we are recomputing the field box size. Do not
// return false after this point.
m_fbox_size = ComputeFBoxSize( /* aDynamic */ false );
wxPoint pos = aBox.GetPosition();
pos.y = round_n( pos.y - offset, FIELD_V_SPACING, aSide == SIDE_BOTTOM ) + offset;
return pos;
wxPoint pos = aBox->GetPosition();
// Remove the existing padding to get a bit more space to work with
if( aSide == SIDE_BOTTOM )
{
pos.y = m_comp_bbox.GetBottom() - get_field_padding();
}
else
{
pos.y = m_comp_bbox.GetTop() - m_fbox_size.y + get_field_padding();
}
pos.y = round_n( pos.y, WIRE_V_SPACING, aSide == SIDE_BOTTOM );
aBox->SetOrigin( pos );
return true;
}
@ -597,6 +623,59 @@ protected:
return field_xcoord;
}
/**
* Function field_vert_placement
* Place a field vertically. Because field vertical placements accumulate,
* this takes a pointer to a vertical position accumulator.
*
* @param aField - the field to place.
* @param aFieldBox - box in which fields will be placed.
* @param aPosAccum - pointer to a position accumulator
* @param aDynamic - use dynamic spacing
*
* @return Correct field vertical position
*/
int field_vert_placement( SCH_FIELD *aField, const EDA_RECT &aFieldBox, int *aPosAccum,
bool aDynamic )
{
int field_height;
int padding;
if( aDynamic )
{
if( m_component->GetTransform().y1 )
field_height = aField->GetBoundingBox().GetWidth();
else
field_height = aField->GetBoundingBox().GetHeight();
field_height = aField->GetBoundingBox().GetHeight();
padding = get_field_padding();
}
else
{
field_height = WIRE_V_SPACING / 2;
padding = WIRE_V_SPACING / 2;
}
int placement = *aPosAccum + padding / 2 + field_height / 2;
*aPosAccum += padding + field_height;
return placement;
}
/**
* Function get_field_padding
* Return the desired padding between fields.
*/
int get_field_padding()
{
if( m_align_to_grid )
return FIELD_PADDING_ALIGNED;
else
return FIELD_PADDING;
}
};
const AUTOPLACER::SIDE AUTOPLACER::SIDE_TOP( 0, -1 );

View File

@ -212,16 +212,16 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
bSizer2->Add( m_checkHVOrientation, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 );
m_checkPageLimits = new wxCheckBox( m_panel1, wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkPageLimits, 0, wxALL|wxEXPAND, 3 );
bSizer2->Add( m_checkPageLimits, 0, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 3 );
m_checkAutoplaceFields = new wxCheckBox( m_panel1, wxID_ANY, _("Automatically place component fields"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkAutoplaceFields, 0, wxALL, 3 );
bSizer2->Add( m_checkAutoplaceFields, 0, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 3 );
m_checkAutoplaceJustify = new wxCheckBox( m_panel1, wxID_ANY, _("Allow field autoplace to change justification"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkAutoplaceJustify, 0, wxALL, 3 );
bSizer2->Add( m_checkAutoplaceJustify, 0, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 3 );
m_checkAutoplaceAlign = new wxCheckBox( m_panel1, wxID_ANY, _("Always align autoplaced fields to the 50 mil grid"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkAutoplaceAlign, 0, wxALL, 3 );
bSizer2->Add( m_checkAutoplaceAlign, 0, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 3 );
bSizer3->Add( bSizer2, 0, wxEXPAND, 0 );

View File

@ -3577,7 +3577,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxLEFT|wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@ -3663,9 +3663,9 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxEXPAND|wxLEFT|wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -3751,9 +3751,9 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxEXPAND|wxLEFT|wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -3839,9 +3839,9 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxEXPAND|wxLEFT|wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -52,13 +52,13 @@
/** @brief Kicad can use case sensitive or case insensitive comparisons for labels
* Currently, it uses case insensitive.
* Can be changed by defining LABEL_KEEPCASE (uncomment next line).
* Can be changed by defining LABEL_CASE_SENSITIVE (uncomment next line).
*/
//#define LABEL_KEEPCASE
//#define LABEL_CASE_SENSITIVE
/// Compiler controlled string compare function, either case independent or not:
inline int CmpLabel_KEEPCASE( const wxString& aString1, const wxString& aString2 )
{
#ifdef LABEL_KEEPCASE
#ifdef LABEL_CASE_SENSITIVE
// case specificity, the normal behavior:
return aString1.Cmp( aString2 );
#else

View File

@ -524,7 +524,8 @@ bool SCH_EDIT_FRAME::RescueProject( bool aRunningOnDemand )
{
if( aRunningOnDemand )
{
wxMessageDialog dlg( this, _( "This project has nothing to rescue." ) );
wxMessageDialog dlg( this, _( "This project has nothing to rescue." ),
_( "Project Rescue Helper" ) );
dlg.ShowModal();
}
return true;
@ -538,7 +539,8 @@ bool SCH_EDIT_FRAME::RescueProject( bool aRunningOnDemand )
// have clicked cancel by mistake, and should have some indication of that.
if( !rescuer.GetChosenCandidateCount() )
{
wxMessageDialog dlg( this, _( "No symbols were rescued." ) );
wxMessageDialog dlg( this, _( "No symbols were rescued." ),
_( "Project Rescue Helper" ) );
dlg.ShowModal();
// Set the modified flag even on Cancel. Many users seem to instinctively want to Save at

View File

@ -1233,6 +1233,42 @@ void SCH_SHEET::ClearAnnotation( bool aIncludeSubSheets )
}
bool SCH_SHEET::IsModified() const
{
if( m_screen->IsModify() )
return true;
bool retv = false;
SCH_ITEM* item = m_screen->GetDrawItems();
while( item && !retv )
{
if( item->Type() == SCH_SHEET_T )
retv = static_cast<SCH_SHEET*>( item )->IsModified();
item = item->Next();
}
return retv;
}
void SCH_SHEET::ClearModifyStatus()
{
m_screen->ClrModify();
SCH_ITEM* item = m_screen->GetDrawItems();
while( item )
{
if( item->Type() == SCH_SHEET_T )
static_cast<SCH_SHEET*>( item )->m_screen->ClrModify();
item = item->Next();
}
}
SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
{
wxLogDebug( wxT( "Sheet assignment operator." ) );

View File

@ -635,6 +635,20 @@ public:
void ClearAnnotation( bool aIncludeSubSheets = false );
/**
* Function IsModified
* checks the sheet and any of it's sub-sheets (hierarchy) for any modifications.
* @return true if the hierarchy is modified otherwise false.
*/
bool IsModified() const;
/**
* Function ClearModifyStatus
*
* clears the modification flag for everything in the sheet and all sub-sheets.
*/
void ClearModifyStatus();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override
#endif

View File

@ -684,18 +684,6 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
}
bool SCH_SHEET_LIST::IsModified()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet; sheet = GetNext() )
{
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
return true;
}
return false;
}
bool SCH_SHEET_LIST::IsAutoSaveRequired()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet; sheet = GetNext() )
@ -708,16 +696,6 @@ bool SCH_SHEET_LIST::IsAutoSaveRequired()
}
void SCH_SHEET_LIST::ClearModifyStatus()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet; sheet = GetNext() )
{
if( sheet->LastScreen() )
sheet->LastScreen()->ClrModify();
}
}
void SCH_SHEET_LIST::AnnotatePowerSymbols( PART_LIBS* aLibs )
{
int ref = 1;

View File

@ -436,13 +436,6 @@ public:
*/
SCH_SHEET_PATH* GetSheetByPath( const wxString aPath, bool aHumanReadable = true );
/**
* Function IsModified
* checks the entire hierarchy for any modifications.
* @returns True if the hierarchy is modified otherwise false.
*/
bool IsModified();
/**
* Function IsAutoSaveRequired
* checks the entire hierarchy for any modifications that require auto save.
@ -450,8 +443,6 @@ public:
*/
bool IsAutoSaveRequired();
void ClearModifyStatus();
/**
* Function AnnotatePowerSymbols
* clear and annotates the entire hierarchy of the sheet path list.

View File

@ -613,9 +613,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
return;
}
SCH_SHEET_LIST sheetList;
if( sheetList.IsModified() )
if( g_RootSheet->IsModified() )
{
wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
wxString msg = wxString::Format( _(
@ -666,7 +664,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
wxRemoveFile( fn.GetFullPath() );
}
sheetList.ClearModifyStatus();
g_RootSheet->ClearModifyStatus();
wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
@ -786,16 +784,13 @@ void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
{
SCH_SHEET_LIST sheetList;
aEvent.Enable( sheetList.IsModified() );
aEvent.Enable( g_RootSheet->IsModified() );
}
void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetScreen()->IsModify() );
}

View File

@ -27,14 +27,6 @@
#include <wx/wx.h>
/**
* @note This appears to already be included in the OSX build of wxWidgets.
* Will someone with OSX please remove this and see if it compiles?
*/
#ifdef __WXMAC__
#include <Carbon/Carbon.h>
#endif
#ifdef DEBUG
#define DBG(x) x
#else

View File

@ -249,30 +249,45 @@ class SHAPE_POLY_SET : public SHAPE
return CIterate( 0, OutlineCount() - 1 );
}
/** operations on polygons use a aFastMode param
* if aFastMode is PM_FAST (true) the result can be a weak polygon
* if aFastMode is PM_STRICTLY_SIMPLE (false) (default) the result is (theorically) a strictly
* simple polygon, but calculations can be really significantly time consuming
* Most of time PM_FAST is preferable.
* PM_STRICTLY_SIMPLE can be used in critical cases (Gerber output for instance)
*/
enum POLYGON_MODE
{
PM_FAST = true,
PM_STRICTLY_SIMPLE = false
};
///> Performs boolean polyset union
///> For aFastMode meaning, see function booleanOp
void BooleanAdd( const SHAPE_POLY_SET& b, bool aFastMode = false );
void BooleanAdd( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode );
///> Performs boolean polyset difference
///> For aFastMode meaning, see function booleanOp
void BooleanSubtract( const SHAPE_POLY_SET& b, bool aFastMode = false );
void BooleanSubtract( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode );
///> Performs boolean polyset intersection
///> For aFastMode meaning, see function booleanOp
void BooleanIntersection( const SHAPE_POLY_SET& b, bool aFastMode = false );
void BooleanIntersection( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode );
///> Performs boolean polyset union between a and b, store the result in it self
///> For aFastMode meaning, see function booleanOp
void BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode = false );
void BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
POLYGON_MODE aFastMode );
///> Performs boolean polyset difference between a and b, store the result in it self
///> For aFastMode meaning, see function booleanOp
void BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode = false );
void BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
POLYGON_MODE aFastMode );
///> Performs boolean polyset intersection between a and b, store the result in it self
///> For aFastMode meaning, see function booleanOp
void BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode = false );
void BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
POLYGON_MODE aFastMode );
///> Performs outline inflation/deflation, using round corners.
void Inflate( int aFactor, int aCircleSegmentsCount );
@ -280,7 +295,7 @@ class SHAPE_POLY_SET : public SHAPE
///> Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the outer ring
///> to the inner holes
///> For aFastMode meaning, see function booleanOp
void Fracture( bool aFastMode = false );
void Fracture( POLYGON_MODE aFastMode );
///> Converts a set of slitted polygons to a set of polygons with holes
void Unfracture();
@ -290,7 +305,7 @@ class SHAPE_POLY_SET : public SHAPE
///> Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
///> For aFastMode meaning, see function booleanOp
void Simplify( bool aFastMode = false);
void Simplify( POLYGON_MODE aFastMode );
/// @copydoc SHAPE::Format()
const std::string Format() const;
@ -348,18 +363,18 @@ class SHAPE_POLY_SET : public SHAPE
* (AND, OR, ... and polygon simplification (merging overlaping polygons)
* @param aType is the transform type ( see ClipperLib::ClipType )
* @param aOtherShape is the SHAPE_LINE_CHAIN to combine with me.
* @param aFastMode is an option to choos if the result is a weak polygon
* @param aFastMode is an option to choose if the result can be a weak polygon
* or a stricty simple polygon.
* if aFastMode is true the result can be a weak polygon
* if aFastMode is false (default) the result is (theorically) a strictly
* if aFastMode is PM_FAST the result can be a weak polygon
* if aFastMode is PM_STRICTLY_SIMPLE (default) the result is (theorically) a strictly
* simple polygon, but calculations can be really significantly time consuming
*/
void booleanOp( ClipperLib::ClipType aType,
const SHAPE_POLY_SET& aOtherShape, bool aFastMode = false );
const SHAPE_POLY_SET& aOtherShape, POLYGON_MODE aFastMode );
void booleanOp( ClipperLib::ClipType aType,
const SHAPE_POLY_SET& aShape,
const SHAPE_POLY_SET& aOtherShape, bool aFastMode = false );
const SHAPE_POLY_SET& aOtherShape, POLYGON_MODE aFastMode );
bool pointInPolygon( const VECTOR2I& aP, const SHAPE_LINE_CHAIN& aPath ) const;

View File

@ -1137,9 +1137,9 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer,
}
stubs.Append( stub );
stubs.Simplify();
stubs.Simplify( SHAPE_POLY_SET::PM_FAST );
antipad.BooleanSubtract( stubs );
antipad.BooleanSubtract( stubs, SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( antipad );
break;

View File

@ -865,13 +865,13 @@ class MYFRAME : public wxFrame
*/
}
bool OnLayerSelect( LAYER aLayer )
bool OnLayerSelect( LAYER_NUM aLayer )
{
printf( "OnLayerSelect( aLayer:%d )\n", aLayer );
return true;
}
void OnLayerVisible( LAYER aLayer, bool isVisible, bool isFinal )
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{
printf( "OnLayerVisible( aLayer:%d, isVisible:%d isFinal:%d)\n", aLayer, isVisible, isFinal );
}
@ -910,7 +910,7 @@ public:
// add some render rows
static const LAYER_WIDGET::ROW renderRows[] = {
LAYER_WIDGET::ROW( wxT("With Very Large Ears"), 0, -1, wxT("Spock here") ),
LAYER_WIDGET::ROW( wxT("With Very Large Ears"), 0, UNSPECIFIED_COLOR, wxT("Spock here") ),
LAYER_WIDGET::ROW( wxT("With Legs"), 1, YELLOW ),
LAYER_WIDGET::ROW( wxT("With Oval Eyes"), 1, BROWN, wxT("My eyes are upon you") ),
};

View File

@ -558,7 +558,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
outlines.RemoveAllContours();
aBoard->ConvertBrdLayerToPolygonalContours( layer, outlines );
outlines.Simplify();
outlines.Simplify( SHAPE_POLY_SET::PM_FAST );
// Plot outlines
std::vector< wxPoint > cornerList;
@ -631,7 +631,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
* mask clearance + (min width solder mask /2)
* 2 - Merge shapes
* 3 - deflate result by (min width solder mask /2)
* 4 - oring result by all pad shapes as polygons with a size inflated by
* 4 - ORing result by all pad shapes as polygons with a size inflated by
* mask clearance only (because deflate sometimes creates shape artifacts)
* 5 - draw result as polygons
*
@ -773,13 +773,13 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
zone.SetMinThickness( 0 ); // trace polygons only
zone.SetLayer ( layer );
areas.BooleanAdd( initialPolys );
areas.BooleanAdd( initialPolys, SHAPE_POLY_SET::PM_FAST );
areas.Inflate( -inflate, circleToSegmentsCount );
// Combine the current areas to initial areas. This is mandatory because
// inflate/deflate transform is not perfect, and we want the initial areas perfectly kept
areas.BooleanAdd( initialPolys );
areas.Fracture();
areas.BooleanAdd( initialPolys, SHAPE_POLY_SET::PM_FAST );
areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
zone.AddFilledPolysList( areas );

View File

@ -105,10 +105,9 @@ int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
MODULE* module = m_board->m_Modules;
assert( module );
assert( m_board->m_Modules );
D_PAD* pad = new D_PAD( module );
D_PAD* pad = new D_PAD( m_board->m_Modules );
m_frame->Import_Pad_Settings( pad, false ); // use the global settings for pad
VECTOR2I cursorPos = m_controls->GetCursorPosition();
@ -159,11 +158,12 @@ int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_LEFT ) )
{
m_frame->OnModify();
m_frame->SaveCopyInUndoList( module, UR_MODEDIT );
m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
m_board->m_Status_Pcb = 0; // I have no clue why, but it is done in the legacy view
module->SetLastEditTime();
module->Pads().PushBack( pad );
pad->SetParent( m_board->m_Modules );
m_board->m_Modules->SetLastEditTime();
m_board->m_Modules->Pads().PushBack( pad );
// Set the relative pad position
// ( pad position for module orient, 0, and relative to the module position)
@ -177,7 +177,7 @@ int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
m_view->Add( pad );
// Start placing next pad
pad = new D_PAD( module );
pad = new D_PAD( m_board->m_Modules );
m_frame->Import_Pad_Settings( pad, false );
pad->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
preview.Add( pad );
@ -199,9 +199,8 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
{
std::list<D_PAD*> pads;
std::set<D_PAD*> allPads;
MODULE* module = m_board->m_Modules;
if( !module || !module->Pads() )
if( !m_board->m_Modules || !m_board->m_Modules->Pads() )
return 0;
GENERAL_COLLECTOR collector;
@ -215,7 +214,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
guide.SetIgnoreModulesRefs( true );
// Create a set containing all pads (to avoid double adding to the list)
for( D_PAD* p = module->Pads(); p; p = p->Next() )
for( D_PAD* p = m_board->m_Modules->Pads(); p; p = p->Next() )
allPads.insert( p );
DIALOG_ENUM_PADS settingsDlg( m_frame );
@ -309,7 +308,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
{
// Accept changes
m_frame->OnModify();
m_frame->SaveCopyInUndoList( module, UR_MODEDIT );
m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
BOOST_FOREACH( D_PAD* pad, pads )
pad->SetPadName( wxString::Format( wxT( "%s%d" ), padPrefix.c_str(), padNumber++ ) );

View File

@ -112,7 +112,7 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, SHAPE_POLY_SET*
int margin = m_ZoneMinThickness / 2;
m_FilledPolysList = ConvertPolyListToPolySet( m_smoothedPoly->m_CornersList );
m_FilledPolysList.Inflate( -margin, 16 );
m_FilledPolysList.Fracture();
m_FilledPolysList.Fracture( SHAPE_POLY_SET::PM_FAST );
}
if( m_FillMode ) // if fill mode uses segments, create them:

View File

@ -44,6 +44,11 @@
* - shapes are smoothed.
*/
// Polygon calculations can use fast mode or force strickly simple polygons after calculations
// Forcing strickly simple polygons is time consuming, and we have not see issues in fast mode
// so we use fast mode
#define POLY_CALC_MODE SHAPE_POLY_SET::PM_FAST
#include <cmath>
#include <sstream>
@ -429,7 +434,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
SHAPE_POLY_SET solidAreas = ConvertPolyListToPolySet( m_smoothedPoly->m_CornersList );
solidAreas.Inflate( -outline_half_thickness, segsPerCircle );
solidAreas.Simplify();
solidAreas.Simplify( POLY_CALC_MODE );
SHAPE_POLY_SET holes;
@ -442,18 +447,18 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
if(g_DumpZonesWhenFilling)
dumper->Write( &holes, "feature-holes" );
holes.Simplify( true );
holes.Simplify( POLY_CALC_MODE );
if (g_DumpZonesWhenFilling)
dumper->Write( &holes, "feature-holes-postsimplify" );
solidAreas.BooleanSubtract( holes, true );
solidAreas.BooleanSubtract( holes, POLY_CALC_MODE );
if (g_DumpZonesWhenFilling)
dumper->Write( &solidAreas, "solid-areas-minus-holes" );
SHAPE_POLY_SET fractured = solidAreas;
fractured.Fracture();
fractured.Fracture( POLY_CALC_MODE );
if (g_DumpZonesWhenFilling)
dumper->Write( &fractured, "fractured" );
@ -475,16 +480,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
// remove copper areas corresponding to not connected stubs
if( !thermalHoles.IsEmpty() )
{
thermalHoles.Simplify();
thermalHoles.Simplify( POLY_CALC_MODE );
// Remove unconnected stubs
solidAreas.BooleanSubtract( thermalHoles );
solidAreas.BooleanSubtract( thermalHoles, POLY_CALC_MODE );
if( g_DumpZonesWhenFilling )
dumper->Write( &thermalHoles, "thermal-holes" );
// put these areas in m_FilledPolysList
SHAPE_POLY_SET fractured = solidAreas;
fractured.Fracture();
fractured.Fracture( POLY_CALC_MODE );
if( g_DumpZonesWhenFilling )
dumper->Write ( &fractured, "fractured" );

View File

@ -68,7 +68,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
if( clearance )
polybuffer.Inflate( clearance, 16 );
polybuffer.Fracture();
polybuffer.Fracture( SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( polybuffer );
}

View File

@ -293,8 +293,8 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_
SHAPE_POLY_SET mergedOutlines = ConvertPolyListToPolySet( area_ref->Outline()->m_CornersList );
SHAPE_POLY_SET areaToMergePoly = ConvertPolyListToPolySet( area_to_combine->Outline()->m_CornersList );
mergedOutlines.BooleanAdd( areaToMergePoly );
mergedOutlines.Simplify();
mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
// We should have one polygon with hole
// We can have 2 polygons with hole, if the 2 initial polygons have only one common corner

View File

@ -4,8 +4,8 @@
* Few parts of this code come from FreePCB, released under the GNU General Public License V2.
* (see http://www.freepcb.com/ )
*
* Copyright (C) 2012-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -122,6 +122,9 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
// We are expecting only one main outline, but this main outline can have holes
// if holes: combine holes and remove them from the main outline.
// Note also we are using SHAPE_POLY_SET::PM_STRICTLY_SIMPLE in polygon
// calculations, but it is not mandatory. It is used mainly
// because there is usually only very few vertices in area outlines
SHAPE_POLY_SET::POLYGON& outline = polySet.Polygon( 0 );
SHAPE_POLY_SET holesBuffer;
@ -133,13 +136,13 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
outline.pop_back();
}
polySet.Simplify();
polySet.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE);
// If any hole, substract it to main outline
if( holesBuffer.OutlineCount() )
{
holesBuffer.Simplify();
polySet.BooleanSubtract( holesBuffer );
holesBuffer.Simplify( SHAPE_POLY_SET::PM_FAST);
polySet.BooleanSubtract( holesBuffer, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
}
RemoveAllContours();