enum class PCB_SHAPE_TYPE_T
This commit is contained in:
parent
a69256e15b
commit
21fde9b629
|
@ -647,7 +647,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
const SFVEC2F center3DU( aShape->GetCenter().x * m_biuTo3Dunits,
|
||||
-aShape->GetCenter().y * m_biuTo3Dunits );
|
||||
|
@ -665,7 +665,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
if( aShape->IsFilled() )
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
@ -697,7 +697,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
unsigned int segCount = GetCircleSegmentCount( aShape->GetBoundingBox().GetSizeMax() );
|
||||
|
||||
|
@ -706,7 +706,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
{
|
||||
const SFVEC2F start3DU( aShape->GetStart().x * m_biuTo3Dunits,
|
||||
-aShape->GetStart().y * m_biuTo3Dunits );
|
||||
|
@ -727,8 +727,8 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
|
|
|
@ -45,28 +45,28 @@ class PCB_GROUP;
|
|||
/**
|
||||
* The set of shapes for PCB graphics and tracks and footprint graphics in the .m_Shape member
|
||||
*/
|
||||
enum PCB_SHAPE_TYPE_T
|
||||
enum class PCB_SHAPE_TYPE : int
|
||||
{
|
||||
S_SEGMENT = 0, ///< usual segment : line with rounded ends
|
||||
S_RECT, ///< segment with non rounded ends
|
||||
S_ARC, ///< Arcs (with rounded ends)
|
||||
S_CIRCLE, ///< ring
|
||||
S_POLYGON, ///< polygon (not yet used for tracks, but could be in microwave apps)
|
||||
S_CURVE, ///< Bezier Curve
|
||||
S_LAST ///< last value for this list
|
||||
SEGMENT = 0, ///< usual segment : line with rounded ends
|
||||
RECT, ///< segment with non rounded ends
|
||||
ARC, ///< Arcs (with rounded ends)
|
||||
CIRCLE, ///< ring
|
||||
POLYGON, ///< polygon (not yet used for tracks, but could be in microwave apps)
|
||||
CURVE, ///< Bezier Curve
|
||||
LAST ///< last value for this list
|
||||
};
|
||||
|
||||
static inline wxString PCB_SHAPE_TYPE_T_asString( PCB_SHAPE_TYPE_T a )
|
||||
static inline wxString PCB_SHAPE_TYPE_T_asString( PCB_SHAPE_TYPE a )
|
||||
{
|
||||
switch( a )
|
||||
{
|
||||
case S_SEGMENT: return "S_SEGMENT";
|
||||
case S_RECT: return "S_RECT";
|
||||
case S_ARC: return "S_ARC";
|
||||
case S_CIRCLE: return "S_CIRCLE";
|
||||
case S_POLYGON: return "S_POLYGON";
|
||||
case S_CURVE: return "S_CURVE";
|
||||
case S_LAST: return "S_LAST"; // Synthetic value, but if we come across it we're
|
||||
case PCB_SHAPE_TYPE::SEGMENT: return "S_SEGMENT";
|
||||
case PCB_SHAPE_TYPE::RECT: return "S_RECT";
|
||||
case PCB_SHAPE_TYPE::ARC: return "S_ARC";
|
||||
case PCB_SHAPE_TYPE::CIRCLE: return "S_CIRCLE";
|
||||
case PCB_SHAPE_TYPE::POLYGON: return "S_POLYGON";
|
||||
case PCB_SHAPE_TYPE::CURVE: return "S_CURVE";
|
||||
case PCB_SHAPE_TYPE::LAST: return "S_LAST"; // Synthetic value, but if we come across it we're
|
||||
// going to want to know.
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public:
|
|||
/**
|
||||
* Convert the enum #PCB_SHAPE_TYPE_T integer value to a wxString.
|
||||
*/
|
||||
static wxString ShowShape( PCB_SHAPE_TYPE_T aShape );
|
||||
static wxString ShowShape( PCB_SHAPE_TYPE aShape );
|
||||
|
||||
/**
|
||||
* Move this object.
|
||||
|
|
|
@ -777,15 +777,15 @@ void AR_MATRIX::TraceSegmentPcb( PCB_SHAPE* pt_segm, int color, int marge,
|
|||
|
||||
switch( pt_segm->GetShape() )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
traceCircle( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
traceArc( ux0, uy0, ux1, uy1, pt_segm->GetAngle(), half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
drawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
|
|
|
@ -28,16 +28,16 @@
|
|||
#include <board.h>
|
||||
#include <string>
|
||||
|
||||
wxString BOARD_ITEM::ShowShape( PCB_SHAPE_TYPE_T aShape )
|
||||
wxString BOARD_ITEM::ShowShape( PCB_SHAPE_TYPE aShape )
|
||||
{
|
||||
switch( aShape )
|
||||
{
|
||||
case S_SEGMENT: return _( "Line" );
|
||||
case S_RECT: return _( "Rect" );
|
||||
case S_ARC: return _( "Arc" );
|
||||
case S_CIRCLE: return _( "Circle" );
|
||||
case S_CURVE: return _( "Bezier Curve" );
|
||||
case S_POLYGON: return _( "Polygon" );
|
||||
case PCB_SHAPE_TYPE::SEGMENT: return _( "Line" );
|
||||
case PCB_SHAPE_TYPE::RECT: return _( "Rect" );
|
||||
case PCB_SHAPE_TYPE::ARC: return _( "Arc" );
|
||||
case PCB_SHAPE_TYPE::CIRCLE: return _( "Circle" );
|
||||
case PCB_SHAPE_TYPE::CURVE: return _( "Bezier Curve" );
|
||||
case PCB_SHAPE_TYPE::POLYGON: return _( "Polygon" );
|
||||
default: return wxT( "??" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
if( IsFilled() )
|
||||
{
|
||||
TransformCircleToPolygon( aCornerBuffer, GetCenter(), GetRadius() + width / 2, aError,
|
||||
|
@ -460,7 +460,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
}
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -483,16 +483,16 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
TransformArcToPolygon( aCornerBuffer, GetArcStart(), GetArcMid(), GetArcEnd(), width,
|
||||
aError, aErrorLoc );
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
TransformOvalToPolygon( aCornerBuffer, m_start, m_end, width, aError, aErrorLoc );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
if( !IsPolyShapeValid() )
|
||||
break;
|
||||
|
@ -538,7 +538,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE: // Bezier curve
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier curve
|
||||
{
|
||||
std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end };
|
||||
BEZIER_POLY converter( ctrlPoints );
|
||||
|
|
|
@ -96,7 +96,7 @@ static PCB_SHAPE* findNext( PCB_SHAPE* aShape, const wxPoint& aPoint,
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
if( aPoint == graphic->GetArcStart() || aPoint == graphic->GetArcEnd() )
|
||||
return graphic;
|
||||
|
||||
|
@ -122,7 +122,7 @@ static PCB_SHAPE* findNext( PCB_SHAPE* aShape, const wxPoint& aPoint,
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
d_sq = ( pt - graphic->GetArcStart() ).SquaredEuclideanNorm();
|
||||
|
||||
if( d_sq < closest_dist_sq )
|
||||
|
@ -201,8 +201,8 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case S_RECT:
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
{
|
||||
if( graphic->GetStart().x < xmin.x )
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
wxPoint pstart = graphic->GetArcStart();
|
||||
wxPoint center = graphic->GetCenter();
|
||||
|
@ -244,7 +244,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
wxPoint pt = graphic->GetCenter();
|
||||
|
||||
|
@ -260,7 +260,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
{
|
||||
graphic->RebuildBezierToSegmentsPointsList( graphic->GetWidth() );
|
||||
|
||||
|
@ -275,7 +275,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
const SHAPE_POLY_SET poly = graphic->GetPolyShape();
|
||||
double orientation = 0.0;
|
||||
|
@ -330,13 +330,13 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
startCandidates.erase( graphic );
|
||||
|
||||
// Output the outline perimeter as polygon.
|
||||
if( graphic->GetShape() == S_CIRCLE )
|
||||
if( graphic->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
{
|
||||
TransformCircleToPolygon( aPolygons, graphic->GetCenter(), graphic->GetRadius(),
|
||||
ARC_LOW_DEF, ERROR_INSIDE );
|
||||
polygonComplete = true;
|
||||
}
|
||||
else if( graphic->GetShape() == S_RECT )
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
{
|
||||
std::vector<wxPoint> pts = graphic->GetRectCorners();
|
||||
|
||||
|
@ -352,7 +352,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
|
||||
polygonComplete = true;
|
||||
}
|
||||
else if( graphic->GetShape() == S_POLYGON )
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
{
|
||||
double orientation = 0.0;
|
||||
VECTOR2I offset = VECTOR2I( 0, 0 );
|
||||
|
@ -388,7 +388,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
// Polygon start point. Arbitrarily chosen end of the
|
||||
// segment and build the poly from here.
|
||||
|
||||
wxPoint startPt = graphic->GetShape() == S_ARC ? graphic->GetArcEnd()
|
||||
wxPoint startPt = graphic->GetShape() == PCB_SHAPE_TYPE::ARC ? graphic->GetArcEnd()
|
||||
: graphic->GetEnd();
|
||||
|
||||
prevPt = startPt;
|
||||
|
@ -402,8 +402,8 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
{
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case S_RECT:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
// As a non-first item, closed shapes can't be anything but self-intersecting
|
||||
|
||||
|
@ -419,7 +419,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
{
|
||||
wxPoint nextPt;
|
||||
|
||||
|
@ -437,7 +437,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
// We do not support arcs in polygons, so approximate an arc with a series of
|
||||
// short lines and put those line segments into the !same! PATH.
|
||||
|
@ -476,7 +476,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
{
|
||||
// We do not support Bezier curves in polygons, so approximate with a series
|
||||
// of short lines and put those line segments into the !same! PATH.
|
||||
|
@ -592,7 +592,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
|
||||
// Both circles and polygons on the edge cuts layer are closed items that
|
||||
// do not connect to other elements, so we process them independently
|
||||
if( graphic->GetShape() == S_POLYGON )
|
||||
if( graphic->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
{
|
||||
double orientation = 0.0;
|
||||
VECTOR2I offset = VECTOR2I( 0, 0 );
|
||||
|
@ -619,7 +619,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
prevPt = (wxPoint) pt;
|
||||
}
|
||||
}
|
||||
else if( graphic->GetShape() == S_CIRCLE )
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
{
|
||||
// make a circle by segments;
|
||||
wxPoint center = graphic->GetCenter();
|
||||
|
@ -646,7 +646,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
prevPt = nextPt;
|
||||
}
|
||||
}
|
||||
else if( graphic->GetShape() == S_RECT )
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
{
|
||||
std::vector<wxPoint> pts = graphic->GetRectCorners();
|
||||
|
||||
|
@ -676,7 +676,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
{
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
{
|
||||
wxPoint nextPt;
|
||||
|
||||
|
@ -695,7 +695,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
// We do not support arcs in polygons, so approximate an arc with a series of
|
||||
// short lines and put those line segments into the !same! PATH.
|
||||
{
|
||||
|
@ -734,7 +734,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
// We do not support Bezier curves in polygons, so approximate with a series
|
||||
// of short lines and put those line segments into the !same! PATH.
|
||||
{
|
||||
|
|
|
@ -155,11 +155,11 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
return false;
|
||||
|
||||
// Only an arc has a angle parameter. So do not show this parameter for other shapes
|
||||
if( m_item->GetShape() != S_ARC )
|
||||
if( m_item->GetShape() != PCB_SHAPE_TYPE::ARC )
|
||||
m_angle.Show( false );
|
||||
|
||||
// Only a Bezeier curve has control points. So do not show these parameters for other shapes
|
||||
if( m_item->GetShape() != S_CURVE )
|
||||
if( m_item->GetShape() != PCB_SHAPE_TYPE::CURVE )
|
||||
{
|
||||
m_bezierCtrlPt1Label->Show( false );
|
||||
m_bezierCtrl1X.Show( false );
|
||||
|
@ -172,7 +172,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
// Change texts according to the segment shape:
|
||||
switch( m_item->GetShape() )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
SetTitle( _( "Circle Properties" ) );
|
||||
m_startPointLabel->SetLabel( _( "Center" ) );
|
||||
|
||||
|
@ -185,25 +185,25 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
SetTitle( _( "Arc Properties" ) );
|
||||
m_AngleValue = m_item->GetAngle() / 10.0;
|
||||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
SetTitle( _( "Polygon Properties" ) );
|
||||
m_sizerLeft->Show( false );
|
||||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
SetTitle( _( "Rectangle Properties" ) );
|
||||
|
||||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
SetTitle( _( "Line Segment Properties" ) );
|
||||
|
||||
if( m_item->GetStart().x == m_item->GetEnd().x )
|
||||
|
@ -218,7 +218,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
break;
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == S_ARC )
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
{
|
||||
m_startX.SetValue( m_item->GetArcStart().x );
|
||||
m_startY.SetValue( m_item->GetArcStart().y );
|
||||
|
@ -234,11 +234,11 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
m_startY.SetValue( m_item->GetStart().y );
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == S_CIRCLE )
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
{
|
||||
m_endX.SetValue( m_item->GetRadius() );
|
||||
}
|
||||
else if( m_item->GetShape() == S_ARC )
|
||||
else if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
{
|
||||
m_endX.SetValue( m_item->GetArcEnd().x );
|
||||
m_endY.SetValue( m_item->GetArcEnd().y );
|
||||
|
@ -290,7 +290,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
BOARD_COMMIT commit( m_parent );
|
||||
commit.Modify( m_item );
|
||||
|
||||
if( m_item->GetShape() == S_ARC )
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
{
|
||||
m_item->SetArcStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
|
||||
}
|
||||
|
@ -305,11 +305,11 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
m_item->SetStartY( m_startY.GetValue() );
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == S_CIRCLE )
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
{
|
||||
m_item->SetEnd( m_item->GetStart() + wxPoint( m_endX.GetValue(), 0 ) );
|
||||
}
|
||||
else if( m_item->GetShape() == S_ARC )
|
||||
else if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
{
|
||||
m_item->SetArcEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
|
||||
}
|
||||
|
@ -325,13 +325,13 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
|
||||
// For Bezier curve: Set the two control points
|
||||
if( m_item->GetShape() == S_CURVE )
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::CURVE )
|
||||
{
|
||||
m_item->SetBezControl1( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue() ) );
|
||||
m_item->SetBezControl2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue() ) );
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == S_ARC )
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
{
|
||||
m_item->SetCenter( GetArcCenter( m_item->GetArcStart(), m_item->GetArcEnd(), m_AngleValue ) );
|
||||
m_item->SetAngle( m_AngleValue * 10.0, false );
|
||||
|
@ -343,7 +343,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
m_fp_item->SetStart0( m_fp_item->GetStart() );
|
||||
m_fp_item->SetEnd0( m_fp_item->GetEnd() );
|
||||
|
||||
if( m_fp_item->GetShape() == S_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->SetBezier0_C2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue() ) );
|
||||
|
@ -375,28 +375,28 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
|
|||
// Type specific checks.
|
||||
switch( m_item->GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
// Check angle of arc.
|
||||
if( m_angle.GetValue() == 0 )
|
||||
error_msgs.Add( _( "The arc angle cannot be zero." ) );
|
||||
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
// Check radius.
|
||||
if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() )
|
||||
error_msgs.Add( _( "The radius cannot be zero." ) );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
// Check for null rect.
|
||||
if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() )
|
||||
error_msgs.Add( _( "The rectangle cannot be empty." ) );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case S_SEGMENT:
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -75,7 +75,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
switch( m_shape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT: // Segment with rounded ends
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Segment with rounded ends
|
||||
SetTitle( _( "Segment" ) );
|
||||
m_startX.SetValue( m_shape->GetStart().x );
|
||||
m_startY.SetValue( m_shape->GetStart().y );
|
||||
|
@ -93,7 +93,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case S_CURVE: // Bezier line
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier line
|
||||
SetTitle( _( "Bezier" ) );
|
||||
m_startX.SetValue( m_shape->GetStart().x );
|
||||
m_startY.SetValue( m_shape->GetStart().y );
|
||||
|
@ -107,7 +107,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case S_ARC: // Arc with rounded ends
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
SetTitle( _( "Arc" ) );
|
||||
m_startX.SetValue( m_shape->GetEnd().x ); // confusingly, the start point of the arc
|
||||
m_startY.SetValue( m_shape->GetEnd().y );
|
||||
|
@ -128,7 +128,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // ring or circle
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
if( m_shape->GetWidth() )
|
||||
SetTitle( _( "Ring" ) );
|
||||
else
|
||||
|
@ -155,7 +155,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case S_POLYGON: // polygon
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
// polygon has a specific dialog editor. So nothing here
|
||||
break;
|
||||
|
||||
|
@ -182,19 +182,19 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
switch( m_shape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT: // Segment with rounded ends
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Segment with rounded ends
|
||||
m_shape->SetStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
|
||||
m_shape->SetEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
|
||||
break;
|
||||
|
||||
case S_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->SetEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
|
||||
m_shape->SetBezControl1( wxPoint( m_ctrl1X.GetValue(), m_ctrl1Y.GetValue() ) );
|
||||
m_shape->SetBezControl1( wxPoint( m_ctrl2X.GetValue(), m_ctrl2Y.GetValue() ) );
|
||||
break;
|
||||
|
||||
case S_ARC: // Arc with rounded ends
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
// NB: we store the center of the arc in m_Start, and, confusingly,
|
||||
// the start point in m_End
|
||||
m_shape->SetStart( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
|
||||
|
@ -203,12 +203,12 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow()
|
|||
m_shape->SetAngle( m_radius.GetValue() );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // ring or circle
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
m_shape->SetStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
|
||||
m_shape->SetEnd( m_shape->GetStart() + wxPoint( m_radius.GetValue(), 0 ) );
|
||||
break;
|
||||
|
||||
case S_POLYGON: // polygon
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
// polygon has a specific dialog editor. So nothing here
|
||||
break;
|
||||
|
||||
|
|
|
@ -693,26 +693,26 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
|||
|
||||
switch( primitive->GetShape() )
|
||||
{
|
||||
case S_SEGMENT: // usual segment : line with rounded ends
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // usual segment : line with rounded ends
|
||||
bs_info[0] = _( "Segment" );
|
||||
bs_info[1] = _( "from" ) + wxS( " " )+ formatCoord( m_units, primitive->GetStart() );
|
||||
bs_info[2] = _( "to" ) + wxS( " " )+ formatCoord( m_units, primitive->GetEnd() );
|
||||
break;
|
||||
|
||||
case S_CURVE: // Bezier segment
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier segment
|
||||
bs_info[0] = _( "Bezier" );
|
||||
bs_info[1] = _( "from" ) + wxS( " " )+ formatCoord( m_units, primitive->GetStart() );
|
||||
bs_info[2] = _( "to" ) + wxS( " " )+ formatCoord( m_units, primitive->GetEnd() );
|
||||
break;
|
||||
|
||||
case S_ARC: // Arc with rounded ends
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
bs_info[0] = _( "Arc" );
|
||||
bs_info[1] = _( "center" ) + wxS( " " )+ formatCoord( m_units, primitive->GetCenter() );
|
||||
bs_info[2] = _( "start" ) + wxS( " " )+ formatCoord( m_units, primitive->GetArcStart() );
|
||||
bs_info[3] = _( "angle" ) + wxS( " " )+ FormatAngle( primitive->GetAngle() );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // ring or circle
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
if( primitive->GetWidth() )
|
||||
bs_info[0] = _( "ring" );
|
||||
else
|
||||
|
@ -722,7 +722,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
|||
bs_info[2] = _( "radius" ) + wxS( " " )+ MessageTextFromValue( m_units, primitive->GetRadius() );
|
||||
break;
|
||||
|
||||
case S_POLYGON: // polygon
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
bs_info[0] = "Polygon";
|
||||
bs_info[1] = wxString::Format( _( "corners count %d" ),
|
||||
(int) primitive->GetPolyShape().Outline( 0 ).PointCount() );
|
||||
|
@ -2042,7 +2042,7 @@ void DIALOG_PAD_PROPERTIES::editPrimitive()
|
|||
|
||||
std::shared_ptr<PCB_SHAPE>& shape = m_primitives[select];
|
||||
|
||||
if( shape->GetShape() == S_POLYGON )
|
||||
if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
{
|
||||
DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, shape.get() );
|
||||
|
||||
|
@ -2140,14 +2140,16 @@ void DIALOG_PAD_PROPERTIES::onAddPrimitive( wxCommandEvent& event )
|
|||
if( type == -1 )
|
||||
return;
|
||||
|
||||
PCB_SHAPE_TYPE_T listtype[] = { S_SEGMENT, S_ARC, S_CURVE, S_CIRCLE, S_POLYGON };
|
||||
PCB_SHAPE_TYPE listtype[] = { PCB_SHAPE_TYPE::SEGMENT, PCB_SHAPE_TYPE::ARC,
|
||||
PCB_SHAPE_TYPE::CURVE, PCB_SHAPE_TYPE::CIRCLE,
|
||||
PCB_SHAPE_TYPE::POLYGON };
|
||||
|
||||
PCB_SHAPE* primitive = new PCB_SHAPE();
|
||||
primitive->SetShape( listtype[type] );
|
||||
primitive->SetWidth( m_board->GetDesignSettings().GetLineThickness( F_Cu ) );
|
||||
primitive->SetFilled( true );
|
||||
|
||||
if( listtype[type] == S_POLYGON )
|
||||
if( listtype[type] == PCB_SHAPE_TYPE::POLYGON )
|
||||
{
|
||||
DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, primitive );
|
||||
|
||||
|
|
|
@ -151,29 +151,29 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
|
|||
{
|
||||
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( shape->GetShape() == S_RECT )
|
||||
if( shape->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
{
|
||||
// A single rectangle for the board would make the RTree useless, so
|
||||
// convert to 4 edges
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( S_SEGMENT );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetEndX( shape->GetStartX() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( S_SEGMENT );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetEndY( shape->GetStartY() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( S_SEGMENT );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetStartX( shape->GetEndX() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( S_SEGMENT );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetStartY( shape->GetEndY() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
return true;
|
||||
}
|
||||
else if( shape->GetShape() == S_POLYGON )
|
||||
else if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
{
|
||||
// Same for polygons
|
||||
SHAPE_LINE_CHAIN poly = shape->GetPolyShape().Outline( 0 );
|
||||
|
@ -182,7 +182,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
|
|||
{
|
||||
SEG seg = poly.CSegment( ii );
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( S_SEGMENT );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetStart((wxPoint) seg.A );
|
||||
edges.back()->SetEnd((wxPoint) seg.B );
|
||||
edges.back()->SetWidth( 0 );
|
||||
|
|
|
@ -1176,7 +1176,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
{
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->m_Start0.x / SCALE_FACTOR,
|
||||
-shape->m_Start0.y / SCALE_FACTOR,
|
||||
|
@ -1184,7 +1184,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
-shape->m_End0.y / SCALE_FACTOR );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->m_Start0.x / SCALE_FACTOR,
|
||||
|
@ -1209,7 +1209,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
int radius = KiROUND( GetLineLength( shape->m_End0, shape->m_Start0 ) );
|
||||
fprintf( aFile, "CIRCLE %g %g %g\n",
|
||||
|
@ -1219,7 +1219,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
break;
|
||||
}
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
int arcendx, arcendy;
|
||||
arcendx = shape->m_End0.x - shape->m_Start0.x;
|
||||
|
@ -1238,7 +1238,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
break;
|
||||
}
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
// Not exported (TODO)
|
||||
break;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
{
|
||||
if( ( graphic->GetStart().x == graphic->GetEnd().x )
|
||||
&& ( graphic->GetStart().y == graphic->GetEnd().y ) )
|
||||
|
@ -103,7 +103,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
if( ( graphic->GetStart().x == graphic->GetEnd().x )
|
||||
&& ( graphic->GetStart().y == graphic->GetEnd().y ) )
|
||||
|
@ -129,7 +129,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
if( ( graphic->GetCenter().x == graphic->GetArcStart().x )
|
||||
&& ( graphic->GetCenter().y == graphic->GetArcStart().y ) )
|
||||
|
@ -148,7 +148,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
if( graphic->GetRadius() == 0 )
|
||||
break;
|
||||
|
|
|
@ -1791,14 +1791,14 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case S_ARC:
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
return shape->GetWidth() * shape->GetWidth();
|
||||
|
||||
case S_RECT:
|
||||
case S_CIRCLE:
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
if( !shape->IsFilled() )
|
||||
return shape->GetWidth() * shape->GetWidth();
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <view/view.h>
|
||||
|
||||
|
||||
FP_SHAPE::FP_SHAPE( FOOTPRINT* parent, PCB_SHAPE_TYPE_T aShape ) :
|
||||
FP_SHAPE::FP_SHAPE( FOOTPRINT* parent, PCB_SHAPE_TYPE aShape ) :
|
||||
PCB_SHAPE( parent, PCB_FP_SHAPE_T )
|
||||
{
|
||||
m_shape = aShape;
|
||||
|
@ -161,15 +161,15 @@ void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
// 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.
|
||||
SetAngle( -GetAngle(), false );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
default:
|
||||
case S_SEGMENT:
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
// If Start0 and Start are equal (ie: Footprint Editor), then flip both sets around the
|
||||
// centre point.
|
||||
if( m_start == m_Start0 )
|
||||
|
@ -205,7 +205,7 @@ void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
RebuildBezierToSegmentsPointsList( m_width );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
// polygon corners coordinates are relative to the footprint position, orientation 0
|
||||
m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight );
|
||||
break;
|
||||
|
@ -228,15 +228,15 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
|
|||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
// 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.
|
||||
SetAngle( -GetAngle(), false );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
default:
|
||||
case S_CURVE:
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
if( aMirrorAroundXAxis )
|
||||
{
|
||||
MIRROR( m_Start0.y, aCentre.y );
|
||||
|
@ -264,7 +264,7 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
|
|||
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
// polygon corners coordinates are always relative to the
|
||||
// footprint position, orientation 0
|
||||
m_poly.Mirror( !aMirrorAroundXAxis, aMirrorAroundXAxis );
|
||||
|
@ -301,7 +301,7 @@ void FP_SHAPE::Move( const wxPoint& aMoveVector )
|
|||
default:
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
// polygon corners coordinates are always relative to the
|
||||
// footprint position, orientation 0
|
||||
m_poly.Move( VECTOR2I( aMoveVector ) );
|
||||
|
|
|
@ -39,7 +39,7 @@ class MSG_PANEL_ITEM;
|
|||
class FP_SHAPE : public PCB_SHAPE
|
||||
{
|
||||
public:
|
||||
FP_SHAPE( FOOTPRINT* parent, PCB_SHAPE_TYPE_T aShape = S_SEGMENT );
|
||||
FP_SHAPE( FOOTPRINT* parent, PCB_SHAPE_TYPE aShape = PCB_SHAPE_TYPE::SEGMENT );
|
||||
|
||||
// Do not create a copy constructor & operator=.
|
||||
// The ones generated by the compiler are adequate.
|
||||
|
|
|
@ -69,21 +69,21 @@ bool GRAPHICS_CLEANER::isNullSegment( PCB_SHAPE* aSegment )
|
|||
{
|
||||
switch( aSegment->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
return aSegment->GetStart() == aSegment->GetEnd();
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
return aSegment->GetRadius() == 0;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
return aSegment->GetCenter().x == aSegment->GetArcStart().x
|
||||
&& aSegment->GetCenter().y == aSegment->GetArcStart().y;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
return aSegment->GetPointCount() == 0;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
aSegment->RebuildBezierToSegmentsPointsList( aSegment->GetWidth() );
|
||||
return aSegment->GetBezierPoints().empty();
|
||||
|
||||
|
@ -106,22 +106,22 @@ bool GRAPHICS_CLEANER::areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 )
|
|||
|
||||
switch( aShape1->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case S_RECT:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
return aShape1->GetStart() == aShape2->GetStart()
|
||||
&& aShape1->GetEnd() == aShape2->GetEnd();
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
return aShape1->GetCenter() == aShape2->GetCenter()
|
||||
&& aShape1->GetArcStart() == aShape2->GetArcStart()
|
||||
&& aShape1->GetAngle() == aShape2->GetAngle();
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
// TODO
|
||||
return false;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
return aShape1->GetBezControl1() == aShape2->GetBezControl1()
|
||||
&& aShape1->GetBezControl2() == aShape2->GetBezControl2()
|
||||
&& aShape1->GetBezierPoints() == aShape2->GetBezierPoints();
|
||||
|
@ -141,7 +141,8 @@ void GRAPHICS_CLEANER::cleanupSegments()
|
|||
{
|
||||
PCB_SHAPE* segment = dynamic_cast<PCB_SHAPE*>( *it );
|
||||
|
||||
if( !segment || segment->GetShape() != S_SEGMENT || segment->HasFlag( IS_DELETED ) )
|
||||
if( !segment || segment->GetShape() != PCB_SHAPE_TYPE::SEGMENT
|
||||
|| segment->HasFlag( IS_DELETED ) )
|
||||
continue;
|
||||
|
||||
if( isNullSegment( segment ) )
|
||||
|
@ -205,7 +206,7 @@ void GRAPHICS_CLEANER::mergeRects()
|
|||
{
|
||||
PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( !shape || shape->GetShape() != S_SEGMENT )
|
||||
if( !shape || shape->GetShape() != PCB_SHAPE_TYPE::SEGMENT )
|
||||
continue;
|
||||
|
||||
if( shape->GetStart().x == shape->GetEnd().x || shape->GetStart().y == shape->GetEnd().y )
|
||||
|
@ -306,7 +307,7 @@ void GRAPHICS_CLEANER::mergeRects()
|
|||
else
|
||||
rect = new PCB_SHAPE();
|
||||
|
||||
rect->SetShape( S_RECT );
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetFilled( false );
|
||||
rect->SetStart( top->start );
|
||||
rect->SetEnd( bottom->end );
|
||||
|
|
|
@ -62,7 +62,7 @@ int GRAPHICS_IMPORTER_PCBNEW::MapLineWidth( double aLineWidth )
|
|||
void GRAPHICS_IMPORTER_PCBNEW::AddLine( const VECTOR2D& aOrigin, const VECTOR2D& aEnd, double aWidth )
|
||||
{
|
||||
std::unique_ptr<PCB_SHAPE> line( createDrawing() );
|
||||
line->SetShape( S_SEGMENT );
|
||||
line->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetLayer( GetLayer() );
|
||||
line->SetWidth( MapLineWidth( aWidth ) );
|
||||
line->SetStart( MapCoordinate( aOrigin ) );
|
||||
|
@ -78,7 +78,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddLine( const VECTOR2D& aOrigin, const VECTOR2D&
|
|||
void GRAPHICS_IMPORTER_PCBNEW::AddCircle( const VECTOR2D& aCenter, double aRadius, double aWidth, bool aFilled )
|
||||
{
|
||||
std::unique_ptr<PCB_SHAPE> circle( createDrawing() );
|
||||
circle->SetShape( S_CIRCLE );
|
||||
circle->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
circle->SetFilled( aFilled );
|
||||
circle->SetLayer( GetLayer() );
|
||||
circle->SetWidth( MapLineWidth( aWidth ) );
|
||||
|
@ -96,7 +96,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D&
|
|||
double aAngle, double aWidth )
|
||||
{
|
||||
std::unique_ptr<PCB_SHAPE> arc( createDrawing() );
|
||||
arc->SetShape( S_ARC );
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetLayer( GetLayer() );
|
||||
arc->SetWidth( MapLineWidth( aWidth ) );
|
||||
arc->SetCenter( MapCoordinate( aCenter) );
|
||||
|
@ -119,7 +119,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector< VECTOR2D >& aVerti
|
|||
convertedPoints.emplace_back( MapCoordinate( precisePoint ) );
|
||||
|
||||
std::unique_ptr<PCB_SHAPE> polygon( createDrawing() );
|
||||
polygon->SetShape( S_POLYGON );
|
||||
polygon->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
polygon->SetFilled( GetLayer() != Edge_Cuts );
|
||||
polygon->SetLayer( GetLayer() );
|
||||
polygon->SetPolyPoints( convertedPoints );
|
||||
|
@ -160,7 +160,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D
|
|||
const VECTOR2D& BezierControl2, const VECTOR2D& aEnd, double aWidth )
|
||||
{
|
||||
std::unique_ptr<PCB_SHAPE> spline( createDrawing() );
|
||||
spline->SetShape( S_CURVE );
|
||||
spline->SetShape( PCB_SHAPE_TYPE::CURVE );
|
||||
spline->SetLayer( GetLayer() );
|
||||
spline->SetWidth( MapLineWidth( aWidth ) );
|
||||
spline->SetStart( MapCoordinate( aStart ) );
|
||||
|
|
|
@ -431,7 +431,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
|||
seg->SetEnd( buffer[jj] );
|
||||
seg->SetWidth( aInductorPattern.m_Width );
|
||||
seg->SetLayer( footprint->GetLayer() );
|
||||
seg->SetShape( S_SEGMENT );
|
||||
seg->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
seg->SetStart0( seg->GetStart() - footprint->GetPosition() );
|
||||
seg->SetEnd0( seg->GetEnd() - footprint->GetPosition() );
|
||||
footprint->Add( seg );
|
||||
|
|
|
@ -300,7 +300,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
|
|||
|
||||
// Add a polygonal edge (corners will be added later) on copper layer
|
||||
shape = new FP_SHAPE( footprint );
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( F_Cu );
|
||||
|
||||
|
|
|
@ -55,7 +55,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 )
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( S_POLYGON );
|
||||
item->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
item->SetFilled( aFilled );
|
||||
item->SetPolyPoints( aPoly );
|
||||
item->SetWidth( aThickness );
|
||||
|
@ -68,7 +68,7 @@ void PAD::AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness, b
|
|||
void PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness )
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( S_SEGMENT );
|
||||
item->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
item->SetFilled( false );
|
||||
item->SetStart( aStart );
|
||||
item->SetEnd( aEnd );
|
||||
|
@ -83,7 +83,7 @@ void PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aA
|
|||
int aThickness )
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( S_ARC );
|
||||
item->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
item->SetFilled( false );
|
||||
item->SetCenter( aCenter );
|
||||
item->SetArcStart( aStart );
|
||||
|
@ -99,7 +99,7 @@ void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const w
|
|||
const wxPoint& aCtrl2, int aThickness )
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( S_CURVE );
|
||||
item->SetShape( PCB_SHAPE_TYPE::CURVE );
|
||||
item->SetFilled( false );
|
||||
item->SetStart( aStart );
|
||||
item->SetEnd( aEnd );
|
||||
|
@ -115,7 +115,7 @@ void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const w
|
|||
void PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled )
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( S_CIRCLE );
|
||||
item->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
item->SetFilled( aFilled );
|
||||
item->SetStart( aCenter );
|
||||
item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) );
|
||||
|
@ -130,7 +130,7 @@ void PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThi
|
|||
bool aFilled)
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( S_RECT );
|
||||
item->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
item->SetFilled( aFilled );
|
||||
item->SetStart( aStart );
|
||||
item->SetEnd( aEnd );
|
||||
|
|
|
@ -1247,7 +1247,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
if( sketch )
|
||||
{
|
||||
m_gal->DrawSegment( start, end, thickness );
|
||||
|
@ -1261,7 +1261,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = aShape->GetRectCorners();
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
if( sketch )
|
||||
{
|
||||
m_gal->DrawArcSegment( start, aShape->GetRadius(),
|
||||
|
@ -1319,7 +1319,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
if( sketch )
|
||||
{
|
||||
m_gal->DrawCircle( start, aShape->GetRadius() - thickness / 2 );
|
||||
|
@ -1335,7 +1335,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
|
||||
const FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
|
||||
|
@ -1390,7 +1390,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
if( sketch )
|
||||
{
|
||||
// Use thickness as filter value to convert the curve to polyline when the curve
|
||||
|
@ -1415,7 +1415,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_LAST:
|
||||
case PCB_SHAPE_TYPE::LAST:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
|||
m_angle = 0;
|
||||
m_filled = false;
|
||||
m_flags = 0;
|
||||
m_shape = S_SEGMENT;
|
||||
m_shape = PCB_SHAPE_TYPE::SEGMENT;
|
||||
m_width = Millimeter2iu( DEFAULT_LINE_WIDTH );
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void PCB_SHAPE::SetPosition( const wxPoint& aPos )
|
|||
|
||||
wxPoint PCB_SHAPE::GetPosition() const
|
||||
{
|
||||
if( m_shape == S_POLYGON )
|
||||
if( m_shape == PCB_SHAPE_TYPE::POLYGON )
|
||||
return (wxPoint) m_poly.CVertex( 0 );
|
||||
else
|
||||
return m_start;
|
||||
|
@ -80,23 +80,23 @@ double PCB_SHAPE::GetLength() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
for( size_t ii = 1; ii < m_bezierPoints.size(); ++ii )
|
||||
length += GetLineLength( m_bezierPoints[ ii - 1], m_bezierPoints[ii] );
|
||||
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
length = GetLineLength( GetStart(), GetEnd() );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
for( int ii = 0; ii < m_poly.COutline( 0 ).SegmentCount(); ii++ )
|
||||
length += m_poly.COutline( 0 ).CSegment( ii ).Length();
|
||||
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
length = 2 * M_PI * GetRadius() * ( GetAngle() / 3600.0 );
|
||||
break;
|
||||
|
||||
|
@ -114,7 +114,7 @@ void PCB_SHAPE::Move( const wxPoint& aMoveVector )
|
|||
{
|
||||
// Move vector should not affect start/end for polygon since it will
|
||||
// be applied directly to polygon outline.
|
||||
if( m_shape != S_POLYGON )
|
||||
if( m_shape != PCB_SHAPE_TYPE::POLYGON )
|
||||
{
|
||||
m_start += aMoveVector;
|
||||
m_end += aMoveVector;
|
||||
|
@ -122,15 +122,15 @@ void PCB_SHAPE::Move( const wxPoint& aMoveVector )
|
|||
|
||||
switch ( m_shape )
|
||||
{
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
m_poly.Move( VECTOR2I( aMoveVector ) );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
m_thirdPoint += aMoveVector;
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
m_bezierC1 += aMoveVector;
|
||||
m_bezierC2 += aMoveVector;
|
||||
|
||||
|
@ -161,21 +161,21 @@ void PCB_SHAPE::Scale( double aScale )
|
|||
// specific parameters:
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
scalePt( m_bezierC1 );
|
||||
scalePt( m_bezierC2 );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
scalePt( m_thirdPoint );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // ring or circle
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
m_end.x = m_start.x + KiROUND( radius * aScale );
|
||||
m_end.y = m_start.y;
|
||||
break;
|
||||
|
||||
case S_POLYGON: // polygon
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
{
|
||||
std::vector<wxPoint> pts;
|
||||
|
||||
|
@ -199,16 +199,16 @@ void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
{
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_ARC:
|
||||
case S_SEGMENT:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
// these can all be done by just rotating the constituent points
|
||||
RotatePoint( &m_start, aRotCentre, aAngle );
|
||||
RotatePoint( &m_end, aRotCentre, aAngle );
|
||||
RotatePoint( &m_thirdPoint, aRotCentre, aAngle );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
if( KiROUND( aAngle ) % 900 == 0 )
|
||||
{
|
||||
RotatePoint( &m_start, aRotCentre, aAngle );
|
||||
|
@ -217,7 +217,7 @@ void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
}
|
||||
|
||||
// Convert non-cartesian-rotated rect to a diamond
|
||||
m_shape = S_POLYGON;
|
||||
m_shape = PCB_SHAPE_TYPE::POLYGON;
|
||||
m_poly.RemoveAllContours();
|
||||
m_poly.NewOutline();
|
||||
m_poly.Append( m_start );
|
||||
|
@ -227,11 +227,11 @@ void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
m_poly.Rotate( -DECIDEG2RAD( aAngle ), VECTOR2I( aRotCentre ) );
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
RotatePoint( &m_start, aRotCentre, aAngle);
|
||||
RotatePoint( &m_end, aRotCentre, aAngle);
|
||||
RotatePoint( &m_bezierC1, aRotCentre, aAngle);
|
||||
|
@ -265,7 +265,7 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
|
||||
switch ( m_shape )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
if( aFlipLeftRight )
|
||||
m_thirdPoint.x = aCentre.x - ( m_thirdPoint.x - aCentre.x );
|
||||
else
|
||||
|
@ -274,11 +274,11 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
m_angle = -m_angle;
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, VECTOR2I( aCentre ) );
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
{
|
||||
if( aFlipLeftRight )
|
||||
{
|
||||
|
@ -298,9 +298,9 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case S_RECT:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -316,7 +316,7 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
void PCB_SHAPE::RebuildBezierToSegmentsPointsList( int aMinSegLen )
|
||||
{
|
||||
// Has meaning only for S_CURVE DRAW_SEGMENT shape
|
||||
if( m_shape != S_CURVE )
|
||||
if( m_shape != PCB_SHAPE_TYPE::CURVE )
|
||||
{
|
||||
m_bezierPoints.clear();
|
||||
return;
|
||||
|
@ -345,19 +345,19 @@ wxPoint PCB_SHAPE::GetCenter() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_ARC:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
c = m_start;
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
// Midpoint of the line
|
||||
c = ( GetStart() + GetEnd() ) / 2;
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case S_RECT:
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
c = GetBoundingBox().Centre();
|
||||
break;
|
||||
|
||||
|
@ -377,7 +377,7 @@ wxPoint PCB_SHAPE::GetArcEnd() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
endPoint = m_thirdPoint;
|
||||
break;
|
||||
|
||||
|
@ -395,7 +395,7 @@ wxPoint PCB_SHAPE::GetArcMid() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
// rotate the starting point of the arc, given by m_End, through half
|
||||
// the angle m_Angle to get the middle of the arc.
|
||||
// m_Start is the arc centre
|
||||
|
@ -500,14 +500,14 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
aList.emplace_back( shape, _( "Circle" ) );
|
||||
|
||||
msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) );
|
||||
aList.emplace_back( _( "Radius" ), msg );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
aList.emplace_back( shape, _( "Arc" ) );
|
||||
|
||||
msg.Printf( wxT( "%.1f" ), m_angle / 10.0 );
|
||||
|
@ -517,21 +517,21 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
aList.emplace_back( _( "Radius" ), msg );
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
aList.emplace_back( shape, _( "Curve" ) );
|
||||
|
||||
msg = MessageTextFromValue( units, GetLength() );
|
||||
aList.emplace_back( _( "Length" ), msg );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
aList.emplace_back( shape, _( "Polygon" ) );
|
||||
|
||||
msg.Printf( "%d", GetPolyShape().Outline(0).PointCount() );
|
||||
aList.emplace_back( _( "Points" ), msg );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
aList.emplace_back( shape, _( "Rectangle" ) );
|
||||
|
||||
msg = MessageTextFromValue( units, std::abs( m_end.x - m_start.x ) );
|
||||
|
@ -541,7 +541,7 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
aList.emplace_back( _( "Height" ), msg );
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
{
|
||||
aList.emplace_back( shape, _( "Segment" ) );
|
||||
|
||||
|
@ -574,7 +574,7 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -585,19 +585,19 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
bbox.SetEnd( m_end );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
bbox.Inflate( GetRadius() );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
computeArcBBox( bbox );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
if( m_poly.IsEmpty() )
|
||||
break;
|
||||
|
@ -620,7 +620,7 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
bbox.Merge( m_bezierC1 );
|
||||
bbox.Merge( m_bezierC2 );
|
||||
bbox.Merge( m_end );
|
||||
|
@ -645,7 +645,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
int radius = GetRadius();
|
||||
int dist = KiROUND( EuclideanNorm( aPosition - GetCenter() ) );
|
||||
|
@ -663,7 +663,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
wxPoint relPos = aPosition - GetCenter();
|
||||
int radius = GetRadius();
|
||||
|
@ -703,7 +703,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
const_cast<PCB_SHAPE*>( this )->RebuildBezierToSegmentsPointsList( m_width );
|
||||
|
||||
for( unsigned int i= 1; i < m_bezierPoints.size(); i++)
|
||||
|
@ -714,13 +714,13 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
if( TestSegmentHit( aPosition, m_start, m_end, maxdist ) )
|
||||
return true;
|
||||
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -748,7 +748,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
if( IsFilled() )
|
||||
{
|
||||
return m_poly.Collide( VECTOR2I( aPosition ), maxdist );
|
||||
|
@ -782,7 +782,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
// Test if area intersects or contains the circle:
|
||||
if( aContained )
|
||||
return arect.Contains( bb );
|
||||
|
@ -800,7 +800,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
// Test for full containment of this arc in the rect
|
||||
if( aContained )
|
||||
{
|
||||
|
@ -820,7 +820,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( bb );
|
||||
|
@ -839,7 +839,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( GetStart() ) && aRect.Contains( GetEnd() );
|
||||
|
@ -853,7 +853,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( bb );
|
||||
|
@ -885,7 +885,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( bb );
|
||||
|
@ -952,7 +952,7 @@ const BOX2I PCB_SHAPE::ViewBBox() const
|
|||
{
|
||||
// For arcs - do not include the center point in the bounding box,
|
||||
// it is redundant for displaying an arc
|
||||
if( m_shape == S_ARC )
|
||||
if( m_shape == PCB_SHAPE_TYPE::ARC )
|
||||
{
|
||||
EDA_RECT bbox;
|
||||
bbox.SetOrigin( m_end );
|
||||
|
@ -1089,16 +1089,16 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
effectiveShapes.emplace_back( new SHAPE_ARC( GetCenter(), GetArcStart(),
|
||||
GetAngle() / 10.0, m_width ) );
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
effectiveShapes.emplace_back( new SHAPE_SEGMENT( GetStart(), GetEnd(), m_width ) );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -1117,7 +1117,7 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
if( IsFilled() )
|
||||
{
|
||||
|
@ -1140,7 +1140,7 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
break;
|
||||
}
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
{
|
||||
auto bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
|
||||
wxPoint start_pt = bezierPoints[0];
|
||||
|
@ -1155,7 +1155,7 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
break;
|
||||
}
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
SHAPE_LINE_CHAIN l = GetPolyShape().COutline( 0 );
|
||||
FOOTPRINT* parentFootprint = dynamic_cast<FOOTPRINT*>( m_parent );
|
||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
|||
wxPoint m_end; // Line end point or circle and arc start point
|
||||
wxPoint m_thirdPoint; // Used only for Arcs: arc end point
|
||||
|
||||
PCB_SHAPE_TYPE_T m_shape; // Shape: line, Circle, Arc
|
||||
PCB_SHAPE_TYPE m_shape; // Shape: line, Circle, Arc
|
||||
double m_angle; // Used only for Arcs: Arc angle in 1/10 deg
|
||||
wxPoint m_bezierC1; // Bezier Control Point 1
|
||||
wxPoint m_bezierC2; // Bezier Control Point 2
|
||||
|
@ -97,17 +97,17 @@ public:
|
|||
{
|
||||
switch( m_shape )
|
||||
{
|
||||
case S_RECT:
|
||||
case S_CIRCLE:
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
return m_filled;
|
||||
|
||||
case S_SEGMENT:
|
||||
case S_ARC:
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
return false;
|
||||
|
||||
case S_LAST: // Make CLang compiler happy
|
||||
case PCB_SHAPE_TYPE::LAST: // Make CLang compiler happy
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -126,8 +126,8 @@ public:
|
|||
virtual void SetAngle( double aAngle, bool aUpdateEnd = true );
|
||||
double GetAngle() const { return m_angle; }
|
||||
|
||||
void SetShape( PCB_SHAPE_TYPE_T aShape ) { m_shape = aShape; }
|
||||
PCB_SHAPE_TYPE_T GetShape() const { return m_shape; }
|
||||
void SetShape( PCB_SHAPE_TYPE aShape ) { m_shape = aShape; }
|
||||
PCB_SHAPE_TYPE GetShape() const { return m_shape; }
|
||||
|
||||
void SetBezControl1( const wxPoint& aPoint ) { m_bezierC1 = aPoint; }
|
||||
const wxPoint& GetBezControl1() const { return m_bezierC1; }
|
||||
|
|
|
@ -437,7 +437,7 @@ void BRDITEMS_PLOTTER::PlotDimension( const DIMENSION_BASE* aDim )
|
|||
{
|
||||
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
|
||||
|
||||
draw.SetShape( S_SEGMENT );
|
||||
draw.SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
draw.SetStart( wxPoint( seg.A ) );
|
||||
draw.SetEnd( wxPoint( seg.B ) );
|
||||
|
||||
|
@ -450,7 +450,7 @@ void BRDITEMS_PLOTTER::PlotDimension( const DIMENSION_BASE* aDim )
|
|||
wxPoint start( shape->Centre() );
|
||||
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
|
||||
|
||||
draw.SetShape( S_CIRCLE );
|
||||
draw.SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
draw.SetFilled( false );
|
||||
draw.SetStart( start );
|
||||
draw.SetEnd( wxPoint( start.x + radius, start.y ) );
|
||||
|
@ -477,7 +477,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
|
|||
|
||||
PCB_SHAPE draw;
|
||||
|
||||
draw.SetShape( S_CIRCLE );
|
||||
draw.SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
draw.SetFilled( false );
|
||||
draw.SetWidth( aMire->GetWidth() );
|
||||
draw.SetLayer( aMire->GetLayer() );
|
||||
|
@ -492,7 +492,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
|
|||
|
||||
PlotPcbShape( &draw );
|
||||
|
||||
draw.SetShape( S_SEGMENT );
|
||||
draw.SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
|
||||
radius = aMire->GetSize() / 2;
|
||||
dx1 = radius;
|
||||
|
@ -567,11 +567,11 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
m_plotter->ThickSegment( pos, end, thickness, GetPlotMode(), &gbr_metadata );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = aShape->GetRectCorners();
|
||||
|
||||
|
@ -595,7 +595,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
radius = KiROUND( GetLineLength( end, pos ) );
|
||||
|
||||
if( aShape->IsFilled() )
|
||||
|
@ -605,7 +605,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
radius = KiROUND( GetLineLength( end, pos ) );
|
||||
double startAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
|
||||
|
@ -624,7 +624,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
if( aShape->IsPolyShapeValid() )
|
||||
{
|
||||
const std::vector<wxPoint> &polyPoints = aShape->BuildPolyPointsList();
|
||||
|
@ -682,7 +682,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezControl1(),
|
||||
aShape->GetBezControl2(), aShape->GetEnd(), 0, thickness );
|
||||
break;
|
||||
|
@ -887,11 +887,11 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
m_plotter->ThickSegment( start, end, thickness, GetPlotMode(), &gbr_metadata );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
radius = KiROUND( GetLineLength( end, start ) );
|
||||
|
||||
if( aShape->IsFilled() )
|
||||
|
@ -901,7 +901,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
radius = KiROUND( GetLineLength( end, start ) );
|
||||
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
||||
EndAngle = StAngle + aShape->GetAngle();
|
||||
|
@ -918,12 +918,12 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezControl1(),
|
||||
aShape->GetBezControl2(), aShape->GetEnd(), 0, thickness );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
if( aShape->IsPolyShapeValid() )
|
||||
{
|
||||
if( sketch || thickness > 0 )
|
||||
|
@ -956,7 +956,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = aShape->GetRectCorners();
|
||||
|
||||
|
|
|
@ -701,13 +701,13 @@ void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector<ALTIUM_VERTICE>& aV
|
|||
|
||||
if( !last->isRound && !cur->isRound )
|
||||
{
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetStart( last->position );
|
||||
shape->SetEnd( cur->position );
|
||||
}
|
||||
else if( cur->isRound )
|
||||
{
|
||||
shape->SetShape( S_ARC );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetAngle( -NormalizeAngleDegreesPos( cur->endangle - cur->startangle ) * 10. );
|
||||
|
||||
double startradiant = DEG2RAD( cur->startangle );
|
||||
|
@ -725,7 +725,7 @@ void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector<ALTIUM_VERTICE>& aV
|
|||
wxPoint arcEnd = cur->center + arcEndOffset;
|
||||
|
||||
PCB_SHAPE* shape2 = new PCB_SHAPE( m_board );
|
||||
shape2->SetShape( S_SEGMENT );
|
||||
shape2->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
m_board->Add( shape2, ADD_MODE::APPEND );
|
||||
shape2->SetWidth( m_board->GetDesignSettings().GetLineThickness( Edge_Cuts ) );
|
||||
shape2->SetLayer( Edge_Cuts );
|
||||
|
@ -1004,7 +1004,7 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
|
|||
{
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape, ADD_MODE::APPEND );
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( aElem.linewidth );
|
||||
shape->SetStart( last );
|
||||
|
@ -1025,7 +1025,7 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
|
|||
|
||||
PCB_SHAPE* shape1 = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape1, ADD_MODE::APPEND );
|
||||
shape1->SetShape( S_SEGMENT );
|
||||
shape1->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape1->SetLayer( klayer );
|
||||
shape1->SetWidth( aElem.linewidth );
|
||||
shape1->SetStart( referencePoint0 );
|
||||
|
@ -1035,7 +1035,7 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
|
|||
|
||||
PCB_SHAPE* shape2 = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape2, ADD_MODE::APPEND );
|
||||
shape2->SetShape( S_SEGMENT );
|
||||
shape2->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape2->SetLayer( klayer );
|
||||
shape2->SetWidth( aElem.linewidth );
|
||||
shape2->SetStart( referencePoint0 );
|
||||
|
@ -1076,7 +1076,7 @@ void ALTIUM_PCB::HelperParseDimensions6Datum( const ADIMENSION6& aElem )
|
|||
{
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape, ADD_MODE::APPEND );
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( aElem.linewidth );
|
||||
shape->SetStart( aElem.referencePoint.at( i ) );
|
||||
|
@ -1502,7 +1502,7 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aRe
|
|||
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape, ADD_MODE::APPEND );
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
@ -1635,12 +1635,12 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
|
|||
|
||||
if( elem.startangle == 0. && elem.endangle == 360. )
|
||||
{ // TODO: other variants to define circle?
|
||||
shape.SetShape( S_CIRCLE );
|
||||
shape.SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape.SetArcStart( elem.center - wxPoint( 0, elem.radius ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape.SetShape( S_ARC );
|
||||
shape.SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape.SetAngle( -NormalizeAngleDegreesPos( elem.endangle - elem.startangle ) * 10. );
|
||||
|
||||
double startradiant = DEG2RAD( elem.startangle );
|
||||
|
@ -1719,12 +1719,12 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
|
|||
|
||||
if( elem.startangle == 0. && elem.endangle == 360. )
|
||||
{ // TODO: other variants to define circle?
|
||||
shape->SetShape( S_CIRCLE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetArcStart( elem.center - wxPoint( 0, elem.radius ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape->SetShape( S_ARC );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetAngle( -NormalizeAngleDegreesPos( elem.endangle - elem.startangle ) * 10. );
|
||||
|
||||
double startradiant = DEG2RAD( elem.startangle );
|
||||
|
@ -2003,7 +2003,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// filled rect
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
@ -2042,14 +2042,14 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
wxPoint p22 = aElem.position + wxPoint( -offsetX, -offsetY );
|
||||
wxPoint p21 = aElem.position + wxPoint( -offsetX, offsetY );
|
||||
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetFilled( true );
|
||||
shape->SetPolyPoints( { p11, p12, p22, p21 } );
|
||||
}
|
||||
else if( aElem.topsize.x == aElem.topsize.y )
|
||||
{
|
||||
// circle
|
||||
shape->SetShape( S_CIRCLE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetFilled( true );
|
||||
shape->SetCenter( aElem.position );
|
||||
shape->SetWidth( aElem.topsize.x / 2 );
|
||||
|
@ -2058,7 +2058,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
else if( aElem.topsize.x < aElem.topsize.y )
|
||||
{
|
||||
// short vertical line
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
wxPoint pointOffset( 0, ( aElem.topsize.y - aElem.topsize.x ) / 2 );
|
||||
shape->SetStart( aElem.position + pointOffset );
|
||||
shape->SetEnd( aElem.position - pointOffset );
|
||||
|
@ -2066,7 +2066,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
else
|
||||
{
|
||||
// short horizontal line
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
wxPoint pointOffset( ( aElem.topsize.x - aElem.topsize.y ) / 2, 0 );
|
||||
shape->SetStart( aElem.position + pointOffset );
|
||||
shape->SetEnd( aElem.position - pointOffset );
|
||||
|
@ -2081,7 +2081,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// filled circle
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( S_CIRCLE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetCenter( aElem.position );
|
||||
|
@ -2093,7 +2093,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// short line
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( std::min( aElem.topsize.x, aElem.topsize.y ) );
|
||||
|
||||
|
@ -2121,7 +2121,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// filled octagon
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
@ -2230,7 +2230,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
|
|||
if( elem.is_keepout || IsAltiumLayerAPlane( elem.layer ) )
|
||||
{
|
||||
PCB_SHAPE shape( nullptr ); // just a helper to get the graphic
|
||||
shape.SetShape( S_SEGMENT );
|
||||
shape.SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape.SetStart( elem.start );
|
||||
shape.SetEnd( elem.end );
|
||||
shape.SetWidth( elem.width );
|
||||
|
@ -2294,7 +2294,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
|
|||
else
|
||||
{
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( elem.component );
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetStart( elem.start );
|
||||
shape->SetEnd( elem.end );
|
||||
shape->SetWidth( elem.width );
|
||||
|
@ -2560,7 +2560,7 @@ void ALTIUM_PCB::ParseFills6Data( const CFB::CompoundFileReader& aReader,
|
|||
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape, ADD_MODE::APPEND );
|
||||
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
|
|
@ -1104,7 +1104,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
|
|||
ERROR_LOC::ERROR_INSIDE );
|
||||
|
||||
PCB_SHAPE* padShape = new PCB_SHAPE;
|
||||
padShape->SetShape( S_POLYGON );
|
||||
padShape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
padShape->SetFilled( true );
|
||||
padShape->SetPolyShape( padOutline );
|
||||
padShape->SetWidth( 0 );
|
||||
|
@ -1967,7 +1967,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers()
|
|||
{
|
||||
SHAPE_POLY_SET segment;
|
||||
|
||||
if( seg->GetShape() == PCB_SHAPE_TYPE_T::S_ARC )
|
||||
if( seg->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
{
|
||||
TransformArcToPolygon( segment, seg->GetStart(), seg->GetArcMid(),
|
||||
seg->GetEnd(), copperWidth, ARC_HIGH_DEF,
|
||||
|
@ -2607,12 +2607,12 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape,
|
|||
|
||||
if( isFootprint( aContainer ) )
|
||||
{
|
||||
shape = new FP_SHAPE( (FOOTPRINT*) aContainer, S_POLYGON );
|
||||
shape = new FP_SHAPE( (FOOTPRINT*) aContainer, PCB_SHAPE_TYPE::POLYGON );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape = new PCB_SHAPE( aContainer );
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
}
|
||||
|
||||
shape->SetFilled( true );
|
||||
|
@ -2734,12 +2734,12 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC
|
|||
|
||||
if( isFootprint( aContainer ) )
|
||||
{
|
||||
ds = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), S_SEGMENT );
|
||||
ds = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), PCB_SHAPE_TYPE::SEGMENT );
|
||||
}
|
||||
else
|
||||
{
|
||||
ds = new PCB_SHAPE( aContainer );
|
||||
ds->SetShape( S_SEGMENT );
|
||||
ds->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
}
|
||||
|
||||
ds->SetStart( startPoint );
|
||||
|
@ -2756,12 +2756,12 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC
|
|||
|
||||
if( isFootprint( aContainer ) )
|
||||
{
|
||||
ds = new FP_SHAPE((FOOTPRINT*) aContainer, S_ARC );
|
||||
ds = new FP_SHAPE( (FOOTPRINT*) aContainer, PCB_SHAPE_TYPE::ARC );
|
||||
}
|
||||
else
|
||||
{
|
||||
ds = new PCB_SHAPE( aContainer );
|
||||
ds->SetShape( S_ARC );
|
||||
ds->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
}
|
||||
|
||||
ds->SetArcStart( startPoint );
|
||||
|
@ -2904,7 +2904,7 @@ SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromDrawsegments( const
|
|||
{
|
||||
switch( ds->GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
if( ds->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
|
@ -2919,7 +2919,7 @@ SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromDrawsegments( const
|
|||
}
|
||||
}
|
||||
break;
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
if( ds->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* em = (FP_SHAPE*) ds;
|
||||
|
@ -2985,7 +2985,7 @@ std::vector<TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(
|
|||
{
|
||||
switch( ds->GetShape() )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
if( ds->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* em = (FP_SHAPE*) ds;
|
||||
|
@ -2998,7 +2998,7 @@ std::vector<TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(
|
|||
track = new ARC( aParentContainer, &arc );
|
||||
}
|
||||
break;
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
if( ds->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* em = (FP_SHAPE*) ds;
|
||||
|
|
|
@ -618,7 +618,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
|||
{
|
||||
wxPoint center = ConvertArcCenter( start, end, *w.curve );
|
||||
|
||||
shape->SetShape( S_ARC );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetStart( center );
|
||||
shape->SetEnd( start );
|
||||
shape->SetAngle( *w.curve * -10.0 ); // KiCad rotates the other way
|
||||
|
@ -788,7 +788,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
|||
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape, ADD_MODE::APPEND );
|
||||
|
||||
shape->SetShape( S_CIRCLE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetFilled( false );
|
||||
shape->SetLayer( layer );
|
||||
shape->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );
|
||||
|
@ -1647,14 +1647,14 @@ void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
|
|||
|
||||
if( !w.curve )
|
||||
{
|
||||
dwg = new FP_SHAPE( aFootprint, S_SEGMENT );
|
||||
dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::SEGMENT );
|
||||
|
||||
dwg->SetStart0( start );
|
||||
dwg->SetEnd0( end );
|
||||
}
|
||||
else
|
||||
{
|
||||
dwg = new FP_SHAPE( aFootprint, S_ARC );
|
||||
dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::ARC );
|
||||
wxPoint center = ConvertArcCenter( start, end, *w.curve );
|
||||
|
||||
dwg->SetStart0( center );
|
||||
|
@ -1924,7 +1924,7 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, S_POLYGON );
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::POLYGON );
|
||||
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
|
@ -2039,7 +2039,7 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, S_POLYGON );
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::POLYGON );
|
||||
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
|
@ -2109,7 +2109,7 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* gr = new FP_SHAPE( aFootprint, S_CIRCLE );
|
||||
FP_SHAPE* gr = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::CIRCLE );
|
||||
|
||||
// with == 0 means filled circle
|
||||
if( width <= 0 )
|
||||
|
|
|
@ -2025,7 +2025,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
{
|
||||
const GRAPHIC_LINE* lsrc = static_cast<const GRAPHIC_LINE*>( seg.get() );
|
||||
|
||||
FP_SHAPE* line = new FP_SHAPE( fp, S_SEGMENT );
|
||||
FP_SHAPE* line = new FP_SHAPE( fp, PCB_SHAPE_TYPE::SEGMENT );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2053,7 +2053,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
{
|
||||
const GRAPHIC_ARC* lsrc = static_cast<const GRAPHIC_ARC*>( seg.get() );
|
||||
|
||||
FP_SHAPE* arc = new FP_SHAPE( fp, S_ARC );
|
||||
FP_SHAPE* arc = new FP_SHAPE( fp, PCB_SHAPE_TYPE::ARC );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2084,7 +2084,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
const GRAPHIC_RECTANGLE *lsrc =
|
||||
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
|
||||
|
||||
FP_SHAPE* rect = new FP_SHAPE( fp, S_RECT );
|
||||
FP_SHAPE* rect = new FP_SHAPE( fp, PCB_SHAPE_TYPE::RECT );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2544,7 +2544,7 @@ bool FABMASTER::loadPolygon( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
|
|||
|
||||
PCB_SHAPE* new_poly = new PCB_SHAPE( aBoard );
|
||||
|
||||
new_poly->SetShape( S_POLYGON );
|
||||
new_poly->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
new_poly->SetLayer( layer );
|
||||
|
||||
// Polygons on the silk layer are filled but other layers are not/fill doesn't make sense
|
||||
|
@ -2688,7 +2688,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
|
|||
const GRAPHIC_LINE* src = static_cast<const GRAPHIC_LINE*>( seg.get() );
|
||||
|
||||
PCB_SHAPE* line = new PCB_SHAPE( aBoard );
|
||||
line->SetShape( S_SEGMENT );
|
||||
line->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetLayer( layer );
|
||||
line->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
line->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
@ -2705,7 +2705,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
|
|||
const GRAPHIC_ARC* src = static_cast<const GRAPHIC_ARC*>( seg.get() );
|
||||
|
||||
PCB_SHAPE* arc = new PCB_SHAPE( aBoard );
|
||||
arc->SetShape( S_ARC );
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetLayer( layer );
|
||||
arc->SetCenter( wxPoint( src->center_x, src->center_y ) );
|
||||
arc->SetArcStart( wxPoint( src->start_x, src->start_y ) );
|
||||
|
@ -2724,7 +2724,7 @@ bool FABMASTER::loadOutline( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
|
|||
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
|
||||
|
||||
PCB_SHAPE* rect = new PCB_SHAPE( aBoard );
|
||||
rect->SetShape( S_RECT );
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetLayer( layer );
|
||||
rect->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
rect->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
@ -2788,7 +2788,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
|
|||
|
||||
PCB_SHAPE* new_poly = new PCB_SHAPE( aBoard );
|
||||
|
||||
new_poly->SetShape( S_POLYGON );
|
||||
new_poly->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
new_poly->SetLayer( layer );
|
||||
new_poly->SetPolyShape( poly_outline );
|
||||
new_poly->SetWidth( 0 );
|
||||
|
@ -2810,7 +2810,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
|
|||
const GRAPHIC_LINE* src = static_cast<const GRAPHIC_LINE*>( seg.get() );
|
||||
|
||||
PCB_SHAPE* line = new PCB_SHAPE( aBoard );
|
||||
line->SetShape( S_SEGMENT );
|
||||
line->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetLayer( layer );
|
||||
line->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
line->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
@ -2824,7 +2824,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
|
|||
const GRAPHIC_ARC* src = static_cast<const GRAPHIC_ARC*>( seg.get() );
|
||||
|
||||
PCB_SHAPE* arc = new PCB_SHAPE( aBoard );
|
||||
arc->SetShape( S_ARC );
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetLayer( layer );
|
||||
arc->SetCenter( wxPoint( src->center_x, src->center_y ) );
|
||||
arc->SetArcStart( wxPoint( src->start_x, src->start_y ) );
|
||||
|
@ -2840,7 +2840,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
|
|||
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
|
||||
|
||||
PCB_SHAPE* rect = new PCB_SHAPE( aBoard );
|
||||
rect->SetShape( S_RECT );
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetLayer( layer );
|
||||
rect->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
rect->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
|
|
@ -462,7 +462,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
|
||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get() );
|
||||
shape->SetLayer( F_SilkS );
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
|
||||
parseInt( parameters[3], conv_unit ) ) );
|
||||
shape->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ),
|
||||
|
@ -486,7 +486,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
// Pcbnew does know ellipse so we must have Width = Height
|
||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get() );
|
||||
shape->SetLayer( F_SilkS );
|
||||
shape->SetShape( S_ARC );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
footprint->Add( shape );
|
||||
|
||||
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
|
||||
|
@ -506,7 +506,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
|
||||
// Geda PCB does not support circles.
|
||||
if( sweep_angle == -3600.0 )
|
||||
shape->SetShape( S_CIRCLE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
|
||||
// Angle value is clockwise in gpcb and Pcbnew.
|
||||
shape->SetAngle( sweep_angle );
|
||||
|
|
|
@ -786,7 +786,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT: // Line
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Line
|
||||
m_out->Print( aNestLevel, "(gr_line%s (start %s) (end %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
|
@ -797,21 +797,21 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
|
||||
break;
|
||||
|
||||
case S_RECT: // Rectangle
|
||||
case PCB_SHAPE_TYPE::RECT: // Rectangle
|
||||
m_out->Print( aNestLevel, "(gr_rect%s (start %s) (end %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
FormatInternalUnits( aShape->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // Circle
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // Circle
|
||||
m_out->Print( aNestLevel, "(gr_circle%s (center %s) (end %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
FormatInternalUnits( aShape->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_ARC: // Arc
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc
|
||||
m_out->Print( aNestLevel, "(gr_arc%s (start %s) (end %s) (angle %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
|
@ -819,7 +819,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
FormatAngle( aShape->GetAngle() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_POLYGON: // Polygon
|
||||
case PCB_SHAPE_TYPE::POLYGON: // Polygon
|
||||
if( aShape->IsPolyShapeValid() )
|
||||
{
|
||||
const SHAPE_POLY_SET& poly = aShape->GetPolyShape();
|
||||
|
@ -855,7 +855,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
|
||||
break;
|
||||
|
||||
case S_CURVE: // Bezier curve
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier curve
|
||||
m_out->Print( aNestLevel, "(gr_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
|
@ -875,8 +875,9 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
m_out->Print( 0, " (width %s)", FormatInternalUnits( aShape->GetWidth() ).c_str() );
|
||||
|
||||
// The filled flag represents if a solid fill is present on circles, rectangles and polygons
|
||||
if( ( aShape->GetShape() == S_POLYGON ) || ( aShape->GetShape() == S_RECT )
|
||||
|| ( aShape->GetShape() == S_CIRCLE ) )
|
||||
if( ( aShape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
|| ( aShape->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
|| ( aShape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
{
|
||||
if( aShape->IsFilled() )
|
||||
m_out->Print( 0, " (fill solid)" );
|
||||
|
@ -896,28 +897,28 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
|
||||
switch( aFPShape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT: // Line
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Line
|
||||
m_out->Print( aNestLevel, "(fp_line%s (start %s) (end %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
|
||||
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_RECT: // Rectangle
|
||||
case PCB_SHAPE_TYPE::RECT: // Rectangle
|
||||
m_out->Print( aNestLevel, "(fp_rect%s (start %s) (end %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
|
||||
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // Circle
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // Circle
|
||||
m_out->Print( aNestLevel, "(fp_circle%s (center %s) (end %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
|
||||
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_ARC: // Arc
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc
|
||||
m_out->Print( aNestLevel, "(fp_arc%s (start %s) (end %s) (angle %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
|
||||
|
@ -925,7 +926,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
FormatAngle( aFPShape->GetAngle() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_POLYGON: // Polygonal segment
|
||||
case PCB_SHAPE_TYPE::POLYGON: // Polygonal segment
|
||||
if( aFPShape->IsPolyShapeValid() )
|
||||
{
|
||||
const SHAPE_POLY_SET& poly = aFPShape->GetPolyShape();
|
||||
|
@ -960,7 +961,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE: // Bezier curve
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier curve
|
||||
m_out->Print( aNestLevel, "(fp_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
|
||||
|
@ -980,8 +981,9 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
m_out->Print( 0, " (width %s)", FormatInternalUnits( aFPShape->GetWidth() ).c_str() );
|
||||
|
||||
// The filled flag represents if a solid fill is present on circles, rectangles and polygons
|
||||
if( ( aFPShape->GetShape() == S_POLYGON ) || ( aFPShape->GetShape() == S_RECT )
|
||||
|| ( aFPShape->GetShape() == S_CIRCLE ) )
|
||||
if( ( aFPShape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
|| ( aFPShape->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
|| ( aFPShape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
{
|
||||
if( aFPShape->IsFilled() )
|
||||
m_out->Print( 0, " (fill solid)" );
|
||||
|
@ -1553,32 +1555,32 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
|
|||
|
||||
switch( primitive->GetShape() )
|
||||
{
|
||||
case S_SEGMENT: // usual segment : line with rounded ends
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // usual segment : line with rounded ends
|
||||
m_out->Print( nested_level, "(gr_line (start %s) (end %s)",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
m_out->Print( nested_level, "(gr_rect (start %s) (end %s)",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_ARC: // Arc with rounded ends
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
m_out->Print( nested_level, "(gr_arc (start %s) (end %s) (angle %s)",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetEnd() ).c_str(),
|
||||
FormatAngle( primitive->GetAngle() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // ring or circle (circle if width == 0
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle (circle if width == 0
|
||||
m_out->Print( nested_level, "(gr_circle (center %s) (end %s)",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_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))",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetBezControl1() ).c_str(),
|
||||
|
@ -1586,7 +1588,7 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
|
|||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case S_POLYGON: // polygon
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
if( primitive->GetPolyShape().COutline( 0 ).CPoints().size() < 2 )
|
||||
break; // Malformed polygon.
|
||||
|
||||
|
|
|
@ -2155,7 +2155,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
switch( CurTok() )
|
||||
{
|
||||
case T_gr_arc:
|
||||
shape->SetShape( S_ARC );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2191,7 +2191,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
break;
|
||||
|
||||
case T_gr_circle:
|
||||
shape->SetShape( S_CIRCLE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2226,7 +2226,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
break;
|
||||
|
||||
case T_gr_curve:
|
||||
shape->SetShape( S_CURVE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CURVE );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2251,7 +2251,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
break;
|
||||
|
||||
case T_gr_rect:
|
||||
shape->SetShape( S_RECT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2320,7 +2320,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
|
||||
case T_gr_poly:
|
||||
{
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetWidth( 0 ); // this is the default value. will be (perhaps) modified later
|
||||
token = NextTok();
|
||||
|
||||
|
@ -2432,12 +2432,13 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
// Legacy versions didn't have a filled flag but allowed some shapes to indicate they
|
||||
// should be filled by specifying a 0 stroke-width.
|
||||
if( shape->GetWidth() == 0
|
||||
&& ( shape->GetShape() == S_RECT || shape->GetShape() == S_CIRCLE ) )
|
||||
&& ( shape->GetShape() == PCB_SHAPE_TYPE::RECT
|
||||
|| shape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
{
|
||||
shape->SetFilled( true );
|
||||
}
|
||||
// Polygons on non-Edge_Cuts layers were always filled
|
||||
else if( shape->GetShape() == S_POLYGON && shape->GetLayer() != Edge_Cuts )
|
||||
else if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON && shape->GetLayer() != Edge_Cuts )
|
||||
{
|
||||
shape->SetFilled( true );
|
||||
}
|
||||
|
@ -3399,7 +3400,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
switch( CurTok() )
|
||||
{
|
||||
case T_fp_arc:
|
||||
shape->SetShape( S_ARC );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3445,7 +3446,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
break;
|
||||
|
||||
case T_fp_circle:
|
||||
shape->SetShape( S_CIRCLE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3479,7 +3480,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
break;
|
||||
|
||||
case T_fp_curve:
|
||||
shape->SetShape( S_CURVE );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CURVE );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3504,7 +3505,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
break;
|
||||
|
||||
case T_fp_rect:
|
||||
shape->SetShape( S_RECT );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3575,7 +3576,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
|
||||
case T_fp_poly:
|
||||
{
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3682,12 +3683,13 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
// Legacy versions didn't have a filled flag but allowed some shapes to indicate they
|
||||
// should be filled by specifying a 0 stroke-width.
|
||||
if( shape->GetWidth() == 0
|
||||
&& ( shape->GetShape() == S_RECT || shape->GetShape() == S_CIRCLE ) )
|
||||
&& ( shape->GetShape() == PCB_SHAPE_TYPE::RECT
|
||||
|| shape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
{
|
||||
shape->SetFilled( true );
|
||||
}
|
||||
// Polygons on non-Edge_Cuts layers were always filled
|
||||
else if( shape->GetShape() == S_POLYGON && shape->GetLayer() != Edge_Cuts )
|
||||
else if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON && shape->GetLayer() != Edge_Cuts )
|
||||
{
|
||||
shape->SetFilled( true );
|
||||
}
|
||||
|
|
|
@ -1618,15 +1618,15 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
|
|||
|
||||
void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
||||
{
|
||||
PCB_SHAPE_TYPE_T shape;
|
||||
PCB_SHAPE_TYPE shape;
|
||||
char* line = m_reader->Line(); // obtain current (old) line
|
||||
|
||||
switch( line[1] )
|
||||
{
|
||||
case 'S': shape = S_SEGMENT; break;
|
||||
case 'C': shape = S_CIRCLE; break;
|
||||
case 'A': shape = S_ARC; break;
|
||||
case 'P': shape = S_POLYGON; break;
|
||||
case 'S': shape = PCB_SHAPE_TYPE::SEGMENT; break;
|
||||
case 'C': shape = PCB_SHAPE_TYPE::CIRCLE; break;
|
||||
case 'A': shape = PCB_SHAPE_TYPE::ARC; break;
|
||||
case 'P': shape = PCB_SHAPE_TYPE::POLYGON; break;
|
||||
default:
|
||||
m_error.Printf( _( "Unknown FP_SHAPE type:'%c=0x%02x' on line:%d of footprint:\"%s\"" ),
|
||||
(unsigned char) line[1],
|
||||
|
@ -1647,7 +1647,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
|||
|
||||
switch( shape )
|
||||
{
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
BIU start0_x = biuParse( line + SZ( "DA" ), &data );
|
||||
BIU start0_y = biuParse( data, &data );
|
||||
|
@ -1667,8 +1667,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_SEGMENT:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
// e.g. "DS -7874 -10630 7874 -10630 50 20\r\n"
|
||||
BIU start0_x = biuParse( line + SZ( "DS" ), &data );
|
||||
|
@ -1684,7 +1684,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
// e.g. "DP %d %d %d %d %d %d %d\n"
|
||||
BIU start0_x = biuParse( line + SZ( "DP" ), &data );
|
||||
|
@ -1923,7 +1923,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
|
|||
if( width < 0 )
|
||||
width = 0;
|
||||
|
||||
dseg->SetShape( PCB_SHAPE_TYPE_T( shape ) );
|
||||
dseg->SetShape( static_cast<PCB_SHAPE_TYPE>( shape ) );
|
||||
dseg->SetFilled( false );
|
||||
dseg->SetWidth( width );
|
||||
dseg->SetStart( wxPoint( start_x, start_y ) );
|
||||
|
|
|
@ -160,7 +160,8 @@ void PCB_ARC::AddToFootprint( FOOTPRINT* aFootprint )
|
|||
{
|
||||
if( IsNonCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
FP_SHAPE* arc = new FP_SHAPE( aFootprint, ( IsCircle() ? S_CIRCLE : S_ARC ) );
|
||||
FP_SHAPE* arc = new FP_SHAPE(
|
||||
aFootprint, ( IsCircle() ? PCB_SHAPE_TYPE::CIRCLE : PCB_SHAPE_TYPE::ARC ) );
|
||||
aFootprint->Add( arc );
|
||||
|
||||
arc->m_Start0 = wxPoint( m_positionX, m_positionY );
|
||||
|
@ -184,7 +185,7 @@ void PCB_ARC::AddToBoard()
|
|||
|
||||
m_board->Add( arc, ADD_MODE::APPEND );
|
||||
|
||||
arc->SetShape( IsCircle() ? S_CIRCLE : S_ARC );
|
||||
arc->SetShape( IsCircle() ? PCB_SHAPE_TYPE::CIRCLE : PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetFilled( false );
|
||||
arc->SetLayer( m_KiCadLayer );
|
||||
arc->SetStart( wxPoint( m_positionX, m_positionY ) );
|
||||
|
|
|
@ -119,7 +119,7 @@ void PCB_LINE::AddToFootprint( FOOTPRINT* aFootprint )
|
|||
{
|
||||
if( IsNonCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
FP_SHAPE* segment = new FP_SHAPE( aFootprint, S_SEGMENT );
|
||||
FP_SHAPE* segment = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::SEGMENT );
|
||||
aFootprint->Add( segment );
|
||||
|
||||
segment->m_Start0 = wxPoint( m_positionX, m_positionY );
|
||||
|
|
|
@ -164,7 +164,7 @@ void PCB_POLYGON::AddToFootprint( FOOTPRINT* aFootprint )
|
|||
{
|
||||
if( IsNonCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, S_POLYGON );
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::POLYGON );
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
dwg->SetWidth( 0 );
|
||||
|
|
|
@ -1152,7 +1152,7 @@ bool PNS_KICAD_IFACE_BASE::syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aIte
|
|||
|| IsCopperLayer( aItem->GetLayer() ) )
|
||||
{
|
||||
// TODO: where do we handle filled polygons on copper layers?
|
||||
if( aItem->GetShape() == S_POLYGON && aItem->IsFilled() )
|
||||
if( aItem->GetShape() == PCB_SHAPE_TYPE::POLYGON && aItem->IsFilled() )
|
||||
return false;
|
||||
|
||||
for( SHAPE* shape : aItem->MakeEffectiveShapes() )
|
||||
|
|
|
@ -710,7 +710,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
outline = new SHAPE( image, T_outline );
|
||||
|
||||
image->Append( outline );
|
||||
|
@ -723,7 +723,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
path->AppendPoint( mapPt( graphic->GetEnd0() ) );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
// this is best done by 4 QARC's but freerouter does not yet support QARCs.
|
||||
// for now, support by using line segments.
|
||||
|
@ -765,8 +765,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
}
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,8 @@ bool CONVERT_TOOL::Init()
|
|||
static KICAD_T convertableTracks[] = { PCB_TRACE_T, PCB_ARC_T, EOT };
|
||||
static KICAD_T zones[] = { PCB_ZONE_T, PCB_FP_ZONE_T, EOT };
|
||||
|
||||
auto graphicLines = P_S_C::OnlyGraphicShapeTypes( { S_SEGMENT, S_RECT, S_CIRCLE } )
|
||||
auto graphicLines = P_S_C::OnlyGraphicShapeTypes( { PCB_SHAPE_TYPE::SEGMENT, PCB_SHAPE_TYPE::RECT,
|
||||
PCB_SHAPE_TYPE::CIRCLE } )
|
||||
&& P_S_C::SameLayer();
|
||||
|
||||
auto trackLines = S_C::MoreThan( 1 ) && S_C::OnlyTypes( convertableTracks )
|
||||
|
@ -84,9 +85,11 @@ bool CONVERT_TOOL::Init()
|
|||
auto anyLines = graphicLines || trackLines;
|
||||
|
||||
auto anyPolys = S_C::OnlyTypes( zones )
|
||||
|| P_S_C::OnlyGraphicShapeTypes( { S_POLYGON, S_RECT } );
|
||||
|| P_S_C::OnlyGraphicShapeTypes(
|
||||
{ PCB_SHAPE_TYPE::POLYGON, PCB_SHAPE_TYPE::RECT } );
|
||||
|
||||
auto lineToArc = S_C::Count( 1 ) && ( P_S_C::OnlyGraphicShapeTypes( { S_SEGMENT } )
|
||||
auto lineToArc = S_C::Count( 1 )
|
||||
&& ( P_S_C::OnlyGraphicShapeTypes( { PCB_SHAPE_TYPE::SEGMENT } )
|
||||
|| S_C::OnlyType( PCB_TRACE_T ) );
|
||||
|
||||
auto showConvert = anyPolys || anyLines || lineToArc;
|
||||
|
@ -127,9 +130,9 @@ int CONVERT_TOOL::LinesToPoly( const TOOL_EVENT& aEvent )
|
|||
case PCB_FP_SHAPE_T:
|
||||
switch( static_cast<PCB_SHAPE*>( item )->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case S_RECT:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
// case S_ARC: // Not yet
|
||||
break;
|
||||
|
||||
|
@ -185,7 +188,7 @@ int CONVERT_TOOL::LinesToPoly( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* graphic = isFootprint ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
|
||||
graphic->SetShape( S_POLYGON );
|
||||
graphic->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
graphic->SetFilled( false );
|
||||
graphic->SetWidth( poly.Outline( 0 ).Width() );
|
||||
graphic->SetLayer( destLayer );
|
||||
|
@ -341,7 +344,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromRects( const std::deque<EDA_ITEM*>& aI
|
|||
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( graphic->GetShape() != S_RECT )
|
||||
if( graphic->GetShape() != PCB_SHAPE_TYPE::RECT )
|
||||
continue;
|
||||
|
||||
SHAPE_LINE_CHAIN outline;
|
||||
|
@ -374,7 +377,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromCircles( const std::deque<EDA_ITEM*>&
|
|||
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( graphic->GetShape() != S_CIRCLE )
|
||||
if( graphic->GetShape() != PCB_SHAPE_TYPE::CIRCLE )
|
||||
continue;
|
||||
|
||||
BOARD_DESIGN_SETTINGS& bds = graphic->GetBoard()->GetDesignSettings();
|
||||
|
@ -405,10 +408,10 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
case PCB_FP_SHAPE_T:
|
||||
switch( static_cast<PCB_SHAPE*>( item )->GetShape() )
|
||||
{
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -447,11 +450,11 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( aItem );
|
||||
|
||||
if( graphic->GetShape() == S_POLYGON )
|
||||
if( graphic->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
{
|
||||
set = graphic->GetPolyShape();
|
||||
}
|
||||
else if( graphic->GetShape() == S_RECT )
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
{
|
||||
SHAPE_LINE_CHAIN outline;
|
||||
VECTOR2I start( graphic->GetStart() );
|
||||
|
@ -517,7 +520,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( fpEditor )
|
||||
{
|
||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, S_SEGMENT );
|
||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, PCB_SHAPE_TYPE::SEGMENT );
|
||||
|
||||
graphic->SetLayer( layer );
|
||||
graphic->SetStart( wxPoint( seg.A ) );
|
||||
|
@ -530,7 +533,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* graphic = new PCB_SHAPE;
|
||||
|
||||
graphic->SetShape( S_SEGMENT );
|
||||
graphic->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
graphic->SetLayer( layer );
|
||||
graphic->SetStart( wxPoint( seg.A ) );
|
||||
graphic->SetEnd( wxPoint( seg.B ) );
|
||||
|
@ -553,7 +556,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
// Creating segments on copper layer
|
||||
for( SEG& seg : segs )
|
||||
{
|
||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, S_SEGMENT );
|
||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, PCB_SHAPE_TYPE::SEGMENT );
|
||||
graphic->SetLayer( layer );
|
||||
graphic->SetStart( wxPoint( seg.A ) );
|
||||
graphic->SetStart0( wxPoint( seg.A ) );
|
||||
|
@ -641,7 +644,7 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent )
|
|||
|
||||
VECTOR2I center = GetArcCenter( start, mid, end );
|
||||
|
||||
arc->SetShape( S_ARC );
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetFilled( false );
|
||||
arc->SetLayer( layer );
|
||||
arc->SetWidth( line->GetWidth() );
|
||||
|
|
|
@ -250,7 +250,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
|
|||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::LINE );
|
||||
OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) );
|
||||
|
||||
line->SetShape( S_SEGMENT );
|
||||
line->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetFlags( IS_NEW );
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
|
@ -277,7 +277,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
line = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
line->SetShape( S_SEGMENT );
|
||||
line->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetFlags( IS_NEW );
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
|
|||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::RECTANGLE );
|
||||
OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) );
|
||||
|
||||
rect->SetShape( S_RECT );
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetFilled( false );
|
||||
rect->SetFlags(IS_NEW );
|
||||
|
||||
|
@ -321,7 +321,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
rect = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
rect->SetShape( S_RECT );
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetFilled( false );
|
||||
rect->SetFlags(IS_NEW );
|
||||
startingPoint = NULLOPT;
|
||||
|
@ -342,7 +342,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
|
|||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::CIRCLE );
|
||||
OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) );
|
||||
|
||||
circle->SetShape( S_CIRCLE );
|
||||
circle->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
circle->SetFilled( false );
|
||||
circle->SetFlags( IS_NEW );
|
||||
|
||||
|
@ -367,7 +367,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
circle = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
circle->SetShape( S_CIRCLE );
|
||||
circle->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
circle->SetFilled( false );
|
||||
circle->SetFlags( IS_NEW );
|
||||
startingPoint = NULLOPT;
|
||||
|
@ -388,7 +388,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
|
|||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ARC );
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
|
||||
arc->SetShape( S_ARC );
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetFlags( IS_NEW );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
|
@ -409,7 +409,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
arc = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
arc->SetShape( S_ARC );
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetFlags( IS_NEW );
|
||||
immediateMode = false;
|
||||
}
|
||||
|
@ -1339,9 +1339,10 @@ static void updateSegmentFromGeometryMgr( const KIGFX::PREVIEW::TWO_POINT_GEOMET
|
|||
bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
||||
OPT<VECTOR2D> aStartingPoint )
|
||||
{
|
||||
int shape = (*aGraphic)->GetShape();
|
||||
PCB_SHAPE_TYPE shape = ( *aGraphic )->GetShape();
|
||||
// Only three shapes are currently supported
|
||||
assert( shape == S_SEGMENT || shape == S_CIRCLE || shape == S_RECT );
|
||||
wxASSERT( shape == PCB_SHAPE_TYPE::SEGMENT || shape == PCB_SHAPE_TYPE::CIRCLE
|
||||
|| shape == PCB_SHAPE_TYPE::RECT );
|
||||
|
||||
EDA_UNITS userUnits = m_frame->GetUserUnits();
|
||||
PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() );
|
||||
|
@ -1505,7 +1506,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
m_lineWidth = getSegmentWidth( drawingLayer );
|
||||
|
||||
// Init the new item attributes
|
||||
graphic->SetShape( (PCB_SHAPE_TYPE_T) shape );
|
||||
graphic->SetShape( static_cast<PCB_SHAPE_TYPE>( shape ) );
|
||||
graphic->SetFilled( false );
|
||||
graphic->SetWidth( m_lineWidth );
|
||||
graphic->SetLayer( drawingLayer );
|
||||
|
@ -1532,7 +1533,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
|
||||
started = true;
|
||||
}
|
||||
else if( shape == S_CIRCLE )
|
||||
else if( shape == PCB_SHAPE_TYPE::CIRCLE )
|
||||
{
|
||||
// No clever logic if drawing a circle
|
||||
preview.Clear();
|
||||
|
@ -1544,7 +1545,8 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
PCB_SHAPE* snapItem = dyn_cast<PCB_SHAPE*>( grid.GetSnapped() );
|
||||
|
||||
if( twoPointManager.GetOrigin() == twoPointManager.GetEnd()
|
||||
|| ( evt->IsDblClick( BUT_LEFT ) && shape == S_SEGMENT ) || snapItem )
|
||||
|| ( evt->IsDblClick( BUT_LEFT ) && shape == PCB_SHAPE_TYPE::SEGMENT )
|
||||
|| snapItem )
|
||||
// User has clicked twice in the same spot
|
||||
// or clicked on the end of an existing segment (closing a path)
|
||||
{
|
||||
|
@ -1552,7 +1554,8 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
|
||||
// If the user clicks on an existing snap point from a drawsegment
|
||||
// we finish the segment as they are likely closing a path
|
||||
if( snapItem && ( shape == S_RECT || graphic->GetLength() > 0.0 ) )
|
||||
if( snapItem
|
||||
&& ( shape == PCB_SHAPE_TYPE::RECT || graphic->GetLength() > 0.0 ) )
|
||||
{
|
||||
commit.Add( graphic );
|
||||
commit.Push( _( "Draw a line segment" ) );
|
||||
|
@ -1576,13 +1579,14 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
else if( evt->IsMotion() )
|
||||
{
|
||||
// 45 degree lines
|
||||
if( started && ( ( limit45 && shape == S_SEGMENT )
|
||||
|| ( evt->Modifier( MD_CTRL ) && shape == S_RECT ) ) )
|
||||
if( started
|
||||
&& ( ( limit45 && shape == PCB_SHAPE_TYPE::SEGMENT )
|
||||
|| ( evt->Modifier( MD_CTRL ) && shape == PCB_SHAPE_TYPE::RECT ) ) )
|
||||
{
|
||||
const VECTOR2I lineVector( cursorPos - VECTOR2I( twoPointManager.GetOrigin() ) );
|
||||
|
||||
// get a restricted 45/H/V line from the last fixed point to the cursor
|
||||
auto newEnd = GetVectorSnapped45( lineVector, ( shape == S_RECT ) );
|
||||
auto newEnd = GetVectorSnapped45( lineVector, ( shape == PCB_SHAPE_TYPE::RECT ) );
|
||||
m_controls->ForceCursorPosition( true, VECTOR2I( twoPointManager.GetEnd() ) );
|
||||
twoPointManager.SetEnd( twoPointManager.GetOrigin() + (wxPoint) newEnd );
|
||||
twoPointManager.SetAngleSnap( true );
|
||||
|
@ -1778,7 +1782,7 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool
|
|||
|
||||
// Init the new item attributes
|
||||
// (non-geometric, those are handled by the manager)
|
||||
graphic->SetShape( S_ARC );
|
||||
graphic->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
graphic->SetWidth( m_lineWidth );
|
||||
|
||||
if( !m_view->IsLayerVisible( drawingLayer ) )
|
||||
|
|
|
@ -695,7 +695,7 @@ void PAD_TOOL::recombinePad( PAD* aPad )
|
|||
aPad->SetOffset( wxPoint( 0, 0 ) );
|
||||
|
||||
PCB_SHAPE* shape = new PCB_SHAPE;
|
||||
shape->SetShape( S_POLYGON );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetFilled( true );
|
||||
shape->SetPolyShape( existingOutline );
|
||||
shape->Move( - aPad->GetPosition() );
|
||||
|
|
|
@ -522,7 +522,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
int r = ( start - end ).EuclideanNorm();
|
||||
|
||||
|
@ -534,14 +534,14 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
|||
break;
|
||||
}
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
addAnchor( shape->GetArcStart(), CORNER | SNAPPABLE, shape );
|
||||
addAnchor( shape->GetArcEnd(), CORNER | SNAPPABLE, shape );
|
||||
addAnchor( shape->GetArcMid(), CORNER | SNAPPABLE, shape );
|
||||
addAnchor( shape->GetCenter(), ORIGIN | SNAPPABLE, shape );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
VECTOR2I point2( end.x, start.y );
|
||||
VECTOR2I point3( start.x, end.y );
|
||||
|
@ -561,13 +561,13 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
|||
break;
|
||||
}
|
||||
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
addAnchor( start, CORNER | SNAPPABLE, shape );
|
||||
addAnchor( end, CORNER | SNAPPABLE, shape );
|
||||
addAnchor( shape->GetCenter(), CORNER | SNAPPABLE, shape );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
SHAPE_LINE_CHAIN lc;
|
||||
lc.SetClosed( true );
|
||||
|
@ -582,7 +582,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
|||
break;
|
||||
}
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
addAnchor( start, CORNER | SNAPPABLE, shape );
|
||||
addAnchor( end, CORNER | SNAPPABLE, shape );
|
||||
KI_FALLTHROUGH;
|
||||
|
|
|
@ -181,12 +181,12 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
points->AddPoint( shape->GetStart() );
|
||||
points->AddPoint( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
points->AddPoint( shape->GetStart() );
|
||||
points->AddPoint( wxPoint( shape->GetEnd().x, shape->GetStart().y ) );
|
||||
points->AddPoint( shape->GetEnd() );
|
||||
|
@ -203,7 +203,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
|
|||
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
points->AddPoint( shape->GetCenter() );
|
||||
points->AddPoint( shape->GetArcStart() );
|
||||
points->AddPoint( shape->GetArcMid() );
|
||||
|
@ -215,16 +215,16 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
|
|||
points->Point( ARC_END ).SetGridConstraint( SNAP_TO_GRID );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
points->AddPoint( shape->GetCenter() );
|
||||
points->AddPoint( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
buildForPolyOutline( points, &shape->GetPolyShape() );
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
points->AddPoint( shape->GetStart() );
|
||||
points->AddPoint( shape->GetBezControl1() );
|
||||
points->AddPoint( shape->GetBezControl2() );
|
||||
|
@ -1026,7 +1026,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
if( isModified( m_editPoints->Point( SEG_START ) ) )
|
||||
{
|
||||
shape->SetStart( wxPoint( m_editPoints->Point( SEG_START ).GetPosition().x,
|
||||
|
@ -1040,7 +1040,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
{
|
||||
if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) ) )
|
||||
{
|
||||
|
@ -1085,7 +1085,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
{
|
||||
VECTOR2I center = m_editPoints->Point( ARC_CENTER ).GetPosition();
|
||||
VECTOR2I mid = m_editPoints->Point( ARC_MID ).GetPosition();
|
||||
|
@ -1119,7 +1119,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
{
|
||||
const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition();
|
||||
const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition();
|
||||
|
@ -1136,7 +1136,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
SHAPE_POLY_SET& outline = shape->GetPolyShape();
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
|
||||
shape->SetStart( (wxPoint) m_editPoints->Point( BEZIER_CURVE_START ).GetPosition() );
|
||||
else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) )
|
||||
|
@ -1561,12 +1561,12 @@ void PCB_POINT_EDITOR::updatePoints()
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
m_editPoints->Point( SEG_START ).SetPosition( shape->GetStart() );
|
||||
m_editPoints->Point( SEG_END ).SetPosition( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case S_RECT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shape->GetStart() );
|
||||
m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( shape->GetEnd().x,
|
||||
shape->GetStart().y );
|
||||
|
@ -1575,19 +1575,19 @@ void PCB_POINT_EDITOR::updatePoints()
|
|||
shape->GetEnd().y );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
m_editPoints->Point( ARC_CENTER ).SetPosition( shape->GetCenter() );
|
||||
m_editPoints->Point( ARC_START ).SetPosition( shape->GetArcStart() );
|
||||
m_editPoints->Point( ARC_MID ).SetPosition( shape->GetArcMid() );
|
||||
m_editPoints->Point( ARC_END ).SetPosition( shape->GetArcEnd() );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
m_editPoints->Point( CIRC_CENTER ).SetPosition( shape->GetCenter() );
|
||||
m_editPoints->Point( CIRC_END ).SetPosition( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
{
|
||||
const auto& points = shape->BuildPolyPointsList();
|
||||
|
||||
|
@ -1609,7 +1609,7 @@ void PCB_POINT_EDITOR::updatePoints()
|
|||
break;
|
||||
}
|
||||
|
||||
case S_CURVE:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
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_POINT2 ).SetPosition( shape->GetBezControl2() );
|
||||
|
@ -1802,7 +1802,8 @@ void PCB_POINT_EDITOR::setAltConstraint( bool aEnabled )
|
|||
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
isPoly = static_cast<PCB_SHAPE*>( m_editPoints->GetParent() )->GetShape() == S_POLYGON;
|
||||
isPoly = static_cast<PCB_SHAPE*>( m_editPoints->GetParent() )->GetShape()
|
||||
== PCB_SHAPE_TYPE::POLYGON;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1839,11 +1840,11 @@ EDIT_POINT PCB_POINT_EDITOR::get45DegConstrainer() const
|
|||
case PCB_FP_SHAPE_T:
|
||||
switch( static_cast<const PCB_SHAPE*>( item )->GetShape() )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
return *( m_editPoints->Next( *m_editedPoint ) ); // select the other end of line
|
||||
|
||||
case S_ARC:
|
||||
case S_CIRCLE:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
return m_editPoints->Point( CIRC_CENTER );
|
||||
|
||||
default: // suppress warnings
|
||||
|
@ -1895,7 +1896,8 @@ bool PCB_POINT_EDITOR::canAddCorner( const EDA_ITEM& aItem )
|
|||
if( type == PCB_SHAPE_T || type == PCB_FP_SHAPE_T )
|
||||
{
|
||||
const PCB_SHAPE& shape = static_cast<const PCB_SHAPE&>( aItem );
|
||||
return shape.GetShape() == S_SEGMENT || shape.GetShape() == S_POLYGON;
|
||||
return shape.GetShape() == PCB_SHAPE_TYPE::SEGMENT
|
||||
|| shape.GetShape() == PCB_SHAPE_TYPE::POLYGON;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1949,7 +1951,7 @@ bool PCB_POINT_EDITOR::removeCornerCondition( const SELECTION& )
|
|||
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
if( static_cast<PCB_SHAPE*>( item )->GetShape() == S_POLYGON )
|
||||
if( static_cast<PCB_SHAPE*>( item )->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
|
||||
else
|
||||
return false;
|
||||
|
@ -1999,7 +2001,7 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
|
|||
BOARD_COMMIT commit( frame );
|
||||
|
||||
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T
|
||||
|| ( graphicItem && graphicItem->GetShape() == S_POLYGON ) )
|
||||
|| ( graphicItem && graphicItem->GetShape() == PCB_SHAPE_TYPE::POLYGON ) )
|
||||
{
|
||||
unsigned int nearestIdx = 0;
|
||||
unsigned int nextNearestIdx = 0;
|
||||
|
@ -2070,7 +2072,7 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
|
|||
commit.Push( _( "Add a zone corner" ) );
|
||||
}
|
||||
|
||||
else if( graphicItem && graphicItem->GetShape() == S_SEGMENT )
|
||||
else if( graphicItem && graphicItem->GetShape() == PCB_SHAPE_TYPE::SEGMENT )
|
||||
{
|
||||
commit.Modify( graphicItem );
|
||||
|
||||
|
@ -2135,7 +2137,7 @@ int PCB_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( shape->GetShape() == S_POLYGON )
|
||||
if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
polygon = &shape->GetPolyShape();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ S_C PCB_SELECTION_CONDITIONS::SameLayer()
|
|||
}
|
||||
|
||||
|
||||
S_C PCB_SELECTION_CONDITIONS::OnlyGraphicShapeTypes( const std::set<PCB_SHAPE_TYPE_T> aTypes )
|
||||
S_C PCB_SELECTION_CONDITIONS::OnlyGraphicShapeTypes( const std::set<PCB_SHAPE_TYPE> aTypes )
|
||||
{
|
||||
return std::bind( &PCB_SELECTION_CONDITIONS::onlyGraphicShapeTypesFunc, _1, aTypes );
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ bool PCB_SELECTION_CONDITIONS::sameLayerFunc( const SELECTION& aSelection )
|
|||
|
||||
|
||||
bool PCB_SELECTION_CONDITIONS::onlyGraphicShapeTypesFunc( const SELECTION& aSelection,
|
||||
const std::set<PCB_SHAPE_TYPE_T> aTypes )
|
||||
const std::set<PCB_SHAPE_TYPE> aTypes )
|
||||
{
|
||||
if( aSelection.Empty() )
|
||||
return false;
|
||||
|
@ -147,7 +147,7 @@ bool PCB_SELECTION_CONDITIONS::onlyGraphicShapeTypesFunc( const SELECTION& aSele
|
|||
if( item->Type() != PCB_SHAPE_T && item->Type() != PCB_FP_SHAPE_T )
|
||||
return false;
|
||||
|
||||
PCB_SHAPE_TYPE_T shape = static_cast<const PCB_SHAPE*>( item )->GetShape();
|
||||
PCB_SHAPE_TYPE shape = static_cast<const PCB_SHAPE*>( item )->GetShape();
|
||||
|
||||
if( !aTypes.count( shape ) )
|
||||
return false;
|
||||
|
|
|
@ -69,10 +69,10 @@ public:
|
|||
*
|
||||
* This implicitly includes an OnlyType( PCB_SHAPE_T ) as part of the test.
|
||||
*
|
||||
* @param aTypes is a list of allowed PCB_SHAPE shapes (@see PCB_SHAPE_TYPE_T)
|
||||
* @param aTypes is a list of allowed PCB_SHAPE shapes (@see PCB_SHAPE_TYPE)
|
||||
* @return functor testing if selected items match the given list of allowed shapes
|
||||
*/
|
||||
static SELECTION_CONDITION OnlyGraphicShapeTypes( const std::set<PCB_SHAPE_TYPE_T> aTypes );
|
||||
static SELECTION_CONDITION OnlyGraphicShapeTypes( const std::set<PCB_SHAPE_TYPE> aTypes );
|
||||
|
||||
|
||||
private:
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
|
||||
///< Helper function used by OnlyGraphicShapeTypes()
|
||||
static bool onlyGraphicShapeTypesFunc( const SELECTION& aSelection,
|
||||
const std::set<PCB_SHAPE_TYPE_T> aTypes );
|
||||
const std::set<PCB_SHAPE_TYPE> aTypes );
|
||||
};
|
||||
|
||||
#endif /* PCB_SELECTION_CONDITIONS_H_ */
|
||||
|
|
|
@ -227,7 +227,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
|
|||
else
|
||||
poly = new PCB_SHAPE();
|
||||
|
||||
poly->SetShape( S_POLYGON );
|
||||
poly->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
|
||||
if( layer == Edge_Cuts || layer == F_CrtYd || layer == B_CrtYd )
|
||||
poly->SetFilled( false );
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace KI_TEST
|
|||
|
||||
void DrawSegment( FOOTPRINT& aFootprint, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer )
|
||||
{
|
||||
auto seg = std::make_unique<FP_SHAPE>( &aFootprint, S_SEGMENT );
|
||||
auto seg = std::make_unique<FP_SHAPE>( &aFootprint, PCB_SHAPE_TYPE::SEGMENT );
|
||||
|
||||
seg->SetStart0( (wxPoint) aSeg.A );
|
||||
seg->SetEnd0( (wxPoint) aSeg.B );
|
||||
|
@ -59,7 +59,7 @@ void DrawPolyline( FOOTPRINT& aFootprint, const std::vector<VECTOR2I>& aPts, int
|
|||
void DrawArc( FOOTPRINT& aFootprint, const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||
double aAngle, int aWidth, PCB_LAYER_ID aLayer )
|
||||
{
|
||||
auto seg = std::make_unique<FP_SHAPE>( &aFootprint, S_ARC );
|
||||
auto seg = std::make_unique<FP_SHAPE>( &aFootprint, PCB_SHAPE_TYPE::ARC );
|
||||
|
||||
seg->SetStart0( (wxPoint) aCentre );
|
||||
seg->SetEnd0( (wxPoint) aStart );
|
||||
|
|
Loading…
Reference in New Issue