Read files with rectangle primitives in custom pads.
This commit is contained in:
parent
09cb75b8a1
commit
9ba9f0288e
|
@ -304,17 +304,19 @@ public:
|
||||||
* a curve
|
* a curve
|
||||||
*/
|
*/
|
||||||
void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness,
|
void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness,
|
||||||
bool aMergePrimitives = true ); ///< add a polygonal basic shape
|
bool aMergePrimitives = true );
|
||||||
void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness,
|
void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness,
|
||||||
bool aMergePrimitives = true ); ///< add a polygonal basic shape
|
bool aMergePrimitives = true );
|
||||||
void AddPrimitiveSegment( wxPoint aStart, wxPoint aEnd, int aThickness,
|
void AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
|
||||||
bool aMergePrimitives = true ); ///< segment basic shape
|
bool aMergePrimitives = true );
|
||||||
void AddPrimitiveCircle( wxPoint aCenter, int aRadius, int aThickness,
|
void AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness,
|
||||||
bool aMergePrimitives = true ); ///< ring or circle basic shape
|
bool aMergePrimitives = true ); ///< ring or circle basic shape
|
||||||
void AddPrimitiveArc( wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness,
|
void AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
|
||||||
bool aMergePrimitives = true ); ///< arc basic shape
|
bool aMergePrimitives = true );
|
||||||
void AddPrimitiveCurve( wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2,
|
void AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
|
||||||
int aThickness, bool aMergePrimitives = true ); ///< curve basic shape
|
int aThickness, bool aMergePrimitives = true );
|
||||||
|
void AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
|
||||||
|
const wxPoint& aCtrl2, int aThickness, bool aMergePrimitives = true );
|
||||||
|
|
||||||
|
|
||||||
bool GetBestAnchorPosition( VECTOR2I& aPos );
|
bool GetBestAnchorPosition( VECTOR2I& aPos );
|
||||||
|
|
|
@ -174,7 +174,7 @@ void D_PAD::AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D_PAD::AddPrimitiveSegment( wxPoint aStart, wxPoint aEnd, int aThickness,
|
void D_PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
|
||||||
bool aMergePrimitives )
|
bool aMergePrimitives )
|
||||||
{
|
{
|
||||||
PAD_CS_PRIMITIVE shape( S_SEGMENT );
|
PAD_CS_PRIMITIVE shape( S_SEGMENT );
|
||||||
|
@ -188,8 +188,8 @@ void D_PAD::AddPrimitiveSegment( wxPoint aStart, wxPoint aEnd, int aThickness,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D_PAD::AddPrimitiveArc( wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness,
|
void D_PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
|
||||||
bool aMergePrimitives )
|
int aThickness, bool aMergePrimitives )
|
||||||
{
|
{
|
||||||
PAD_CS_PRIMITIVE shape( S_ARC );
|
PAD_CS_PRIMITIVE shape( S_ARC );
|
||||||
shape.m_Start = aCenter;
|
shape.m_Start = aCenter;
|
||||||
|
@ -203,8 +203,8 @@ void D_PAD::AddPrimitiveArc( wxPoint aCenter, wxPoint aStart, int aArcAngle, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D_PAD::AddPrimitiveCurve( wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2,
|
void D_PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
|
||||||
int aThickness, bool aMergePrimitives )
|
const wxPoint& aCtrl2, int aThickness, bool aMergePrimitives )
|
||||||
{
|
{
|
||||||
PAD_CS_PRIMITIVE shape( S_CURVE );
|
PAD_CS_PRIMITIVE shape( S_CURVE );
|
||||||
shape.m_Start = aStart;
|
shape.m_Start = aStart;
|
||||||
|
@ -219,7 +219,7 @@ void D_PAD::AddPrimitiveCurve( wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D_PAD::AddPrimitiveCircle( wxPoint aCenter, int aRadius, int aThickness,
|
void D_PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness,
|
||||||
bool aMergePrimitives )
|
bool aMergePrimitives )
|
||||||
{
|
{
|
||||||
PAD_CS_PRIMITIVE shape( S_CIRCLE );
|
PAD_CS_PRIMITIVE shape( S_CIRCLE );
|
||||||
|
@ -233,6 +233,20 @@ void D_PAD::AddPrimitiveCircle( wxPoint aCenter, int aRadius, int aThickness,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D_PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
|
||||||
|
bool aMergePrimitives )
|
||||||
|
{
|
||||||
|
PAD_CS_PRIMITIVE shape( S_RECT );
|
||||||
|
shape.m_Start = aStart;
|
||||||
|
shape.m_End = aEnd;
|
||||||
|
shape.m_Thickness = aThickness;
|
||||||
|
m_basicShapes.push_back( shape );
|
||||||
|
|
||||||
|
if( aMergePrimitives )
|
||||||
|
MergePrimitivesAsPolygon();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool D_PAD::SetPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList )
|
bool D_PAD::SetPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList )
|
||||||
{
|
{
|
||||||
// clear old list
|
// clear old list
|
||||||
|
|
|
@ -3352,37 +3352,45 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
|
||||||
case T_gr_arc:
|
case T_gr_arc:
|
||||||
dummysegm = parseDRAWSEGMENT();
|
dummysegm = parseDRAWSEGMENT();
|
||||||
pad->AddPrimitiveArc( dummysegm->GetCenter(), dummysegm->GetArcStart(),
|
pad->AddPrimitiveArc( dummysegm->GetCenter(), dummysegm->GetArcStart(),
|
||||||
dummysegm->GetAngle(), dummysegm->GetWidth(), false );
|
dummysegm->GetAngle(), dummysegm->GetWidth(), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_gr_line:
|
case T_gr_line:
|
||||||
dummysegm = parseDRAWSEGMENT();
|
dummysegm = parseDRAWSEGMENT();
|
||||||
pad->AddPrimitiveSegment( dummysegm->GetStart(), dummysegm->GetEnd(),
|
pad->AddPrimitiveSegment( dummysegm->GetStart(), dummysegm->GetEnd(),
|
||||||
dummysegm->GetWidth(), false );
|
dummysegm->GetWidth(), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_gr_circle:
|
case T_gr_circle:
|
||||||
dummysegm = parseDRAWSEGMENT( true ); // Circles with 0 thickness are allowed
|
dummysegm = parseDRAWSEGMENT( true ); // Circles with 0 thickness are allowed
|
||||||
// ( filled circles )
|
// ( filled circles )
|
||||||
pad->AddPrimitiveCircle( dummysegm->GetCenter(), dummysegm->GetRadius(),
|
pad->AddPrimitiveCircle( dummysegm->GetCenter(), dummysegm->GetRadius(),
|
||||||
dummysegm->GetWidth(), false );
|
dummysegm->GetWidth(), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_gr_rect:
|
||||||
|
dummysegm = parseDRAWSEGMENT( true );
|
||||||
|
pad->AddPrimitiveRect( dummysegm->GetStart(), dummysegm->GetEnd(),
|
||||||
|
dummysegm->GetWidth(), false );
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case T_gr_poly:
|
case T_gr_poly:
|
||||||
dummysegm = parseDRAWSEGMENT();
|
dummysegm = parseDRAWSEGMENT();
|
||||||
pad->AddPrimitivePoly(
|
pad->AddPrimitivePoly( dummysegm->BuildPolyPointsList(),
|
||||||
dummysegm->BuildPolyPointsList(), dummysegm->GetWidth(), false );
|
dummysegm->GetWidth(), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_gr_curve:
|
case T_gr_curve:
|
||||||
dummysegm = parseDRAWSEGMENT();
|
dummysegm = parseDRAWSEGMENT();
|
||||||
pad->AddPrimitiveCurve( dummysegm->GetStart(), dummysegm->GetEnd(),
|
pad->AddPrimitiveCurve( dummysegm->GetStart(), dummysegm->GetEnd(),
|
||||||
dummysegm->GetBezControl1(), dummysegm->GetBezControl2(),
|
dummysegm->GetBezControl1(),
|
||||||
dummysegm->GetWidth(), false );
|
dummysegm->GetBezControl2(),
|
||||||
|
dummysegm->GetWidth(), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Expecting( "gr_line, gr_arc, gr_circle, gr_curve or gr_poly" );
|
Expecting( "gr_line, gr_arc, gr_circle, gr_curve, gr_rect or gr_poly" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue