Shorter names before things get out of hand.

Also, remove comments indicating CURVE is a Bezier.  Just call it a
BEZIER.
This commit is contained in:
Jeff Young 2021-07-17 19:52:13 +01:00
parent a41944020d
commit 8b08c9e53f
21 changed files with 133 additions and 175 deletions

View File

@ -516,7 +516,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
break; break;
} }
case SHAPE_T::BEZIER: // Bezier curve case SHAPE_T::BEZIER:
{ {
std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end }; std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end };
BEZIER_POLY converter( ctrlPoints ); BEZIER_POLY converter( ctrlPoints );
@ -533,7 +533,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
} }
default: default:
wxFAIL_MSG( "PCB_SHAPE::TransformShapeWithClearanceToPolygon no implementation for " wxFAIL_MSG( "EDA_SHAPE::TransformShapeWithClearanceToPolygon not implemented for "
+ SHAPE_T_asString() ); + SHAPE_T_asString() );
break; break;
} }

View File

@ -160,7 +160,7 @@ void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
switch( GetShape() ) switch( GetShape() )
{ {
case SHAPE_T::ARC: case SHAPE_T::ARC:
// Update arc angle but do not yet update m_thirdPoint0 and m_thirdPoint, // Update arc angle but do not yet update m_ThirdPoint0 and m_thirdPoint,
// arc center and start point must be updated before calculation arc end. // arc center and start point must be updated before calculation arc end.
SetAngle( -GetAngle(), false ); SetAngle( -GetAngle(), false );
KI_FALLTHROUGH; KI_FALLTHROUGH;
@ -227,7 +227,7 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
switch( GetShape() ) switch( GetShape() )
{ {
case SHAPE_T::ARC: case SHAPE_T::ARC:
// Update arc angle but do not yet update m_thirdPoint0 and m_thirdPoint, // Update arc angle but do not yet update m_ThirdPoint0 and m_thirdPoint,
// arc center and start point must be updated before calculation arc end. // arc center and start point must be updated before calculation arc end.
SetAngle( -GetAngle(), false ); SetAngle( -GetAngle(), false );
KI_FALLTHROUGH; KI_FALLTHROUGH;

View File

@ -126,7 +126,7 @@ bool GRAPHICS_CLEANER::areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 )
&& aShape1->GetBezierPoints() == aShape2->GetBezierPoints(); && aShape1->GetBezierPoints() == aShape2->GetBezierPoints();
default: default:
wxFAIL_MSG( "GRAPHICS_CLEANER::areEquivalent unsupported PCB_SHAPE shape: " wxFAIL_MSG( "GRAPHICS_CLEANER::areEquivalent unimplemented for "
+ aShape1->SHAPE_T_asString() ); + aShape1->SHAPE_T_asString() );
return false; return false;
} }

View File

@ -425,12 +425,11 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
for( unsigned jj = 1; jj < buffer.size(); jj++ ) for( unsigned jj = 1; jj < buffer.size(); jj++ )
{ {
FP_SHAPE* seg; FP_SHAPE* seg;
seg = new FP_SHAPE( footprint ); seg = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
seg->SetStart( buffer[jj - 1] ); seg->SetStart( buffer[jj - 1] );
seg->SetEnd( buffer[jj] ); seg->SetEnd( buffer[jj] );
seg->SetWidth( aInductorPattern.m_Width ); seg->SetWidth( aInductorPattern.m_Width );
seg->SetLayer( footprint->GetLayer() ); seg->SetLayer( footprint->GetLayer() );
seg->SetShape( SHAPE_T::SEGMENT );
seg->SetStart0( seg->GetStart() - footprint->GetPosition() ); seg->SetStart0( seg->GetStart() - footprint->GetPosition() );
seg->SetEnd0( seg->GetEnd() - footprint->GetPosition() ); seg->SetEnd0( seg->GetEnd() - footprint->GetPosition() );
footprint->Add( seg ); footprint->Add( seg );

View File

@ -341,8 +341,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
pad2->SetX( pad2->GetPos0().x ); pad2->SetX( pad2->GetPos0().x );
// Add a polygonal edge (corners will be added later) on copper layer // Add a polygonal edge (corners will be added later) on copper layer
shape = new FP_SHAPE( footprint ); shape = new FP_SHAPE( footprint, SHAPE_T::POLY );
shape->SetShape( SHAPE_T::POLY );
shape->SetFilled( true ); shape->SetFilled( true );
shape->SetLayer( F_Cu ); shape->SetLayer( F_Cu );

View File

@ -57,8 +57,7 @@ void PAD::AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness, bool aF
void PAD::AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness, bool aFilled ) void PAD::AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness, bool aFilled )
{ {
PCB_SHAPE* item = new PCB_SHAPE(); PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::POLY );
item->SetShape( SHAPE_T::POLY );
item->SetFilled( aFilled ); item->SetFilled( aFilled );
item->SetPolyPoints( aPoly ); item->SetPolyPoints( aPoly );
item->SetWidth( aThickness ); item->SetWidth( aThickness );
@ -70,8 +69,7 @@ void PAD::AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness, b
void PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness ) void PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness )
{ {
PCB_SHAPE* item = new PCB_SHAPE(); PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::SEGMENT );
item->SetShape( SHAPE_T::SEGMENT );
item->SetFilled( false ); item->SetFilled( false );
item->SetStart( aStart ); item->SetStart( aStart );
item->SetEnd( aEnd ); item->SetEnd( aEnd );
@ -85,8 +83,7 @@ void PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int a
void PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle, void PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
int aThickness ) int aThickness )
{ {
PCB_SHAPE* item = new PCB_SHAPE(); PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::ARC );
item->SetShape( SHAPE_T::ARC );
item->SetFilled( false ); item->SetFilled( false );
item->SetArcCenter( aCenter ); item->SetArcCenter( aCenter );
item->SetArcStart( aStart ); item->SetArcStart( aStart );
@ -101,8 +98,7 @@ void PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aA
void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1, void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
const wxPoint& aCtrl2, int aThickness ) const wxPoint& aCtrl2, int aThickness )
{ {
PCB_SHAPE* item = new PCB_SHAPE(); PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::BEZIER );
item->SetShape( SHAPE_T::BEZIER );
item->SetFilled( false ); item->SetFilled( false );
item->SetStart( aStart ); item->SetStart( aStart );
item->SetEnd( aEnd ); item->SetEnd( aEnd );
@ -117,8 +113,7 @@ void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const w
void PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled ) void PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled )
{ {
PCB_SHAPE* item = new PCB_SHAPE(); PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::CIRCLE );
item->SetShape( SHAPE_T::CIRCLE );
item->SetFilled( aFilled ); item->SetFilled( aFilled );
item->SetStart( aCenter ); item->SetStart( aCenter );
item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) ); item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) );
@ -132,8 +127,7 @@ void PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThicknes
void PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness, void PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
bool aFilled) bool aFilled)
{ {
PCB_SHAPE* item = new PCB_SHAPE(); PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T:: RECT );
item->SetShape( SHAPE_T::RECT );
item->SetFilled( aFilled ); item->SetFilled( aFilled );
item->SetStart( aStart ); item->SetStart( aStart );
item->SetEnd( aEnd ); item->SetEnd( aEnd );

View File

@ -37,7 +37,13 @@ PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, KICAD_T idtype, SHAPE_T shapetype ) :
BOARD_ITEM( aParent, idtype ), BOARD_ITEM( aParent, idtype ),
EDA_SHAPE( shapetype, Millimeter2iu( DEFAULT_LINE_WIDTH ) ) EDA_SHAPE( shapetype, Millimeter2iu( DEFAULT_LINE_WIDTH ) )
{ {
m_flags = 0; }
PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, SHAPE_T shapetype ) :
BOARD_ITEM( aParent, PCB_SHAPE_T ),
EDA_SHAPE( shapetype, Millimeter2iu( DEFAULT_LINE_WIDTH ) )
{
} }

View File

@ -38,8 +38,9 @@ class MSG_PANEL_ITEM;
class PCB_SHAPE : public BOARD_ITEM, public EDA_SHAPE class PCB_SHAPE : public BOARD_ITEM, public EDA_SHAPE
{ {
public: public:
PCB_SHAPE( BOARD_ITEM* aParent = NULL, KICAD_T idtype = PCB_SHAPE_T, PCB_SHAPE( BOARD_ITEM* aParent, KICAD_T idtype, SHAPE_T shapetype );
SHAPE_T shapetype = SHAPE_T::SEGMENT );
PCB_SHAPE( BOARD_ITEM* aParent = NULL, SHAPE_T shapetype = SHAPE_T::SEGMENT );
// Do not create a copy constructor & operator=. // Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate. // The ones generated by the compiler are adequate.

View File

@ -114,7 +114,7 @@ bool IsAltiumLayerAPlane( ALTIUM_LAYER aLayer )
} }
PCB_SHAPE* ALTIUM_PCB::HelperCreateAndAddDrawsegment( uint16_t aComponent ) PCB_SHAPE* ALTIUM_PCB::HelperCreateAndAddShape( uint16_t aComponent )
{ {
if( aComponent == ALTIUM_COMPONENT_NONE ) if( aComponent == ALTIUM_COMPONENT_NONE )
{ {
@ -141,7 +141,7 @@ PCB_SHAPE* ALTIUM_PCB::HelperCreateAndAddDrawsegment( uint16_t aComponent )
} }
void ALTIUM_PCB::HelperDrawsegmentSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponent ) void ALTIUM_PCB::HelperShapeSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponent )
{ {
if( aComponent != ALTIUM_COMPONENT_NONE ) if( aComponent != ALTIUM_COMPONENT_NONE )
{ {
@ -169,36 +169,36 @@ void ALTIUM_PCB::HelperDrawsegmentSetLocalCoord( PCB_SHAPE* aShape, uint16_t aCo
void HelperShapeLineChainFromAltiumVertices( SHAPE_LINE_CHAIN& aLine, void HelperShapeLineChainFromAltiumVertices( SHAPE_LINE_CHAIN& aLine,
const std::vector<ALTIUM_VERTICE>& aVertices ) const std::vector<ALTIUM_VERTICE>& aVertices )
{ {
for( auto& vertice : aVertices ) for( const ALTIUM_VERTICE& vertex : aVertices )
{ {
if( vertice.isRound ) if( vertex.isRound )
{ {
double angle = NormalizeAngleDegreesPos( vertice.endangle - vertice.startangle ); double angle = NormalizeAngleDegreesPos( vertex.endangle - vertex.startangle );
double startradiant = DEG2RAD( vertice.startangle ); double startradiant = DEG2RAD( vertex.startangle );
double endradiant = DEG2RAD( vertice.endangle ); double endradiant = DEG2RAD( vertex.endangle );
wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * vertice.radius ), wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * vertex.radius ),
-KiROUND( std::sin( startradiant ) * vertice.radius ) ); -KiROUND( std::sin( startradiant ) * vertex.radius ) );
wxPoint arcEndOffset = wxPoint( KiROUND( std::cos( endradiant ) * vertice.radius ), wxPoint arcEndOffset = wxPoint( KiROUND( std::cos( endradiant ) * vertex.radius ),
-KiROUND( std::sin( endradiant ) * vertice.radius ) ); -KiROUND( std::sin( endradiant ) * vertex.radius ) );
wxPoint arcStart = vertice.center + arcStartOffset; wxPoint arcStart = vertex.center + arcStartOffset;
wxPoint arcEnd = vertice.center + arcEndOffset; wxPoint arcEnd = vertex.center + arcEndOffset;
if( GetLineLength( arcStart, vertice.position ) if( GetLineLength( arcStart, vertex.position )
< GetLineLength( arcEnd, vertice.position ) ) < GetLineLength( arcEnd, vertex.position ) )
{ {
aLine.Append( SHAPE_ARC( vertice.center, arcStart, -angle ) ); aLine.Append( SHAPE_ARC( vertex.center, arcStart, -angle ) );
} }
else else
{ {
aLine.Append( SHAPE_ARC( vertice.center, arcEnd, angle ) ); aLine.Append( SHAPE_ARC( vertex.center, arcEnd, angle ) );
} }
} }
else else
{ {
aLine.Append( vertice.position ); aLine.Append( vertex.position );
} }
} }
@ -1240,9 +1240,8 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
wxPoint last = referencePoint0; wxPoint last = referencePoint0;
for( size_t i = 1; i < aElem.referencePoint.size(); i++ ) for( size_t i = 1; i < aElem.referencePoint.size(); i++ )
{ {
PCB_SHAPE* shape = new PCB_SHAPE( m_board ); PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT );
m_board->Add( shape, ADD_MODE::APPEND ); m_board->Add( shape, ADD_MODE::APPEND );
shape->SetShape( SHAPE_T::SEGMENT );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetWidth( aElem.linewidth ); shape->SetWidth( aElem.linewidth );
shape->SetStart( last ); shape->SetStart( last );
@ -1261,9 +1260,8 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
wxPoint( KiROUND( dirVec.x / scaling ), KiROUND( dirVec.y / scaling ) ); wxPoint( KiROUND( dirVec.x / scaling ), KiROUND( dirVec.y / scaling ) );
RotatePoint( &arrVec, 200. ); RotatePoint( &arrVec, 200. );
PCB_SHAPE* shape1 = new PCB_SHAPE( m_board ); PCB_SHAPE* shape1 = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT );
m_board->Add( shape1, ADD_MODE::APPEND ); m_board->Add( shape1, ADD_MODE::APPEND );
shape1->SetShape( SHAPE_T::SEGMENT );
shape1->SetLayer( klayer ); shape1->SetLayer( klayer );
shape1->SetWidth( aElem.linewidth ); shape1->SetWidth( aElem.linewidth );
shape1->SetStart( referencePoint0 ); shape1->SetStart( referencePoint0 );
@ -1271,9 +1269,8 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
RotatePoint( &arrVec, -400. ); RotatePoint( &arrVec, -400. );
PCB_SHAPE* shape2 = new PCB_SHAPE( m_board ); PCB_SHAPE* shape2 = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT );
m_board->Add( shape2, ADD_MODE::APPEND ); m_board->Add( shape2, ADD_MODE::APPEND );
shape2->SetShape( SHAPE_T::SEGMENT );
shape2->SetLayer( klayer ); shape2->SetLayer( klayer );
shape2->SetWidth( aElem.linewidth ); shape2->SetWidth( aElem.linewidth );
shape2->SetStart( referencePoint0 ); shape2->SetStart( referencePoint0 );
@ -1314,9 +1311,8 @@ void ALTIUM_PCB::HelperParseDimensions6Datum( const ADIMENSION6& aElem )
for( size_t i = 0; i < aElem.referencePoint.size(); i++ ) for( size_t i = 0; i < aElem.referencePoint.size(); i++ )
{ {
PCB_SHAPE* shape = new PCB_SHAPE( m_board ); PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT );
m_board->Add( shape, ADD_MODE::APPEND ); m_board->Add( shape, ADD_MODE::APPEND );
shape->SetShape( SHAPE_T::SEGMENT );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetWidth( aElem.linewidth ); shape->SetWidth( aElem.linewidth );
shape->SetStart( aElem.referencePoint.at( i ) ); shape->SetStart( aElem.referencePoint.at( i ) );
@ -1790,9 +1786,8 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe
continue; continue;
} }
PCB_SHAPE* shape = new PCB_SHAPE( m_board ); PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::POLY );
m_board->Add( shape, ADD_MODE::APPEND ); m_board->Add( shape, ADD_MODE::APPEND );
shape->SetShape( SHAPE_T::POLY );
shape->SetFilled( true ); shape->SetFilled( true );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetWidth( 0 ); shape->SetWidth( 0 );
@ -1937,6 +1932,7 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
else else
{ {
shape.SetShape( SHAPE_T::ARC ); shape.SetShape( SHAPE_T::ARC );
double startradiant = DEG2RAD( elem.startangle ); double startradiant = DEG2RAD( elem.startangle );
wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * elem.radius ), wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * elem.radius ),
-KiROUND( std::sin( startradiant ) * elem.radius ) ); -KiROUND( std::sin( startradiant ) * elem.radius ) );
@ -2026,7 +2022,7 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
} }
else else
{ {
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( elem.component ); PCB_SHAPE* shape = HelperCreateAndAddShape( elem.component );
shape->SetArcCenter( elem.center ); shape->SetArcCenter( elem.center );
shape->SetWidth( elem.width ); shape->SetWidth( elem.width );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
@ -2047,7 +2043,7 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
shape->SetArcStart( elem.center + arcStartOffset ); shape->SetArcStart( elem.center + arcStartOffset );
} }
HelperDrawsegmentSetLocalCoord( shape, elem.component ); HelperShapeSetLocalCoord( shape, elem.component );
} }
} }
@ -2318,7 +2314,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
case ALTIUM_PAD_SHAPE::RECT: case ALTIUM_PAD_SHAPE::RECT:
{ {
// filled rect // filled rect
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component ); PCB_SHAPE* shape = HelperCreateAndAddShape( aElem.component );
shape->SetShape( SHAPE_T::POLY ); shape->SetShape( SHAPE_T::POLY );
shape->SetFilled( true ); shape->SetFilled( true );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
@ -2332,7 +2328,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
if( aElem.direction != 0 ) if( aElem.direction != 0 )
shape->Rotate( aElem.position, aElem.direction * 10 ); shape->Rotate( aElem.position, aElem.direction * 10 );
HelperDrawsegmentSetLocalCoord( shape, aElem.component ); HelperShapeSetLocalCoord( shape, aElem.component );
} }
break; break;
@ -2344,7 +2340,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
int cornerradius = aElem.sizeAndShape->cornerradius[0]; int cornerradius = aElem.sizeAndShape->cornerradius[0];
int offset = ( std::min( aElem.topsize.x, aElem.topsize.y ) * cornerradius ) / 200; int offset = ( std::min( aElem.topsize.x, aElem.topsize.y ) * cornerradius ) / 200;
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component ); PCB_SHAPE* shape = HelperCreateAndAddShape( aElem.component );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetWidth( offset * 2 ); shape->SetWidth( offset * 2 );
@ -2391,24 +2387,24 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
if( aElem.direction != 0 ) if( aElem.direction != 0 )
shape->Rotate( aElem.position, aElem.direction * 10 ); shape->Rotate( aElem.position, aElem.direction * 10 );
HelperDrawsegmentSetLocalCoord( shape, aElem.component ); HelperShapeSetLocalCoord( shape, aElem.component );
} }
else if( aElem.topsize.x == aElem.topsize.y ) else if( aElem.topsize.x == aElem.topsize.y )
{ {
// filled circle // filled circle
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component ); PCB_SHAPE* shape = HelperCreateAndAddShape( aElem.component );
shape->SetShape( SHAPE_T::CIRCLE ); shape->SetShape( SHAPE_T::CIRCLE );
shape->SetFilled( true ); shape->SetFilled( true );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetArcCenter( aElem.position ); shape->SetArcCenter( aElem.position );
shape->SetWidth( aElem.topsize.x / 2 ); shape->SetWidth( aElem.topsize.x / 2 );
shape->SetArcStart( aElem.position - wxPoint( 0, aElem.topsize.x / 4 ) ); shape->SetArcStart( aElem.position - wxPoint( 0, aElem.topsize.x / 4 ) );
HelperDrawsegmentSetLocalCoord( shape, aElem.component ); HelperShapeSetLocalCoord( shape, aElem.component );
} }
else else
{ {
// short line // short line
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component ); PCB_SHAPE* shape = HelperCreateAndAddShape( aElem.component );
shape->SetShape( SHAPE_T::SEGMENT ); shape->SetShape( SHAPE_T::SEGMENT );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetWidth( std::min( aElem.topsize.x, aElem.topsize.y ) ); shape->SetWidth( std::min( aElem.topsize.x, aElem.topsize.y ) );
@ -2429,14 +2425,14 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
if( aElem.direction != 0 ) if( aElem.direction != 0 )
shape->Rotate( aElem.position, aElem.direction * 10. ); shape->Rotate( aElem.position, aElem.direction * 10. );
HelperDrawsegmentSetLocalCoord( shape, aElem.component ); HelperShapeSetLocalCoord( shape, aElem.component );
} }
break; break;
case ALTIUM_PAD_SHAPE::OCTAGONAL: case ALTIUM_PAD_SHAPE::OCTAGONAL:
{ {
// filled octagon // filled octagon
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component ); PCB_SHAPE* shape = HelperCreateAndAddShape( aElem.component );
shape->SetShape( SHAPE_T::POLY ); shape->SetShape( SHAPE_T::POLY );
shape->SetFilled( true ); shape->SetFilled( true );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
@ -2457,7 +2453,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
if( aElem.direction != 0. ) if( aElem.direction != 0. )
shape->Rotate( aElem.position, aElem.direction * 10 ); shape->Rotate( aElem.position, aElem.direction * 10 );
HelperDrawsegmentSetLocalCoord( shape, aElem.component ); HelperShapeSetLocalCoord( shape, aElem.component );
} }
break; break;
@ -2554,8 +2550,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
if( elem.is_keepout || IsAltiumLayerAPlane( elem.layer ) ) if( elem.is_keepout || IsAltiumLayerAPlane( elem.layer ) )
{ {
PCB_SHAPE shape( nullptr ); // just a helper to get the graphic PCB_SHAPE shape( nullptr, SHAPE_T::SEGMENT );
shape.SetShape( SHAPE_T::SEGMENT );
shape.SetStart( elem.start ); shape.SetStart( elem.start );
shape.SetEnd( elem.end ); shape.SetEnd( elem.end );
shape.SetWidth( elem.width ); shape.SetWidth( elem.width );
@ -2619,13 +2614,13 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
} }
else else
{ {
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( elem.component ); PCB_SHAPE* shape = HelperCreateAndAddShape( elem.component );
shape->SetShape( SHAPE_T::SEGMENT ); shape->SetShape( SHAPE_T::SEGMENT );
shape->SetStart( elem.start ); shape->SetStart( elem.start );
shape->SetEnd( elem.end ); shape->SetEnd( elem.end );
shape->SetWidth( elem.width ); shape->SetWidth( elem.width );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
HelperDrawsegmentSetLocalCoord( shape, elem.component ); HelperShapeSetLocalCoord( shape, elem.component );
} }
reader.SkipSubrecord(); reader.SkipSubrecord();
@ -2891,10 +2886,8 @@ void ALTIUM_PCB::ParseFills6Data( const CFB::CompoundFileReader& aReader,
} }
else else
{ {
PCB_SHAPE* shape = new PCB_SHAPE( m_board ); PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::POLY );
m_board->Add( shape, ADD_MODE::APPEND ); m_board->Add( shape, ADD_MODE::APPEND );
shape->SetShape( SHAPE_T::POLY );
shape->SetFilled( true ); shape->SetFilled( true );
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetWidth( 0 ); shape->SetWidth( 0 );

View File

@ -185,8 +185,8 @@ private:
void HelperCreateBoardOutline( const std::vector<ALTIUM_VERTICE>& aVertices ); void HelperCreateBoardOutline( const std::vector<ALTIUM_VERTICE>& aVertices );
PCB_SHAPE* HelperCreateAndAddDrawsegment( uint16_t aComponent ); PCB_SHAPE* HelperCreateAndAddShape( uint16_t aComponent );
void HelperDrawsegmentSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponent ); void HelperShapeSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponent );
BOARD* m_board; BOARD* m_board;
std::vector<FOOTPRINT*> m_components; std::vector<FOOTPRINT*> m_components;

