Convert wxPoint/wxSize starting from EDA_RECT usages
This commit is contained in:
parent
14209c04ee
commit
347e03363a
|
@ -834,7 +834,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
|
|||
|
||||
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const
|
||||
{
|
||||
const wxPoint& gridOrigin = GetGridOrigin();
|
||||
const VECTOR2I& gridOrigin = GetGridOrigin();
|
||||
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
|
||||
|
||||
double xOffset = fmod( gridOrigin.x, gridSize.x );
|
||||
|
@ -848,7 +848,7 @@ wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const
|
|||
|
||||
wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) const
|
||||
{
|
||||
const wxPoint& gridOrigin = GetGridOrigin();
|
||||
const VECTOR2I& gridOrigin = GetGridOrigin();
|
||||
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
|
||||
|
||||
double xOffset = fmod( gridOrigin.x, gridSize.x );
|
||||
|
|
|
@ -48,16 +48,16 @@ void EDA_RECT::Normalize()
|
|||
}
|
||||
|
||||
|
||||
void EDA_RECT::Move( const wxPoint& aMoveVector )
|
||||
void EDA_RECT::Move( const VECTOR2I& aMoveVector )
|
||||
{
|
||||
m_pos += aMoveVector;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_RECT::Contains( const wxPoint& aPoint ) const
|
||||
bool EDA_RECT::Contains( const VECTOR2I& aPoint ) const
|
||||
{
|
||||
wxPoint rel_pos = aPoint - m_pos;
|
||||
wxSize size = m_size;
|
||||
VECTOR2I rel_pos = aPoint - m_pos;
|
||||
VECTOR2I size = m_size;
|
||||
|
||||
if( size.x < 0 )
|
||||
{
|
||||
|
@ -82,9 +82,9 @@ bool EDA_RECT::Contains( const EDA_RECT& aRect ) const
|
|||
}
|
||||
|
||||
|
||||
bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const
|
||||
bool EDA_RECT::Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2 ) const
|
||||
{
|
||||
wxPoint point2, point4;
|
||||
VECTOR2I point2, point4;
|
||||
|
||||
if( Contains( aPoint1 ) || Contains( aPoint2 ) )
|
||||
return true;
|
||||
|
@ -108,10 +108,10 @@ bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) cons
|
|||
}
|
||||
|
||||
|
||||
bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2, wxPoint* aIntersection1,
|
||||
wxPoint* aIntersection2 ) const
|
||||
bool EDA_RECT::Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2,
|
||||
VECTOR2I* aIntersection1, VECTOR2I* aIntersection2 ) const
|
||||
{
|
||||
wxPoint point2, point4;
|
||||
VECTOR2I point2, point4;
|
||||
|
||||
point2.x = GetEnd().x;
|
||||
point2.y = GetOrigin().y;
|
||||
|
@ -120,7 +120,7 @@ bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2, wxPoi
|
|||
|
||||
bool intersects = false;
|
||||
|
||||
wxPoint* aPointToFill = aIntersection1;
|
||||
VECTOR2I* aPointToFill = aIntersection1;
|
||||
|
||||
if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin(), point2, aPointToFill ) )
|
||||
intersects = true;
|
||||
|
@ -229,7 +229,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
|||
* C) One of the sides of the rotated rect intersect this
|
||||
*/
|
||||
|
||||
wxPoint corners[4];
|
||||
VECTOR2I corners[4];
|
||||
|
||||
/* Test A : Any corners exist in rotated rect? */
|
||||
corners[0] = m_pos;
|
||||
|
@ -237,12 +237,12 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
|||
corners[2] = m_pos + wxPoint( m_size.x, m_size.y );
|
||||
corners[3] = m_pos + wxPoint( 0, m_size.y );
|
||||
|
||||
wxPoint rCentre = aRect.Centre();
|
||||
VECTOR2I rCentre = aRect.Centre();
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
wxPoint delta = corners[i] - rCentre;
|
||||
RotatePoint( &delta, -aRot );
|
||||
VECTOR2I delta = corners[i] - rCentre;
|
||||
RotatePoint( delta, -aRot );
|
||||
delta += rCentre;
|
||||
|
||||
if( aRect.Contains( delta ) )
|
||||
|
@ -264,7 +264,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
|||
// Rotate and test each corner
|
||||
for( int j = 0; j < 4; j++ )
|
||||
{
|
||||
RotatePoint( &corners[j], aRot );
|
||||
RotatePoint( corners[j], aRot );
|
||||
corners[j] += rCentre;
|
||||
|
||||
if( Contains( corners[j] ) )
|
||||
|
@ -445,8 +445,8 @@ void EDA_RECT::Merge( const EDA_RECT& aRect )
|
|||
Normalize(); // ensure width and height >= 0
|
||||
EDA_RECT rect = aRect;
|
||||
rect.Normalize(); // ensure width and height >= 0
|
||||
wxPoint end = GetEnd();
|
||||
wxPoint rect_end = rect.GetEnd();
|
||||
VECTOR2I end = GetEnd();
|
||||
VECTOR2I rect_end = rect.GetEnd();
|
||||
|
||||
// Change origin and size in order to contain the given rect
|
||||
m_pos.x = std::min( m_pos.x, rect.m_pos.x );
|
||||
|
@ -469,7 +469,7 @@ void EDA_RECT::Merge( const wxPoint& aPoint )
|
|||
|
||||
Normalize(); // ensure width and height >= 0
|
||||
|
||||
wxPoint end = GetEnd();
|
||||
VECTOR2I end = GetEnd();
|
||||
|
||||
// Change origin and size in order to contain the given rect
|
||||
m_pos.x = std::min( m_pos.x, aPoint.x );
|
||||
|
@ -492,27 +492,27 @@ EDA_RECT EDA_RECT::Common( const EDA_RECT& aRect ) const
|
|||
|
||||
if( Intersects( aRect ) )
|
||||
{
|
||||
wxPoint originA(
|
||||
std::min( GetOrigin().x, GetEnd().x ), std::min( GetOrigin().y, GetEnd().y ) );
|
||||
wxPoint originB( std::min( aRect.GetOrigin().x, aRect.GetEnd().x ),
|
||||
std::min( aRect.GetOrigin().y, aRect.GetEnd().y ) );
|
||||
wxPoint endA(
|
||||
std::max( GetOrigin().x, GetEnd().x ), std::max( GetOrigin().y, GetEnd().y ) );
|
||||
wxPoint endB( std::max( aRect.GetOrigin().x, aRect.GetEnd().x ),
|
||||
std::max( aRect.GetOrigin().y, aRect.GetEnd().y ) );
|
||||
VECTOR2I originA( std::min( GetOrigin().x, GetEnd().x ),
|
||||
std::min( GetOrigin().y, GetEnd().y ) );
|
||||
VECTOR2I originB( std::min( aRect.GetOrigin().x, aRect.GetEnd().x ),
|
||||
std::min( aRect.GetOrigin().y, aRect.GetEnd().y ) );
|
||||
VECTOR2I endA( std::max( GetOrigin().x, GetEnd().x ),
|
||||
std::max( GetOrigin().y, GetEnd().y ) );
|
||||
VECTOR2I endB( std::max( aRect.GetOrigin().x, aRect.GetEnd().x ),
|
||||
std::max( aRect.GetOrigin().y, aRect.GetEnd().y ) );
|
||||
|
||||
r.SetOrigin(
|
||||
wxPoint( std::max( originA.x, originB.x ), std::max( originA.y, originB.y ) ) );
|
||||
r.SetEnd( wxPoint( std::min( endA.x, endB.x ), std::min( endA.y, endB.y ) ) );
|
||||
VECTOR2I( std::max( originA.x, originB.x ), std::max( originA.y, originB.y ) ) );
|
||||
r.SetEnd( VECTOR2I( std::min( endA.x, endB.x ), std::min( endA.y, endB.y ) ) );
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const wxPoint& aRotCenter, double aAngle ) const
|
||||
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const VECTOR2I& aRotCenter, double aAngle ) const
|
||||
{
|
||||
wxPoint corners[4];
|
||||
VECTOR2I corners[4];
|
||||
|
||||
// Build the corners list
|
||||
corners[0] = GetOrigin();
|
||||
|
@ -524,11 +524,11 @@ const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const wxPoint& aRotCenter, doubl
|
|||
|
||||
// Rotate all corners, to find the bounding box
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
RotatePoint( &corners[ii], aRotCenter, aAngle );
|
||||
RotatePoint( corners[ii], aRotCenter, aAngle );
|
||||
|
||||
// Find the corners bounding box
|
||||
wxPoint start = corners[0];
|
||||
wxPoint end = corners[0];
|
||||
VECTOR2I start = corners[0];
|
||||
VECTOR2I end = corners[0];
|
||||
|
||||
for( int ii = 1; ii < 4; ii++ )
|
||||
{
|
||||
|
|
|
@ -408,7 +408,7 @@ wxPoint EDA_SHAPE::getCenter() const
|
|||
case SHAPE_T::POLY:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::BEZIER:
|
||||
return getBoundingBox().Centre();
|
||||
return (wxPoint)getBoundingBox().Centre();
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
|
|
|
@ -283,7 +283,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
|||
// Creates bounding box (rectangle) for horizontal, left and top justified text. The
|
||||
// bounding box will be moved later according to the actual text options
|
||||
wxSize textsize = wxSize( dx, dy );
|
||||
wxPoint pos = GetTextPos();
|
||||
VECTOR2I pos = GetTextPos();
|
||||
|
||||
if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
|
||||
{
|
||||
|
@ -394,10 +394,10 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
|||
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetTextBox();
|
||||
wxPoint location = aPoint;
|
||||
VECTOR2I location = aPoint;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
RotatePoint( &location, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( location, GetTextPos(), -GetTextAngle() );
|
||||
|
||||
return rect.Contains( location );
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
|||
|
||||
void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const
|
||||
{
|
||||
wxPoint pos = GetTextPos(); // Position of first line of the multiline text according
|
||||
VECTOR2I pos = GetTextPos(); // Position of first line of the multiline text according
|
||||
// to the center of the multiline text block
|
||||
|
||||
wxPoint offset; // Offset to next line.
|
||||
|
@ -466,22 +466,22 @@ void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCoun
|
|||
}
|
||||
|
||||
// Rotate the position of the first line around the center of the multiline text block
|
||||
RotatePoint( &pos, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( pos, GetTextPos(), GetTextAngle() );
|
||||
|
||||
// Rotate the offset lines to increase happened in the right direction
|
||||
RotatePoint( &offset, GetTextAngle() );
|
||||
|
||||
for( int ii = 0; ii < aLineCount; ii++ )
|
||||
{
|
||||
aPositions.push_back( pos );
|
||||
aPositions.push_back( (wxPoint) pos );
|
||||
pos += offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||
void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
||||
const COLOR4D& aColor, OUTLINE_MODE aFillMode,
|
||||
const wxString& aText, const wxPoint &aPos )
|
||||
const wxString& aText, const VECTOR2I& aPos )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||
|
@ -489,7 +489,7 @@ void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoi
|
|||
if( aFillMode == SKETCH )
|
||||
penWidth = -penWidth;
|
||||
|
||||
wxSize size = GetTextSize();
|
||||
VECTOR2I size = GetTextSize();
|
||||
|
||||
if( IsMirrored() )
|
||||
size.x = -size.x;
|
||||
|
@ -704,7 +704,7 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
|
|||
if( GetText().Length() == 0 )
|
||||
return;
|
||||
|
||||
wxPoint corners[4]; // Buffer of polygon corners
|
||||
VECTOR2I corners[4]; // Buffer of polygon corners
|
||||
|
||||
EDA_RECT rect = GetTextBox();
|
||||
|
||||
|
@ -735,10 +735,10 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
|
|||
|
||||
aCornerBuffer->NewOutline();
|
||||
|
||||
for( wxPoint& corner : corners )
|
||||
for( VECTOR2I& corner : corners )
|
||||
{
|
||||
// Rotate polygon
|
||||
RotatePoint( &corner, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( corner, GetTextPos(), GetTextAngle() );
|
||||
aCornerBuffer->Append( corner.x, corner.y );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,8 +122,8 @@ void MARKER_BASE::ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale ) const
|
|||
|
||||
EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
|
||||
{
|
||||
wxSize size_iu = m_shapeBoundingBox.GetSize();
|
||||
wxPoint position_iu = m_shapeBoundingBox.GetPosition();
|
||||
VECTOR2I size_iu = m_shapeBoundingBox.GetSize();
|
||||
VECTOR2I position_iu = m_shapeBoundingBox.GetPosition();
|
||||
size_iu.x *= m_scalingFactor;
|
||||
size_iu.y *= m_scalingFactor;
|
||||
position_iu.x *= m_scalingFactor;
|
||||
|
|
|
@ -527,7 +527,7 @@ protected:
|
|||
*/
|
||||
wxPoint fieldBoxPlacement( SIDE_AND_NPINS aFieldSideAndPins )
|
||||
{
|
||||
wxPoint fbox_center = m_symbol_bbox.Centre();
|
||||
VECTOR2I fbox_center = m_symbol_bbox.Centre();
|
||||
int offs_x = ( m_symbol_bbox.GetWidth() + m_fbox_size.GetWidth() ) / 2;
|
||||
int offs_y = ( m_symbol_bbox.GetHeight() + m_fbox_size.GetHeight() ) / 2;
|
||||
|
||||
|
@ -617,7 +617,7 @@ protected:
|
|||
// return false after this point.
|
||||
m_fbox_size = computeFBoxSize( /* aDynamic */ false );
|
||||
|
||||
wxPoint pos = aBox->GetPosition();
|
||||
VECTOR2I pos = aBox->GetPosition();
|
||||
|
||||
pos.y = round_n( pos.y, WIRE_V_SPACING, aSide == SIDE_BOTTOM );
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco
|
|||
void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
|
||||
const std::vector<SCH_ITEM*>& aItemList )
|
||||
{
|
||||
std::map< wxPoint, std::vector<SCH_ITEM*> > connection_map;
|
||||
std::map<VECTOR2I, std::vector<SCH_ITEM*>> connection_map;
|
||||
|
||||
for( SCH_ITEM* item : aItemList )
|
||||
{
|
||||
|
|
|
@ -134,7 +134,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
if( crossProbingSettings.zoom_to_fit )
|
||||
{
|
||||
EDA_RECT bbox = symbol->GetBoundingBox();
|
||||
wxSize bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
|
||||
VECTOR2I bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
|
||||
VECTOR2D screenSize = getView()->GetViewport().GetSize();
|
||||
|
||||
// This code tries to come up with a zoom factor that doesn't simply zoom in
|
||||
|
|
|
@ -647,7 +647,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
|
|||
}
|
||||
|
||||
if( resetPositions )
|
||||
field.SetTextPos( aSymbol->GetPosition() + libField->GetTextPos() );
|
||||
field.SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField->GetTextPos() );
|
||||
}
|
||||
else if( i >= MANDATORY_FIELDS && removeExtras )
|
||||
{
|
||||
|
@ -675,7 +675,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
|
|||
// Careful: the visible bit and position are also set by SetAttributes()
|
||||
schField->SetAttributes( libField );
|
||||
schField->SetText( libField.GetText() );
|
||||
schField->SetTextPos( aSymbol->GetPosition() + libField.GetTextPos() );
|
||||
schField->SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField.GetTextPos() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -600,7 +600,7 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH
|
|||
GR_TEXT_V_ALIGN_T vJustify = EDA_TEXT::MapVertJustify( m_verticalJustification - 1 );
|
||||
bool positioningModified = false;
|
||||
|
||||
if( aField->GetPosition() != m_position )
|
||||
if( aField->GetPosition() != (wxPoint)m_position )
|
||||
positioningModified = true;
|
||||
|
||||
if( aField->GetTextAngle().IsVertical() != m_isVertical )
|
||||
|
@ -617,7 +617,7 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH
|
|||
|
||||
aField->SetText( m_text );
|
||||
updateText( aField );
|
||||
aField->SetPosition( m_position );
|
||||
aField->SetPosition( (wxPoint)m_position );
|
||||
|
||||
// Note that we must set justifications before we can ask if they're flipped. If the old
|
||||
// justification is center then it won't know (whereas if the new justification is center
|
||||
|
|
|
@ -94,7 +94,7 @@ protected:
|
|||
wxString m_text;
|
||||
bool m_isItalic;
|
||||
bool m_isBold;
|
||||
wxPoint m_position;
|
||||
VECTOR2I m_position;
|
||||
int m_size;
|
||||
bool m_isVertical;
|
||||
int m_verticalJustification;
|
||||
|
|
|
@ -389,7 +389,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|||
RENDER_SETTINGS* renderSettings = symbolEditor->GetRenderSettings();
|
||||
renderSettings->SetPrintDC( &dc );
|
||||
|
||||
m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform );
|
||||
m_dummyPin->Print( renderSettings, (wxPoint) - bBox.Centre(), (void*) &opts, DefaultTransform );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
|
|
@ -537,7 +537,7 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
|
|||
{
|
||||
wxCHECK( aRow < GetNumberRows(), /*void*/ );
|
||||
T& field = this->at( (size_t) aRow );
|
||||
wxPoint pos;
|
||||
VECTOR2I pos;
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
|||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? GetDefaultLayer() : LAYER_HIDDEN );
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
wxPoint text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
|
||||
VECTOR2I text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
|
||||
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
|
||||
|
||||
GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
||||
|
@ -276,8 +276,8 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
|
|||
{
|
||||
int rot_angle = aRotateCCW ? -900 : 900;
|
||||
|
||||
wxPoint pt = GetTextPos();
|
||||
RotatePoint( &pt, center, rot_angle );
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, center, rot_angle );
|
||||
SetTextPos( pt );
|
||||
|
||||
SetTextAngle( GetTextAngle() != EDA_ANGLE::HORIZONTAL ? EDA_ANGLE::HORIZONTAL
|
||||
|
@ -307,7 +307,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
|
||||
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_CENTER;
|
||||
GR_TEXT_V_ALIGN_T vjustify = GR_TEXT_V_ALIGN_CENTER;
|
||||
wxPoint textpos = aTransform.TransformCoordinate( bbox.Centre() ) + aOffset;
|
||||
VECTOR2I textpos = aTransform.TransformCoordinate( bbox.Centre() ) + aOffset;
|
||||
|
||||
COLOR4D color;
|
||||
|
||||
|
@ -349,11 +349,11 @@ const EDA_RECT LIB_FIELD::GetBoundingBox() const
|
|||
rect.RevertYAxis();
|
||||
|
||||
// We are using now a bottom to top Y axis.
|
||||
wxPoint orig = rect.GetOrigin();
|
||||
wxPoint end = rect.GetEnd();
|
||||
VECTOR2I orig = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
|
||||
RotatePoint( &orig, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( &end, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( orig, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( end, GetTextPos(), -GetTextAngle() );
|
||||
|
||||
rect.SetOrigin( orig );
|
||||
rect.SetEnd( end );
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
|
||||
void MoveTo( const wxPoint& aPosition ) override;
|
||||
|
||||
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
||||
wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); }
|
||||
|
||||
void MirrorHorizontal( const wxPoint& aCenter ) override;
|
||||
void MirrorVertical( const wxPoint& aCenter ) override;
|
||||
|
|
|
@ -228,8 +228,8 @@ void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW )
|
|||
NormalizeJustification( false );
|
||||
int rot_angle = aRotateCCW ? -900 : 900;
|
||||
|
||||
wxPoint pt = GetTextPos();
|
||||
RotatePoint( &pt, center, rot_angle );
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, center, rot_angle );
|
||||
SetTextPos( pt );
|
||||
|
||||
if( GetTextAngle().IsHorizontal() )
|
||||
|
@ -265,12 +265,12 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
|
|||
EDA_RECT bBox = GetBoundingBox();
|
||||
// convert coordinates from draw Y axis to symbol_editor Y axis
|
||||
bBox.RevertYAxis();
|
||||
wxPoint txtpos = bBox.Centre();
|
||||
VECTOR2I txtpos = bBox.Centre();
|
||||
|
||||
// The text orientation may need to be flipped if the transformation matrix causes xy
|
||||
// axes to be flipped.
|
||||
int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != EDA_ANGLE::HORIZONTAL );
|
||||
wxPoint pos = aTransform.TransformCoordinate( txtpos ) + offset;
|
||||
VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
|
||||
|
||||
// Get color
|
||||
COLOR4D color;
|
||||
|
@ -329,7 +329,7 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
|||
|
||||
// convert coordinates from draw Y axis to symbol_editor Y axis:
|
||||
bBox.RevertYAxis();
|
||||
wxPoint txtpos = bBox.Centre();
|
||||
VECTOR2I txtpos = bBox.Centre();
|
||||
|
||||
// Calculate pos according to mirror/rotation.
|
||||
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
||||
|
@ -382,11 +382,11 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const
|
|||
rect.RevertYAxis();
|
||||
|
||||
// We are using now a bottom to top Y axis.
|
||||
wxPoint orig = rect.GetOrigin();
|
||||
wxPoint end = rect.GetEnd();
|
||||
VECTOR2I orig = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
|
||||
RotatePoint( &orig, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( &end, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( orig, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( end, GetTextPos(), -GetTextAngle() );
|
||||
|
||||
rect.SetOrigin( orig );
|
||||
rect.SetEnd( end );
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
void MoveTo( const wxPoint& aPosition ) override;
|
||||
|
||||
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
||||
wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); }
|
||||
|
||||
void MirrorHorizontal( const wxPoint& aCenter ) override;
|
||||
void MirrorVertical( const wxPoint& aCenter ) override;
|
||||
|
|
|
@ -121,12 +121,12 @@ public:
|
|||
const PAGE_INFO& GetPageSettings () const override;
|
||||
const wxSize GetPageSizeIU() const override;
|
||||
|
||||
const wxPoint& GetGridOrigin() const override
|
||||
const VECTOR2I& GetGridOrigin() const override
|
||||
{
|
||||
static wxPoint zero;
|
||||
static VECTOR2I zero;
|
||||
return zero;
|
||||
}
|
||||
void SetGridOrigin( const wxPoint& aPoint ) override {}
|
||||
void SetGridOrigin( const VECTOR2I& aPoint ) override {}
|
||||
|
||||
const TITLE_BLOCK& GetTitleBlock() const override;
|
||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
|
||||
|
|
|
@ -217,7 +217,7 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_layer );
|
||||
wxPoint textpos;
|
||||
VECTOR2I textpos;
|
||||
int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
|
||||
|
||||
if( ( !IsVisible() && !IsForceVisible() ) || IsVoid() )
|
||||
|
@ -299,7 +299,7 @@ EDA_ANGLE SCH_FIELD::GetDrawRotation() const
|
|||
|
||||
wxPoint SCH_FIELD::GetDrawPos() const
|
||||
{
|
||||
return GetBoundingBox().Centre();
|
||||
return (wxPoint)GetBoundingBox().Centre();
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,12 +321,12 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
|||
EDA_RECT rect = GetTextBox();
|
||||
|
||||
// Calculate the bounding box position relative to the parent:
|
||||
wxPoint origin = GetParentPosition();
|
||||
wxPoint pos = GetTextPos() - origin;
|
||||
wxPoint begin = rect.GetOrigin() - origin;
|
||||
wxPoint end = rect.GetEnd() - origin;
|
||||
RotatePoint( &begin, pos, GetTextAngle() );
|
||||
RotatePoint( &end, pos, GetTextAngle() );
|
||||
VECTOR2I origin = GetParentPosition();
|
||||
VECTOR2I pos = GetTextPos() - origin;
|
||||
VECTOR2I begin = rect.GetOrigin() - origin;
|
||||
VECTOR2I end = rect.GetEnd() - origin;
|
||||
RotatePoint( begin, pos, GetTextAngle() );
|
||||
RotatePoint( end, pos, GetTextAngle() );
|
||||
|
||||
// Now, apply the symbol transform (mirror/rot)
|
||||
TRANSFORM transform;
|
||||
|
@ -359,7 +359,7 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
|||
|
||||
bool SCH_FIELD::IsHorizJustifyFlipped() const
|
||||
{
|
||||
wxPoint render_center = GetBoundingBox().Centre();
|
||||
VECTOR2I render_center = GetBoundingBox().Centre();
|
||||
wxPoint pos = GetPosition();
|
||||
|
||||
switch( GetHorizJustify() )
|
||||
|
@ -396,7 +396,7 @@ GR_TEXT_H_ALIGN_T SCH_FIELD::GetEffectiveHorizJustify() const
|
|||
|
||||
bool SCH_FIELD::IsVertJustifyFlipped() const
|
||||
{
|
||||
wxPoint render_center = GetBoundingBox().Centre();
|
||||
VECTOR2I render_center = GetBoundingBox().Centre();
|
||||
wxPoint pos = GetPosition();
|
||||
|
||||
switch( GetVertJustify() )
|
||||
|
@ -859,7 +859,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
|
|||
*/
|
||||
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_CENTER;
|
||||
GR_TEXT_V_ALIGN_T vjustify = GR_TEXT_V_ALIGN_CENTER;
|
||||
wxPoint textpos = GetBoundingBox().Centre();
|
||||
VECTOR2I textpos = GetBoundingBox().Centre();
|
||||
|
||||
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
||||
penWidth, IsItalic(), IsBold() );
|
||||
|
@ -891,14 +891,14 @@ wxPoint SCH_FIELD::GetPosition() const
|
|||
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
|
||||
wxPoint relativePos = GetTextPos() - parentSymbol->GetPosition();
|
||||
VECTOR2I relativePos = GetTextPos() - parentSymbol->GetPosition();
|
||||
|
||||
relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos );
|
||||
|
||||
return relativePos + parentSymbol->GetPosition();
|
||||
return (wxPoint)relativePos + parentSymbol->GetPosition();
|
||||
}
|
||||
|
||||
return GetTextPos();
|
||||
return (wxPoint)GetTextPos();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ public:
|
|||
|
||||
bool IsReplaceable() const override;
|
||||
|
||||
wxPoint GetLibPosition() const { return EDA_TEXT::GetTextPos(); }
|
||||
wxPoint GetLibPosition() const { return (wxPoint)EDA_TEXT::GetTextPos(); }
|
||||
|
||||
wxPoint GetPosition() const override;
|
||||
void SetPosition( const wxPoint& aPosition ) override;
|
||||
|
|
|
@ -416,7 +416,7 @@ float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows
|
|||
}
|
||||
|
||||
|
||||
static VECTOR2D mapCoords( const wxPoint& aCoord )
|
||||
static VECTOR2D mapCoords( const VECTOR2D& aCoord )
|
||||
{
|
||||
return VECTOR2D( aCoord.x, -aCoord.y );
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
|
|||
m_gal->SetFillColor( color );
|
||||
|
||||
EDA_RECT bbox = aField->GetBoundingBox();
|
||||
wxPoint textpos = bbox.Centre();
|
||||
VECTOR2I textpos = bbox.Centre();
|
||||
|
||||
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
|
||||
{
|
||||
|
@ -1235,7 +1235,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
|||
|
||||
// Draw the target (an open square) for a wire or label which has no connection or is
|
||||
// being moved.
|
||||
void SCH_PAINTER::drawDanglingSymbol( const wxPoint& aPos, const COLOR4D& aColor, int aWidth,
|
||||
void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
|
||||
bool aDrawingShadows, bool aBrightened )
|
||||
{
|
||||
wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
|
||||
|
@ -1706,7 +1706,7 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
|
|||
bbox.Offset( label->GetSchematicTextOffset( &m_schSettings ) );
|
||||
}
|
||||
|
||||
wxPoint textpos = bbox.Centre();
|
||||
VECTOR2I textpos = bbox.Centre();
|
||||
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
|
||||
|
@ -1767,7 +1767,7 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer )
|
|||
std::vector<wxPoint> pts;
|
||||
std::deque<VECTOR2D> pts2;
|
||||
|
||||
aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
|
||||
aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() );
|
||||
|
||||
for( const wxPoint& p : pts )
|
||||
pts2.emplace_back( VECTOR2D( p.x, p.y ) );
|
||||
|
@ -1841,7 +1841,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer )
|
|||
std::vector<wxPoint> pts;
|
||||
std::deque<VECTOR2D> pts2;
|
||||
|
||||
aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
|
||||
aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint)aLabel->GetTextPos() );
|
||||
|
||||
for( const wxPoint& p : pts )
|
||||
pts2.emplace_back( VECTOR2D( p.x, p.y ) );
|
||||
|
@ -1889,7 +1889,7 @@ void SCH_PAINTER::draw( const SCH_NETCLASS_FLAG *aLabel, int aLayer )
|
|||
std::vector<wxPoint> pts;
|
||||
std::deque<VECTOR2D> pts2;
|
||||
|
||||
aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
|
||||
aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() );
|
||||
|
||||
for( const wxPoint& p : pts )
|
||||
pts2.emplace_back( VECTOR2D( p.x, p.y ) );
|
||||
|
@ -1950,8 +1950,8 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer )
|
|||
}
|
||||
|
||||
int width = std::max( aSheet->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
|
||||
wxPoint initial_pos = sheetPin->GetTextPos();
|
||||
wxPoint offset_pos = initial_pos;
|
||||
VECTOR2I initial_pos = sheetPin->GetTextPos();
|
||||
VECTOR2I offset_pos = initial_pos;
|
||||
|
||||
// For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2
|
||||
switch( sheetPin->GetSide() )
|
||||
|
|
|
@ -173,7 +173,7 @@ private:
|
|||
|
||||
void drawPinDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor,
|
||||
bool aDrawingShadows, bool aBrightened );
|
||||
void drawDanglingSymbol( const wxPoint& aPos, const COLOR4D& aColor, int aWidth,
|
||||
void drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
|
||||
bool aDrawingShadows, bool aBrightened );
|
||||
|
||||
int internalPinDecoSize( const LIB_PIN &aPin );
|
||||
|
|
|
@ -217,7 +217,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
|||
// When exporting to pdf, CADSTAR applies a margin of 3% of the longest dimension (height
|
||||
// or width) to all 4 sides (top, bottom, left right). For the import, we are also rounding
|
||||
// the margin to the nearest grid, ensuring all items remain on the grid.
|
||||
wxSize targetSheetSize = sheetBoundingBox.GetSize();
|
||||
wxSize targetSheetSize = (wxSize)sheetBoundingBox.GetSize();
|
||||
int longestSide = std::max( targetSheetSize.x, targetSheetSize.y );
|
||||
int margin = ( (double) longestSide * 0.03 );
|
||||
margin = roundToNearestGrid( margin );
|
||||
|
@ -232,11 +232,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
|||
sheet->GetScreen()->SetPageSettings( pageInfo );
|
||||
|
||||
wxSize pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU();
|
||||
wxPoint sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
|
||||
wxPoint itemsCentre = sheetBoundingBox.Centre();
|
||||
VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
|
||||
VECTOR2I itemsCentre = sheetBoundingBox.Centre();
|
||||
|
||||
// round the translation to nearest point on the grid
|
||||
wxPoint translation = sheetcentre - itemsCentre;
|
||||
VECTOR2I translation = sheetcentre - itemsCentre;
|
||||
translation.x = roundToNearestGrid( translation.x );
|
||||
translation.y = roundToNearestGrid( translation.y );
|
||||
|
||||
|
@ -248,7 +248,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
|||
|
||||
for( SCH_ITEM* item : allItems )
|
||||
{
|
||||
item->Move( translation );
|
||||
item->Move( (wxPoint)translation );
|
||||
item->ClearFlags();
|
||||
sheet->GetScreen()->Update( item );
|
||||
}
|
||||
|
@ -1425,9 +1425,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
|||
for( size_t ii = 0; ii < strings.size(); ++ii )
|
||||
{
|
||||
EDA_RECT bbox = libtext->GetTextBox( ii, true );
|
||||
wxPoint linePos = { bbox.GetLeft(), -bbox.GetBottom() };
|
||||
VECTOR2I linePos = { bbox.GetLeft(), -bbox.GetBottom() };
|
||||
|
||||
RotatePoint( &linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
|
||||
RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
|
||||
|
||||
LIB_TEXT* line = static_cast<LIB_TEXT*>( libtext->Clone() );
|
||||
line->SetText( strings[ii] );
|
||||
|
|
|
@ -929,8 +929,8 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
|
|||
|
||||
// Calculate the new sheet size.
|
||||
EDA_RECT sheetBoundingBox = getSheetBbox( m_currentSheet );
|
||||
wxSize targetSheetSize = sheetBoundingBox.GetSize();
|
||||
targetSheetSize.IncBy( Mils2iu( 1500 ), Mils2iu( 1500 ) );
|
||||
VECTOR2I targetSheetSize = sheetBoundingBox.GetSize();
|
||||
targetSheetSize += VECTOR2I( Mils2iu( 1500 ), Mils2iu( 1500 ) );
|
||||
|
||||
// Get current Eeschema sheet size.
|
||||
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
|
||||
|
@ -947,11 +947,11 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
|
|||
m_currentSheet->GetScreen()->SetPageSettings( pageInfo );
|
||||
|
||||
pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
|
||||
wxPoint sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
|
||||
wxPoint itemsCentre = sheetBoundingBox.Centre();
|
||||
VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
|
||||
VECTOR2I itemsCentre = sheetBoundingBox.Centre();
|
||||
|
||||
// round the translation to nearest 100mil to place it on the grid.
|
||||
wxPoint translation = sheetcentre - itemsCentre;
|
||||
VECTOR2I translation = sheetcentre - itemsCentre;
|
||||
translation.x = translation.x - translation.x % Mils2iu( 100 );
|
||||
translation.y = translation.y - translation.y % Mils2iu( 100 );
|
||||
|
||||
|
@ -972,7 +972,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
|
|||
|
||||
for( SCH_ITEM* item : allItems )
|
||||
{
|
||||
item->SetPosition( item->GetPosition() + translation );
|
||||
item->SetPosition( item->GetPosition() + (wxPoint)translation );
|
||||
item->ClearFlags();
|
||||
m_currentSheet->GetScreen()->Update( item );
|
||||
|
||||
|
@ -1341,7 +1341,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
for( const LIB_FIELD* field : partFields )
|
||||
{
|
||||
symbol->GetFieldById( field->GetId() )->ImportValues( *field );
|
||||
symbol->GetFieldById( field->GetId() )->SetTextPos( symbol->GetPosition()
|
||||
symbol->GetFieldById( field->GetId() )->SetTextPos( (VECTOR2I)symbol->GetPosition()
|
||||
+ field->GetTextPos() );
|
||||
}
|
||||
|
||||
|
|
|
@ -432,6 +432,12 @@ public:
|
|||
return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
|
||||
}
|
||||
|
||||
SCH_LINE* GetBus( const VECTOR2I& aPosition, int aAccuracy = 0,
|
||||
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
|
||||
{
|
||||
return GetLine( (wxPoint)aPosition, aAccuracy, LAYER_BUS, aSearchType );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a label item located at \a aPosition.
|
||||
*
|
||||
|
|
|
@ -640,7 +640,7 @@ const EDA_RECT SCH_SHEET::GetBoundingBox() const
|
|||
wxPoint SCH_SHEET::GetRotationCenter() const
|
||||
{
|
||||
EDA_RECT box( m_pos, m_size );
|
||||
return box.GetCenter();
|
||||
return (wxPoint)box.GetCenter();
|
||||
}
|
||||
|
||||
|
||||
|
@ -803,7 +803,7 @@ void SCH_SHEET::Rotate( const wxPoint& aCenter )
|
|||
// Move the fields to the new position because the parent itself has moved.
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
wxPoint pos = field.GetTextPos();
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
pos.x -= prev.x - m_pos.x;
|
||||
pos.y -= prev.y - m_pos.y;
|
||||
field.SetTextPos( pos );
|
||||
|
@ -825,7 +825,7 @@ void SCH_SHEET::MirrorVertically( int aCenter )
|
|||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
wxPoint pos = field.GetTextPos();
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
pos.y -= dy;
|
||||
field.SetTextPos( pos );
|
||||
}
|
||||
|
@ -845,7 +845,7 @@ void SCH_SHEET::MirrorHorizontally( int aCenter )
|
|||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
wxPoint pos = field.GetTextPos();
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
pos.x -= dx;
|
||||
field.SetTextPos( pos );
|
||||
}
|
||||
|
|
|
@ -249,13 +249,13 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
|
|||
|
||||
void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
wxPoint pt = GetTextPos();
|
||||
wxPoint delta = pt - aCenter;
|
||||
VECTOR2I pt = GetTextPos();
|
||||
VECTOR2I delta = pt - aCenter;
|
||||
|
||||
RotatePoint( &pt, aCenter, 900 );
|
||||
RotatePoint( pt, aCenter, 900 );
|
||||
|
||||
SHEET_SIDE oldSide = GetSide();
|
||||
ConstrainOnEdge( pt );
|
||||
ConstrainOnEdge( (wxPoint)pt );
|
||||
|
||||
// If the new side is the same as the old side, instead mirror across the center of that side.
|
||||
if( GetSide() == oldSide )
|
||||
|
@ -323,7 +323,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
|
|||
|
||||
void SCH_SHEET_PIN::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
DANGLING_END_ITEM item( SHEET_LABEL_END, this, GetTextPos() );
|
||||
DANGLING_END_ITEM item( SHEET_LABEL_END, this, (wxPoint)GetTextPos() );
|
||||
aItemList.push_back( item );
|
||||
}
|
||||
|
||||
|
|
|
@ -793,7 +793,7 @@ void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, b
|
|||
if( aUpdateStyle )
|
||||
{
|
||||
schField->ImportValues( *libField );
|
||||
schField->SetTextPos( m_pos + libField->GetTextPos() );
|
||||
schField->SetTextPos( (VECTOR2I)m_pos + libField->GetTextPos() );
|
||||
}
|
||||
|
||||
if( id == REFERENCE_FIELD && aPath )
|
||||
|
@ -1459,7 +1459,7 @@ void SCH_SYMBOL::MirrorHorizontally( int aCenter )
|
|||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
// Move the fields to the new position because the symbol itself has moved.
|
||||
wxPoint pos = field.GetTextPos();
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
pos.x -= dx;
|
||||
field.SetTextPos( pos );
|
||||
}
|
||||
|
@ -1477,7 +1477,7 @@ void SCH_SYMBOL::MirrorVertically( int aCenter )
|
|||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
// Move the fields to the new position because the symbol itself has moved.
|
||||
wxPoint pos = field.GetTextPos();
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
pos.y -= dy;
|
||||
field.SetTextPos( pos );
|
||||
}
|
||||
|
@ -1495,7 +1495,7 @@ void SCH_SYMBOL::Rotate( const wxPoint& aCenter )
|
|||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
// Move the fields to the new position because the symbol itself has moved.
|
||||
wxPoint pos = field.GetTextPos();
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
pos.x -= prev.x - m_pos.x;
|
||||
pos.y -= prev.y - m_pos.y;
|
||||
field.SetTextPos( pos );
|
||||
|
|
|
@ -283,9 +283,9 @@ void SCH_TEXT::MirrorVertically( int aCenter )
|
|||
|
||||
void SCH_TEXT::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
wxPoint pt = GetTextPos();
|
||||
RotatePoint( &pt, aCenter, 900 );
|
||||
wxPoint offset = pt - GetTextPos();
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, aCenter, 900 );
|
||||
VECTOR2I offset = pt - GetTextPos();
|
||||
|
||||
Rotate90( false );
|
||||
|
||||
|
@ -419,11 +419,11 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const
|
|||
|
||||
if( GetTextAngle() != EDA_ANGLE::ANGLE_0 ) // Rotate rect.
|
||||
{
|
||||
wxPoint pos = rect.GetOrigin();
|
||||
wxPoint end = rect.GetEnd();
|
||||
VECTOR2I pos = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
|
||||
RotatePoint( &pos, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( &end, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( pos, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( end, GetTextPos(), GetTextAngle() );
|
||||
|
||||
rect.SetOrigin( pos );
|
||||
rect.SetEnd( end );
|
||||
|
@ -728,9 +728,9 @@ void SCH_LABEL_BASE::SwapData( SCH_ITEM* aItem )
|
|||
|
||||
void SCH_LABEL_BASE::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
wxPoint pt = GetTextPos();
|
||||
RotatePoint( &pt, aCenter, 900 );
|
||||
wxPoint offset = pt - GetTextPos();
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, aCenter, 900 );
|
||||
VECTOR2I offset = pt - GetTextPos();
|
||||
|
||||
Rotate90( false );
|
||||
|
||||
|
@ -786,8 +786,8 @@ void SCH_LABEL_BASE::Rotate90( bool aClockwise )
|
|||
field.SetTextAngle( EDA_ANGLE::VERTICAL );
|
||||
}
|
||||
|
||||
wxPoint pos = field.GetTextPos();
|
||||
RotatePoint( &pos, GetPosition(), aClockwise ? -900 : 900 );
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
RotatePoint( pos, GetPosition(), aClockwise ? -900 : 900 );
|
||||
field.SetTextPos( pos );
|
||||
}
|
||||
}
|
||||
|
@ -967,14 +967,14 @@ SEARCH_RESULT SCH_LABEL_BASE::Visit( INSPECTOR aInspector, void* testData,
|
|||
|
||||
void SCH_LABEL_BASE::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
|
||||
DANGLING_END_ITEM item( LABEL_END, this, (wxPoint)GetTextPos() );
|
||||
aItemList.push_back( item );
|
||||
}
|
||||
|
||||
|
||||
std::vector<wxPoint> SCH_LABEL_BASE::GetConnectionPoints() const
|
||||
{
|
||||
return { GetTextPos() };
|
||||
return { (wxPoint)GetTextPos() };
|
||||
}
|
||||
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ const EDA_RECT SCH_LABEL_BASE::GetBodyBoundingBox() const
|
|||
EDA_RECT box;
|
||||
std::vector<wxPoint> pts;
|
||||
|
||||
CreateGraphicShape( nullptr, pts, GetTextPos() );
|
||||
CreateGraphicShape( nullptr, pts, (wxPoint)GetTextPos() );
|
||||
|
||||
for( const wxPoint& pt : pts )
|
||||
box.Merge( pt );
|
||||
|
@ -1241,12 +1241,12 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const
|
|||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
||||
wxPoint textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||
VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||
|
||||
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
||||
|
||||
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
|
||||
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, (wxPoint)GetTextPos() );
|
||||
|
||||
if( s_poly.size() )
|
||||
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
|
||||
|
@ -1266,7 +1266,7 @@ void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOf
|
|||
|
||||
EDA_TEXT::Print( aSettings, text_offset, color );
|
||||
|
||||
CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
|
||||
CreateGraphicShape( aSettings, s_poly, (wxPoint)GetTextPos() + aOffset );
|
||||
|
||||
if( !s_poly.empty() )
|
||||
GRPoly( nullptr, DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
|
||||
|
@ -1294,11 +1294,11 @@ const EDA_RECT SCH_LABEL::GetBodyBoundingBox() const
|
|||
if( GetTextAngle() != EDA_ANGLE::ANGLE_0 )
|
||||
{
|
||||
// Rotate rect
|
||||
wxPoint pos = rect.GetOrigin();
|
||||
wxPoint end = rect.GetEnd();
|
||||
VECTOR2I pos = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
|
||||
RotatePoint( &pos, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( &end, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( pos, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( end, GetTextPos(), GetTextAngle() );
|
||||
|
||||
rect.SetOrigin( pos );
|
||||
rect.SetEnd( end );
|
||||
|
@ -1552,8 +1552,8 @@ void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
|
|||
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
}
|
||||
|
||||
wxPoint pos = field.GetTextPos();
|
||||
wxPoint delta = GetPosition() - pos;
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = (VECTOR2I)GetPosition() - pos;
|
||||
|
||||
if( aLeftRight )
|
||||
pos.x = GetPosition().x + delta.x;
|
||||
|
@ -1567,7 +1567,7 @@ void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
|
|||
|
||||
void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter )
|
||||
{
|
||||
wxPoint old_pos = GetPosition();
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
SCH_TEXT::MirrorHorizontally( aCenter );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
|
@ -1577,27 +1577,27 @@ void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter )
|
|||
else
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
|
||||
wxPoint pos = field.GetTextPos();
|
||||
wxPoint delta = old_pos - pos;
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.x = GetPosition().x + delta.x;
|
||||
|
||||
field.SetPosition( pos );
|
||||
field.SetPosition( (wxPoint)pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_GLOBALLABEL::MirrorVertically( int aCenter )
|
||||
{
|
||||
wxPoint old_pos = GetPosition();
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
SCH_TEXT::MirrorVertically( aCenter );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
wxPoint pos = field.GetTextPos();
|
||||
wxPoint delta = old_pos - pos;
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.y = GetPosition().y + delta.y;
|
||||
|
||||
field.SetPosition( pos );
|
||||
field.SetPosition( (wxPoint)pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
||||
wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); }
|
||||
void SetPosition( const wxPoint& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); }
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
|
|
@ -520,7 +520,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
SCH_SHEET* sheet = pin->GetParent();
|
||||
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
|
||||
pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
|
||||
SCH_SHEET* sheet = pin->GetParent();
|
||||
|
||||
pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
|
||||
pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() );
|
||||
}
|
||||
}
|
||||
else if( item->Type() == SCH_FIELD_T )
|
||||
|
@ -787,7 +787,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
|
||||
case SCH_SHEET_T:
|
||||
// Mirror the sheet on itself. Sheets do not have a anchor point.
|
||||
mirrorPoint = m_frame->GetNearestHalfGridPosition( item->GetBoundingBox().Centre() );
|
||||
mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)item->GetBoundingBox().Centre() );
|
||||
|
||||
if( vertical )
|
||||
item->MirrorVertically( mirrorPoint.y );
|
||||
|
|
|
@ -512,7 +512,7 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
|
|||
if( item )
|
||||
{
|
||||
m_selectionTool->AddItemToSel( item );
|
||||
m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter() );
|
||||
m_frame->FocusOnLocation( (wxPoint)item->GetBoundingBox().GetCenter() );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -659,7 +659,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin
|
|||
SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
|
||||
bool oneEndFixed = !line->HasFlag( STARTPOINT ) || !line->HasFlag( ENDPOINT );
|
||||
|
||||
if( line->HitTest( label->GetTextPos(), 1 ) )
|
||||
if( line->HitTest( (wxPoint)label->GetTextPos(), 1 ) )
|
||||
{
|
||||
label->SetFlags( TEMP_SELECTED );
|
||||
aList.push_back( label );
|
||||
|
|
|
@ -442,7 +442,8 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
|
|||
PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
|
||||
PAGE_INFO pageTemp = pageSave;
|
||||
|
||||
wxSize symbolSize = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
|
||||
VECTOR2I symbolSize =
|
||||
symbol->GetUnitBoundingBox( editFrame->GetUnit(),
|
||||
editFrame->GetConvert() ).GetSize();
|
||||
|
||||
// Add a small margin to the plot bounding box
|
||||
|
|
|
@ -45,6 +45,13 @@ wxPoint TRANSFORM::TransformCoordinate( const wxPoint& aPoint ) const
|
|||
( x2 * aPoint.x ) + ( y2 * aPoint.y ) );
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I TRANSFORM::TransformCoordinate( const VECTOR2I& aPoint ) const
|
||||
{
|
||||
return VECTOR2I( ( x1 * aPoint.x ) + ( y1 * aPoint.y ), ( x2 * aPoint.x ) + ( y2 * aPoint.y ) );
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT TRANSFORM::TransformCoordinate( const EDA_RECT& aRect ) const
|
||||
{
|
||||
EDA_RECT rect;
|
||||
|
|
|
@ -71,6 +71,16 @@ public:
|
|||
*/
|
||||
wxPoint TransformCoordinate( const wxPoint& aPoint ) const;
|
||||
|
||||
/**
|
||||
* Calculate a new coordinate according to the mirror/rotation transform.
|
||||
* Useful to calculate actual coordinates of a point
|
||||
* from coordinates relative to a symbol.
|
||||
* which are given for a non rotated, non mirrored item
|
||||
* @param aPoint = The position to transform
|
||||
* @return The transformed coordinate.
|
||||
*/
|
||||
VECTOR2I TransformCoordinate( const VECTOR2I& aPoint ) const;
|
||||
|
||||
/**
|
||||
* Calculate a new rect according to the mirror/rotation transform.
|
||||
* Useful to calculate actual coordinates of a point
|
||||
|
|
|
@ -408,8 +408,8 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
|||
}
|
||||
|
||||
// calculate the corners coordinates in current Gerber axis orientations
|
||||
wxPoint org = GetABPosition( bbox.GetOrigin() );
|
||||
wxPoint end = GetABPosition( bbox.GetEnd() );
|
||||
VECTOR2I org = GetABPosition( bbox.GetOrigin() );
|
||||
VECTOR2I end = GetABPosition( bbox.GetEnd() );
|
||||
|
||||
// Set the corners position:
|
||||
bbox.SetOrigin( org );
|
||||
|
@ -827,7 +827,7 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos, int aAccuracy ) const
|
|||
|
||||
// This is similar to a segment with thickness = min( m_Size.x, m_Size.y )
|
||||
int radius = std::min( m_Size.x, m_Size.y )/2;
|
||||
wxPoint start, end;
|
||||
VECTOR2I start, end;
|
||||
|
||||
if( m_Size.x > m_Size.y ) // Horizontal oval
|
||||
{
|
||||
|
|
|
@ -422,8 +422,8 @@ public:
|
|||
const PAGE_INFO& GetPageSettings() const override;
|
||||
const wxSize GetPageSizeIU() const override;
|
||||
|
||||
const wxPoint& GetGridOrigin() const override { return m_grid_origin; }
|
||||
void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; }
|
||||
const VECTOR2I& GetGridOrigin() const override { return m_grid_origin; }
|
||||
void SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; }
|
||||
|
||||
const TITLE_BLOCK& GetTitleBlock() const override;
|
||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
|
||||
|
@ -520,7 +520,7 @@ private:
|
|||
|
||||
GBR_LAYOUT* m_gerberLayout;
|
||||
int m_activeLayer;
|
||||
wxPoint m_grid_origin;
|
||||
VECTOR2I m_grid_origin;
|
||||
PAGE_INFO m_paper; // used only to show paper limits to screen
|
||||
wxStaticText* m_cmpText; // a message on the auxiliary toolbar,
|
||||
// relative to the m_SelComponentBox
|
||||
|
|
|
@ -645,11 +645,11 @@ public:
|
|||
|
||||
int GetLayerClass( PCB_LAYER_ID aLayer ) const;
|
||||
|
||||
void SetAuxOrigin( const wxPoint& aOrigin ) { m_auxOrigin = aOrigin; }
|
||||
const wxPoint& GetAuxOrigin() { return m_auxOrigin; }
|
||||
void SetAuxOrigin( const VECTOR2I& aOrigin ) { m_auxOrigin = aOrigin; }
|
||||
const VECTOR2I& GetAuxOrigin() { return m_auxOrigin; }
|
||||
|
||||
void SetGridOrigin( const wxPoint& aOrigin ) { m_gridOrigin = aOrigin; }
|
||||
const wxPoint& GetGridOrigin() { return m_gridOrigin; }
|
||||
void SetGridOrigin( const VECTOR2I& aOrigin ) { m_gridOrigin = aOrigin; }
|
||||
const VECTOR2I& GetGridOrigin() { return m_gridOrigin; }
|
||||
|
||||
private:
|
||||
void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
|
||||
|
@ -756,8 +756,8 @@ public:
|
|||
bool m_UseHeightForLengthCalcs;
|
||||
|
||||
private:
|
||||
wxPoint m_auxOrigin; ///< origin for plot exports
|
||||
wxPoint m_gridOrigin; ///< origin for grid offsets
|
||||
VECTOR2I m_auxOrigin; ///< origin for plot exports
|
||||
VECTOR2I m_gridOrigin; ///< origin for grid offsets
|
||||
|
||||
// Indices into the trackWidth, viaSizes and diffPairDimensions lists.
|
||||
// The 0 index is always the current netclass value(s)
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
*/
|
||||
virtual wxPoint GetCenter() const
|
||||
{
|
||||
return GetBoundingBox().GetCenter();
|
||||
return (wxPoint)GetBoundingBox().GetCenter();
|
||||
}
|
||||
|
||||
void SetX( int aX )
|
||||
|
|
|
@ -316,7 +316,7 @@ public:
|
|||
|
||||
void SetTextAngle( double aAngle ) override;
|
||||
|
||||
wxPoint GetPosition() const override { return GetTextPos(); }
|
||||
wxPoint GetPosition() const override { return (wxPoint)GetTextPos(); }
|
||||
void SetPosition( const wxPoint& aPos ) override { SetTextPos( aPos ); }
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
|
|
@ -135,8 +135,8 @@ public:
|
|||
* This is treated as a relative offset and snapping will occur at multiples of the grid
|
||||
* size relative to this point.
|
||||
*/
|
||||
virtual const wxPoint& GetGridOrigin() const = 0;
|
||||
virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
|
||||
virtual const VECTOR2I& GetGridOrigin() const = 0;
|
||||
virtual void SetGridOrigin( const VECTOR2I& aPosition ) = 0;
|
||||
|
||||
/**
|
||||
* Return the nearest \a aGridSize location to \a aPosition.
|
||||
|
|
|
@ -44,14 +44,14 @@ class EDA_RECT
|
|||
public:
|
||||
EDA_RECT() : m_init( false ) { };
|
||||
|
||||
EDA_RECT( const wxPoint& aPos, const wxSize& aSize ) :
|
||||
EDA_RECT( const VECTOR2I& aPos, const VECTOR2I& aSize ) :
|
||||
m_pos( aPos ),
|
||||
m_size( aSize ),
|
||||
m_init( true )
|
||||
{ }
|
||||
|
||||
EDA_RECT( const VECTOR2I& aPos, const VECTOR2I& aSize ) :
|
||||
EDA_RECT( wxPoint( aPos.x, aPos.y ), wxSize( aSize.x, aSize.y ) )
|
||||
EDA_RECT( const wxPoint& aPos, const wxSize& aSize ) :
|
||||
EDA_RECT( VECTOR2I( aPos.x, aPos.y ), VECTOR2I( aSize.x, aSize.y ) )
|
||||
{ }
|
||||
|
||||
template<class T>
|
||||
|
@ -65,9 +65,9 @@ public:
|
|||
|
||||
virtual ~EDA_RECT() { };
|
||||
|
||||
wxPoint Centre() const
|
||||
VECTOR2I Centre() const
|
||||
{
|
||||
return wxPoint( m_pos.x + ( m_size.x >> 1 ), m_pos.y + ( m_size.y >> 1 ) );
|
||||
return VECTOR2I( m_pos.x + ( m_size.x >> 1 ), m_pos.y + ( m_size.y >> 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
*
|
||||
* @param aMoveVector A wxPoint that is the value to move this rectangle.
|
||||
*/
|
||||
void Move( const wxPoint& aMoveVector );
|
||||
void Move( const VECTOR2I& aMoveVector );
|
||||
|
||||
/**
|
||||
* Ensures that the height ant width are positive.
|
||||
|
@ -86,14 +86,14 @@ public:
|
|||
* @param aPoint the wxPoint to test.
|
||||
* @return true if aPoint is inside the boundary box. A point on a edge is seen as inside.
|
||||
*/
|
||||
bool Contains( const wxPoint& aPoint ) const;
|
||||
bool Contains( const VECTOR2I& aPoint ) const;
|
||||
|
||||
/**
|
||||
* @param x the x coordinate of the point to test.
|
||||
* @param y the x coordinate of the point to test.
|
||||
* @return true if point is inside the boundary box. A point on a edge is seen as inside
|
||||
*/
|
||||
bool Contains( int x, int y ) const { return Contains( wxPoint( x, y ) ); }
|
||||
bool Contains( int x, int y ) const { return Contains( VECTOR2I( x, y ) ); }
|
||||
|
||||
/**
|
||||
* @param aRect the EDA_RECT to test.
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
*/
|
||||
bool Contains( const EDA_RECT& aRect ) const;
|
||||
|
||||
const wxSize GetSize() const { return m_size; }
|
||||
const VECTOR2I GetSize() const { return m_size; }
|
||||
|
||||
/**
|
||||
* @return the max size dimension.
|
||||
|
@ -111,12 +111,12 @@ public:
|
|||
int GetX() const { return m_pos.x; }
|
||||
int GetY() const { return m_pos.y; }
|
||||
|
||||
const wxPoint GetOrigin() const { return m_pos; }
|
||||
const wxPoint GetPosition() const { return m_pos; }
|
||||
const wxPoint GetEnd() const { return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y ); }
|
||||
const wxPoint GetCenter() const
|
||||
const VECTOR2I GetOrigin() const { return m_pos; }
|
||||
const VECTOR2I GetPosition() const { return m_pos; }
|
||||
const VECTOR2I GetEnd() const { return VECTOR2I( m_pos.x + m_size.x, m_pos.y + m_size.y ); }
|
||||
const VECTOR2I GetCenter() const
|
||||
{
|
||||
return wxPoint( m_pos.x + ( m_size.x / 2 ), m_pos.y + ( m_size.y / 2 ) );
|
||||
return VECTOR2I( m_pos.x + ( m_size.x / 2 ), m_pos.y + ( m_size.y / 2 ) );
|
||||
}
|
||||
|
||||
int GetWidth() const { return m_size.x; }
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
return m_init;
|
||||
}
|
||||
|
||||
void SetOrigin( const wxPoint& pos )
|
||||
void SetOrigin( const VECTOR2I& pos )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_init = true;
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
m_init = true;
|
||||
}
|
||||
|
||||
void SetSize( const wxSize& size )
|
||||
void SetSize( const VECTOR2I& size )
|
||||
{
|
||||
m_size = size;
|
||||
m_init = true;
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
m_pos.y += dy;
|
||||
}
|
||||
|
||||
void Offset( const wxPoint& offset )
|
||||
void Offset( const VECTOR2I& offset )
|
||||
{
|
||||
m_pos += offset;
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ public:
|
|||
|
||||
void SetEnd( int x, int y )
|
||||
{
|
||||
SetEnd( wxPoint( x, y ) );
|
||||
SetEnd( VECTOR2I( x, y ) );
|
||||
m_init = true;
|
||||
}
|
||||
|
||||
void SetEnd( const wxPoint& pos )
|
||||
void SetEnd( const VECTOR2I& pos )
|
||||
{
|
||||
m_size.x = pos.x - m_pos.x;
|
||||
m_size.y = pos.y - m_pos.y;
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
* @return true if the argument segment intersects this rectangle.
|
||||
* (i.e. if the segment and rectangle have at least a common point)
|
||||
*/
|
||||
bool Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const;
|
||||
bool Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2 ) const;
|
||||
|
||||
/**
|
||||
* Test for intersection between a segment and this rectangle, returning the intersections.
|
||||
|
@ -251,8 +251,8 @@ public:
|
|||
* @param aIntersection2 will be filled with the second intersection point, if any.
|
||||
* @return true if the segment intersects the rect.
|
||||
*/
|
||||
bool Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2,
|
||||
wxPoint* aIntersection1, wxPoint* aIntersection2 ) const;
|
||||
bool Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2, VECTOR2I* aIntersection1,
|
||||
VECTOR2I* aIntersection2 ) const;
|
||||
|
||||
/**
|
||||
* Return the point in this rect that is closest to the provided point
|
||||
|
@ -290,7 +290,7 @@ public:
|
|||
{
|
||||
EDA_RECT rect( m_pos, m_size );
|
||||
rect.Normalize();
|
||||
return wxRect( rect.m_pos, rect.m_size );
|
||||
return wxRect( (wxPoint)rect.m_pos, (wxSize)rect.m_size );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -355,12 +355,12 @@ public:
|
|||
* @param aRotCenter the rotation point.
|
||||
* @return the bounding box of this, after rotation.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBoxRotated( const wxPoint& aRotCenter, double aAngle ) const;
|
||||
const EDA_RECT GetBoundingBoxRotated( const VECTOR2I& aRotCenter, double aAngle ) const;
|
||||
|
||||
private:
|
||||
wxPoint m_pos; // Rectangle Origin
|
||||
wxSize m_size; // Rectangle Size
|
||||
bool m_init; // Is the rectangle initialized
|
||||
VECTOR2I m_pos; // Rectangle Origin
|
||||
VECTOR2I m_size; // Rectangle Size
|
||||
bool m_init; // Is the rectangle initialized
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -224,8 +224,8 @@ public:
|
|||
void SetTextHeight( int aHeight ) { m_attributes.m_Size.y = aHeight; }
|
||||
int GetTextHeight() const { return m_attributes.m_Size.y; }
|
||||
|
||||
void SetTextPos( const wxPoint& aPoint ) { m_pos = aPoint; }
|
||||
const wxPoint& GetTextPos() const { return m_pos; }
|
||||
void SetTextPos( const VECTOR2I& aPoint ) { m_pos = aPoint; }
|
||||
const VECTOR2I& GetTextPos() const { return m_pos; }
|
||||
|
||||
void SetTextX( int aX ) { m_pos.x = aX; }
|
||||
void SetTextY( int aY ) { m_pos.y = aY; }
|
||||
|
@ -346,7 +346,7 @@ public:
|
|||
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
|
||||
|
||||
virtual EDA_ANGLE GetDrawRotation() const { return GetTextAngle(); }
|
||||
virtual wxPoint GetDrawPos() const { return GetTextPos(); }
|
||||
virtual wxPoint GetDrawPos() const { return (wxPoint)GetTextPos(); }
|
||||
virtual GR_TEXT_H_ALIGN_T GetDrawHorizJustify() const { return GetHorizJustify(); };
|
||||
virtual GR_TEXT_V_ALIGN_T GetDrawVertJustify() const { return GetVertJustify(); };
|
||||
|
||||
|
@ -364,16 +364,16 @@ private:
|
|||
* @param aText the single line of text to draw.
|
||||
* @param aPos the position of this line ).
|
||||
*/
|
||||
void printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||
void printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
||||
const COLOR4D& aColor, OUTLINE_MODE aFillMode, const wxString& aText,
|
||||
const wxPoint& aPos );
|
||||
const VECTOR2I& aPos );
|
||||
|
||||
wxString m_text;
|
||||
wxString m_shown_text; // Cache of unescaped text for efficient access
|
||||
bool m_shown_text_has_text_var_refs;
|
||||
|
||||
TEXT_ATTRIBUTES m_attributes;
|
||||
wxPoint m_pos;
|
||||
VECTOR2I m_pos;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -136,12 +136,12 @@ public:
|
|||
const PAGE_INFO& GetPageSettings() const override;
|
||||
const wxSize GetPageSizeIU() const override;
|
||||
|
||||
const wxPoint& GetGridOrigin() const override;
|
||||
void SetGridOrigin( const wxPoint& aPoint ) override;
|
||||
const VECTOR2I& GetGridOrigin() const override;
|
||||
void SetGridOrigin( const VECTOR2I& aPoint ) override;
|
||||
|
||||
const wxPoint& GetAuxOrigin() const;
|
||||
const VECTOR2I& GetAuxOrigin() const;
|
||||
|
||||
const wxPoint GetUserOrigin() const;
|
||||
const VECTOR2I GetUserOrigin() const;
|
||||
|
||||
/**
|
||||
* Return a reference to the default ORIGIN_TRANSFORMS object
|
||||
|
|
|
@ -127,6 +127,16 @@ public:
|
|||
return wxPoint( x, y );
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the cast to wxPoint.
|
||||
*
|
||||
* @return the vector cast to wxPoint.
|
||||
*/
|
||||
explicit operator wxSize() const
|
||||
{
|
||||
return wxSize( x, y );
|
||||
}
|
||||
|
||||
// virtual ~VECTOR2();
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,9 +55,9 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
|
|||
* @return bool - true if the two segments defined by four points intersect.
|
||||
* (i.e. if the 2 segments have at least a common point)
|
||||
*/
|
||||
bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
|
||||
const wxPoint& a_p1_l2, const wxPoint& a_p2_l2,
|
||||
wxPoint* aIntersectionPoint = nullptr );
|
||||
bool SegmentIntersectsSegment( const VECTOR2I& a_p1_l1, const VECTOR2I& a_p2_l1,
|
||||
const VECTOR2I& a_p1_l2, const VECTOR2I& a_p2_l2,
|
||||
VECTOR2I* aIntersectionPoint = nullptr );
|
||||
|
||||
/*
|
||||
* Calculate the new point of coord coord pX, pY,
|
||||
|
@ -94,8 +94,18 @@ inline void RotatePoint( wxPoint* point, EDA_ANGLE angle )
|
|||
RotatePoint( &point->x, &point->y, angle.AsTenthsOfADegree() );
|
||||
}
|
||||
|
||||
inline void RotatePoint( VECTOR2I& point, EDA_ANGLE angle )
|
||||
{
|
||||
RotatePoint( &point.x, &point.y, angle.AsTenthsOfADegree() );
|
||||
}
|
||||
|
||||
void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, double angle );
|
||||
|
||||
inline void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, EDA_ANGLE angle )
|
||||
{
|
||||
RotatePoint( point, centre, angle.AsTenthsOfADegree() );
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the new coord point point for a center rotation center and angle in (1/10 degree).
|
||||
*/
|
||||
|
@ -226,7 +236,7 @@ inline double CrossProduct( const wxPoint& vectorA, const wxPoint& vectorB )
|
|||
* @param aEnd is the second end-point of the line segment
|
||||
* @param aDist = maximum distance for hit
|
||||
*/
|
||||
bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd,
|
||||
bool TestSegmentHit( const VECTOR2I& aRefPoint, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
int aDist );
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,9 +58,9 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
|
|||
|
||||
|
||||
// Returns true if the segment 1 intersected the segment 2.
|
||||
bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
|
||||
const wxPoint& a_p1_l2, const wxPoint& a_p2_l2,
|
||||
wxPoint* aIntersectionPoint )
|
||||
bool SegmentIntersectsSegment( const VECTOR2I& a_p1_l1, const VECTOR2I& a_p2_l1,
|
||||
const VECTOR2I& a_p1_l2, const VECTOR2I& a_p2_l2,
|
||||
VECTOR2I* aIntersectionPoint )
|
||||
{
|
||||
|
||||
//We are forced to use 64bit ints because the internal units can overflow 32bit ints when
|
||||
|
@ -126,14 +126,14 @@ bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
|
|||
}
|
||||
|
||||
|
||||
bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd,
|
||||
bool TestSegmentHit( const VECTOR2I& aRefPoint, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
int aDist )
|
||||
{
|
||||
int xmin = aStart.x;
|
||||
int xmax = aEnd.x;
|
||||
int ymin = aStart.y;
|
||||
int ymax = aEnd.y;
|
||||
wxPoint delta = aStart - aRefPoint;
|
||||
VECTOR2I delta = aStart - aRefPoint;
|
||||
|
||||
if( xmax < xmin )
|
||||
std::swap( xmax, xmin );
|
||||
|
|
|
@ -107,8 +107,8 @@ public:
|
|||
PL_DRAW_PANEL_GAL* GetCanvas() const override;
|
||||
SELECTION& GetCurrentSelection() override;
|
||||
|
||||
const wxPoint& GetGridOrigin() const override { return m_grid_origin; }
|
||||
void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; }
|
||||
const VECTOR2I& GetGridOrigin() const override { return m_grid_origin; }
|
||||
void SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; }
|
||||
|
||||
/**
|
||||
* Calculate the position (in page, in iu) of the corner used as coordinate origin
|
||||
|
@ -284,7 +284,7 @@ private:
|
|||
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
||||
// useful when there are some items which are
|
||||
// only on page 1, not on page 1
|
||||
wxPoint m_grid_origin;
|
||||
VECTOR2I m_grid_origin;
|
||||
};
|
||||
|
||||
#endif /* _PL_EDITOR_FRAME_H */
|
||||
|
|
|
@ -356,7 +356,7 @@ void AR_AUTOPLACER::buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance )
|
|||
fpBBox.Inflate( ( m_matrix.m_GridRouting / 2 ) + aFpClearance );
|
||||
|
||||
// Add a minimal area to the fp area:
|
||||
addFpBody( fpBBox.GetOrigin(), fpBBox.GetEnd(), layerMask );
|
||||
addFpBody( (wxPoint)fpBBox.GetOrigin(), (wxPoint)fpBBox.GetEnd(), layerMask );
|
||||
|
||||
// Trace pads + clearance areas.
|
||||
for( PAD* pad : aFootprint->Pads() )
|
||||
|
@ -438,8 +438,8 @@ int AR_AUTOPLACER::testRectangle( const EDA_RECT& aRect, int side )
|
|||
|
||||
rect.Inflate( m_matrix.m_GridRouting / 2 );
|
||||
|
||||
wxPoint start = rect.GetOrigin();
|
||||
wxPoint end = rect.GetEnd();
|
||||
VECTOR2I start = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
|
||||
start -= m_matrix.m_BrdBox.GetOrigin();
|
||||
end -= m_matrix.m_BrdBox.GetOrigin();
|
||||
|
@ -487,8 +487,8 @@ int AR_AUTOPLACER::testRectangle( const EDA_RECT& aRect, int side )
|
|||
|
||||
unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int side )
|
||||
{
|
||||
wxPoint start = aRect.GetOrigin();
|
||||
wxPoint end = aRect.GetEnd();
|
||||
VECTOR2I start = aRect.GetOrigin();
|
||||
VECTOR2I end = aRect.GetEnd();
|
||||
|
||||
start -= m_matrix.m_BrdBox.GetOrigin();
|
||||
end -= m_matrix.m_BrdBox.GetOrigin();
|
||||
|
@ -575,7 +575,7 @@ int AR_AUTOPLACER::testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSid
|
|||
int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
|
||||
{
|
||||
int error = 1;
|
||||
wxPoint lastPosOK;
|
||||
VECTOR2I lastPosOK;
|
||||
double min_cost, curr_cost, Score;
|
||||
bool testOtherSide;
|
||||
|
||||
|
@ -586,18 +586,18 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
|
|||
|
||||
// Move fpBBox to have the footprint position at (0,0)
|
||||
fpBBox.Move( -fpPos );
|
||||
wxPoint fpBBoxOrg = fpBBox.GetOrigin();
|
||||
VECTOR2I fpBBoxOrg = fpBBox.GetOrigin();
|
||||
|
||||
// Calculate the limit of the footprint position, relative to the routing matrix area
|
||||
wxPoint xylimit = m_matrix.m_BrdBox.GetEnd() - fpBBox.GetEnd();
|
||||
VECTOR2I xylimit = m_matrix.m_BrdBox.GetEnd() - fpBBox.GetEnd();
|
||||
|
||||
wxPoint initialPos = m_matrix.m_BrdBox.GetOrigin() - fpBBoxOrg;
|
||||
VECTOR2I initialPos = m_matrix.m_BrdBox.GetOrigin() - fpBBoxOrg;
|
||||
|
||||
// Stay on grid.
|
||||
initialPos.x -= initialPos.x % m_matrix.m_GridRouting;
|
||||
initialPos.y -= initialPos.y % m_matrix.m_GridRouting;
|
||||
|
||||
m_curPosition = initialPos;
|
||||
m_curPosition = (wxPoint)initialPos;
|
||||
wxPoint fpOffset = fpPos - m_curPosition;
|
||||
|
||||
// Examine pads, and set testOtherSide to true if a footprint has at least 1 pad through.
|
||||
|
@ -657,7 +657,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
|
|||
}
|
||||
|
||||
// Regeneration of the modified variable.
|
||||
m_curPosition = lastPosOK;
|
||||
m_curPosition = (wxPoint)lastPosOK;
|
||||
|
||||
m_minCost = min_cost;
|
||||
return error;
|
||||
|
|
|
@ -67,7 +67,7 @@ bool AR_MATRIX::ComputeMatrixSize( const EDA_RECT& aBoundingBox )
|
|||
m_BrdBox.SetY( m_BrdBox.GetY() - ( m_BrdBox.GetY() % m_GridRouting ) );
|
||||
|
||||
// The boundary box must have its end point on routing grid:
|
||||
wxPoint end = m_BrdBox.GetEnd();
|
||||
VECTOR2I end = m_BrdBox.GetEnd();
|
||||
|
||||
end.x -= end.x % m_GridRouting;
|
||||
end.x += m_GridRouting;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
*/
|
||||
wxPoint GetBrdCoordOrigin()
|
||||
{
|
||||
return m_BrdBox.GetOrigin();
|
||||
return (wxPoint)m_BrdBox.GetOrigin();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -168,8 +168,9 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector <FOOTPRIN
|
|||
FOOTPRINT* footprint = aFootprintList[vecSubRects[it].n];
|
||||
|
||||
EDA_RECT fpBBox = footprint->GetBoundingBox( false, false );
|
||||
wxPoint mod_pos = pos + ( footprint->GetPosition() - fpBBox.GetOrigin() )
|
||||
+ aFreeArea.GetOrigin();
|
||||
wxPoint mod_pos =
|
||||
pos + ( footprint->GetPosition() - (wxPoint)fpBBox.GetOrigin() )
|
||||
+ (wxPoint) aFreeArea.GetOrigin();
|
||||
|
||||
footprint->Move( mod_pos - footprint->GetPosition() );
|
||||
}
|
||||
|
@ -260,7 +261,8 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, wxPoint aSpreadArea
|
|||
|
||||
if( pass == 1 )
|
||||
{
|
||||
wxPoint areapos = placementSheetAreas[subareaIdx].GetOrigin()
|
||||
VECTOR2I areapos =
|
||||
placementSheetAreas[subareaIdx].GetOrigin()
|
||||
+ aSpreadAreaPosition;
|
||||
freeArea.SetOrigin( areapos );
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ public:
|
|||
|
||||
wxPoint GetPosition() const override;
|
||||
void SetPosition( const wxPoint& aPos ) override;
|
||||
const wxPoint GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
|
||||
const wxPoint GetFocusPosition() const override { return (wxPoint)GetBoundingBox().GetCenter(); }
|
||||
|
||||
bool IsEmpty() const
|
||||
{
|
||||
|
|
|
@ -319,7 +319,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
|||
plot_opts.SetFormat( PLOT_FORMAT::SVG );
|
||||
|
||||
PAGE_INFO savedPageInfo = m_board->GetPageSettings();
|
||||
wxPoint savedAuxOrigin = m_board->GetDesignSettings().GetAuxOrigin();
|
||||
VECTOR2I savedAuxOrigin = m_board->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
if( m_rbSvgPageSizeOpt->GetSelection() == 2 ) // Page is board boundary size
|
||||
{
|
||||
|
@ -330,7 +330,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
|||
currpageInfo.SetHeightMils( bbox.GetHeight() / IU_PER_MILS );
|
||||
m_board->SetPageSettings( currpageInfo );
|
||||
plot_opts.SetUseAuxOrigin( true );
|
||||
wxPoint origin = bbox.GetOrigin();
|
||||
VECTOR2I origin = bbox.GetOrigin();
|
||||
m_board->GetDesignSettings().SetAuxOrigin( origin );
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
|
|||
{
|
||||
// Origin = board center:
|
||||
BOARD* pcb = GetBoard();
|
||||
wxPoint center = pcb->GetBoundingBox().GetCenter();
|
||||
VECTOR2I center = pcb->GetBoundingBox().GetCenter();
|
||||
aXRef = Iu2Millimeter( center.x );
|
||||
aYRef = Iu2Millimeter( center.y );
|
||||
}
|
||||
|
|
|
@ -341,7 +341,7 @@ void DIALOG_GENDRILL::UpdateDrillParams()
|
|||
m_UseRouteModeForOvalHoles = m_radioBoxOvalHoleMode->GetSelection() == 0;
|
||||
|
||||
if( m_Choice_Drill_Offset->GetSelection() == 0 )
|
||||
m_DrillFileOffset = wxPoint( 0, 0 );
|
||||
m_DrillFileOffset = VECTOR2I( 0, 0 );
|
||||
else
|
||||
m_DrillFileOffset = m_board->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
static bool m_Mirror;
|
||||
static bool m_Merge_PTH_NPTH;
|
||||
DRILL_PRECISION m_Precision; // Precision for drill files, in non decimal format
|
||||
wxPoint m_DrillFileOffset; // Drill offset: 0,0 for absolute coordinates,
|
||||
VECTOR2I m_DrillFileOffset; // Drill offset: 0,0 for absolute coordinates,
|
||||
// or origin of the auxiliary axis
|
||||
static bool m_UseRouteModeForOvalHoles; // True to use a G00 route command for oval holes
|
||||
// False to use a G85 canned mode for oval holes
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
DIALOG_POSITION_RELATIVE::POSITION_RELATIVE_OPTIONS DIALOG_POSITION_RELATIVE::m_options;
|
||||
|
||||
|
||||
DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxPoint& translation,
|
||||
wxPoint& anchor ) :
|
||||
DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, VECTOR2I& translation,
|
||||
VECTOR2I& anchor ) :
|
||||
DIALOG_POSITION_RELATIVE_BASE( aParent ),
|
||||
m_toolMgr( aParent->GetToolManager() ),
|
||||
m_translation( translation ),
|
||||
|
@ -182,7 +182,7 @@ void DIALOG_POSITION_RELATIVE::OnClear( wxCommandEvent& event )
|
|||
POSITION_RELATIVE_TOOL* posrelTool = m_toolMgr->GetTool<POSITION_RELATIVE_TOOL>();
|
||||
wxASSERT( posrelTool );
|
||||
|
||||
wxPoint offset = posrelTool->GetSelectionAnchorPosition() - m_anchor_position;
|
||||
VECTOR2I offset = posrelTool->GetSelectionAnchorPosition() - m_anchor_position;
|
||||
double r, q;
|
||||
ToPolarDeg( offset.x, offset.y, r, q );
|
||||
|
||||
|
@ -245,7 +245,7 @@ void DIALOG_POSITION_RELATIVE::OnUseUserOriginClick( wxCommandEvent& event )
|
|||
{
|
||||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) m_toolMgr->GetToolHolder();
|
||||
|
||||
m_anchor_position = (wxPoint) frame->GetScreen()->m_LocalOrigin;
|
||||
m_anchor_position = frame->GetScreen()->m_LocalOrigin;
|
||||
m_referenceInfo->SetLabel( _( "Reference location: local coordinates origin" ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class DIALOG_POSITION_RELATIVE : public DIALOG_POSITION_RELATIVE_BASE
|
|||
{
|
||||
public:
|
||||
// Constructor and destructor
|
||||
DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxPoint& translation, wxPoint& anchor );
|
||||
DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, VECTOR2I& translation, VECTOR2I& anchor );
|
||||
~DIALOG_POSITION_RELATIVE() { };
|
||||
|
||||
void UpdateAnchor( EDA_ITEM* aItem );
|
||||
|
@ -96,8 +96,8 @@ private:
|
|||
static POSITION_RELATIVE_OPTIONS m_options;
|
||||
|
||||
TOOL_MANAGER* m_toolMgr;
|
||||
wxPoint& m_translation;
|
||||
wxPoint& m_anchor_position;
|
||||
VECTOR2I& m_translation;
|
||||
VECTOR2I& m_anchor_position;
|
||||
|
||||
UNIT_BINDER m_xOffset;
|
||||
UNIT_BINDER m_yOffset;
|
||||
|
|
|
@ -114,7 +114,7 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
|
|||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
|
||||
drcItem->SetItems( m_board );
|
||||
|
||||
reportViolation( drcItem, m_board->GetBoundingBox().Centre(), Edge_Cuts );
|
||||
reportViolation( drcItem, (wxPoint)m_board->GetBoundingBox().Centre(), Edge_Cuts );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ static int iu_to_d356(int iu, int clamp)
|
|||
/* Extract the D356 record from the footprints (pads) */
|
||||
static void build_pad_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecords )
|
||||
{
|
||||
wxPoint origin = aPcb->GetDesignSettings().GetAuxOrigin();
|
||||
VECTOR2I origin = aPcb->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
for( FOOTPRINT* footprint : aPcb->Footprints() )
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ static int via_access_code( BOARD *aPcb, int top_layer, int bottom_layer )
|
|||
/* Extract the D356 record from the vias */
|
||||
static void build_via_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecords )
|
||||
{
|
||||
wxPoint origin = aPcb->GetDesignSettings().GetAuxOrigin();
|
||||
VECTOR2I origin = aPcb->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
// Enumerate all the track segments and keep the vias
|
||||
for( auto track : aPcb->Tracks() )
|
||||
|
|
|
@ -97,7 +97,7 @@ PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, bool aOn
|
|||
if( aUseAuxOrigin )
|
||||
m_place_Offset = m_board->GetDesignSettings().GetAuxOrigin();
|
||||
else
|
||||
m_place_Offset = wxPoint( 0, 0 );
|
||||
m_place_Offset = VECTOR2I( 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,7 +173,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
|
||||
for( int ii = 0; ii < m_fpCount; ii++ )
|
||||
{
|
||||
wxPoint footprint_pos;
|
||||
VECTOR2I footprint_pos;
|
||||
footprint_pos = list[ii].m_Footprint->GetPosition();
|
||||
footprint_pos -= m_place_Offset;
|
||||
|
||||
|
@ -239,7 +239,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
|
||||
for( int ii = 0; ii < m_fpCount; ii++ )
|
||||
{
|
||||
wxPoint footprint_pos;
|
||||
VECTOR2I footprint_pos;
|
||||
footprint_pos = list[ii].m_Footprint->GetPosition();
|
||||
footprint_pos -= m_place_Offset;
|
||||
|
||||
|
@ -280,7 +280,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
{
|
||||
std::string buffer;
|
||||
|
||||
m_place_Offset = wxPoint( 0, 0 );
|
||||
m_place_Offset = VECTOR2I( 0, 0 );
|
||||
|
||||
// Select units:
|
||||
double conv_unit = m_unitsMM ? conv_unit_mm : conv_unit_inch;
|
||||
|
@ -351,7 +351,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
|
||||
buffer += "\n";
|
||||
|
||||
wxPoint footprint_pos = footprint->GetPosition();
|
||||
VECTOR2I footprint_pos = footprint->GetPosition();
|
||||
footprint_pos -= m_place_Offset;
|
||||
|
||||
sprintf( line, "position %9.6f %9.6f orientation %.2f\n",
|
||||
|
|
|
@ -90,14 +90,14 @@ public:
|
|||
static std::string GetBackSideName() { return std::string( "bottom" ); }
|
||||
|
||||
private:
|
||||
BOARD* m_board;
|
||||
bool m_unitsMM; // true for mm, false for inches
|
||||
bool m_onlySMD; // Include only SMD components
|
||||
bool m_excludeAllTH; // Exclude any footprints with through-hole pads
|
||||
int m_side; // PCB_BACK_SIDE, PCB_FRONT_SIDE, PCB_BOTH_SIDES
|
||||
bool m_formatCSV; // true for csv format, false for ascii (utf8) format
|
||||
int m_fpCount; // Number of footprints in list, for info
|
||||
wxPoint m_place_Offset; // Offset for coordinates in generated data.
|
||||
BOARD* m_board;
|
||||
bool m_unitsMM; // true for mm, false for inches
|
||||
bool m_onlySMD; // Include only SMD components
|
||||
bool m_excludeAllTH; // Exclude any footprints with through-hole pads
|
||||
int m_side; // PCB_BACK_SIDE, PCB_FRONT_SIDE, PCB_BOTH_SIDES
|
||||
bool m_formatCSV; // true for csv format, false for ascii (utf8) format
|
||||
int m_fpCount; // Number of footprints in list, for info
|
||||
VECTOR2I m_place_Offset; // Offset for coordinates in generated data.
|
||||
};
|
||||
|
||||
#endif // #ifndef EXPORT_FOOTPRINTS_PLACEFILE_H
|
||||
|
|
|
@ -272,7 +272,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
|
|||
GetBoard()->ComputeBoundingBox();
|
||||
|
||||
// Save the auxiliary origin for the rest of the footprint
|
||||
wxPoint auxOrigin = m_pcb->GetDesignSettings().GetAuxOrigin();
|
||||
VECTOR2I auxOrigin = m_pcb->GetDesignSettings().GetAuxOrigin();
|
||||
GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.x : 0;
|
||||
GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.y : 0;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
|||
// for the right holes set (PTH, NPTH, buried/blind vias ...)
|
||||
|
||||
double scale = 1.0;
|
||||
wxPoint offset = GetOffset();
|
||||
VECTOR2I offset = GetOffset();
|
||||
PLOTTER* plotter = nullptr;
|
||||
PAGE_INFO dummy( PAGE_INFO::A4, false );
|
||||
int bottom_limit = 0; // Y coord limit of page. 0 mean do not use
|
||||
|
@ -440,7 +440,7 @@ bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName )
|
|||
bool GENDRILL_WRITER_BASE::plotDrillMarks( PLOTTER* aPlotter )
|
||||
{
|
||||
// Plot the drill map:
|
||||
wxPoint pos;
|
||||
VECTOR2I pos;
|
||||
|
||||
for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ bool GENDRILL_WRITER_BASE::plotDrillMarks( PLOTTER* aPlotter )
|
|||
|
||||
if( hole.m_Hole_Shape != 0 )
|
||||
{
|
||||
wxSize oblong_size = hole.m_Hole_Size;
|
||||
VECTOR2I oblong_size = hole.m_Hole_Size;
|
||||
aPlotter->FlashPadOval( pos, oblong_size, hole.m_Hole_Orient, SKETCH, nullptr );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
/**
|
||||
* Return the plot offset (usually the position of the auxiliary axis.
|
||||
*/
|
||||
wxPoint GetOffset() { return m_offset; }
|
||||
VECTOR2I GetOffset() { return m_offset; }
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
* @param aMerge_PTH_NPTH set to true to create only one file containing PTH and NPTH
|
||||
* false to create 2 separate files : one for PTH and one for NPTH.
|
||||
*/
|
||||
void SetOptions( bool aMirror, bool aMinimalHeader, const wxPoint& aOffset,
|
||||
void SetOptions( bool aMirror, bool aMinimalHeader, const VECTOR2I& aOffset,
|
||||
bool aMerge_PTH_NPTH )
|
||||
{
|
||||
m_mirror = aMirror;
|
||||
|
|
|
@ -103,10 +103,10 @@ public:
|
|||
// size y).
|
||||
int m_Tool_Reference; // Tool reference for this hole = 1 ... n (values <=0
|
||||
// must not be used).
|
||||
wxSize m_Hole_Size; // hole size for oblong holes
|
||||
VECTOR2I m_Hole_Size; // hole size for oblong holes
|
||||
double m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes
|
||||
int m_Hole_Shape; // hole shape: round (0) or oval (1)
|
||||
wxPoint m_Hole_Pos; // hole position
|
||||
VECTOR2I m_Hole_Pos; // hole position
|
||||
PCB_LAYER_ID m_Hole_Bottom_Layer; // hole ending layer (usually back layer)
|
||||
PCB_LAYER_ID m_Hole_Top_Layer; // hole starting layer (usually front layer):
|
||||
// m_Hole_Top_Layer < m_Hole_Bottom_Layer
|
||||
|
@ -180,7 +180,7 @@ public:
|
|||
/**
|
||||
* Return the plot offset (usually the position of the drill/place origin).
|
||||
*/
|
||||
wxPoint GetOffset() { return m_offset; }
|
||||
VECTOR2I GetOffset() { return m_offset; }
|
||||
|
||||
/**
|
||||
* Set the page info used to plot drill maps.
|
||||
|
@ -380,7 +380,7 @@ protected:
|
|||
double m_conversionUnits; // scaling factor to convert the board
|
||||
// unites to Excellon/Gerber units (i.e
|
||||
// inches or mm)
|
||||
wxPoint m_offset; // Drill offset coordinates
|
||||
VECTOR2I m_offset; // Drill offset coordinates
|
||||
bool m_merge_PTH_NPTH; // True to generate only one drill file
|
||||
std::vector<HOLE_INFO> m_holeListBuffer; // Buffer containing holes
|
||||
std::vector<DRILL_TOOL> m_toolListBuffer; // Buffer containing tools
|
||||
|
|
|
@ -172,7 +172,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
|
|||
|
||||
holes_count = 0;
|
||||
|
||||
wxPoint hole_pos;
|
||||
VECTOR2I hole_pos;
|
||||
bool last_item_is_via = true; // a flag to clear object attributes when a via hole is created.
|
||||
|
||||
for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
*
|
||||
* @param aOffset is the drill coordinates offset.
|
||||
*/
|
||||
void SetOptions( const wxPoint& aOffset )
|
||||
void SetOptions( const VECTOR2I& aOffset )
|
||||
{
|
||||
m_offset = aOffset;
|
||||
m_merge_PTH_NPTH = false;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define PLACEFILE_GERBER_WRITER_H
|
||||
|
||||
#include <layer_ids.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class BOARD;
|
||||
class FOOTPRINT;
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
*
|
||||
* @param aOffset is the drill coordinates offset.
|
||||
*/
|
||||
void SetOptions( const wxPoint& aOffset )
|
||||
void SetOptions( const VECTOR2I& aOffset )
|
||||
{
|
||||
m_offset = aOffset;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ private:
|
|||
|
||||
BOARD* m_pcb;
|
||||
PCB_LAYER_ID m_layer; // The board layer currently used (typically F_Cu or B_Cu)
|
||||
wxPoint m_offset; // Drill offset coordinates
|
||||
VECTOR2I m_offset; // Drill offset coordinates
|
||||
|
||||
bool m_plotPad1Marker; // True to plot a flashed marker shape at pad 1 position
|
||||
bool m_plotOtherPadsMarker; // True to plot a marker shape at other pads position
|
||||
|
|
|
@ -85,11 +85,11 @@ void FP_TEXT::SetTextAngle( const EDA_ANGLE& aAngle )
|
|||
bool FP_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetTextBox();
|
||||
wxPoint location = aPoint;
|
||||
VECTOR2I location = aPoint;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
RotatePoint( &location, GetTextPos(), -GetDrawRotation() );
|
||||
RotatePoint( location, GetTextPos(), -GetDrawRotation() );
|
||||
|
||||
return rect.Contains( location );
|
||||
}
|
||||
|
@ -131,8 +131,8 @@ void FP_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
// Used in footprint editing
|
||||
// Note also in footprint editor, m_Pos0 = m_Pos
|
||||
|
||||
wxPoint pt = GetTextPos();
|
||||
RotatePoint( &pt, aRotCentre, aAngle );
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, aRotCentre, aAngle );
|
||||
SetTextPos( pt );
|
||||
|
||||
SetTextAngle( GetTextAngle().AsTenthsOfADegree() + aAngle );
|
||||
|
@ -203,8 +203,8 @@ void FP_TEXT::SetDrawCoord()
|
|||
{
|
||||
double angle = parentFootprint->GetOrientation();
|
||||
|
||||
wxPoint pt = GetTextPos();
|
||||
RotatePoint( &pt, angle );
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, angle );
|
||||
SetTextPos( pt );
|
||||
|
||||
Offset( parentFootprint->GetPosition() );
|
||||
|
@ -218,7 +218,7 @@ void FP_TEXT::SetLocalCoord()
|
|||
|
||||
if( parentFootprint )
|
||||
{
|
||||
m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
|
||||
m_Pos0 = (wxPoint)GetTextPos() - parentFootprint->GetPosition();
|
||||
|
||||
double angle = parentFootprint->GetOrientation();
|
||||
|
||||
|
@ -226,7 +226,7 @@ void FP_TEXT::SetLocalCoord()
|
|||
}
|
||||
else
|
||||
{
|
||||
m_Pos0 = GetTextPos();
|
||||
m_Pos0 = (wxPoint)GetTextPos();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
virtual wxPoint GetPosition() const override
|
||||
{
|
||||
return EDA_TEXT::GetTextPos();
|
||||
return (wxPoint)EDA_TEXT::GetTextPos();
|
||||
}
|
||||
|
||||
virtual void SetPosition( const wxPoint& aPos ) override
|
||||
|
|
|
@ -453,27 +453,27 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
|
|||
}
|
||||
|
||||
|
||||
const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
|
||||
const VECTOR2I& PCB_BASE_FRAME::GetGridOrigin() const
|
||||
{
|
||||
return m_pcb->GetDesignSettings().GetGridOrigin();
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
|
||||
void PCB_BASE_FRAME::SetGridOrigin( const VECTOR2I& aPoint )
|
||||
{
|
||||
m_pcb->GetDesignSettings().SetGridOrigin( aPoint );
|
||||
}
|
||||
|
||||
|
||||
const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
|
||||
const VECTOR2I& PCB_BASE_FRAME::GetAuxOrigin() const
|
||||
{
|
||||
return m_pcb->GetDesignSettings().GetAuxOrigin();
|
||||
}
|
||||
|
||||
|
||||
const wxPoint PCB_BASE_FRAME::GetUserOrigin() const
|
||||
const VECTOR2I PCB_BASE_FRAME::GetUserOrigin() const
|
||||
{
|
||||
wxPoint origin( 0, 0 );
|
||||
VECTOR2I origin( 0, 0 );
|
||||
|
||||
switch( Settings().m_Display.m_DisplayOrigin )
|
||||
{
|
||||
|
|
|
@ -220,8 +220,8 @@ void PCB_DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle )
|
|||
|
||||
m_text.SetTextAngle( newAngle );
|
||||
|
||||
wxPoint pt = m_text.GetTextPos();
|
||||
RotatePoint( &pt, aRotCentre, aAngle );
|
||||
VECTOR2I pt = m_text.GetTextPos();
|
||||
RotatePoint( pt, aRotCentre, aAngle );
|
||||
m_text.SetTextPos( pt );
|
||||
|
||||
RotatePoint( &m_start, aRotCentre, aAngle );
|
||||
|
@ -242,7 +242,7 @@ void PCB_DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
void PCB_DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight )
|
||||
{
|
||||
int axis = aMirrorLeftRight ? axis_pos.x : axis_pos.y;
|
||||
wxPoint newPos = m_text.GetTextPos();
|
||||
VECTOR2I newPos = m_text.GetTextPos();
|
||||
|
||||
#define INVERT( pos ) ( ( pos ) = axis - ( ( pos ) - axis ) )
|
||||
if( aMirrorLeftRight )
|
||||
|
|
|
@ -115,7 +115,7 @@ bool PCB_GROUP::WithinScope( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootpr
|
|||
|
||||
wxPoint PCB_GROUP::GetPosition() const
|
||||
{
|
||||
return GetBoundingBox().Centre();
|
||||
return (wxPoint)GetBoundingBox().Centre();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1652,9 +1652,9 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
|
|||
EDA_RECT bbox = aGroup->GetBoundingBox();
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth * 2.0f );
|
||||
wxPoint topLeft = bbox.GetPosition();
|
||||
wxPoint width = wxPoint( bbox.GetWidth(), 0 );
|
||||
wxPoint height = wxPoint( 0, bbox.GetHeight() );
|
||||
VECTOR2I topLeft = bbox.GetPosition();
|
||||
VECTOR2I width = VECTOR2I( bbox.GetWidth(), 0 );
|
||||
VECTOR2I height = VECTOR2I( 0, bbox.GetHeight() );
|
||||
|
||||
m_gal->DrawLine( topLeft, topLeft + width );
|
||||
m_gal->DrawLine( topLeft + width, topLeft + width + height );
|
||||
|
|
|
@ -167,8 +167,8 @@ bool PCB_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
|
|||
|
||||
void PCB_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
|
||||
{
|
||||
wxPoint pt = GetTextPos();
|
||||
RotatePoint( &pt, aRotCentre, aAngle );
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, aRotCentre, aAngle );
|
||||
SetTextPos( pt );
|
||||
|
||||
SetTextAngle( GetTextAngle().AsTenthsOfADegree() + aAngle );
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
virtual wxPoint GetPosition() const override
|
||||
{
|
||||
return EDA_TEXT::GetTextPos();
|
||||
return (wxPoint)EDA_TEXT::GetTextPos();
|
||||
}
|
||||
|
||||
virtual void SetPosition( const wxPoint& aPos ) override
|
||||
|
|
|
@ -340,7 +340,7 @@ void AddGerberX2Header( PLOTTER* aPlotter, const BOARD* aBoard, bool aUseX1Compa
|
|||
// Please, if absolute Pcbnew coordinates, one day, are set by user, change the way
|
||||
// the key is built to ensure file only using the *same* axis have the same key.
|
||||
wxString registration_id = "Original";
|
||||
wxPoint auxOrigin = aBoard->GetDesignSettings().GetAuxOrigin();
|
||||
VECTOR2I auxOrigin = aBoard->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
if( aBoard->GetPlotOptions().GetUseAuxOrigin() && auxOrigin.x && auxOrigin.y )
|
||||
registration_id.Printf( "PX%xPY%x", auxOrigin.x, auxOrigin.y );
|
||||
|
|
|
@ -1037,8 +1037,8 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
|
|||
}
|
||||
|
||||
EDA_RECT bbox = aBoard->ComputeBoundingBox();
|
||||
wxPoint boardCenter = bbox.Centre();
|
||||
wxSize boardSize = bbox.GetSize();
|
||||
VECTOR2I boardCenter = bbox.Centre();
|
||||
VECTOR2I boardSize = bbox.GetSize();
|
||||
|
||||
double compound_scale;
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
|
|||
|
||||
// For the plot offset we have to keep in mind the auxiliary origin too: if autoscaling is
|
||||
// off we check that plot option (i.e. autoscaling overrides auxiliary origin)
|
||||
wxPoint offset( 0, 0);
|
||||
VECTOR2I offset( 0, 0);
|
||||
|
||||
if( autocenter )
|
||||
{
|
||||
|
|
|
@ -386,8 +386,8 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4
|
|||
m_plotter->SetColor( color );
|
||||
|
||||
// calculate some text parameters :
|
||||
wxSize size = aText->GetTextSize();
|
||||
wxPoint pos = aText->GetTextPos();
|
||||
VECTOR2I size = aText->GetTextSize();
|
||||
VECTOR2I pos = aText->GetTextPos();
|
||||
int thickness = aText->GetEffectiveTextPenWidth();
|
||||
|
||||
if( aText->IsMirrored() )
|
||||
|
@ -753,8 +753,8 @@ void BRDITEMS_PLOTTER::PlotPcbText( const PCB_TEXT* aText )
|
|||
COLOR4D color = getColor( aText->GetLayer() );
|
||||
m_plotter->SetColor( color );
|
||||
|
||||
wxSize size = aText->GetTextSize();
|
||||
wxPoint pos = aText->GetTextPos();
|
||||
VECTOR2I size = aText->GetTextSize();
|
||||
VECTOR2I pos = aText->GetTextPos();
|
||||
int thickness = aText->GetEffectiveTextPenWidth();
|
||||
|
||||
if( aText->IsMirrored() )
|
||||
|
|
|
@ -498,9 +498,9 @@ void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const
|
|||
m_out->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %s)\n",
|
||||
Double2Str( dsnSettings.m_SolderPasteMarginRatio ).c_str() );
|
||||
|
||||
wxPoint origin = dsnSettings.GetAuxOrigin();
|
||||
VECTOR2I origin = dsnSettings.GetAuxOrigin();
|
||||
|
||||
if( origin != wxPoint( 0, 0 ) )
|
||||
if( origin != VECTOR2I( 0, 0 ) )
|
||||
{
|
||||
m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
|
||||
FormatInternalUnits( origin.x ).c_str(),
|
||||
|
|
|
@ -196,7 +196,7 @@ void BOARD_EDITOR_CONTROL::Reset( RESET_REASON aReason )
|
|||
|
||||
if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
|
||||
{
|
||||
m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
|
||||
m_placeOrigin->SetPosition( (wxPoint)getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
|
||||
getView()->Remove( m_placeOrigin.get() );
|
||||
getView()->Add( m_placeOrigin.get() );
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ void PCB_CONTROL::Reset( RESET_REASON aReason )
|
|||
|
||||
if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
|
||||
{
|
||||
m_gridOrigin->SetPosition( board()->GetDesignSettings().GetGridOrigin() );
|
||||
m_gridOrigin->SetPosition( (wxPoint) board()->GetDesignSettings().GetGridOrigin() );
|
||||
m_gridOrigin->SetColor( m_frame->GetGridColor() );
|
||||
getView()->Remove( m_gridOrigin.get() );
|
||||
getView()->Add( m_gridOrigin.get() );
|
||||
|
|
|
@ -133,10 +133,10 @@ int POSITION_RELATIVE_TOOL::PositionRelative( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const wxPoint& aPosAnchor,
|
||||
const wxPoint& aTranslation )
|
||||
int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const VECTOR2I& aPosAnchor,
|
||||
const VECTOR2I& aTranslation )
|
||||
{
|
||||
wxPoint aggregateTranslation = aPosAnchor + aTranslation - GetSelectionAnchorPosition();
|
||||
VECTOR2I aggregateTranslation = aPosAnchor + aTranslation - GetSelectionAnchorPosition();
|
||||
|
||||
for( auto item : m_selection )
|
||||
{
|
||||
|
|
|
@ -66,13 +66,13 @@ public:
|
|||
/**
|
||||
* Return the position of the selected item(s)
|
||||
*/
|
||||
wxPoint GetSelectionAnchorPosition() const { return m_selectionAnchor; }
|
||||
VECTOR2I GetSelectionAnchorPosition() const { return m_selectionAnchor; }
|
||||
|
||||
/**
|
||||
* Position the m_position_relative_selection selection relative to anchor position using
|
||||
* the given translation.
|
||||
*/
|
||||
int RelativeItemSelectionMove( const wxPoint& anchor, const wxPoint& translation );
|
||||
int RelativeItemSelectionMove( const VECTOR2I& anchor, const VECTOR2I& translation );
|
||||
|
||||
///< Set up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
@ -82,14 +82,14 @@ private:
|
|||
|
||||
PCB_SELECTION_TOOL* m_selectionTool;
|
||||
PCB_SELECTION m_selection;
|
||||
wxPoint m_selectionAnchor;
|
||||
VECTOR2I m_selectionAnchor;
|
||||
|
||||
std::unique_ptr<BOARD_COMMIT> m_commit;
|
||||
|
||||
EDA_ITEM* m_anchor_item;
|
||||
wxPoint m_anchor;
|
||||
VECTOR2I m_anchor;
|
||||
|
||||
wxPoint m_translation;
|
||||
VECTOR2I m_translation;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -212,18 +212,18 @@ BOOST_AUTO_TEST_CASE( Rotate )
|
|||
if( schItem != nullptr )
|
||||
{
|
||||
// Only rotating pins around the center of parent sheet works.
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
}
|
||||
|
||||
if( libItem != nullptr )
|
||||
{
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
}
|
||||
|
||||
CompareItems( newItem.get(), item.get() );
|
||||
|
|
Loading…
Reference in New Issue