Naming conventions and a bug fix on arc points.

This commit is contained in:
Jeff Young 2021-07-18 13:31:56 +01:00
parent 9cb4c9bfc2
commit e61822c9e0
40 changed files with 475 additions and 459 deletions

View File

@ -257,10 +257,10 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
} }
// For Bezier curve: // For Bezier curve:
m_bezierCtrl1X.SetValue( m_item->GetBezControl1().x ); m_bezierCtrl1X.SetValue( m_item->GetBezierC1().x );
m_bezierCtrl1Y.SetValue( m_item->GetBezControl1().y ); m_bezierCtrl1Y.SetValue( m_item->GetBezierC1().y );
m_bezierCtrl2X.SetValue( m_item->GetBezControl2().x ); m_bezierCtrl2X.SetValue( m_item->GetBezierC2().x );
m_bezierCtrl2Y.SetValue( m_item->GetBezControl2().y ); m_bezierCtrl2Y.SetValue( m_item->GetBezierC2().y );
m_filledCtrl->SetValue( m_item->IsFilled() ); m_filledCtrl->SetValue( m_item->IsFilled() );
m_locked->SetValue( m_item->IsLocked() ); m_locked->SetValue( m_item->IsLocked() );
@ -329,8 +329,8 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
// For Bezier curve: Set the two control points // For Bezier curve: Set the two control points
if( m_item->GetShape() == PCB_SHAPE_TYPE::CURVE ) if( m_item->GetShape() == PCB_SHAPE_TYPE::CURVE )
{ {
m_item->SetBezControl1( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue() ) ); m_item->SetBezierC1( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue()));
m_item->SetBezControl2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue() ) ); m_item->SetBezierC2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue()));
} }
if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC ) if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
@ -347,8 +347,8 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
if( m_fp_item->GetShape() == PCB_SHAPE_TYPE::CURVE ) if( m_fp_item->GetShape() == PCB_SHAPE_TYPE::CURVE )
{ {
m_fp_item->SetBezier0_C1( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue() ) ); m_fp_item->SetBezierC1_0( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue()));
m_fp_item->SetBezier0_C2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue() ) ); m_fp_item->SetBezierC2_0( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue()));
} }
} }

View File

@ -101,10 +101,10 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
m_startY.SetValue( m_shape->GetStart().y ); m_startY.SetValue( m_shape->GetStart().y );
m_endX.SetValue( m_shape->GetEnd().x ); m_endX.SetValue( m_shape->GetEnd().x );
m_endY.SetValue( m_shape->GetEnd().y ); m_endY.SetValue( m_shape->GetEnd().y );
m_ctrl1X.SetValue( m_shape->GetBezControl1().x ); m_ctrl1X.SetValue( m_shape->GetBezierC1().x );
m_ctrl1Y.SetValue( m_shape->GetBezControl1().y ); m_ctrl1Y.SetValue( m_shape->GetBezierC1().y );
m_ctrl2X.SetValue( m_shape->GetBezControl2().x ); m_ctrl2X.SetValue( m_shape->GetBezierC2().x );
m_ctrl2Y.SetValue( m_shape->GetBezControl2().y ); m_ctrl2Y.SetValue( m_shape->GetBezierC2().y );
m_radius.Show( false ); m_radius.Show( false );
m_filledCtrl->Show( false ); m_filledCtrl->Show( false );
break; break;
@ -192,8 +192,8 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow()
case PCB_SHAPE_TYPE::CURVE: // Segment with rounded ends case PCB_SHAPE_TYPE::CURVE: // Segment with rounded ends
m_shape->SetStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) ); m_shape->SetStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
m_shape->SetEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) ); m_shape->SetEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
m_shape->SetBezControl1( wxPoint( m_ctrl1X.GetValue(), m_ctrl1Y.GetValue() ) ); m_shape->SetBezierC1( wxPoint( m_ctrl1X.GetValue(), m_ctrl1Y.GetValue()));
m_shape->SetBezControl1( wxPoint( m_ctrl2X.GetValue(), m_ctrl2Y.GetValue() ) ); m_shape->SetBezierC1( wxPoint( m_ctrl2X.GetValue(), m_ctrl2Y.GetValue()));
break; break;
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends

View File

@ -1212,43 +1212,44 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
{ {
case PCB_SHAPE_TYPE::SEGMENT: case PCB_SHAPE_TYPE::SEGMENT:
fprintf( aFile, "LINE %g %g %g %g\n", fprintf( aFile, "LINE %g %g %g %g\n",
shape->m_Start0.x / SCALE_FACTOR, shape->GetStart0().x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR, -shape->GetStart0().y / SCALE_FACTOR,
shape->m_End0.x / SCALE_FACTOR, shape->GetEnd0().x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR ); -shape->GetEnd0().y / SCALE_FACTOR );
break; break;
case PCB_SHAPE_TYPE::RECT: case PCB_SHAPE_TYPE::RECT:
{ {
fprintf( aFile, "LINE %g %g %g %g\n", fprintf( aFile, "LINE %g %g %g %g\n",
shape->m_Start0.x / SCALE_FACTOR, shape->GetStart0().x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR, -shape->GetStart0().y / SCALE_FACTOR,
shape->m_End0.x / SCALE_FACTOR, shape->GetEnd0().x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR ); -shape->GetStart0().y / SCALE_FACTOR );
fprintf( aFile, "LINE %g %g %g %g\n", fprintf( aFile, "LINE %g %g %g %g\n",
shape->m_End0.x / SCALE_FACTOR, shape->GetEnd0().x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR, -shape->GetStart0().y / SCALE_FACTOR,
shape->m_End0.x / SCALE_FACTOR, shape->GetEnd0().x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR ); -shape->GetEnd0().y / SCALE_FACTOR );
fprintf( aFile, "LINE %g %g %g %g\n", fprintf( aFile, "LINE %g %g %g %g\n",
shape->m_End0.x / SCALE_FACTOR, shape->GetEnd0().x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR, -shape->GetEnd0().y / SCALE_FACTOR,
shape->m_Start0.x / SCALE_FACTOR, shape->GetStart0().x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR ); -shape->GetEnd0().y / SCALE_FACTOR );
fprintf( aFile, "LINE %g %g %g %g\n", fprintf( aFile, "LINE %g %g %g %g\n",
shape->m_Start0.x / SCALE_FACTOR, shape->GetStart0().x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR, -shape->GetEnd0().y / SCALE_FACTOR,
shape->m_Start0.x / SCALE_FACTOR, shape->GetStart0().x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR ); -shape->GetStart0().y / SCALE_FACTOR );
} }
break; break;
case PCB_SHAPE_TYPE::CIRCLE: case PCB_SHAPE_TYPE::CIRCLE:
{ {
int radius = KiROUND( GetLineLength( shape->m_End0, shape->m_Start0 ) ); int radius = KiROUND( GetLineLength( shape->GetEnd0(), shape->GetStart0() ) );
fprintf( aFile, "CIRCLE %g %g %g\n", fprintf( aFile, "CIRCLE %g %g %g\n",
shape->m_Start0.x / SCALE_FACTOR, shape->GetStart0().x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR, -shape->GetStart0().y / SCALE_FACTOR,
radius / SCALE_FACTOR ); radius / SCALE_FACTOR );
break; break;
} }
@ -1256,14 +1257,14 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
case PCB_SHAPE_TYPE::ARC: case PCB_SHAPE_TYPE::ARC:
{ {
int arcendx, arcendy; int arcendx, arcendy;
arcendx = shape->m_End0.x - shape->m_Start0.x; arcendx = shape->GetEnd0().x - shape->GetStart0().x;
arcendy = shape->m_End0.y - shape->m_Start0.y; arcendy = shape->GetEnd0().y - shape->GetStart0().y;
RotatePoint( &arcendx, &arcendy, -shape->GetAngle() ); RotatePoint( &arcendx, &arcendy, -shape->GetAngle() );
arcendx += shape->GetStart0().x; arcendx += shape->GetStart0().x;
arcendy += shape->GetStart0().y; arcendy += shape->GetStart0().y;
fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n",
shape->m_End0.x / SCALE_FACTOR, shape->GetEnd0().x / SCALE_FACTOR,
-shape->GetEnd0().y / SCALE_FACTOR, -shape->GetEnd0().y / SCALE_FACTOR,
arcendx / SCALE_FACTOR, arcendx / SCALE_FACTOR,
-arcendy / SCALE_FACTOR, -arcendy / SCALE_FACTOR,

View File

@ -57,25 +57,25 @@ void FP_SHAPE::SetLocalCoord()
if( fp == NULL ) if( fp == NULL )
{ {
m_Start0 = m_start; m_start0 = m_start;
m_End0 = m_end; m_end0 = m_end;
m_ThirdPoint0 = m_thirdPoint; m_thirdPoint0 = m_thirdPoint;
m_Bezier0_C1 = m_bezierC1; m_bezierC1_0 = m_bezierC1;
m_Bezier0_C2 = m_bezierC2; m_bezierC2_0 = m_bezierC2;
return; return;
} }
m_Start0 = m_start - fp->GetPosition(); m_start0 = m_start - fp->GetPosition();
m_End0 = m_end - fp->GetPosition(); m_end0 = m_end - fp->GetPosition();
m_ThirdPoint0 = m_thirdPoint - fp->GetPosition(); m_thirdPoint0 = m_thirdPoint - fp->GetPosition();
m_Bezier0_C1 = m_bezierC1 - fp->GetPosition(); m_bezierC1_0 = m_bezierC1 - fp->GetPosition();
m_Bezier0_C2 = m_bezierC2 - fp->GetPosition(); m_bezierC2_0 = m_bezierC2 - fp->GetPosition();
double angle = fp->GetOrientation(); double angle = fp->GetOrientation();
RotatePoint( &m_Start0.x, &m_Start0.y, -angle ); RotatePoint( &m_start0.x, &m_start0.y, -angle );
RotatePoint( &m_End0.x, &m_End0.y, -angle ); RotatePoint( &m_end0.x, &m_end0.y, -angle );
RotatePoint( &m_ThirdPoint0.x, &m_ThirdPoint0.y, -angle ); RotatePoint( &m_thirdPoint0.x, &m_thirdPoint0.y, -angle );
RotatePoint( &m_Bezier0_C1.x, &m_Bezier0_C1.y, -angle ); RotatePoint( &m_bezierC1_0.x, &m_bezierC1_0.y, -angle );
RotatePoint( &m_Bezier0_C2.x, &m_Bezier0_C2.y, -angle ); RotatePoint( &m_bezierC2_0.x, &m_bezierC2_0.y, -angle );
} }
@ -83,11 +83,11 @@ void FP_SHAPE::SetDrawCoord()
{ {
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent ); FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
m_start = m_Start0; m_start = m_start0;
m_end = m_End0; m_end = m_end0;
m_thirdPoint = m_ThirdPoint0; m_thirdPoint = m_thirdPoint0;
m_bezierC1 = m_Bezier0_C1; m_bezierC1 = m_bezierC1_0;
m_bezierC2 = m_Bezier0_C2; m_bezierC2 = m_bezierC2_0;
if( fp ) if( fp )
{ {
@ -146,11 +146,11 @@ void FP_SHAPE::SetAngle( double aAngle, bool aUpdateEnd )
// Update the parent class (updates the global m_ThirdPoint) // Update the parent class (updates the global m_ThirdPoint)
PCB_SHAPE::SetAngle( aAngle, aUpdateEnd ); PCB_SHAPE::SetAngle( aAngle, aUpdateEnd );
// Also update the local m_ThirdPoint0 if requested // Also update the local m_thirdPoint0 if requested
if( aUpdateEnd ) if( aUpdateEnd )
{ {
m_ThirdPoint0 = m_End0; m_thirdPoint0 = m_end0;
RotatePoint( &m_ThirdPoint0, m_Start0, -m_angle ); RotatePoint( &m_thirdPoint0, m_start0, -m_angle );
} }
} }
@ -162,7 +162,7 @@ void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
switch( GetShape() ) switch( GetShape() )
{ {
case PCB_SHAPE_TYPE::ARC: case PCB_SHAPE_TYPE::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;
@ -172,7 +172,7 @@ void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
case PCB_SHAPE_TYPE::CURVE: case PCB_SHAPE_TYPE::CURVE:
// If Start0 and Start are equal (ie: Footprint Editor), then flip both sets around the // If Start0 and Start are equal (ie: Footprint Editor), then flip both sets around the
// centre point. // centre point.
if( m_start == m_Start0 ) if( m_start == m_start0 )
pt = aCentre; pt = aCentre;
if( aFlipLeftRight ) if( aFlipLeftRight )
@ -182,11 +182,11 @@ void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
MIRROR( m_thirdPoint.x, aCentre.x ); MIRROR( m_thirdPoint.x, aCentre.x );
MIRROR( m_bezierC1.x, aCentre.x ); MIRROR( m_bezierC1.x, aCentre.x );
MIRROR( m_bezierC2.x, aCentre.x ); MIRROR( m_bezierC2.x, aCentre.x );
MIRROR( m_Start0.x, pt.x ); MIRROR( m_start0.x, pt.x );
MIRROR( m_End0.x, pt.x ); MIRROR( m_end0.x, pt.x );
MIRROR( m_ThirdPoint0.x, pt.x ); MIRROR( m_thirdPoint0.x, pt.x );
MIRROR( m_Bezier0_C1.x, pt.x ); MIRROR( m_bezierC1_0.x, pt.x );
MIRROR( m_Bezier0_C2.x, pt.x ); MIRROR( m_bezierC2_0.x, pt.x );
} }
else else
{ {
@ -195,11 +195,11 @@ void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
MIRROR( m_thirdPoint.y, aCentre.y ); MIRROR( m_thirdPoint.y, aCentre.y );
MIRROR( m_bezierC1.y, aCentre.y ); MIRROR( m_bezierC1.y, aCentre.y );
MIRROR( m_bezierC2.y, aCentre.y ); MIRROR( m_bezierC2.y, aCentre.y );
MIRROR( m_Start0.y, pt.y ); MIRROR( m_start0.y, pt.y );
MIRROR( m_End0.y, pt.y ); MIRROR( m_end0.y, pt.y );
MIRROR( m_ThirdPoint0.y, pt.y ); MIRROR( m_thirdPoint0.y, pt.y );
MIRROR( m_Bezier0_C1.y, pt.y ); MIRROR( m_bezierC1_0.y, pt.y );
MIRROR( m_Bezier0_C2.y, pt.y ); MIRROR( m_bezierC2_0.y, pt.y );
} }
RebuildBezierToSegmentsPointsList( m_width ); RebuildBezierToSegmentsPointsList( m_width );
@ -229,7 +229,7 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
switch( GetShape() ) switch( GetShape() )
{ {
case PCB_SHAPE_TYPE::ARC: case PCB_SHAPE_TYPE::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;
@ -239,19 +239,19 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
case PCB_SHAPE_TYPE::SEGMENT: case PCB_SHAPE_TYPE::SEGMENT:
if( aMirrorAroundXAxis ) if( aMirrorAroundXAxis )
{ {
MIRROR( m_Start0.y, aCentre.y ); MIRROR( m_start0.y, aCentre.y );
MIRROR( m_End0.y, aCentre.y ); MIRROR( m_end0.y, aCentre.y );
MIRROR( m_ThirdPoint0.y, aCentre.y ); MIRROR( m_thirdPoint0.y, aCentre.y );
MIRROR( m_Bezier0_C1.y, aCentre.y ); MIRROR( m_bezierC1_0.y, aCentre.y );
MIRROR( m_Bezier0_C2.y, aCentre.y ); MIRROR( m_bezierC2_0.y, aCentre.y );
} }
else else
{ {
MIRROR( m_Start0.x, aCentre.x ); MIRROR( m_start0.x, aCentre.x );
MIRROR( m_End0.x, aCentre.x ); MIRROR( m_end0.x, aCentre.x );
MIRROR( m_ThirdPoint0.x, aCentre.x ); MIRROR( m_thirdPoint0.x, aCentre.x );
MIRROR( m_Bezier0_C1.x, aCentre.x ); MIRROR( m_bezierC1_0.x, aCentre.x );
MIRROR( m_Bezier0_C2.x, aCentre.x ); MIRROR( m_bezierC2_0.x, aCentre.x );
} }
for( unsigned ii = 0; ii < m_bezierPoints.size(); ii++ ) for( unsigned ii = 0; ii < m_bezierPoints.size(); ii++ )
@ -290,11 +290,11 @@ void FP_SHAPE::Move( const wxPoint& aMoveVector )
{ {
// Move an edge of the footprint. // Move an edge of the footprint.
// This is a footprint shape modification. // This is a footprint shape modification.
m_Start0 += aMoveVector; m_start0 += aMoveVector;
m_End0 += aMoveVector; m_end0 += aMoveVector;
m_ThirdPoint0 += aMoveVector; m_thirdPoint0 += aMoveVector;
m_Bezier0_C1 += aMoveVector; m_bezierC1_0 += aMoveVector;
m_Bezier0_C2 += aMoveVector; m_bezierC2_0 += aMoveVector;
switch( GetShape() ) switch( GetShape() )
{ {

View File

@ -71,7 +71,7 @@ public:
* Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees. * Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
* @param aAngle is tenths of degrees, but will soon be degrees. * @param aAngle is tenths of degrees, but will soon be degrees.
* @param aUpdateEnd = true to update also arc end coordinates m_thirdPoint and * @param aUpdateEnd = true to update also arc end coordinates m_thirdPoint and
* m_ThirdPoint0, so must be called after setting m_Start, m_Start0, m_End and m_End0 * m_thirdPoint0, so must be called after setting m_Start, m_start0, m_End and m_end0
*/ */
void SetAngle( double aAngle, bool aUpdateEnd = true ) override; void SetAngle( double aAngle, bool aUpdateEnd = true ) override;
@ -108,20 +108,20 @@ public:
bool IsParentFlipped() const; bool IsParentFlipped() const;
void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; } void SetStart0( const wxPoint& aPoint ) { m_start0 = aPoint; }
const wxPoint& GetStart0() const { return m_Start0; } const wxPoint& GetStart0() const { return m_start0; }
void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; } void SetEnd0( const wxPoint& aPoint ) { m_end0 = aPoint; }
const wxPoint& GetEnd0() const { return m_End0; } const wxPoint& GetEnd0() const { return m_end0; }
void SetThirdPoint0( const wxPoint& aPoint ){ m_ThirdPoint0 = aPoint; } void SetThirdPoint0( const wxPoint& aPoint ){ m_thirdPoint0 = aPoint; }
const wxPoint& GetThirdPoint0() const { return m_ThirdPoint0; } const wxPoint& GetThirdPoint0() const { return m_thirdPoint0; }
void SetBezier0_C1( const wxPoint& aPoint ) { m_Bezier0_C1 = aPoint; } void SetBezierC1_0( const wxPoint& aPoint ) { m_bezierC1_0 = aPoint; }
const wxPoint& GetBezier0_C1() const { return m_Bezier0_C1; } const wxPoint& GetBezierC1_0() const { return m_bezierC1_0; }
void SetBezier0_C2( const wxPoint& aPoint ) { m_Bezier0_C2 = aPoint; } void SetBezierC2_0( const wxPoint& aPoint ) { m_bezierC2_0 = aPoint; }
const wxPoint& GetBezier0_C2() const { return m_Bezier0_C2; } const wxPoint& GetBezierC2_0() const { return m_bezierC2_0; }
/** /**
* Set relative coordinates from draw coordinates. * Set relative coordinates from draw coordinates.
@ -157,11 +157,12 @@ public:
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif #endif
wxPoint m_Start0; ///< Start point or center, relative to footprint origin, orient 0. protected:
wxPoint m_End0; ///< End point, relative to footprint origin, orient 0. wxPoint m_start0; ///< Start point or circle center, relative to footprint origin, orient 0.
wxPoint m_ThirdPoint0; ///< End point for an arc. wxPoint m_end0; ///< End point or circle edge, relative to footprint origin, orient 0.
wxPoint m_Bezier0_C1; ///< Bezier Control Point 1, relative to footprint origin, orient 0. wxPoint m_thirdPoint0; ///< End point for an arc.
wxPoint m_Bezier0_C2; ///< Bezier Control Point 2, relative to footprint origin, orient 0. wxPoint m_bezierC1_0; ///< Bezier Control Point 1, relative to footprint origin, orient 0.
wxPoint m_bezierC2_0; ///< Bezier Control Point 2, relative to footprint origin, orient 0.
}; };
#endif // FP_SHAPE_H #endif // FP_SHAPE_H

View File

@ -122,8 +122,8 @@ bool GRAPHICS_CLEANER::areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 )
return false; return false;
case PCB_SHAPE_TYPE::CURVE: case PCB_SHAPE_TYPE::CURVE:
return aShape1->GetBezControl1() == aShape2->GetBezControl1() return aShape1->GetBezierC1() == aShape2->GetBezierC1()
&& aShape1->GetBezControl2() == aShape2->GetBezControl2() && aShape1->GetBezierC2() == aShape2->GetBezierC2()
&& aShape1->GetBezierPoints() == aShape2->GetBezierPoints(); && aShape1->GetBezierPoints() == aShape2->GetBezierPoints();
default: default:

View File

@ -164,8 +164,8 @@ void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D
spline->SetLayer( GetLayer() ); spline->SetLayer( GetLayer() );
spline->SetWidth( MapLineWidth( aWidth ) ); spline->SetWidth( MapLineWidth( aWidth ) );
spline->SetStart( MapCoordinate( aStart ) ); spline->SetStart( MapCoordinate( aStart ) );
spline->SetBezControl1( MapCoordinate( BezierControl1 ) ); spline->SetBezierC1( MapCoordinate( BezierControl1 ));
spline->SetBezControl2( MapCoordinate( BezierControl2 ) ); spline->SetBezierC2( MapCoordinate( BezierControl2 ));
spline->SetEnd( MapCoordinate( aEnd ) ); spline->SetEnd( MapCoordinate( aEnd ) );
spline->RebuildBezierToSegmentsPointsList( aWidth ); spline->RebuildBezierToSegmentsPointsList( aWidth );

View File

@ -104,8 +104,8 @@ void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const w
item->SetFilled( false ); item->SetFilled( false );
item->SetStart( aStart ); item->SetStart( aStart );
item->SetEnd( aEnd ); item->SetEnd( aEnd );
item->SetBezControl1( aCtrl1 ); item->SetBezierC1( aCtrl1 );
item->SetBezControl2( aCtrl2 ); item->SetBezierC2( aCtrl2 );
item->SetWidth( aThickness ); item->SetWidth( aThickness );
item->SetParent( this ); item->SetParent( this );
m_editPrimitives.emplace_back( item ); m_editPrimitives.emplace_back( item );

View File

@ -1497,8 +1497,8 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
// Use thickness as filter value to convert the curve to polyline when the curve // Use thickness as filter value to convert the curve to polyline when the curve
// is not supported // is not supported
m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ), m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
VECTOR2D( aShape->GetBezControl1() ), VECTOR2D( aShape->GetBezierC1() ),
VECTOR2D( aShape->GetBezControl2() ), VECTOR2D( aShape->GetBezierC2() ),
VECTOR2D( aShape->GetEnd() ), thickness ); VECTOR2D( aShape->GetEnd() ), thickness );
} }
else else
@ -1510,8 +1510,8 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
// Use thickness as filter value to convert the curve to polyline when the curve // Use thickness as filter value to convert the curve to polyline when the curve
// is not supported // is not supported
m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ), m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
VECTOR2D( aShape->GetBezControl1() ), VECTOR2D( aShape->GetBezierC1() ),
VECTOR2D( aShape->GetBezControl2() ), VECTOR2D( aShape->GetBezierC2() ),
VECTOR2D( aShape->GetEnd() ), thickness ); VECTOR2D( aShape->GetEnd() ), thickness );
} }
break; break;

View File

@ -109,11 +109,11 @@ public:
void SetShape( PCB_SHAPE_TYPE aShape ) { m_shape = aShape; } void SetShape( PCB_SHAPE_TYPE aShape ) { m_shape = aShape; }
PCB_SHAPE_TYPE GetShape() const { return m_shape; } PCB_SHAPE_TYPE GetShape() const { return m_shape; }
void SetBezControl1( const wxPoint& aPoint ) { m_bezierC1 = aPoint; } void SetBezierC1( const wxPoint& aPoint ) { m_bezierC1 = aPoint; }
const wxPoint& GetBezControl1() const { return m_bezierC1; } const wxPoint& GetBezierC1() const { return m_bezierC1; }
void SetBezControl2( const wxPoint& aPoint ) { m_bezierC2 = aPoint; } void SetBezierC2( const wxPoint& aPoint ) { m_bezierC2 = aPoint; }
const wxPoint& GetBezControl2() const { return m_bezierC2; } const wxPoint& GetBezierC2() const { return m_bezierC2; }
void SetPosition( const wxPoint& aPos ) override; void SetPosition( const wxPoint& aPos ) override;
wxPoint GetPosition() const override; wxPoint GetPosition() const override;

View File

@ -679,8 +679,8 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
break; break;
case PCB_SHAPE_TYPE::CURVE: case PCB_SHAPE_TYPE::CURVE:
m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezControl1(), m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
aShape->GetBezControl2(), aShape->GetEnd(), 0, thickness ); aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
break; break;
default: default:
@ -921,8 +921,8 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
break; break;
case PCB_SHAPE_TYPE::CURVE: case PCB_SHAPE_TYPE::CURVE:
m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezControl1(), m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
aShape->GetBezControl2(), aShape->GetEnd(), 0, thickness ); aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
break; break;
case PCB_SHAPE_TYPE::POLYGON: case PCB_SHAPE_TYPE::POLYGON:

View File

@ -1964,26 +1964,26 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers()
// We convert them to an oval in most cases, but handle also the possibility of // We convert them to an oval in most cases, but handle also the possibility of
// encountering arcs in here. // encountering arcs in here.
std::vector<PCB_SHAPE*> outlineSegments = std::vector<PCB_SHAPE*> outlineShapes = getShapesFromVertices( csCopper.Shape.Vertices );
getDrawSegmentsFromVertices( csCopper.Shape.Vertices );
for( auto& seg : outlineSegments ) for( PCB_SHAPE* shape : outlineShapes )
{ {
SHAPE_POLY_SET segment; SHAPE_POLY_SET poly;
if( seg->GetShape() == PCB_SHAPE_TYPE::ARC ) if( shape->GetShape() == PCB_SHAPE_TYPE::ARC )
{ {
TransformArcToPolygon( segment, seg->GetStart(), seg->GetArcMid(), TransformArcToPolygon( poly, shape->GetArcStart(), shape->GetArcMid(),
seg->GetEnd(), copperWidth, ARC_HIGH_DEF, shape->GetArcEnd(), copperWidth, ARC_HIGH_DEF,
ERROR_LOC::ERROR_INSIDE ); ERROR_LOC::ERROR_INSIDE );
} }
else else
{ {
TransformOvalToPolygon( segment, seg->GetStart(), seg->GetEnd(), TransformOvalToPolygon( poly, shape->GetStart(), shape->GetEnd(),
copperWidth, ARC_HIGH_DEF, ERROR_LOC::ERROR_INSIDE ); copperWidth, ARC_HIGH_DEF,
ERROR_LOC::ERROR_INSIDE );
} }
rawPolys.BooleanAdd( segment, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); rawPolys.BooleanAdd( poly, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
} }
} }
@ -2028,31 +2028,29 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers()
if( csCopper.Shape.Type == SHAPE_TYPE::OPENSHAPE if( csCopper.Shape.Type == SHAPE_TYPE::OPENSHAPE
|| csCopper.Shape.Type == SHAPE_TYPE::OUTLINE ) || csCopper.Shape.Type == SHAPE_TYPE::OUTLINE )
{ {
std::vector<PCB_SHAPE*> outlineSegments = std::vector<PCB_SHAPE*> outlineShapes = getShapesFromVertices( csCopper.Shape.Vertices );
getDrawSegmentsFromVertices( csCopper.Shape.Vertices );
std::vector<PCB_TRACK*> outlineTracks = makeTracksFromDrawsegments( outlineSegments, std::vector<PCB_TRACK*> outlineTracks = makeTracksFromShapes( outlineShapes, m_board,
m_board, getKiCadNet( csCopper.NetRef.NetID ), getKiCadNet( csCopper.NetRef.NetID ),
getKiCadLayer( csCopper.LayerID ), getKiCadLayer( csCopper.LayerID ),
getKiCadLength( getCopperCode( csCopper.CopperCodeID ).CopperWidth ) ); getKiCadLength( getCopperCode( csCopper.CopperCodeID ).CopperWidth ) );
//cleanup //cleanup
for( PCB_SHAPE* seg : outlineSegments ) for( PCB_SHAPE* shape : outlineShapes )
delete seg; delete shape;
for( CUTOUT cutout : csCopper.Shape.Cutouts ) for( CUTOUT cutout : csCopper.Shape.Cutouts )
{ {
std::vector<PCB_SHAPE*> cutoutSeg = std::vector<PCB_SHAPE*> cutoutShapes = getShapesFromVertices( cutout.Vertices );
getDrawSegmentsFromVertices( cutout.Vertices );
std::vector<PCB_TRACK*> cutoutTracks = makeTracksFromDrawsegments( cutoutSeg, std::vector<PCB_TRACK*> cutoutTracks = makeTracksFromShapes( cutoutShapes, m_board,
m_board, getKiCadNet( csCopper.NetRef.NetID ), getKiCadNet( csCopper.NetRef.NetID ),
getKiCadLayer( csCopper.LayerID ), getKiCadLayer( csCopper.LayerID ),
getKiCadLength( getCopperCode( csCopper.CopperCodeID ).CopperWidth )); getKiCadLength( getCopperCode( csCopper.CopperCodeID ).CopperWidth ));
//cleanup //cleanup
for( PCB_SHAPE* seg : cutoutSeg ) for( PCB_SHAPE* shape : cutoutShapes )
delete seg; delete shape;
} }
} }
else else
@ -2355,7 +2353,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNetTracks( const NET_ID& aCadstarNe
for( const NET_PCB::ROUTE_VERTEX& v : routeVertices ) for( const NET_PCB::ROUTE_VERTEX& v : routeVertices )
{ {
PCB_SHAPE* shape = getDrawSegmentFromVertex( prevEnd, v.Vertex ); PCB_SHAPE* shape = getShapeFromVertex( prevEnd, v.Vertex );
shape->SetLayer( getKiCadLayer( aCadstarRoute.LayerID ) ); shape->SetLayer( getKiCadLayer( aCadstarRoute.LayerID ) );
shape->SetWidth( getKiCadLength( v.RouteWidth ) ); shape->SetWidth( getKiCadLength( v.RouteWidth ) );
shape->SetLocked( v.Fixed ); shape->SetLocked( v.Fixed );
@ -2364,7 +2362,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNetTracks( const NET_ID& aCadstarNe
} }
NETINFO_ITEM* net = getKiCadNet( aCadstarNetID ); NETINFO_ITEM* net = getKiCadNet( aCadstarNetID );
std::vector<PCB_TRACK*> tracks = makeTracksFromDrawsegments( shapes, m_board, net ); std::vector<PCB_TRACK*> tracks = makeTracksFromShapes( shapes, m_board, net );
//cleanup //cleanup
for( PCB_SHAPE* shape : shapes ) for( PCB_SHAPE* shape : shapes )
@ -2593,10 +2591,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape,
case SHAPE_TYPE::OPENSHAPE: case SHAPE_TYPE::OPENSHAPE:
case SHAPE_TYPE::OUTLINE: case SHAPE_TYPE::OUTLINE:
///TODO update this when Polygons in KiCad can be defined with no fill ///TODO update this when Polygons in KiCad can be defined with no fill
drawCadstarVerticesAsSegments( aCadstarShape.Vertices, aKiCadLayer, aLineThickness, drawCadstarVerticesAsShapes( aCadstarShape.Vertices, aKiCadLayer, aLineThickness,
aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor, aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
aTransformCentre, aMirrorInvert ); aTransformCentre, aMirrorInvert );
drawCadstarCutoutsAsSegments( aCadstarShape.Cutouts, aKiCadLayer, aLineThickness, drawCadstarCutoutsAsShapes( aCadstarShape.Cutouts, aKiCadLayer, aLineThickness,
aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor, aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
aTransformCentre, aMirrorInvert ); aTransformCentre, aMirrorInvert );
break; break;
@ -2643,7 +2641,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape,
} }
void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarCutoutsAsSegments( const std::vector<CUTOUT>& aCutouts, void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts,
const PCB_LAYER_ID& aKiCadLayer, const PCB_LAYER_ID& aKiCadLayer,
const int& aLineThickness, const int& aLineThickness,
BOARD_ITEM_CONTAINER* aContainer, BOARD_ITEM_CONTAINER* aContainer,
@ -2656,37 +2654,48 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarCutoutsAsSegments( const std::vector
{ {
for( CUTOUT cutout : aCutouts ) for( CUTOUT cutout : aCutouts )
{ {
drawCadstarVerticesAsSegments( cutout.Vertices, aKiCadLayer, aLineThickness, aContainer, drawCadstarVerticesAsShapes( cutout.Vertices, aKiCadLayer, aLineThickness, aContainer,
aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
aTransformCentre, aMirrorInvert ); aTransformCentre, aMirrorInvert );
} }
} }
void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarVerticesAsSegments( void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
const std::vector<VERTEX>& aCadstarVertices, const PCB_LAYER_ID& aKiCadLayer, const PCB_LAYER_ID& aKiCadLayer,
const int& aLineThickness, BOARD_ITEM_CONTAINER* aContainer, const int& aLineThickness,
const GROUP_ID& aCadstarGroupID, const wxPoint& aMoveVector, const double& aRotationAngle, BOARD_ITEM_CONTAINER* aContainer,
const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) const GROUP_ID& aCadstarGroupID,
const wxPoint& aMoveVector,
const double& aRotationAngle,
const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
{ {
std::vector<PCB_SHAPE*> drawSegments = std::vector<PCB_SHAPE*> shapes = getShapesFromVertices( aCadstarVertices, aContainer,
getDrawSegmentsFromVertices( aCadstarVertices, aContainer, aCadstarGroupID, aMoveVector, aCadstarGroupID, aMoveVector,
aRotationAngle, aScalingFactor, aTransformCentre, aMirrorInvert ); aRotationAngle, aScalingFactor,
aTransformCentre, aMirrorInvert );
for( PCB_SHAPE* ds : drawSegments ) for( PCB_SHAPE* shape : shapes )
{ {
ds->SetWidth( aLineThickness ); shape->SetWidth( aLineThickness );
ds->SetLayer( aKiCadLayer ); shape->SetLayer( aKiCadLayer );
ds->SetParent( aContainer ); shape->SetParent( aContainer );
aContainer->Add( ds, ADD_MODE::APPEND ); aContainer->Add( shape, ADD_MODE::APPEND );
} }
} }
std::vector<PCB_SHAPE*> CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentsFromVertices( std::vector<PCB_SHAPE*> CADSTAR_PCB_ARCHIVE_LOADER::getShapesFromVertices(
const std::vector<VERTEX>& aCadstarVertices, BOARD_ITEM_CONTAINER* aContainer, const std::vector<VERTEX>& aCadstarVertices,
const GROUP_ID& aCadstarGroupID, const wxPoint& aMoveVector, const double& aRotationAngle, BOARD_ITEM_CONTAINER* aContainer,
const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) const GROUP_ID& aCadstarGroupID,
const wxPoint& aMoveVector,
const double& aRotationAngle,
const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
{ {
std::vector<PCB_SHAPE*> drawSegments; std::vector<PCB_SHAPE*> drawSegments;
@ -2700,9 +2709,9 @@ std::vector<PCB_SHAPE*> CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentsFromVertices(
for( size_t i = 1; i < aCadstarVertices.size(); i++ ) for( size_t i = 1; i < aCadstarVertices.size(); i++ )
{ {
cur = &aCadstarVertices.at( i ); cur = &aCadstarVertices.at( i );
drawSegments.push_back( drawSegments.push_back( getShapeFromVertex( prev->End, *cur, aContainer, aCadstarGroupID,
getDrawSegmentFromVertex( prev->End, *cur, aContainer, aCadstarGroupID, aMoveVector, aMoveVector, aRotationAngle, aScalingFactor,
aRotationAngle, aScalingFactor, aTransformCentre, aMirrorInvert ) ); aTransformCentre, aMirrorInvert ) );
prev = cur; prev = cur;
} }
@ -2710,7 +2719,7 @@ std::vector<PCB_SHAPE*> CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentsFromVertices(
} }
PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aCadstarStartPoint, PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstarStartPoint,
const VERTEX& aCadstarVertex, const VERTEX& aCadstarVertex,
BOARD_ITEM_CONTAINER* aContainer, BOARD_ITEM_CONTAINER* aContainer,
const GROUP_ID& aCadstarGroupID, const GROUP_ID& aCadstarGroupID,
@ -2720,7 +2729,7 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC
const wxPoint& aTransformCentre, const wxPoint& aTransformCentre,
const bool& aMirrorInvert ) const bool& aMirrorInvert )
{ {
PCB_SHAPE* ds = nullptr; PCB_SHAPE* shape = nullptr;
bool cw = false; bool cw = false;
double arcStartAngle, arcEndAngle, arcAngle; double arcStartAngle, arcEndAngle, arcAngle;
@ -2730,9 +2739,13 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC
if( aCadstarVertex.Type == VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE if( aCadstarVertex.Type == VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE
|| aCadstarVertex.Type == VERTEX_TYPE::CLOCKWISE_SEMICIRCLE ) || aCadstarVertex.Type == VERTEX_TYPE::CLOCKWISE_SEMICIRCLE )
{
centerPoint = ( startPoint + endPoint ) / 2; centerPoint = ( startPoint + endPoint ) / 2;
}
else else
{
centerPoint = getKiCadPoint( aCadstarVertex.Center ); centerPoint = getKiCadPoint( aCadstarVertex.Center );
}
switch( aCadstarVertex.Type ) switch( aCadstarVertex.Type )
{ {
@ -2741,16 +2754,16 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC
if( isFootprint( aContainer ) ) if( isFootprint( aContainer ) )
{ {
ds = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), PCB_SHAPE_TYPE::SEGMENT ); shape = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), PCB_SHAPE_TYPE::SEGMENT );
} }
else else
{ {
ds = new PCB_SHAPE( aContainer ); shape = new PCB_SHAPE( aContainer );
ds->SetShape( PCB_SHAPE_TYPE::SEGMENT ); shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
} }
ds->SetStart( startPoint ); shape->SetStart( startPoint );
ds->SetEnd( endPoint ); shape->SetEnd( endPoint );
break; break;
case VERTEX_TYPE::CLOCKWISE_SEMICIRCLE: case VERTEX_TYPE::CLOCKWISE_SEMICIRCLE:
@ -2763,16 +2776,16 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC
if( isFootprint( aContainer ) ) if( isFootprint( aContainer ) )
{ {
ds = new FP_SHAPE( (FOOTPRINT*) aContainer, PCB_SHAPE_TYPE::ARC ); shape = new FP_SHAPE((FOOTPRINT*) aContainer, PCB_SHAPE_TYPE::ARC );
} }
else else
{ {
ds = new PCB_SHAPE( aContainer ); shape = new PCB_SHAPE( aContainer );
ds->SetShape( PCB_SHAPE_TYPE::ARC ); shape->SetShape( PCB_SHAPE_TYPE::ARC );
} }
ds->SetArcStart( startPoint ); shape->SetArcStart( startPoint );
ds->SetCenter( centerPoint ); shape->SetCenter( centerPoint );
arcStartAngle = getPolarAngle( startPoint - centerPoint ); arcStartAngle = getPolarAngle( startPoint - centerPoint );
arcEndAngle = getPolarAngle( endPoint - centerPoint ); arcEndAngle = getPolarAngle( endPoint - centerPoint );
@ -2781,37 +2794,37 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC
// with opposite start/end points and same centre point) // with opposite start/end points and same centre point)
if( cw ) if( cw )
ds->SetAngle( NormalizeAnglePos( arcAngle ) ); shape->SetAngle( NormalizeAnglePos( arcAngle ) );
else else
ds->SetAngle( NormalizeAngleNeg( arcAngle ) ); shape->SetAngle( NormalizeAngleNeg( arcAngle ) );
break; break;
} }
//Apply transforms //Apply transforms
if( aMirrorInvert ) if( aMirrorInvert )
ds->Flip( aTransformCentre, true ); shape->Flip( aTransformCentre, true );
if( aScalingFactor != 1.0 ) if( aScalingFactor != 1.0 )
{ {
ds->Move( -aTransformCentre ); shape->Move( -aTransformCentre );
ds->Scale( aScalingFactor ); shape->Scale( aScalingFactor );
ds->Move( aTransformCentre ); shape->Move( aTransformCentre );
} }
if( aRotationAngle != 0.0 ) if( aRotationAngle != 0.0 )
ds->Rotate( aTransformCentre, aRotationAngle ); shape->Rotate( aTransformCentre, aRotationAngle );
if( aMoveVector != wxPoint{ 0, 0 } ) if( aMoveVector != wxPoint{ 0, 0 } )
ds->Move( aMoveVector ); shape->Move( aMoveVector );
if( isFootprint( aContainer ) && ds != nullptr ) if( isFootprint( aContainer ) && shape != nullptr )
static_cast<FP_SHAPE*>( ds )->SetLocalCoord(); static_cast<FP_SHAPE*>( shape )->SetLocalCoord();
if( !aCadstarGroupID.IsEmpty() ) if( !aCadstarGroupID.IsEmpty() )
addToGroup( aCadstarGroupID, ds ); addToGroup( aCadstarGroupID, shape );
return ds; return shape;
} }
@ -2853,35 +2866,29 @@ SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHA
{ {
GROUP_ID noGroup = wxEmptyString; GROUP_ID noGroup = wxEmptyString;
std::vector<PCB_SHAPE*> outlineSegments = getDrawSegmentsFromVertices( aCadstarShape.Vertices, std::vector<PCB_SHAPE*> outlineShapes = getShapesFromVertices( aCadstarShape.Vertices,
aContainer, noGroup, aContainer, noGroup, aMoveVector,
aMoveVector, aRotationAngle, aScalingFactor,
aRotationAngle, aTransformCentre, aMirrorInvert );
aScalingFactor,
aTransformCentre,
aMirrorInvert );
SHAPE_POLY_SET polySet( getLineChainFromDrawsegments( outlineSegments ) ); SHAPE_POLY_SET polySet( getLineChainFromShapes( outlineShapes ) );
//cleanup //cleanup
for( PCB_SHAPE* seg : outlineSegments ) for( PCB_SHAPE* shape : outlineShapes )
delete seg; delete shape;
for( CUTOUT cutout : aCadstarShape.Cutouts ) for( CUTOUT cutout : aCadstarShape.Cutouts )
{ {
std::vector<PCB_SHAPE*> cutoutSeg = getDrawSegmentsFromVertices( cutout.Vertices, std::vector<PCB_SHAPE*> cutoutShapes = getShapesFromVertices( cutout.Vertices, aContainer,
aContainer, noGroup, noGroup, aMoveVector,
aMoveVector, aRotationAngle, aScalingFactor,
aRotationAngle, aTransformCentre, aMirrorInvert );
aScalingFactor,
aTransformCentre,
aMirrorInvert );
polySet.AddHole( getLineChainFromDrawsegments( cutoutSeg ) ); polySet.AddHole( getLineChainFromShapes( cutoutShapes ) );
//cleanup //cleanup
for( PCB_SHAPE* seg : cutoutSeg ) for( PCB_SHAPE* shape : cutoutShapes )
delete seg; delete shape;
} }
if( aLineThickness > 0 ) if( aLineThickness > 0 )
@ -2903,40 +2910,40 @@ SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHA
} }
SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromDrawsegments( const std::vector<PCB_SHAPE*> aDrawsegments ) SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes( const std::vector<PCB_SHAPE*> aShapes )
{ {
SHAPE_LINE_CHAIN lineChain; SHAPE_LINE_CHAIN lineChain;
for( PCB_SHAPE* ds : aDrawsegments ) for( PCB_SHAPE* shape : aShapes )
{ {
switch( ds->GetShape() ) switch( shape->GetShape() )
{ {
case PCB_SHAPE_TYPE::ARC: case PCB_SHAPE_TYPE::ARC:
{ {
if( ds->GetClass() == wxT( "MGRAPHIC" ) ) if( shape->GetClass() == wxT( "MGRAPHIC" ) )
{ {
FP_SHAPE* em = (FP_SHAPE*) ds; FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
SHAPE_ARC arc( em->GetStart0(), em->GetEnd0(), (double) em->GetAngle() / 10.0 ); SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(), fp_shape->GetAngle() / 10.0 );
lineChain.Append( arc ); lineChain.Append( arc );
} }
else else
{ {
SHAPE_ARC arc( ds->GetCenter(), ds->GetArcStart(), (double) ds->GetAngle() / 10.0 ); SHAPE_ARC arc( shape->GetCenter(), shape->GetArcStart(), shape->GetAngle() / 10.0 );
lineChain.Append( arc ); lineChain.Append( arc );
} }
} }
break; break;
case PCB_SHAPE_TYPE::SEGMENT: case PCB_SHAPE_TYPE::SEGMENT:
if( ds->GetClass() == wxT( "MGRAPHIC" ) ) if( shape->GetClass() == wxT( "MGRAPHIC" ) )
{ {
FP_SHAPE* em = (FP_SHAPE*) ds; FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
lineChain.Append( em->GetStart0().x, em->GetStart0().y ); lineChain.Append( fp_shape->GetStart0().x, fp_shape->GetStart0().y );
lineChain.Append( em->GetEnd0().x, em->GetEnd0().y ); lineChain.Append( fp_shape->GetEnd0().x, fp_shape->GetEnd0().y );
} }
else else
{ {
lineChain.Append( ds->GetStartX(), ds->GetStartY() ); lineChain.Append( shape->GetStartX(), shape->GetStartY() );
lineChain.Append( ds->GetEndX(), ds->GetEndY() ); lineChain.Append( shape->GetEndX(), shape->GetEndY() );
} }
break; break;
@ -2960,8 +2967,8 @@ SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromDrawsegments( const
} }
std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments( std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(
const std::vector<PCB_SHAPE*> aDrawsegments, const std::vector<PCB_SHAPE*> aShapes,
BOARD_ITEM_CONTAINER* aParentContainer, BOARD_ITEM_CONTAINER* aParentContainer,
NETINFO_ITEM* aNet, PCB_LAYER_ID aLayerOverride, NETINFO_ITEM* aNet, PCB_LAYER_ID aLayerOverride,
int aWidthOverride ) int aWidthOverride )
@ -2989,36 +2996,36 @@ std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(
} }
}; };
for( PCB_SHAPE* ds : aDrawsegments ) for( PCB_SHAPE* shape : aShapes )
{ {
switch( ds->GetShape() ) switch( shape->GetShape() )
{ {
case PCB_SHAPE_TYPE::ARC: case PCB_SHAPE_TYPE::ARC:
if( ds->GetClass() == wxT( "MGRAPHIC" ) ) if( shape->GetClass() == wxT( "MGRAPHIC" ) )
{ {
FP_SHAPE* em = (FP_SHAPE*) ds; FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
SHAPE_ARC arc( em->GetStart0(), em->GetEnd0(), (double) em->GetAngle() / 10.0 ); SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetEnd0(), fp_shape->GetAngle() / 10.0 );
track = new PCB_ARC( aParentContainer, &arc ); track = new PCB_ARC( aParentContainer, &arc );
} }
else else
{ {
SHAPE_ARC arc( ds->GetCenter(), ds->GetArcStart(), (double) ds->GetAngle() / 10.0 ); SHAPE_ARC arc( shape->GetCenter(), shape->GetArcStart(), shape->GetAngle() / 10.0 );
track = new PCB_ARC( aParentContainer, &arc ); track = new PCB_ARC( aParentContainer, &arc );
} }
break; break;
case PCB_SHAPE_TYPE::SEGMENT: case PCB_SHAPE_TYPE::SEGMENT:
if( ds->GetClass() == wxT( "MGRAPHIC" ) ) if( shape->GetClass() == wxT( "MGRAPHIC" ) )
{ {
FP_SHAPE* em = (FP_SHAPE*) ds; FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
track = new PCB_TRACK( aParentContainer ); track = new PCB_TRACK( aParentContainer );
track->SetStart( em->GetStart0() ); track->SetStart( fp_shape->GetStart0() );
track->SetEnd( em->GetEnd0() ); track->SetEnd( fp_shape->GetEnd0() );
} }
else else
{ {
track = new PCB_TRACK( aParentContainer ); track = new PCB_TRACK( aParentContainer );
track->SetStart( ds->GetStart() ); track->SetStart( shape->GetStart() );
track->SetEnd( ds->GetEnd() ); track->SetEnd( shape->GetEnd() );
} }
break; break;
@ -3028,19 +3035,19 @@ std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(
} }
if( aWidthOverride == -1 ) if( aWidthOverride == -1 )
track->SetWidth( ds->GetWidth() ); track->SetWidth( shape->GetWidth() );
else else
track->SetWidth( aWidthOverride ); track->SetWidth( aWidthOverride );
if( aLayerOverride == PCB_LAYER_ID::UNDEFINED_LAYER ) if( aLayerOverride == PCB_LAYER_ID::UNDEFINED_LAYER )
track->SetLayer( ds->GetLayer() ); track->SetLayer( shape->GetLayer() );
else else
track->SetLayer( aLayerOverride ); track->SetLayer( aLayerOverride );
if( aNet != nullptr ) if( aNet != nullptr )
track->SetNet( aNet ); track->SetNet( aNet );
track->SetLocked( ds->IsLocked() ); track->SetLocked( shape->IsLocked() );
// Apply route offsetting, mimmicking the behaviour of the CADSTAR post processor // Apply route offsetting, mimmicking the behaviour of the CADSTAR post processor
if( prevTrack != nullptr ) if( prevTrack != nullptr )

View File

@ -236,7 +236,7 @@ private:
* @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 drawsegments
*/ */
void drawCadstarCutoutsAsSegments( 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,
BOARD_ITEM_CONTAINER* aContainer, BOARD_ITEM_CONTAINER* aContainer,
const GROUP_ID& aCadstarGroupID = wxEmptyString, const GROUP_ID& aCadstarGroupID = wxEmptyString,
@ -260,7 +260,7 @@ private:
* @param aMirrorInvert if true, mirrors the drawsegment * @param aMirrorInvert if true, mirrors the drawsegment
* @param aCadstarGroupID to add the shape to * @param aCadstarGroupID to add the shape to
*/ */
void drawCadstarVerticesAsSegments( const std::vector<VERTEX>& aCadstarVertices, void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness, const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
BOARD_ITEM_CONTAINER* aContainer, BOARD_ITEM_CONTAINER* aContainer,
const GROUP_ID& aCadstarGroupID = wxEmptyString, const GROUP_ID& aCadstarGroupID = wxEmptyString,
@ -282,7 +282,7 @@ private:
* @param aMirrorInvert if true, mirrors the drawsegment * @param aMirrorInvert if true, mirrors the drawsegment
* @return * @return
*/ */
std::vector<PCB_SHAPE*> getDrawSegmentsFromVertices( const std::vector<VERTEX>& aCadstarVertices, std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices,
BOARD_ITEM_CONTAINER* aContainer = nullptr, BOARD_ITEM_CONTAINER* aContainer = nullptr,
const GROUP_ID& aCadstarGroupID = wxEmptyString, const GROUP_ID& aCadstarGroupID = wxEmptyString,
const wxPoint& aMoveVector = { 0, 0 }, const wxPoint& aMoveVector = { 0, 0 },
@ -304,7 +304,7 @@ private:
* @param aMirrorInvert if true, mirrors the drawsegment * @param aMirrorInvert if true, mirrors the drawsegment
* @return * @return
*/ */
PCB_SHAPE* getDrawSegmentFromVertex( const POINT& aCadstarStartPoint, PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint,
const VERTEX& aCadstarVertex, const VERTEX& aCadstarVertex,
BOARD_ITEM_CONTAINER* aContainer = nullptr, BOARD_ITEM_CONTAINER* aContainer = nullptr,
const GROUP_ID& aCadstarGroupID = wxEmptyString, const GROUP_ID& aCadstarGroupID = wxEmptyString,
@ -347,14 +347,14 @@ private:
/** /**
* @brief Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects * @brief Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects
* @param aDrawSegments * @param aShapes
* @return * @return
*/ */
SHAPE_LINE_CHAIN getLineChainFromDrawsegments( const std::vector<PCB_SHAPE*> aDrawSegments ); SHAPE_LINE_CHAIN getLineChainFromShapes( const std::vector<PCB_SHAPE*> aShapes );
/** /**
* @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 aDrawsegments * @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 layers
@ -363,7 +363,7 @@ private:
* in the DrawSegments * in the DrawSegments
* @return * @return
*/ */
std::vector<PCB_TRACK*> makeTracksFromDrawsegments( const std::vector<PCB_SHAPE*> aDrawsegments, std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*> aShapes,
BOARD_ITEM_CONTAINER* aParentContainer, BOARD_ITEM_CONTAINER* aParentContainer,
NETINFO_ITEM* aNet = nullptr, NETINFO_ITEM* aNet = nullptr,
PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER, PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER,

View File

@ -893,8 +893,8 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
m_out->Print( aNestLevel, "(gr_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))", m_out->Print( aNestLevel, "(gr_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))",
locked.c_str(), locked.c_str(),
FormatInternalUnits( aShape->GetStart() ).c_str(), FormatInternalUnits( aShape->GetStart() ).c_str(),
FormatInternalUnits( aShape->GetBezControl1() ).c_str(), FormatInternalUnits( aShape->GetBezierC1() ).c_str(),
FormatInternalUnits( aShape->GetBezControl2() ).c_str(), FormatInternalUnits( aShape->GetBezierC2() ).c_str(),
FormatInternalUnits( aShape->GetEnd() ).c_str() ); FormatInternalUnits( aShape->GetEnd() ).c_str() );
break; break;
@ -1018,8 +1018,8 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
m_out->Print( aNestLevel, "(fp_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))", m_out->Print( aNestLevel, "(fp_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))",
locked.c_str(), locked.c_str(),
FormatInternalUnits( aFPShape->GetStart0() ).c_str(), FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
FormatInternalUnits( aFPShape->GetBezier0_C1() ).c_str(), FormatInternalUnits( aFPShape->GetBezierC1_0() ).c_str(),
FormatInternalUnits( aFPShape->GetBezier0_C2() ).c_str(), FormatInternalUnits( aFPShape->GetBezierC2_0() ).c_str(),
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() ); FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
break; break;
@ -1636,8 +1636,8 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
case PCB_SHAPE_TYPE::CURVE: // Bezier Curve case PCB_SHAPE_TYPE::CURVE: // Bezier Curve
m_out->Print( nested_level, "(gr_curve (pts (xy %s) (xy %s) (xy %s) (xy %s))", m_out->Print( nested_level, "(gr_curve (pts (xy %s) (xy %s) (xy %s) (xy %s))",
FormatInternalUnits( primitive->GetStart() ).c_str(), FormatInternalUnits( primitive->GetStart() ).c_str(),
FormatInternalUnits( primitive->GetBezControl1() ).c_str(), FormatInternalUnits( primitive->GetBezierC1() ).c_str(),
FormatInternalUnits( primitive->GetBezControl2() ).c_str(), FormatInternalUnits( primitive->GetBezierC2() ).c_str(),
FormatInternalUnits( primitive->GetEnd() ).c_str() ); FormatInternalUnits( primitive->GetEnd() ).c_str() );
break; break;

View File

@ -2417,8 +2417,8 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
Expecting( T_pts ); Expecting( T_pts );
shape->SetStart( parseXY() ); shape->SetStart( parseXY() );
shape->SetBezControl1( parseXY() ); shape->SetBezierC1( parseXY());
shape->SetBezControl2( parseXY() ); shape->SetBezierC2( parseXY());
shape->SetEnd( parseXY() ); shape->SetEnd( parseXY() );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -3616,8 +3616,8 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
if( token != T_angle ) if( token != T_angle )
Expecting( T_angle ); Expecting( T_angle );
// Setting angle will set m_ThirdPoint0, so must be done after setting // Setting angle will set m_thirdPoint0, so must be done after setting
// m_Start0 and m_End0 // m_start0 and m_end0
shape->SetAngle( parseDouble( "segment angle" ) * 10.0 ); shape->SetAngle( parseDouble( "segment angle" ) * 10.0 );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -3675,8 +3675,8 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
Expecting( T_pts ); Expecting( T_pts );
shape->SetStart0( parseXY() ); shape->SetStart0( parseXY() );
shape->SetBezier0_C1( parseXY() ); shape->SetBezierC1_0( parseXY());
shape->SetBezier0_C2( parseXY() ); shape->SetBezierC2_0( parseXY());
shape->SetEnd0( parseXY() ); shape->SetEnd0( parseXY() );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -4323,8 +4323,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
case T_gr_curve: case T_gr_curve:
dummysegm = parsePCB_SHAPE(); dummysegm = parsePCB_SHAPE();
pad->AddPrimitiveCurve( dummysegm->GetStart(), dummysegm->GetEnd(), pad->AddPrimitiveCurve( dummysegm->GetStart(), dummysegm->GetEnd(),
dummysegm->GetBezControl1(), dummysegm->GetBezierC1(),
dummysegm->GetBezControl2(), dummysegm->GetWidth() ); dummysegm->GetBezierC2(), dummysegm->GetWidth() );
break; break;
default: default:

View File

@ -1711,11 +1711,11 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
width = biuParse( data, &data ); width = biuParse( data, &data );
layer = layerParse( data ); layer = layerParse( data );
dwg->m_Start0 = wxPoint( start0_x, start0_y ); dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->m_End0 = wxPoint( end0_x, end0_y ); dwg->SetEnd0( wxPoint( end0_x, end0_y ) );
// Setting angle will set m_ThirdPoint0, so must be done after setting // Setting angle will set m_thirdPoint0, so must be done after setting
// m_Start0 and m_End0 // m_start0 and m_end0
dwg->SetAngle( angle ); dwg->SetAngle( angle );
} }
break; break;
@ -1732,8 +1732,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
width = biuParse( data, &data ); width = biuParse( data, &data );
layer = layerParse( data ); layer = layerParse( data );
dwg->m_Start0 = wxPoint( start0_x, start0_y ); dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->m_End0 = wxPoint( end0_x, end0_y ); dwg->SetEnd0( wxPoint( end0_x, end0_y ) );
} }
break; break;
@ -1749,8 +1749,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
width = biuParse( data, &data ); width = biuParse( data, &data );
layer = layerParse( data ); layer = layerParse( data );
dwg->m_Start0 = wxPoint( start0_x, start0_y ); dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->m_End0 = wxPoint( end0_x, end0_y ); dwg->SetEnd0( wxPoint( end0_x, end0_y ) );
std::vector<wxPoint> pts; std::vector<wxPoint> pts;
pts.reserve( ptCount ); pts.reserve( ptCount );
@ -2029,7 +2029,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
break; break;
case 6: case 6:
y = biuParse( data ); y = biuParse( data );
dseg->SetBezControl1( wxPoint( x, y ) ); dseg->SetBezierC1( wxPoint( x, y ));
break; break;
case 7: case 7:
@ -2037,7 +2037,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
break; break;
case 8: case 8:
y = biuParse( data ); y = biuParse( data );
dseg->SetBezControl2( wxPoint( x, y ) ); dseg->SetBezierC2( wxPoint( x, y ));
break; break;
default: default:

View File

@ -37,7 +37,8 @@
namespace PCAD2KICAD { namespace PCAD2KICAD {
PCB_ARC::PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard ) PCB_ARC::PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCB_COMPONENT( aCallbacks, aBoard )
{ {
m_objType = wxT( 'A' ); m_objType = wxT( 'A' );
m_StartX = 0; m_StartX = 0;
@ -52,9 +53,7 @@ PCB_ARC::~PCB_ARC()
} }
void PCB_ARC::Parse( XNODE* aNode, void PCB_ARC::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
int aLayer,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -67,8 +66,10 @@ void PCB_ARC::Parse( XNODE* aNode,
m_KiCadLayer = GetKiCadLayer(); m_KiCadLayer = GetKiCadLayer();
if( FindNode( aNode, wxT( "width" ) ) ) if( FindNode( aNode, wxT( "width" ) ) )
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), {
aDefaultMeasurementUnit, &m_Width, aActualConversion ); SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_Width,
aActualConversion );
}
if( aNode->GetName() == wxT( "triplePointArc" ) ) if( aNode->GetName() == wxT( "triplePointArc" ) )
{ {
@ -76,24 +77,27 @@ void PCB_ARC::Parse( XNODE* aNode,
lNode = FindNode( aNode, wxT( "pt" ) ); lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode ) if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, {
&m_positionX, &m_positionY, aActualConversion ); SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
aActualConversion );
}
// start point // start point
if( lNode ) if( lNode )
lNode = lNode->GetNext(); lNode = lNode->GetNext();
if( lNode ) if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, {
&m_StartX, &m_StartY, aActualConversion ); SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_StartX, &m_StartY,
aActualConversion );
}
// end point // end point
if( lNode ) if( lNode )
lNode = lNode->GetNext(); lNode = lNode->GetNext();
if( lNode ) if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, SetPosition( lNode->GetNodeContent(), aDefaultUnits, &endX, &endY, aActualConversion );
&endX, &endY, aActualConversion );
if( m_StartX == endX && m_StartY == endY ) if( m_StartX == endX && m_StartY == endY )
{ {
@ -113,20 +117,27 @@ void PCB_ARC::Parse( XNODE* aNode,
lNode = FindNode( aNode, wxT( "pt" ) ); lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode ) if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, {
&m_positionX, &m_positionY, aActualConversion ); SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
aActualConversion );
}
lNode = FindNode( aNode, wxT( "radius" ) ); lNode = FindNode( aNode, wxT( "radius" ) );
if( lNode) if( lNode)
SetWidth( FindNode( aNode, wxT( "radius" ) )->GetNodeContent(), {
aDefaultMeasurementUnit, &r, aActualConversion ); SetWidth( FindNode( aNode, wxT( "radius" ) )->GetNodeContent(), aDefaultUnits, &r,
aActualConversion );
}
lNode = FindNode( aNode, wxT( "startAngle" ) ); lNode = FindNode( aNode, wxT( "startAngle" ) );
if( lNode ) if( lNode )
a = StrToInt1Units( lNode->GetNodeContent() ); a = StrToInt1Units( lNode->GetNodeContent() );
lNode = FindNode( aNode, wxT( "sweepAngle" ) ); lNode = FindNode( aNode, wxT( "sweepAngle" ) );
if( lNode ) if( lNode )
m_Angle = StrToInt1Units( lNode->GetNodeContent() ); m_Angle = StrToInt1Units( lNode->GetNodeContent() );
@ -164,11 +175,11 @@ void PCB_ARC::AddToFootprint( FOOTPRINT* aFootprint )
aFootprint, ( IsCircle() ? PCB_SHAPE_TYPE::CIRCLE : PCB_SHAPE_TYPE::ARC ) ); aFootprint, ( IsCircle() ? PCB_SHAPE_TYPE::CIRCLE : PCB_SHAPE_TYPE::ARC ) );
aFootprint->Add( arc ); aFootprint->Add( arc );
arc->m_Start0 = wxPoint( m_positionX, m_positionY ); arc->SetStart0( wxPoint( m_positionX, m_positionY ) );
arc->m_End0 = wxPoint( m_StartX, m_StartY ); arc->SetEnd0( wxPoint( m_StartX, m_StartY ) );
// Setting angle will set m_ThirdPoint0, so must be done after setting // Setting angle will set m_thirdPoint0, so must be done after setting
// m_Start0 and m_End0 // m_start0 and m_end0
arc->SetAngle( -m_Angle ); arc->SetAngle( -m_Angle );
arc->SetWidth( m_Width ); arc->SetWidth( m_Width );

View File

@ -41,7 +41,7 @@ public:
PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_ARC(); ~PCB_ARC();
virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurementUnit, virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
const wxString& aActualConversion ); const wxString& aActualConversion );
virtual void SetPosOffset( int aX_offs, int aY_offs ) override; virtual void SetPosOffset( int aX_offs, int aY_offs ) override;

View File

@ -34,8 +34,7 @@
namespace PCAD2KICAD { namespace PCAD2KICAD {
PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
BOARD* aBoard ) :
m_uuid(), m_uuid(),
m_callbacks( aCallbacks ), m_callbacks( aCallbacks ),
m_board( aBoard ) m_board( aBoard )

View File

@ -33,9 +33,7 @@
namespace PCAD2KICAD { namespace PCAD2KICAD {
PCB_COPPER_POUR::PCB_COPPER_POUR( PCB_CALLBACKS* aCallbacks, PCB_COPPER_POUR::PCB_COPPER_POUR( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
BOARD* aBoard,
int aPCadLayer ) :
PCB_POLYGON( aCallbacks, aBoard, aPCadLayer ) PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
{ {
m_filled = false; m_filled = false;
@ -47,8 +45,7 @@ PCB_COPPER_POUR::~PCB_COPPER_POUR()
} }
bool PCB_COPPER_POUR::Parse( XNODE* aNode, bool PCB_COPPER_POUR::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -67,16 +64,22 @@ bool PCB_COPPER_POUR::Parse( XNODE* aNode,
} }
if( FindNode( aNode, wxT( "width" ) ) ) if( FindNode( aNode, wxT( "width" ) ) )
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), {
aDefaultMeasurementUnit, &m_width, aActualConversion ); SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_width,
aActualConversion );
}
if( FindNode( aNode, wxT( "pourSpacing" ) ) ) if( FindNode( aNode, wxT( "pourSpacing" ) ) )
SetWidth( FindNode( aNode, wxT( "pourSpacing" ) )->GetNodeContent(), {
aDefaultMeasurementUnit, &pourSpacing, aActualConversion ); SetWidth( FindNode( aNode, wxT( "pourSpacing" ) )->GetNodeContent(), aDefaultUnits,
&pourSpacing, aActualConversion );
}
if( FindNode( aNode, wxT( "thermalWidth" ) ) ) if( FindNode( aNode, wxT( "thermalWidth" ) ) )
SetWidth( FindNode( aNode, wxT( "thermalWidth" ) )->GetNodeContent(), {
aDefaultMeasurementUnit, &thermalWidth, aActualConversion ); SetWidth( FindNode( aNode, wxT( "thermalWidth" ) )->GetNodeContent(), aDefaultUnits,
&thermalWidth, aActualConversion );
}
if( FindNode( aNode, wxT( "island" ) ) ) if( FindNode( aNode, wxT( "island" ) ) )
m_filled = true; m_filled = true;
@ -86,7 +89,7 @@ bool PCB_COPPER_POUR::Parse( XNODE* aNode,
if( lNode ) if( lNode )
{ {
// retrieve copper pour outline // retrieve copper pour outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion ); FormPolygon( lNode, &m_outline, aDefaultUnits, aActualConversion );
m_positionX = m_outline[0]->x; m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y; m_positionY = m_outline[0]->y;

View File

@ -41,7 +41,7 @@ public:
~PCB_COPPER_POUR(); ~PCB_COPPER_POUR();
virtual bool Parse( XNODE* aNode, virtual bool Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit, const wxString& aDefaultUnits,
const wxString& aActualConversion ) override; const wxString& aActualConversion ) override;
}; };

View File

@ -37,8 +37,8 @@
namespace PCAD2KICAD { namespace PCAD2KICAD {
PCB_LINE::PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, PCB_LINE::PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
aBoard ) PCB_COMPONENT( aCallbacks, aBoard )
{ {
m_Width = 0; m_Width = 0;
m_ToX = 0; m_ToX = 0;
@ -52,9 +52,7 @@ PCB_LINE::~PCB_LINE()
} }
void PCB_LINE::Parse( XNODE* aNode, void PCB_LINE::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
int aLayer,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -70,20 +68,21 @@ void PCB_LINE::Parse( XNODE* aNode,
lNode = FindNode( aNode, wxT( "pt" ) ); lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode ) if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, {
&m_positionX, &m_positionY, aActualConversion ); SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
aActualConversion );
}
if( lNode ) if( lNode )
lNode = lNode->GetNext(); lNode = lNode->GetNext();
if( lNode ) if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_ToX, &m_ToY, aActualConversion );
&m_ToX, &m_ToY, aActualConversion );
lNode = FindNode( aNode, wxT( "width" ) ); lNode = FindNode( aNode, wxT( "width" ) );
if( lNode ) if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion ); SetWidth( lNode->GetNodeContent(), aDefaultUnits, &m_Width, aActualConversion );
lNode = FindNode( aNode, wxT( "netNameRef" ) ); lNode = FindNode( aNode, wxT( "netNameRef" ) );
@ -123,8 +122,8 @@ void PCB_LINE::AddToFootprint( FOOTPRINT* aFootprint )
FP_SHAPE* segment = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::SEGMENT ); FP_SHAPE* segment = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::SEGMENT );
aFootprint->Add( segment ); aFootprint->Add( segment );
segment->m_Start0 = wxPoint( m_positionX, m_positionY ); segment->SetStart0( wxPoint( m_positionX, m_positionY ) );
segment->m_End0 = wxPoint( m_ToX, m_ToY ); segment->SetEnd0( wxPoint( m_ToX, m_ToY ) );
segment->SetWidth( m_Width ); segment->SetWidth( m_Width );
segment->SetLayer( m_KiCadLayer ); segment->SetLayer( m_KiCadLayer );

View File

@ -42,7 +42,7 @@ public:
PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_LINE(); ~PCB_LINE();
virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurementUnit, virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
const wxString& aActualConversion ); const wxString& aActualConversion );
virtual void SetPosOffset( int aX_offs, int aY_offs ) override; virtual void SetPosOffset( int aX_offs, int aY_offs ) override;

View File

@ -58,7 +58,7 @@ PCB_PAD::~PCB_PAD()
} }
void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -89,7 +89,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
if( lNode ) if( lNode )
{ {
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_positionX, &m_positionY, SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
aActualConversion ); aActualConversion );
} }
@ -150,7 +150,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
cNode = FindNode( lNode, wxT( "holeDiam" ) ); cNode = FindNode( lNode, wxT( "holeDiam" ) );
if( cNode ) if( cNode )
SetWidth( cNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Hole, aActualConversion ); SetWidth( cNode->GetNodeContent(), aDefaultUnits, &m_Hole, aActualConversion );
if( FindNodeGetContent( lNode, wxT( "isHolePlated" ) ) == wxT( "False" ) ) if( FindNodeGetContent( lNode, wxT( "isHolePlated" ) ) == wxT( "False" ) )
m_IsHolePlated = false; m_IsHolePlated = false;
@ -166,7 +166,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
if( FindNode( cNode, wxT( "layerNumRef" ) ) ) if( FindNode( cNode, wxT( "layerNumRef" ) ) )
{ {
padShape = new PCB_PAD_SHAPE( m_callbacks, m_board ); padShape = new PCB_PAD_SHAPE( m_callbacks, m_board );
padShape->Parse( cNode, aDefaultMeasurementUnit, aActualConversion ); padShape->Parse( cNode, aDefaultUnits, aActualConversion );
m_Shapes.Add( padShape ); m_Shapes.Add( padShape );
} }
} }
@ -290,6 +290,7 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
// Set the proper net code // Set the proper net code
NETINFO_ITEM* netinfo = m_board->FindNet( m_net ); NETINFO_ITEM* netinfo = m_board->FindNet( m_net );
if( netinfo == NULL ) // I believe this should not happen, but just in case if( netinfo == NULL ) // I believe this should not happen, but just in case
{ {
// It is a new net // It is a new net

View File

@ -41,7 +41,7 @@ public:
PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD(); ~PCB_PAD();
virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ); const wxString& aActualConversion );
virtual void Flip() override; virtual void Flip() override;

