Continue the war on wxPoint
This commit is contained in:
parent
e67b6bc402
commit
fcfe42d67c
|
@ -128,7 +128,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
||||||
{
|
{
|
||||||
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
|
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
|
||||||
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
|
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
|
||||||
std::vector<wxPoint> points;
|
std::vector<VECTOR2I> points;
|
||||||
|
|
||||||
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
|
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,19 +162,6 @@ public:
|
||||||
|
|
||||||
SHAPE_LINE_CHAIN( const std::vector<int>& aV );
|
SHAPE_LINE_CHAIN( const std::vector<int>& aV );
|
||||||
|
|
||||||
SHAPE_LINE_CHAIN( const std::vector<wxPoint>& aV, bool aClosed = false ) :
|
|
||||||
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
|
|
||||||
m_closed( aClosed ),
|
|
||||||
m_width( 0 )
|
|
||||||
{
|
|
||||||
m_points.reserve( aV.size() );
|
|
||||||
|
|
||||||
for( auto pt : aV )
|
|
||||||
m_points.emplace_back( pt.x, pt.y );
|
|
||||||
|
|
||||||
m_shapes = std::vector<std::pair<ssize_t, ssize_t>>( aV.size(), SHAPES_ARE_PT );
|
|
||||||
}
|
|
||||||
|
|
||||||
SHAPE_LINE_CHAIN( const std::vector<VECTOR2I>& aV, bool aClosed = false ) :
|
SHAPE_LINE_CHAIN( const std::vector<VECTOR2I>& aV, bool aClosed = false ) :
|
||||||
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
|
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
|
||||||
m_closed( aClosed ),
|
m_closed( aClosed ),
|
||||||
|
|
|
@ -482,9 +482,9 @@ public:
|
||||||
return DRC_LAYER( m_tree[int( aLayer )] );
|
return DRC_LAYER( m_tree[int( aLayer )] );
|
||||||
}
|
}
|
||||||
|
|
||||||
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const wxPoint& aPoint, int aAccuracy = 0 ) const
|
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const VECTOR2I& aPoint, int aAccuracy = 0 ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect( aPoint, wxSize( 0, 0 ) );
|
EDA_RECT rect( aPoint, VECTOR2I( 0, 0 ) );
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
return DRC_LAYER( m_tree[int( aLayer )], rect );
|
return DRC_LAYER( m_tree[int( aLayer )], rect );
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,7 +252,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
||||||
|
|
||||||
// Plot title "Info"
|
// Plot title "Info"
|
||||||
wxString Text = wxT( "Drill Map:" );
|
wxString Text = wxT( "Drill Map:" );
|
||||||
plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, EDA_ANGLE::HORIZONTAL,
|
plotter->Text( VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, EDA_ANGLE::HORIZONTAL,
|
||||||
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
|
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
|
||||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
|
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
||||||
int y = KiROUND( plotY + charSize * charScale );
|
int y = KiROUND( plotY + charSize * charScale );
|
||||||
|
|
||||||
plotter->SetCurrentLineWidth( getMarkerBestPenSize( plot_diam ) );
|
plotter->SetCurrentLineWidth( getMarkerBestPenSize( plot_diam ) );
|
||||||
plotter->Marker( wxPoint( x, y ), plot_diam, ii );
|
plotter->Marker( VECTOR2I( x, y ), plot_diam, ii );
|
||||||
plotter->SetCurrentLineWidth( -1 );
|
plotter->SetCurrentLineWidth( -1 );
|
||||||
|
|
||||||
// List the diameter of each drill in mm and inches.
|
// List the diameter of each drill in mm and inches.
|
||||||
|
@ -313,8 +313,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
||||||
if( tool.m_Hole_NotPlated )
|
if( tool.m_Hole_NotPlated )
|
||||||
msg += wxT( " (not plated)" );
|
msg += wxT( " (not plated)" );
|
||||||
|
|
||||||
plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, EDA_ANGLE::HORIZONTAL,
|
plotter->Text( VECTOR2I( plotX, y ), COLOR4D::UNSPECIFIED, msg, EDA_ANGLE::HORIZONTAL,
|
||||||
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
|
VECTOR2I( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
|
||||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
|
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
|
||||||
|
|
||||||
intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
|
intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
|
||||||
|
|
|
@ -127,7 +127,7 @@ void GERBER_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, b
|
||||||
|
|
||||||
#if !FLASH_OVAL_HOLE
|
#if !FLASH_OVAL_HOLE
|
||||||
// A helper class to transform an oblong hole to a segment
|
// A helper class to transform an oblong hole to a segment
|
||||||
static void convertOblong2Segment( wxSize aSize, double aOrient, wxPoint& aStart, wxPoint& aEnd );
|
static void convertOblong2Segment( wxSize aSize, double aOrient, VECTOR2I& aStart, VECTOR2I& aEnd );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
|
||||||
hole_descr.m_Hole_Orient, FILLED, &gbr_metadata );
|
hole_descr.m_Hole_Orient, FILLED, &gbr_metadata );
|
||||||
#else
|
#else
|
||||||
// Use routing for oblong hole (Slots)
|
// Use routing for oblong hole (Slots)
|
||||||
wxPoint start, end;
|
VECTOR2I start, end;
|
||||||
convertOblong2Segment( hole_descr.m_Hole_Size, hole_descr.m_Hole_Orient, start, end );
|
convertOblong2Segment( hole_descr.m_Hole_Size, hole_descr.m_Hole_Orient, start, end );
|
||||||
int width = std::min( hole_descr.m_Hole_Size.x, hole_descr.m_Hole_Size.y );
|
int width = std::min( hole_descr.m_Hole_Size.x, hole_descr.m_Hole_Size.y );
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
|
||||||
|
|
||||||
|
|
||||||
#if !FLASH_OVAL_HOLE
|
#if !FLASH_OVAL_HOLE
|
||||||
void convertOblong2Segment( wxSize aSize, double aOrient, wxPoint& aStart, wxPoint& aEnd )
|
void convertOblong2Segment( wxSize aSize, double aOrient, VECTOR2I& aStart, VECTOR2I& aEnd )
|
||||||
{
|
{
|
||||||
wxSize size( aSize );
|
wxSize size( aSize );
|
||||||
double orient = aOrient;
|
double orient = aOrient;
|
||||||
|
@ -280,10 +280,10 @@ void convertOblong2Segment( wxSize aSize, double aOrient, wxPoint& aStart, wxPoi
|
||||||
int cx = 0;
|
int cx = 0;
|
||||||
int cy = deltaxy / 2;
|
int cy = deltaxy / 2;
|
||||||
RotatePoint( &cx, &cy, orient );
|
RotatePoint( &cx, &cy, orient );
|
||||||
aStart = wxPoint( cx, cy );
|
aStart = VECTOR2I( cx, cy );
|
||||||
cx = 0; cy = -deltaxy / 2;
|
cx = 0; cy = -deltaxy / 2;
|
||||||
RotatePoint( &cx, &cy, orient );
|
RotatePoint( &cx, &cy, orient );
|
||||||
aEnd = wxPoint( cx, cy );
|
aEnd = VECTOR2I( cx, cy );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -713,10 +713,10 @@ EDA_RECT FOOTPRINT::GetFpPadsLocalBbox() const
|
||||||
// Create such a image:
|
// Create such a image:
|
||||||
FOOTPRINT dummy( *this );
|
FOOTPRINT dummy( *this );
|
||||||
|
|
||||||
dummy.SetPosition( wxPoint( 0, 0 ) );
|
dummy.SetPosition( VECTOR2I( 0, 0 ) );
|
||||||
|
|
||||||
if( dummy.IsFlipped() )
|
if( dummy.IsFlipped() )
|
||||||
dummy.Flip( wxPoint( 0, 0 ) , false );
|
dummy.Flip( VECTOR2I( 0, 0 ), false );
|
||||||
|
|
||||||
if( dummy.GetOrientation() )
|
if( dummy.GetOrientation() )
|
||||||
dummy.SetOrientation( 0 );
|
dummy.SetOrientation( 0 );
|
||||||
|
@ -2310,7 +2310,7 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
|
||||||
// as their hole:
|
// as their hole:
|
||||||
if( aSkipNPTHPadsWihNoCopper && pad->GetAttribute() == PAD_ATTRIB::NPTH )
|
if( aSkipNPTHPadsWihNoCopper && pad->GetAttribute() == PAD_ATTRIB::NPTH )
|
||||||
{
|
{
|
||||||
if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == wxPoint( 0, 0 ) )
|
if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == VECTOR2I( 0, 0 ) )
|
||||||
{
|
{
|
||||||
switch( pad->GetShape() )
|
switch( pad->GetShape() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -525,7 +525,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get a pad at \a aPosition on \a aLayerMask in the footprint.
|
* Get a pad at \a aPosition on \a aLayerMask in the footprint.
|
||||||
*
|
*
|
||||||
* @param aPosition A wxPoint object containing the position to hit test.
|
* @param aPosition A VECTOR2I object containing the position to hit test.
|
||||||
* @param aLayerMask A layer or layers to mask the hit test.
|
* @param aLayerMask A layer or layers to mask the hit test.
|
||||||
* @return A pointer to a #PAD object if found otherwise NULL.
|
* @return A pointer to a #PAD object if found otherwise NULL.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,7 +88,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
||||||
newFootprint.SetLocked( false );
|
newFootprint.SetLocked( false );
|
||||||
|
|
||||||
// locate the reference point at (0, 0) in the copied items
|
// locate the reference point at (0, 0) in the copied items
|
||||||
newFootprint.Move( wxPoint( -refPoint.x, -refPoint.y ) );
|
newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) );
|
||||||
|
|
||||||
Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
|
Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
||||||
PAD* pad = (PAD*) item->Clone();
|
PAD* pad = (PAD*) item->Clone();
|
||||||
|
|
||||||
footprint->SetPosition( pad->GetPosition() );
|
footprint->SetPosition( pad->GetPosition() );
|
||||||
pad->SetPos0( wxPoint() );
|
pad->SetPos0( VECTOR2I() );
|
||||||
footprint->Add( pad );
|
footprint->Add( pad );
|
||||||
copy = footprint;
|
copy = footprint;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
|
|
||||||
class wxDC;
|
class wxDC;
|
||||||
class wxPoint;
|
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class EDA_DRAW_FRAME;
|
class EDA_DRAW_FRAME;
|
||||||
class PAD;
|
class PAD;
|
||||||
|
|
|
@ -392,7 +392,7 @@ public:
|
||||||
*/
|
*/
|
||||||
double GetAngle() const
|
double GetAngle() const
|
||||||
{
|
{
|
||||||
wxPoint delta( m_end - m_start );
|
VECTOR2I delta( m_end - m_start );
|
||||||
|
|
||||||
return atan2( (double)delta.y, (double)delta.x );
|
return atan2( (double)delta.y, (double)delta.x );
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ wxString PCB_MARKER::Serialize() const
|
||||||
PCB_MARKER* PCB_MARKER::Deserialize( const wxString& data )
|
PCB_MARKER* PCB_MARKER::Deserialize( const wxString& data )
|
||||||
{
|
{
|
||||||
wxArrayString props = wxSplit( data, '|' );
|
wxArrayString props = wxSplit( data, '|' );
|
||||||
wxPoint markerPos( (int) strtol( props[1].c_str(), nullptr, 10 ),
|
VECTOR2I markerPos( (int) strtol( props[1].c_str(), nullptr, 10 ),
|
||||||
(int) strtol( props[2].c_str(), nullptr, 10 ) );
|
(int) strtol( props[2].c_str(), nullptr, 10 ) );
|
||||||
|
|
||||||
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( props[0] );
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( props[0] );
|
||||||
|
|
|
@ -1716,8 +1716,8 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
|
||||||
// Scale by zoom a bit, but not too much
|
// Scale by zoom a bit, but not too much
|
||||||
int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
|
int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
|
||||||
int penWidth = textSize / 10;
|
int penWidth = textSize / 10;
|
||||||
wxPoint textOffset = wxPoint( width.x / 2, - KiROUND( textSize * 0.5 ) );
|
VECTOR2I textOffset = VECTOR2I( width.x / 2, -KiROUND( textSize * 0.5 ) );
|
||||||
wxPoint titleHeight = wxPoint( 0, KiROUND( textSize * 2.0 ) );
|
VECTOR2I titleHeight = VECTOR2I( 0, KiROUND( textSize * 2.0 ) );
|
||||||
|
|
||||||
if( PrintableCharCount( name ) * textSize < bbox.GetWidth() )
|
if( PrintableCharCount( name ) * textSize < bbox.GetWidth() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,7 +143,7 @@ VECTOR2I PCB_SHAPE::getParentPosition() const
|
||||||
if( GetParentFootprint() )
|
if( GetParentFootprint() )
|
||||||
return GetParentFootprint()->GetPosition();
|
return GetParentFootprint()->GetPosition();
|
||||||
else
|
else
|
||||||
return wxPoint( 0, 0 );
|
return VECTOR2I( 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -417,7 +417,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
// Build the dummy pad outline with coordinates relative to the pad position
|
// Build the dummy pad outline with coordinates relative to the pad position
|
||||||
// and orientation 0. The actual pos and rotation will be taken in account
|
// and orientation 0. The actual pos and rotation will be taken in account
|
||||||
// later by the plot function
|
// later by the plot function
|
||||||
dummy.SetPosition( wxPoint( 0, 0 ) );
|
dummy.SetPosition( VECTOR2I( 0, 0 ) );
|
||||||
dummy.SetOrientation( 0 );
|
dummy.SetOrientation( 0 );
|
||||||
SHAPE_POLY_SET outline;
|
SHAPE_POLY_SET outline;
|
||||||
int maxError = aBoard->GetDesignSettings().m_MaxError;
|
int maxError = aBoard->GetDesignSettings().m_MaxError;
|
||||||
|
@ -584,7 +584,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
double start_angle = arc->GetArcAngleStart();
|
double start_angle = arc->GetArcAngleStart();
|
||||||
double end_angle = start_angle + arc->GetAngle();
|
double end_angle = start_angle + arc->GetAngle();
|
||||||
|
|
||||||
aPlotter->ThickArc( wxPoint( center.x, center.y ), -end_angle, -start_angle,
|
aPlotter->ThickArc( VECTOR2I( center.x, center.y ), -end_angle, -start_angle,
|
||||||
radius, width, plotMode, &gbr_metadata );
|
radius, width, plotMode, &gbr_metadata );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -719,7 +719,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
outlines.Simplify( SHAPE_POLY_SET::PM_FAST );
|
outlines.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
// Plot outlines
|
// Plot outlines
|
||||||
std::vector<wxPoint> cornerList;
|
std::vector<VECTOR2I> cornerList;
|
||||||
|
|
||||||
// Now we have one or more basic polygons: plot each polygon
|
// Now we have one or more basic polygons: plot each polygon
|
||||||
for( int ii = 0; ii < outlines.OutlineCount(); ii++ )
|
for( int ii = 0; ii < outlines.OutlineCount(); ii++ )
|
||||||
|
@ -758,8 +758,8 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
{
|
{
|
||||||
// Note: small drill marks have no significance when applied to slots
|
// Note: small drill marks have no significance when applied to slots
|
||||||
const SHAPE_SEGMENT* seg = pad->GetEffectiveHoleShape();
|
const SHAPE_SEGMENT* seg = pad->GetEffectiveHoleShape();
|
||||||
aPlotter->ThickSegment( (wxPoint) seg->GetSeg().A,
|
aPlotter->ThickSegment( seg->GetSeg().A,
|
||||||
(wxPoint) seg->GetSeg().B,
|
seg->GetSeg().B,
|
||||||
seg->GetWidth(), SKETCH, nullptr );
|
seg->GetWidth(), SKETCH, nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -977,7 +977,7 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
|
||||||
{
|
{
|
||||||
int32_t x = ALTIUM_PARSER::ConvertToKicadUnit( aReader.Read<double>() );
|
int32_t x = ALTIUM_PARSER::ConvertToKicadUnit( aReader.Read<double>() );
|
||||||
int32_t y = ALTIUM_PARSER::ConvertToKicadUnit( -aReader.Read<double>() );
|
int32_t y = ALTIUM_PARSER::ConvertToKicadUnit( -aReader.Read<double>() );
|
||||||
holes.at( k ).emplace_back( wxPoint( x, y ) );
|
holes.at( k ).emplace_back( VECTOR2I( x, y ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2380,7 +2380,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
||||||
shape->SetFilled( true );
|
shape->SetFilled( true );
|
||||||
shape->SetLayer( klayer );
|
shape->SetLayer( klayer );
|
||||||
shape->SetStart( aElem.position );
|
shape->SetStart( aElem.position );
|
||||||
shape->SetEnd( aElem.position - wxPoint( 0, aElem.topsize.x / 4 ) );
|
shape->SetEnd( aElem.position - VECTOR2I( 0, aElem.topsize.x / 4 ) );
|
||||||
shape->SetStroke( STROKE_PARAMS( aElem.topsize.x / 2, PLOT_DASH_TYPE::SOLID ) );
|
shape->SetStroke( STROKE_PARAMS( aElem.topsize.x / 2, PLOT_DASH_TYPE::SOLID ) );
|
||||||
HelperShapeSetLocalCoord( shape, aElem.component );
|
HelperShapeSetLocalCoord( shape, aElem.component );
|
||||||
}
|
}
|
||||||
|
@ -2422,10 +2422,10 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
||||||
shape->SetLayer( klayer );
|
shape->SetLayer( klayer );
|
||||||
shape->SetStroke( STROKE_PARAMS( 0 ) );
|
shape->SetStroke( STROKE_PARAMS( 0 ) );
|
||||||
|
|
||||||
VECTOR2I p11 = aElem.position + wxPoint( aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
VECTOR2I p11 = aElem.position + VECTOR2I( aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
||||||
VECTOR2I p12 = aElem.position + wxPoint( aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
VECTOR2I p12 = aElem.position + VECTOR2I( aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
||||||
VECTOR2I p22 = aElem.position + wxPoint( -aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
VECTOR2I p22 = aElem.position + VECTOR2I( -aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
||||||
VECTOR2I p21 = aElem.position + wxPoint( -aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
VECTOR2I p21 = aElem.position + VECTOR2I( -aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
||||||
|
|
||||||
int chamfer = std::min( aElem.topsize.x, aElem.topsize.y ) / 4;
|
int chamfer = std::min( aElem.topsize.x, aElem.topsize.y ) / 4;
|
||||||
VECTOR2I chamferX( chamfer, 0 );
|
VECTOR2I chamferX( chamfer, 0 );
|
||||||
|
|
|
@ -121,7 +121,7 @@ private:
|
||||||
std::vector<LAYER_ID> m_powerPlaneLayers; ///< List of layers that are marked as
|
std::vector<LAYER_ID> m_powerPlaneLayers; ///< List of layers that are marked as
|
||||||
///< power plane in CADSTAR. This is used
|
///< power plane in CADSTAR. This is used
|
||||||
///< by "loadtemplates"
|
///< by "loadtemplates"
|
||||||
wxPoint m_designCenter; ///< Used for calculating the required
|
VECTOR2I m_designCenter; ///< Used for calculating the required
|
||||||
///< offset to apply to the Cadstar design
|
///< offset to apply to the Cadstar design
|
||||||
///< so that it fits in KiCad canvas
|
///< so that it fits in KiCad canvas
|
||||||
std::set<HATCHCODE_ID> m_hatchcodesTested; ///< Used by checkAndLogHatchCode() to
|
std::set<HATCHCODE_ID> m_hatchcodesTested; ///< Used by checkAndLogHatchCode() to
|
||||||
|
|
|
@ -134,7 +134,7 @@ BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppe
|
||||||
int desired_x = ( w - bbbox.GetWidth() ) / 2;
|
int desired_x = ( w - bbbox.GetWidth() ) / 2;
|
||||||
int desired_y = ( h - bbbox.GetHeight() ) / 2;
|
int desired_y = ( h - bbbox.GetHeight() ) / 2;
|
||||||
|
|
||||||
m_board->Move( wxPoint( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
|
m_board->Move( VECTOR2I( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -699,8 +699,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
||||||
EWIRE w( gr );
|
EWIRE w( gr );
|
||||||
PCB_LAYER_ID layer = kicad_layer( w.layer );
|
PCB_LAYER_ID layer = kicad_layer( w.layer );
|
||||||
|
|
||||||
wxPoint start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
|
VECTOR2I start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
|
||||||
wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
|
VECTOR2I end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
|
||||||
|
|
||||||
if( layer != UNDEFINED_LAYER )
|
if( layer != UNDEFINED_LAYER )
|
||||||
{
|
{
|
||||||
|
@ -750,7 +750,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
||||||
pcbtxt->SetLayer( layer );
|
pcbtxt->SetLayer( layer );
|
||||||
wxString kicadText = interpret_text( t.text );
|
wxString kicadText = interpret_text( t.text );
|
||||||
pcbtxt->SetText( FROM_UTF8( kicadText.c_str() ) );
|
pcbtxt->SetText( FROM_UTF8( kicadText.c_str() ) );
|
||||||
pcbtxt->SetTextPos( wxPoint( kicad_x( t.x ), kicad_y( t.y ) ) );
|
pcbtxt->SetTextPos( VECTOR2I( kicad_x( t.x ), kicad_y( t.y ) ) );
|
||||||
|
|
||||||
double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default
|
double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default
|
||||||
int textThickness = KiROUND( t.size.ToPcbUnits() * ratio / 100 );
|
int textThickness = KiROUND( t.size.ToPcbUnits() * ratio / 100 );
|
||||||
|
@ -910,8 +910,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
||||||
m_board->Add( shape, ADD_MODE::APPEND );
|
m_board->Add( shape, ADD_MODE::APPEND );
|
||||||
shape->SetFilled( false );
|
shape->SetFilled( false );
|
||||||
shape->SetLayer( layer );
|
shape->SetLayer( layer );
|
||||||
shape->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );
|
shape->SetStart( VECTOR2I( kicad_x( c.x ), kicad_y( c.y ) ) );
|
||||||
shape->SetEnd( wxPoint( kicad_x( c.x ) + radius, kicad_y( c.y ) ) );
|
shape->SetEnd( VECTOR2I( kicad_x( c.x ) + radius, kicad_y( c.y ) ) );
|
||||||
shape->SetStroke( STROKE_PARAMS( width, PLOT_DASH_TYPE::SOLID ) );
|
shape->SetStroke( STROKE_PARAMS( width, PLOT_DASH_TYPE::SOLID ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -939,10 +939,10 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
||||||
ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
|
ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
|
||||||
|
|
||||||
const int outlineIdx = -1; // this is the id of the copper zone main outline
|
const int outlineIdx = -1; // this is the id of the copper zone main outline
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
|
||||||
|
|
||||||
if( r.rot )
|
if( r.rot )
|
||||||
zone->Rotate( zone->GetPosition(), r.rot->degrees * 10 );
|
zone->Rotate( zone->GetPosition(), r.rot->degrees * 10 );
|
||||||
|
@ -1014,8 +1014,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
||||||
dimension->SetPrecision( DIMENSION_PRECISION );
|
dimension->SetPrecision( DIMENSION_PRECISION );
|
||||||
|
|
||||||
// The origin and end are assumed to always be in this order from eagle
|
// The origin and end are assumed to always be in this order from eagle
|
||||||
dimension->SetStart( wxPoint( kicad_x( d.x1 ), kicad_y( d.y1 ) ) );
|
dimension->SetStart( VECTOR2I( kicad_x( d.x1 ), kicad_y( d.y1 ) ) );
|
||||||
dimension->SetEnd( wxPoint( kicad_x( d.x2 ), kicad_y( d.y2 ) ) );
|
dimension->SetEnd( VECTOR2I( kicad_x( d.x2 ), kicad_y( d.y2 ) ) );
|
||||||
dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) );
|
dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) );
|
||||||
dimension->Text().SetTextThickness( designSettings.GetTextThickness( layer ) );
|
dimension->Text().SetTextThickness( designSettings.GetTextThickness( layer ) );
|
||||||
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
|
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
|
||||||
|
@ -1186,7 +1186,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
|
||||||
|
|
||||||
refanceNamePresetInPackageLayout = true;
|
refanceNamePresetInPackageLayout = true;
|
||||||
valueNamePresetInPackageLayout = true;
|
valueNamePresetInPackageLayout = true;
|
||||||
footprint->SetPosition( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) );
|
footprint->SetPosition( VECTOR2I( kicad_x( e.x ), kicad_y( e.y ) ) );
|
||||||
|
|
||||||
// Is >NAME field set in package layout ?
|
// Is >NAME field set in package layout ?
|
||||||
if( footprint->GetReference().size() == 0 )
|
if( footprint->GetReference().size() == 0 )
|
||||||
|
@ -1561,7 +1561,7 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
|
||||||
|
|
||||||
if( a.x && a.y ) // OPT
|
if( a.x && a.y ) // OPT
|
||||||
{
|
{
|
||||||
wxPoint pos( kicad_x( *a.x ), kicad_y( *a.y ) );
|
VECTOR2I pos( kicad_x( *a.x ), kicad_y( *a.y ) );
|
||||||
aFPText->SetTextPos( pos );
|
aFPText->SetTextPos( pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1742,8 +1742,8 @@ void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
|
||||||
{
|
{
|
||||||
EWIRE w( aTree );
|
EWIRE w( aTree );
|
||||||
PCB_LAYER_ID layer = kicad_layer( w.layer );
|
PCB_LAYER_ID layer = kicad_layer( w.layer );
|
||||||
wxPoint start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
|
VECTOR2I start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
|
||||||
wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
|
VECTOR2I end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
|
||||||
int width = w.width.ToPcbUnits();
|
int width = w.width.ToPcbUnits();
|
||||||
|
|
||||||
if( layer == UNDEFINED_LAYER )
|
if( layer == UNDEFINED_LAYER )
|
||||||
|
@ -1902,7 +1902,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree )
|
||||||
if( e.shape && *e.shape == EPAD::OFFSET )
|
if( e.shape && *e.shape == EPAD::OFFSET )
|
||||||
{
|
{
|
||||||
int offset = KiROUND( ( sz.x - sz.y ) / 2.0 );
|
int offset = KiROUND( ( sz.x - sz.y ) / 2.0 );
|
||||||
pad->SetOffset( wxPoint( offset, 0 ) );
|
pad->SetOffset( VECTOR2I( offset, 0 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2044,10 +2044,10 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
|
||||||
setKeepoutSettingsToZone( zone, r.layer );
|
setKeepoutSettingsToZone( zone, r.layer );
|
||||||
|
|
||||||
const int outlineIdx = -1; // this is the id of the copper zone main outline
|
const int outlineIdx = -1; // this is the id of the copper zone main outline
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
|
||||||
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
|
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
|
||||||
|
|
||||||
if( r.rot )
|
if( r.rot )
|
||||||
{
|
{
|
||||||
|
@ -2282,8 +2282,8 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
gr->SetLayer( layer );
|
gr->SetLayer( layer );
|
||||||
gr->SetStart0( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) );
|
gr->SetStart0( VECTOR2I( kicad_x( e.x ), kicad_y( e.y ) ) );
|
||||||
gr->SetEnd0( wxPoint( kicad_x( e.x ) + radius, kicad_y( e.y ) ) );
|
gr->SetEnd0( VECTOR2I( kicad_x( e.x ) + radius, kicad_y( e.y ) ) );
|
||||||
gr->SetDrawCoord();
|
gr->SetDrawCoord();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2305,14 +2305,14 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC
|
||||||
|
|
||||||
// Mechanical purpose only:
|
// Mechanical purpose only:
|
||||||
// no offset, no net name, no pad name allowed
|
// no offset, no net name, no pad name allowed
|
||||||
// pad->SetOffset( wxPoint( 0, 0 ) );
|
// pad->SetOffset( VECTOR2I( 0, 0 ) );
|
||||||
// pad->SetNumber( wxEmptyString );
|
// pad->SetNumber( wxEmptyString );
|
||||||
|
|
||||||
VECTOR2I padpos( kicad_x( e.x ), kicad_y( e.y ) );
|
VECTOR2I padpos( kicad_x( e.x ), kicad_y( e.y ) );
|
||||||
|
|
||||||
if( aCenter )
|
if( aCenter )
|
||||||
{
|
{
|
||||||
pad->SetPos0( wxPoint( 0, 0 ) );
|
pad->SetPos0( VECTOR2I( 0, 0 ) );
|
||||||
aFootprint->SetPosition( padpos );
|
aFootprint->SetPosition( padpos );
|
||||||
pad->SetPosition( padpos );
|
pad->SetPosition( padpos );
|
||||||
}
|
}
|
||||||
|
@ -2573,8 +2573,8 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
|
||||||
|
|
||||||
if( w.curve )
|
if( w.curve )
|
||||||
{
|
{
|
||||||
center = ConvertArcCenter( wxPoint( kicad_x( w.x1 ), kicad_y( w.y1 ) ),
|
center = ConvertArcCenter( VECTOR2I( kicad_x( w.x1 ), kicad_y( w.y1 ) ),
|
||||||
wxPoint( kicad_x( w.x2 ), kicad_y( w.y2 ) ),
|
VECTOR2I( kicad_x( w.x2 ), kicad_y( w.y2 ) ),
|
||||||
*w.curve );
|
*w.curve );
|
||||||
|
|
||||||
angle = DEG2RAD( *w.curve );
|
angle = DEG2RAD( *w.curve );
|
||||||
|
@ -2593,7 +2593,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
|
||||||
while( fabs( angle ) > fabs( delta_angle ) )
|
while( fabs( angle ) > fabs( delta_angle ) )
|
||||||
{
|
{
|
||||||
wxASSERT( radius > 0.0 );
|
wxASSERT( radius > 0.0 );
|
||||||
wxPoint end( KiROUND( radius * cos( end_angle + angle ) + center.x ),
|
VECTOR2I end( KiROUND( radius * cos( end_angle + angle ) + center.x ),
|
||||||
KiROUND( radius * sin( end_angle + angle ) + center.y ) );
|
KiROUND( radius * sin( end_angle + angle ) + center.y ) );
|
||||||
|
|
||||||
PCB_TRACK* t = new PCB_TRACK( m_board );
|
PCB_TRACK* t = new PCB_TRACK( m_board );
|
||||||
|
@ -2613,7 +2613,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
|
||||||
PCB_TRACK* t = new PCB_TRACK( m_board );
|
PCB_TRACK* t = new PCB_TRACK( m_board );
|
||||||
|
|
||||||
t->SetPosition( start );
|
t->SetPosition( start );
|
||||||
t->SetEnd( wxPoint( kicad_x( w.x2 ), kicad_y( w.y2 ) ) );
|
t->SetEnd( VECTOR2I( kicad_x( w.x2 ), kicad_y( w.y2 ) ) );
|
||||||
t->SetWidth( width );
|
t->SetWidth( width );
|
||||||
t->SetLayer( layer );
|
t->SetLayer( layer );
|
||||||
t->SetNetCode( netCode );
|
t->SetNetCode( netCode );
|
||||||
|
@ -2704,7 +2704,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
|
||||||
via->SetViaType( VIATYPE::BLIND_BURIED );
|
via->SetViaType( VIATYPE::BLIND_BURIED );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint pos( kicad_x( v.x ), kicad_y( v.y ) );
|
VECTOR2I pos( kicad_x( v.x ), kicad_y( v.y ) );
|
||||||
|
|
||||||
via->SetLayerPair( layer_front_most, layer_back_most );
|
via->SetLayerPair( layer_front_most, layer_back_most );
|
||||||
via->SetPosition( pos );
|
via->SetPosition( pos );
|
||||||
|
@ -2988,7 +2988,7 @@ void EAGLE_PLUGIN::centerBoard()
|
||||||
int desired_x = ( w - bbbox.GetWidth() ) / 2;
|
int desired_x = ( w - bbbox.GetWidth() ) / 2;
|
||||||
int desired_y = ( h - bbbox.GetHeight() ) / 2;
|
int desired_y = ( h - bbbox.GetHeight() ) / 2;
|
||||||
|
|
||||||
m_board->Move( wxPoint( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
|
m_board->Move( VECTOR2I( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,12 +267,12 @@ wxString PCB_PARSER::GetRequiredVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint PCB_PARSER::parseXY()
|
VECTOR2I PCB_PARSER::parseXY()
|
||||||
{
|
{
|
||||||
if( CurTok() != T_LEFT )
|
if( CurTok() != T_LEFT )
|
||||||
NeedLEFT();
|
NeedLEFT();
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
T token = NextTok();
|
T token = NextTok();
|
||||||
|
|
||||||
if( token != T_xy )
|
if( token != T_xy )
|
||||||
|
@ -374,7 +374,7 @@ void PCB_PARSER::parseOutlinePoints( SHAPE_LINE_CHAIN& aPoly )
|
||||||
|
|
||||||
void PCB_PARSER::parseXY( int* aX, int* aY )
|
void PCB_PARSER::parseXY( int* aX, int* aY )
|
||||||
{
|
{
|
||||||
wxPoint pt = parseXY();
|
VECTOR2I pt = parseXY();
|
||||||
|
|
||||||
if( aX )
|
if( aX )
|
||||||
*aX = pt.x;
|
*aX = pt.x;
|
||||||
|
@ -2117,7 +2117,7 @@ void PCB_PARSER::parseSetup()
|
||||||
{
|
{
|
||||||
int x = parseBoardUnits( "auxiliary origin X" );
|
int x = parseBoardUnits( "auxiliary origin X" );
|
||||||
int y = parseBoardUnits( "auxiliary origin Y" );
|
int y = parseBoardUnits( "auxiliary origin Y" );
|
||||||
designSettings.SetAuxOrigin( wxPoint( x, y ) );
|
designSettings.SetAuxOrigin( VECTOR2I( x, y ) );
|
||||||
|
|
||||||
// Aux origin still stored in board for the moment
|
// Aux origin still stored in board for the moment
|
||||||
//m_board->m_LegacyDesignSettingsLoaded = true;
|
//m_board->m_LegacyDesignSettingsLoaded = true;
|
||||||
|
@ -2129,7 +2129,7 @@ void PCB_PARSER::parseSetup()
|
||||||
{
|
{
|
||||||
int x = parseBoardUnits( "grid origin X" );
|
int x = parseBoardUnits( "grid origin X" );
|
||||||
int y = parseBoardUnits( "grid origin Y" );
|
int y = parseBoardUnits( "grid origin Y" );
|
||||||
designSettings.SetGridOrigin( wxPoint( x, y ) );
|
designSettings.SetGridOrigin( VECTOR2I( x, y ) );
|
||||||
// Grid origin still stored in board for the moment
|
// Grid origin still stored in board for the moment
|
||||||
//m_board->m_LegacyDesignSettingsLoaded = true;
|
//m_board->m_LegacyDesignSettingsLoaded = true;
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
|
@ -2435,7 +2435,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_SHAPE." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_SHAPE." ) );
|
||||||
|
|
||||||
T token;
|
T token;
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
STROKE_PARAMS stroke( 0, PLOT_DASH_TYPE::SOLID );
|
STROKE_PARAMS stroke( 0, PLOT_DASH_TYPE::SOLID );
|
||||||
std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( nullptr );
|
std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( nullptr );
|
||||||
|
|
||||||
|
@ -2480,7 +2480,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxPoint arc_start, arc_mid, arc_end;
|
VECTOR2I arc_start, arc_mid, arc_end;
|
||||||
|
|
||||||
if( token != T_start )
|
if( token != T_start )
|
||||||
Expecting( T_start );
|
Expecting( T_start );
|
||||||
|
@ -2821,7 +2821,7 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT()
|
||||||
if( token != T_at )
|
if( token != T_at )
|
||||||
Expecting( T_at );
|
Expecting( T_at );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
|
|
||||||
pt.x = parseBoardUnits( "X coordinate" );
|
pt.x = parseBoardUnits( "X coordinate" );
|
||||||
pt.y = parseBoardUnits( "Y coordinate" );
|
pt.y = parseBoardUnits( "Y coordinate" );
|
||||||
|
@ -2991,7 +2991,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
|
||||||
// New format: feature points
|
// New format: feature points
|
||||||
case T_pts:
|
case T_pts:
|
||||||
{
|
{
|
||||||
wxPoint point;
|
VECTOR2I point;
|
||||||
|
|
||||||
parseXY( &point.x, &point.y );
|
parseXY( &point.x, &point.y );
|
||||||
dim->SetStart( point );
|
dim->SetStart( point );
|
||||||
|
@ -3189,7 +3189,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
|
||||||
if( token != T_pts )
|
if( token != T_pts )
|
||||||
Expecting( T_pts );
|
Expecting( T_pts );
|
||||||
|
|
||||||
wxPoint point;
|
VECTOR2I point;
|
||||||
|
|
||||||
parseXY( &point.x, &point.y );
|
parseXY( &point.x, &point.y );
|
||||||
dim->SetStart( point );
|
dim->SetStart( point );
|
||||||
|
@ -3209,7 +3209,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
|
||||||
if( token != T_pts )
|
if( token != T_pts )
|
||||||
Expecting( T_pts );
|
Expecting( T_pts );
|
||||||
|
|
||||||
wxPoint point;
|
VECTOR2I point;
|
||||||
|
|
||||||
parseXY( &point.x, &point.y );
|
parseXY( &point.x, &point.y );
|
||||||
dim->SetEnd( point );
|
dim->SetEnd( point );
|
||||||
|
@ -3232,7 +3232,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
|
||||||
PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dim.get() );
|
PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dim.get() );
|
||||||
|
|
||||||
// Old style: calculate height from crossbar
|
// Old style: calculate height from crossbar
|
||||||
wxPoint point1, point2;
|
VECTOR2I point1, point2;
|
||||||
parseXY( &point1.x, &point1.y );
|
parseXY( &point1.x, &point1.y );
|
||||||
parseXY( &point2.x, &point2.y );
|
parseXY( &point2.x, &point2.y );
|
||||||
aligned->UpdateHeight( point2, point1 ); // Yes, backwards intentionally
|
aligned->UpdateHeight( point2, point1 ); // Yes, backwards intentionally
|
||||||
|
@ -3726,7 +3726,7 @@ FP_TEXT* PCB_PARSER::parseFP_TEXT()
|
||||||
if( token != T_at )
|
if( token != T_at )
|
||||||
Expecting( T_at );
|
Expecting( T_at );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
|
|
||||||
pt.x = parseBoardUnits( "X coordinate" );
|
pt.x = parseBoardUnits( "X coordinate" );
|
||||||
pt.y = parseBoardUnits( "Y coordinate" );
|
pt.y = parseBoardUnits( "Y coordinate" );
|
||||||
|
@ -3796,7 +3796,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
||||||
CurTok() == T_fp_rect || CurTok() == T_fp_line || CurTok() == T_fp_poly, nullptr,
|
CurTok() == T_fp_rect || CurTok() == T_fp_line || CurTok() == T_fp_poly, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FP_SHAPE." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FP_SHAPE." ) );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
STROKE_PARAMS stroke( 0, PLOT_DASH_TYPE::SOLID );
|
STROKE_PARAMS stroke( 0, PLOT_DASH_TYPE::SOLID );
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
|
@ -3851,7 +3851,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxPoint arc_start, arc_mid, arc_end;
|
VECTOR2I arc_start, arc_mid, arc_end;
|
||||||
|
|
||||||
if( token != T_start )
|
if( token != T_start )
|
||||||
Expecting( T_start );
|
Expecting( T_start );
|
||||||
|
@ -4160,8 +4160,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
||||||
wxCHECK_MSG( CurTok() == T_pad, nullptr,
|
wxCHECK_MSG( CurTok() == T_pad, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PAD." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PAD." ) );
|
||||||
|
|
||||||
wxSize sz;
|
VECTOR2I sz;
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
|
|
||||||
std::unique_ptr<PAD> pad = std::make_unique<PAD>( aParent );
|
std::unique_ptr<PAD> pad = std::make_unique<PAD>( aParent );
|
||||||
|
|
||||||
|
@ -4184,7 +4184,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
||||||
|
|
||||||
// Default PAD object is thru hole with drill.
|
// Default PAD object is thru hole with drill.
|
||||||
// SMD pads have no hole
|
// SMD pads have no hole
|
||||||
pad->SetDrillSize( wxSize( 0, 0 ) );
|
pad->SetDrillSize( VECTOR2I( 0, 0 ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_connect:
|
case T_connect:
|
||||||
|
@ -4192,7 +4192,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
||||||
|
|
||||||
// Default PAD object is thru hole with drill.
|
// Default PAD object is thru hole with drill.
|
||||||
// CONN pads have no hole
|
// CONN pads have no hole
|
||||||
pad->SetDrillSize( wxSize( 0, 0 ) );
|
pad->SetDrillSize( VECTOR2I( 0, 0 ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_np_thru_hole:
|
case T_np_thru_hole:
|
||||||
|
@ -4260,8 +4260,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
||||||
switch( token )
|
switch( token )
|
||||||
{
|
{
|
||||||
case T_size:
|
case T_size:
|
||||||
sz.SetWidth( parseBoardUnits( "width value" ) );
|
sz.x = parseBoardUnits( "width value" );
|
||||||
sz.SetHeight( parseBoardUnits( "height value" ) );
|
sz.y = parseBoardUnits( "height value" );
|
||||||
pad->SetSize( sz );
|
pad->SetSize( sz );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
@ -4741,7 +4741,7 @@ void PCB_PARSER::parseGROUP( BOARD_ITEM* aParent )
|
||||||
wxCHECK_RET( CurTok() == T_group,
|
wxCHECK_RET( CurTok() == T_group,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_GROUP." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_GROUP." ) );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
m_groupInfos.push_back( GROUP_INFO() );
|
m_groupInfos.push_back( GROUP_INFO() );
|
||||||
|
@ -4791,7 +4791,7 @@ PCB_ARC* PCB_PARSER::parseARC()
|
||||||
wxCHECK_MSG( CurTok() == T_arc, nullptr,
|
wxCHECK_MSG( CurTok() == T_arc, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ARC." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ARC." ) );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
std::unique_ptr<PCB_ARC> arc = std::make_unique<PCB_ARC>( m_board );
|
std::unique_ptr<PCB_ARC> arc = std::make_unique<PCB_ARC>( m_board );
|
||||||
|
@ -4875,7 +4875,7 @@ PCB_TRACK* PCB_PARSER::parsePCB_TRACK()
|
||||||
wxCHECK_MSG( CurTok() == T_segment, nullptr,
|
wxCHECK_MSG( CurTok() == T_segment, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TRACK." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TRACK." ) );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
std::unique_ptr<PCB_TRACK> track = std::make_unique<PCB_TRACK>( m_board );
|
std::unique_ptr<PCB_TRACK> track = std::make_unique<PCB_TRACK>( m_board );
|
||||||
|
@ -4953,7 +4953,7 @@ PCB_VIA* PCB_PARSER::parsePCB_VIA()
|
||||||
wxCHECK_MSG( CurTok() == T_via, nullptr,
|
wxCHECK_MSG( CurTok() == T_via, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_VIA." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_VIA." ) );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
std::unique_ptr<PCB_VIA> via = std::make_unique<PCB_VIA>( m_board );
|
std::unique_ptr<PCB_VIA> via = std::make_unique<PCB_VIA>( m_board );
|
||||||
|
@ -5075,7 +5075,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
|
||||||
ZONE_BORDER_DISPLAY_STYLE hatchStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
|
ZONE_BORDER_DISPLAY_STYLE hatchStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
|
||||||
|
|
||||||
int hatchPitch = ZONE::GetDefaultHatchPitch();
|
int hatchPitch = ZONE::GetDefaultHatchPitch();
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
T token;
|
T token;
|
||||||
int tmp;
|
int tmp;
|
||||||
wxString netnameFromfile; // the zone net name find in file
|
wxString netnameFromfile; // the zone net name find in file
|
||||||
|
@ -5653,7 +5653,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET()
|
||||||
wxCHECK_MSG( CurTok() == T_target, nullptr,
|
wxCHECK_MSG( CurTok() == T_target, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TARGET." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TARGET." ) );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
std::unique_ptr<PCB_TARGET> target = std::make_unique<PCB_TARGET>( nullptr );
|
std::unique_ptr<PCB_TARGET> target = std::make_unique<PCB_TARGET>( nullptr );
|
||||||
|
|
|
@ -236,7 +236,7 @@ private:
|
||||||
* @return A wxPoint object containing the coordinate pair.
|
* @return A wxPoint object containing the coordinate pair.
|
||||||
* @throw PARSE_ERROR if the coordinate pair syntax is incorrect.
|
* @throw PARSE_ERROR if the coordinate pair syntax is incorrect.
|
||||||
*/
|
*/
|
||||||
wxPoint parseXY();
|
VECTOR2I parseXY();
|
||||||
|
|
||||||
void parseXY( int* aX, int* aY );
|
void parseXY( int* aX, int* aY );
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const
|
||||||
|
|
||||||
origin = dsnSettings.GetGridOrigin();
|
origin = dsnSettings.GetGridOrigin();
|
||||||
|
|
||||||
if( origin != wxPoint( 0, 0 ) )
|
if( origin != VECTOR2I( 0, 0 ) )
|
||||||
{
|
{
|
||||||
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
|
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
|
||||||
FormatInternalUnits( origin.x ).c_str(),
|
FormatInternalUnits( origin.x ).c_str(),
|
||||||
|
@ -2139,8 +2139,8 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const
|
||||||
for( const SEG& seg : segs )
|
for( const SEG& seg : segs )
|
||||||
{
|
{
|
||||||
m_out->Print( aNestLevel + 2, "(pts (xy %s) (xy %s))\n",
|
m_out->Print( aNestLevel + 2, "(pts (xy %s) (xy %s))\n",
|
||||||
FormatInternalUnits( wxPoint( seg.A ) ).c_str(),
|
FormatInternalUnits( seg.A ).c_str(),
|
||||||
FormatInternalUnits( wxPoint( seg.B ) ).c_str() );
|
FormatInternalUnits( seg.B ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_out->Print( aNestLevel + 1, ")\n" );
|
m_out->Print( aNestLevel + 1, ")\n" );
|
||||||
|
|
|
@ -122,8 +122,8 @@ void PCB_LINE::AddToFootprint( FOOTPRINT* aFootprint )
|
||||||
FP_SHAPE* segment = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
FP_SHAPE* segment = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||||
aFootprint->Add( segment );
|
aFootprint->Add( segment );
|
||||||
|
|
||||||
segment->SetStart0( wxPoint( m_positionX, m_positionY ) );
|
segment->SetStart0( VECTOR2I( m_positionX, m_positionY ) );
|
||||||
segment->SetEnd0( wxPoint( m_ToX, m_ToY ) );
|
segment->SetEnd0( VECTOR2I( m_ToX, m_ToY ) );
|
||||||
|
|
||||||
segment->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
|
segment->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
|
||||||
segment->SetLayer( m_KiCadLayer );
|
segment->SetLayer( m_KiCadLayer );
|
||||||
|
@ -140,8 +140,8 @@ void PCB_LINE::AddToBoard()
|
||||||
PCB_TRACK* track = new PCB_TRACK( m_board );
|
PCB_TRACK* track = new PCB_TRACK( m_board );
|
||||||
m_board->Add( track );
|
m_board->Add( track );
|
||||||
|
|
||||||
track->SetPosition( wxPoint( m_positionX, m_positionY ) );
|
track->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
|
||||||
track->SetEnd( wxPoint( m_ToX, m_ToY ) );
|
track->SetEnd( VECTOR2I( m_ToX, m_ToY ) );
|
||||||
|
|
||||||
track->SetWidth( m_Width );
|
track->SetWidth( m_Width );
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ void PCB_LINE::AddToBoard()
|
||||||
m_board->Add( segment, ADD_MODE::APPEND );
|
m_board->Add( segment, ADD_MODE::APPEND );
|
||||||
|
|
||||||
segment->SetLayer( m_KiCadLayer );
|
segment->SetLayer( m_KiCadLayer );
|
||||||
segment->SetStart( wxPoint( m_positionX, m_positionY ) );
|
segment->SetStart( VECTOR2I( m_positionX, m_positionY ) );
|
||||||
segment->SetEnd( wxPoint( m_ToX, m_ToY ) );
|
segment->SetEnd( VECTOR2I( m_ToX, m_ToY ) );
|
||||||
segment->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
|
segment->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,8 +358,8 @@ void PCB_PAD::AddToBoard()
|
||||||
PCB_VIA* via = new PCB_VIA( m_board );
|
PCB_VIA* via = new PCB_VIA( m_board );
|
||||||
m_board->Add( via );
|
m_board->Add( via );
|
||||||
|
|
||||||
via->SetPosition( wxPoint( m_positionX, m_positionY ) );
|
via->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
|
||||||
via->SetEnd( wxPoint( m_positionX, m_positionY ) );
|
via->SetEnd( VECTOR2I( m_positionX, m_positionY ) );
|
||||||
|
|
||||||
via->SetWidth( height );
|
via->SetWidth( height );
|
||||||
via->SetViaType( VIATYPE::THROUGH );
|
via->SetViaType( VIATYPE::THROUGH );
|
||||||
|
@ -377,7 +377,7 @@ void PCB_PAD::AddToBoard()
|
||||||
|
|
||||||
m_name.text = m_defaultPinDes;
|
m_name.text = m_defaultPinDes;
|
||||||
|
|
||||||
footprint->SetPosition( wxPoint( m_positionX, m_positionY ) );
|
footprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
|
||||||
AddToFootprint( footprint, 0, true );
|
AddToFootprint( footprint, 0, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,11 +454,11 @@ bool ZONE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) cons
|
||||||
auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
|
auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
|
||||||
|
|
||||||
// Test if the point is within the rect
|
// Test if the point is within the rect
|
||||||
if( arect.Contains( ( wxPoint ) vertex ) )
|
if( arect.Contains( vertex ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Test if this edge intersects the rect
|
// Test if this edge intersects the rect
|
||||||
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
|
if( arect.Intersects( vertex, vertexNext ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,7 +881,7 @@ void ZONE::UnHatchBorder()
|
||||||
|
|
||||||
|
|
||||||
// Creates hatch lines inside the outline of the complex polygon
|
// Creates hatch lines inside the outline of the complex polygon
|
||||||
// sort function used in ::HatchBorder to sort points by descending wxPoint.x values
|
// sort function used in ::HatchBorder to sort points by descending VECTOR2I.x values
|
||||||
bool sortEndsByDescendingX( const VECTOR2I& ref, const VECTOR2I& tst )
|
bool sortEndsByDescendingX( const VECTOR2I& ref, const VECTOR2I& tst )
|
||||||
{
|
{
|
||||||
return tst.x < ref.x;
|
return tst.x < ref.x;
|
||||||
|
|
Loading…
Reference in New Issue