Remove DPOINT from drawing sheet stuff. (Use VECTOR2D instead.)

This commit is contained in:
Jeff Young 2022-01-19 23:31:07 +00:00
parent 881af75029
commit 67eb3116ce
6 changed files with 55 additions and 55 deletions

View File

@ -423,7 +423,7 @@ void DRAWING_SHEET_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
void DRAWING_SHEET_PARSER::parsePolyOutline( DS_DATA_ITEM_POLYGONS * aItem )
{
DPOINT corner;
VECTOR2D corner;
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
{

View File

@ -145,7 +145,7 @@ int DS_DATA_ITEM::GetPenSizeUi()
void DS_DATA_ITEM::MoveToUi( const VECTOR2I& aPosition )
{
DPOINT pos_mm;
VECTOR2D pos_mm;
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
@ -153,10 +153,10 @@ void DS_DATA_ITEM::MoveToUi( const VECTOR2I& aPosition )
}
void DS_DATA_ITEM::MoveTo( const DPOINT& aPosition )
void DS_DATA_ITEM::MoveTo( const VECTOR2D& aPosition )
{
DPOINT vector = aPosition - GetStartPos();
DPOINT endpos = vector + GetEndPos();
VECTOR2D vector = aPosition - GetStartPos();
VECTOR2D endpos = vector + GetEndPos();
MoveStartPointTo( aPosition );
MoveEndPointTo( endpos );
@ -169,10 +169,10 @@ void DS_DATA_ITEM::MoveTo( const DPOINT& aPosition )
}
void DS_DATA_ITEM::MoveStartPointTo( const DPOINT& aPosition )
void DS_DATA_ITEM::MoveStartPointTo( const VECTOR2D& aPosition )
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT position;
VECTOR2D position;
// Calculate the position of the starting point
// relative to the reference corner
@ -204,17 +204,17 @@ void DS_DATA_ITEM::MoveStartPointTo( const DPOINT& aPosition )
void DS_DATA_ITEM::MoveStartPointToUi( const VECTOR2I& aPosition )
{
DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
VECTOR2D pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
MoveStartPointTo( pos_mm );
}
void DS_DATA_ITEM::MoveEndPointTo( const DPOINT& aPosition )
void DS_DATA_ITEM::MoveEndPointTo( const VECTOR2D& aPosition )
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT position;
VECTOR2D position;
// Calculate the position of the starting point
// relative to the reference corner
@ -256,7 +256,7 @@ void DS_DATA_ITEM::MoveEndPointTo( const DPOINT& aPosition )
void DS_DATA_ITEM::MoveEndPointToUi( const VECTOR2I& aPosition )
{
DPOINT pos_mm;
VECTOR2D pos_mm;
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
@ -264,10 +264,10 @@ void DS_DATA_ITEM::MoveEndPointToUi( const VECTOR2I& aPosition )
}
const DPOINT DS_DATA_ITEM::GetStartPos( int ii ) const
const VECTOR2D DS_DATA_ITEM::GetStartPos( int ii ) const
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
VECTOR2D pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
switch( m_Pos.m_Anchor )
@ -297,15 +297,15 @@ const DPOINT DS_DATA_ITEM::GetStartPos( int ii ) const
const VECTOR2I DS_DATA_ITEM::GetStartPosUi( int ii ) const
{
DPOINT pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
VECTOR2D pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
}
const DPOINT DS_DATA_ITEM::GetEndPos( int ii ) const
const VECTOR2D DS_DATA_ITEM::GetEndPos( int ii ) const
{
DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
VECTOR2D pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
switch( m_End.m_Anchor )
{
@ -334,7 +334,7 @@ const DPOINT DS_DATA_ITEM::GetEndPos( int ii ) const
const VECTOR2I DS_DATA_ITEM::GetEndPosUi( int ii ) const
{
DPOINT pos = GetEndPos( ii );
VECTOR2D pos = GetEndPos( ii );
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
}
@ -344,7 +344,7 @@ bool DS_DATA_ITEM::IsInsidePage( int ii ) const
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT pos = GetStartPos( ii );
VECTOR2D pos = GetStartPos( ii );
for( int kk = 0; kk < 1; kk++ )
{
@ -493,7 +493,7 @@ bool DS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
DPOINT pos = GetStartPos( ii );
VECTOR2D pos = GetStartPos( ii );
pos += m_minCoord; // left top pos of bounding box
if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
@ -511,7 +511,7 @@ bool DS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
{
DPOINT pos = GetCornerPosition( aIdx, aRepeat );
VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return VECTOR2I( int( pos.x ), int( pos.y ) );
}

View File

@ -102,13 +102,13 @@ void DS_DATA_MODEL::SetupDrawEnvironment( const PAGE_INFO& aPageInfo, double aMi
m_WSunits2Iu = aMilsToIU / MILS_TO_MM;
// Left top corner position
DPOINT lt_corner;
VECTOR2D lt_corner;
lt_corner.x = GetLeftMargin();
lt_corner.y = GetTopMargin();
m_LT_Corner = lt_corner;
// Right bottom corner position
DPOINT rb_corner;
VECTOR2D rb_corner;
rb_corner.x = ( aPageInfo.GetSizeMils().x * MILS_TO_MM ) - GetRightMargin();
rb_corner.y = ( aPageInfo.GetSizeMils().y * MILS_TO_MM ) - GetBottomMargin();
m_RB_Corner = rb_corner;

View File

@ -361,8 +361,8 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) co
while( ist <= iend )
{
DPOINT pos = aItem->m_Corners[ist++];
int nestLevel = 0;
VECTOR2D pos = aItem->m_Corners[ist++];
int nestLevel = 0;
if( ii++ > 4)
{

View File

@ -71,13 +71,13 @@ class POINT_COORD
public:
POINT_COORD() { m_Anchor = RB_CORNER; }
POINT_COORD( const DPOINT& aPos, enum CORNER_ANCHOR aAnchor = RB_CORNER )
POINT_COORD( const VECTOR2D& aPos, enum CORNER_ANCHOR aAnchor = RB_CORNER )
{
m_Pos = aPos;
m_Anchor = aAnchor;
}
DPOINT m_Pos;
VECTOR2D m_Pos;
int m_Anchor;
};
@ -136,8 +136,8 @@ public:
// Coordinate handling
const VECTOR2I GetStartPosUi( int ii = 0 ) const;
const VECTOR2I GetEndPosUi( int ii = 0 ) const;
const DPOINT GetStartPos( int ii = 0 ) const;
const DPOINT GetEndPos( int ii = 0 ) const;
const VECTOR2D GetStartPos( int ii = 0 ) const;
const VECTOR2D GetEndPos( int ii = 0 ) const;
virtual int GetPenSizeUi();
@ -146,7 +146,7 @@ public:
*
* @param aPosition the new position of item, in mm.
*/
void MoveTo( const DPOINT& aPosition );
void MoveTo( const VECTOR2D& aPosition );
/**
* Move item to a new position.
@ -160,7 +160,7 @@ public:
*
* @param aPosition the new position of the starting point, in mm.
*/
void MoveStartPointTo( const DPOINT& aPosition );
void MoveStartPointTo( const VECTOR2D& aPosition );
/**
* Move the starting point of the item to a new position.
@ -177,7 +177,7 @@ public:
*
* @param aPosition is the new position of the ending point, in mm.
*/
void MoveEndPointTo( const DPOINT& aPosition );
void MoveEndPointTo( const VECTOR2D& aPosition );
/**
* Move the ending point of the item to a new position.
@ -201,7 +201,7 @@ public:
POINT_COORD m_End;
double m_LineWidth;
int m_RepeatCount; // repeat count for duplicate items
DPOINT m_IncrementVector; // for duplicate items: move vector for position increment
VECTOR2D m_IncrementVector; // for duplicate items: move vector for position increment
int m_IncrementLabel;
protected:
@ -226,7 +226,7 @@ public:
*
* @param aCorner is the item to append.
*/
void AppendCorner( const DPOINT& aCorner )
void AppendCorner( const VECTOR2D& aCorner )
{
m_Corners.push_back( aCorner );
}

View File

@ -174,29 +174,29 @@ public:
*/
static const wxString ResolvePath( const wxString& aPath, const wxString& aProjectPath );
double m_WSunits2Iu; // conversion factor between
// ws units (mils) and draw/plot units
DPOINT m_RB_Corner; // coordinates of the right bottom corner (in mm)
DPOINT m_LT_Corner; // coordinates of the left top corner (in mm)
double m_DefaultLineWidth; // Used when object line width is 0
DSIZE m_DefaultTextSize; // Used when object text size is 0
double m_DefaultTextThickness; // Used when object text stroke width is 0
bool m_EditMode; // Used in drawing sheet editor to toggle variable substitution
// In normal mode (m_EditMode = false) the %format is
// replaced by the corresponding text.
// In edit mode (m_EditMode = true) the %format is
// displayed "as this"
double m_WSunits2Iu; // conversion factor between
// ws units (mils) and draw/plot units
VECTOR2D m_RB_Corner; // coordinates of the right bottom corner (in mm)
VECTOR2D m_LT_Corner; // coordinates of the left top corner (in mm)
double m_DefaultLineWidth; // Used when object line width is 0
DSIZE m_DefaultTextSize; // Used when object text size is 0
double m_DefaultTextThickness; // Used when object text stroke width is 0
bool m_EditMode; // Used in drawing sheet editor to toggle variable substitution
// In normal mode (m_EditMode = false) the %format is
// replaced by the corresponding text.
// In edit mode (m_EditMode = true) the %format is
// displayed "as this"
private:
std::vector <DS_DATA_ITEM*> m_list;
bool m_allowVoidList; // If false, the default drawing sheet will be loaded the
// first time DS_DRAW_ITEM_LIST::BuildDrawItemsList is run
// (useful mainly for drawing sheet editor)
int m_fileFormatVersionAtLoad;
double m_leftMargin; // the left page margin in mm
double m_rightMargin; // the right page margin in mm
double m_topMargin; // the top page margin in mm
double m_bottomMargin; // the bottom page margin in mm
bool m_allowVoidList; // If false, the default drawing sheet will be loaded the
// first time DS_DRAW_ITEM_LIST::BuildDrawItemsList is run
// (useful mainly for drawing sheet editor)
int m_fileFormatVersionAtLoad;
double m_leftMargin; // the left page margin in mm
double m_rightMargin; // the right page margin in mm
double m_topMargin; // the top page margin in mm
double m_bottomMargin; // the bottom page margin in mm
};
#endif // DS_DATA_MODEL_H