View File

@ -32,8 +32,8 @@
namespace PCAD2KICAD { namespace PCAD2KICAD {
PCB_PAD_SHAPE::PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, PCB_PAD_SHAPE::PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard ) PCB_COMPONENT( aCallbacks, aBoard )
{ {
m_Shape = wxEmptyString; m_Shape = wxEmptyString;
m_Width = 0; m_Width = 0;
@ -46,8 +46,7 @@ PCB_PAD_SHAPE::~PCB_PAD_SHAPE()
} }
void PCB_PAD_SHAPE::Parse( XNODE* aNode, void PCB_PAD_SHAPE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
wxString str, s; wxString str, s;
@ -83,14 +82,12 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode,
lNode = FindNode( aNode, wxT( "shapeWidth" ) ); lNode = FindNode( aNode, wxT( "shapeWidth" ) );
if( lNode ) if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, SetWidth( lNode->GetNodeContent(), aDefaultUnits, &m_Width, aActualConversion );
aActualConversion );
lNode = FindNode( aNode, wxT( "shapeHeight" ) ); lNode = FindNode( aNode, wxT( "shapeHeight" ) );
if( lNode ) if( lNode )
SetWidth( SetWidth( lNode->GetNodeContent(), aDefaultUnits, &m_Height, aActualConversion );
lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Height, aActualConversion );
} }
else if( m_Shape == wxT( "Polygon" ) ) else if( m_Shape == wxT( "Polygon" ) )
{ {
@ -108,7 +105,7 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode,
while( lNode ) while( lNode )
{ {
s = lNode->GetNodeContent(); s = lNode->GetNodeContent();
SetPosition( s, aDefaultMeasurementUnit, &x, &y, aActualConversion ); SetPosition( s, aDefaultUnits, &x, &y, aActualConversion );
if( minX > x ) if( minX > x )
minX = x; minX = x;

View File

@ -40,7 +40,7 @@ public:
PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD_SHAPE(); ~PCB_PAD_SHAPE();
virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ); const wxString& aActualConversion );
void AddToBoard() override; void AddToBoard() override;

View File

@ -46,8 +46,7 @@ PCB_PLANE::~PCB_PLANE()
} }
bool PCB_PLANE::Parse( XNODE* aNode, bool PCB_PLANE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -65,15 +64,17 @@ bool PCB_PLANE::Parse( XNODE* aNode,
} }
if( FindNode( aNode, wxT( "width" ) ) ) if( FindNode( aNode, wxT( "width" ) ) )
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), {
aDefaultMeasurementUnit, &m_width, aActualConversion ); SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_width,
aActualConversion );
}
lNode = FindNode( aNode, wxT( "pcbPoly" ) ); lNode = FindNode( aNode, wxT( "pcbPoly" ) );
if( lNode ) if( lNode )
{ {
// retrieve plane outline // retrieve plane outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion ); FormPolygon( lNode, &m_outline, aDefaultUnits, aActualConversion );
m_positionX = m_outline[0]->x; m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y; m_positionY = m_outline[0]->y;

View File

@ -39,7 +39,7 @@ public:
PCB_PLANE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ); PCB_PLANE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_PLANE(); ~PCB_PLANE();
virtual bool Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, virtual bool Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ) override; const wxString& aActualConversion ) override;
}; };

View File

@ -26,7 +26,6 @@
#include <pcad/pcb_polygon.h> #include <pcad/pcb_polygon.h>
#include <board.h> #include <board.h>
#include <common.h>
#include <footprint.h> #include <footprint.h>
#include <fp_shape.h> #include <fp_shape.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
@ -108,8 +107,7 @@ void PCB_POLYGON::SetOutline( VERTICES_ARRAY* aOutline )
} }
void PCB_POLYGON::FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon, void PCB_POLYGON::FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
const wxString& aDefaultMeasurementUnit, const wxString& aDefaultUnits, const wxString& aActualConversion )
const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
double x, y; double x, y;
@ -120,8 +118,8 @@ void PCB_POLYGON::FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
{ {
if( lNode->GetName() == wxT( "pt" ) ) if( lNode->GetName() == wxT( "pt" ) )
{ {
SetDoublePrecisionPosition( SetDoublePrecisionPosition( lNode->GetNodeContent(), aDefaultUnits, &x, &y,
lNode->GetNodeContent(), aDefaultMeasurementUnit, &x, &y, aActualConversion ); aActualConversion );
aPolygon->Add( new wxRealPoint( x, y ) ); aPolygon->Add( new wxRealPoint( x, y ) );
} }
@ -130,8 +128,7 @@ void PCB_POLYGON::FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
} }
bool PCB_POLYGON::Parse( XNODE* aNode, bool PCB_POLYGON::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -149,14 +146,14 @@ bool PCB_POLYGON::Parse( XNODE* aNode,
} }
// retrieve polygon outline // retrieve polygon outline
FormPolygon( aNode, &m_outline, aDefaultMeasurementUnit, aActualConversion ); FormPolygon( aNode, &m_outline, aDefaultUnits, aActualConversion );
m_positionX = m_outline[0]->x; m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y; m_positionY = m_outline[0]->y;
// fill the polygon with the same contour as its outline is // fill the polygon with the same contour as its outline is
m_islands.Add( new VERTICES_ARRAY ); m_islands.Add( new VERTICES_ARRAY );
FormPolygon( aNode, m_islands[0], aDefaultMeasurementUnit, aActualConversion ); FormPolygon( aNode, m_islands[0], aDefaultUnits, aActualConversion );
return true; return true;
} }

