Commit 8f79b146 authored by Dick Hollenbeck's avatar Dick Hollenbeck

This patch restores some of the goodness in Vladimir's rev 3239, and in particular

the GetPosition() and SetPosition() changes.  It also starts towards making m_Orientation
and m_Thickness fields private with accessors, but does not complete this latter goal.
parent 701fa6b0
...@@ -643,7 +643,7 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text ) ...@@ -643,7 +643,7 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
SetGLColor( color ); SetGLColor( color );
s_Text3DZPos = g_Parm_3D_Visu.m_LayerZcoord[layer]; s_Text3DZPos = g_Parm_3D_Visu.m_LayerZcoord[layer];
s_Text3DWidth = text->m_Thickness * g_Parm_3D_Visu.m_BoardScale; s_Text3DWidth = text->GetThickness() * g_Parm_3D_Visu.m_BoardScale;
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) ); glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
wxSize size = text->m_Size; wxSize size = text->m_Size;
...@@ -658,27 +658,27 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text ) ...@@ -658,27 +658,27 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
offset.y = text->GetInterline(); offset.y = text->GetInterline();
RotatePoint( &offset, text->m_Orient ); RotatePoint( &offset, text->GetOrientation() );
for( unsigned i = 0; i<list->Count(); i++ ) for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color, DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
txt, text->m_Orient, size, txt, text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify, text->m_HJustify, text->m_VJustify,
text->m_Thickness, text->m_Italic, text->GetThickness(), text->m_Italic,
true, Draw3dTextSegm ); true, Draw3dTextSegm );
pos += offset; pos += offset;
} }
delete (list); delete list;
} }
else else
{ {
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color, DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
text->m_Text, text->m_Orient, size, text->m_Text, text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify, text->m_HJustify, text->m_VJustify,
text->m_Thickness, text->m_Italic, text->GetThickness(), text->m_Italic,
true, true,
Draw3dTextSegm ); Draw3dTextSegm );
} }
...@@ -820,7 +820,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -820,7 +820,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
wxPoint& pt = points[ii]; wxPoint& pt = points[ii];
RotatePoint( &pt.x, &pt.y, module->m_Orient ); RotatePoint( &pt.x, &pt.y, module->GetOrientation() );
pt += module->m_Pos; pt += module->m_Pos;
} }
...@@ -868,7 +868,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -868,7 +868,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
wxPoint& pt = points[ii]; wxPoint& pt = points[ii];
RotatePoint( &pt.x, &pt.y, module->m_Orient ); RotatePoint( &pt.x, &pt.y, module->GetOrientation() );
pt += module->m_Pos; pt += module->m_Pos;
} }
......
...@@ -167,11 +167,16 @@ public: ...@@ -167,11 +167,16 @@ public:
* @return const wxPoint& - The position of this object. * @return const wxPoint& - The position of this object.
* This function exists mainly to satisfy the virtual GetPosition() in parent class * This function exists mainly to satisfy the virtual GetPosition() in parent class
*/ */
wxPoint& GetPosition() const wxPoint GetPosition() const
{ {
return m_Start; // it had to be start or end. return m_Start; // it had to be start or end.
} }
void SetPosition( const wxPoint& aPos )
{
m_Start = aPos;
}
/** /**
* Function GetABPosition * Function GetABPosition
* returns the image position of aPosition for this object. * returns the image position of aPosition for this object.
......
...@@ -239,7 +239,6 @@ public: ...@@ -239,7 +239,6 @@ public:
m_Size.x = pos.x - m_Pos.x; m_Size.y = pos.y - m_Pos.y; m_Size.x = pos.x - m_Pos.x; m_Size.y = pos.y - m_Pos.y;
} }
/** /**
* Function Intersects * Function Intersects
* @return bool - true if the argument rectangle intersects this rectangle. * @return bool - true if the argument rectangle intersects this rectangle.
...@@ -729,12 +728,14 @@ enum FILL_T { ...@@ -729,12 +728,14 @@ enum FILL_T {
*/ */
class EDA_TEXT class EDA_TEXT
{ {
public: public:
int m_Thickness; /* pen size used to draw this text */
int m_Orient; /* Orient in 0.1 degrees */
wxString m_Text; /* text! */ wxString m_Text; /* text! */
wxPoint m_Pos; /* XY position of anchor text. */ wxPoint m_Pos; /* XY position of anchor text. */
wxSize m_Size; /* XY size of text */ wxSize m_Size; /* XY size of text */
int m_Thickness; /* pen size used to draw this text */
int m_Orient; /* Orient in 0.1 degrees */
bool m_Mirror; /* Display Normal / mirror */ bool m_Mirror; /* Display Normal / mirror */
int m_Attributs; /* flags (visible...) */ int m_Attributs; /* flags (visible...) */
bool m_Italic; /* true to simulate (or use if exists) bool m_Italic; /* true to simulate (or use if exists)
...@@ -766,6 +767,9 @@ public: ...@@ -766,6 +767,9 @@ public:
*/ */
int GetThickness() const { return m_Thickness; }; int GetThickness() const { return m_Thickness; };
void SetOrientation( int aOrientation ) { m_Orient = aOrientation; }
int GetOrientation() const { return m_Orient; }
/** /**
* Function SetSize * Function SetSize
* sets text size. * sets text size.
...@@ -780,6 +784,9 @@ public: ...@@ -780,6 +784,9 @@ public:
*/ */
wxSize GetSize() const { return m_Size; }; wxSize GetSize() const { return m_Size; };
//void SetPosition( const wxPoint& aPoint ) { m_Pos = aPoint; }
//wxPoint GetPosition() const { return m_Pos; }
int GetLength() const { return m_Text.Length(); }; int GetLength() const { return m_Text.Length(); };
/** /**
......
...@@ -76,9 +76,16 @@ public: ...@@ -76,9 +76,16 @@ public:
/** /**
* Function GetPosition * Function GetPosition
* returns the position of this object. * returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it can be changed * @return const wxPoint - The position of this object
*/ */
virtual wxPoint& GetPosition() = 0; virtual const wxPoint GetPosition() const = 0;
/**
* Function SetPosition
* sets the position of this object.
* @param aPos is the new position of this object
*/
virtual void SetPosition( const wxPoint& aPos ) = 0;
/** /**
* Function GetLayer * Function GetLayer
...@@ -313,10 +320,9 @@ public: ...@@ -313,10 +320,9 @@ public:
{} {}
//-----< satisfy some virtual functions >------------------------------ //-----< satisfy some virtual functions >------------------------------
wxPoint& GetPosition() const wxPoint GetPosition()
{ {
static wxPoint dummy; return wxPoint(0, 0); // dummy
return dummy;
} }
void Draw( EDA_DRAW_PANEL* DrawPanel, wxDC* DC, void Draw( EDA_DRAW_PANEL* DrawPanel, wxDC* DC,
......
...@@ -537,7 +537,8 @@ void DeleteMarkedItems( MODULE* module ) ...@@ -537,7 +537,8 @@ void DeleteMarkedItems( MODULE* module )
void MirrorMarkedItems( MODULE* module, wxPoint offset ) void MirrorMarkedItems( MODULE* module, wxPoint offset )
{ {
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x; #define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
EDA_ITEM* item; EDA_ITEM* item;
wxPoint tmp;
if( module == NULL ) if( module == NULL )
return; return;
...@@ -549,7 +550,10 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -549,7 +550,10 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
SETMIRROR( pad->GetPosition().x ); tmp = pad->GetPosition();
SETMIRROR( tmp.x );
pad->SetPosition( tmp );
pad->m_Pos0.x = pad->GetPosition().x; pad->m_Pos0.x = pad->GetPosition().x;
NEGATE( pad->m_Offset.x ); NEGATE( pad->m_Offset.x );
NEGATE( pad->m_DeltaSize.x ); NEGATE( pad->m_DeltaSize.x );
...@@ -567,18 +571,19 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -567,18 +571,19 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ EDGE_MODULE * edge;
EDGE_MODULE * edge = (EDGE_MODULE*) item; edge = (EDGE_MODULE*) item;
SETMIRROR( edge->m_Start.x ); SETMIRROR( edge->m_Start.x );
edge->m_Start0.x = edge->m_Start.x; edge->m_Start0.x = edge->m_Start.x;
SETMIRROR( edge->m_End.x ); SETMIRROR( edge->m_End.x );
edge->m_End0.x = edge->m_End.x; edge->m_End0.x = edge->m_End.x;
NEGATE( edge->m_Angle ); NEGATE( edge->m_Angle );
}
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x ); tmp = ( (TEXTE_MODULE*) item )->GetPosition();
SETMIRROR( tmp.x );
( (TEXTE_MODULE*) item )->SetPosition( tmp );
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x; ( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x;
break; break;
...@@ -609,7 +614,10 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -609,7 +614,10 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
ROTATE( pad->GetPosition() ); wxPoint pos = pad->GetPosition();
ROTATE( pos );
pad->SetPosition( pos );
pad->m_Pos0 = pad->GetPosition(); pad->m_Pos0 = pad->GetPosition();
pad->m_Orient += 900; pad->m_Orient += 900;
NORMALIZE_ANGLE_POS( pad->m_Orient ); NORMALIZE_ANGLE_POS( pad->m_Orient );
...@@ -632,7 +640,11 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -632,7 +640,11 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() ); {
wxPoint pos = ( (TEXTE_MODULE*) item )->GetPosition();
ROTATE( pos );
( (TEXTE_MODULE*) item )->SetPosition( pos );
}
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition(); ( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->m_Orient += 900; ( (TEXTE_MODULE*) item )->m_Orient += 900;
break; break;
......
...@@ -643,15 +643,6 @@ bool BOARD::IsModuleLayerVisible( int layer ) ...@@ -643,15 +643,6 @@ bool BOARD::IsModuleLayerVisible( int layer )
} }
wxPoint& BOARD::GetPosition()
{
static wxPoint dummy( 0, 0 );
return dummy; // a reference
}
void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl ) void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
{ {
if( aBoardItem == NULL ) if( aBoardItem == NULL )
......
...@@ -259,13 +259,11 @@ public: ...@@ -259,13 +259,11 @@ public:
*/ */
static wxString GetDefaultLayerName( int aLayerNumber ); static wxString GetDefaultLayerName( int aLayerNumber );
/** const wxPoint GetPosition() const // overload
* Function GetPosition {
* is here to satisfy BOARD_ITEM's requirements, but this implementation return wxPoint( 0, 0 ); // dummy for pure virtual
* is a dummy. }
* @return const wxPoint& of (0,0) void SetPosition( const wxPoint& aPos ) {} // overload
*/
wxPoint& GetPosition();
/** /**
* Function Add * Function Add
......
...@@ -143,14 +143,18 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader ) ...@@ -143,14 +143,18 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
if( Line[0] == 'P' ) if( Line[0] == 'P' )
{ {
int normal_display = 1; int normal_display = 1;
int orientation;
int thickness;
sscanf( Line + 2, " %d %d %d %d %d %d %d", sscanf( Line + 2, " %d %d %d %d %d %d %d",
&m_Text->m_Pos.x, &m_Text->m_Pos.y, &m_Text->m_Pos.x, &m_Text->m_Pos.y,
&m_Text->m_Size.x, &m_Text->m_Size.y, &m_Text->m_Size.x, &m_Text->m_Size.y,
&m_Text->m_Thickness, &m_Text->m_Orient, &thickness, &orientation,
&normal_display ); &normal_display );
m_Text->m_Mirror = normal_display ? false : true; m_Text->m_Mirror = normal_display ? false : true;
m_Pos = m_Text->m_Pos; m_Pos = m_Text->m_Pos;
m_Text->SetOrientation( orientation );
m_Text->SetThickness( thickness );
continue; continue;
} }
...@@ -260,18 +264,21 @@ void DIMENSION::Move(const wxPoint& offset) ...@@ -260,18 +264,21 @@ void DIMENSION::Move(const wxPoint& offset)
} }
void DIMENSION::Rotate(const wxPoint& aRotCentre, int aAngle) void DIMENSION::Rotate( const wxPoint& aRotCentre, int aAngle )
{ {
RotatePoint( &m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Pos, aRotCentre, aAngle );
RotatePoint( &m_Text->m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Text->m_Pos, aRotCentre, aAngle );
m_Text->m_Orient += aAngle;
if( m_Text->m_Orient >= 3600 ) int newAngle = m_Text->GetOrientation() + aAngle;
m_Text->m_Orient -= 3600;
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient <2700 ) ) if( newAngle >= 3600 )
m_Text->m_Orient -= 1800; newAngle -= 3600;
if( newAngle > 900 && newAngle < 2700 )
newAngle -= 1800;
m_Text->SetOrientation( newAngle );
RotatePoint( &m_crossBarOx, &m_crossBarOy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_crossBarOx, &m_crossBarOy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_crossBarFx, &m_crossBarFy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_crossBarFx, &m_crossBarFy, aRotCentre.x, aRotCentre.y, aAngle );
...@@ -290,7 +297,7 @@ void DIMENSION::Rotate(const wxPoint& aRotCentre, int aAngle) ...@@ -290,7 +297,7 @@ void DIMENSION::Rotate(const wxPoint& aRotCentre, int aAngle)
} }
void DIMENSION::Flip(const wxPoint& aCentre ) void DIMENSION::Flip( const wxPoint& aCentre )
{ {
Mirror( aCentre ); Mirror( aCentre );
SetLayer( ChangeSideNumLayer( GetLayer() ) ); SetLayer( ChangeSideNumLayer( GetLayer() ) );
...@@ -300,16 +307,18 @@ void DIMENSION::Flip(const wxPoint& aCentre ) ...@@ -300,16 +307,18 @@ void DIMENSION::Flip(const wxPoint& aCentre )
void DIMENSION::Mirror(const wxPoint& axis_pos) void DIMENSION::Mirror(const wxPoint& axis_pos)
{ {
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y ) #define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
#define INVERT_ANGLE( phi ) (phi) = -(phi)
INVERT( m_Pos.y ); INVERT( m_Pos.y );
INVERT( m_Text->m_Pos.y ); INVERT( m_Text->m_Pos.y );
INVERT_ANGLE( m_Text->m_Orient );
if( m_Text->m_Orient >= 3600 ) // invert angle
m_Text->m_Orient -= 3600; int newAngle = m_Text->GetOrientation();
if( newAngle >= 3600 )
newAngle -= 3600;
if( newAngle > 900 && newAngle < 2700 )
newAngle -= 1800;
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient < 2700 ) ) m_Text->SetOrientation( newAngle );
m_Text->m_Orient -= 1800;
INVERT( m_crossBarOy ); INVERT( m_crossBarOy );
INVERT( m_crossBarFy ); INVERT( m_crossBarFy );
...@@ -352,7 +361,7 @@ bool DIMENSION::Save( FILE* aFile ) const ...@@ -352,7 +361,7 @@ bool DIMENSION::Save( FILE* aFile ) const
fprintf( aFile, "Po %d %d %d %d %d %d %d\n", fprintf( aFile, "Po %d %d %d %d %d %d %d\n",
m_Text->m_Pos.x, m_Text->m_Pos.y, m_Text->m_Pos.x, m_Text->m_Pos.y,
m_Text->m_Size.x, m_Text->m_Size.y, m_Text->m_Size.x, m_Text->m_Size.y,
m_Text->m_Thickness, m_Text->m_Orient, m_Text->GetThickness(), m_Text->GetOrientation(),
m_Text->m_Mirror ? 0 : 1 ); m_Text->m_Mirror ? 0 : 1 );
fprintf( aFile, "Sb %d %d %d %d %d %d\n", S_SEGMENT, fprintf( aFile, "Sb %d %d %d %d %d %d\n", S_SEGMENT,
...@@ -410,12 +419,12 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -410,12 +419,12 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
/* calculate the size of the dimension (text + line above the text) */ /* calculate the size of the dimension (text + line above the text) */
ii = m_Text->m_Size.y + ii = m_Text->m_Size.y +
m_Text->m_Thickness + (m_Width * 3); m_Text->GetThickness() + (m_Width * 3);
deltax = m_featureLineDOx - m_featureLineGOx; deltax = m_featureLineDOx - m_featureLineGOx;
deltay = m_featureLineDOy - m_featureLineGOy; deltay = m_featureLineDOy - m_featureLineGOy;
/* Calculate dimension value */ // Calculate dimension value
mesure = wxRound(hypot( (double) deltax, (double) deltay ) ); mesure = wxRound(hypot( (double) deltax, (double) deltay ) );
if( deltax || deltay ) if( deltax || deltay )
...@@ -423,10 +432,10 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -423,10 +432,10 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
else else
angle = 0.0; angle = 0.0;
/* Calculation of parameters X and Y dimensions of the arrows and lines. */ // Calculation of parameters X and Y dimensions of the arrows and lines.
hx = hy = ii; hx = hy = ii;
/* Taking into account the slope of the side lines. */ // Taking into account the slope of the side lines.
if( mesure ) if( mesure )
{ {
hx = (abs) ( (int) ( ( (double) deltay * hx ) / mesure ) ); hx = (abs) ( (int) ( ( (double) deltay * hx ) / mesure ) );
...@@ -487,16 +496,17 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -487,16 +496,17 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
m_Pos.x = m_Text->m_Pos.x = (m_crossBarFx + m_featureLineGFx) / 2; m_Pos.x = m_Text->m_Pos.x = (m_crossBarFx + m_featureLineGFx) / 2;
m_Pos.y = m_Text->m_Pos.y = (m_crossBarFy + m_featureLineGFy) / 2; m_Pos.y = m_Text->m_Pos.y = (m_crossBarFy + m_featureLineGFy) / 2;
m_Text->m_Orient = -(int) (angle * 1800 / M_PI); int newAngle = -(int) (angle * 1800 / M_PI);
if( newAngle < 0 )
newAngle += 3600;
if( m_Text->m_Orient < 0 ) if( newAngle >= 3600 )
m_Text->m_Orient += 3600; newAngle -= 3600;
if( m_Text->m_Orient >= 3600 ) if( newAngle > 900 && newAngle < 2700 )
m_Text->m_Orient -= 3600; newAngle -= 1800;
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) ) m_Text->SetOrientation( newAngle );
m_Text->m_Orient -= 1800;
if( !aDoNotChangeText ) if( !aDoNotChangeText )
{ {
......
...@@ -37,11 +37,13 @@ public: ...@@ -37,11 +37,13 @@ public:
DIMENSION( BOARD_ITEM* aParent ); DIMENSION( BOARD_ITEM* aParent );
~DIMENSION(); ~DIMENSION();
wxPoint& GetPosition() const wxPoint GetPosition() const
{ {
return m_Pos; return m_Pos;
} }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; }
/** /**
* Function SetLayer * Function SetLayer
* sets the layer this item is on. * sets the layer this item is on.
......
...@@ -453,7 +453,7 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const ...@@ -453,7 +453,7 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
if( module ) // Transform, if we belong to a module if( module ) // Transform, if we belong to a module
{ {
RotatePoint( &pt, module->m_Orient ); RotatePoint( &pt, module->GetOrientation() );
pt += module->m_Pos; pt += module->m_Pos;
} }
......
...@@ -59,13 +59,15 @@ public: ...@@ -59,13 +59,15 @@ public:
* Function GetPosition * Function GetPosition
* returns the position of this object. * returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition() * Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint& - The position of this object. * @return const wxPoint - The position of this object.
*/ */
wxPoint& GetPosition() const wxPoint GetPosition() const
{ {
return m_Start; return m_Start;
} }
void SetPosition( const wxPoint& aPos ) { m_Start = aPos; }
/** /**
* Function GetStart * Function GetStart
* returns the starting point of the graphic * returns the starting point of the graphic
......
...@@ -60,17 +60,18 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source ) ...@@ -60,17 +60,18 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source )
void EDGE_MODULE::SetDrawCoord() void EDGE_MODULE::SetDrawCoord()
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
m_Start = m_Start0; m_Start = m_Start0;
m_End = m_End0; m_End = m_End0;
if( Module ) if( module )
{ {
RotatePoint( &m_Start.x, &m_Start.y, Module->m_Orient ); RotatePoint( &m_Start.x, &m_Start.y, module->GetOrientation() );
RotatePoint( &m_End.x, &m_End.y, Module->m_Orient ); RotatePoint( &m_End.x, &m_End.y, module->GetOrientation() );
m_Start += Module->m_Pos;
m_End += Module->m_Pos; m_Start += module->m_Pos;
m_End += module->m_Pos;
} }
} }
...@@ -196,7 +197,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx ...@@ -196,7 +197,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
{ {
wxPoint& pt = points[ii]; wxPoint& pt = points[ii];
RotatePoint( &pt.x, &pt.y, module->m_Orient ); RotatePoint( &pt.x, &pt.y, module->GetOrientation() );
pt += module->m_Pos - offset; pt += module->m_Pos - offset;
} }
......
...@@ -77,15 +77,12 @@ public: ...@@ -77,15 +77,12 @@ public:
DrawMarker( aPanel, aDC, aDrawMode, aOffset ); DrawMarker( aPanel, aDC, aDrawMode, aOffset );
} }
/** const wxPoint GetPosition() const
* Function GetPosition
* returns the position of this MARKER_PCB.
*/
wxPoint& GetPosition()
{ {
return (wxPoint&) m_Pos; return m_Pos;
} }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; }
/** /**
* Function HitTest * Function HitTest
......
...@@ -30,11 +30,12 @@ public: ...@@ -30,11 +30,12 @@ public:
PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; } PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; }
PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; } PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; }
wxPoint& GetPosition() const wxPoint GetPosition() const
{ {
return m_Pos; return m_Pos;
} }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; }
/** /**
* Function Move * Function Move
......
...@@ -41,7 +41,9 @@ enum Mod_Attribut /* Attributes used for modules */ ...@@ -41,7 +41,9 @@ enum Mod_Attribut /* Attributes used for modules */
class MODULE : public BOARD_ITEM class MODULE : public BOARD_ITEM
{ {
public: public:
int m_Orient; // orientation in 0.1 degrees
wxPoint m_Pos; // Real coord on board wxPoint m_Pos; // Real coord on board
DLIST<D_PAD> m_Pads; /* Pad list (linked list) */ DLIST<D_PAD> m_Pads; /* Pad list (linked list) */
DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */ DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */
...@@ -57,7 +59,6 @@ public: ...@@ -57,7 +59,6 @@ public:
* reannotation of the schematic */ * reannotation of the schematic */
int m_Attributs; /* Flag bits ( see Mod_Attribut ) */ int m_Attributs; /* Flag bits ( see Mod_Attribut ) */
int m_Orient; /* orientation in 0.1 degrees */
int flag; /* Use to trace ratsnest and auto routing. */ int flag; /* Use to trace ratsnest and auto routing. */
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */ int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation. EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation.
...@@ -100,7 +101,6 @@ public: ...@@ -100,7 +101,6 @@ public:
void Copy( MODULE* Module ); // Copy structure void Copy( MODULE* Module ); // Copy structure
/* /*
* Function Add * Function Add
* adds the given item to this MODULE and takes ownership of its memory. * adds the given item to this MODULE and takes ownership of its memory.
...@@ -131,22 +131,17 @@ public: ...@@ -131,22 +131,17 @@ public:
*/ */
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** const wxPoint GetPosition() const // overload
* Function GetPosition
* returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{ {
return m_Pos; return m_Pos;
} }
// Moves void SetPosition( const wxPoint& aPos ); // overload
void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle ); void SetOrientation( int newangle );
int GetOrientation() const { return m_Orient; }
/** /**
* Function Move * Function Move
* move this object. * move this object.
......
...@@ -159,7 +159,7 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle) ...@@ -159,7 +159,7 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle)
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
void MODULE::Flip(const wxPoint& aCentre ) void MODULE::Flip( const wxPoint& aCentre )
{ {
D_PAD* pt_pad; D_PAD* pt_pad;
TEXTE_MODULE* pt_texte; TEXTE_MODULE* pt_texte;
......
...@@ -496,7 +496,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader ) ...@@ -496,7 +496,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
break; break;
case 'L': case 'L':
int lengthdie; int lengthdie;
nn = sscanf( PtLine, "%d", &lengthdie ); nn = sscanf( PtLine, "%d", &lengthdie );
m_LengthDie = lengthdie; m_LengthDie = lengthdie;
break; break;
...@@ -765,7 +765,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -765,7 +765,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Drill X / Y" ), Line, RED ); frame->AppendMsgPanel( _( "Drill X / Y" ), Line, RED );
} }
int module_orient = module ? module->m_Orient : 0; int module_orient = module ? module->GetOrientation() : 0;
if( module_orient ) if( module_orient )
Line.Printf( wxT( "%3.1f(+%3.1f)" ), Line.Printf( wxT( "%3.1f(+%3.1f)" ),
......
...@@ -168,21 +168,12 @@ public: ...@@ -168,21 +168,12 @@ public:
*/ */
int GetShape() const { return m_PadShape & 0xFF; } int GetShape() const { return m_PadShape & 0xFF; }
/** const wxPoint GetPosition() const // overload
* Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{ {
return m_Pos; return m_Pos;
} }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // overload
void SetPosition( const wxPoint& aPos )
{
m_Pos = aPos;
}
/** /**
* Function TransformShapeWithClearanceToPolygon * Function TransformShapeWithClearanceToPolygon
......
...@@ -21,16 +21,16 @@ public: ...@@ -21,16 +21,16 @@ public:
TEXTE_PCB( TEXTE_PCB* textepcb ); TEXTE_PCB( TEXTE_PCB* textepcb );
~TEXTE_PCB(); ~TEXTE_PCB();
/** const wxPoint GetPosition() const // is an overload
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it can be changed
*/
wxPoint& GetPosition()
{ {
return m_Pos; // within EDA_TEXT return m_Pos; // within EDA_TEXT
} }
void SetPosition( const wxPoint& aPos ) // is an overload
{
m_Pos = aPos; // within EDA_TEXT
}
/** /**
* Function Move * Function Move
* move this object. * move this object.
......
...@@ -45,17 +45,15 @@ public: ...@@ -45,17 +45,15 @@ public:
TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; } TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; }
/** const wxPoint GetPosition() const // overload a base
* Function GetPosition
* returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{ {
return m_Pos; return m_Pos; // from EDA_TEXT
} }
void SetPosition( const wxPoint& aPos ) // overload a base
{
m_Pos = aPos; // in EDA_TEXT
}
void Copy( TEXTE_MODULE* source ); // copy structure void Copy( TEXTE_MODULE* source ); // copy structure
......
...@@ -127,6 +127,13 @@ public: ...@@ -127,6 +127,13 @@ public:
return m_Start; // it had to be start or end. return m_Start; // it had to be start or end.
} }
const wxPoint GetPosition() const // overload
{
return m_Start; // it had to be start or end.
}
void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // overload
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** /**
...@@ -465,18 +472,12 @@ public: ...@@ -465,18 +472,12 @@ public:
*/ */
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const; void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
/** const wxPoint GetPosition() const // overload
* Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{ {
return m_Start; return m_Start;
} }
void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; } // overload
void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; }
/** /**
* Function GetClass * Function GetClass
......
...@@ -84,19 +84,13 @@ bool ZONE_CONTAINER::UnFill() ...@@ -84,19 +84,13 @@ bool ZONE_CONTAINER::UnFill()
} }
wxPoint& ZONE_CONTAINER::GetPosition() const wxPoint ZONE_CONTAINER::GetPosition() const
{ {
static wxPoint pos; return m_Poly? GetCornerPosition( 0 ) : wxPoint( 0, 0 );
}
if( m_Poly )
{
pos = GetCornerPosition( 0 );
}
else
pos = wxPoint( 0, 0 );
return pos; void ZONE_CONTAINER::SetPosition( const wxPoint& aPos ) {}
}
void ZONE_CONTAINER::SetNet( int aNetCode ) void ZONE_CONTAINER::SetNet( int aNetCode )
......
...@@ -118,7 +118,8 @@ public: ...@@ -118,7 +118,8 @@ public:
* Function GetPosition * Function GetPosition
* @return a wxPoint, position of the first point of the outline * @return a wxPoint, position of the first point of the outline
*/ */
wxPoint& GetPosition(); const wxPoint GetPosition() const; // overload
void SetPosition( const wxPoint& aPos ); // overload
/** /**
* Function copy * Function copy
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment