Remove some more wxPoint

This commit is contained in:
Marek Roszko 2022-01-01 13:57:44 -05:00
parent a0d708e04d
commit c91d3e3cf9
22 changed files with 90 additions and 113 deletions

View File

@ -150,8 +150,8 @@ public:
void SetFileExists( bool aFileExists ) { m_fileExists = aFileExists; } void SetFileExists( bool aFileExists ) { m_fileExists = aFileExists; }
bool FileExists() const { return m_fileExists; } bool FileExists() const { return m_fileExists; }
const wxPoint& GetAuxOrigin() const { return m_aux_origin; } const VECTOR2I& GetAuxOrigin() const { return m_aux_origin; }
void SetAuxOrigin( const wxPoint& aPosition ) { m_aux_origin = aPosition; } void SetAuxOrigin( const VECTOR2I& aPosition ) { m_aux_origin = aPosition; }
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; } const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
@ -410,7 +410,7 @@ public:
/** /**
* Return a line item located at \a aPosition. * Return a line item located at \a aPosition.
* *
* @param[in] aPosition The wxPoint to test for a line item. * @param[in] aPosition The VECTOR2I to test for a line item.
* @param aAccuracy Amount to inflate the item hit test bounding box. * @param aAccuracy Amount to inflate the item hit test bounding box.
* @param aLayer The layer the line is drawn upon. * @param aLayer The layer the line is drawn upon.
* @param aSearchType Additional line test criteria. * @param aSearchType Additional line test criteria.
@ -435,7 +435,7 @@ public:
/** /**
* Return a label item located at \a aPosition. * Return a label item located at \a aPosition.
* *
* @param[in] aPosition The wxPoint to test for label items. * @param[in] aPosition The VECTOR2I to test for label items.
* @param aAccuracy Amount to inflate the item hit test bounding box. * @param aAccuracy Amount to inflate the item hit test bounding box.
* @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not * @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not
* found. * found.
@ -534,7 +534,7 @@ private:
PAGE_INFO m_paper; // The size of the paper to print or plot on. PAGE_INFO m_paper; // The size of the paper to print or plot on.
TITLE_BLOCK m_titles; TITLE_BLOCK m_titles;
wxPoint m_aux_origin; // Origin used for drill & place files by Pcbnew. VECTOR2I m_aux_origin; // Origin used for drill & place files by Pcbnew.
EE_RTREE m_rtree; EE_RTREE m_rtree;
int m_modification_sync; // Inequality with SYMBOL_LIBS::GetModificationHash() int m_modification_sync; // Inequality with SYMBOL_LIBS::GetModificationHash()

View File

@ -473,7 +473,7 @@ public:
* Print a symbol. * Print a symbol.
* *
* @param aDC is the device context (can be null). * @param aDC is the device context (can be null).
* @param aOffset is the drawing offset (usually wxPoint(0,0), but can be different when * @param aOffset is the drawing offset (usually VECTOR2I(0,0), but can be different when
* moving an object) * moving an object)
*/ */
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
@ -563,7 +563,7 @@ public:
void Move( const VECTOR2I& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
if( aMoveVector == wxPoint( 0, 0 ) ) if( aMoveVector == VECTOR2I( 0, 0 ) )
return; return;
m_pos += aMoveVector; m_pos += aMoveVector;

View File

@ -214,8 +214,8 @@ VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, int aLayer,
else if( snapPoint ) else if( snapPoint )
{ {
m_snapItem = nearest; m_snapItem = nearest;
m_viewSnapPoint.SetPosition( (wxPoint) pt ); m_viewSnapPoint.SetPosition( pt );
m_viewSnapLine.SetPosition( (wxPoint) pt ); m_viewSnapLine.SetPosition( pt );
m_toolMgr->GetView()->SetVisible( &m_viewSnapLine, false ); m_toolMgr->GetView()->SetVisible( &m_viewSnapLine, false );
@ -316,16 +316,14 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b
{ {
VECTOR2I possible( line->GetStartPoint().x, pt.y ); VECTOR2I possible( line->GetStartPoint().x, pt.y );
if( TestSegmentHit( wxPoint( possible ), line->GetStartPoint(), line->GetEndPoint(), if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
0 ) )
addAnchor( possible, SNAPPABLE | VERTICAL, aItem ); addAnchor( possible, SNAPPABLE | VERTICAL, aItem );
} }
else if( line->GetStartPoint().y == line->GetEndPoint().y ) else if( line->GetStartPoint().y == line->GetEndPoint().y )
{ {
VECTOR2I possible( pt.x, line->GetStartPoint().y ); VECTOR2I possible( pt.x, line->GetStartPoint().y );
if( TestSegmentHit( wxPoint( possible ), line->GetStartPoint(), line->GetEndPoint(), if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
0 ) )
addAnchor( possible, SNAPPABLE | HORIZONTAL, aItem ); addAnchor( possible, SNAPPABLE | HORIZONTAL, aItem );
} }

View File

@ -48,9 +48,9 @@ extern int scaletoIU( double aCoord, bool isMetric );
* *
* @return The GerbView coordinate system vector. * @return The GerbView coordinate system vector.
*/ */
static wxPoint mapPt( double x, double y, bool isMetric ) static VECTOR2I mapPt( double x, double y, bool isMetric )
{ {
wxPoint ret( scaletoIU( x, isMetric ), scaletoIU( y, isMetric ) ); VECTOR2I ret( scaletoIU( x, isMetric ), scaletoIU( y, isMetric ) );
return ret; return ret;
} }
@ -377,7 +377,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S
// the shape rotation is the last param of list, after corners // the shape rotation is the last param of list, after corners
int last_prm = params.size() - 1; int last_prm = params.size() - 1;
rotation = params[last_prm].GetValue( tool ) * 10.0; rotation = params[last_prm].GetValue( tool ) * 10.0;
wxPoint pos; VECTOR2I pos;
// Read points. // Read points.
// Note: numCorners is the polygon corner count, following the first corner // Note: numCorners is the polygon corner count, following the first corner
@ -498,17 +498,17 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
case AMP_LINE2: case AMP_LINE2:
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation) case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
{ {
int width = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ); int width = scaletoIU( params[1].GetValue( tool ), m_GerbMetric );
wxPoint start = mapPt( params[2].GetValue( tool ), VECTOR2I start =
params[3].GetValue( tool ), m_GerbMetric ); mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), m_GerbMetric );
wxPoint end = mapPt( params[4].GetValue( tool ), VECTOR2I end =
params[5].GetValue( tool ), m_GerbMetric ); mapPt( params[4].GetValue( tool ), params[5].GetValue( tool ), m_GerbMetric );
wxPoint delta = end - start; VECTOR2I delta = end - start;
int len = KiROUND( EuclideanNorm( delta ) ); int len = KiROUND( EuclideanNorm( delta ) );
// To build the polygon, we must create a horizontal polygon starting to "start" // To build the polygon, we must create a horizontal polygon starting to "start"
// and rotate it to have the end point to "end" // and rotate it to have the end point to "end"
wxPoint currpt; VECTOR2I currpt;
currpt.y += width / 2; // Upper left currpt.y += width / 2; // Upper left
aBuffer.push_back( currpt ); aBuffer.push_back( currpt );
currpt.x = len; // Upper right currpt.x = len; // Upper right
@ -676,8 +676,8 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
for( int ii = 0; ii <= vertexcount; ii++ ) for( int ii = 0; ii <= vertexcount; ii++ )
{ {
wxPoint pos( radius, 0); VECTOR2I pos( radius, 0 );
RotatePoint( &pos, ii * 3600 / vertexcount ); RotatePoint( pos, ii * 3600 / vertexcount );
aBuffer.push_back( pos ); aBuffer.push_back( pos );
} }

View File

@ -106,25 +106,25 @@ struct EXCELLON_ROUTE_COORD
m_rmode( 0 ), m_arc_type_info( 0 ) m_rmode( 0 ), m_arc_type_info( 0 )
{} {}
EXCELLON_ROUTE_COORD( const wxPoint& aPos ): EXCELLON_ROUTE_COORD( const VECTOR2I& aPos ) :
m_x( aPos.x ), m_y( aPos.y ), m_x( aPos.x ), m_y( aPos.y ),
m_cx( 0 ), m_cy( 0 ), m_radius( 0 ), m_rmode( 0 ), m_cx( 0 ), m_cy( 0 ), m_radius( 0 ), m_rmode( 0 ),
m_arc_type_info( ARC_INFO_TYPE_NONE ) m_arc_type_info( ARC_INFO_TYPE_NONE )
{} {}
EXCELLON_ROUTE_COORD( const wxPoint& aPos, const wxPoint& aCenter, int aMode ): EXCELLON_ROUTE_COORD( const VECTOR2I& aPos, const VECTOR2I& aCenter, int aMode ) :
m_x( aPos.x ), m_y( aPos.y ), m_x( aPos.x ), m_y( aPos.y ),
m_cx( aCenter.x ), m_cy( aCenter.y ), m_radius( 0 ), m_rmode( aMode ), m_cx( aCenter.x ), m_cy( aCenter.y ), m_radius( 0 ), m_rmode( aMode ),
m_arc_type_info( ARC_INFO_TYPE_CENTER ) m_arc_type_info( ARC_INFO_TYPE_CENTER )
{} {}
EXCELLON_ROUTE_COORD( const wxPoint& aPos, int aRadius, int aMode ): EXCELLON_ROUTE_COORD( const VECTOR2I& aPos, int aRadius, int aMode ) :
m_x( aPos.x ), m_y( aPos.y ), m_x( aPos.x ), m_y( aPos.y ),
m_cx( 0 ), m_cy( 0 ), m_radius( aRadius ), m_rmode( aMode ), m_cx( 0 ), m_cy( 0 ), m_radius( aRadius ), m_rmode( aMode ),
m_arc_type_info( ARC_INFO_TYPE_RADIUS ) m_arc_type_info( ARC_INFO_TYPE_RADIUS )
{} {}
wxPoint GetPos() { return wxPoint( m_x, m_y ); } VECTOR2I GetPos() { return VECTOR2I( m_x, m_y ); }
}; };
/** /**

View File

@ -57,8 +57,8 @@ public:
// which handles the list of gerber files (and drill files) images loaded // which handles the list of gerber files (and drill files) images loaded
GERBER_FILE_IMAGE_LIST* GetImagesList() const; GERBER_FILE_IMAGE_LIST* GetImagesList() const;
const wxPoint& GetAuxOrigin() const { return m_originAxisPosition; } const VECTOR2I& GetAuxOrigin() const { return m_originAxisPosition; }
void SetAuxOrigin( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; } void SetAuxOrigin( const VECTOR2I& aPosition ) { m_originAxisPosition = aPosition; }
TITLE_BLOCK& GetTitleBlock() { return m_titles; } TITLE_BLOCK& GetTitleBlock() { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; } void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
@ -87,7 +87,7 @@ public:
private: private:
mutable EDA_RECT m_BoundingBox; mutable EDA_RECT m_BoundingBox;
TITLE_BLOCK m_titles; TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition; VECTOR2I m_originAxisPosition;
}; };
#endif // #ifndef GBR_LAYOUT_H #endif // #ifndef GBR_LAYOUT_H

View File

@ -285,8 +285,8 @@ private:
bool m_swapAxis; // false if A = X, B = Y; true if A =Y, B = Y bool m_swapAxis; // false if A = X, B = Y; true if A =Y, B = Y
bool m_mirrorA; // true: mirror / axis A bool m_mirrorA; // true: mirror / axis A
bool m_mirrorB; // true: mirror / ax's B bool m_mirrorB; // true: mirror / ax's B
wxRealPoint m_drawScale; // A and B scaling factor VECTOR2I m_drawScale; // A and B scaling factor
wxPoint m_layerOffset; // Offset for A and B axis, from OF parameter VECTOR2I m_layerOffset; // Offset for A and B axis, from OF parameter
double m_lyrRotation; // Fine rotation, from OR parameter, in degrees double m_lyrRotation; // Fine rotation, from OR parameter, in degrees
GBR_NETLIST_METADATA m_netAttributes; ///< the string given by a %TO attribute set in aperture GBR_NETLIST_METADATA m_netAttributes; ///< the string given by a %TO attribute set in aperture
///< (dcode). Stored in each item, because %TO is ///< (dcode). Stored in each item, because %TO is

View File

@ -212,7 +212,7 @@ public:
* it forces truncation of a digit string to a maximum length because the exact coordinate * it forces truncation of a digit string to a maximum length because the exact coordinate
* format is not always known. * format is not always known.
*/ */
wxPoint ReadXYCoord( char*& aText, bool aExcellonMode = false ); VECTOR2I ReadXYCoord( char*& aText, bool aExcellonMode = false );
/** /**
* Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) * Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm)
@ -220,7 +220,7 @@ public:
* These coordinates are relative, so if coordinate is absent, its value * These coordinates are relative, so if coordinate is absent, its value
* defaults to 0 * defaults to 0
*/ */
wxPoint ReadIJCoord( char*& Text ); VECTOR2I ReadIJCoord( char*& Text );
// functions to read G commands or D commands: // functions to read G commands or D commands:
int GCodeNumber( char*& Text ); int GCodeNumber( char*& Text );
@ -377,13 +377,13 @@ public:
bool m_ImageJustifyYCenter; bool m_ImageJustifyYCenter;
///< Image Justify Offset on XY axis (default = 0,0). ///< Image Justify Offset on XY axis (default = 0,0).
wxPoint m_ImageJustifyOffset; VECTOR2I m_ImageJustifyOffset;
bool m_GerbMetric; // false = Inches, true = metric bool m_GerbMetric; // false = Inches, true = metric
///< false = absolute Coord, true = relative Coord. ///< false = absolute Coord, true = relative Coord.
bool m_Relative; bool m_Relative;
bool m_NoTrailingZeros; // true: remove tailing zeros. bool m_NoTrailingZeros; // true: remove tailing zeros.
wxPoint m_ImageOffset; // Coord Offset, from IO command VECTOR2I m_ImageOffset; // Coord Offset, from IO command
///< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4. ///< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4.
wxSize m_FmtScale; wxSize m_FmtScale;
@ -397,8 +397,8 @@ public:
///< Local rotation in degrees added to m_ImageRotation. ///< Local rotation in degrees added to m_ImageRotation.
///< @note This value is stored in 0.1 degrees. ///< @note This value is stored in 0.1 degrees.
double m_LocalRotation; double m_LocalRotation;
wxPoint m_Offset; // Coord Offset, from OF command VECTOR2I m_Offset; // Coord Offset, from OF command
wxRealPoint m_Scale; // scale (X and Y) of layer. VECTOR2I m_Scale; // scale (X and Y) of layer.
bool m_SwapAxis; // false (default) if A = X and B = Y bool m_SwapAxis; // false (default) if A = X and B = Y
// true if A = Y, B = X // true if A = Y, B = X
bool m_MirrorA; // true: mirror / axis A (X) bool m_MirrorA; // true: mirror / axis A (X)
@ -412,9 +412,9 @@ public:
///< Line number of the gerber file while reading. ///< Line number of the gerber file while reading.
int m_LineNum; int m_LineNum;
wxPoint m_CurrentPos; // current specified coord for plot VECTOR2I m_CurrentPos; // current specified coord for plot
wxPoint m_PreviousPos; // old current specified coord for plot VECTOR2I m_PreviousPos; // old current specified coord for plot
wxPoint m_IJPos; // IJ coord (for arcs & circles ) VECTOR2I m_IJPos; // IJ coord (for arcs & circles )
///< True if a IJ coord was read (for arcs & circles ). ///< True if a IJ coord was read (for arcs & circles ).
bool m_LastCoordIsIJPos; bool m_LastCoordIsIJPos;