View File

@ -2004,8 +2004,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers()
if( shape->GetShape() == SHAPE_T::ARC ) if( shape->GetShape() == SHAPE_T::ARC )
{ {
TransformArcToPolygon( poly, shape->GetArcStart(), shape->GetArcMid(), TransformArcToPolygon( poly, shape->GetStart(), shape->GetArcMid(),
shape->GetArcEnd(), copperWidth, ARC_HIGH_DEF, shape->GetEnd(), copperWidth, ARC_HIGH_DEF,
ERROR_LOC::ERROR_INSIDE ); ERROR_LOC::ERROR_INSIDE );
} }
else else
@ -2660,14 +2660,9 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape,
PCB_SHAPE* shape; PCB_SHAPE* shape;
if( isFootprint( aContainer ) ) if( isFootprint( aContainer ) )
{
shape = new FP_SHAPE( (FOOTPRINT*) aContainer, SHAPE_T::POLY ); shape = new FP_SHAPE( (FOOTPRINT*) aContainer, SHAPE_T::POLY );
}
else else
{ shape = new PCB_SHAPE( aContainer, SHAPE_T::POLY );
shape = new PCB_SHAPE( aContainer );
shape->SetShape( SHAPE_T::POLY );
}
shape->SetFilled( true ); shape->SetFilled( true );
@ -2802,14 +2797,9 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
case VERTEX_TYPE::POINT: case VERTEX_TYPE::POINT:
if( isFootprint( aContainer ) ) if( isFootprint( aContainer ) )
{
shape = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), SHAPE_T::SEGMENT ); shape = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), SHAPE_T::SEGMENT );
}
else else
{ shape = new PCB_SHAPE( aContainer, SHAPE_T::SEGMENT );
shape = new PCB_SHAPE( aContainer );
shape->SetShape( SHAPE_T::SEGMENT );
}
shape->SetStart( startPoint ); shape->SetStart( startPoint );
shape->SetEnd( endPoint ); shape->SetEnd( endPoint );
@ -2824,14 +2814,9 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
case VERTEX_TYPE::ANTICLOCKWISE_ARC: case VERTEX_TYPE::ANTICLOCKWISE_ARC:
if( isFootprint( aContainer ) ) if( isFootprint( aContainer ) )
{
shape = new FP_SHAPE((FOOTPRINT*) aContainer, SHAPE_T::ARC ); shape = new FP_SHAPE((FOOTPRINT*) aContainer, SHAPE_T::ARC );
}
else else
{ shape = new PCB_SHAPE( aContainer, SHAPE_T::ARC );
shape = new PCB_SHAPE( aContainer );
shape->SetShape( SHAPE_T::ARC );
}
shape->SetArcStart( startPoint ); shape->SetArcStart( startPoint );
shape->SetArcCenter( centerPoint ); shape->SetArcCenter( centerPoint );
@ -2975,12 +2960,12 @@ SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes( const std::
if( shape->GetClass() == wxT( "MGRAPHIC" ) ) if( shape->GetClass() == wxT( "MGRAPHIC" ) )
{ {
FP_SHAPE* fp_shape = (FP_SHAPE*) shape; FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(), fp_shape->GetAngle() / 10.0 ); SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(), (double) fp_shape->GetAngle() / 10.0 );
lineChain.Append( arc ); lineChain.Append( arc );
} }
else else
{ {
SHAPE_ARC arc( shape->GetCenter(), shape->GetArcStart(), shape->GetAngle() / 10.0 ); SHAPE_ARC arc( shape->GetCenter(), shape->GetArcStart(), (double) shape->GetAngle() / 10.0 );
lineChain.Append( arc ); lineChain.Append( arc );
} }
} }
@ -3056,13 +3041,15 @@ std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(
if( shape->GetClass() == wxT( "MGRAPHIC" ) ) if( shape->GetClass() == wxT( "MGRAPHIC" ) )
{ {
FP_SHAPE* fp_shape = (FP_SHAPE*) shape; FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(),
(double) fp_shape->GetAngle() / 10.0 );
SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(), SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(),
fp_shape->GetAngle() / 10.0 ); fp_shape->GetAngle() / 10.0 );
track = new PCB_ARC( aParentContainer, &arc ); track = new PCB_ARC( aParentContainer, &arc );
} }
else else
{ {
SHAPE_ARC arc( shape->GetCenter(), shape->GetArcStart(), shape->GetAngle() / 10.0 ); SHAPE_ARC arc( shape->GetCenter(), shape->GetArcStart(), (double) shape->GetAngle() / 10.0 );
track = new PCB_ARC( aParentContainer, &arc ); track = new PCB_ARC( aParentContainer, &arc );
} }
break; break;

