Commit a674dd65 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: class DIMENSION: code cleaning

parent ea603c4d
...@@ -50,7 +50,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : ...@@ -50,7 +50,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
m_Text( this ) m_Text( this )
{ {
m_Layer = DRAW_LAYER; m_Layer = DRAW_LAYER;
m_Width = 50; m_Width = Millimeter2iu( 0.2 );
m_Value = 0; m_Value = 0;
m_Shape = 0; m_Shape = 0;
m_Unit = INCHES; m_Unit = INCHES;
...@@ -64,11 +64,16 @@ DIMENSION::~DIMENSION() ...@@ -64,11 +64,16 @@ DIMENSION::~DIMENSION()
void DIMENSION::SetPosition( const wxPoint& aPos ) void DIMENSION::SetPosition( const wxPoint& aPos )
{ {
m_Pos = aPos;
m_Text.SetPos( aPos ); m_Text.SetPos( aPos );
} }
const wxPoint& DIMENSION::GetPosition() const
{
return m_Text.GetPosition();
}
void DIMENSION::SetText( const wxString& aNewText ) void DIMENSION::SetText( const wxString& aNewText )
{ {
m_Text.SetText( aNewText ); m_Text.SetText( aNewText );
...@@ -84,7 +89,7 @@ const wxString DIMENSION::GetText() const ...@@ -84,7 +89,7 @@ const wxString DIMENSION::GetText() const
void DIMENSION::SetLayer( int aLayer ) void DIMENSION::SetLayer( int aLayer )
{ {
m_Layer = aLayer; m_Layer = aLayer;
m_Text.SetLayer( aLayer); m_Text.SetLayer( aLayer );
} }
...@@ -93,82 +98,50 @@ void DIMENSION::Copy( DIMENSION* source ) ...@@ -93,82 +98,50 @@ void DIMENSION::Copy( DIMENSION* source )
m_Value = source->m_Value; m_Value = source->m_Value;
SetLayer( source->GetLayer() ); SetLayer( source->GetLayer() );
m_Width = source->m_Width; m_Width = source->m_Width;
m_Pos = source->m_Pos;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Unit = source->m_Unit; m_Unit = source->m_Unit;
SetTimeStamp( GetNewTimeStamp() ); SetTimeStamp( GetNewTimeStamp() );
m_Text.Copy( &source->m_Text ); m_Text.Copy( &source->m_Text );
m_crossBarOx = source->m_crossBarOx; m_crossBarO = source->m_crossBarO;
m_crossBarOy = source->m_crossBarOy; m_crossBarF = source->m_crossBarF;
m_crossBarFx = source->m_crossBarFx; m_featureLineGO = source->m_featureLineGO;
m_crossBarFy = source->m_crossBarFy; m_featureLineGF = source->m_featureLineGF;
m_featureLineGOx = source->m_featureLineGOx; m_featureLineDO = source->m_featureLineDO;
m_featureLineGOy = source->m_featureLineGOy; m_featureLineDF = source->m_featureLineDF;
m_featureLineGFx = source->m_featureLineGFx; m_arrowD1O = source->m_arrowD1O;
m_featureLineGFy = source->m_featureLineGFy; m_arrowD1F = source->m_arrowD1F;
m_featureLineDOx = source->m_featureLineDOx; m_arrowD2O = source->m_arrowD2O;
m_featureLineDOy = source->m_featureLineDOy; m_arrowD2F = source->m_arrowD2F;
m_featureLineDFx = source->m_featureLineDFx; m_arrowG1O = source->m_arrowG1O;
m_featureLineDFy = source->m_featureLineDFy; m_arrowG1F = source->m_arrowG1F;
m_arrowD1Ox = source->m_arrowD1Ox; m_arrowG2O = source->m_arrowG2O;
m_arrowD1Oy = source->m_arrowD1Oy; m_arrowG2F = source->m_arrowG2F;
m_arrowD1Fx = source->m_arrowD1Fx;
m_arrowD1Fy = source->m_arrowD1Fy;
m_arrowD2Ox = source->m_arrowD2Ox;
m_arrowD2Oy = source->m_arrowD2Oy;
m_arrowD2Fx = source->m_arrowD2Fx;
m_arrowD2Fy = source->m_arrowD2Fy;
m_arrowG1Ox = source->m_arrowG1Ox;
m_arrowG1Oy = source->m_arrowG1Oy;
m_arrowG1Fx = source->m_arrowG1Fx;
m_arrowG1Fy = source->m_arrowG1Fy;
m_arrowG2Ox = source->m_arrowG2Ox;
m_arrowG2Oy = source->m_arrowG2Oy;
m_arrowG2Fx = source->m_arrowG2Fx;
m_arrowG2Fy = source->m_arrowG2Fy;
} }
void DIMENSION::Move( const wxPoint& offset ) void DIMENSION::Move( const wxPoint& offset )
{ {
m_Pos += offset;
m_Text.m_Pos += offset; m_Text.m_Pos += offset;
m_crossBarOx += offset.x; m_crossBarO += offset;
m_crossBarOy += offset.y; m_crossBarF += offset;
m_crossBarFx += offset.x; m_featureLineGO += offset;
m_crossBarFy += offset.y; m_featureLineGF += offset;
m_featureLineGOx += offset.x; m_featureLineDO += offset;
m_featureLineGOy += offset.y; m_featureLineDF += offset;
m_featureLineGFx += offset.x; m_arrowG1O += offset;
m_featureLineGFy += offset.y; m_arrowG1F += offset;
m_featureLineDOx += offset.x; m_arrowG2O += offset;
m_featureLineDOy += offset.y; m_arrowG2F += offset;
m_featureLineDFx += offset.x; m_arrowD1O += offset;
m_featureLineDFy += offset.y; m_arrowD1F += offset;
m_arrowG1Ox += offset.x; m_arrowD2O += offset;
m_arrowG1Oy += offset.y; m_arrowD2F += offset;
m_arrowG1Fx += offset.x;
m_arrowG1Fy += offset.y;
m_arrowG2Ox += offset.x;
m_arrowG2Oy += offset.y;
m_arrowG2Fx += offset.x;
m_arrowG2Fy += offset.y;
m_arrowD1Ox += offset.x;
m_arrowD1Oy += offset.y;
m_arrowD1Fx += offset.x;
m_arrowD1Fy += offset.y;
m_arrowD2Ox += offset.x;
m_arrowD2Oy += offset.y;
m_arrowD2Fx += offset.x;
m_arrowD2Fy += offset.y;
} }
void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle ) void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
{ {
RotatePoint( &m_Pos, aRotCentre, aAngle );
RotatePoint( &m_Text.m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Text.m_Pos, aRotCentre, aAngle );
double newAngle = m_Text.GetOrientation() + aAngle; double newAngle = m_Text.GetOrientation() + aAngle;
...@@ -181,20 +154,20 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle ) ...@@ -181,20 +154,20 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
m_Text.SetOrientation( newAngle ); m_Text.SetOrientation( newAngle );
RotatePoint( &m_crossBarOx, &m_crossBarOy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_crossBarO, aRotCentre, aAngle );
RotatePoint( &m_crossBarFx, &m_crossBarFy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_crossBarF, aRotCentre, aAngle );
RotatePoint( &m_featureLineGOx, &m_featureLineGOy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_featureLineGO, aRotCentre, aAngle );
RotatePoint( &m_featureLineGFx, &m_featureLineGFy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_featureLineGF, aRotCentre, aAngle );
RotatePoint( &m_featureLineDOx, &m_featureLineDOy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_featureLineDO, aRotCentre, aAngle );
RotatePoint( &m_featureLineDFx, &m_featureLineDFy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_featureLineDF, aRotCentre, aAngle );
RotatePoint( &m_arrowG1Ox, &m_arrowG1Oy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowG1O, aRotCentre, aAngle );
RotatePoint( &m_arrowG1Fx, &m_arrowG1Fy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowG1F, aRotCentre, aAngle );
RotatePoint( &m_arrowG2Ox, &m_arrowG2Oy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowG2O, aRotCentre, aAngle );
RotatePoint( &m_arrowG2Fx, &m_arrowG2Fy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowG2F, aRotCentre, aAngle );
RotatePoint( &m_arrowD1Ox, &m_arrowD1Oy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowD1O, aRotCentre, aAngle );
RotatePoint( &m_arrowD1Fx, &m_arrowD1Fy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowD1F, aRotCentre, aAngle );
RotatePoint( &m_arrowD2Ox, &m_arrowD2Oy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowD2O, aRotCentre, aAngle );
RotatePoint( &m_arrowD2Fx, &m_arrowD2Fy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_arrowD2F, aRotCentre, aAngle );
} }
...@@ -208,11 +181,11 @@ void DIMENSION::Flip( const wxPoint& aCentre ) ...@@ -208,11 +181,11 @@ 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 )
INVERT( m_Pos.y );
INVERT( m_Text.m_Pos.y ); INVERT( m_Text.m_Pos.y );
// invert angle // invert angle
double newAngle = m_Text.GetOrientation(); double newAngle = m_Text.GetOrientation();
if( newAngle >= 3600 ) if( newAngle >= 3600 )
newAngle -= 3600; newAngle -= 3600;
...@@ -221,20 +194,20 @@ void DIMENSION::Mirror( const wxPoint& axis_pos ) ...@@ -221,20 +194,20 @@ void DIMENSION::Mirror( const wxPoint& axis_pos )
m_Text.SetOrientation( newAngle ); m_Text.SetOrientation( newAngle );
INVERT( m_crossBarOy ); INVERT( m_crossBarO.y );
INVERT( m_crossBarFy ); INVERT( m_crossBarF.y );
INVERT( m_featureLineGOy ); INVERT( m_featureLineGO.y );
INVERT( m_featureLineGFy ); INVERT( m_featureLineGF.y );
INVERT( m_featureLineDOy ); INVERT( m_featureLineDO.y );
INVERT( m_featureLineDFy ); INVERT( m_featureLineDF.y );
INVERT( m_arrowG1Oy ); INVERT( m_arrowG1O.y );
INVERT( m_arrowG1Fy ); INVERT( m_arrowG1F.y );
INVERT( m_arrowG2Oy ); INVERT( m_arrowG2O.y );
INVERT( m_arrowG2Fy ); INVERT( m_arrowG2F.y );
INVERT( m_arrowD1Oy ); INVERT( m_arrowD1O.y );
INVERT( m_arrowD1Fy ); INVERT( m_arrowD1F.y );
INVERT( m_arrowD2Oy ); INVERT( m_arrowD2O.y );
INVERT( m_arrowD2Fy ); INVERT( m_arrowD2F.y );
} }
...@@ -256,8 +229,8 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -256,8 +229,8 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
ii = m_Text.m_Size.y + ii = m_Text.m_Size.y +
m_Text.GetThickness() + (m_Width * 3); m_Text.GetThickness() + (m_Width * 3);
deltax = m_featureLineDOx - m_featureLineGOx; deltax = m_featureLineDO.x - m_featureLineGO.x;
deltay = m_featureLineDOy - m_featureLineGOy; deltay = m_featureLineDO.y - m_featureLineGO.y;
// Calculate dimension value // Calculate dimension value
measure = KiROUND( hypot( (double) deltax, (double) deltay ) ); measure = KiROUND( hypot( (double) deltax, (double) deltay ) );
...@@ -276,16 +249,16 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -276,16 +249,16 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
hx = (abs) ( (int) ( ( (double) deltay * hx ) / measure ) ); hx = (abs) ( (int) ( ( (double) deltay * hx ) / measure ) );
hy = (abs) ( (int) ( ( (double) deltax * hy ) / measure ) ); hy = (abs) ( (int) ( ( (double) deltax * hy ) / measure ) );
if( m_featureLineGOx > m_crossBarOx ) if( m_featureLineGO.x > m_crossBarO.x )
hx = -hx; hx = -hx;
if( m_featureLineGOx == m_crossBarOx ) if( m_featureLineGO.x == m_crossBarO.x )
hx = 0; hx = 0;
if( m_featureLineGOy > m_crossBarOy ) if( m_featureLineGO.y > m_crossBarO.y )
hy = -hy; hy = -hy;
if( m_featureLineGOy == m_crossBarOy ) if( m_featureLineGO.y == m_crossBarO.y )
hy = 0; hy = 0;
angle_f = angle + (M_PI * 27.5 / 180); angle_f = angle + (M_PI * 27.5 / 180);
...@@ -296,41 +269,42 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -296,41 +269,42 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
arrow_dw_Y = (int) ( arrowz * sin( angle_f ) ); arrow_dw_Y = (int) ( arrowz * sin( angle_f ) );
} }
m_arrowG1Ox = m_crossBarOx; m_arrowG1O.x = m_crossBarO.x;
m_arrowG1Oy = m_crossBarOy; m_arrowG1O.y = m_crossBarO.y;
m_arrowG1Fx = m_crossBarOx + arrow_up_X; m_arrowG1F.x = m_crossBarO.x + arrow_up_X;
m_arrowG1Fy = m_crossBarOy + arrow_up_Y; m_arrowG1F.y = m_crossBarO.y + arrow_up_Y;
m_arrowG2Ox = m_crossBarOx; m_arrowG2O.x = m_crossBarO.x;
m_arrowG2Oy = m_crossBarOy; m_arrowG2O.y = m_crossBarO.y;
m_arrowG2Fx = m_crossBarOx + arrow_dw_X; m_arrowG2F.x = m_crossBarO.x + arrow_dw_X;
m_arrowG2Fy = m_crossBarOy + arrow_dw_Y; m_arrowG2F.y = m_crossBarO.y + arrow_dw_Y;
/* The right arrow is symmetrical to the left. /* The right arrow is symmetrical to the left.
* / = -\ and \ = -/ * / = -\ and \ = -/
*/ */
m_arrowD1Ox = m_crossBarFx; m_arrowD1O.x = m_crossBarF.x;
m_arrowD1Oy = m_crossBarFy; m_arrowD1O.y = m_crossBarF.y;
m_arrowD1Fx = m_crossBarFx - arrow_dw_X; m_arrowD1F.x = m_crossBarF.x - arrow_dw_X;
m_arrowD1Fy = m_crossBarFy - arrow_dw_Y; m_arrowD1F.y = m_crossBarF.y - arrow_dw_Y;
m_arrowD2Ox = m_crossBarFx; m_arrowD2O.x = m_crossBarF.x;
m_arrowD2Oy = m_crossBarFy; m_arrowD2O.y = m_crossBarF.y;
m_arrowD2Fx = m_crossBarFx - arrow_up_X; m_arrowD2F.x = m_crossBarF.x - arrow_up_X;
m_arrowD2Fy = m_crossBarFy - arrow_up_Y; m_arrowD2F.y = m_crossBarF.y - arrow_up_Y;
m_featureLineGFx = m_crossBarOx + hx; m_featureLineGF.x = m_crossBarO.x + hx;
m_featureLineGFy = m_crossBarOy + hy; m_featureLineGF.y = m_crossBarO.y + hy;
m_featureLineDFx = m_crossBarFx + hx; m_featureLineDF.x = m_crossBarF.x + hx;
m_featureLineDFy = m_crossBarFy + hy; m_featureLineDF.y = m_crossBarF.y + hy;
// Calculate the better text position and orientation: // Calculate the better text position and orientation:
m_Pos.x = m_Text.m_Pos.x = (m_crossBarFx + m_featureLineGFx) / 2; m_Text.m_Pos.x = (m_crossBarF.x + m_featureLineGF.x) / 2;
m_Pos.y = m_Text.m_Pos.y = (m_crossBarFy + m_featureLineGFy) / 2; m_Text.m_Pos.y = (m_crossBarF.y + m_featureLineGF.y) / 2;
double newAngle = -(angle * 1800 / M_PI); double newAngle = -(angle * 1800 / M_PI);
if( newAngle < 0 ) if( newAngle < 0 )
newAngle += 3600; newAngle += 3600;
...@@ -354,20 +328,16 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -354,20 +328,16 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
const wxPoint& offset ) const wxPoint& offset )
{ {
int ox, oy, typeaff, width; int typeaff, width;
EDA_COLOR_T gcolor; EDA_COLOR_T gcolor;
BOARD* brd = GetBoard();
ox = -offset.x;
oy = -offset.y;
m_Text.Draw( panel, DC, mode_color, offset );
BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false ) if( brd->IsLayerVisible( m_Layer ) == false )
return; return;
gcolor = brd->GetLayerColor(m_Layer); m_Text.Draw( panel, DC, mode_color, offset );
gcolor = brd->GetLayerColor( m_Layer );
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
...@@ -382,58 +352,37 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, ...@@ -382,58 +352,37 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
width = 0; width = 0;
case FILLED: case FILLED:
GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
m_crossBarOx - ox, m_crossBarOy - oy, m_crossBarF + offset, width, gcolor );
m_crossBarFx - ox, m_crossBarFy - oy, width, gcolor ); GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset,
GRLine( panel->GetClipBox(), DC, m_featureLineGF + offset, width, gcolor );
m_featureLineGOx - ox, m_featureLineGOy - oy, GRLine( panel->GetClipBox(), DC, m_featureLineDO + offset,
m_featureLineGFx - ox, m_featureLineGFy - oy, width, gcolor ); m_featureLineDF + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC, m_arrowD1O + offset,
m_featureLineDOx - ox, m_featureLineDOy - oy, m_arrowD1F + offset, width, gcolor );
m_featureLineDFx - ox, m_featureLineDFy - oy, width, gcolor ); GRLine( panel->GetClipBox(), DC, m_arrowD2O + offset,
GRLine( panel->GetClipBox(), DC, m_arrowD2F + offset, width, gcolor );
m_arrowD1Ox - ox, m_arrowD1Oy - oy, GRLine( panel->GetClipBox(), DC, m_arrowG1O + offset,
m_arrowD1Fx - ox, m_arrowD1Fy - oy, width, gcolor ); m_arrowG1F + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC, m_arrowG2O + offset,
m_arrowD2Ox - ox, m_arrowD2Oy - oy, m_arrowG2F + offset, width, gcolor );
m_arrowD2Fx - ox, m_arrowD2Fy - oy, width, gcolor );
GRLine( panel->GetClipBox(), DC,
m_arrowG1Ox - ox, m_arrowG1Oy - oy,
m_arrowG1Fx - ox, m_arrowG1Fy - oy, width, gcolor );
GRLine( panel->GetClipBox(), DC,
m_arrowG2Ox - ox, m_arrowG2Oy - oy,
m_arrowG2Fx - ox, m_arrowG2Fy - oy, width, gcolor );
break; break;
case SKETCH: case SKETCH:
GRCSegm( panel->GetClipBox(), DC, GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
m_crossBarOx - ox, m_crossBarOy - oy, m_crossBarF + offset, width, gcolor );
m_crossBarFx - ox, m_crossBarFy - oy, GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset,
width, gcolor ); m_featureLineGF + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, GRCSegm( panel->GetClipBox(), DC, m_featureLineDO + offset,
m_featureLineGOx - ox, m_featureLineGOy - oy, m_featureLineDF + offset, width, gcolor );
m_featureLineGFx - ox, m_featureLineGFy - oy, GRCSegm( panel->GetClipBox(), DC, m_arrowD1O + offset,
width, gcolor ); m_arrowD1F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, GRCSegm( panel->GetClipBox(), DC, m_arrowD2O + offset,
m_featureLineDOx - ox, m_featureLineDOy - oy, m_arrowD2F + offset, width, gcolor );
m_featureLineDFx - ox, m_featureLineDFy - oy, GRCSegm( panel->GetClipBox(), DC, m_arrowG1O + offset,
width, gcolor ); m_arrowG1F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, GRCSegm( panel->GetClipBox(), DC, m_arrowG2O + offset,
m_arrowD1Ox - ox, m_arrowD1Oy - oy, m_arrowG2F + offset, width, gcolor );
m_arrowD1Fx - ox, m_arrowD1Fy - oy,
width, gcolor );
GRCSegm( panel->GetClipBox(), DC,
m_arrowD2Ox - ox, m_arrowD2Oy - oy,
m_arrowD2Fx - ox, m_arrowD2Fy - oy,
width, gcolor );
GRCSegm( panel->GetClipBox(), DC,
m_arrowG1Ox - ox, m_arrowG1Oy - oy,
m_arrowG1Fx - ox, m_arrowG1Fy - oy,
width, gcolor );
GRCSegm( panel->GetClipBox(), DC,
m_arrowG2Ox - ox, m_arrowG2Oy - oy,
m_arrowG2Fx - ox, m_arrowG2Fy - oy,
width, gcolor );
break; break;
} }
} }
...@@ -456,12 +405,12 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -456,12 +405,12 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
return true; return true;
// Locate SEGMENTS? // Locate SEGMENTS?
ux0 = m_crossBarOx; ux0 = m_crossBarO.x;
uy0 = m_crossBarOy; uy0 = m_crossBarO.y;
// Recalculate coordinates with ux0, uy0 = origin. // Recalculate coordinates with ux0, uy0 = origin.
dx = m_crossBarFx - ux0; dx = m_crossBarF.x - ux0;
dy = m_crossBarFy - uy0; dy = m_crossBarF.y - uy0;
spot_cX = aPosition.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0; spot_cY = aPosition.y - uy0;
...@@ -469,11 +418,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -469,11 +418,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
ux0 = m_featureLineGOx; ux0 = m_featureLineGO.x;
uy0 = m_featureLineGOy; uy0 = m_featureLineGO.y;
dx = m_featureLineGFx - ux0; dx = m_featureLineGF.x - ux0;
dy = m_featureLineGFy - uy0; dy = m_featureLineGF.y - uy0;
spot_cX = aPosition.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0; spot_cY = aPosition.y - uy0;
...@@ -481,11 +430,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -481,11 +430,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
ux0 = m_featureLineDOx; ux0 = m_featureLineDO.x;
uy0 = m_featureLineDOy; uy0 = m_featureLineDO.y;
dx = m_featureLineDFx - ux0; dx = m_featureLineDF.x - ux0;
dy = m_featureLineDFy - uy0; dy = m_featureLineDF.y - uy0;
spot_cX = aPosition.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0; spot_cY = aPosition.y - uy0;
...@@ -493,11 +442,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -493,11 +442,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
ux0 = m_arrowD1Ox; ux0 = m_arrowD1O.x;
uy0 = m_arrowD1Oy; uy0 = m_arrowD1O.y;
dx = m_arrowD1Fx - ux0; dx = m_arrowD1F.x - ux0;
dy = m_arrowD1Fy - uy0; dy = m_arrowD1F.y - uy0;
spot_cX = aPosition.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0; spot_cY = aPosition.y - uy0;
...@@ -505,11 +454,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -505,11 +454,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
ux0 = m_arrowD2Ox; ux0 = m_arrowD2O.x;
uy0 = m_arrowD2Oy; uy0 = m_arrowD2O.y;
dx = m_arrowD2Fx - ux0; dx = m_arrowD2F.x - ux0;
dy = m_arrowD2Fy - uy0; dy = m_arrowD2F.y - uy0;
spot_cX = aPosition.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0; spot_cY = aPosition.y - uy0;
...@@ -517,11 +466,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -517,11 +466,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
ux0 = m_arrowG1Ox; ux0 = m_arrowG1O.x;
uy0 = m_arrowG1Oy; uy0 = m_arrowG1O.y;
dx = m_arrowG1Fx - ux0; dx = m_arrowG1F.x - ux0;
dy = m_arrowG1Fy - uy0; dy = m_arrowG1F.y - uy0;
spot_cX = aPosition.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0; spot_cY = aPosition.y - uy0;
...@@ -529,11 +478,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -529,11 +478,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
ux0 = m_arrowG2Ox; ux0 = m_arrowG2O.x;
uy0 = m_arrowG2Oy; uy0 = m_arrowG2O.y;
dx = m_arrowG2Fx - ux0; dx = m_arrowG2F.x - ux0;
dy = m_arrowG2Fy - uy0; dy = m_arrowG2F.y - uy0;
spot_cX = aPosition.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0; spot_cY = aPosition.y - uy0;
...@@ -547,7 +496,7 @@ bool DIMENSION::HitTest( const wxPoint& aPosition ) ...@@ -547,7 +496,7 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
bool DIMENSION::HitTest( const EDA_RECT& aRect ) const bool DIMENSION::HitTest( const EDA_RECT& aRect ) const
{ {
if( aRect.Contains( m_Pos ) ) if( aRect.Contains( GetPosition() ) )
return true; return true;
return false; return false;
...@@ -565,23 +514,23 @@ EDA_RECT DIMENSION::GetBoundingBox() const ...@@ -565,23 +514,23 @@ EDA_RECT DIMENSION::GetBoundingBox() const
ymin = bBox.GetY(); ymin = bBox.GetY();
ymax = bBox.GetBottom(); ymax = bBox.GetBottom();
xmin = std::min( xmin, m_crossBarOx ); xmin = std::min( xmin, m_crossBarO.x );
xmin = std::min( xmin, m_crossBarFx ); xmin = std::min( xmin, m_crossBarF.x );
ymin = std::min( ymin, m_crossBarOy ); ymin = std::min( ymin, m_crossBarO.y );
ymin = std::min( ymin, m_crossBarFy ); ymin = std::min( ymin, m_crossBarF.y );
xmax = std::max( xmax, m_crossBarOx ); xmax = std::max( xmax, m_crossBarO.x );
xmax = std::max( xmax, m_crossBarFx ); xmax = std::max( xmax, m_crossBarF.x );
ymax = std::max( ymax, m_crossBarOy ); ymax = std::max( ymax, m_crossBarO.y );
ymax = std::max( ymax, m_crossBarFy ); ymax = std::max( ymax, m_crossBarF.y );
xmin = std::min( xmin, m_featureLineGOx ); xmin = std::min( xmin, m_featureLineGO.x );
xmin = std::min( xmin, m_featureLineGFx ); xmin = std::min( xmin, m_featureLineGF.x );
ymin = std::min( ymin, m_featureLineGOy ); ymin = std::min( ymin, m_featureLineGO.y );
ymin = std::min( ymin, m_featureLineGFy ); ymin = std::min( ymin, m_featureLineGF.y );
xmax = std::max( xmax, m_featureLineGOx ); xmax = std::max( xmax, m_featureLineGO.x );
xmax = std::max( xmax, m_featureLineGFx ); xmax = std::max( xmax, m_featureLineGF.x );
ymax = std::max( ymax, m_featureLineGOy ); ymax = std::max( ymax, m_featureLineGO.y );
ymax = std::max( ymax, m_featureLineGFy ); ymax = std::max( ymax, m_featureLineGF.y );
bBox.SetX( xmin ); bBox.SetX( xmin );
bBox.SetY( ymin ); bBox.SetY( ymin );
......
...@@ -44,20 +44,20 @@ class DIMENSION : public BOARD_ITEM ...@@ -44,20 +44,20 @@ class DIMENSION : public BOARD_ITEM
{ {
public: public:
int m_Width; int m_Width;
wxPoint m_Pos; int m_Shape; // / Currently always 0.
int m_Shape; /// Current always 0. int m_Unit; // / 0 = inches, 1 = mm
int m_Unit; /// 0 = inches, 1 = mm int m_Value; // / value of PCB dimensions.
int m_Value; /// value of PCB dimensions.
TEXTE_PCB m_Text; TEXTE_PCB m_Text;
int m_crossBarOx, m_crossBarOy, m_crossBarFx, m_crossBarFy;
int m_featureLineGOx, m_featureLineGOy, m_featureLineGFx, m_featureLineGFy;
int m_featureLineDOx, m_featureLineDOy, m_featureLineDFx, m_featureLineDFy;
int m_arrowD1Ox, m_arrowD1Oy, m_arrowD1Fx, m_arrowD1Fy;
int m_arrowD2Ox, m_arrowD2Oy, m_arrowD2Fx, m_arrowD2Fy;
int m_arrowG1Ox, m_arrowG1Oy, m_arrowG1Fx, m_arrowG1Fy;
int m_arrowG2Ox, m_arrowG2Oy, m_arrowG2Fx, m_arrowG2Fy;
// private: These member should be private. they are public only due to legacy code
wxPoint m_crossBarO, m_crossBarF;
wxPoint m_featureLineGO, m_featureLineGF;
wxPoint m_featureLineDO, m_featureLineDF;
wxPoint m_arrowD1O, m_arrowD1F;
wxPoint m_arrowD2O, m_arrowD2F;
wxPoint m_arrowG1O, m_arrowG1F;
wxPoint m_arrowG2O, m_arrowG2F;
public: public:
DIMENSION( BOARD_ITEM* aParent ); DIMENSION( BOARD_ITEM* aParent );
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
~DIMENSION(); ~DIMENSION();
const wxPoint& GetPosition() const { return m_Pos; } const wxPoint& GetPosition() const;
void SetPosition( const wxPoint& aPos ); // override, sets m_Text's position too void SetPosition( const wxPoint& aPos ); // override, sets m_Text's position too
......
...@@ -244,26 +244,13 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC ) ...@@ -244,26 +244,13 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension->SetLayer( getActiveLayer() ); aDimension->SetLayer( getActiveLayer() );
aDimension->m_crossBarOx = aDimension->m_crossBarFx = pos.x; aDimension->m_crossBarO = aDimension->m_crossBarF = pos;
aDimension->m_crossBarOy = aDimension->m_crossBarFy = pos.y; aDimension->m_featureLineDO = aDimension->m_featureLineDF = pos;
aDimension->m_featureLineGO = aDimension->m_featureLineGF = pos;
aDimension->m_featureLineDOx = aDimension->m_featureLineDFx = pos.x; aDimension->m_arrowG1O = aDimension->m_arrowG1F = pos;
aDimension->m_featureLineDOy = aDimension->m_featureLineDFy = pos.y; aDimension->m_arrowG2O = aDimension->m_arrowG2F = pos;
aDimension->m_arrowD1O = aDimension->m_arrowD1F = pos;
aDimension->m_featureLineGOx = aDimension->m_featureLineGFx = pos.x; aDimension->m_arrowD2O = aDimension->m_arrowD2F = pos;
aDimension->m_featureLineGOy = aDimension->m_featureLineGFy = pos.y;
aDimension->m_arrowG1Ox = aDimension->m_arrowG1Fx = pos.x;
aDimension->m_arrowG1Oy = aDimension->m_arrowG1Fy = pos.y;
aDimension->m_arrowG2Ox = aDimension->m_arrowG2Fx = pos.x;
aDimension->m_arrowG2Oy = aDimension->m_arrowG2Fy = pos.y;
aDimension->m_arrowD1Ox = aDimension->m_arrowD1Fx = pos.x;
aDimension->m_arrowD1Oy = aDimension->m_arrowD1Fy = pos.y;
aDimension->m_arrowD2Ox = aDimension->m_arrowD2Fx = pos.x;
aDimension->m_arrowD2Oy = aDimension->m_arrowD2Fy = pos.y;
aDimension->m_Text.m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize; aDimension->m_Text.m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize;
int width = GetBoard()->GetDesignSettings().m_PcbTextWidth; int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
...@@ -327,31 +314,28 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -327,31 +314,28 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( status_dimension == 1 ) if( status_dimension == 1 )
{ {
Dimension->m_featureLineDOx = pos.x; Dimension->m_featureLineDO = pos;
Dimension->m_featureLineDOy = pos.y; Dimension->m_crossBarF = Dimension->m_featureLineDO;
Dimension->m_crossBarFx = Dimension->m_featureLineDOx;
Dimension->m_crossBarFy = Dimension->m_featureLineDOy;
Dimension->AdjustDimensionDetails( ); Dimension->AdjustDimensionDetails( );
} }
else else
{ {
int deltax, deltay, dx, dy; wxPoint delta;
int dx, dy;
float angle, depl; float angle, depl;
deltax = Dimension->m_featureLineDOx - Dimension->m_featureLineGOx; delta = Dimension->m_featureLineDO - Dimension->m_featureLineGO;
deltay = Dimension->m_featureLineDOy - Dimension->m_featureLineGOy;
/* Calculating the direction of travel perpendicular to the selected axis. */ /* Calculating the direction of travel perpendicular to the selected axis. */
angle = atan2( (double)deltay, (double)deltax ) + (M_PI / 2); angle = atan2( (double)delta.y, (double)delta.x ) + (M_PI / 2);
deltax = pos.x - Dimension->m_featureLineDOx; delta = pos - Dimension->m_featureLineDO;
deltay = pos.y - Dimension->m_featureLineDOy; depl = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
depl = ( deltax * cos( angle ) ) + ( deltay * sin( angle ) );
dx = (int) ( depl * cos( angle ) ); dx = (int) ( depl * cos( angle ) );
dy = (int) ( depl * sin( angle ) ); dy = (int) ( depl * sin( angle ) );
Dimension->m_crossBarOx = Dimension->m_featureLineGOx + dx; Dimension->m_crossBarO.x = Dimension->m_featureLineGO.x + dx;
Dimension->m_crossBarOy = Dimension->m_featureLineGOy + dy; Dimension->m_crossBarO.y = Dimension->m_featureLineGO.y + dy;
Dimension->m_crossBarFx = Dimension->m_featureLineDOx + dx; Dimension->m_crossBarF.x = Dimension->m_featureLineDO.x + dx;
Dimension->m_crossBarFy = Dimension->m_featureLineDOy + dy; Dimension->m_crossBarF.y = Dimension->m_featureLineDO.y + dy;
Dimension->AdjustDimensionDetails( ); Dimension->AdjustDimensionDetails( );
} }
......
...@@ -644,46 +644,46 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const ...@@ -644,46 +644,46 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
Format( (TEXTE_PCB*) &aDimension->m_Text, aNestLevel+1 ); Format( (TEXTE_PCB*) &aDimension->m_Text, aNestLevel+1 );
m_out->Print( aNestLevel+1, "(feature1 (pts (xy %s %s) (xy %s %s)))\n", m_out->Print( aNestLevel+1, "(feature1 (pts (xy %s %s) (xy %s %s)))\n",
FMT_IU( aDimension->m_featureLineDOx ).c_str(), FMT_IU( aDimension->m_featureLineDO.x ).c_str(),
FMT_IU( aDimension->m_featureLineDOy ).c_str(), FMT_IU( aDimension->m_featureLineDO.y ).c_str(),
FMT_IU( aDimension->m_featureLineDFx ).c_str(), FMT_IU( aDimension->m_featureLineDF.x ).c_str(),
FMT_IU( aDimension->m_featureLineDFy ).c_str() ); FMT_IU( aDimension->m_featureLineDF.y ).c_str() );
m_out->Print( aNestLevel+1, "(feature2 (pts (xy %s %s) (xy %s %s)))\n", m_out->Print( aNestLevel+1, "(feature2 (pts (xy %s %s) (xy %s %s)))\n",
FMT_IU( aDimension->m_featureLineGOx ).c_str(), FMT_IU( aDimension->m_featureLineGO.x ).c_str(),
FMT_IU( aDimension->m_featureLineGOy ).c_str(), FMT_IU( aDimension->m_featureLineGO.y ).c_str(),
FMT_IU( aDimension->m_featureLineGFx ).c_str(), FMT_IU( aDimension->m_featureLineGF.x ).c_str(),
FMT_IU( aDimension->m_featureLineGFy ).c_str() ); FMT_IU( aDimension->m_featureLineGF.y ).c_str() );
m_out->Print( aNestLevel+1, "(crossbar (pts (xy %s %s) (xy %s %s)))\n", m_out->Print( aNestLevel+1, "(crossbar (pts (xy %s %s) (xy %s %s)))\n",
FMT_IU( aDimension->m_crossBarOx ).c_str(), FMT_IU( aDimension->m_crossBarO.x ).c_str(),
FMT_IU( aDimension->m_crossBarOy ).c_str(), FMT_IU( aDimension->m_crossBarO.y ).c_str(),
FMT_IU( aDimension->m_crossBarFx ).c_str(), FMT_IU( aDimension->m_crossBarF.x ).c_str(),
FMT_IU( aDimension->m_crossBarFy ).c_str() ); FMT_IU( aDimension->m_crossBarF.y ).c_str() );
m_out->Print( aNestLevel+1, "(arrow1a (pts (xy %s %s) (xy %s %s)))\n", m_out->Print( aNestLevel+1, "(arrow1a (pts (xy %s %s) (xy %s %s)))\n",
FMT_IU( aDimension->m_arrowD1Ox ).c_str(), FMT_IU( aDimension->m_arrowD1O.x ).c_str(),
FMT_IU( aDimension->m_arrowD1Oy ).c_str(), FMT_IU( aDimension->m_arrowD1O.y ).c_str(),
FMT_IU( aDimension->m_arrowD1Fx ).c_str(), FMT_IU( aDimension->m_arrowD1F.x ).c_str(),
FMT_IU( aDimension->m_arrowD1Fy ).c_str() ); FMT_IU( aDimension->m_arrowD1F.y ).c_str() );
m_out->Print( aNestLevel+1, "(arrow1b (pts (xy %s %s) (xy %s %s)))\n", m_out->Print( aNestLevel+1, "(arrow1b (pts (xy %s %s) (xy %s %s)))\n",
FMT_IU( aDimension->m_arrowD2Ox ).c_str(), FMT_IU( aDimension->m_arrowD2O.x ).c_str(),
FMT_IU( aDimension->m_arrowD2Oy ).c_str(), FMT_IU( aDimension->m_arrowD2O.y ).c_str(),
FMT_IU( aDimension->m_arrowD2Fx ).c_str(), FMT_IU( aDimension->m_arrowD2F.x ).c_str(),
FMT_IU( aDimension->m_arrowD2Fy ).c_str() ); FMT_IU( aDimension->m_arrowD2F.y ).c_str() );
m_out->Print( aNestLevel+1, "(arrow2a (pts (xy %s %s) (xy %s %s)))\n", m_out->Print( aNestLevel+1, "(arrow2a (pts (xy %s %s) (xy %s %s)))\n",
FMT_IU( aDimension->m_arrowG1Ox ).c_str(), FMT_IU( aDimension->m_arrowG1O.x ).c_str(),
FMT_IU( aDimension->m_arrowG1Oy ).c_str(), FMT_IU( aDimension->m_arrowG1O.y ).c_str(),
FMT_IU( aDimension->m_arrowG1Fx ).c_str(), FMT_IU( aDimension->m_arrowG1F.x ).c_str(),
FMT_IU( aDimension->m_arrowG1Fy ).c_str() ); FMT_IU( aDimension->m_arrowG1F.y ).c_str() );
m_out->Print( aNestLevel+1, "(arrow2b (pts (xy %s %s) (xy %s %s)))\n", m_out->Print( aNestLevel+1, "(arrow2b (pts (xy %s %s) (xy %s %s)))\n",
FMT_IU( aDimension->m_arrowG2Ox ).c_str(), FMT_IU( aDimension->m_arrowG2O.x ).c_str(),
FMT_IU( aDimension->m_arrowG2Oy ).c_str(), FMT_IU( aDimension->m_arrowG2O.y ).c_str(),
FMT_IU( aDimension->m_arrowG2Fx ).c_str(), FMT_IU( aDimension->m_arrowG2F.x ).c_str(),
FMT_IU( aDimension->m_arrowG2Fy ).c_str() ); FMT_IU( aDimension->m_arrowG2F.y ).c_str() );
m_out->Print( aNestLevel, ")\n" ); m_out->Print( aNestLevel, ")\n" );
} }
......
...@@ -2485,10 +2485,10 @@ void LEGACY_PLUGIN::loadDIMENSION() ...@@ -2485,10 +2485,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU crossBarFy = biuParse( data, &data ); BIU crossBarFy = biuParse( data, &data );
BIU width = biuParse( data ); BIU width = biuParse( data );
dim->m_crossBarOx = crossBarOx; dim->m_crossBarO.x = crossBarOx;
dim->m_crossBarOy = crossBarOy; dim->m_crossBarO.y = crossBarOy;
dim->m_crossBarFx = crossBarFx; dim->m_crossBarF.x = crossBarFx;
dim->m_crossBarFy = crossBarFy; dim->m_crossBarF.y = crossBarFy;
dim->m_Width = width; dim->m_Width = width;
(void) ignore; (void) ignore;
} }
...@@ -2503,10 +2503,10 @@ void LEGACY_PLUGIN::loadDIMENSION() ...@@ -2503,10 +2503,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU featureLineDFx = biuParse( data, &data ); BIU featureLineDFx = biuParse( data, &data );
BIU featureLineDFy = biuParse( data ); BIU featureLineDFy = biuParse( data );
dim->m_featureLineDOx = featureLineDOx; dim->m_featureLineDO.x = featureLineDOx;
dim->m_featureLineDOy = featureLineDOy; dim->m_featureLineDO.y = featureLineDOy;
dim->m_featureLineDFx = featureLineDFx; dim->m_featureLineDF.x = featureLineDFx;
dim->m_featureLineDFy = featureLineDFy; dim->m_featureLineDF.y = featureLineDFy;
(void) ignore; (void) ignore;
} }
...@@ -2520,10 +2520,10 @@ void LEGACY_PLUGIN::loadDIMENSION() ...@@ -2520,10 +2520,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU featureLineGFx = biuParse( data, &data ); BIU featureLineGFx = biuParse( data, &data );
BIU featureLineGFy = biuParse( data ); BIU featureLineGFy = biuParse( data );
dim->m_featureLineGOx = featureLineGOx; dim->m_featureLineGO.x = featureLineGOx;
dim->m_featureLineGOy = featureLineGOy; dim->m_featureLineGO.y = featureLineGOy;
dim->m_featureLineGFx = featureLineGFx; dim->m_featureLineGF.x = featureLineGFx;
dim->m_featureLineGFy = featureLineGFy; dim->m_featureLineGF.y = featureLineGFy;
(void) ignore; (void) ignore;
} }
...@@ -2537,10 +2537,10 @@ void LEGACY_PLUGIN::loadDIMENSION() ...@@ -2537,10 +2537,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowD1Fx = biuParse( data, &data ); BIU arrowD1Fx = biuParse( data, &data );
BIU arrowD1Fy = biuParse( data ); BIU arrowD1Fy = biuParse( data );
dim->m_arrowD1Ox = arrowD10x; dim->m_arrowD1O.x = arrowD10x;
dim->m_arrowD1Oy = arrowD10y; dim->m_arrowD1O.y = arrowD10y;
dim->m_arrowD1Fx = arrowD1Fx; dim->m_arrowD1F.x = arrowD1Fx;
dim->m_arrowD1Fy = arrowD1Fy; dim->m_arrowD1F.y = arrowD1Fy;
(void) ignore; (void) ignore;
} }
...@@ -2554,10 +2554,10 @@ void LEGACY_PLUGIN::loadDIMENSION() ...@@ -2554,10 +2554,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowD2Fx = biuParse( data, &data ); BIU arrowD2Fx = biuParse( data, &data );
BIU arrowD2Fy = biuParse( data, &data ); BIU arrowD2Fy = biuParse( data, &data );
dim->m_arrowD2Ox = arrowD2Ox; dim->m_arrowD2O.x = arrowD2Ox;
dim->m_arrowD2Oy = arrowD2Oy; dim->m_arrowD2O.y = arrowD2Oy;
dim->m_arrowD2Fx = arrowD2Fx; dim->m_arrowD2F.x = arrowD2Fx;
dim->m_arrowD2Fy = arrowD2Fy; dim->m_arrowD2F.y = arrowD2Fy;
(void) ignore; (void) ignore;
} }
...@@ -2570,10 +2570,10 @@ void LEGACY_PLUGIN::loadDIMENSION() ...@@ -2570,10 +2570,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowG1Fx = biuParse( data, &data ); BIU arrowG1Fx = biuParse( data, &data );
BIU arrowG1Fy = biuParse( data, &data ); BIU arrowG1Fy = biuParse( data, &data );
dim->m_arrowG1Ox = arrowG1Ox; dim->m_arrowG1O.x = arrowG1Ox;
dim->m_arrowG1Oy = arrowG1Oy; dim->m_arrowG1O.y = arrowG1Oy;
dim->m_arrowG1Fx = arrowG1Fx; dim->m_arrowG1F.x = arrowG1Fx;
dim->m_arrowG1Fy = arrowG1Fy; dim->m_arrowG1F.y = arrowG1Fy;
(void) ignore; (void) ignore;
} }
...@@ -2586,10 +2586,10 @@ void LEGACY_PLUGIN::loadDIMENSION() ...@@ -2586,10 +2586,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowG2Fx = biuParse( data, &data ); BIU arrowG2Fx = biuParse( data, &data );
BIU arrowG2Fy = biuParse( data, &data ); BIU arrowG2Fy = biuParse( data, &data );
dim->m_arrowG2Ox = arrowG2Ox; dim->m_arrowG2O.x = arrowG2Ox;
dim->m_arrowG2Oy = arrowG2Oy; dim->m_arrowG2O.y = arrowG2Oy;
dim->m_arrowG2Fx = arrowG2Fx; dim->m_arrowG2F.x = arrowG2Fx;
dim->m_arrowG2Fy = arrowG2Fy; dim->m_arrowG2F.y = arrowG2Fy;
(void) ignore; (void) ignore;
} }
} }
...@@ -3743,38 +3743,38 @@ void LEGACY_PLUGIN::saveDIMENTION( const DIMENSION* me ) const ...@@ -3743,38 +3743,38 @@ void LEGACY_PLUGIN::saveDIMENTION( const DIMENSION* me ) const
); );
fprintf( m_fp, "Sb %d %s %s %s\n", S_SEGMENT, fprintf( m_fp, "Sb %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_crossBarOx, me->m_crossBarOy ).c_str(), fmtBIUPair( me->m_crossBarO.x, me->m_crossBarO.y ).c_str(),
fmtBIUPair( me->m_crossBarFx, me->m_crossBarFy ).c_str(), fmtBIUPair( me->m_crossBarF.x, me->m_crossBarF.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() ); fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "Sd %d %s %s %s\n", S_SEGMENT, fprintf( m_fp, "Sd %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_featureLineDOx, me->m_featureLineDOy ).c_str(), fmtBIUPair( me->m_featureLineDO.x, me->m_featureLineDO.y ).c_str(),
fmtBIUPair( me->m_featureLineDFx, me->m_featureLineDFy ).c_str(), fmtBIUPair( me->m_featureLineDF.x, me->m_featureLineDF.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() ); fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "Sg %d %s %s %s\n", S_SEGMENT, fprintf( m_fp, "Sg %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_featureLineGOx, me->m_featureLineGOy ).c_str(), fmtBIUPair( me->m_featureLineGO.x, me->m_featureLineGO.y ).c_str(),
fmtBIUPair( me->m_featureLineGFx, me->m_featureLineGFy ).c_str(), fmtBIUPair( me->m_featureLineGF.x, me->m_featureLineGF.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() ); fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S1 %d %s %s %s\n", S_SEGMENT, fprintf( m_fp, "S1 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowD1Ox, me->m_arrowD1Oy ).c_str(), fmtBIUPair( me->m_arrowD1O.x, me->m_arrowD1O.y ).c_str(),
fmtBIUPair( me->m_arrowD1Fx, me->m_arrowD1Fy ).c_str(), fmtBIUPair( me->m_arrowD1F.x, me->m_arrowD1F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() ); fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S2 %d %s %s %s\n", S_SEGMENT, fprintf( m_fp, "S2 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowD2Ox, me->m_arrowD2Oy ).c_str(), fmtBIUPair( me->m_arrowD2O.x, me->m_arrowD2O.y ).c_str(),
fmtBIUPair( me->m_arrowD2Fx, me->m_arrowD2Fy ).c_str(), fmtBIUPair( me->m_arrowD2F.x, me->m_arrowD2F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() ); fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S3 %d %s %s %s\n", S_SEGMENT, fprintf( m_fp, "S3 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowG1Ox, me->m_arrowG1Oy ).c_str(), fmtBIUPair( me->m_arrowG1O.x, me->m_arrowG1O.y ).c_str(),
fmtBIUPair( me->m_arrowG1Fx, me->m_arrowG1Fy ).c_str(), fmtBIUPair( me->m_arrowG1F.x, me->m_arrowG1F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() ); fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S4 %d %s %s %s\n", S_SEGMENT, fprintf( m_fp, "S4 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowG2Ox, me->m_arrowG2Oy ).c_str(), fmtBIUPair( me->m_arrowG2O.x, me->m_arrowG2O.y ).c_str(),
fmtBIUPair( me->m_arrowG2Fx, me->m_arrowG2Fy ).c_str(), fmtBIUPair( me->m_arrowG2F.x, me->m_arrowG2F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() ); fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "$endCOTATION\n" ); fprintf( m_fp, "$endCOTATION\n" );
......
...@@ -1418,8 +1418,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1418,8 +1418,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts ) if( token != T_pts )
Expecting( T_pts ); Expecting( T_pts );
parseXY( &dimension->m_featureLineDOx, &dimension->m_featureLineDOy ); parseXY( &dimension->m_featureLineDO.x, &dimension->m_featureLineDO.y );
parseXY( &dimension->m_featureLineDFx, &dimension->m_featureLineDFy ); parseXY( &dimension->m_featureLineDF.x, &dimension->m_featureLineDF.y );
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -1431,8 +1431,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1431,8 +1431,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts ) if( token != T_pts )
Expecting( T_pts ); Expecting( T_pts );
parseXY( &dimension->m_featureLineGOx, &dimension->m_featureLineGOy ); parseXY( &dimension->m_featureLineGO.x, &dimension->m_featureLineGO.y );
parseXY( &dimension->m_featureLineGFx, &dimension->m_featureLineGFy ); parseXY( &dimension->m_featureLineGF.x, &dimension->m_featureLineGF.y );
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -1445,8 +1445,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1445,8 +1445,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts ) if( token != T_pts )
Expecting( T_pts ); Expecting( T_pts );
parseXY( &dimension->m_crossBarOx, &dimension->m_crossBarOy ); parseXY( &dimension->m_crossBarO.x, &dimension->m_crossBarO.y );
parseXY( &dimension->m_crossBarFx, &dimension->m_crossBarFy ); parseXY( &dimension->m_crossBarF.x, &dimension->m_crossBarF.y );
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -1458,8 +1458,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1458,8 +1458,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts ) if( token != T_pts )
Expecting( T_pts ); Expecting( T_pts );
parseXY( &dimension->m_arrowD1Ox, &dimension->m_arrowD1Oy ); parseXY( &dimension->m_arrowD1O.x, &dimension->m_arrowD1O.y );
parseXY( &dimension->m_arrowD1Fx, &dimension->m_arrowD1Fy ); parseXY( &dimension->m_arrowD1F.x, &dimension->m_arrowD1F.y );
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -1471,8 +1471,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1471,8 +1471,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts ) if( token != T_pts )
Expecting( T_pts ); Expecting( T_pts );
parseXY( &dimension->m_arrowD2Ox, &dimension->m_arrowD2Oy ); parseXY( &dimension->m_arrowD2O.x, &dimension->m_arrowD2O.y );
parseXY( &dimension->m_arrowD2Fx, &dimension->m_arrowD2Fy ); parseXY( &dimension->m_arrowD2F.x, &dimension->m_arrowD2F.y );
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -1484,8 +1484,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1484,8 +1484,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts ) if( token != T_pts )
Expecting( T_pts ); Expecting( T_pts );
parseXY( &dimension->m_arrowG1Ox, &dimension->m_arrowG1Oy ); parseXY( &dimension->m_arrowG1O.x, &dimension->m_arrowG1O.y );
parseXY( &dimension->m_arrowG1Fx, &dimension->m_arrowG1Fy ); parseXY( &dimension->m_arrowG1F.x, &dimension->m_arrowG1F.y );
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -1497,8 +1497,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1497,8 +1497,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts ) if( token != T_pts )
Expecting( T_pts ); Expecting( T_pts );
parseXY( &dimension->m_arrowG2Ox, &dimension->m_arrowG2Oy ); parseXY( &dimension->m_arrowG2O.x, &dimension->m_arrowG2O.y );
parseXY( &dimension->m_arrowG2Fx, &dimension->m_arrowG2Fy ); parseXY( &dimension->m_arrowG2F.x, &dimension->m_arrowG2F.y );
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
break; break;
......
...@@ -277,32 +277,32 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) ...@@ -277,32 +277,32 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim )
PlotTextePcb( &aDim->m_Text ); PlotTextePcb( &aDim->m_Text );
draw.SetStart( wxPoint( aDim->m_crossBarOx, aDim->m_crossBarOy )); draw.SetStart( aDim->m_crossBarO );
draw.SetEnd( wxPoint( aDim->m_crossBarFx, aDim->m_crossBarFy )); draw.SetEnd( aDim->m_crossBarF );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_featureLineGOx, aDim->m_featureLineGOy )); draw.SetStart( aDim->m_featureLineGO);
draw.SetEnd( wxPoint( aDim->m_featureLineGFx, aDim->m_featureLineGFy )); draw.SetEnd( aDim->m_featureLineGF );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_featureLineDOx, aDim->m_featureLineDOy )); draw.SetStart( aDim->m_featureLineDO );
draw.SetEnd( wxPoint( aDim->m_featureLineDFx, aDim->m_featureLineDFy )); draw.SetEnd( aDim->m_featureLineDF );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowD1Ox, aDim->m_arrowD1Oy )); draw.SetStart( aDim->m_arrowD1O );
draw.SetEnd( wxPoint( aDim->m_arrowD1Fx, aDim->m_arrowD1Fy )); draw.SetEnd( aDim->m_arrowD1F );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowD2Ox, aDim->m_arrowD2Oy )); draw.SetStart( aDim->m_arrowD2O );
draw.SetEnd( wxPoint( aDim->m_arrowD2Fx, aDim->m_arrowD2Fy )); draw.SetEnd( aDim->m_arrowD2F );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowG1Ox, aDim->m_arrowG1Oy )); draw.SetStart( aDim->m_arrowG1O );
draw.SetEnd( wxPoint( aDim->m_arrowG1Fx, aDim->m_arrowG1Fy )); draw.SetEnd( aDim->m_arrowG1F );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowG2Ox, aDim->m_arrowG2Oy )); draw.SetStart( aDim->m_arrowG2O );
draw.SetEnd( wxPoint( aDim->m_arrowG2Fx, aDim->m_arrowG2Fy )); draw.SetEnd( aDim->m_arrowG2F );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
} }
......
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