View File

@ -42,7 +42,7 @@ public:
PCB_POLYGON( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ); PCB_POLYGON( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_POLYGON(); ~PCB_POLYGON();
virtual bool Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, virtual bool Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ); const wxString& aActualConversion );
virtual void SetPosOffset( int aX_offs, int aY_offs ) override; virtual void SetPosOffset( int aX_offs, int aY_offs ) override;
@ -59,7 +59,7 @@ public:
void SetOutline( VERTICES_ARRAY* aOutline ); void SetOutline( VERTICES_ARRAY* aOutline );
void FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon, void FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
const wxString& aDefaultMeasurementUnit, const wxString& actualConversion ); const wxString& aDefaultUnits, const wxString& actualConversion );
int m_width; int m_width;
int m_priority; int m_priority;

View File

@ -46,7 +46,7 @@ PCB_TEXT::~PCB_TEXT()
} }
void PCB_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurementUnit, void PCB_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -61,7 +61,7 @@ void PCB_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurem
if( lNode ) if( lNode )
{ {
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_positionX, &m_positionY, SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
aActualConversion ); aActualConversion );
} }
@ -88,7 +88,7 @@ void PCB_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurem
lNode = FindNode( aNode, wxT( "textStyleRef" ) ); lNode = FindNode( aNode, wxT( "textStyleRef" ) );
if( lNode ) if( lNode )
SetFontProperty( lNode, &m_name, aDefaultMeasurementUnit, aActualConversion ); SetFontProperty( lNode, &m_name, aDefaultUnits, aActualConversion );
} }