View File

@ -68,13 +68,13 @@ int scaletoIU( double aCoord, bool isMetric )
} }
wxPoint GERBER_FILE_IMAGE::ReadXYCoord( char*& Text, bool aExcellonMode ) VECTOR2I GERBER_FILE_IMAGE::ReadXYCoord( char*& Text, bool aExcellonMode )
{ {
wxPoint pos; VECTOR2I pos;
int type_coord = 0, current_coord, nbdigits; int type_coord = 0, current_coord, nbdigits;
bool is_float = false; bool is_float = false;
char* text; char* text;
char line[256]; char line[256];
if( m_Relative ) if( m_Relative )
@ -190,9 +190,9 @@ wxPoint GERBER_FILE_IMAGE::ReadXYCoord( char*& Text, bool aExcellonMode )
} }
wxPoint GERBER_FILE_IMAGE::ReadIJCoord( char*& Text ) VECTOR2I GERBER_FILE_IMAGE::ReadIJCoord( char*& Text )
{ {
wxPoint pos( 0, 0 ); VECTOR2I pos( 0, 0 );
int type_coord = 0, current_coord, nbdigits; int type_coord = 0, current_coord, nbdigits;
bool is_float = false; bool is_float = false;

View File

@ -117,7 +117,7 @@ public:
/** /**
* A value of wxPoint(0,0) which can be passed to the Draw() functions. * A value of wxPoint(0,0) which can be passed to the Draw() functions.
*/ */
static wxPoint ZeroOffset; static VECTOR2I ZeroOffset;
/** /**
* Some pad shapes can be complex (rounded/chamfered rectangle), even without considering * Some pad shapes can be complex (rounded/chamfered rectangle), even without considering

View File

@ -130,8 +130,7 @@ void RotatePoint( double *pX, double *pY, double cx, double cy, double angle );
*/ */
const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ); const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, const VECTOR2D& aEnd ); const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, const VECTOR2D& aEnd );
const wxPoint CalcArcCenter( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd ); const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
const wxPoint CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
/** /**
* Return the subtended angle for a given arc. * Return the subtended angle for a given arc.

View File

@ -359,7 +359,7 @@ void RotatePoint( double* pX, double* pY, double angle )
} }
const wxPoint CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle ) const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle )
{ {
VECTOR2I start = aStart; VECTOR2I start = aStart;
VECTOR2I end = aEnd; VECTOR2I end = aEnd;
@ -472,27 +472,6 @@ const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, cons
} }
const wxPoint CalcArcCenter( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd )
{
VECTOR2D dStart( static_cast<double>( aStart.x ), static_cast<double>( aStart.y ) );
VECTOR2D dMid( static_cast<double>( aMid.x ), static_cast<double>( aMid.y ) );
VECTOR2D dEnd( static_cast<double>( aEnd.x ), static_cast<double>( aEnd.y ) );
VECTOR2D dCenter = CalcArcCenter( dStart, dMid, dEnd );
wxPoint iCenter;
iCenter.x = KiROUND( Clamp<double>( double( std::numeric_limits<int>::min() / 2.0 ),
dCenter.x,
double( std::numeric_limits<int>::max() / 2.0 ) ) );
iCenter.y = KiROUND( Clamp<double>( double( std::numeric_limits<int>::min() / 2.0 ),
dCenter.y,
double( std::numeric_limits<int>::max() / 2.0 ) ) );
return iCenter;
}
double CalcArcAngle( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ) double CalcArcAngle( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd )
{ {
VECTOR2I center = CalcArcCenter( aStart, aMid, aEnd ); VECTOR2I center = CalcArcCenter( aStart, aMid, aEnd );

View File

@ -57,7 +57,7 @@
// This is an odd place for this, but CvPcb won't link if it's in board_item.cpp like I first // This is an odd place for this, but CvPcb won't link if it's in board_item.cpp like I first
// tried it. // tried it.
wxPoint BOARD_ITEM::ZeroOffset( 0, 0 ); VECTOR2I BOARD_ITEM::ZeroOffset( 0, 0 );
BOARD::BOARD() : BOARD::BOARD() :
@ -1747,7 +1747,7 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const PCB_TRACK& aTrack )
} }
FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, FOOTPRINT* BOARD::GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked ) const bool aVisibleOnly, bool aIgnoreLocked ) const
{ {
FOOTPRINT* footprint = nullptr; FOOTPRINT* footprint = nullptr;
@ -1832,7 +1832,7 @@ std::list<ZONE*> BOARD::GetZoneList( bool aIncludeZonesInFootprints ) const
ZONE* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, ZONE* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch ) VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch )
{ {
ZONE* new_area = new ZONE( this ); ZONE* new_area = new ZONE( this );
@ -1882,7 +1882,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE* aCurr
// Create new copper area and copy poly into it // Create new copper area and copy poly into it
SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( ip ) ); SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( ip ) );
NewArea = AddArea( aNewZonesList, aCurrArea->GetNetCode(), aCurrArea->GetLayer(), NewArea = AddArea( aNewZonesList, aCurrArea->GetNetCode(), aCurrArea->GetLayer(),
wxPoint(0, 0), aCurrArea->GetHatchStyle() ); VECTOR2I( 0, 0 ), aCurrArea->GetHatchStyle() );
// remove the poly that was automatically created for the new area // remove the poly that was automatically created for the new area
// and replace it with a poly from NormalizeAreaOutlines // and replace it with a poly from NormalizeAreaOutlines

View File

@ -866,7 +866,7 @@ public:
* @return a reference to the new area. * @return a reference to the new area.
*/ */
ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch ); VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
/** /**
* Process an area that has been modified, by normalizing its polygon against itself. * Process an area that has been modified, by normalizing its polygon against itself.
@ -1002,7 +1002,7 @@ public:
* @param aVisibleOnly Search only the visible layers if true. * @param aVisibleOnly Search only the visible layers if true.
* @param aIgnoreLocked Ignore locked footprints when true. * @param aIgnoreLocked Ignore locked footprints when true.
*/ */
FOOTPRINT* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false ) const; bool aVisibleOnly, bool aIgnoreLocked = false ) const;
/** /**

View File

@ -195,7 +195,8 @@ void FP_SHAPE::SetArcAngleAndEnd0( double aAngle, bool aCheckNegativeAngle )
} }
void FP_SHAPE::SetArcGeometry0( const wxPoint& aStart0, const wxPoint& aMid0, const wxPoint& aEnd0 ) void FP_SHAPE::SetArcGeometry0( const VECTOR2I& aStart0, const VECTOR2I& aMid0,
const VECTOR2I& aEnd0 )
{ {
m_start0 = aStart0; m_start0 = aStart0;
m_end0 = aEnd0; m_end0 = aEnd0;

View File

@ -73,7 +73,7 @@ public:
*/ */
void SetArcAngleAndEnd0( double aAngle, bool aCheckNegativeAngle = false ); void SetArcAngleAndEnd0( double aAngle, bool aCheckNegativeAngle = false );
void SetArcGeometry0( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd ); void SetArcGeometry0( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
/** /**
* Move an edge of the footprint. * Move an edge of the footprint.

View File

@ -189,13 +189,13 @@ void GRAPHICS_CLEANER::mergeRects()
std::swap( start, end ); std::swap( start, end );
} }
wxPoint start; VECTOR2I start;
wxPoint end; VECTOR2I end;
PCB_SHAPE* shape; PCB_SHAPE* shape;
}; };
std::vector<SIDE_CANDIDATE*> sides; std::vector<SIDE_CANDIDATE*> sides;
std::map<wxPoint, std::vector<SIDE_CANDIDATE*>> ptMap; std::map<VECTOR2I, std::vector<SIDE_CANDIDATE*>> ptMap;
// First load all the candidates into the side vector and layer maps // First load all the candidates into the side vector and layer maps
for( BOARD_ITEM* item : m_drawings ) for( BOARD_ITEM* item : m_drawings )

View File

@ -61,7 +61,7 @@ const VECTOR2I PCB_SHAPE::GetFocusPosition() const
{ {
case SHAPE_T::CIRCLE: case SHAPE_T::CIRCLE:
if( !IsFilled() ) if( !IsFilled() )
return wxPoint( GetCenter().x + GetRadius(), GetCenter().y ); return VECTOR2I( GetCenter().x + GetRadius(), GetCenter().y );
else else
return GetCenter(); return GetCenter();
@ -75,7 +75,7 @@ const VECTOR2I PCB_SHAPE::GetFocusPosition() const
if( !IsFilled() ) if( !IsFilled() )
{ {
VECTOR2I pos = GetPolyShape().Outline(0).CPoint(0); VECTOR2I pos = GetPolyShape().Outline(0).CPoint(0);
return wxPoint( pos.x, pos.y ); return VECTOR2I( pos.x, pos.y );
} }
else else
{ {

View File

@ -64,9 +64,9 @@ EDA_ITEM* PCB_TRACK::Clone() const
PCB_ARC::PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc ) : PCB_ARC::PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc ) :
PCB_TRACK( aParent, PCB_ARC_T ) PCB_TRACK( aParent, PCB_ARC_T )
{ {
m_Start = wxPoint( aArc->GetP0() ); m_Start = aArc->GetP0();
m_End = wxPoint( aArc->GetP1() ); m_End = aArc->GetP1();
m_Mid = wxPoint( aArc->GetArcMid() ); m_Mid = aArc->GetArcMid();
} }
@ -250,7 +250,7 @@ const EDA_RECT PCB_TRACK::GetBoundingBox() const
xmin -= radius; xmin -= radius;
// return a rectangle which is [pos,dim) in nature. therefore the +1 // return a rectangle which is [pos,dim) in nature. therefore the +1
EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) ); EDA_RECT ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin + 1, ymax - ymin + 1 ) );
return ret; return ret;
} }

View File

@ -2331,10 +2331,10 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
shape->SetLayer( klayer ); shape->SetLayer( klayer );
shape->SetStroke( STROKE_PARAMS( 0 ) ); shape->SetStroke( STROKE_PARAMS( 0 ) );
shape->SetPolyPoints( { aElem.position + wxPoint( aElem.topsize.x / 2, aElem.topsize.y / 2 ), shape->SetPolyPoints( { aElem.position + VECTOR2I( aElem.topsize.x / 2, aElem.topsize.y / 2 ),
aElem.position + wxPoint( aElem.topsize.x / 2, -aElem.topsize.y / 2 ), aElem.position + VECTOR2I( aElem.topsize.x / 2, -aElem.topsize.y / 2 ),
aElem.position + wxPoint( -aElem.topsize.x / 2, -aElem.topsize.y / 2 ), aElem.position + VECTOR2I( -aElem.topsize.x / 2, -aElem.topsize.y / 2 ),
aElem.position + wxPoint( -aElem.topsize.x / 2, aElem.topsize.y / 2 ) } ); aElem.position + VECTOR2I( -aElem.topsize.x / 2, aElem.topsize.y / 2 ) } );
if( aElem.direction != 0 ) if( aElem.direction != 0 )
shape->Rotate( aElem.position, aElem.direction * 10 ); shape->Rotate( aElem.position, aElem.direction * 10 );
@ -2382,7 +2382,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
{ {
// short vertical line // short vertical line
shape->SetShape( SHAPE_T::SEGMENT ); shape->SetShape( SHAPE_T::SEGMENT );
wxPoint pointOffset( 0, ( aElem.topsize.y - aElem.topsize.x ) / 2 ); VECTOR2I pointOffset( 0, ( aElem.topsize.y - aElem.topsize.x ) / 2 );
shape->SetStart( aElem.position + pointOffset ); shape->SetStart( aElem.position + pointOffset );
shape->SetEnd( aElem.position - pointOffset ); shape->SetEnd( aElem.position - pointOffset );
} }
@ -2390,7 +2390,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
{ {
// short horizontal line // short horizontal line
shape->SetShape( SHAPE_T::SEGMENT ); shape->SetShape( SHAPE_T::SEGMENT );
wxPoint pointOffset( ( aElem.topsize.x - aElem.topsize.y ) / 2, 0 ); VECTOR2I pointOffset( ( aElem.topsize.x - aElem.topsize.y ) / 2, 0 );
shape->SetStart( aElem.position + pointOffset ); shape->SetStart( aElem.position + pointOffset );
shape->SetEnd( aElem.position - pointOffset ); shape->SetEnd( aElem.position - pointOffset );
} }
@ -2423,13 +2423,13 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
if( aElem.topsize.x < aElem.topsize.y ) if( aElem.topsize.x < aElem.topsize.y )
{ {
wxPoint offset( 0, ( aElem.topsize.y - aElem.topsize.x ) / 2 ); VECTOR2I offset( 0, ( aElem.topsize.y - aElem.topsize.x ) / 2 );
shape->SetStart( aElem.position + offset ); shape->SetStart( aElem.position + offset );
shape->SetEnd( aElem.position - offset ); shape->SetEnd( aElem.position - offset );
} }
else else
{ {
wxPoint offset( ( aElem.topsize.x - aElem.topsize.y ) / 2, 0 ); VECTOR2I offset( ( aElem.topsize.x - aElem.topsize.y ) / 2, 0 );
shape->SetStart( aElem.position + offset ); shape->SetStart( aElem.position + offset );
shape->SetEnd( aElem.position - offset ); shape->SetEnd( aElem.position - offset );
} }
@ -2856,12 +2856,12 @@ void ALTIUM_PCB::ParseFills6Data( const CFB::CompoundFileReader& aReader,
checkpoint(); checkpoint();
AFILL6 elem( reader ); AFILL6 elem( reader );
wxPoint p11( elem.pos1.x, elem.pos1.y ); VECTOR2I p11( elem.pos1.x, elem.pos1.y );
wxPoint p12( elem.pos1.x, elem.pos2.y ); VECTOR2I p12( elem.pos1.x, elem.pos2.y );
wxPoint p22( elem.pos2.x, elem.pos2.y ); VECTOR2I p22( elem.pos2.x, elem.pos2.y );
wxPoint p21( elem.pos2.x, elem.pos1.y ); VECTOR2I p21( elem.pos2.x, elem.pos1.y );
wxPoint center( ( elem.pos1.x + elem.pos2.x ) / 2, ( elem.pos1.y + elem.pos2.y ) / 2 ); VECTOR2I center( ( elem.pos1.x + elem.pos2.x ) / 2, ( elem.pos1.y + elem.pos2.y ) / 2 );
PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); PCB_LAYER_ID klayer = GetKicadLayer( elem.layer );

View File

@ -174,8 +174,8 @@ void PCB_ARC::AddToFootprint( FOOTPRINT* aFootprint )
FP_SHAPE* arc = new FP_SHAPE( aFootprint, IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC ); FP_SHAPE* arc = new FP_SHAPE( aFootprint, IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC );
aFootprint->Add( arc ); aFootprint->Add( arc );
arc->SetCenter0( wxPoint( m_positionX, m_positionY ) ); arc->SetCenter0( VECTOR2I( m_positionX, m_positionY ) );
arc->SetStart0( wxPoint( m_StartX, m_StartY ) ); arc->SetStart0( VECTOR2I( m_StartX, m_StartY ) );
arc->SetArcAngleAndEnd0( -m_Angle ); arc->SetArcAngleAndEnd0( -m_Angle );
arc->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) ); arc->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
@ -194,8 +194,8 @@ void PCB_ARC::AddToBoard()
arc->SetFilled( false ); arc->SetFilled( false );
arc->SetLayer( m_KiCadLayer ); arc->SetLayer( m_KiCadLayer );
arc->SetCenter( wxPoint( m_positionX, m_positionY ) ); arc->SetCenter( VECTOR2I( m_positionX, m_positionY ) );
arc->SetStart( wxPoint( m_StartX, m_StartY ) ); arc->SetStart( VECTOR2I( m_StartX, m_StartY ) );
arc->SetArcAngleAndEnd( -m_Angle ); arc->SetArcAngleAndEnd( -m_Angle );
arc->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) ); arc->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
} }

View File

@ -508,7 +508,7 @@ void PCB_FOOTPRINT::AddToBoard()
FOOTPRINT* footprint = new FOOTPRINT( m_board ); FOOTPRINT* footprint = new FOOTPRINT( m_board );
m_board->Add( footprint, ADD_MODE::APPEND ); m_board->Add( footprint, ADD_MODE::APPEND );
footprint->SetPosition( wxPoint( m_positionX, m_positionY ) ); footprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
footprint->SetLayer( m_Mirror ? B_Cu : F_Cu ); footprint->SetLayer( m_Mirror ? B_Cu : F_Cu );
footprint->SetOrientation( m_rotation ); footprint->SetOrientation( m_rotation );
footprint->SetLastEditTime( 0 ); footprint->SetLastEditTime( 0 );
@ -523,7 +523,7 @@ void PCB_FOOTPRINT::AddToBoard()
ref_text->SetText( ValidateReference( m_name.text ) ); ref_text->SetText( ValidateReference( m_name.text ) );
ref_text->SetType( FP_TEXT::TEXT_is_REFERENCE ); ref_text->SetType( FP_TEXT::TEXT_is_REFERENCE );
ref_text->SetPos0( wxPoint( m_name.correctedPositionX, m_name.correctedPositionY ) ); ref_text->SetPos0( VECTOR2I( m_name.correctedPositionX, m_name.correctedPositionY ) );
if( m_name.isTrueType ) if( m_name.isTrueType )
SetTextSizeFromTrueTypeFontHeight( ref_text, m_name.textHeight ); SetTextSizeFromTrueTypeFontHeight( ref_text, m_name.textHeight );
@ -551,7 +551,7 @@ void PCB_FOOTPRINT::AddToBoard()
val_text->SetText( m_Value.text ); val_text->SetText( m_Value.text );
val_text->SetType( FP_TEXT::TEXT_is_VALUE ); val_text->SetType( FP_TEXT::TEXT_is_VALUE );
val_text->SetPos0( wxPoint( m_Value.correctedPositionX, m_Value.correctedPositionY ) ); val_text->SetPos0( VECTOR2I( m_Value.correctedPositionX, m_Value.correctedPositionY ) );
if( m_Value.isTrueType ) if( m_Value.isTrueType )
SetTextSizeFromTrueTypeFontHeight( val_text, m_Value.textHeight ); SetTextSizeFromTrueTypeFontHeight( val_text, m_Value.textHeight );