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 ) :
m_Text( this )
{
m_Layer = DRAW_LAYER;
m_Width = 50;
m_Width = Millimeter2iu( 0.2 );
m_Value = 0;
m_Shape = 0;
m_Unit = INCHES;
......@@ -64,11 +64,16 @@ DIMENSION::~DIMENSION()
void DIMENSION::SetPosition( const wxPoint& aPos )
{
m_Pos = aPos;
m_Text.SetPos( aPos );
}
const wxPoint& DIMENSION::GetPosition() const
{
return m_Text.GetPosition();
}
void DIMENSION::SetText( const wxString& aNewText )
{
m_Text.SetText( aNewText );
......@@ -84,91 +89,59 @@ const wxString DIMENSION::GetText() const
void DIMENSION::SetLayer( int aLayer )
{
m_Layer = aLayer;
m_Text.SetLayer( aLayer);
m_Text.SetLayer( aLayer );
}
void DIMENSION::Copy( DIMENSION* source )
{
m_Value = source->m_Value;
m_Value = source->m_Value;
SetLayer( source->GetLayer() );
m_Width = source->m_Width;
m_Pos = source->m_Pos;
m_Shape = source->m_Shape;
m_Unit = source->m_Unit;
m_Width = source->m_Width;
m_Shape = source->m_Shape;
m_Unit = source->m_Unit;
SetTimeStamp( GetNewTimeStamp() );
m_Text.Copy( &source->m_Text );
m_crossBarOx = source->m_crossBarOx;
m_crossBarOy = source->m_crossBarOy;
m_crossBarFx = source->m_crossBarFx;
m_crossBarFy = source->m_crossBarFy;
m_featureLineGOx = source->m_featureLineGOx;
m_featureLineGOy = source->m_featureLineGOy;
m_featureLineGFx = source->m_featureLineGFx;
m_featureLineGFy = source->m_featureLineGFy;
m_featureLineDOx = source->m_featureLineDOx;
m_featureLineDOy = source->m_featureLineDOy;
m_featureLineDFx = source->m_featureLineDFx;
m_featureLineDFy = source->m_featureLineDFy;
m_arrowD1Ox = source->m_arrowD1Ox;
m_arrowD1Oy = source->m_arrowD1Oy;
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;
m_crossBarO = source->m_crossBarO;
m_crossBarF = source->m_crossBarF;
m_featureLineGO = source->m_featureLineGO;
m_featureLineGF = source->m_featureLineGF;
m_featureLineDO = source->m_featureLineDO;
m_featureLineDF = source->m_featureLineDF;
m_arrowD1O = source->m_arrowD1O;
m_arrowD1F = source->m_arrowD1F;
m_arrowD2O = source->m_arrowD2O;
m_arrowD2F = source->m_arrowD2F;
m_arrowG1O = source->m_arrowG1O;
m_arrowG1F = source->m_arrowG1F;
m_arrowG2O = source->m_arrowG2O;
m_arrowG2F = source->m_arrowG2F;
}
void DIMENSION::Move( const wxPoint& offset )
{
m_Pos += offset;
m_Text.m_Pos += offset;
m_crossBarOx += offset.x;
m_crossBarOy += offset.y;
m_crossBarFx += offset.x;
m_crossBarFy += offset.y;
m_featureLineGOx += offset.x;
m_featureLineGOy += offset.y;
m_featureLineGFx += offset.x;
m_featureLineGFy += offset.y;
m_featureLineDOx += offset.x;
m_featureLineDOy += offset.y;
m_featureLineDFx += offset.x;
m_featureLineDFy += offset.y;
m_arrowG1Ox += offset.x;
m_arrowG1Oy += offset.y;
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;
m_Text.m_Pos += offset;
m_crossBarO += offset;
m_crossBarF += offset;
m_featureLineGO += offset;
m_featureLineGF += offset;
m_featureLineDO += offset;
m_featureLineDF += offset;
m_arrowG1O += offset;
m_arrowG1F += offset;
m_arrowG2O += offset;
m_arrowG2F += offset;
m_arrowD1O += offset;
m_arrowD1F += offset;
m_arrowD2O += offset;
m_arrowD2F += offset;
}
void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
{
RotatePoint( &m_Pos, aRotCentre, aAngle );
RotatePoint( &m_Text.m_Pos, aRotCentre, aAngle );
double newAngle = m_Text.GetOrientation() + aAngle;
......@@ -181,20 +154,20 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
m_Text.SetOrientation( newAngle );
RotatePoint( &m_crossBarOx, &m_crossBarOy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_crossBarFx, &m_crossBarFy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_featureLineGOx, &m_featureLineGOy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_featureLineGFx, &m_featureLineGFy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_featureLineDOx, &m_featureLineDOy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_featureLineDFx, &m_featureLineDFy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowG1Ox, &m_arrowG1Oy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowG1Fx, &m_arrowG1Fy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowG2Ox, &m_arrowG2Oy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowG2Fx, &m_arrowG2Fy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowD1Ox, &m_arrowD1Oy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowD1Fx, &m_arrowD1Fy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowD2Ox, &m_arrowD2Oy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_arrowD2Fx, &m_arrowD2Fy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_crossBarO, aRotCentre, aAngle );
RotatePoint( &m_crossBarF, aRotCentre, aAngle );
RotatePoint( &m_featureLineGO, aRotCentre, aAngle );
RotatePoint( &m_featureLineGF, aRotCentre, aAngle );
RotatePoint( &m_featureLineDO, aRotCentre, aAngle );
RotatePoint( &m_featureLineDF, aRotCentre, aAngle );
RotatePoint( &m_arrowG1O, aRotCentre, aAngle );
RotatePoint( &m_arrowG1F, aRotCentre, aAngle );
RotatePoint( &m_arrowG2O, aRotCentre, aAngle );
RotatePoint( &m_arrowG2F, aRotCentre, aAngle );
RotatePoint( &m_arrowD1O, aRotCentre, aAngle );
RotatePoint( &m_arrowD1F, aRotCentre, aAngle );
RotatePoint( &m_arrowD2O, aRotCentre, aAngle );
RotatePoint( &m_arrowD2F, aRotCentre, aAngle );
}
......@@ -207,12 +180,12 @@ void DIMENSION::Flip( const wxPoint& aCentre )
void DIMENSION::Mirror( const wxPoint& axis_pos )
{
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
INVERT( m_Pos.y );
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
INVERT( m_Text.m_Pos.y );
// invert angle
double newAngle = m_Text.GetOrientation();
if( newAngle >= 3600 )
newAngle -= 3600;
......@@ -221,20 +194,20 @@ void DIMENSION::Mirror( const wxPoint& axis_pos )
m_Text.SetOrientation( newAngle );
INVERT( m_crossBarOy );
INVERT( m_crossBarFy );
INVERT( m_featureLineGOy );
INVERT( m_featureLineGFy );
INVERT( m_featureLineDOy );
INVERT( m_featureLineDFy );
INVERT( m_arrowG1Oy );
INVERT( m_arrowG1Fy );
INVERT( m_arrowG2Oy );
INVERT( m_arrowG2Fy );
INVERT( m_arrowD1Oy );
INVERT( m_arrowD1Fy );
INVERT( m_arrowD2Oy );
INVERT( m_arrowD2Fy );
INVERT( m_crossBarO.y );
INVERT( m_crossBarF.y );
INVERT( m_featureLineGO.y );
INVERT( m_featureLineGF.y );
INVERT( m_featureLineDO.y );
INVERT( m_featureLineDF.y );
INVERT( m_arrowG1O.y );
INVERT( m_arrowG1F.y );
INVERT( m_arrowG2O.y );
INVERT( m_arrowG2F.y );
INVERT( m_arrowD1O.y );
INVERT( m_arrowD1F.y );
INVERT( m_arrowD2O.y );
INVERT( m_arrowD2F.y );
}
......@@ -242,10 +215,10 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
{
const int arrowz = DMils2iu( 500 ); // size of arrows
int ii;
int measure, deltax, deltay; // value of the measure on X and Y axes
int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
int hx, hy; // dimension line interval
int measure, deltax, deltay; // value of the measure on X and Y axes
int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
int hx, hy; // dimension line interval
double angle, angle_f;
wxString msg;
......@@ -256,8 +229,8 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
ii = m_Text.m_Size.y +
m_Text.GetThickness() + (m_Width * 3);
deltax = m_featureLineDOx - m_featureLineGOx;
deltay = m_featureLineDOy - m_featureLineGOy;
deltax = m_featureLineDO.x - m_featureLineGO.x;
deltay = m_featureLineDO.y - m_featureLineGO.y;
// Calculate dimension value
measure = KiROUND( hypot( (double) deltax, (double) deltay ) );
......@@ -273,64 +246,65 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
// Taking into account the slope of the side lines.
if( measure )
{
hx = (abs) ( (int) ( ( (double) deltay * hx ) / measure ) );
hy = (abs) ( (int) ( ( (double) deltax * hy ) / measure ) );
hx = (abs) ( (int) ( ( (double) deltay * hx ) / measure ) );
hy = (abs) ( (int) ( ( (double) deltax * hy ) / measure ) );
if( m_featureLineGOx > m_crossBarOx )
if( m_featureLineGO.x > m_crossBarO.x )
hx = -hx;
if( m_featureLineGOx == m_crossBarOx )
if( m_featureLineGO.x == m_crossBarO.x )
hx = 0;
if( m_featureLineGOy > m_crossBarOy )
if( m_featureLineGO.y > m_crossBarO.y )
hy = -hy;
if( m_featureLineGOy == m_crossBarOy )
if( m_featureLineGO.y == m_crossBarO.y )
hy = 0;
angle_f = angle + (M_PI * 27.5 / 180);
arrow_up_X = (int) ( arrowz * cos( angle_f ) );
arrow_up_Y = (int) ( arrowz * sin( angle_f ) );
arrow_up_X = (int) ( arrowz * cos( angle_f ) );
arrow_up_Y = (int) ( arrowz * sin( angle_f ) );
angle_f = angle - (M_PI * 27.5 / 180);
arrow_dw_X = (int) ( arrowz * cos( angle_f ) );
arrow_dw_Y = (int) ( arrowz * sin( angle_f ) );
arrow_dw_X = (int) ( arrowz * cos( angle_f ) );
arrow_dw_Y = (int) ( arrowz * sin( angle_f ) );
}
m_arrowG1Ox = m_crossBarOx;
m_arrowG1Oy = m_crossBarOy;
m_arrowG1Fx = m_crossBarOx + arrow_up_X;
m_arrowG1Fy = m_crossBarOy + arrow_up_Y;
m_arrowG1O.x = m_crossBarO.x;
m_arrowG1O.y = m_crossBarO.y;
m_arrowG1F.x = m_crossBarO.x + arrow_up_X;
m_arrowG1F.y = m_crossBarO.y + arrow_up_Y;
m_arrowG2Ox = m_crossBarOx;
m_arrowG2Oy = m_crossBarOy;
m_arrowG2Fx = m_crossBarOx + arrow_dw_X;
m_arrowG2Fy = m_crossBarOy + arrow_dw_Y;
m_arrowG2O.x = m_crossBarO.x;
m_arrowG2O.y = m_crossBarO.y;
m_arrowG2F.x = m_crossBarO.x + arrow_dw_X;
m_arrowG2F.y = m_crossBarO.y + arrow_dw_Y;
/* The right arrow is symmetrical to the left.
* / = -\ and \ = -/
*/
m_arrowD1Ox = m_crossBarFx;
m_arrowD1Oy = m_crossBarFy;
m_arrowD1Fx = m_crossBarFx - arrow_dw_X;
m_arrowD1Fy = m_crossBarFy - arrow_dw_Y;
m_arrowD1O.x = m_crossBarF.x;
m_arrowD1O.y = m_crossBarF.y;
m_arrowD1F.x = m_crossBarF.x - arrow_dw_X;
m_arrowD1F.y = m_crossBarF.y - arrow_dw_Y;
m_arrowD2Ox = m_crossBarFx;
m_arrowD2Oy = m_crossBarFy;
m_arrowD2Fx = m_crossBarFx - arrow_up_X;
m_arrowD2Fy = m_crossBarFy - arrow_up_Y;
m_arrowD2O.x = m_crossBarF.x;
m_arrowD2O.y = m_crossBarF.y;
m_arrowD2F.x = m_crossBarF.x - arrow_up_X;
m_arrowD2F.y = m_crossBarF.y - arrow_up_Y;
m_featureLineGFx = m_crossBarOx + hx;
m_featureLineGFy = m_crossBarOy + hy;
m_featureLineGF.x = m_crossBarO.x + hx;
m_featureLineGF.y = m_crossBarO.y + hy;
m_featureLineDFx = m_crossBarFx + hx;
m_featureLineDFy = m_crossBarFy + hy;
m_featureLineDF.x = m_crossBarF.x + hx;
m_featureLineDF.y = m_crossBarF.y + hy;
// Calculate the better text position and orientation:
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_Text.m_Pos.x = (m_crossBarF.x + m_featureLineGF.x) / 2;
m_Text.m_Pos.y = (m_crossBarF.y + m_featureLineGF.y) / 2;
double newAngle = -(angle * 1800 / M_PI);
if( newAngle < 0 )
newAngle += 3600;
......@@ -345,7 +319,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
if( !aDoNotChangeText )
{
m_Value = measure;
msg = ::CoordinateToString( m_Value );
msg = ::CoordinateToString( m_Value );
SetText( msg );
}
}
......@@ -354,20 +328,16 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
const wxPoint& offset )
{
int ox, oy, typeaff, width;
int typeaff, width;
EDA_COLOR_T gcolor;
ox = -offset.x;
oy = -offset.y;
m_Text.Draw( panel, DC, mode_color, offset );
BOARD * brd = GetBoard( );
BOARD* brd = GetBoard();
if( brd->IsLayerVisible( m_Layer ) == false )
return;
gcolor = brd->GetLayerColor(m_Layer);
m_Text.Draw( panel, DC, mode_color, offset );
gcolor = brd->GetLayerColor( m_Layer );
GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems;
......@@ -382,58 +352,37 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
width = 0;
case FILLED:
GRLine( panel->GetClipBox(), DC,
m_crossBarOx - ox, m_crossBarOy - oy,
m_crossBarFx - ox, m_crossBarFy - oy, width, gcolor );
GRLine( panel->GetClipBox(), DC,
m_featureLineGOx - ox, m_featureLineGOy - oy,
m_featureLineGFx - ox, m_featureLineGFy - oy, width, gcolor );
GRLine( panel->GetClipBox(), DC,
m_featureLineDOx - ox, m_featureLineDOy - oy,
m_featureLineDFx - ox, m_featureLineDFy - oy, width, gcolor );
GRLine( panel->GetClipBox(), DC,
m_arrowD1Ox - ox, m_arrowD1Oy - oy,
m_arrowD1Fx - ox, m_arrowD1Fy - oy, width, gcolor );
GRLine( panel->GetClipBox(), DC,
m_arrowD2Ox - ox, m_arrowD2Oy - oy,
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 );
GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
m_crossBarF + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset,
m_featureLineGF + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_featureLineDO + offset,
m_featureLineDF + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowD1O + offset,
m_arrowD1F + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowD2O + offset,
m_arrowD2F + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowG1O + offset,
m_arrowG1F + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowG2O + offset,
m_arrowG2F + offset, width, gcolor );
break;
case SKETCH:
GRCSegm( panel->GetClipBox(), DC,
m_crossBarOx - ox, m_crossBarOy - oy,
m_crossBarFx - ox, m_crossBarFy - oy,
width, gcolor );
GRCSegm( panel->GetClipBox(), DC,
m_featureLineGOx - ox, m_featureLineGOy - oy,
m_featureLineGFx - ox, m_featureLineGFy - oy,
width, gcolor );
GRCSegm( panel->GetClipBox(), DC,
m_featureLineDOx - ox, m_featureLineDOy - oy,
m_featureLineDFx - ox, m_featureLineDFy - oy,
width, gcolor );
GRCSegm( panel->GetClipBox(), DC,
m_arrowD1Ox - ox, m_arrowD1Oy - oy,
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 );
GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
m_crossBarF + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset,
m_featureLineGF + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_featureLineDO + offset,
m_featureLineDF + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowD1O + offset,
m_arrowD1F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowD2O + offset,
m_arrowD2F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowG1O + offset,
m_arrowG1F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowG2O + offset,
m_arrowG2F + offset, width, gcolor );
break;
}
}
......@@ -456,12 +405,12 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
return true;
// Locate SEGMENTS?
ux0 = m_crossBarOx;
uy0 = m_crossBarOy;
ux0 = m_crossBarO.x;
uy0 = m_crossBarO.y;
// Recalculate coordinates with ux0, uy0 = origin.
dx = m_crossBarFx - ux0;
dy = m_crossBarFy - uy0;
dx = m_crossBarF.x - ux0;
dy = m_crossBarF.y - uy0;
spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0;
......@@ -469,11 +418,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = m_featureLineGOx;
uy0 = m_featureLineGOy;
ux0 = m_featureLineGO.x;
uy0 = m_featureLineGO.y;
dx = m_featureLineGFx - ux0;
dy = m_featureLineGFy - uy0;
dx = m_featureLineGF.x - ux0;
dy = m_featureLineGF.y - uy0;
spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0;
......@@ -481,11 +430,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = m_featureLineDOx;
uy0 = m_featureLineDOy;
ux0 = m_featureLineDO.x;
uy0 = m_featureLineDO.y;
dx = m_featureLineDFx - ux0;
dy = m_featureLineDFy - uy0;
dx = m_featureLineDF.x - ux0;
dy = m_featureLineDF.y - uy0;
spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0;
......@@ -493,11 +442,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = m_arrowD1Ox;
uy0 = m_arrowD1Oy;
ux0 = m_arrowD1O.x;
uy0 = m_arrowD1O.y;
dx = m_arrowD1Fx - ux0;
dy = m_arrowD1Fy - uy0;
dx = m_arrowD1F.x - ux0;
dy = m_arrowD1F.y - uy0;
spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0;
......@@ -505,11 +454,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = m_arrowD2Ox;
uy0 = m_arrowD2Oy;
ux0 = m_arrowD2O.x;
uy0 = m_arrowD2O.y;
dx = m_arrowD2Fx - ux0;
dy = m_arrowD2Fy - uy0;
dx = m_arrowD2F.x - ux0;
dy = m_arrowD2F.y - uy0;
spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0;
......@@ -517,11 +466,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = m_arrowG1Ox;
uy0 = m_arrowG1Oy;
ux0 = m_arrowG1O.x;
uy0 = m_arrowG1O.y;
dx = m_arrowG1Fx - ux0;
dy = m_arrowG1Fy - uy0;
dx = m_arrowG1F.x - ux0;
dy = m_arrowG1F.y - uy0;
spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0;
......@@ -529,11 +478,11 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = m_arrowG2Ox;
uy0 = m_arrowG2Oy;
ux0 = m_arrowG2O.x;
uy0 = m_arrowG2O.y;
dx = m_arrowG2Fx - ux0;
dy = m_arrowG2Fy - uy0;
dx = m_arrowG2F.x - ux0;
dy = m_arrowG2F.y - uy0;
spot_cX = aPosition.x - ux0;
spot_cY = aPosition.y - uy0;
......@@ -547,7 +496,7 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
bool DIMENSION::HitTest( const EDA_RECT& aRect ) const
{
if( aRect.Contains( m_Pos ) )
if( aRect.Contains( GetPosition() ) )
return true;
return false;
......@@ -556,32 +505,32 @@ bool DIMENSION::HitTest( const EDA_RECT& aRect ) const
EDA_RECT DIMENSION::GetBoundingBox() const
{
EDA_RECT bBox;
int xmin, xmax, ymin, ymax;
bBox = m_Text.GetTextBox( -1 );
xmin = bBox.GetX();
xmax = bBox.GetRight();
ymin = bBox.GetY();
ymax = bBox.GetBottom();
xmin = std::min( xmin, m_crossBarOx );
xmin = std::min( xmin, m_crossBarFx );
ymin = std::min( ymin, m_crossBarOy );
ymin = std::min( ymin, m_crossBarFy );
xmax = std::max( xmax, m_crossBarOx );
xmax = std::max( xmax, m_crossBarFx );
ymax = std::max( ymax, m_crossBarOy );
ymax = std::max( ymax, m_crossBarFy );
xmin = std::min( xmin, m_featureLineGOx );
xmin = std::min( xmin, m_featureLineGFx );
ymin = std::min( ymin, m_featureLineGOy );
ymin = std::min( ymin, m_featureLineGFy );
xmax = std::max( xmax, m_featureLineGOx );
xmax = std::max( xmax, m_featureLineGFx );
ymax = std::max( ymax, m_featureLineGOy );
ymax = std::max( ymax, m_featureLineGFy );
EDA_RECT bBox;
int xmin, xmax, ymin, ymax;
bBox = m_Text.GetTextBox( -1 );
xmin = bBox.GetX();
xmax = bBox.GetRight();
ymin = bBox.GetY();
ymax = bBox.GetBottom();
xmin = std::min( xmin, m_crossBarO.x );
xmin = std::min( xmin, m_crossBarF.x );
ymin = std::min( ymin, m_crossBarO.y );
ymin = std::min( ymin, m_crossBarF.y );
xmax = std::max( xmax, m_crossBarO.x );
xmax = std::max( xmax, m_crossBarF.x );
ymax = std::max( ymax, m_crossBarO.y );
ymax = std::max( ymax, m_crossBarF.y );
xmin = std::min( xmin, m_featureLineGO.x );
xmin = std::min( xmin, m_featureLineGF.x );
ymin = std::min( ymin, m_featureLineGO.y );
ymin = std::min( ymin, m_featureLineGF.y );
xmax = std::max( xmax, m_featureLineGO.x );
xmax = std::max( xmax, m_featureLineGF.x );
ymax = std::max( ymax, m_featureLineGO.y );
ymax = std::max( ymax, m_featureLineGF.y );
bBox.SetX( xmin );
bBox.SetY( ymin );
......
......@@ -43,21 +43,21 @@ class TEXTE_PCB;
class DIMENSION : public BOARD_ITEM
{
public:
int m_Width;
wxPoint m_Pos;
int m_Shape; /// Current always 0.
int m_Unit; /// 0 = inches, 1 = mm
int m_Value; /// value of PCB dimensions.
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;
int m_Width;
int m_Shape; // / Currently always 0.
int m_Unit; // / 0 = inches, 1 = mm
int m_Value; // / value of PCB dimensions.
TEXTE_PCB m_Text;
// 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:
DIMENSION( BOARD_ITEM* aParent );
......@@ -65,9 +65,9 @@ public:
~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
void SetTextSize( const wxSize& aTextSize )
{
......@@ -77,9 +77,9 @@ public:
void SetLayer( int aLayer );
void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
int GetShape() const { return m_Shape; }
int GetWidth() const { return m_Width; }
int GetWidth() const { return m_Width; }
void SetWidth( int aWidth ) { m_Width = aWidth; }
/**
......@@ -87,25 +87,25 @@ public:
* Calculate coordinates of segments used to draw the dimension.
* @param aDoNotChangeText (bool) if false, the dimension text is initialized
*/
void AdjustDimensionDetails( bool aDoNotChangeText = false );
void AdjustDimensionDetails( bool aDoNotChangeText = false );
void SetText( const wxString& NewText );
const wxString GetText() const;
void SetText( const wxString& NewText );
const wxString GetText() const;
void Copy( DIMENSION* source );
void Copy( DIMENSION* source );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aColorMode, const wxPoint& offset = ZeroOffset );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aColorMode, const wxPoint& offset = ZeroOffset );
/**
* Function Move
* @param offset : moving vector
*/
void Move( const wxPoint& offset );
void Move( const wxPoint& offset );
void Rotate( const wxPoint& aRotCentre, double aAngle );
void Rotate( const wxPoint& aRotCentre, double aAngle );
void Flip( const wxPoint& aCentre );
void Flip( const wxPoint& aCentre );
/**
* Function Mirror
......@@ -114,30 +114,30 @@ public:
* the layer is not changed
* @param axis_pos : vertical axis position
*/
void Mirror( const wxPoint& axis_pos );
void Mirror( const wxPoint& axis_pos );
void DisplayInfo( EDA_DRAW_FRAME* frame );
void DisplayInfo( EDA_DRAW_FRAME* frame );
bool HitTest( const wxPoint& aPosition );
bool HitTest( const wxPoint& aPosition );
bool HitTest( const EDA_RECT& aRect ) const;
bool HitTest( const EDA_RECT& aRect ) const;
wxString GetClass() const
{
return wxT( "DIMENSION" );
}
EDA_RECT GetBoundingBox() const;
EDA_RECT GetBoundingBox() const;
wxString GetSelectMenuText() const;
wxString GetSelectMenuText() const;
BITMAP_DEF GetMenuImage() const { return add_dimension_xpm; }
BITMAP_DEF GetMenuImage() const { return add_dimension_xpm; }
EDA_ITEM* Clone() const;
EDA_ITEM* Clone() const;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif
};
#endif // DIMENSION_H_
#endif // DIMENSION_H_
......@@ -244,26 +244,13 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension->SetLayer( getActiveLayer() );
aDimension->m_crossBarOx = aDimension->m_crossBarFx = pos.x;
aDimension->m_crossBarOy = aDimension->m_crossBarFy = pos.y;
aDimension->m_featureLineDOx = aDimension->m_featureLineDFx = pos.x;
aDimension->m_featureLineDOy = aDimension->m_featureLineDFy = pos.y;
aDimension->m_featureLineGOx = aDimension->m_featureLineGFx = pos.x;
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_crossBarO = aDimension->m_crossBarF = pos;
aDimension->m_featureLineDO = aDimension->m_featureLineDF = pos;
aDimension->m_featureLineGO = aDimension->m_featureLineGF = pos;
aDimension->m_arrowG1O = aDimension->m_arrowG1F = pos;
aDimension->m_arrowG2O = aDimension->m_arrowG2F = pos;
aDimension->m_arrowD1O = aDimension->m_arrowD1F = pos;
aDimension->m_arrowD2O = aDimension->m_arrowD2F = pos;
aDimension->m_Text.m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize;
int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
......@@ -327,31 +314,28 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( status_dimension == 1 )
{
Dimension->m_featureLineDOx = pos.x;
Dimension->m_featureLineDOy = pos.y;
Dimension->m_crossBarFx = Dimension->m_featureLineDOx;
Dimension->m_crossBarFy = Dimension->m_featureLineDOy;
Dimension->m_featureLineDO = pos;
Dimension->m_crossBarF = Dimension->m_featureLineDO;
Dimension->AdjustDimensionDetails( );
}
else
{
int deltax, deltay, dx, dy;
wxPoint delta;
int dx, dy;
float angle, depl;
deltax = Dimension->m_featureLineDOx - Dimension->m_featureLineGOx;
deltay = Dimension->m_featureLineDOy - Dimension->m_featureLineGOy;
delta = Dimension->m_featureLineDO - Dimension->m_featureLineGO;
/* 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;
deltay = pos.y - Dimension->m_featureLineDOy;
depl = ( deltax * cos( angle ) ) + ( deltay * sin( angle ) );
delta = pos - Dimension->m_featureLineDO;
depl = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
dx = (int) ( depl * cos( angle ) );
dy = (int) ( depl * sin( angle ) );
Dimension->m_crossBarOx = Dimension->m_featureLineGOx + dx;
Dimension->m_crossBarOy = Dimension->m_featureLineGOy + dy;
Dimension->m_crossBarFx = Dimension->m_featureLineDOx + dx;
Dimension->m_crossBarFy = Dimension->m_featureLineDOy + dy;
Dimension->m_crossBarO.x = Dimension->m_featureLineGO.x + dx;
Dimension->m_crossBarO.y = Dimension->m_featureLineGO.y + dy;
Dimension->m_crossBarF.x = Dimension->m_featureLineDO.x + dx;
Dimension->m_crossBarF.y = Dimension->m_featureLineDO.y + dy;
Dimension->AdjustDimensionDetails( );
}
......
......@@ -644,46 +644,46 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
Format( (TEXTE_PCB*) &aDimension->m_Text, aNestLevel+1 );
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_featureLineDOy ).c_str(),
FMT_IU( aDimension->m_featureLineDFx ).c_str(),
FMT_IU( aDimension->m_featureLineDFy ).c_str() );
FMT_IU( aDimension->m_featureLineDO.x ).c_str(),
FMT_IU( aDimension->m_featureLineDO.y ).c_str(),
FMT_IU( aDimension->m_featureLineDF.x ).c_str(),
FMT_IU( aDimension->m_featureLineDF.y ).c_str() );
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_featureLineGOy ).c_str(),
FMT_IU( aDimension->m_featureLineGFx ).c_str(),
FMT_IU( aDimension->m_featureLineGFy ).c_str() );
FMT_IU( aDimension->m_featureLineGO.x ).c_str(),
FMT_IU( aDimension->m_featureLineGO.y ).c_str(),
FMT_IU( aDimension->m_featureLineGF.x ).c_str(),
FMT_IU( aDimension->m_featureLineGF.y ).c_str() );
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_crossBarOy ).c_str(),
FMT_IU( aDimension->m_crossBarFx ).c_str(),
FMT_IU( aDimension->m_crossBarFy ).c_str() );
FMT_IU( aDimension->m_crossBarO.x ).c_str(),
FMT_IU( aDimension->m_crossBarO.y ).c_str(),
FMT_IU( aDimension->m_crossBarF.x ).c_str(),
FMT_IU( aDimension->m_crossBarF.y ).c_str() );
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_arrowD1Oy ).c_str(),
FMT_IU( aDimension->m_arrowD1Fx ).c_str(),
FMT_IU( aDimension->m_arrowD1Fy ).c_str() );
FMT_IU( aDimension->m_arrowD1O.x ).c_str(),
FMT_IU( aDimension->m_arrowD1O.y ).c_str(),
FMT_IU( aDimension->m_arrowD1F.x ).c_str(),
FMT_IU( aDimension->m_arrowD1F.y ).c_str() );
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_arrowD2Oy ).c_str(),
FMT_IU( aDimension->m_arrowD2Fx ).c_str(),
FMT_IU( aDimension->m_arrowD2Fy ).c_str() );
FMT_IU( aDimension->m_arrowD2O.x ).c_str(),
FMT_IU( aDimension->m_arrowD2O.y ).c_str(),
FMT_IU( aDimension->m_arrowD2F.x ).c_str(),
FMT_IU( aDimension->m_arrowD2F.y ).c_str() );
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_arrowG1Oy ).c_str(),
FMT_IU( aDimension->m_arrowG1Fx ).c_str(),
FMT_IU( aDimension->m_arrowG1Fy ).c_str() );
FMT_IU( aDimension->m_arrowG1O.x ).c_str(),
FMT_IU( aDimension->m_arrowG1O.y ).c_str(),
FMT_IU( aDimension->m_arrowG1F.x ).c_str(),
FMT_IU( aDimension->m_arrowG1F.y ).c_str() );
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_arrowG2Oy ).c_str(),
FMT_IU( aDimension->m_arrowG2Fx ).c_str(),
FMT_IU( aDimension->m_arrowG2Fy ).c_str() );
FMT_IU( aDimension->m_arrowG2O.x ).c_str(),
FMT_IU( aDimension->m_arrowG2O.y ).c_str(),
FMT_IU( aDimension->m_arrowG2F.x ).c_str(),
FMT_IU( aDimension->m_arrowG2F.y ).c_str() );
m_out->Print( aNestLevel, ")\n" );
}
......
......@@ -2485,10 +2485,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU crossBarFy = biuParse( data, &data );
BIU width = biuParse( data );
dim->m_crossBarOx = crossBarOx;
dim->m_crossBarOy = crossBarOy;
dim->m_crossBarFx = crossBarFx;
dim->m_crossBarFy = crossBarFy;
dim->m_crossBarO.x = crossBarOx;
dim->m_crossBarO.y = crossBarOy;
dim->m_crossBarF.x = crossBarFx;
dim->m_crossBarF.y = crossBarFy;
dim->m_Width = width;
(void) ignore;
}
......@@ -2503,10 +2503,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU featureLineDFx = biuParse( data, &data );
BIU featureLineDFy = biuParse( data );
dim->m_featureLineDOx = featureLineDOx;
dim->m_featureLineDOy = featureLineDOy;
dim->m_featureLineDFx = featureLineDFx;
dim->m_featureLineDFy = featureLineDFy;
dim->m_featureLineDO.x = featureLineDOx;
dim->m_featureLineDO.y = featureLineDOy;
dim->m_featureLineDF.x = featureLineDFx;
dim->m_featureLineDF.y = featureLineDFy;
(void) ignore;
}
......@@ -2520,10 +2520,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU featureLineGFx = biuParse( data, &data );
BIU featureLineGFy = biuParse( data );
dim->m_featureLineGOx = featureLineGOx;
dim->m_featureLineGOy = featureLineGOy;
dim->m_featureLineGFx = featureLineGFx;
dim->m_featureLineGFy = featureLineGFy;
dim->m_featureLineGO.x = featureLineGOx;
dim->m_featureLineGO.y = featureLineGOy;
dim->m_featureLineGF.x = featureLineGFx;
dim->m_featureLineGF.y = featureLineGFy;
(void) ignore;
}
......@@ -2537,10 +2537,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowD1Fx = biuParse( data, &data );
BIU arrowD1Fy = biuParse( data );
dim->m_arrowD1Ox = arrowD10x;
dim->m_arrowD1Oy = arrowD10y;
dim->m_arrowD1Fx = arrowD1Fx;
dim->m_arrowD1Fy = arrowD1Fy;
dim->m_arrowD1O.x = arrowD10x;
dim->m_arrowD1O.y = arrowD10y;
dim->m_arrowD1F.x = arrowD1Fx;
dim->m_arrowD1F.y = arrowD1Fy;
(void) ignore;
}
......@@ -2554,10 +2554,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowD2Fx = biuParse( data, &data );
BIU arrowD2Fy = biuParse( data, &data );
dim->m_arrowD2Ox = arrowD2Ox;
dim->m_arrowD2Oy = arrowD2Oy;
dim->m_arrowD2Fx = arrowD2Fx;
dim->m_arrowD2Fy = arrowD2Fy;
dim->m_arrowD2O.x = arrowD2Ox;
dim->m_arrowD2O.y = arrowD2Oy;
dim->m_arrowD2F.x = arrowD2Fx;
dim->m_arrowD2F.y = arrowD2Fy;
(void) ignore;
}
......@@ -2570,10 +2570,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowG1Fx = biuParse( data, &data );
BIU arrowG1Fy = biuParse( data, &data );
dim->m_arrowG1Ox = arrowG1Ox;
dim->m_arrowG1Oy = arrowG1Oy;
dim->m_arrowG1Fx = arrowG1Fx;
dim->m_arrowG1Fy = arrowG1Fy;
dim->m_arrowG1O.x = arrowG1Ox;
dim->m_arrowG1O.y = arrowG1Oy;
dim->m_arrowG1F.x = arrowG1Fx;
dim->m_arrowG1F.y = arrowG1Fy;
(void) ignore;
}
......@@ -2586,10 +2586,10 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowG2Fx = biuParse( data, &data );
BIU arrowG2Fy = biuParse( data, &data );
dim->m_arrowG2Ox = arrowG2Ox;
dim->m_arrowG2Oy = arrowG2Oy;
dim->m_arrowG2Fx = arrowG2Fx;
dim->m_arrowG2Fy = arrowG2Fy;
dim->m_arrowG2O.x = arrowG2Ox;
dim->m_arrowG2O.y = arrowG2Oy;
dim->m_arrowG2F.x = arrowG2Fx;
dim->m_arrowG2F.y = arrowG2Fy;
(void) ignore;
}
}
......@@ -3743,38 +3743,38 @@ void LEGACY_PLUGIN::saveDIMENTION( const DIMENSION* me ) const
);
fprintf( m_fp, "Sb %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_crossBarOx, me->m_crossBarOy ).c_str(),
fmtBIUPair( me->m_crossBarFx, me->m_crossBarFy ).c_str(),
fmtBIUPair( me->m_crossBarO.x, me->m_crossBarO.y ).c_str(),
fmtBIUPair( me->m_crossBarF.x, me->m_crossBarF.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "Sd %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_featureLineDOx, me->m_featureLineDOy ).c_str(),
fmtBIUPair( me->m_featureLineDFx, me->m_featureLineDFy ).c_str(),
fmtBIUPair( me->m_featureLineDO.x, me->m_featureLineDO.y ).c_str(),
fmtBIUPair( me->m_featureLineDF.x, me->m_featureLineDF.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "Sg %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_featureLineGOx, me->m_featureLineGOy ).c_str(),
fmtBIUPair( me->m_featureLineGFx, me->m_featureLineGFy ).c_str(),
fmtBIUPair( me->m_featureLineGO.x, me->m_featureLineGO.y ).c_str(),
fmtBIUPair( me->m_featureLineGF.x, me->m_featureLineGF.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S1 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowD1Ox, me->m_arrowD1Oy ).c_str(),
fmtBIUPair( me->m_arrowD1Fx, me->m_arrowD1Fy ).c_str(),
fmtBIUPair( me->m_arrowD1O.x, me->m_arrowD1O.y ).c_str(),
fmtBIUPair( me->m_arrowD1F.x, me->m_arrowD1F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S2 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowD2Ox, me->m_arrowD2Oy ).c_str(),
fmtBIUPair( me->m_arrowD2Fx, me->m_arrowD2Fy ).c_str(),
fmtBIUPair( me->m_arrowD2O.x, me->m_arrowD2O.y ).c_str(),
fmtBIUPair( me->m_arrowD2F.x, me->m_arrowD2F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S3 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowG1Ox, me->m_arrowG1Oy ).c_str(),
fmtBIUPair( me->m_arrowG1Fx, me->m_arrowG1Fy ).c_str(),
fmtBIUPair( me->m_arrowG1O.x, me->m_arrowG1O.y ).c_str(),
fmtBIUPair( me->m_arrowG1F.x, me->m_arrowG1F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S4 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowG2Ox, me->m_arrowG2Oy ).c_str(),
fmtBIUPair( me->m_arrowG2Fx, me->m_arrowG2Fy ).c_str(),
fmtBIUPair( me->m_arrowG2O.x, me->m_arrowG2O.y ).c_str(),
fmtBIUPair( me->m_arrowG2F.x, me->m_arrowG2F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "$endCOTATION\n" );
......
......@@ -1418,8 +1418,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_featureLineDOx, &dimension->m_featureLineDOy );
parseXY( &dimension->m_featureLineDFx, &dimension->m_featureLineDFy );
parseXY( &dimension->m_featureLineDO.x, &dimension->m_featureLineDO.y );
parseXY( &dimension->m_featureLineDF.x, &dimension->m_featureLineDF.y );
NeedRIGHT();
NeedRIGHT();
break;
......@@ -1431,8 +1431,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_featureLineGOx, &dimension->m_featureLineGOy );
parseXY( &dimension->m_featureLineGFx, &dimension->m_featureLineGFy );
parseXY( &dimension->m_featureLineGO.x, &dimension->m_featureLineGO.y );
parseXY( &dimension->m_featureLineGF.x, &dimension->m_featureLineGF.y );
NeedRIGHT();
NeedRIGHT();
break;
......@@ -1445,8 +1445,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_crossBarOx, &dimension->m_crossBarOy );
parseXY( &dimension->m_crossBarFx, &dimension->m_crossBarFy );
parseXY( &dimension->m_crossBarO.x, &dimension->m_crossBarO.y );
parseXY( &dimension->m_crossBarF.x, &dimension->m_crossBarF.y );
NeedRIGHT();
NeedRIGHT();
break;
......@@ -1458,8 +1458,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowD1Ox, &dimension->m_arrowD1Oy );
parseXY( &dimension->m_arrowD1Fx, &dimension->m_arrowD1Fy );
parseXY( &dimension->m_arrowD1O.x, &dimension->m_arrowD1O.y );
parseXY( &dimension->m_arrowD1F.x, &dimension->m_arrowD1F.y );
NeedRIGHT();
NeedRIGHT();
break;
......@@ -1471,8 +1471,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowD2Ox, &dimension->m_arrowD2Oy );
parseXY( &dimension->m_arrowD2Fx, &dimension->m_arrowD2Fy );
parseXY( &dimension->m_arrowD2O.x, &dimension->m_arrowD2O.y );
parseXY( &dimension->m_arrowD2F.x, &dimension->m_arrowD2F.y );
NeedRIGHT();
NeedRIGHT();
break;
......@@ -1484,8 +1484,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowG1Ox, &dimension->m_arrowG1Oy );
parseXY( &dimension->m_arrowG1Fx, &dimension->m_arrowG1Fy );
parseXY( &dimension->m_arrowG1O.x, &dimension->m_arrowG1O.y );
parseXY( &dimension->m_arrowG1F.x, &dimension->m_arrowG1F.y );
NeedRIGHT();
NeedRIGHT();
break;
......@@ -1497,8 +1497,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowG2Ox, &dimension->m_arrowG2Oy );
parseXY( &dimension->m_arrowG2Fx, &dimension->m_arrowG2Fy );
parseXY( &dimension->m_arrowG2O.x, &dimension->m_arrowG2O.y );
parseXY( &dimension->m_arrowG2F.x, &dimension->m_arrowG2F.y );
NeedRIGHT();
NeedRIGHT();
break;
......
......@@ -277,32 +277,32 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim )
PlotTextePcb( &aDim->m_Text );
draw.SetStart( wxPoint( aDim->m_crossBarOx, aDim->m_crossBarOy ));
draw.SetEnd( wxPoint( aDim->m_crossBarFx, aDim->m_crossBarFy ));
draw.SetStart( aDim->m_crossBarO );
draw.SetEnd( aDim->m_crossBarF );
PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_featureLineGOx, aDim->m_featureLineGOy ));
draw.SetEnd( wxPoint( aDim->m_featureLineGFx, aDim->m_featureLineGFy ));
draw.SetStart( aDim->m_featureLineGO);
draw.SetEnd( aDim->m_featureLineGF );
PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_featureLineDOx, aDim->m_featureLineDOy ));
draw.SetEnd( wxPoint( aDim->m_featureLineDFx, aDim->m_featureLineDFy ));
draw.SetStart( aDim->m_featureLineDO );
draw.SetEnd( aDim->m_featureLineDF );
PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowD1Ox, aDim->m_arrowD1Oy ));
draw.SetEnd( wxPoint( aDim->m_arrowD1Fx, aDim->m_arrowD1Fy ));
draw.SetStart( aDim->m_arrowD1O );
draw.SetEnd( aDim->m_arrowD1F );
PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowD2Ox, aDim->m_arrowD2Oy ));
draw.SetEnd( wxPoint( aDim->m_arrowD2Fx, aDim->m_arrowD2Fy ));
draw.SetStart( aDim->m_arrowD2O );
draw.SetEnd( aDim->m_arrowD2F );
PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowG1Ox, aDim->m_arrowG1Oy ));
draw.SetEnd( wxPoint( aDim->m_arrowG1Fx, aDim->m_arrowG1Fy ));
draw.SetStart( aDim->m_arrowG1O );
draw.SetEnd( aDim->m_arrowG1F );
PlotDrawSegment( &draw );
draw.SetStart( wxPoint( aDim->m_arrowG2Ox, aDim->m_arrowG2Oy ));
draw.SetEnd( wxPoint( aDim->m_arrowG2Fx, aDim->m_arrowG2Fy ));
draw.SetStart( aDim->m_arrowG2O );
draw.SetEnd( aDim->m_arrowG2F );
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