View File

@ -191,9 +191,9 @@ private:
* @param aContainer to draw on (e.g. m_board) * @param aContainer to draw on (e.g. m_board)
* @param aCadstarGroupID to add the text to * @param aCadstarGroupID to add the text to
* @param aCadstarLayerOverride if not empty, overrides the LayerID in aCadstarText * @param aCadstarLayerOverride if not empty, overrides the LayerID in aCadstarText
* @param aMoveVector move draw segment by this amount (in KiCad coordinates) * @param aMoveVector move text by this amount (in KiCad coordinates)
* @param aRotationAngle rotate draw segment by this amount (in tenth degrees) * @param aRotationAngle rotate text by this amount (in tenth degrees)
* @param aScalingFactor scale draw segment by this amount * @param aScalingFactor scale text by this amount
* @param aTransformCentre around which all transforms are applied (KiCad coordinates) * @param aTransformCentre around which all transforms are applied (KiCad coordinates)
* @param aMirrorInvert if true, it inverts the Mirror status of aCadstarText * @param aMirrorInvert if true, it inverts the Mirror status of aCadstarText
*/ */
@ -214,11 +214,11 @@ private:
* @param aShapeName for reporting warnings/errors to the user * @param aShapeName for reporting warnings/errors to the user
* @param aContainer to draw on (e.g. m_board) * @param aContainer to draw on (e.g. m_board)
* @param aCadstarGroupID to add the shape to * @param aCadstarGroupID to add the shape to
* @param aMoveVector move draw segment by this amount (in KiCad coordinates) * @param aMoveVector move shapes by this amount (in KiCad coordinates)
* @param aRotationAngle rotate draw segment by this amount (in tenth degrees) * @param aRotationAngle rotate shapes by this amount (in tenth degrees)
* @param aScalingFactor scale draw segment by this amount * @param aScalingFactor scale shapes by this amount
* @param aTransformCentre around which all transforms are applied (KiCad coordinates) * @param aTransformCentre around which all transforms are applied (KiCad coordinates)
* @param aMirrorInvert if true, mirrors the shape * @param aMirrorInvert if true, mirrors the shapes
*/ */
void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer, void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer,
const int& aLineThickness, const wxString& aShapeName, const int& aLineThickness, const wxString& aShapeName,
@ -230,17 +230,17 @@ private:
const bool& aMirrorInvert = false ); const bool& aMirrorInvert = false );
/** /**
* @brief Uses PCB_SHAPE to draw the cutouts on m_board object * @brief Uses PCB_SHAPEs to draw the cutouts on m_board object
* @param aVertices * @param aVertices
* @param aKiCadLayer KiCad layer to draw on * @param aKiCadLayer KiCad layer to draw on
* @param aLineThickness Thickness of line to draw with * @param aLineThickness Thickness of line to draw with
* @param aContainer to draw on (e.g. m_board) * @param aContainer to draw on (e.g. m_board)
* @param aCadstarGroupID to add the shape to * @param aCadstarGroupID to add the shapes to
* @param aMoveVector move draw segment by this amount (in KiCad coordinates) * @param aMoveVector move shapes by this amount (in KiCad coordinates)
* @param aRotationAngle rotate draw segment by this amount (in tenth degrees) * @param aRotationAngle rotate shapes by this amount (in tenth degrees)
* @param aScalingFactor scale draw segment by this amount * @param aScalingFactor scale shapes by this amount
* @param aTransformCentre around which all transforms are applied (KiCad coordinates) * @param aTransformCentre around which all transforms are applied (KiCad coordinates)
* @param aMirrorInvert if true, mirrors the drawsegments * @param aMirrorInvert if true, mirrors the shapes
*/ */
void drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts, void drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts,
const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness, const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
@ -259,11 +259,11 @@ private:
* @param aLineThickness Thickness of line to draw with * @param aLineThickness Thickness of line to draw with
* @param aContainer to draw on (e.g. m_board) * @param aContainer to draw on (e.g. m_board)
* @param aCadstarGroupID to add the shape to * @param aCadstarGroupID to add the shape to
* @param aMoveVector move draw segment by this amount (in KiCad coordinates) * @param aMoveVector move shape by this amount (in KiCad coordinates)
* @param aRotationAngle rotate draw segment by this amount (in tenth degrees) * @param aRotationAngle rotate shape by this amount (in tenth degrees)
* @param aScalingFactor scale draw segment by this amount * @param aScalingFactor scale shape by this amount
* @param aTransformCentre around which all transforms are applied (KiCad coordinates) * @param aTransformCentre around which all transforms are applied (KiCad coordinates)
* @param aMirrorInvert if true, mirrors the drawsegment * @param aMirrorInvert if true, mirrors the shape
* @param aCadstarGroupID to add the shape to * @param aCadstarGroupID to add the shape to
*/ */
void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices, void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
@ -281,11 +281,11 @@ private:
* @param aCadstarVertices * @param aCadstarVertices
* @param aContainer to draw on (e.g. m_board). Can be nullptr. * @param aContainer to draw on (e.g. m_board). Can be nullptr.
* @param aCadstarGroupID to add the shape to * @param aCadstarGroupID to add the shape to
* @param aMoveVector move draw segment by this amount (in KiCad coordinates) * @param aMoveVector move shapes by this amount (in KiCad coordinates)
* @param aRotationAngle rotate draw segment by this amount (in tenth degrees) * @param aRotationAngle rotate shapes by this amount (in tenth degrees)
* @param aScalingFactor scale draw segment by this amount * @param aScalingFactor scale shapes by this amount
* @param aTransformCentre around which all transforms are applied (KiCad coordinates) * @param aTransformCentre around which all transforms are applied (KiCad coordinates)
* @param aMirrorInvert if true, mirrors the drawsegment * @param aMirrorInvert if true, mirrors the shapes
* @return * @return
*/ */
std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices, std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices,
@ -303,11 +303,11 @@ private:
* @param aCadstarVertex * @param aCadstarVertex
* @param aContainer to draw on (e.g. m_board). Can be nullptr. * @param aContainer to draw on (e.g. m_board). Can be nullptr.
* @param aCadstarGroupID to add the shape to * @param aCadstarGroupID to add the shape to
* @param aMoveVector move draw segment by this amount (in KiCad coordinates) * @param aMoveVector move shapes by this amount (in KiCad coordinates)
* @param aRotationAngle rotate draw segment by this amount (in tenth degrees) * @param aRotationAngle rotate shapes by this amount (in tenth degrees)
* @param aScalingFactor scale draw segment by this amount * @param aScalingFactor scale shapes by this amount
* @param aTransformCentre around which all transforms are applied (KiCad coordinates) * @param aTransformCentre around which all transforms are applied (KiCad coordinates)
* @param aMirrorInvert if true, mirrors the drawsegment * @param aMirrorInvert if true, mirrors the shapes
* @return * @return
*/ */
PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint, PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint,
@ -335,11 +335,11 @@ private:
* @param aCadstarShape * @param aCadstarShape
* @param aLineThickness Thickness of line is used for expanding the polygon by half. * @param aLineThickness Thickness of line is used for expanding the polygon by half.
* @param aContainer to draw on (e.g. m_board). Can be nullptr. * @param aContainer to draw on (e.g. m_board). Can be nullptr.
* @param aMoveVector move draw segment by this amount (in KiCad coordinates) * @param aMoveVector move poly by this amount (in KiCad coordinates)
* @param aRotationAngle rotate draw segment by this amount (in tenth degrees) * @param aRotationAngle rotate poly by this amount (in tenth degrees)
* @param aScalingFactor scale draw segment by this amount * @param aScalingFactor scale poly by this amount
* @param aTransformCentre around which all transforms are applied (KiCad coordinates) * @param aTransformCentre around which all transforms are applied (KiCad coordinates)
* @param aMirrorInvert if true, mirrors the shape * @param aMirrorInvert if true, mirrors the poly
* @return * @return
*/ */
SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape, SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape,
@ -361,12 +361,13 @@ private:
/** /**
* @brief Returns a vector of pointers to TRACK/ARC objects. Caller owns the objects * @brief Returns a vector of pointers to TRACK/ARC objects. Caller owns the objects
* @param aShapes * @param aShapes
* @param aParentContainer sets this as the parent of each TRACK object and Add()s it to the parent * @param aParentContainer sets this as the parent of each TRACK object and Add()s it to the
* parent
* @param aNet sets all the tracks to this net, unless nullptr * @param aNet sets all the tracks to this net, unless nullptr
* @param aLayerOverride Sets all tracks to this layer, or, if it is UNDEFINED_LAYER, uses the layers * @param aLayerOverride Sets all tracks to this layer, or, if it is UNDEFINED_LAYER, uses the
* in the DrawSegments * layers in the shapes
* @param aWidthOverride Sets all tracks to this width, or, if it is UNDEFINED_LAYER, uses the width * @param aWidthOverride Sets all tracks to this width, or, if it is UNDEFINED_LAYER, uses the
* in the DrawSegments * width in the shapes
* @return * @return
*/ */
std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*> aShapes, std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*> aShapes,

