Commit 46db6ac1 authored by Maciej Suminski's avatar Maciej Suminski

Removed redundant fields DIMENSION::m_arrowD1O, m_arrowD2O, m_arrowG1O,...

Removed redundant fields DIMENSION::m_arrowD1O, m_arrowD2O, m_arrowG1O, m_arrowG2O (==m_crossBarO/F).
Added DIMENSION::SetOrigin(), DIMENSION::SetEnd(), DIMENSION::GetOrigin(), DIMENSION::GetEnd(), DIMENSION::GetHeight().
Fixed flipping for DIMENSION class.
Added an information that helps to understand roles of the points in the DIMENSION class.
Some minor changes to PCB_PAINTER (mainly using const COLOR4D& for taking the result of GetColor() function).
parent 2aef11a5
......@@ -109,13 +109,9 @@ void DIMENSION::Copy( DIMENSION* source )
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;
}
......@@ -129,13 +125,9 @@ void DIMENSION::Move( const wxPoint& 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;
}
......@@ -162,13 +154,9 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double 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 );
}
......@@ -190,15 +178,7 @@ void DIMENSION::Mirror( const wxPoint& axis_pos )
m_Text.SetTextPosition( newPos );
// invert angle
double newAngle = m_Text.GetOrientation();
if( newAngle >= 3600 )
newAngle -= 3600;
if( newAngle > 900 && newAngle < 2700 )
newAngle -= 1800;
m_Text.SetOrientation( newAngle );
m_Text.SetOrientation( -m_Text.GetOrientation() );
INVERT( m_crossBarO.y );
INVERT( m_crossBarF.y );
......@@ -206,17 +186,47 @@ void DIMENSION::Mirror( const wxPoint& axis_pos )
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 );
}
void DIMENSION::SetOrigin( const wxPoint& aOrigin )
{
m_crossBarO = aOrigin;
m_featureLineGO = aOrigin;
AdjustDimensionDetails();
}
void DIMENSION::SetEnd( const wxPoint& aEnd )
{
m_crossBarF = aEnd;
m_featureLineDO = aEnd;
AdjustDimensionDetails();
}
void DIMENSION::SetHeight( double aHeight )
{
/* Calculating the direction of travel perpendicular to the selected axis. */
double angle = GetAngle() + ( M_PI / 2 );
int dx = KiROUND( aHeight * cos( angle ) );
int dy = KiROUND( aHeight * sin( angle ) );
m_crossBarO.x = m_featureLineGO.x + dx;
m_crossBarO.y = m_featureLineGO.y + dy;
m_crossBarF.x = m_featureLineDO.x + dx;
m_crossBarF.y = m_featureLineDO.y + dy;
AdjustDimensionDetails();
}
void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
{
const int arrowz = DMils2iu( 500 ); // size of arrows
......@@ -271,30 +281,21 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
arrow_dw_Y = wxRound( arrowz * sin( angle_f ) );
}
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_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_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_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_featureLineGF.x = m_crossBarO.x + hx;
m_featureLineGF.y = m_crossBarO.y + hy;
......@@ -358,13 +359,13 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
m_featureLineGF + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_featureLineDO + offset,
m_featureLineDF + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowD1O + offset,
GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
m_arrowD1F + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowD2O + offset,
GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
m_arrowD2F + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowG1O + offset,
GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
m_arrowG1F + offset, width, gcolor );
GRLine( panel->GetClipBox(), DC, m_arrowG2O + offset,
GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
m_arrowG2F + offset, width, gcolor );
break;
......@@ -375,13 +376,13 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
m_featureLineGF + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_featureLineDO + offset,
m_featureLineDF + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowD1O + offset,
GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
m_arrowD1F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowD2O + offset,
GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
m_arrowD2F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowG1O + offset,
GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
m_arrowG1F + offset, width, gcolor );
GRCSegm( panel->GetClipBox(), DC, m_arrowG2O + offset,
GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
m_arrowG2F + offset, width, gcolor );
break;
}
......@@ -414,16 +415,16 @@ bool DIMENSION::HitTest( const wxPoint& aPosition )
if( TestSegmentHit( aPosition, m_featureLineDO, m_featureLineDF, dist_max ) )
return true;
if( TestSegmentHit( aPosition, m_arrowD1O, m_arrowD1F, dist_max ) )
if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD1F, dist_max ) )
return true;
if( TestSegmentHit( aPosition, m_arrowD2O, m_arrowD2F, dist_max ) )
if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD2F, dist_max ) )
return true;
if( TestSegmentHit( aPosition, m_arrowG1O, m_arrowG1F, dist_max ) )
if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG1F, dist_max ) )
return true;
if( TestSegmentHit( aPosition, m_arrowG2O, m_arrowG2F, dist_max ) )
if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG2F, dist_max ) )
return true;
return false;
......
......@@ -41,6 +41,24 @@ class TEXTE_PCB;
class MSG_PANEL_ITEM;
/**
* Class DIMENSION
*
* For better understanding of the points that make a dimension:
*
* m_featureLineGO m_featureLineDO
* | |
* | |
* | |
* | m_arrowG2F m_arrowD2F |
* | / \ |
* m_crossBarO|/____________________________\|m_crossBarF
* |\ m_Text /|
* | \ / |
* | m_arrowG1F m_arrowD1F |
* | |
* m_featureLineGF m_featureLineDF
*/
class DIMENSION : public BOARD_ITEM
{
int m_Width;
......@@ -52,14 +70,12 @@ class DIMENSION : public BOARD_ITEM
public:
// private: These member should be private. they are public only due to legacy code
// TODO 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;
wxPoint m_arrowD1F, m_arrowD2F;
wxPoint m_arrowG1F, m_arrowG2F;
DIMENSION( BOARD_ITEM* aParent );
......@@ -88,6 +104,57 @@ public:
int GetWidth() const { return m_Width; }
void SetWidth( int aWidth ) { m_Width = aWidth; }
/**
* Function SetOrigin
* Sets a new origin of the crossbar line. All remaining lines are adjusted after that.
* @param aOrigin is the new point to be used as the new origin of the crossbar line.
*/
void SetOrigin( const wxPoint& aOrigin );
/**
* Function GetOrigin
* @return Origin of the crossbar line.
*/
const wxPoint& GetOrigin() const
{
return m_crossBarO;
}
/**
* Function SetEnd
* Sets a new end of the crossbar line. All remaining lines are adjusted after that.
* @param aEnd is the new point to be used as the new end of the crossbar line.
*/
void SetEnd( const wxPoint& aEnd );
/**
* Function GetEnd
* @return End of the crossbar line.
*/
const wxPoint& GetEnd()
{
return m_crossBarF;
}
/**
* Function SetHeight
* Sets the length of feature lines.
* @param aHeight is the new height.
*/
void SetHeight( double aHeight );
/**
* Function GetAngle
* Returns angle of the crossbar.
* @return Angle of the crossbar line.
*/
double GetAngle() const
{
wxPoint delta( m_featureLineDO - m_featureLineGO );
return atan2( delta.y, delta.x );
}
/**
* Function AdjustDimensionDetails
* Calculate coordinates of segments used to draw the dimension.
......
......@@ -251,16 +251,9 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension = new DIMENSION( GetBoard() );
aDimension->SetFlags( IS_NEW );
aDimension->SetLayer( getActiveLayer() );
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->SetOrigin( pos );
aDimension->SetEnd( pos );
aDimension->Text().SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
......@@ -330,24 +323,12 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
}
else
{
wxPoint delta;
int dx, dy;
double angle, depl;
delta = Dimension->m_featureLineDO - Dimension->m_featureLineGO;
/* Calculating the direction of travel perpendicular to the selected axis. */
angle = atan2( delta.y, delta.x ) + (M_PI / 2);
double angle = Dimension->GetAngle() + (M_PI / 2);
delta = pos - Dimension->m_featureLineDO;
depl = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
dx = KiROUND( depl * cos( angle ) );
dy = KiROUND( depl * sin( angle ) );
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( );
wxPoint delta = pos - Dimension->m_featureLineDO;
double depl = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
Dimension->SetHeight( depl );
}
Dimension->Draw( aPanel, aDC, GR_XOR );
......
......@@ -747,26 +747,26 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
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_arrowD1O.x ).c_str(),
FMT_IU( aDimension->m_arrowD1O.y ).c_str(),
FMT_IU( aDimension->m_crossBarF.x ).c_str(),
FMT_IU( aDimension->m_crossBarF.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_arrowD2O.x ).c_str(),
FMT_IU( aDimension->m_arrowD2O.y ).c_str(),
FMT_IU( aDimension->m_crossBarF.x ).c_str(),
FMT_IU( aDimension->m_crossBarF.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_arrowG1O.x ).c_str(),
FMT_IU( aDimension->m_arrowG1O.y ).c_str(),
FMT_IU( aDimension->m_crossBarO.x ).c_str(),
FMT_IU( aDimension->m_crossBarO.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_arrowG2O.x ).c_str(),
FMT_IU( aDimension->m_arrowG2O.y ).c_str(),
FMT_IU( aDimension->m_crossBarO.x ).c_str(),
FMT_IU( aDimension->m_crossBarO.y ).c_str(),
FMT_IU( aDimension->m_arrowG2F.x ).c_str(),
FMT_IU( aDimension->m_arrowG2F.y ).c_str() );
......
......@@ -2588,8 +2588,8 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowD1Fx = biuParse( data, &data );
BIU arrowD1Fy = biuParse( data );
dim->m_arrowD1O.x = arrowD10x;
dim->m_arrowD1O.y = arrowD10y;
dim->m_crossBarF.x = arrowD10x;
dim->m_crossBarF.y = arrowD10y;
dim->m_arrowD1F.x = arrowD1Fx;
dim->m_arrowD1F.y = arrowD1Fy;
(void) ignore;
......@@ -2605,8 +2605,8 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowD2Fx = biuParse( data, &data );
BIU arrowD2Fy = biuParse( data, &data );
dim->m_arrowD2O.x = arrowD2Ox;
dim->m_arrowD2O.y = arrowD2Oy;
dim->m_crossBarF.x = arrowD2Ox;
dim->m_crossBarF.y = arrowD2Oy;
dim->m_arrowD2F.x = arrowD2Fx;
dim->m_arrowD2F.y = arrowD2Fy;
(void) ignore;
......@@ -2621,8 +2621,8 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowG1Fx = biuParse( data, &data );
BIU arrowG1Fy = biuParse( data, &data );
dim->m_arrowG1O.x = arrowG1Ox;
dim->m_arrowG1O.y = arrowG1Oy;
dim->m_crossBarO.x = arrowG1Ox;
dim->m_crossBarO.y = arrowG1Oy;
dim->m_arrowG1F.x = arrowG1Fx;
dim->m_arrowG1F.y = arrowG1Fy;
(void) ignore;
......@@ -2637,8 +2637,8 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU arrowG2Fx = biuParse( data, &data );
BIU arrowG2Fy = biuParse( data, &data );
dim->m_arrowG2O.x = arrowG2Ox;
dim->m_arrowG2O.y = arrowG2Oy;
dim->m_crossBarO.x = arrowG2Ox;
dim->m_crossBarO.y = arrowG2Oy;
dim->m_arrowG2F.x = arrowG2Fx;
dim->m_arrowG2F.y = arrowG2Fy;
(void) ignore;
......@@ -3794,22 +3794,22 @@ void LEGACY_PLUGIN::saveDIMENTION( const DIMENSION* me ) const
fmtBIU( me->GetWidth() ).c_str() );
fprintf( m_fp, "S1 %d %s %s %s\n", S_SEGMENT,
fmtBIUPair( me->m_arrowD1O.x, me->m_arrowD1O.y ).c_str(),
fmtBIUPair( me->m_crossBarF.x, me->m_crossBarF.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_arrowD2O.x, me->m_arrowD2O.y ).c_str(),
fmtBIUPair( me->m_crossBarF.x, me->m_crossBarF.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_arrowG1O.x, me->m_arrowG1O.y ).c_str(),
fmtBIUPair( me->m_crossBarO.x, me->m_crossBarO.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_arrowG2O.x, me->m_arrowG2O.y ).c_str(),
fmtBIUPair( me->m_crossBarO.x, me->m_crossBarO.y ).c_str(),
fmtBIUPair( me->m_arrowG2F.x, me->m_arrowG2F.y ).c_str(),
fmtBIU( me->GetWidth() ).c_str() );
......
......@@ -262,7 +262,6 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
VECTOR2D end( aTrack->GetEnd() );
int width = aTrack->GetWidth();
int netNumber = aTrack->GetNet();
COLOR4D color;
if( m_pcbSettings->m_netNamesOnTracks && IsNetnameLayer( aLayer ) )
{
......@@ -286,7 +285,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
double textSize = std::min( static_cast<double>( width ), length / netName.length() );
// Set a proper color for the label
color = m_pcbSettings->GetColor( aTrack, aTrack->GetLayer() );
const COLOR4D& color = m_pcbSettings->GetColor( aTrack, aTrack->GetLayer() );
COLOR4D labelColor = m_pcbSettings->GetColor( NULL, aLayer );
if( color.GetBrightness() > 0.5 )
......@@ -307,7 +306,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
else if( IsCopperLayer( aLayer ))
{
// Draw a regular track
color = m_pcbSettings->GetColor( aTrack, aLayer );
const COLOR4D& color = m_pcbSettings->GetColor( aTrack, aLayer );
m_gal->SetStrokeColor( color );
m_gal->SetIsStroke( true );
......@@ -332,7 +331,6 @@ void PCB_PAINTER::draw( const SEGVIA* aVia, int aLayer )
{
VECTOR2D center( aVia->GetStart() );
double radius;
COLOR4D color;
// Choose drawing settings depending on if we are drawing via's pad or hole
if( aLayer == ITEM_GAL_LAYER( VIAS_VISIBLE ) )
......@@ -346,7 +344,7 @@ void PCB_PAINTER::draw( const SEGVIA* aVia, int aLayer )
else
return;
color = m_pcbSettings->GetColor( aVia, aLayer );
const COLOR4D& color = m_pcbSettings->GetColor( aVia, aLayer );
if( m_pcbSettings->m_sketchModeSelect[VIAS_VISIBLE] )
{
......@@ -370,7 +368,6 @@ void PCB_PAINTER::draw( const SEGVIA* aVia, int aLayer )
void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
{
COLOR4D color;
VECTOR2D size;
VECTOR2D position( aPad->GetPosition() );
PAD_SHAPE_T shape;
......@@ -385,7 +382,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
if( m_pcbSettings->m_netNamesOnPads || m_pcbSettings->m_padNumbers )
{
// Min char count to calculate string size
#define MIN_CHAR_COUNT 3
const int MIN_CHAR_COUNT = 3;
bool displayNetname = ( m_pcbSettings->m_netNamesOnPads &&
!aPad->GetNetname().empty() );
......@@ -405,9 +402,6 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// If the text is displayed on a symmetrical pad, do not rotate it
orientation = 0.0;
}
else
{
}
// Font size limits
if( size > maxSize )
......@@ -428,7 +422,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal->SetMirrored( false );
// Set a proper color for the label
color = m_pcbSettings->GetColor( aPad, aPad->GetLayer() );
const COLOR4D& color = m_pcbSettings->GetColor( aPad, aPad->GetLayer() );
COLOR4D labelColor = m_pcbSettings->GetColor( NULL, aLayer );
if( color.GetBrightness() > 0.5 )
......@@ -456,8 +450,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
VECTOR2D namesize( tsize, tsize );
m_gal->SetGlyphSize( namesize );
m_gal->SetLineWidth( namesize.x / 12.0 );
m_gal->StrokeText( std::wstring( aPad->GetShortNetname().wc_str() ),
textpos, 0.0 );
m_gal->StrokeText( aPad->GetShortNetname(), textpos, 0.0 );
}
if( m_pcbSettings->m_padNumbers )
......@@ -474,7 +467,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal->SetGlyphSize( numsize );
m_gal->SetLineWidth( numsize.x / 12.0 );
m_gal->StrokeText( std::wstring( aPad->GetPadName().wc_str() ), textpos, 0.0 );
m_gal->StrokeText( aPad->GetPadName(), textpos, 0.0 );
}
m_gal->Restore();
......@@ -483,7 +476,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
}
// Pad drawing
color = m_pcbSettings->GetColor( aPad, aLayer );
const COLOR4D& color = m_pcbSettings->GetColor( aPad, aLayer );
if( m_pcbSettings->m_sketchModeSelect[PADS_VISIBLE] )
{
// Outline mode
......@@ -628,7 +621,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment )
{
COLOR4D color = m_pcbSettings->GetColor( aSegment, aSegment->GetLayer() );
const COLOR4D& color = m_pcbSettings->GetColor( aSegment, aSegment->GetLayer() );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
......@@ -708,7 +701,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
if( aText->GetText().Length() == 0 )
return;
COLOR4D strokeColor = m_pcbSettings->GetColor( aText, aText->GetLayer() );
const COLOR4D& strokeColor = m_pcbSettings->GetColor( aText, aText->GetLayer() );
VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y );
double orientation = aText->GetOrientation() * M_PI / 1800.0;
......@@ -724,7 +717,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
if( aText->GetLength() == 0 )
return;
COLOR4D strokeColor = m_pcbSettings->GetColor( aText, aLayer );
const COLOR4D& strokeColor = m_pcbSettings->GetColor( aText, aLayer );
VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y );
double orientation = aText->GetDrawRotation() * M_PI / 1800.0;
......@@ -737,7 +730,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
{
COLOR4D color = m_pcbSettings->GetColor( aZone, aZone->GetLayer() );
const COLOR4D& color = m_pcbSettings->GetColor( aZone, aZone->GetLayer() );
std::deque<VECTOR2D> corners;
PCB_RENDER_SETTINGS::DisplayZonesMode displayMode = m_pcbSettings->m_displayZoneMode;
......@@ -810,7 +803,7 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
{
COLOR4D strokeColor = m_pcbSettings->GetColor( aDimension, aLayer );
const COLOR4D& strokeColor = m_pcbSettings->GetColor( aDimension, aLayer );
m_gal->SetStrokeColor( strokeColor );
m_gal->SetIsFill( false );
......@@ -823,10 +816,10 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
VECTOR2D( aDimension->m_featureLineGF ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_featureLineDO ),
VECTOR2D( aDimension->m_featureLineDF ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_arrowD1O ), VECTOR2D( aDimension->m_arrowD1F ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_arrowD2O ), VECTOR2D( aDimension->m_arrowD2F ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_arrowG1O ), VECTOR2D( aDimension->m_arrowG1F ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_arrowG2O ), VECTOR2D( aDimension->m_arrowG2F ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarF ), VECTOR2D( aDimension->m_arrowD1F ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarF ), VECTOR2D( aDimension->m_arrowD2F ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarO ), VECTOR2D( aDimension->m_arrowG1F ) );
m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarO ), VECTOR2D( aDimension->m_arrowG2F ) );
// Draw text
TEXTE_PCB& text = aDimension->Text();
......@@ -835,13 +828,13 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
m_gal->SetLineWidth( text.GetThickness() );
m_gal->SetTextAttributes( &text );
m_gal->StrokeText( std::wstring( text.GetText().wc_str() ), position, orientation );
m_gal->StrokeText( text.GetText(), position, orientation );
}
void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
{
COLOR4D strokeColor = m_pcbSettings->GetColor( aTarget, aTarget->GetLayer() );
const COLOR4D& strokeColor = m_pcbSettings->GetColor( aTarget, aTarget->GetLayer() );
VECTOR2D position( aTarget->GetPosition() );
double size, radius;
......
......@@ -1476,7 +1476,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowD1O.x, &dimension->m_arrowD1O.y );
parseXY( &dimension->m_crossBarF.x, &dimension->m_crossBarF.y );
parseXY( &dimension->m_arrowD1F.x, &dimension->m_arrowD1F.y );
NeedRIGHT();
NeedRIGHT();
......@@ -1489,7 +1489,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowD2O.x, &dimension->m_arrowD2O.y );
parseXY( &dimension->m_crossBarF.x, &dimension->m_crossBarF.y );
parseXY( &dimension->m_arrowD2F.x, &dimension->m_arrowD2F.y );
NeedRIGHT();
NeedRIGHT();
......@@ -1502,7 +1502,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowG1O.x, &dimension->m_arrowG1O.y );
parseXY( &dimension->m_crossBarO.x, &dimension->m_crossBarO.y );
parseXY( &dimension->m_arrowG1F.x, &dimension->m_arrowG1F.y );
NeedRIGHT();
NeedRIGHT();
......@@ -1515,7 +1515,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
if( token != T_pts )
Expecting( T_pts );
parseXY( &dimension->m_arrowG2O.x, &dimension->m_arrowG2O.y );
parseXY( &dimension->m_crossBarO.x, &dimension->m_crossBarO.y );
parseXY( &dimension->m_arrowG2F.x, &dimension->m_arrowG2F.y );
NeedRIGHT();
NeedRIGHT();
......
......@@ -274,19 +274,19 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim )
draw.SetEnd( aDim->m_featureLineDF );
PlotDrawSegment( &draw );
draw.SetStart( aDim->m_arrowD1O );
draw.SetStart( aDim->m_crossBarF );
draw.SetEnd( aDim->m_arrowD1F );
PlotDrawSegment( &draw );
draw.SetStart( aDim->m_arrowD2O );
draw.SetStart( aDim->m_crossBarF );
draw.SetEnd( aDim->m_arrowD2F );
PlotDrawSegment( &draw );
draw.SetStart( aDim->m_arrowG1O );
draw.SetStart( aDim->m_crossBarO );
draw.SetEnd( aDim->m_arrowG1F );
PlotDrawSegment( &draw );
draw.SetStart( aDim->m_arrowG2O );
draw.SetStart( aDim->m_crossBarO );
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