Pull some name changes back from 7.0 to ease merging.
This commit is contained in:
parent
396213fa30
commit
0fb864d596
|
@ -631,7 +631,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
const SFVEC2F center3DU( aShape->GetCenter().x * m_biuTo3Dunits,
|
||||
-aShape->GetCenter().y * m_biuTo3Dunits );
|
||||
|
@ -649,7 +649,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
if( aShape->IsFilled() )
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
@ -681,7 +681,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
unsigned int segCount = GetCircleSegmentCount( aShape->GetBoundingBox().GetSizeMax() );
|
||||
|
||||
|
@ -690,7 +690,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
{
|
||||
const SFVEC2F start3DU( aShape->GetStart().x * m_biuTo3Dunits,
|
||||
-aShape->GetStart().y * m_biuTo3Dunits );
|
||||
|
@ -711,8 +711,8 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::BEZIER:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
|
@ -730,7 +730,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "BOARD_ADAPTER::addShapeWithClearance no implementation for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( aShape->GetShape() ) );
|
||||
+ SHAPE_T_asString( aShape->GetShape()) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,28 +43,28 @@ class PCB_GROUP;
|
|||
/**
|
||||
* The set of shapes for PCB graphics and tracks and footprint graphics in the .m_Shape member
|
||||
*/
|
||||
enum class PCB_SHAPE_TYPE : int
|
||||
enum class SHAPE_T : int
|
||||
{
|
||||
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
|
||||
POLY, ///< polygon (not yet used for tracks, but could be in microwave apps)
|
||||
BEZIER, ///< Bezier Curve
|
||||
LAST ///< last value for this list
|
||||
};
|
||||
|
||||
static inline wxString PCB_SHAPE_TYPE_T_asString( PCB_SHAPE_TYPE a )
|
||||
static inline wxString SHAPE_T_asString( SHAPE_T a )
|
||||
{
|
||||
switch( a )
|
||||
{
|
||||
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
|
||||
case SHAPE_T::SEGMENT: return "S_SEGMENT";
|
||||
case SHAPE_T::RECT: return "S_RECT";
|
||||
case SHAPE_T::ARC: return "S_ARC";
|
||||
case SHAPE_T::CIRCLE: return "S_CIRCLE";
|
||||
case SHAPE_T::POLY: return "S_POLYGON";
|
||||
case SHAPE_T::BEZIER: return "S_CURVE";
|
||||
case SHAPE_T::LAST: return "S_LAST"; // Synthetic value, but if we come across it we're
|
||||
// going to want to know.
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
/**
|
||||
* Convert the enum #PCB_SHAPE_TYPE_T integer value to a wxString.
|
||||
*/
|
||||
static wxString ShowShape( PCB_SHAPE_TYPE aShape );
|
||||
static wxString ShowShape( SHAPE_T 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 PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
traceCircle( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
traceArc( ux0, uy0, ux1, uy1, pt_segm->GetAngle(), half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
drawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
|
||||
break;
|
||||
|
||||
|
|
|
@ -32,17 +32,17 @@
|
|||
#include <wx/msgdlg.h>
|
||||
|
||||
|
||||
wxString BOARD_ITEM::ShowShape( PCB_SHAPE_TYPE aShape )
|
||||
wxString BOARD_ITEM::ShowShape( SHAPE_T aShape )
|
||||
{
|
||||
switch( aShape )
|
||||
{
|
||||
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( "??" );
|
||||
case SHAPE_T::SEGMENT: return _( "Line" );
|
||||
case SHAPE_T::RECT: return _( "Rect" );
|
||||
case SHAPE_T::ARC: return _( "Arc" );
|
||||
case SHAPE_T::CIRCLE: return _( "Circle" );
|
||||
case SHAPE_T::BEZIER: return _( "Bezier Curve" );
|
||||
case SHAPE_T::POLY: return _( "Polygon" );
|
||||
default: return wxT( "??" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
if( IsFilled() )
|
||||
{
|
||||
TransformCircleToPolygon( aCornerBuffer, GetCenter(), GetRadius() + width / 2, aError,
|
||||
|
@ -437,7 +437,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -461,16 +461,16 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
TransformArcToPolygon( aCornerBuffer, GetArcStart(), GetArcMid(), GetArcEnd(), width,
|
||||
aError, aErrorLoc );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
TransformOvalToPolygon( aCornerBuffer, m_start, m_end, width, aError, aErrorLoc );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
if( !IsPolyShapeValid() )
|
||||
break;
|
||||
|
@ -517,7 +517,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier curve
|
||||
case SHAPE_T::BEZIER: // Bezier curve
|
||||
{
|
||||
std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end };
|
||||
BEZIER_POLY converter( ctrlPoints );
|
||||
|
@ -535,7 +535,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::TransformShapeWithClearanceToPolygon no implementation for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ static PCB_SHAPE* findNext( PCB_SHAPE* aShape, const wxPoint& aPoint,
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
if( aPoint == graphic->GetArcStart() || aPoint == graphic->GetArcEnd() )
|
||||
return graphic;
|
||||
|
||||
|
@ -123,7 +123,7 @@ static PCB_SHAPE* findNext( PCB_SHAPE* aShape, const wxPoint& aPoint,
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
d_sq = ( pt - graphic->GetArcStart() ).SquaredEuclideanNorm();
|
||||
|
||||
if( d_sq < closest_dist_sq )
|
||||
|
@ -202,8 +202,8 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
{
|
||||
if( graphic->GetStart().x < xmin.x )
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
wxPoint pstart = graphic->GetArcStart();
|
||||
wxPoint center = graphic->GetCenter();
|
||||
|
@ -245,7 +245,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
wxPoint pt = graphic->GetCenter();
|
||||
|
||||
|
@ -261,7 +261,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
{
|
||||
graphic->RebuildBezierToSegmentsPointsList( graphic->GetWidth() );
|
||||
|
||||
|
@ -276,7 +276,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
const SHAPE_POLY_SET poly = graphic->GetPolyShape();
|
||||
double orientation = 0.0;
|
||||
|
@ -331,13 +331,13 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
startCandidates.erase( graphic );
|
||||
|
||||
// Output the outline perimeter as polygon.
|
||||
if( graphic->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
if( graphic->GetShape() == SHAPE_T::CIRCLE )
|
||||
{
|
||||
TransformCircleToPolygon( aPolygons, graphic->GetCenter(), graphic->GetRadius(),
|
||||
ARC_LOW_DEF, ERROR_INSIDE );
|
||||
polygonComplete = true;
|
||||
}
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
else if( graphic->GetShape() == SHAPE_T::RECT )
|
||||
{
|
||||
std::vector<wxPoint> pts = graphic->GetRectCorners();
|
||||
|
||||
|
@ -353,7 +353,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
|
||||
polygonComplete = true;
|
||||
}
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
else if( graphic->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
double orientation = 0.0;
|
||||
VECTOR2I offset = VECTOR2I( 0, 0 );
|
||||
|
@ -389,8 +389,8 @@ 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() == PCB_SHAPE_TYPE::ARC ? graphic->GetArcEnd()
|
||||
: graphic->GetEnd();
|
||||
wxPoint startPt = graphic->GetShape() == SHAPE_T::ARC ? graphic->GetArcEnd()
|
||||
: graphic->GetEnd();
|
||||
|
||||
prevPt = startPt;
|
||||
aPolygons.NewOutline();
|
||||
|
@ -403,8 +403,8 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
{
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
// As a non-first item, closed shapes can't be anything but self-intersecting
|
||||
|
||||
|
@ -420,7 +420,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
{
|
||||
wxPoint nextPt;
|
||||
|
||||
|
@ -438,7 +438,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::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.
|
||||
|
@ -477,7 +477,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
{
|
||||
// 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.
|
||||
|
@ -593,7 +593,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() == PCB_SHAPE_TYPE::POLYGON )
|
||||
if( graphic->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
double orientation = 0.0;
|
||||
VECTOR2I offset = VECTOR2I( 0, 0 );
|
||||
|
@ -620,7 +620,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
prevPt = (wxPoint) pt;
|
||||
}
|
||||
}
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
else if( graphic->GetShape() == SHAPE_T::CIRCLE )
|
||||
{
|
||||
// make a circle by segments;
|
||||
wxPoint center = graphic->GetCenter();
|
||||
|
@ -647,7 +647,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
prevPt = nextPt;
|
||||
}
|
||||
}
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
else if( graphic->GetShape() == SHAPE_T::RECT )
|
||||
{
|
||||
std::vector<wxPoint> pts = graphic->GetRectCorners();
|
||||
|
||||
|
@ -677,7 +677,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
{
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
{
|
||||
wxPoint nextPt;
|
||||
|
||||
|
@ -696,7 +696,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::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.
|
||||
{
|
||||
|
@ -735,7 +735,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
// 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.
|
||||
{
|
||||
|
|
|
@ -157,11 +157,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() != PCB_SHAPE_TYPE::ARC )
|
||||
if( m_item->GetShape() != SHAPE_T::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() != PCB_SHAPE_TYPE::CURVE )
|
||||
if( m_item->GetShape() != SHAPE_T::BEZIER )
|
||||
{
|
||||
m_bezierCtrlPt1Label->Show( false );
|
||||
m_bezierCtrl1X.Show( false );
|
||||
|
@ -174,7 +174,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
// Change texts according to the segment shape:
|
||||
switch( m_item->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
SetTitle( _( "Circle Properties" ) );
|
||||
m_startPointLabel->SetLabel( _( "Center" ) );
|
||||
|
||||
|
@ -187,25 +187,25 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
SetTitle( _( "Arc Properties" ) );
|
||||
m_AngleValue = m_item->GetAngle() / 10.0;
|
||||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
SetTitle( _( "Polygon Properties" ) );
|
||||
m_sizerLeft->Show( false );
|
||||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
SetTitle( _( "Rectangle Properties" ) );
|
||||
|
||||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
SetTitle( _( "Line Segment Properties" ) );
|
||||
|
||||
if( m_item->GetStart().x == m_item->GetEnd().x )
|
||||
|
@ -220,7 +220,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
break;
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
if( m_item->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
m_startX.SetValue( m_item->GetArcStart().x );
|
||||
m_startY.SetValue( m_item->GetArcStart().y );
|
||||
|
@ -236,11 +236,11 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
|||
m_startY.SetValue( m_item->GetStart().y );
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
if( m_item->GetShape() == SHAPE_T::CIRCLE )
|
||||
{
|
||||
m_endX.SetValue( m_item->GetRadius() );
|
||||
}
|
||||
else if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
else if( m_item->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
m_endX.SetValue( m_item->GetArcEnd().x );
|
||||
m_endY.SetValue( m_item->GetArcEnd().y );
|
||||
|
@ -292,7 +292,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
BOARD_COMMIT commit( m_parent );
|
||||
commit.Modify( m_item );
|
||||
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
if( m_item->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
m_item->SetArcStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
|
||||
}
|
||||
|
@ -307,11 +307,11 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
m_item->SetStartY( m_startY.GetValue() );
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::CIRCLE )
|
||||
if( m_item->GetShape() == SHAPE_T::CIRCLE )
|
||||
{
|
||||
m_item->SetEnd( m_item->GetStart() + wxPoint( m_endX.GetValue(), 0 ) );
|
||||
}
|
||||
else if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
else if( m_item->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
m_item->SetArcEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
|
||||
}
|
||||
|
@ -327,13 +327,13 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
|
||||
// For Bezier curve: Set the two control points
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::CURVE )
|
||||
if( m_item->GetShape() == SHAPE_T::BEZIER )
|
||||
{
|
||||
m_item->SetBezierC1( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue()));
|
||||
m_item->SetBezierC2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue()));
|
||||
}
|
||||
|
||||
if( m_item->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
if( m_item->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
m_item->SetCenter( GetArcCenter( m_item->GetArcStart(), m_item->GetArcEnd(), m_AngleValue ) );
|
||||
m_item->SetAngle( m_AngleValue * 10.0, false );
|
||||
|
@ -345,7 +345,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() == PCB_SHAPE_TYPE::CURVE )
|
||||
if( m_fp_item->GetShape() == SHAPE_T::BEZIER )
|
||||
{
|
||||
m_fp_item->SetBezierC1_0( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue()));
|
||||
m_fp_item->SetBezierC2_0( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue()));
|
||||
|
@ -383,28 +383,28 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
|
|||
// Type specific checks.
|
||||
switch( m_item->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
// Check angle of arc.
|
||||
if( m_angle.GetValue() == 0 )
|
||||
error_msgs.Add( _( "The arc angle cannot be zero." ) );
|
||||
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::POLYGON:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::POLY:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::BEZIER:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -78,7 +78,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
switch( m_shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Segment with rounded ends
|
||||
case SHAPE_T::SEGMENT:
|
||||
SetTitle( _( "Segment" ) );
|
||||
m_startX.SetValue( m_shape->GetStart().x );
|
||||
m_startY.SetValue( m_shape->GetStart().y );
|
||||
|
@ -96,7 +96,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier line
|
||||
case SHAPE_T::BEZIER:
|
||||
SetTitle( _( "Bezier" ) );
|
||||
m_startX.SetValue( m_shape->GetStart().x );
|
||||
m_startY.SetValue( m_shape->GetStart().y );
|
||||
|
@ -110,7 +110,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
case SHAPE_T::ARC:
|
||||
SetTitle( _( "Arc" ) );
|
||||
m_startX.SetValue( m_shape->GetEnd().x ); // confusingly, the start point of the arc
|
||||
m_startY.SetValue( m_shape->GetEnd().y );
|
||||
|
@ -131,7 +131,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( false );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
case SHAPE_T::CIRCLE:
|
||||
if( m_shape->GetWidth() )
|
||||
SetTitle( _( "Ring" ) );
|
||||
else
|
||||
|
@ -158,7 +158,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow()
|
|||
m_filledCtrl->Show( true );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
case SHAPE_T::POLY:
|
||||
// polygon has a specific dialog editor. So nothing here
|
||||
break;
|
||||
|
||||
|
@ -186,19 +186,19 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
switch( m_shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Segment with rounded ends
|
||||
case SHAPE_T::SEGMENT:
|
||||
m_shape->SetStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
|
||||
m_shape->SetEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE: // Segment with rounded ends
|
||||
case SHAPE_T::BEZIER:
|
||||
m_shape->SetStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
|
||||
m_shape->SetEnd( wxPoint( m_endX.GetValue(), m_endY.GetValue() ) );
|
||||
m_shape->SetBezierC1( wxPoint( m_ctrl1X.GetValue(), m_ctrl1Y.GetValue()));
|
||||
m_shape->SetBezierC1( wxPoint( m_ctrl2X.GetValue(), m_ctrl2Y.GetValue()));
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
case SHAPE_T::ARC:
|
||||
// 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() ) );
|
||||
|
@ -208,12 +208,12 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow()
|
|||
m_shape->SetAngle( m_radius.GetValue() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_shape->SetStart( wxPoint( m_startX.GetValue(), m_startY.GetValue() ) );
|
||||
m_shape->SetEnd( m_shape->GetStart() + wxPoint( m_radius.GetValue(), 0 ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
case SHAPE_T::POLY:
|
||||
// polygon has a specific dialog editor. So nothing here
|
||||
break;
|
||||
|
||||
|
|
|
@ -706,19 +706,19 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
|||
|
||||
switch( primitive->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // usual segment : line with rounded ends
|
||||
case SHAPE_T::SEGMENT:
|
||||
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 PCB_SHAPE_TYPE::CURVE: // Bezier segment
|
||||
case SHAPE_T::BEZIER:
|
||||
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 PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
case SHAPE_T::ARC:
|
||||
bs_info[0] = _( "Arc" );
|
||||
bs_info[1] = _( "center" ) + wxS( " " )+ formatCoord( m_units, primitive->GetCenter() );
|
||||
bs_info[2] = _( "start" ) + wxS( " " )+ formatCoord( m_units,
|
||||
|
@ -726,7 +726,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
|||
bs_info[3] = _( "angle" ) + wxS( " " )+ FormatAngle( primitive->GetAngle() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
case SHAPE_T::CIRCLE:
|
||||
if( primitive->GetWidth() )
|
||||
bs_info[0] = _( "ring" );
|
||||
else
|
||||
|
@ -737,7 +737,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
|||
primitive->GetRadius() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
case SHAPE_T::POLY:
|
||||
bs_info[0] = "Polygon";
|
||||
bs_info[1] = wxString::Format( _( "corners count %d" ),
|
||||
(int) primitive->GetPolyShape().Outline( 0 ).PointCount() );
|
||||
|
@ -2069,7 +2069,7 @@ void DIALOG_PAD_PROPERTIES::editPrimitive()
|
|||
|
||||
std::shared_ptr<PCB_SHAPE>& shape = m_primitives[select];
|
||||
|
||||
if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
if( shape->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, shape.get() );
|
||||
|
||||
|
@ -2165,16 +2165,15 @@ void DIALOG_PAD_PROPERTIES::onAddPrimitive( wxCommandEvent& event )
|
|||
if( type == -1 )
|
||||
return;
|
||||
|
||||
PCB_SHAPE_TYPE listtype[] = { PCB_SHAPE_TYPE::SEGMENT, PCB_SHAPE_TYPE::ARC,
|
||||
PCB_SHAPE_TYPE::CURVE, PCB_SHAPE_TYPE::CIRCLE,
|
||||
PCB_SHAPE_TYPE::POLYGON };
|
||||
SHAPE_T listtype[] = { SHAPE_T::SEGMENT, SHAPE_T::ARC, SHAPE_T::BEZIER, SHAPE_T::CIRCLE,
|
||||
SHAPE_T::POLY };
|
||||
|
||||
PCB_SHAPE* primitive = new PCB_SHAPE();
|
||||
primitive->SetShape( listtype[type] );
|
||||
primitive->SetWidth( m_board->GetDesignSettings().GetLineThickness( F_Cu ) );
|
||||
primitive->SetFilled( true );
|
||||
|
||||
if( listtype[type] == PCB_SHAPE_TYPE::POLYGON )
|
||||
if( listtype[type] == SHAPE_T::POLY )
|
||||
{
|
||||
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() == PCB_SHAPE_TYPE::RECT )
|
||||
if( shape->GetShape() == SHAPE_T::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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
||||
edges.back()->SetEndX( shape->GetStartX() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
||||
edges.back()->SetEndY( shape->GetStartY() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
||||
edges.back()->SetStartX( shape->GetEndX() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
||||
edges.back()->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
||||
edges.back()->SetStartY( shape->GetEndY() );
|
||||
edges.back()->SetWidth( 0 );
|
||||
return true;
|
||||
}
|
||||
else if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
else if( shape->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
// 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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
||||
edges.back()->SetStart((wxPoint) seg.A );
|
||||
edges.back()->SetEnd((wxPoint) seg.B );
|
||||
edges.back()->SetWidth( 0 );
|
||||
|
|
|
@ -1210,7 +1210,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
{
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
-shape->GetStart0().y / SCALE_FACTOR,
|
||||
|
@ -1218,7 +1218,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
-shape->GetEnd0().y / SCALE_FACTOR );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
|
@ -1243,7 +1243,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
int radius = KiROUND( GetLineLength( shape->GetEnd0(), shape->GetStart0() ) );
|
||||
|
||||
|
@ -1254,7 +1254,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
int arcendx, arcendy;
|
||||
arcendx = shape->GetEnd0().x - shape->GetStart0().x;
|
||||
|
@ -1273,7 +1273,7 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
// Not exported (TODO)
|
||||
break;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
{
|
||||
if( ( graphic->GetStart().x == graphic->GetEnd().x )
|
||||
&& ( graphic->GetStart().y == graphic->GetEnd().y ) )
|
||||
|
@ -109,7 +109,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
if( ( graphic->GetStart().x == graphic->GetEnd().x )
|
||||
&& ( graphic->GetStart().y == graphic->GetEnd().y ) )
|
||||
|
@ -135,7 +135,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
if( ( graphic->GetCenter().x == graphic->GetArcStart().x )
|
||||
&& ( graphic->GetCenter().y == graphic->GetArcStart().y ) )
|
||||
|
@ -155,7 +155,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
if( graphic->GetRadius() == 0 )
|
||||
break;
|
||||
|
|
|
@ -1805,14 +1805,14 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::BEZIER:
|
||||
return shape->GetWidth() * shape->GetWidth();
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
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 aShape ) :
|
||||
FP_SHAPE::FP_SHAPE( FOOTPRINT* parent, SHAPE_T 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 PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::BEZIER:
|
||||
// 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 PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
// 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 PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::CURVE:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::BEZIER:
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( aMirrorAroundXAxis )
|
||||
{
|
||||
MIRROR( m_start0.y, aCentre.y );
|
||||
|
@ -264,7 +264,7 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
// 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 PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
// 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 aShape = PCB_SHAPE_TYPE::SEGMENT );
|
||||
FP_SHAPE( FOOTPRINT* parent, SHAPE_T aShape = SHAPE_T::SEGMENT );
|
||||
|
||||
// Do not create a copy constructor & operator=.
|
||||
// The ones generated by the compiler are adequate.
|
||||
|
|
|
@ -65,31 +65,30 @@ void GRAPHICS_CLEANER::CleanupBoard( bool aDryRun,
|
|||
}
|
||||
|
||||
|
||||
bool GRAPHICS_CLEANER::isNullSegment( PCB_SHAPE* aSegment )
|
||||
bool GRAPHICS_CLEANER::isNullShape( PCB_SHAPE* aShape )
|
||||
{
|
||||
switch( aSegment->GetShape() )
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
return aSegment->GetStart() == aSegment->GetEnd();
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
return aShape->GetStart() == aShape->GetEnd();
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
return aSegment->GetRadius() == 0;
|
||||
case SHAPE_T::CIRCLE:
|
||||
return aShape->GetRadius() == 0;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
return aSegment->GetCenter().x == aSegment->GetArcStart().x
|
||||
&& aSegment->GetCenter().y == aSegment->GetArcStart().y;
|
||||
case SHAPE_T::ARC:
|
||||
return aShape->GetCenter() == aShape->GetArcStart();
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
return aSegment->GetPointCount() == 0;
|
||||
case SHAPE_T::POLY:
|
||||
return aShape->GetPointCount() == 0;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
aSegment->RebuildBezierToSegmentsPointsList( aSegment->GetWidth() );
|
||||
return aSegment->GetBezierPoints().empty();
|
||||
case SHAPE_T::BEZIER:
|
||||
aShape->RebuildBezierToSegmentsPointsList( aShape->GetWidth() );
|
||||
return aShape->GetBezierPoints().empty();
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "GRAPHICS_CLEANER::isNullSegment unsupported PCB_SHAPE shape: "
|
||||
+ PCB_SHAPE_TYPE_T_asString( aSegment->GetShape() ) );
|
||||
+ SHAPE_T_asString( aShape->GetShape()) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -106,29 +105,29 @@ bool GRAPHICS_CLEANER::areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 )
|
|||
|
||||
switch( aShape1->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
return aShape1->GetStart() == aShape2->GetStart()
|
||||
&& aShape1->GetEnd() == aShape2->GetEnd();
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
return aShape1->GetCenter() == aShape2->GetCenter()
|
||||
&& aShape1->GetArcStart() == aShape2->GetArcStart()
|
||||
&& aShape1->GetAngle() == aShape2->GetAngle();
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
// TODO
|
||||
return false;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
return aShape1->GetBezierC1() == aShape2->GetBezierC1()
|
||||
&& aShape1->GetBezierC2() == aShape2->GetBezierC2()
|
||||
&& aShape1->GetBezierPoints() == aShape2->GetBezierPoints();
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "GRAPHICS_CLEANER::areEquivalent unsupported PCB_SHAPE shape: "
|
||||
+ PCB_SHAPE_TYPE_T_asString( aShape1->GetShape() ) );
|
||||
+ SHAPE_T_asString( aShape1->GetShape()) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -141,11 +140,10 @@ void GRAPHICS_CLEANER::cleanupSegments()
|
|||
{
|
||||
PCB_SHAPE* segment = dynamic_cast<PCB_SHAPE*>( *it );
|
||||
|
||||
if( !segment || segment->GetShape() != PCB_SHAPE_TYPE::SEGMENT
|
||||
|| segment->HasFlag( IS_DELETED ) )
|
||||
if( !segment || segment->GetShape() != SHAPE_T::SEGMENT || segment->HasFlag( IS_DELETED ) )
|
||||
continue;
|
||||
|
||||
if( isNullSegment( segment ) )
|
||||
if( isNullShape( segment ) )
|
||||
{
|
||||
std::shared_ptr<CLEANUP_ITEM> item = std::make_shared<CLEANUP_ITEM>( CLEANUP_NULL_GRAPHIC );
|
||||
item->SetItems( segment );
|
||||
|
@ -206,7 +204,7 @@ void GRAPHICS_CLEANER::mergeRects()
|
|||
{
|
||||
PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( !shape || shape->GetShape() != PCB_SHAPE_TYPE::SEGMENT )
|
||||
if( !shape || shape->GetShape() != SHAPE_T::SEGMENT )
|
||||
continue;
|
||||
|
||||
if( shape->GetStart().x == shape->GetEnd().x || shape->GetStart().y == shape->GetEnd().y )
|
||||
|
@ -307,7 +305,7 @@ void GRAPHICS_CLEANER::mergeRects()
|
|||
else
|
||||
rect = new PCB_SHAPE();
|
||||
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetShape( SHAPE_T::RECT );
|
||||
rect->SetFilled( false );
|
||||
rect->SetStart( top->start );
|
||||
rect->SetEnd( bottom->end );
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
bool aMergeRects, bool aDeleteRedundant );
|
||||
|
||||
private:
|
||||
bool isNullSegment( PCB_SHAPE* aShape );
|
||||
bool isNullShape( PCB_SHAPE* aShape );
|
||||
bool areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 );
|
||||
|
||||
void cleanupSegments();
|
||||
|
|
|
@ -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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetShape( SHAPE_T::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( PCB_SHAPE_TYPE::CIRCLE );
|
||||
circle->SetShape( SHAPE_T::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( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetShape( SHAPE_T::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( PCB_SHAPE_TYPE::POLYGON );
|
||||
polygon->SetShape( SHAPE_T::POLY );
|
||||
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( PCB_SHAPE_TYPE::CURVE );
|
||||
spline->SetShape( SHAPE_T::BEZIER );
|
||||
spline->SetLayer( GetLayer() );
|
||||
spline->SetWidth( MapLineWidth( aWidth ) );
|
||||
spline->SetStart( MapCoordinate( aStart ) );
|
||||
|
|
|
@ -430,7 +430,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
|||
seg->SetEnd( buffer[jj] );
|
||||
seg->SetWidth( aInductorPattern.m_Width );
|
||||
seg->SetLayer( footprint->GetLayer() );
|
||||
seg->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
seg->SetShape( SHAPE_T::SEGMENT );
|
||||
seg->SetStart0( seg->GetStart() - footprint->GetPosition() );
|
||||
seg->SetEnd0( seg->GetEnd() - footprint->GetPosition() );
|
||||
footprint->Add( seg );
|
||||
|
|
|
@ -302,7 +302,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
|
|||
|
||||
// Add a polygonal edge (corners will be added later) on copper layer
|
||||
shape = new FP_SHAPE( footprint );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( F_Cu );
|
||||
|
||||
|
|
|
@ -56,7 +56,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( PCB_SHAPE_TYPE::POLYGON );
|
||||
item->SetShape( SHAPE_T::POLY );
|
||||
item->SetFilled( aFilled );
|
||||
item->SetPolyPoints( aPoly );
|
||||
item->SetWidth( aThickness );
|
||||
|
@ -69,7 +69,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
item->SetShape( SHAPE_T::SEGMENT );
|
||||
item->SetFilled( false );
|
||||
item->SetStart( aStart );
|
||||
item->SetEnd( aEnd );
|
||||
|
@ -84,7 +84,7 @@ void PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aA
|
|||
int aThickness )
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
item->SetShape( SHAPE_T::ARC );
|
||||
item->SetFilled( false );
|
||||
item->SetCenter( aCenter );
|
||||
item->SetArcStart( aStart );
|
||||
|
@ -100,7 +100,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( PCB_SHAPE_TYPE::CURVE );
|
||||
item->SetShape( SHAPE_T::BEZIER );
|
||||
item->SetFilled( false );
|
||||
item->SetStart( aStart );
|
||||
item->SetEnd( aEnd );
|
||||
|
@ -116,7 +116,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( PCB_SHAPE_TYPE::CIRCLE );
|
||||
item->SetShape( SHAPE_T::CIRCLE );
|
||||
item->SetFilled( aFilled );
|
||||
item->SetStart( aCenter );
|
||||
item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) );
|
||||
|
@ -131,7 +131,7 @@ void PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThi
|
|||
bool aFilled)
|
||||
{
|
||||
PCB_SHAPE* item = new PCB_SHAPE();
|
||||
item->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
item->SetShape( SHAPE_T::RECT );
|
||||
item->SetFilled( aFilled );
|
||||
item->SetStart( aStart );
|
||||
item->SetEnd( aEnd );
|
||||
|
|
|
@ -1353,7 +1353,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( sketch )
|
||||
{
|
||||
m_gal->DrawSegment( start, end, thickness );
|
||||
|
@ -1368,7 +1368,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = aShape->GetRectCorners();
|
||||
|
||||
|
@ -1407,7 +1407,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
if( sketch )
|
||||
{
|
||||
m_gal->DrawArcSegment( start, aShape->GetRadius(),
|
||||
|
@ -1427,7 +1427,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
if( sketch )
|
||||
{
|
||||
m_gal->DrawCircle( start, aShape->GetRadius() - thickness / 2 );
|
||||
|
@ -1443,7 +1443,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
|
||||
const FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
|
||||
|
@ -1499,7 +1499,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
if( sketch )
|
||||
{
|
||||
// Use thickness as filter value to convert the curve to polyline when the curve
|
||||
|
@ -1525,7 +1525,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::LAST:
|
||||
case SHAPE_T::LAST:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
|||
m_angle = 0;
|
||||
m_filled = false;
|
||||
m_flags = 0;
|
||||
m_shape = PCB_SHAPE_TYPE::SEGMENT;
|
||||
m_shape = SHAPE_T::SEGMENT;
|
||||
m_width = Millimeter2iu( DEFAULT_LINE_WIDTH );
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void PCB_SHAPE::SetPosition( const wxPoint& aPos )
|
|||
|
||||
wxPoint PCB_SHAPE::GetPosition() const
|
||||
{
|
||||
if( m_shape == PCB_SHAPE_TYPE::POLYGON )
|
||||
if( m_shape == SHAPE_T::POLY )
|
||||
return (wxPoint) m_poly.CVertex( 0 );
|
||||
else
|
||||
return m_start;
|
||||
|
@ -82,23 +82,23 @@ double PCB_SHAPE::GetLength() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
for( size_t ii = 1; ii < m_bezierPoints.size(); ++ii )
|
||||
length += GetLineLength( m_bezierPoints[ ii - 1], m_bezierPoints[ii] );
|
||||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
length = GetLineLength( GetStart(), GetEnd() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
for( int ii = 0; ii < m_poly.COutline( 0 ).SegmentCount(); ii++ )
|
||||
length += m_poly.COutline( 0 ).CSegment( ii ).Length();
|
||||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
length = 2 * M_PI * GetRadius() * ( GetAngle() / 3600.0 );
|
||||
break;
|
||||
|
||||
|
@ -116,7 +116,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 != PCB_SHAPE_TYPE::POLYGON )
|
||||
if( m_shape != SHAPE_T::POLY )
|
||||
{
|
||||
m_start += aMoveVector;
|
||||
m_end += aMoveVector;
|
||||
|
@ -124,15 +124,15 @@ void PCB_SHAPE::Move( const wxPoint& aMoveVector )
|
|||
|
||||
switch ( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
m_poly.Move( VECTOR2I( aMoveVector ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
m_thirdPoint += aMoveVector;
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
m_bezierC1 += aMoveVector;
|
||||
m_bezierC2 += aMoveVector;
|
||||
|
||||
|
@ -163,21 +163,21 @@ void PCB_SHAPE::Scale( double aScale )
|
|||
// specific parameters:
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
scalePt( m_bezierC1 );
|
||||
scalePt( m_bezierC2 );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
scalePt( m_thirdPoint );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
|
||||
case SHAPE_T::CIRCLE: // ring or circle
|
||||
m_end.x = m_start.x + KiROUND( radius * aScale );
|
||||
m_end.y = m_start.y;
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
case SHAPE_T::POLY: // polygon
|
||||
{
|
||||
std::vector<wxPoint> pts;
|
||||
|
||||
|
@ -201,16 +201,16 @@ void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
{
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
if( KiROUND( aAngle ) % 900 == 0 )
|
||||
{
|
||||
RotatePoint( &m_start, aRotCentre, aAngle );
|
||||
|
@ -219,7 +219,7 @@ void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
}
|
||||
|
||||
// Convert non-cartesian-rotated rect to a diamond
|
||||
m_shape = PCB_SHAPE_TYPE::POLYGON;
|
||||
m_shape = SHAPE_T::POLY;
|
||||
m_poly.RemoveAllContours();
|
||||
m_poly.NewOutline();
|
||||
m_poly.Append( m_start );
|
||||
|
@ -229,11 +229,11 @@ void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
m_poly.Rotate( -DECIDEG2RAD( aAngle ), VECTOR2I( aRotCentre ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
RotatePoint( &m_start, aRotCentre, aAngle);
|
||||
RotatePoint( &m_end, aRotCentre, aAngle);
|
||||
RotatePoint( &m_bezierC1, aRotCentre, aAngle);
|
||||
|
@ -246,7 +246,7 @@ void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::Rotate not implemented for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
|
||||
switch ( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
if( aFlipLeftRight )
|
||||
m_thirdPoint.x = aCentre.x - ( m_thirdPoint.x - aCentre.x );
|
||||
else
|
||||
|
@ -276,11 +276,11 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
m_angle = -m_angle;
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, VECTOR2I( aCentre ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
{
|
||||
if( aFlipLeftRight )
|
||||
{
|
||||
|
@ -300,14 +300,14 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::Flip not implemented for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,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 != PCB_SHAPE_TYPE::CURVE )
|
||||
if( m_shape != SHAPE_T::BEZIER )
|
||||
{
|
||||
m_bezierPoints.clear();
|
||||
return;
|
||||
|
@ -347,25 +347,25 @@ wxPoint PCB_SHAPE::GetCenter() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::CIRCLE:
|
||||
c = m_start;
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
// Midpoint of the line
|
||||
c = ( GetStart() + GetEnd() ) / 2;
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::POLY:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::BEZIER:
|
||||
c = GetBoundingBox().Centre();
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::GetCentre not implemented for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ wxPoint PCB_SHAPE::GetArcEnd() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
endPoint = m_thirdPoint;
|
||||
break;
|
||||
|
||||
|
@ -397,7 +397,7 @@ wxPoint PCB_SHAPE::GetArcMid() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::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 center
|
||||
|
@ -512,14 +512,14 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
aList.emplace_back( shape, _( "Circle" ) );
|
||||
|
||||
msg = MessageTextFromValue( units, GetLineLength( m_start, m_end ) );
|
||||
aList.emplace_back( _( "Radius" ), msg );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
aList.emplace_back( shape, _( "Arc" ) );
|
||||
|
||||
msg.Printf( wxT( "%.1f" ), m_angle / 10.0 );
|
||||
|
@ -529,21 +529,21 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
aList.emplace_back( _( "Radius" ), msg );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
aList.emplace_back( shape, _( "Curve" ) );
|
||||
|
||||
msg = MessageTextFromValue( units, GetLength() );
|
||||
aList.emplace_back( _( "Length" ), msg );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
aList.emplace_back( shape, _( "Polygon" ) );
|
||||
|
||||
msg.Printf( "%d", GetPolyShape().Outline(0).PointCount() );
|
||||
aList.emplace_back( _( "Points" ), msg );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
aList.emplace_back( shape, _( "Rectangle" ) );
|
||||
|
||||
msg = MessageTextFromValue( units, std::abs( m_end.x - m_start.x ) );
|
||||
|
@ -553,7 +553,7 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
aList.emplace_back( _( "Height" ), msg );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
{
|
||||
aList.emplace_back( shape, _( "Segment" ) );
|
||||
|
||||
|
@ -586,7 +586,7 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -598,19 +598,19 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
bbox.SetEnd( m_end );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
bbox.Inflate( GetRadius() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
computeArcBBox( bbox );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
if( m_poly.IsEmpty() )
|
||||
break;
|
||||
|
@ -634,7 +634,7 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
bbox.Merge( m_bezierC1 );
|
||||
bbox.Merge( m_bezierC2 );
|
||||
bbox.Merge( m_end );
|
||||
|
@ -642,7 +642,7 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::GetBoundingBox not implemented for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
int radius = GetRadius();
|
||||
int dist = KiROUND( EuclideanNorm( aPosition - GetCenter() ) );
|
||||
|
@ -678,7 +678,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
wxPoint relPos = aPosition - GetCenter();
|
||||
int radius = GetRadius();
|
||||
|
@ -719,7 +719,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
const_cast<PCB_SHAPE*>( this )->RebuildBezierToSegmentsPointsList( m_width );
|
||||
|
||||
for( unsigned int i= 1; i < m_bezierPoints.size(); i++)
|
||||
|
@ -730,13 +730,13 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( TestSegmentHit( aPosition, m_start, m_end, maxdist ) )
|
||||
return true;
|
||||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -765,7 +765,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
if( IsFilled() )
|
||||
{
|
||||
return m_poly.Collide( VECTOR2I( aPosition ), maxdist );
|
||||
|
@ -780,7 +780,7 @@ bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::HitTest (point) not implemented for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
// Test if area intersects or contains the circle:
|
||||
if( aContained )
|
||||
{
|
||||
|
@ -820,7 +820,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
// Test for full containment of this arc in the rect
|
||||
if( aContained )
|
||||
{
|
||||
|
@ -841,7 +841,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( bb );
|
||||
|
@ -860,7 +860,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( GetStart() ) && aRect.Contains( GetEnd() );
|
||||
|
@ -874,7 +874,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( bb );
|
||||
|
@ -923,7 +923,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
if( aContained )
|
||||
{
|
||||
return arect.Contains( bb );
|
||||
|
@ -958,7 +958,7 @@ bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::HitTest (rect) not implemented for "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -988,7 +988,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 == PCB_SHAPE_TYPE::ARC )
|
||||
if( m_shape == SHAPE_T::ARC )
|
||||
{
|
||||
EDA_RECT bbox;
|
||||
bbox.SetOrigin( m_end );
|
||||
|
@ -1125,16 +1125,16 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
effectiveShapes.emplace_back( new SHAPE_ARC( GetCenter(), GetArcStart(),
|
||||
GetAngle() / 10.0, m_width ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
effectiveShapes.emplace_back( new SHAPE_SEGMENT( GetStart(), GetEnd(), m_width ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = GetRectCorners();
|
||||
|
||||
|
@ -1154,7 +1154,7 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
if( IsFilled() )
|
||||
{
|
||||
|
@ -1177,7 +1177,7 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
{
|
||||
auto bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
|
||||
wxPoint start_pt = bezierPoints[0];
|
||||
|
@ -1192,7 +1192,7 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
SHAPE_LINE_CHAIN l = GetPolyShape().COutline( 0 );
|
||||
FOOTPRINT* parentFootprint = dynamic_cast<FOOTPRINT*>( m_parent );
|
||||
|
@ -1219,7 +1219,7 @@ std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_SHAPE::MakeEffectiveShapes unsupported PCB_SHAPE shape: "
|
||||
+ PCB_SHAPE_TYPE_T_asString( m_shape ) );
|
||||
+ SHAPE_T_asString( m_shape ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,17 +76,17 @@ public:
|
|||
{
|
||||
switch( m_shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
case SHAPE_T::POLY:
|
||||
return m_filled;
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::BEZIER:
|
||||
return false;
|
||||
|
||||
case PCB_SHAPE_TYPE::LAST: // Make CLang compiler happy
|
||||
case SHAPE_T::LAST: // Make CLang compiler happy
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ public:
|
|||
virtual void SetAngle( double aAngle, bool aUpdateEnd = true );
|
||||
double GetAngle() const { return m_angle; }
|
||||
|
||||
void SetShape( PCB_SHAPE_TYPE aShape ) { m_shape = aShape; }
|
||||
PCB_SHAPE_TYPE GetShape() const { return m_shape; }
|
||||
void SetShape( SHAPE_T aShape ) { m_shape = aShape; }
|
||||
SHAPE_T GetShape() const { return m_shape; }
|
||||
|
||||
void SetBezierC1( const wxPoint& aPoint ) { m_bezierC1 = aPoint; }
|
||||
const wxPoint& GetBezierC1() const { return m_bezierC1; }
|
||||
|
@ -344,7 +344,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 m_shape; // Shape: line, Circle, Arc
|
||||
SHAPE_T 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
|
||||
|
|
|
@ -429,7 +429,7 @@ void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim )
|
|||
{
|
||||
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
|
||||
|
||||
draw.SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
draw.SetShape( SHAPE_T::SEGMENT );
|
||||
draw.SetStart( wxPoint( seg.A ) );
|
||||
draw.SetEnd( wxPoint( seg.B ) );
|
||||
|
||||
|
@ -442,7 +442,7 @@ void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim )
|
|||
wxPoint start( shape->Centre() );
|
||||
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
|
||||
|
||||
draw.SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
draw.SetShape( SHAPE_T::CIRCLE );
|
||||
draw.SetFilled( false );
|
||||
draw.SetStart( start );
|
||||
draw.SetEnd( wxPoint( start.x + radius, start.y ) );
|
||||
|
@ -469,7 +469,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
|
|||
|
||||
PCB_SHAPE draw;
|
||||
|
||||
draw.SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
draw.SetShape( SHAPE_T::CIRCLE );
|
||||
draw.SetFilled( false );
|
||||
draw.SetWidth( aMire->GetWidth() );
|
||||
draw.SetLayer( aMire->GetLayer() );
|
||||
|
@ -484,7 +484,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
|
|||
|
||||
PlotPcbShape( &draw );
|
||||
|
||||
draw.SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
draw.SetShape( SHAPE_T::SEGMENT );
|
||||
|
||||
radius = aMire->GetSize() / 2;
|
||||
dx1 = radius;
|
||||
|
@ -557,11 +557,11 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
m_plotter->ThickSegment( pos, end, thickness, GetPlotMode(), &gbr_metadata );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = aShape->GetRectCorners();
|
||||
|
||||
|
@ -585,7 +585,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
radius = KiROUND( GetLineLength( end, pos ) );
|
||||
|
||||
if( aShape->IsFilled() )
|
||||
|
@ -595,7 +595,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
radius = KiROUND( GetLineLength( end, pos ) );
|
||||
double startAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
|
||||
|
@ -614,7 +614,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
if( aShape->IsPolyShapeValid() )
|
||||
{
|
||||
const std::vector<wxPoint> &polyPoints = aShape->BuildPolyPointsList();
|
||||
|
@ -673,7 +673,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
|
||||
aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
|
||||
break;
|
||||
|
@ -881,11 +881,11 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
m_plotter->ThickSegment( start, end, thickness, GetPlotMode(), &gbr_metadata );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
radius = KiROUND( GetLineLength( end, start ) );
|
||||
|
||||
if( aShape->IsFilled() )
|
||||
|
@ -895,7 +895,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
radius = KiROUND( GetLineLength( end, start ) );
|
||||
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
||||
EndAngle = StAngle + aShape->GetAngle();
|
||||
|
@ -912,12 +912,12 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
|
||||
aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
if( aShape->IsPolyShapeValid() )
|
||||
{
|
||||
if( sketch || thickness > 0 )
|
||||
|
@ -951,7 +951,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<wxPoint> pts = aShape->GetRectCorners();
|
||||
|
||||
|
|
|
@ -785,13 +785,13 @@ void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector<ALTIUM_VERTICE>& aV
|
|||
|
||||
if( !last->isRound && !cur->isRound )
|
||||
{
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
shape->SetStart( last->position );
|
||||
shape->SetEnd( cur->position );
|
||||
}
|
||||
else if( cur->isRound )
|
||||
{
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetShape( SHAPE_T::ARC );
|
||||
shape->SetAngle( -NormalizeAngleDegreesPos( cur->endangle - cur->startangle ) * 10. );
|
||||
|
||||
double startradiant = DEG2RAD( cur->startangle );
|
||||
|
@ -809,7 +809,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape2->SetShape( SHAPE_T::SEGMENT );
|
||||
m_board->Add( shape2, ADD_MODE::APPEND );
|
||||
shape2->SetWidth( m_board->GetDesignSettings().GetLineThickness( Edge_Cuts ) );
|
||||
shape2->SetLayer( Edge_Cuts );
|
||||
|
@ -1101,7 +1101,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( aElem.linewidth );
|
||||
shape->SetStart( last );
|
||||
|
@ -1122,7 +1122,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape1->SetShape( SHAPE_T::SEGMENT );
|
||||
shape1->SetLayer( klayer );
|
||||
shape1->SetWidth( aElem.linewidth );
|
||||
shape1->SetStart( referencePoint0 );
|
||||
|
@ -1132,7 +1132,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape2->SetShape( SHAPE_T::SEGMENT );
|
||||
shape2->SetLayer( klayer );
|
||||
shape2->SetWidth( aElem.linewidth );
|
||||
shape2->SetStart( referencePoint0 );
|
||||
|
@ -1174,7 +1174,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( aElem.linewidth );
|
||||
shape->SetStart( aElem.referencePoint.at( i ) );
|
||||
|
@ -1655,7 +1655,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( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
@ -1794,12 +1794,12 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
|
|||
|
||||
if( elem.startangle == 0. && elem.endangle == 360. )
|
||||
{ // TODO: other variants to define circle?
|
||||
shape.SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape.SetShape( SHAPE_T::CIRCLE );
|
||||
shape.SetArcStart( elem.center - wxPoint( 0, elem.radius ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape.SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape.SetShape( SHAPE_T::ARC );
|
||||
double startradiant = DEG2RAD( elem.startangle );
|
||||
wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * elem.radius ),
|
||||
-KiROUND( std::sin( startradiant ) * elem.radius ) );
|
||||
|
@ -1878,17 +1878,17 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader,
|
|||
|
||||
if( elem.startangle == 0. && elem.endangle == 360. )
|
||||
{ // TODO: other variants to define circle?
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetShape( SHAPE_T::CIRCLE );
|
||||
shape->SetArcStart( elem.center - wxPoint( 0, elem.radius ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetShape( SHAPE_T::ARC );
|
||||
shape->SetAngle( -NormalizeAngleDegreesPos( elem.endangle - elem.startangle ) * 10. );
|
||||
|
||||
double startradiant = DEG2RAD( elem.startangle );
|
||||
wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * elem.radius ),
|
||||
-KiROUND( std::sin( startradiant ) * elem.radius ) );
|
||||
-KiROUND( std::sin( startradiant ) * elem.radius ) );
|
||||
shape->SetArcStart( elem.center + arcStartOffset );
|
||||
}
|
||||
|
||||
|
@ -2164,7 +2164,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// filled rect
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
@ -2203,14 +2203,14 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
wxPoint p22 = aElem.position + wxPoint( -offsetX, -offsetY );
|
||||
wxPoint p21 = aElem.position + wxPoint( -offsetX, offsetY );
|
||||
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetFilled( true );
|
||||
shape->SetPolyPoints( { p11, p12, p22, p21 } );
|
||||
}
|
||||
else if( aElem.topsize.x == aElem.topsize.y )
|
||||
{
|
||||
// circle
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetShape( SHAPE_T::CIRCLE );
|
||||
shape->SetFilled( true );
|
||||
shape->SetCenter( aElem.position );
|
||||
shape->SetWidth( aElem.topsize.x / 2 );
|
||||
|
@ -2219,7 +2219,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
else if( aElem.topsize.x < aElem.topsize.y )
|
||||
{
|
||||
// short vertical line
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
wxPoint pointOffset( 0, ( aElem.topsize.y - aElem.topsize.x ) / 2 );
|
||||
shape->SetStart( aElem.position + pointOffset );
|
||||
shape->SetEnd( aElem.position - pointOffset );
|
||||
|
@ -2227,7 +2227,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
else
|
||||
{
|
||||
// short horizontal line
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
wxPoint pointOffset( ( aElem.topsize.x - aElem.topsize.y ) / 2, 0 );
|
||||
shape->SetStart( aElem.position + pointOffset );
|
||||
shape->SetEnd( aElem.position - pointOffset );
|
||||
|
@ -2242,7 +2242,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// filled circle
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetShape( SHAPE_T::CIRCLE );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetCenter( aElem.position );
|
||||
|
@ -2254,7 +2254,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// short line
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( std::min( aElem.topsize.x, aElem.topsize.y ) );
|
||||
|
||||
|
@ -2282,7 +2282,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
|||
{
|
||||
// filled octagon
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( aElem.component );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
@ -2400,7 +2400,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape.SetShape( SHAPE_T::SEGMENT );
|
||||
shape.SetStart( elem.start );
|
||||
shape.SetEnd( elem.end );
|
||||
shape.SetWidth( elem.width );
|
||||
|
@ -2465,7 +2465,7 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader,
|
|||
else
|
||||
{
|
||||
PCB_SHAPE* shape = HelperCreateAndAddDrawsegment( elem.component );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
shape->SetStart( elem.start );
|
||||
shape->SetEnd( elem.end );
|
||||
shape->SetWidth( elem.width );
|
||||
|
@ -2739,7 +2739,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( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( klayer );
|
||||
shape->SetWidth( 0 );
|
||||
|
|
|
@ -1109,7 +1109,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
|
|||
ERROR_LOC::ERROR_INSIDE );
|
||||
|
||||
PCB_SHAPE* padShape = new PCB_SHAPE;
|
||||
padShape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
padShape->SetShape( SHAPE_T::POLY );
|
||||
padShape->SetFilled( true );
|
||||
padShape->SetPolyShape( padOutline );
|
||||
padShape->SetWidth( 0 );
|
||||
|
@ -1970,7 +1970,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers()
|
|||
{
|
||||
SHAPE_POLY_SET poly;
|
||||
|
||||
if( shape->GetShape() == PCB_SHAPE_TYPE::ARC )
|
||||
if( shape->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
TransformArcToPolygon( poly, shape->GetArcStart(), shape->GetArcMid(),
|
||||
shape->GetArcEnd(), copperWidth, ARC_HIGH_DEF,
|
||||
|
@ -2612,12 +2612,12 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape,
|
|||
|
||||
if( isFootprint( aContainer ) )
|
||||
{
|
||||
shape = new FP_SHAPE( (FOOTPRINT*) aContainer, PCB_SHAPE_TYPE::POLYGON );
|
||||
shape = new FP_SHAPE( (FOOTPRINT*) aContainer, SHAPE_T::POLY );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape = new PCB_SHAPE( aContainer );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
}
|
||||
|
||||
shape->SetFilled( true );
|
||||
|
@ -2754,12 +2754,12 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
|
|||
|
||||
if( isFootprint( aContainer ) )
|
||||
{
|
||||
shape = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), SHAPE_T::SEGMENT );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape = new PCB_SHAPE( aContainer );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
}
|
||||
|
||||
shape->SetStart( startPoint );
|
||||
|
@ -2776,12 +2776,12 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
|
|||
|
||||
if( isFootprint( aContainer ) )
|
||||
{
|
||||
shape = new FP_SHAPE((FOOTPRINT*) aContainer, PCB_SHAPE_TYPE::ARC );
|
||||
shape = new FP_SHAPE((FOOTPRINT*) aContainer, SHAPE_T::ARC );
|
||||
}
|
||||
else
|
||||
{
|
||||
shape = new PCB_SHAPE( aContainer );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetShape( SHAPE_T::ARC );
|
||||
}
|
||||
|
||||
shape->SetArcStart( startPoint );
|
||||
|
@ -2918,7 +2918,7 @@ SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes( const std::
|
|||
{
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
|
@ -2933,7 +2933,7 @@ SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes( const std::
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
|
||||
|
@ -3000,7 +3000,7 @@ std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(
|
|||
{
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
|
||||
|
@ -3013,7 +3013,7 @@ std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(
|
|||
track = new PCB_ARC( aParentContainer, &arc );
|
||||
}
|
||||
break;
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
|
||||
|
|
|
@ -695,7 +695,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
|||
{
|
||||
wxPoint center = ConvertArcCenter( start, end, *w.curve );
|
||||
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetShape( SHAPE_T::ARC );
|
||||
shape->SetStart( center );
|
||||
shape->SetEnd( start );
|
||||
shape->SetAngle( *w.curve * -10.0 ); // KiCad rotates the other way
|
||||
|
@ -872,7 +872,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
|||
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
|
||||
m_board->Add( shape, ADD_MODE::APPEND );
|
||||
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetShape( SHAPE_T::CIRCLE );
|
||||
shape->SetFilled( false );
|
||||
shape->SetLayer( layer );
|
||||
shape->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );
|
||||
|
@ -1738,14 +1738,14 @@ void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
|
|||
|
||||
if( !w.curve )
|
||||
{
|
||||
dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::SEGMENT );
|
||||
dwg = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
|
||||
dwg->SetStart0( start );
|
||||
dwg->SetEnd0( end );
|
||||
}
|
||||
else
|
||||
{
|
||||
dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::ARC );
|
||||
dwg = new FP_SHAPE( aFootprint, SHAPE_T::ARC );
|
||||
wxPoint center = ConvertArcCenter( start, end, *w.curve );
|
||||
|
||||
dwg->SetStart0( center );
|
||||
|
@ -2016,7 +2016,7 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::POLYGON );
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
|
@ -2129,7 +2129,7 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::POLYGON );
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
|
@ -2201,7 +2201,7 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* gr = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::CIRCLE );
|
||||
FP_SHAPE* gr = new FP_SHAPE( aFootprint, SHAPE_T::CIRCLE );
|
||||
|
||||
// with == 0 means filled circle
|
||||
if( width <= 0 )
|
||||
|
|
|
@ -2091,7 +2091,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
{
|
||||
const GRAPHIC_LINE* lsrc = static_cast<const GRAPHIC_LINE*>( seg.get() );
|
||||
|
||||
FP_SHAPE* line = new FP_SHAPE( fp, PCB_SHAPE_TYPE::SEGMENT );
|
||||
FP_SHAPE* line = new FP_SHAPE( fp, SHAPE_T::SEGMENT );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2119,7 +2119,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
{
|
||||
const GRAPHIC_ARC* lsrc = static_cast<const GRAPHIC_ARC*>( seg.get() );
|
||||
|
||||
FP_SHAPE* arc = new FP_SHAPE( fp, PCB_SHAPE_TYPE::ARC );
|
||||
FP_SHAPE* arc = new FP_SHAPE( fp, SHAPE_T::ARC );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2150,7 +2150,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
const GRAPHIC_RECTANGLE *lsrc =
|
||||
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
|
||||
|
||||
FP_SHAPE* rect = new FP_SHAPE( fp, PCB_SHAPE_TYPE::RECT );
|
||||
FP_SHAPE* rect = new FP_SHAPE( fp, SHAPE_T::RECT );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2616,7 +2616,7 @@ bool FABMASTER::loadPolygon( BOARD* aBoard, const std::unique_ptr<FABMASTER::TRA
|
|||
|
||||
PCB_SHAPE* new_poly = new PCB_SHAPE( aBoard );
|
||||
|
||||
new_poly->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
new_poly->SetShape( SHAPE_T::POLY );
|
||||
new_poly->SetLayer( layer );
|
||||
|
||||
// Polygons on the silk layer are filled but other layers are not/fill doesn't make sense
|
||||
|
@ -2760,7 +2760,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetShape( SHAPE_T::SEGMENT );
|
||||
line->SetLayer( layer );
|
||||
line->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
line->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
@ -2777,7 +2777,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( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetShape( SHAPE_T::ARC );
|
||||
arc->SetLayer( layer );
|
||||
arc->SetCenter( wxPoint( src->center_x, src->center_y ) );
|
||||
arc->SetArcStart( wxPoint( src->start_x, src->start_y ) );
|
||||
|
@ -2796,7 +2796,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( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetShape( SHAPE_T::RECT );
|
||||
rect->SetLayer( layer );
|
||||
rect->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
rect->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
@ -2862,7 +2862,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
|
|||
|
||||
PCB_SHAPE* new_poly = new PCB_SHAPE( aBoard );
|
||||
|
||||
new_poly->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
new_poly->SetShape( SHAPE_T::POLY );
|
||||
new_poly->SetLayer( layer );
|
||||
new_poly->SetPolyShape( poly_outline );
|
||||
new_poly->SetWidth( 0 );
|
||||
|
@ -2884,7 +2884,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetShape( SHAPE_T::SEGMENT );
|
||||
line->SetLayer( layer );
|
||||
line->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
line->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
@ -2898,7 +2898,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( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetShape( SHAPE_T::ARC );
|
||||
arc->SetLayer( layer );
|
||||
arc->SetCenter( wxPoint( src->center_x, src->center_y ) );
|
||||
arc->SetArcStart( wxPoint( src->start_x, src->start_y ) );
|
||||
|
@ -2914,7 +2914,7 @@ bool FABMASTER::loadGraphics( BOARD* aBoard )
|
|||
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
|
||||
|
||||
PCB_SHAPE* rect = new PCB_SHAPE( aBoard );
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetShape( SHAPE_T::RECT );
|
||||
rect->SetLayer( layer );
|
||||
rect->SetStart( wxPoint( src->start_x, src->start_y ) );
|
||||
rect->SetEnd( wxPoint( src->end_x, src->end_y ) );
|
||||
|
|
|
@ -465,7 +465,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
|
||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get() );
|
||||
shape->SetLayer( F_SilkS );
|
||||
shape->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
|
||||
parseInt( parameters[3], conv_unit ) ) );
|
||||
shape->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ),
|
||||
|
@ -489,7 +489,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( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetShape( SHAPE_T::ARC );
|
||||
footprint->Add( shape );
|
||||
|
||||
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
|
||||
|
@ -509,7 +509,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
|
||||
// Geda PCB does not support circles.
|
||||
if( sweep_angle == -3600.0 )
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetShape( SHAPE_T::CIRCLE );
|
||||
|
||||
// Angle value is clockwise in gpcb and Pcbnew.
|
||||
shape->SetAngle( sweep_angle );
|
||||
|
|
|
@ -727,12 +727,16 @@ void PCB_IO::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel ) cons
|
|||
FormatInternalUnits( aDimension->GetEnd().y ).c_str() );
|
||||
|
||||
if( aligned )
|
||||
{
|
||||
m_out->Print( aNestLevel+1, "(height %s)\n",
|
||||
FormatInternalUnits( aligned->GetHeight() ).c_str() );
|
||||
}
|
||||
|
||||
if( ortho )
|
||||
{
|
||||
m_out->Print( aNestLevel+1, "(orientation %d)\n",
|
||||
static_cast<int>( ortho->GetOrientation() ) );
|
||||
}
|
||||
|
||||
if( !center )
|
||||
{
|
||||
|
@ -792,7 +796,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Line
|
||||
case SHAPE_T::SEGMENT:
|
||||
m_out->Print( aNestLevel, "(gr_line%s (start %s) (end %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
|
@ -803,21 +807,21 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT: // Rectangle
|
||||
case SHAPE_T::RECT:
|
||||
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 PCB_SHAPE_TYPE::CIRCLE: // Circle
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::ARC: // Arc
|
||||
case SHAPE_T::ARC:
|
||||
m_out->Print( aNestLevel, "(gr_arc%s (start %s) (end %s) (angle %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
|
@ -825,7 +829,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
FormatAngle( aShape->GetAngle() ).c_str() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON: // Polygon
|
||||
case SHAPE_T::POLY:
|
||||
if( aShape->IsPolyShapeValid() )
|
||||
{
|
||||
const SHAPE_POLY_SET& poly = aShape->GetPolyShape();
|
||||
|
@ -889,7 +893,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier curve
|
||||
case SHAPE_T::BEZIER:
|
||||
m_out->Print( aNestLevel, "(gr_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aShape->GetStart() ).c_str(),
|
||||
|
@ -900,7 +904,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_IO::format cannot format unknown PCB_SHAPE shape:"
|
||||
+ PCB_SHAPE_TYPE_T_asString( aShape->GetShape()) );
|
||||
+ SHAPE_T_asString( aShape->GetShape()) );
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -909,9 +913,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() == PCB_SHAPE_TYPE::POLYGON )
|
||||
|| ( aShape->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
|| ( aShape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
if( ( aShape->GetShape() == SHAPE_T::POLY )
|
||||
|| ( aShape->GetShape() == SHAPE_T::RECT )
|
||||
|| ( aShape->GetShape() == SHAPE_T::CIRCLE ) )
|
||||
{
|
||||
if( aShape->IsFilled() )
|
||||
m_out->Print( 0, " (fill solid)" );
|
||||
|
@ -931,28 +935,28 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
|
||||
switch( aFPShape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // Line
|
||||
case SHAPE_T::SEGMENT:
|
||||
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 PCB_SHAPE_TYPE::RECT: // Rectangle
|
||||
case SHAPE_T::RECT:
|
||||
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 PCB_SHAPE_TYPE::CIRCLE: // Circle
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::ARC: // Arc
|
||||
case SHAPE_T::ARC:
|
||||
m_out->Print( aNestLevel, "(fp_arc%s (start %s) (end %s) (angle %s)",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
|
||||
|
@ -960,7 +964,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
FormatAngle( aFPShape->GetAngle() ).c_str() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON: // Polygonal segment
|
||||
case SHAPE_T::POLY:
|
||||
if( aFPShape->IsPolyShapeValid() )
|
||||
{
|
||||
const SHAPE_POLY_SET& poly = aFPShape->GetPolyShape();
|
||||
|
@ -1014,7 +1018,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier curve
|
||||
case SHAPE_T::BEZIER:
|
||||
m_out->Print( aNestLevel, "(fp_curve%s (pts (xy %s) (xy %s) (xy %s) (xy %s))",
|
||||
locked.c_str(),
|
||||
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
|
||||
|
@ -1025,7 +1029,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
|
|||
|
||||
default:
|
||||
wxFAIL_MSG( "PCB_IO::format cannot format unknown FP_SHAPE shape:"
|
||||
+ PCB_SHAPE_TYPE_T_asString( aFPShape->GetShape() ) );
|
||||
+ SHAPE_T_asString( aFPShape->GetShape()) );
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -1034,9 +1038,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() == PCB_SHAPE_TYPE::POLYGON )
|
||||
|| ( aFPShape->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
|| ( aFPShape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
if( ( aFPShape->GetShape() == SHAPE_T::POLY )
|
||||
|| ( aFPShape->GetShape() == SHAPE_T::RECT )
|
||||
|| ( aFPShape->GetShape() == SHAPE_T::CIRCLE ) )
|
||||
{
|
||||
if( aFPShape->IsFilled() )
|
||||
m_out->Print( 0, " (fill solid)" );
|
||||
|
@ -1608,32 +1612,32 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
|
|||
|
||||
switch( primitive->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT: // usual segment : line with rounded ends
|
||||
case SHAPE_T::SEGMENT:
|
||||
m_out->Print( nested_level, "(gr_line (start %s) (end %s)",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
m_out->Print( nested_level, "(gr_rect (start %s) (end %s)",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC: // Arc with rounded ends
|
||||
case SHAPE_T::ARC:
|
||||
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 PCB_SHAPE_TYPE::CIRCLE: // ring or circle (circle if width == 0
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_out->Print( nested_level, "(gr_circle (center %s) (end %s)",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE: // Bezier Curve
|
||||
case SHAPE_T::BEZIER:
|
||||
m_out->Print( nested_level, "(gr_curve (pts (xy %s) (xy %s) (xy %s) (xy %s))",
|
||||
FormatInternalUnits( primitive->GetStart() ).c_str(),
|
||||
FormatInternalUnits( primitive->GetBezierC1() ).c_str(),
|
||||
|
@ -1641,7 +1645,7 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
|
|||
FormatInternalUnits( primitive->GetEnd() ).c_str() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON: // polygon
|
||||
case SHAPE_T::POLY:
|
||||
if( primitive->GetPolyShape().COutline( 0 ).CPoints().size() < 2 )
|
||||
break; // Malformed polygon.
|
||||
|
||||
|
|
|
@ -2340,7 +2340,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
switch( CurTok() )
|
||||
{
|
||||
case T_gr_arc:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetShape( SHAPE_T::ARC );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2376,7 +2376,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
break;
|
||||
|
||||
case T_gr_circle:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetShape( SHAPE_T::CIRCLE );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2411,7 +2411,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
break;
|
||||
|
||||
case T_gr_curve:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CURVE );
|
||||
shape->SetShape( SHAPE_T::BEZIER );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2436,7 +2436,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
break;
|
||||
|
||||
case T_gr_rect:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
shape->SetShape( SHAPE_T::RECT );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -2505,7 +2505,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
|||
|
||||
case T_gr_poly:
|
||||
{
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetWidth( 0 ); // this is the default value. will be (perhaps) modified later
|
||||
shape->SetPolyPoints( {} );
|
||||
|
||||
|
@ -2621,12 +2621,11 @@ 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() == PCB_SHAPE_TYPE::RECT
|
||||
|| shape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
&& ( shape->GetShape() == SHAPE_T::RECT || shape->GetShape() == SHAPE_T::CIRCLE ) )
|
||||
{
|
||||
shape->SetFilled( true );
|
||||
}
|
||||
else if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON && shape->GetLayer() != Edge_Cuts )
|
||||
else if( shape->GetShape() == SHAPE_T::POLY && shape->GetLayer() != Edge_Cuts )
|
||||
{
|
||||
// Polygons on non-Edge_Cuts layers were always filled.
|
||||
shape->SetFilled( true );
|
||||
|
@ -3594,7 +3593,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
switch( CurTok() )
|
||||
{
|
||||
case T_fp_arc:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
shape->SetShape( SHAPE_T::ARC );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3640,7 +3639,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
break;
|
||||
|
||||
case T_fp_circle:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
shape->SetShape( SHAPE_T::CIRCLE );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3674,7 +3673,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
break;
|
||||
|
||||
case T_fp_curve:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::CURVE );
|
||||
shape->SetShape( SHAPE_T::BEZIER );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3692,14 +3691,14 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
Expecting( T_pts );
|
||||
|
||||
shape->SetStart0( parseXY() );
|
||||
shape->SetBezierC1_0( parseXY());
|
||||
shape->SetBezierC2_0( parseXY());
|
||||
shape->SetBezierC1_0( parseXY() );
|
||||
shape->SetBezierC2_0( parseXY() );
|
||||
shape->SetEnd0( parseXY() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_fp_rect:
|
||||
shape->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
shape->SetShape( SHAPE_T::RECT );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
|
@ -3770,7 +3769,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
|||
|
||||
case T_fp_poly:
|
||||
{
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
shape->SetPolyPoints( {} );
|
||||
SHAPE_LINE_CHAIN& outline = shape->GetPolyShape().Outline( 0 );
|
||||
|
||||
|
@ -3877,13 +3876,12 @@ 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() == PCB_SHAPE_TYPE::RECT
|
||||
|| shape->GetShape() == PCB_SHAPE_TYPE::CIRCLE ) )
|
||||
&& ( shape->GetShape() == SHAPE_T::RECT || shape->GetShape() == SHAPE_T::CIRCLE ) )
|
||||
{
|
||||
shape->SetFilled( true );
|
||||
}
|
||||
// Polygons on non-Edge_Cuts layers were always filled
|
||||
else if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON && shape->GetLayer() != Edge_Cuts )
|
||||
else if( shape->GetShape() == SHAPE_T::POLY && shape->GetLayer() != Edge_Cuts )
|
||||
{
|
||||
shape->SetFilled( true );
|
||||
}
|
||||
|
@ -4302,46 +4300,46 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
|||
// because they are the same as a PCB_SHAPE.
|
||||
// However it could be better to write a specific parser, to avoid possible issues
|
||||
// if the PCB_SHAPE parser is modified.
|
||||
PCB_SHAPE* dummysegm = nullptr;
|
||||
PCB_SHAPE* dummyShape = nullptr;
|
||||
|
||||
switch( token )
|
||||
{
|
||||
case T_gr_arc:
|
||||
dummysegm = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveArc( dummysegm->GetCenter(), dummysegm->GetArcStart(),
|
||||
dummysegm->GetAngle(), dummysegm->GetWidth() );
|
||||
dummyShape = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveArc( dummyShape->GetCenter(), dummyShape->GetArcStart(),
|
||||
dummyShape->GetAngle(), dummyShape->GetWidth() );
|
||||
break;
|
||||
|
||||
case T_gr_line:
|
||||
dummysegm = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveSegment( dummysegm->GetStart(), dummysegm->GetEnd(),
|
||||
dummysegm->GetWidth() );
|
||||
dummyShape = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveSegment( dummyShape->GetStart(), dummyShape->GetEnd(),
|
||||
dummyShape->GetWidth() );
|
||||
break;
|
||||
|
||||
case T_gr_circle:
|
||||
dummysegm = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveCircle( dummysegm->GetCenter(), dummysegm->GetRadius(),
|
||||
dummysegm->GetWidth(), dummysegm->IsFilled() );
|
||||
dummyShape = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveCircle( dummyShape->GetCenter(), dummyShape->GetRadius(),
|
||||
dummyShape->GetWidth(), dummyShape->IsFilled() );
|
||||
break;
|
||||
|
||||
case T_gr_rect:
|
||||
dummysegm = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveRect( dummysegm->GetStart(), dummysegm->GetEnd(),
|
||||
dummysegm->GetWidth(), dummysegm->IsFilled() );
|
||||
dummyShape = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveRect( dummyShape->GetStart(), dummyShape->GetEnd(),
|
||||
dummyShape->GetWidth(), dummyShape->IsFilled() );
|
||||
break;
|
||||
|
||||
|
||||
case T_gr_poly:
|
||||
dummysegm = parsePCB_SHAPE();
|
||||
pad->AddPrimitivePoly( dummysegm->BuildPolyPointsList(), dummysegm->GetWidth(),
|
||||
dummysegm->IsFilled() );
|
||||
dummyShape = parsePCB_SHAPE();
|
||||
pad->AddPrimitivePoly( dummyShape->BuildPolyPointsList(), dummyShape->GetWidth(),
|
||||
dummyShape->IsFilled() );
|
||||
break;
|
||||
|
||||
case T_gr_curve:
|
||||
dummysegm = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveCurve( dummysegm->GetStart(), dummysegm->GetEnd(),
|
||||
dummysegm->GetBezierC1(),
|
||||
dummysegm->GetBezierC2(), dummysegm->GetWidth() );
|
||||
dummyShape = parsePCB_SHAPE();
|
||||
pad->AddPrimitiveCurve( dummyShape->GetStart(), dummyShape->GetEnd(),
|
||||
dummyShape->GetBezierC1(),
|
||||
dummyShape->GetBezierC2(), dummyShape->GetWidth() );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -4349,7 +4347,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
|||
break;
|
||||
}
|
||||
|
||||
delete dummysegm;
|
||||
delete dummyShape;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -1556,15 +1556,15 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
|
|||
|
||||
void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
||||
{
|
||||
PCB_SHAPE_TYPE shape;
|
||||
char* line = m_reader->Line(); // obtain current (old) line
|
||||
SHAPE_T shape;
|
||||
char* line = m_reader->Line(); // obtain current (old) line
|
||||
|
||||
switch( line[1] )
|
||||
{
|
||||
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;
|
||||
case 'S': shape = SHAPE_T::SEGMENT; break;
|
||||
case 'C': shape = SHAPE_T::CIRCLE; break;
|
||||
case 'A': shape = SHAPE_T::ARC; break;
|
||||
case 'P': shape = SHAPE_T::POLY; break;
|
||||
default:
|
||||
m_error.Printf( _( "Unknown FP_SHAPE type:'%c=0x%02x' on line %d of footprint '%s'." ),
|
||||
(unsigned char) line[1], (unsigned char) line[1], m_reader->LineNumber(),
|
||||
|
@ -1582,7 +1582,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
|||
|
||||
switch( shape )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
BIU start0_x = biuParse( line + SZ( "DA" ), &data );
|
||||
BIU start0_y = biuParse( data, &data );
|
||||
|
@ -1602,8 +1602,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
// e.g. "DS -7874 -10630 7874 -10630 50 20\r\n"
|
||||
BIU start0_x = biuParse( line + SZ( "DS" ), &data );
|
||||
|
@ -1619,7 +1619,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
// e.g. "DP %d %d %d %d %d %d %d\n"
|
||||
BIU start0_x = biuParse( line + SZ( "DP" ), &data );
|
||||
|
@ -1849,7 +1849,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
|
|||
if( width < 0 )
|
||||
width = 0;
|
||||
|
||||
dseg->SetShape( static_cast<PCB_SHAPE_TYPE>( shape ) );
|
||||
dseg->SetShape( static_cast<SHAPE_T>( shape ) );
|
||||
dseg->SetFilled( false );
|
||||
dseg->SetWidth( width );
|
||||
dseg->SetStart( wxPoint( start_x, start_y ) );
|
||||
|
|
|
@ -171,8 +171,7 @@ void PCB_ARC::AddToFootprint( FOOTPRINT* aFootprint )
|
|||
{
|
||||
if( IsNonCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
FP_SHAPE* arc = new FP_SHAPE(
|
||||
aFootprint, ( IsCircle() ? PCB_SHAPE_TYPE::CIRCLE : PCB_SHAPE_TYPE::ARC ) );
|
||||
FP_SHAPE* arc = new FP_SHAPE( aFootprint, IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC );
|
||||
aFootprint->Add( arc );
|
||||
|
||||
arc->SetStart0( wxPoint( m_positionX, m_positionY ) );
|
||||
|
@ -196,7 +195,7 @@ void PCB_ARC::AddToBoard()
|
|||
|
||||
m_board->Add( arc, ADD_MODE::APPEND );
|
||||
|
||||
arc->SetShape( IsCircle() ? PCB_SHAPE_TYPE::CIRCLE : PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetShape( IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::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, PCB_SHAPE_TYPE::SEGMENT );
|
||||
FP_SHAPE* segment = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
aFootprint->Add( segment );
|
||||
|
||||
segment->SetStart0( wxPoint( m_positionX, m_positionY ) );
|
||||
|
|
|
@ -163,7 +163,7 @@ void PCB_POLYGON::AddToFootprint( FOOTPRINT* aFootprint )
|
|||
{
|
||||
if( IsNonCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::POLYGON );
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
dwg->SetWidth( 0 );
|
||||
|
|
|
@ -33,24 +33,24 @@
|
|||
%include eda_item_flags.h // generate code for this interface
|
||||
|
||||
/* Only for compatibility with old python scripts: */
|
||||
const int S_SEGMENT = (const int)PCB_SHAPE_TYPE::SEGMENT;
|
||||
const int S_RECT = (const int)PCB_SHAPE_TYPE::RECT;
|
||||
const int S_ARC = (const int)PCB_SHAPE_TYPE::ARC;
|
||||
const int S_CIRCLE = (const int)PCB_SHAPE_TYPE::CIRCLE;
|
||||
const int S_POLYGON = (const int)PCB_SHAPE_TYPE::POLYGON;
|
||||
const int S_CURVE = (const int)PCB_SHAPE_TYPE::CURVE;
|
||||
const int S_SEGMENT = (const int)SHAPE_T::SEGMENT;
|
||||
const int S_RECT = (const int)SHAPE_T::RECT;
|
||||
const int S_ARC = (const int)SHAPE_T::ARC;
|
||||
const int S_CIRCLE = (const int)SHAPE_T::CIRCLE;
|
||||
const int S_POLYGON = (const int)SHAPE_T::POLY;
|
||||
const int S_CURVE = (const int)SHAPE_T::BEZIER;
|
||||
|
||||
%rename(Get) operator BOARD_ITEM*;
|
||||
|
||||
%{
|
||||
#include <board_item.h>
|
||||
/* for compatibility with old python scripts: */
|
||||
const int S_SEGMENT = (const int)PCB_SHAPE_TYPE::SEGMENT;
|
||||
const int S_RECT = (const int)PCB_SHAPE_TYPE::RECT;
|
||||
const int S_ARC = (const int)PCB_SHAPE_TYPE::ARC;
|
||||
const int S_CIRCLE = (const int)PCB_SHAPE_TYPE::CIRCLE;
|
||||
const int S_POLYGON = (const int)PCB_SHAPE_TYPE::POLYGON;
|
||||
const int S_CURVE = (const int)PCB_SHAPE_TYPE::CURVE;
|
||||
const int S_SEGMENT = (const int)SHAPE_T::SEGMENT;
|
||||
const int S_RECT = (const int)SHAPE_T::RECT;
|
||||
const int S_ARC = (const int)SHAPE_T::ARC;
|
||||
const int S_CIRCLE = (const int)SHAPE_T::CIRCLE;
|
||||
const int S_POLYGON = (const int)SHAPE_T::POLY;
|
||||
const int S_CURVE = (const int)SHAPE_T::BEZIER;
|
||||
%}
|
||||
|
||||
|
||||
|
|
|
@ -1165,7 +1165,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() == PCB_SHAPE_TYPE::POLYGON && aItem->IsFilled() )
|
||||
if( aItem->GetShape() == SHAPE_T::POLY && aItem->IsFilled() )
|
||||
return false;
|
||||
|
||||
for( SHAPE* shape : aItem->MakeEffectiveShapes() )
|
||||
|
|
|
@ -714,7 +714,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
outline = new SHAPE( image, T_outline );
|
||||
|
||||
image->Append( outline );
|
||||
|
@ -727,7 +727,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
path->AppendPoint( mapPt( graphic->GetEnd0() ) );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
// this is best done by 4 QARC's but freerouter does not yet support QARCs.
|
||||
// for now, support by using line segments.
|
||||
|
@ -756,7 +756,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
outline = new SHAPE( image, T_outline );
|
||||
|
||||
|
@ -780,7 +780,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
// this is best done by QARC's but freerouter does not yet support QARCs.
|
||||
// for now, support by using line segments.
|
||||
|
|
|
@ -78,10 +78,10 @@ bool CONVERT_TOOL::Init()
|
|||
static KICAD_T convertibleTracks[] = { 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( { PCB_SHAPE_TYPE::SEGMENT,
|
||||
PCB_SHAPE_TYPE::RECT,
|
||||
PCB_SHAPE_TYPE::CIRCLE,
|
||||
PCB_SHAPE_TYPE::ARC } )
|
||||
auto graphicLines = P_S_C::OnlyGraphicShapeTypes( { SHAPE_T::SEGMENT,
|
||||
SHAPE_T::RECT,
|
||||
SHAPE_T::CIRCLE,
|
||||
SHAPE_T::ARC } )
|
||||
&& P_S_C::SameLayer();
|
||||
|
||||
auto trackLines = S_C::MoreThan( 1 ) && S_C::OnlyTypes( convertibleTracks )
|
||||
|
@ -90,12 +90,11 @@ bool CONVERT_TOOL::Init()
|
|||
auto anyLines = graphicLines || trackLines;
|
||||
|
||||
auto anyPolys = S_C::OnlyTypes( zones )
|
||||
|| P_S_C::OnlyGraphicShapeTypes(
|
||||
{ PCB_SHAPE_TYPE::POLYGON, PCB_SHAPE_TYPE::RECT } );
|
||||
|| P_S_C::OnlyGraphicShapeTypes( { SHAPE_T::POLY, SHAPE_T::RECT } );
|
||||
|
||||
auto lineToArc = S_C::Count( 1 )
|
||||
&& ( P_S_C::OnlyGraphicShapeTypes( { PCB_SHAPE_TYPE::SEGMENT } )
|
||||
|| S_C::OnlyType( PCB_TRACE_T ) );
|
||||
&& ( P_S_C::OnlyGraphicShapeTypes( { SHAPE_T::SEGMENT } )
|
||||
|| S_C::OnlyType( PCB_TRACE_T ) );
|
||||
|
||||
auto showConvert = anyPolys || anyLines || lineToArc;
|
||||
|
||||
|
@ -135,10 +134,10 @@ int CONVERT_TOOL::LinesToPoly( const TOOL_EVENT& aEvent )
|
|||
case PCB_FP_SHAPE_T:
|
||||
switch( static_cast<PCB_SHAPE*>( item )->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
case SHAPE_T::ARC:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -189,7 +188,7 @@ int CONVERT_TOOL::LinesToPoly( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* graphic = isFootprint ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
|
||||
graphic->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
graphic->SetShape( SHAPE_T::POLY );
|
||||
graphic->SetFilled( false );
|
||||
graphic->SetWidth( poly.Outline( 0 ).Width() );
|
||||
graphic->SetLayer( destLayer );
|
||||
|
@ -276,7 +275,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromSegs( const std::deque<EDA_ITEM*>& aIt
|
|||
{
|
||||
if( aItem->Type() == PCB_ARC_T ||
|
||||
( aItem->Type() == PCB_SHAPE_T &&
|
||||
static_cast<PCB_SHAPE*>( aItem )->GetShape() == PCB_SHAPE_TYPE::ARC ) )
|
||||
static_cast<PCB_SHAPE*>( aItem )->GetShape() == SHAPE_T::ARC ) )
|
||||
{
|
||||
SHAPE_ARC arc;
|
||||
|
||||
|
@ -346,7 +345,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromSegs( const std::deque<EDA_ITEM*>& aIt
|
|||
// whole arc will be inserted at anchor B inside process()
|
||||
if( !( candidate->Type() == PCB_ARC_T ||
|
||||
( candidate->Type() == PCB_SHAPE_T &&
|
||||
static_cast<PCB_SHAPE*>( candidate )->GetShape() == PCB_SHAPE_TYPE::ARC ) ) )
|
||||
static_cast<PCB_SHAPE*>( candidate )->GetShape() == SHAPE_T::ARC ) ) )
|
||||
{
|
||||
insert( candidate, anchors->A, true );
|
||||
}
|
||||
|
@ -395,7 +394,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromRects( const std::deque<EDA_ITEM*>& aI
|
|||
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( graphic->GetShape() != PCB_SHAPE_TYPE::RECT )
|
||||
if( graphic->GetShape() != SHAPE_T::RECT )
|
||||
continue;
|
||||
|
||||
SHAPE_LINE_CHAIN outline;
|
||||
|
@ -428,7 +427,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromCircles( const std::deque<EDA_ITEM*>&
|
|||
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( graphic->GetShape() != PCB_SHAPE_TYPE::CIRCLE )
|
||||
if( graphic->GetShape() != SHAPE_T::CIRCLE )
|
||||
continue;
|
||||
|
||||
BOARD_DESIGN_SETTINGS& bds = graphic->GetBoard()->GetDesignSettings();
|
||||
|
@ -459,10 +458,10 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
case PCB_FP_SHAPE_T:
|
||||
switch( static_cast<PCB_SHAPE*>( item )->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -501,11 +500,11 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( aItem );
|
||||
|
||||
if( graphic->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
if( graphic->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
set = graphic->GetPolyShape();
|
||||
}
|
||||
else if( graphic->GetShape() == PCB_SHAPE_TYPE::RECT )
|
||||
else if( graphic->GetShape() == SHAPE_T::RECT )
|
||||
{
|
||||
SHAPE_LINE_CHAIN outline;
|
||||
VECTOR2I start( graphic->GetStart() );
|
||||
|
@ -571,7 +570,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( fpEditor )
|
||||
{
|
||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, PCB_SHAPE_TYPE::SEGMENT );
|
||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
|
||||
|
||||
graphic->SetLayer( layer );
|
||||
graphic->SetStart( wxPoint( seg.A ) );
|
||||
|
@ -584,7 +583,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* graphic = new PCB_SHAPE;
|
||||
|
||||
graphic->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
graphic->SetShape( SHAPE_T::SEGMENT );
|
||||
graphic->SetLayer( layer );
|
||||
graphic->SetStart( wxPoint( seg.A ) );
|
||||
graphic->SetEnd( wxPoint( seg.B ) );
|
||||
|
@ -615,7 +614,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, PCB_SHAPE_TYPE::SEGMENT );
|
||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
|
||||
graphic->SetLayer( layer );
|
||||
graphic->SetStart( wxPoint( seg.A ) );
|
||||
graphic->SetStart0( wxPoint( seg.A ) );
|
||||
|
@ -703,7 +702,7 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent )
|
|||
|
||||
VECTOR2I center = GetArcCenter( start, mid, end );
|
||||
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetShape( SHAPE_T::ARC );
|
||||
arc->SetFilled( false );
|
||||
arc->SetLayer( layer );
|
||||
arc->SetWidth( line->GetWidth() );
|
||||
|
@ -748,7 +747,7 @@ OPT<SEG> CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem, int* aWidth )
|
|||
if( aWidth )
|
||||
*aWidth = line->GetWidth();
|
||||
|
||||
if( line->GetShape() == PCB_SHAPE_TYPE::SEGMENT )
|
||||
if( line->GetShape() == SHAPE_T::SEGMENT )
|
||||
{
|
||||
return boost::make_optional<SEG>( { VECTOR2I( line->GetStart() ),
|
||||
VECTOR2I( line->GetEnd() ) } );
|
||||
|
|
|
@ -258,7 +258,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( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetShape( SHAPE_T::SEGMENT );
|
||||
line->SetFlags( IS_NEW );
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
|
@ -285,7 +285,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
line = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
line->SetShape( PCB_SHAPE_TYPE::SEGMENT );
|
||||
line->SetShape( SHAPE_T::SEGMENT );
|
||||
line->SetFlags( IS_NEW );
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,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( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetShape( SHAPE_T::RECT );
|
||||
rect->SetFilled( false );
|
||||
rect->SetFlags(IS_NEW );
|
||||
|
||||
|
@ -335,7 +335,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
rect = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
rect->SetShape( PCB_SHAPE_TYPE::RECT );
|
||||
rect->SetShape( SHAPE_T::RECT );
|
||||
rect->SetFilled( false );
|
||||
rect->SetFlags(IS_NEW );
|
||||
startingPoint = NULLOPT;
|
||||
|
@ -362,7 +362,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( PCB_SHAPE_TYPE::CIRCLE );
|
||||
circle->SetShape( SHAPE_T::CIRCLE );
|
||||
circle->SetFilled( false );
|
||||
circle->SetFlags( IS_NEW );
|
||||
|
||||
|
@ -387,7 +387,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
circle = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
circle->SetShape( PCB_SHAPE_TYPE::CIRCLE );
|
||||
circle->SetShape( SHAPE_T::CIRCLE );
|
||||
circle->SetFilled( false );
|
||||
circle->SetFlags( IS_NEW );
|
||||
startingPoint = NULLOPT;
|
||||
|
@ -414,7 +414,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
|
|||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ARC );
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetShape( SHAPE_T::ARC );
|
||||
arc->SetFlags( IS_NEW );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
|
@ -435,7 +435,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
arc = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
|
||||
arc->SetShape( PCB_SHAPE_TYPE::ARC );
|
||||
arc->SetShape( SHAPE_T::ARC );
|
||||
arc->SetFlags( IS_NEW );
|
||||
immediateMode = false;
|
||||
}
|
||||
|
@ -1403,11 +1403,10 @@ static void updateSegmentFromGeometryMgr( const KIGFX::PREVIEW::TWO_POINT_GEOMET
|
|||
bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
||||
OPT<VECTOR2D> aStartingPoint )
|
||||
{
|
||||
PCB_SHAPE_TYPE shape = ( *aGraphic )->GetShape();
|
||||
SHAPE_T shape = ( *aGraphic )->GetShape();
|
||||
|
||||
// Only three shapes are currently supported
|
||||
wxASSERT( shape == PCB_SHAPE_TYPE::SEGMENT || shape == PCB_SHAPE_TYPE::CIRCLE
|
||||
|| shape == PCB_SHAPE_TYPE::RECT );
|
||||
wxASSERT( shape == SHAPE_T::SEGMENT || shape == SHAPE_T::CIRCLE || shape == SHAPE_T::RECT );
|
||||
|
||||
EDA_UNITS userUnits = m_frame->GetUserUnits();
|
||||
PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() );
|
||||
|
@ -1573,7 +1572,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
m_lineWidth = getSegmentWidth( drawingLayer );
|
||||
|
||||
// Init the new item attributes
|
||||
graphic->SetShape( static_cast<PCB_SHAPE_TYPE>( shape ) );
|
||||
graphic->SetShape( static_cast<SHAPE_T>( shape ) );
|
||||
graphic->SetFilled( false );
|
||||
graphic->SetWidth( m_lineWidth );
|
||||
graphic->SetLayer( drawingLayer );
|
||||
|
@ -1600,7 +1599,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
|
||||
started = true;
|
||||
}
|
||||
else if( shape == PCB_SHAPE_TYPE::CIRCLE )
|
||||
else if( shape == SHAPE_T::CIRCLE )
|
||||
{
|
||||
// No clever logic if drawing a circle
|
||||
preview.Clear();
|
||||
|
@ -1612,7 +1611,7 @@ 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 == PCB_SHAPE_TYPE::SEGMENT )
|
||||
|| ( evt->IsDblClick( BUT_LEFT ) && shape == SHAPE_T::SEGMENT )
|
||||
|| snapItem )
|
||||
// User has clicked twice in the same spot
|
||||
// or clicked on the end of an existing segment (closing a path)
|
||||
|
@ -1622,7 +1621,7 @@ 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 == PCB_SHAPE_TYPE::RECT || graphic->GetLength() > 0.0 ) )
|
||||
&& ( shape == SHAPE_T::RECT || graphic->GetLength() > 0.0 ) )
|
||||
{
|
||||
commit.Add( graphic );
|
||||
commit.Push( _( "Draw a line segment" ) );
|
||||
|
@ -1647,13 +1646,13 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
{
|
||||
// 45 degree lines
|
||||
if( started
|
||||
&& ( ( limit45 && shape == PCB_SHAPE_TYPE::SEGMENT )
|
||||
|| ( evt->Modifier( MD_SHIFT ) && shape == PCB_SHAPE_TYPE::RECT ) ) )
|
||||
&& ( ( limit45 && shape == SHAPE_T::SEGMENT )
|
||||
|| ( evt->Modifier( MD_SHIFT ) && shape == SHAPE_T::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 == PCB_SHAPE_TYPE::RECT ) );
|
||||
auto newEnd = GetVectorSnapped45( lineVector, ( shape == SHAPE_T::RECT ) );
|
||||
m_controls->ForceCursorPosition( true, VECTOR2I( twoPointManager.GetEnd() ) );
|
||||
twoPointManager.SetEnd( twoPointManager.GetOrigin() + (wxPoint) newEnd );
|
||||
twoPointManager.SetAngleSnap( true );
|
||||
|
@ -1850,7 +1849,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( PCB_SHAPE_TYPE::ARC );
|
||||
graphic->SetShape( SHAPE_T::ARC );
|
||||
graphic->SetWidth( m_lineWidth );
|
||||
|
||||
if( !m_view->IsLayerVisible( drawingLayer ) )
|
||||
|
|
|
@ -696,7 +696,7 @@ void PAD_TOOL::recombinePad( PAD* aPad )
|
|||
aPad->SetOffset( wxPoint( 0, 0 ) );
|
||||
|
||||
PCB_SHAPE* shape = new PCB_SHAPE;
|
||||
shape->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
shape->SetShape( SHAPE_T::POLY );
|
||||
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 PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
int r = ( start - end ).EuclideanNorm();
|
||||
|
||||
|
@ -534,14 +534,14 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
addAnchor( start, CORNER | SNAPPABLE, shape );
|
||||
addAnchor( end, CORNER | SNAPPABLE, shape );
|
||||
addAnchor( shape->GetCenter(), CORNER | SNAPPABLE, shape );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
SHAPE_LINE_CHAIN lc;
|
||||
lc.SetClosed( true );
|
||||
|
@ -582,7 +582,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
addAnchor( start, CORNER | SNAPPABLE, shape );
|
||||
addAnchor( end, CORNER | SNAPPABLE, shape );
|
||||
KI_FALLTHROUGH;
|
||||
|
|
|
@ -191,12 +191,12 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
points->AddPoint( shape->GetStart() );
|
||||
points->AddPoint( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
points->AddPoint( shape->GetStart() );
|
||||
points->AddPoint( wxPoint( shape->GetEnd().x, shape->GetStart().y ) );
|
||||
points->AddPoint( shape->GetEnd() );
|
||||
|
@ -213,7 +213,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
points->AddPoint( shape->GetCenter() );
|
||||
points->AddPoint( shape->GetArcStart() );
|
||||
points->AddPoint( shape->GetArcMid() );
|
||||
|
@ -225,16 +225,16 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
|
|||
points->Point( ARC_END ).SetGridConstraint( SNAP_TO_GRID );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
points->AddPoint( shape->GetCenter() );
|
||||
points->AddPoint( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
buildForPolyOutline( points, &shape->GetPolyShape() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
points->AddPoint( shape->GetStart() );
|
||||
points->AddPoint( shape->GetBezierC1() );
|
||||
points->AddPoint( shape->GetBezierC2() );
|
||||
|
@ -1042,7 +1042,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( isModified( m_editPoints->Point( SEG_START ) ) )
|
||||
shape->SetStart( (wxPoint) m_editPoints->Point( SEG_START ).GetPosition() );
|
||||
else if( isModified( m_editPoints->Point( SEG_END ) ) )
|
||||
|
@ -1050,7 +1050,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) ) )
|
||||
{
|
||||
|
@ -1096,7 +1096,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
VECTOR2I center = m_editPoints->Point( ARC_CENTER ).GetPosition();
|
||||
VECTOR2I mid = m_editPoints->Point( ARC_MID ).GetPosition();
|
||||
|
@ -1130,7 +1130,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition();
|
||||
const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition();
|
||||
|
@ -1147,7 +1147,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
SHAPE_POLY_SET& outline = shape->GetPolyShape();
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
|
||||
shape->SetStart( (wxPoint) m_editPoints->Point( BEZIER_CURVE_START ).
|
||||
GetPosition() );
|
||||
|
@ -1561,12 +1561,12 @@ void PCB_POINT_EDITOR::updatePoints()
|
|||
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
m_editPoints->Point( SEG_START ).SetPosition( shape->GetStart() );
|
||||
m_editPoints->Point( SEG_END ).SetPosition( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::RECT:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::ARC:
|
||||
case SHAPE_T::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 PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_editPoints->Point( CIRC_CENTER ).SetPosition( shape->GetCenter() );
|
||||
m_editPoints->Point( CIRC_END ).SetPosition( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_TYPE::POLYGON:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
const auto& points = shape->BuildPolyPointsList();
|
||||
|
||||
|
@ -1609,7 +1609,7 @@ void PCB_POINT_EDITOR::updatePoints()
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_TYPE::CURVE:
|
||||
case SHAPE_T::BEZIER:
|
||||
m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( shape->GetStart() );
|
||||
m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( shape->GetBezierC1() );
|
||||
m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( shape->GetBezierC2() );
|
||||
|
@ -1791,10 +1791,11 @@ void PCB_POINT_EDITOR::setAltConstraint( bool aEnabled )
|
|||
{
|
||||
if( aEnabled )
|
||||
{
|
||||
EDA_ITEM* parent = m_editPoints->GetParent();
|
||||
EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
|
||||
bool isPoly;
|
||||
|
||||
switch( m_editPoints->GetParent()->Type() )
|
||||
switch( parent->Type() )
|
||||
{
|
||||
case PCB_ZONE_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
|
@ -1803,8 +1804,7 @@ 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()
|
||||
== PCB_SHAPE_TYPE::POLYGON;
|
||||
isPoly = static_cast<PCB_SHAPE*>( parent )->GetShape() == SHAPE_T::POLY;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1841,11 +1841,11 @@ EDIT_POINT PCB_POINT_EDITOR::get45DegConstrainer() const
|
|||
case PCB_FP_SHAPE_T:
|
||||
switch( static_cast<const PCB_SHAPE*>( item )->GetShape() )
|
||||
{
|
||||
case PCB_SHAPE_TYPE::SEGMENT:
|
||||
case SHAPE_T::SEGMENT:
|
||||
return *( m_editPoints->Next( *m_editedPoint ) ); // select the other end of line
|
||||
|
||||
case PCB_SHAPE_TYPE::ARC:
|
||||
case PCB_SHAPE_TYPE::CIRCLE:
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::CIRCLE:
|
||||
return m_editPoints->Point( CIRC_CENTER );
|
||||
|
||||
default: // suppress warnings
|
||||
|
@ -1897,8 +1897,7 @@ 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() == PCB_SHAPE_TYPE::SEGMENT
|
||||
|| shape.GetShape() == PCB_SHAPE_TYPE::POLYGON;
|
||||
return shape.GetShape() == SHAPE_T::SEGMENT || shape.GetShape() == SHAPE_T::POLY;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1952,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() == PCB_SHAPE_TYPE::POLYGON )
|
||||
if( static_cast<PCB_SHAPE*>( item )->GetShape() == SHAPE_T::POLY )
|
||||
polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
|
||||
else
|
||||
return false;
|
||||
|
@ -2003,7 +2002,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() == PCB_SHAPE_TYPE::POLYGON ) )
|
||||
|| ( graphicItem && graphicItem->GetShape() == SHAPE_T::POLY ) )
|
||||
{
|
||||
unsigned int nearestIdx = 0;
|
||||
unsigned int nextNearestIdx = 0;
|
||||
|
@ -2073,7 +2072,7 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
|
|||
|
||||
commit.Push( _( "Add a zone corner" ) );
|
||||
}
|
||||
else if( graphicItem && graphicItem->GetShape() == PCB_SHAPE_TYPE::SEGMENT )
|
||||
else if( graphicItem && graphicItem->GetShape() == SHAPE_T::SEGMENT )
|
||||
{
|
||||
commit.Modify( graphicItem );
|
||||
|
||||
|
@ -2138,7 +2137,7 @@ int PCB_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( shape->GetShape() == PCB_SHAPE_TYPE::POLYGON )
|
||||
if( shape->GetShape() == SHAPE_T::POLY )
|
||||
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> aTypes )
|
||||
S_C PCB_SELECTION_CONDITIONS::OnlyGraphicShapeTypes( const std::set<SHAPE_T> 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> aTypes )
|
||||
const std::set<SHAPE_T> 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 shape = static_cast<const PCB_SHAPE*>( item )->GetShape();
|
||||
SHAPE_T 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)
|
||||
* @param aTypes is a list of allowed PCB_SHAPE shapes (@see SHAPE_T)
|
||||
* @return functor testing if selected items match the given list of allowed shapes
|
||||
*/
|
||||
static SELECTION_CONDITION OnlyGraphicShapeTypes( const std::set<PCB_SHAPE_TYPE> aTypes );
|
||||
static SELECTION_CONDITION OnlyGraphicShapeTypes( const std::set<SHAPE_T> aTypes );
|
||||
|
||||
|
||||
private:
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
|
||||
///< Helper function used by OnlyGraphicShapeTypes()
|
||||
static bool onlyGraphicShapeTypesFunc( const SELECTION& aSelection,
|
||||
const std::set<PCB_SHAPE_TYPE> aTypes );
|
||||
const std::set<SHAPE_T> aTypes );
|
||||
};
|
||||
|
||||
#endif /* PCB_SELECTION_CONDITIONS_H_ */
|
||||
|
|
|
@ -229,7 +229,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
|
|||
else
|
||||
poly = new PCB_SHAPE();
|
||||
|
||||
poly->SetShape( PCB_SHAPE_TYPE::POLYGON );
|
||||
poly->SetShape( SHAPE_T::POLY );
|
||||
|
||||
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, PCB_SHAPE_TYPE::SEGMENT );
|
||||
auto seg = std::make_unique<FP_SHAPE>( &aFootprint, SHAPE_T::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, PCB_SHAPE_TYPE::ARC );
|
||||
auto seg = std::make_unique<FP_SHAPE>( &aFootprint, SHAPE_T::ARC );
|
||||
|
||||
seg->SetStart0( (wxPoint) aCentre );
|
||||
seg->SetEnd0( (wxPoint) aStart );
|
||||
|
|
Loading…
Reference in New Issue