View File

@ -896,10 +896,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER ) // unsupported layer if( layer != UNDEFINED_LAYER ) // unsupported layer
{ {
PCB_SHAPE* shape = new PCB_SHAPE( m_board ); PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::CIRCLE );
m_board->Add( shape, ADD_MODE::APPEND ); m_board->Add( shape, ADD_MODE::APPEND );
shape->SetShape( SHAPE_T::CIRCLE );
shape->SetFilled( false ); shape->SetFilled( false );
shape->SetLayer( layer ); shape->SetLayer( layer );
shape->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) ); shape->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );

View File

@ -2755,8 +2755,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
{ {
const GRAPHIC_LINE* src = static_cast<const GRAPHIC_LINE*>( seg.get() ); const GRAPHIC_LINE* src = static_cast<const GRAPHIC_LINE*>( seg.get() );
PCB_SHAPE* line = new PCB_SHAPE( aBoard ); PCB_SHAPE* line = new PCB_SHAPE( aBoard, SHAPE_T::SEGMENT );
line->SetShape( SHAPE_T::SEGMENT );
line->SetLayer( layer ); line->SetLayer( layer );
line->SetStart( wxPoint( src->start_x, src->start_y ) ); line->SetStart( wxPoint( src->start_x, src->start_y ) );
line->SetEnd( wxPoint( src->end_x, src->end_y ) ); line->SetEnd( wxPoint( src->end_x, src->end_y ) );
@ -2772,8 +2771,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
{ {
const GRAPHIC_ARC* src = static_cast<const GRAPHIC_ARC*>( seg.get() ); const GRAPHIC_ARC* src = static_cast<const GRAPHIC_ARC*>( seg.get() );
PCB_SHAPE* arc = new PCB_SHAPE( aBoard ); PCB_SHAPE* arc = new PCB_SHAPE( aBoard, SHAPE_T::ARC );
arc->SetShape( SHAPE_T::ARC );
arc->SetLayer( layer ); arc->SetLayer( layer );
arc->SetArcCenter( wxPoint( src->center_x, src->center_y )); arc->SetArcCenter( wxPoint( src->center_x, src->center_y ));
arc->SetArcStart( wxPoint( src->start_x, src->start_y ) ); arc->SetArcStart( wxPoint( src->start_x, src->start_y ) );
@ -2791,8 +2789,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
const GRAPHIC_RECTANGLE *src = const GRAPHIC_RECTANGLE *src =
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() ); static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
PCB_SHAPE* rect = new PCB_SHAPE( aBoard ); PCB_SHAPE* rect = new PCB_SHAPE( aBoard, SHAPE_T::RECT );
rect->SetShape( SHAPE_T::RECT );
rect->SetLayer( layer ); rect->SetLayer( layer );
rect->SetStart( wxPoint( src->start_x, src->start_y ) ); rect->SetStart( wxPoint( src->start_x, src->start_y ) );
rect->SetEnd( wxPoint( src->end_x, src->end_y ) ); rect->SetEnd( wxPoint( src->end_x, src->end_y ) );
@ -2803,8 +2800,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
} }
case GR_SHAPE_TEXT: case GR_SHAPE_TEXT:
{ {
const GRAPHIC_TEXT *src = const GRAPHIC_TEXT *src = static_cast<const GRAPHIC_TEXT*>( seg.get() );
static_cast<const GRAPHIC_TEXT*>( seg.get() );
PCB_TEXT* txt = new PCB_TEXT( aBoard ); PCB_TEXT* txt = new PCB_TEXT( aBoard );
txt->SetLayer( layer ); txt->SetLayer( layer );
@ -2856,9 +2852,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
if( poly_outline.OutlineCount() < 1 || poly_outline.COutline( 0 ).PointCount() < 3 ) if( poly_outline.OutlineCount() < 1 || poly_outline.COutline( 0 ).PointCount() < 3 )
continue; continue;
PCB_SHAPE* new_poly = new PCB_SHAPE( aBoard ); PCB_SHAPE* new_poly = new PCB_SHAPE( aBoard, SHAPE_T::POLY );
new_poly->SetShape( SHAPE_T::POLY );
new_poly->SetLayer( layer ); new_poly->SetLayer( layer );
new_poly->SetPolyShape( poly_outline ); new_poly->SetPolyShape( poly_outline );
new_poly->SetWidth( 0 ); new_poly->SetWidth( 0 );
@ -2879,8 +2873,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
{ {
const GRAPHIC_LINE* src = static_cast<const GRAPHIC_LINE*>( seg.get() ); const GRAPHIC_LINE* src = static_cast<const GRAPHIC_LINE*>( seg.get() );
PCB_SHAPE* line = new PCB_SHAPE( aBoard ); PCB_SHAPE* line = new PCB_SHAPE( aBoard, SHAPE_T::SEGMENT );
line->SetShape( SHAPE_T::SEGMENT );
line->SetLayer( layer ); line->SetLayer( layer );
line->SetStart( wxPoint( src->start_x, src->start_y ) ); line->SetStart( wxPoint( src->start_x, src->start_y ) );
line->SetEnd( wxPoint( src->end_x, src->end_y ) ); line->SetEnd( wxPoint( src->end_x, src->end_y ) );
@ -2893,8 +2886,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
{ {
const GRAPHIC_ARC* src = static_cast<const GRAPHIC_ARC*>( seg.get() ); const GRAPHIC_ARC* src = static_cast<const GRAPHIC_ARC*>( seg.get() );
PCB_SHAPE* arc = new PCB_SHAPE( aBoard ); PCB_SHAPE* arc = new PCB_SHAPE( aBoard, SHAPE_T::ARC );
arc->SetShape( SHAPE_T::ARC );
arc->SetLayer( layer ); arc->SetLayer( layer );
arc->SetArcCenter( wxPoint( src->center_x, src->center_y )); arc->SetArcCenter( wxPoint( src->center_x, src->center_y ));
arc->SetArcStart( wxPoint( src->start_x, src->start_y ) ); arc->SetArcStart( wxPoint( src->start_x, src->start_y ) );
@ -2909,8 +2901,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
const GRAPHIC_RECTANGLE *src = const GRAPHIC_RECTANGLE *src =
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() ); static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
PCB_SHAPE* rect = new PCB_SHAPE( aBoard ); PCB_SHAPE* rect = new PCB_SHAPE( aBoard, SHAPE_T::RECT );
rect->SetShape( SHAPE_T::RECT );
rect->SetLayer( layer ); rect->SetLayer( layer );
rect->SetStart( wxPoint( src->start_x, src->start_y ) ); rect->SetStart( wxPoint( src->start_x, src->start_y ) );
rect->SetEnd( wxPoint( src->end_x, src->end_y ) ); rect->SetEnd( wxPoint( src->end_x, src->end_y ) );
@ -2951,7 +2942,8 @@ bool FABMASTER::orderZones( BOARD* aBoard )
std::vector<ZONE*> zones = aBoard->Zones(); std::vector<ZONE*> zones = aBoard->Zones();
std::sort( zones.begin(), zones.end(), std::sort( zones.begin(), zones.end(),
[&]( const ZONE* a, const ZONE* b ) { [&]( const ZONE* a, const ZONE* b )
{
if( a->GetLayer() == b->GetLayer() ) if( a->GetLayer() == b->GetLayer() )
return a->GetBoundingBox().GetArea() > b->GetBoundingBox().GetArea(); return a->GetBoundingBox().GetArea() > b->GetBoundingBox().GetArea();
@ -3003,14 +2995,10 @@ bool FABMASTER::LoadBoard( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter )
checkpoint(); checkpoint();
if( track->lclass == "ETCH" ) if( track->lclass == "ETCH" )
{
loadEtch( aBoard, track); loadEtch( aBoard, track);
}
else if( track->layer == "OUTLINE" ) else if( track->layer == "OUTLINE" )
{
loadOutline( aBoard, track ); loadOutline( aBoard, track );
} }
}
orderZones( aBoard ); orderZones( aBoard );

View File

@ -463,9 +463,8 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
aLineReader->LineNumber(), 0 ); aLineReader->LineNumber(), 0 );
} }
FP_SHAPE* shape = new FP_SHAPE( footprint.get() ); FP_SHAPE* shape = new FP_SHAPE( footprint.get(), SHAPE_T::SEGMENT );
shape->SetLayer( F_SilkS ); shape->SetLayer( F_SilkS );
shape->SetShape( SHAPE_T::SEGMENT );
shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ), shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) ) ); parseInt( parameters[3], conv_unit ) ) );
shape->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ), shape->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ),
@ -487,9 +486,8 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
} }
// Pcbnew does know ellipse so we must have Width = Height // Pcbnew does know ellipse so we must have Width = Height
FP_SHAPE* shape = new FP_SHAPE( footprint.get() ); FP_SHAPE* shape = new FP_SHAPE( footprint.get(), SHAPE_T::ARC );
shape->SetLayer( F_SilkS ); shape->SetLayer( F_SilkS );
shape->SetShape( SHAPE_T::ARC );
footprint->Add( shape ); footprint->Add( shape );
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses // for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses

View File

@ -905,8 +905,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
break; break;
default: default:
wxFAIL_MSG( "PCB_IO::format cannot format unknown PCB_SHAPE shape:" wxFAIL_MSG( "PCB_IO::format not implemented for " + aShape->SHAPE_T_asString() );
+ aShape->SHAPE_T_asString() );
return; return;
}; };
@ -1039,8 +1038,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
break; break;
default: default:
wxFAIL_MSG( "PCB_IO::format cannot format unknown FP_SHAPE shape:" wxFAIL_MSG( "PCB_IO::format not implemented for " + aFPShape->SHAPE_T_asString() );
+ aFPShape->SHAPE_T_asString() );
return; return;
}; };

View File

@ -191,11 +191,10 @@ void PCB_ARC::AddToFootprint( FOOTPRINT* aFootprint )
void PCB_ARC::AddToBoard() void PCB_ARC::AddToBoard()
{ {
PCB_SHAPE* arc = new PCB_SHAPE( m_board ); PCB_SHAPE* arc = new PCB_SHAPE( m_board, IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC );
m_board->Add( arc, ADD_MODE::APPEND ); m_board->Add( arc, ADD_MODE::APPEND );
arc->SetShape( IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC );
arc->SetFilled( false ); arc->SetFilled( false );
arc->SetLayer( m_KiCadLayer ); arc->SetLayer( m_KiCadLayer );
arc->SetStart( wxPoint( m_positionX, m_positionY ) ); arc->SetStart( wxPoint( m_positionX, m_positionY ) );

View File

@ -689,9 +689,8 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
} }
else else
{ {
PCB_SHAPE* graphic = new PCB_SHAPE; PCB_SHAPE* graphic = new PCB_SHAPE( nullptr, SHAPE_T::SEGMENT );
graphic->SetShape( SHAPE_T::SEGMENT );
graphic->SetLayer( targetLayer ); graphic->SetLayer( targetLayer );
graphic->SetStart( wxPoint( seg.A ) ); graphic->SetStart( wxPoint( seg.A ) );
graphic->SetEnd( wxPoint( seg.B ) ); graphic->SetEnd( wxPoint( seg.B ) );

View File

@ -1612,8 +1612,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
// If the user clicks on an existing snap point from a drawsegment // If the user clicks on an existing snap point from a drawsegment
// we finish the segment as they are likely closing a path // we finish the segment as they are likely closing a path
if( snapItem if( snapItem && ( shape == SHAPE_T::RECT || graphic->GetLength() > 0.0 ) )
&& ( shape == SHAPE_T::RECT || graphic->GetLength() > 0.0 ) )
{ {
commit.Add( graphic ); commit.Add( graphic );
commit.Push( _( "Draw a line segment" ) ); commit.Push( _( "Draw a line segment" ) );

View File

@ -705,8 +705,7 @@ void PAD_TOOL::recombinePad( PAD* aPad )
aPad->SetOffset( wxPoint( 0, 0 ) ); aPad->SetOffset( wxPoint( 0, 0 ) );
PCB_SHAPE* shape = new PCB_SHAPE; PCB_SHAPE* shape = new PCB_SHAPE( nullptr, SHAPE_T::POLY );
shape->SetShape( SHAPE_T::POLY );
shape->SetFilled( true ); shape->SetFilled( true );
shape->SetWidth( 0 ); shape->SetWidth( 0 );
shape->SetPolyShape( existingOutline ); shape->SetPolyShape( existingOutline );