View File

@ -42,7 +42,7 @@ public:
PCB_TEXT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); PCB_TEXT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_TEXT(); ~PCB_TEXT();
virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurementUnit, virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
const wxString& aActualConversion ); const wxString& aActualConversion );
void AddToFootprint( FOOTPRINT* aFootprint ) override; void AddToFootprint( FOOTPRINT* aFootprint ) override;

View File

@ -33,7 +33,8 @@
namespace PCAD2KICAD { namespace PCAD2KICAD {
PCB_VIA::PCB_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_PAD( aCallbacks, aBoard ) PCB_VIA::PCB_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCB_PAD( aCallbacks, aBoard )
{ {
m_objType = wxT( 'V' ); m_objType = wxT( 'V' );
} }
@ -44,8 +45,7 @@ PCB_VIA::~PCB_VIA()
} }
void PCB_VIA::Parse( XNODE* aNode, void PCB_VIA::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode, * tNode; XNODE* lNode, * tNode;
@ -66,8 +66,10 @@ void PCB_VIA::Parse( XNODE* aNode,
lNode = FindNode( aNode, wxT( "pt" ) ); lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode ) if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, {
&m_positionX, &m_positionY, aActualConversion ); SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
aActualConversion );
}
lNode = FindNode( aNode, wxT( "netNameRef" ) ); lNode = FindNode( aNode, wxT( "netNameRef" ) );
@ -111,8 +113,7 @@ void PCB_VIA::Parse( XNODE* aNode,
lNode = FindNode( tNode, wxT( "holeDiam" ) ); lNode = FindNode( tNode, wxT( "holeDiam" ) );
if( lNode ) if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Hole, SetWidth( lNode->GetNodeContent(), aDefaultUnits, &m_Hole, aActualConversion );
aActualConversion );
lNode = FindNode( tNode, wxT( "viaShape" ) ); lNode = FindNode( tNode, wxT( "viaShape" ) );
@ -125,7 +126,7 @@ void PCB_VIA::Parse( XNODE* aNode,
if( FindNode( lNode, wxT( "layerNumRef" ) ) ) if( FindNode( lNode, wxT( "layerNumRef" ) ) )
{ {
viaShape = new PCB_VIA_SHAPE( m_callbacks, m_board ); viaShape = new PCB_VIA_SHAPE( m_callbacks, m_board );
viaShape->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ); viaShape->Parse( lNode, aDefaultUnits, aActualConversion );
m_Shapes.Add( viaShape ); m_Shapes.Add( viaShape );
} }
} }

View File

@ -41,7 +41,7 @@ public:
PCB_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); PCB_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_VIA(); ~PCB_VIA();
virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ) override; const wxString& aActualConversion ) override;
}; };

View File

@ -32,8 +32,8 @@
namespace PCAD2KICAD { namespace PCAD2KICAD {
PCB_VIA_SHAPE::PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, PCB_VIA_SHAPE::PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
BOARD* aBoard ) : PCB_PAD_SHAPE( aCallbacks, aBoard ) PCB_PAD_SHAPE( aCallbacks, aBoard )
{ {
} }
@ -43,8 +43,7 @@ PCB_VIA_SHAPE::~PCB_VIA_SHAPE()
} }
void PCB_VIA_SHAPE::Parse( XNODE* aNode, void PCB_VIA_SHAPE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
XNODE* lNode; XNODE* lNode;
@ -72,12 +71,12 @@ void PCB_VIA_SHAPE::Parse( XNODE* aNode,
lNode = FindNode( aNode, wxT( "shapeWidth" ) ); lNode = FindNode( aNode, wxT( "shapeWidth" ) );
if( lNode ) if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion ); SetWidth( lNode->GetNodeContent(), aDefaultUnits, &m_Width, aActualConversion );
lNode = FindNode( aNode, wxT( "shapeHeight" ) ); lNode = FindNode( aNode, wxT( "shapeHeight" ) );
if( lNode ) if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Height, aActualConversion ); SetWidth( lNode->GetNodeContent(), aDefaultUnits, &m_Height, aActualConversion );
} }

View File

@ -40,7 +40,7 @@ public:
PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_VIA_SHAPE(); ~PCB_VIA_SHAPE();
virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ) override; const wxString& aActualConversion ) override;
}; };

View File

@ -689,7 +689,6 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
else // pad name is a duplicate within this footprint else // pad name is a duplicate within this footprint
{ {
char buf[32]; char buf[32];
int duplicates = ++pinmap[ padName ]; int duplicates = ++pinmap[ padName ];
sprintf( buf, "@%d", duplicates ); sprintf( buf, "@%d", duplicates );
@ -753,11 +752,11 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
path->SetLayerId( "signal" ); path->SetLayerId( "signal" );
double radius = graphic->GetRadius(); double radius = graphic->GetRadius();
wxPoint circle_centre = graphic->m_Start0; wxPoint circle_centre = graphic->GetStart0();
SHAPE_LINE_CHAIN polyline; SHAPE_LINE_CHAIN polyline;
ConvertArcToPolyline( polyline, VECTOR2I( circle_centre ), radius, ConvertArcToPolyline( polyline, VECTOR2I( circle_centre ), radius, 0.0, 360.0,
0.0, 360.0, ARC_HIGH_DEF, ERROR_INSIDE ); ARC_HIGH_DEF, ERROR_INSIDE );
for( int ii = 0; ii < polyline.PointCount(); ++ii ) for( int ii = 0; ii < polyline.PointCount(); ++ii )
{ {
@ -805,7 +804,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
path->SetAperture( 0 );//scale( graphic->GetWidth() ) ); path->SetAperture( 0 );//scale( graphic->GetWidth() ) );
path->SetLayerId( "signal" ); path->SetLayerId( "signal" );
wxPoint arc_centre = graphic->m_Start0; wxPoint arc_centre = graphic->GetStart0();
double radius = graphic->GetRadius() + graphic->GetWidth()/2; double radius = graphic->GetRadius() + graphic->GetWidth()/2;
double arcStartDeg = graphic->GetArcAngleStart() / 10.0; double arcStartDeg = graphic->GetArcAngleStart() / 10.0;
double arcAngleDeg = graphic->GetAngle() / 10.0; double arcAngleDeg = graphic->GetAngle() / 10.0;

View File

@ -605,8 +605,8 @@ PCB_LAYER_ID PAD_TOOL::explodePad( PAD* aPad )
shape->SetWidth( primitive->GetWidth() ); shape->SetWidth( primitive->GetWidth() );
shape->SetStart( primitive->GetStart() ); shape->SetStart( primitive->GetStart() );
shape->SetEnd( primitive->GetEnd() ); shape->SetEnd( primitive->GetEnd() );
shape->SetBezControl1( primitive->GetBezControl1() ); shape->SetBezierC1( primitive->GetBezierC1());
shape->SetBezControl2( primitive->GetBezControl2() ); shape->SetBezierC2( primitive->GetBezierC2());
shape->SetAngle( primitive->GetAngle() ); shape->SetAngle( primitive->GetAngle() );
shape->SetPolyShape( primitive->GetPolyShape() ); shape->SetPolyShape( primitive->GetPolyShape() );
shape->SetLocalCoord(); shape->SetLocalCoord();
@ -716,8 +716,8 @@ void PAD_TOOL::recombinePad( PAD* aPad )
pcbShape->SetWidth( fpShape->GetWidth() ); pcbShape->SetWidth( fpShape->GetWidth() );
pcbShape->SetStart( fpShape->GetStart() ); pcbShape->SetStart( fpShape->GetStart() );
pcbShape->SetEnd( fpShape->GetEnd() ); pcbShape->SetEnd( fpShape->GetEnd() );
pcbShape->SetBezControl1( fpShape->GetBezControl1() ); pcbShape->SetBezierC1( fpShape->GetBezierC1());
pcbShape->SetBezControl2( fpShape->GetBezControl2() ); pcbShape->SetBezierC2( fpShape->GetBezierC2());
pcbShape->SetAngle( fpShape->GetAngle() ); pcbShape->SetAngle( fpShape->GetAngle() );
pcbShape->SetPolyShape( fpShape->GetPolyShape() ); pcbShape->SetPolyShape( fpShape->GetPolyShape() );

View File

@ -227,8 +227,8 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
case PCB_SHAPE_TYPE::CURVE: case PCB_SHAPE_TYPE::CURVE:
points->AddPoint( shape->GetStart() ); points->AddPoint( shape->GetStart() );
points->AddPoint( shape->GetBezControl1() ); points->AddPoint( shape->GetBezierC1() );
points->AddPoint( shape->GetBezControl2() ); points->AddPoint( shape->GetBezierC2() );
points->AddPoint( shape->GetEnd() ); points->AddPoint( shape->GetEnd() );
break; break;
@ -1153,9 +1153,9 @@ void PCB_POINT_EDITOR::updateItem() const
if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) ) if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
shape->SetStart( (wxPoint) m_editPoints->Point( BEZIER_CURVE_START ).GetPosition() ); shape->SetStart( (wxPoint) m_editPoints->Point( BEZIER_CURVE_START ).GetPosition() );
else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) ) else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) )
shape->SetBezControl1( (wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition() ); shape->SetBezierC1((wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition());
else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) ) else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) )
shape->SetBezControl2( (wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition() ); shape->SetBezierC2((wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition());
else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) ) else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) )
shape->SetEnd( (wxPoint) m_editPoints->Point( BEZIER_CURVE_END ).GetPosition() ); shape->SetEnd( (wxPoint) m_editPoints->Point( BEZIER_CURVE_END ).GetPosition() );
@ -1587,8 +1587,8 @@ void PCB_POINT_EDITOR::updatePoints()
case PCB_SHAPE_TYPE::CURVE: case PCB_SHAPE_TYPE::CURVE:
m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( shape->GetStart() ); m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( shape->GetStart() );
m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( shape->GetBezControl1() ); m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( shape->GetBezierC1() );
m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( shape->GetBezControl2() ); m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( shape->GetBezierC2() );
m_editPoints->Point( BEZIER_CURVE_END ).SetPosition( shape->GetEnd() ); m_editPoints->Point( BEZIER_CURVE_END ).SetPosition( shape->GetEnd() );
break; break;