KiCad PCB EDA Suite
class_dimension.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
31 #include <fctsys.h>
32 #include <macros.h>
33 #include <gr_basic.h>
34 #include <trigo.h>
35 #include <class_drawpanel.h>
36 #include <kicad_string.h>
37 #include <richio.h>
38 #include <bitmaps.h>
39 #include <pcb_edit_frame.h>
40 
41 #include <class_board.h>
42 #include <class_pcb_text.h>
43 #include <class_dimension.h>
44 #include <base_units.h>
45 
46 
48  BOARD_ITEM( aParent, PCB_DIMENSION_T ),
49  m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this )
50 {
52  m_Shape = 0;
53 }
54 
55 
57 {
58 }
59 
60 
61 void DIMENSION::SetPosition( const wxPoint& aPos )
62 {
63  m_Text.SetTextPos( aPos );
64 }
65 
66 
68 {
69  return m_Text.GetTextPos();
70 }
71 
72 
73 void DIMENSION::SetText( const wxString& aNewText )
74 {
75  m_Text.SetText( aNewText );
76 }
77 
78 
79 const wxString DIMENSION::GetText() const
80 {
81  return m_Text.GetText();
82 }
83 
84 
86 {
87  m_Layer = aLayer;
88  m_Text.SetLayer( aLayer );
89 }
90 
91 
92 void DIMENSION::Move( const wxPoint& offset )
93 {
94  m_Text.Offset( offset );
95 
96  m_crossBarO += offset;
97  m_crossBarF += offset;
98  m_featureLineGO += offset;
99  m_featureLineGF += offset;
100  m_featureLineDO += offset;
101  m_featureLineDF += offset;
102  m_arrowG1F += offset;
103  m_arrowG2F += offset;
104  m_arrowD1F += offset;
105  m_arrowD2F += offset;
106 }
107 
108 
109 void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
110 {
111  wxPoint tmp = m_Text.GetTextPos();
112  RotatePoint( &tmp, aRotCentre, aAngle );
113  m_Text.SetTextPos( tmp );
114 
115  double newAngle = m_Text.GetTextAngle() + aAngle;
116 
117  if( newAngle >= 3600 )
118  newAngle -= 3600;
119 
120  if( newAngle > 900 && newAngle < 2700 )
121  newAngle -= 1800;
122 
123  m_Text.SetTextAngle( newAngle );
124 
125  RotatePoint( &m_crossBarO, aRotCentre, aAngle );
126  RotatePoint( &m_crossBarF, aRotCentre, aAngle );
127  RotatePoint( &m_featureLineGO, aRotCentre, aAngle );
128  RotatePoint( &m_featureLineGF, aRotCentre, aAngle );
129  RotatePoint( &m_featureLineDO, aRotCentre, aAngle );
130  RotatePoint( &m_featureLineDF, aRotCentre, aAngle );
131  RotatePoint( &m_arrowG1F, aRotCentre, aAngle );
132  RotatePoint( &m_arrowG2F, aRotCentre, aAngle );
133  RotatePoint( &m_arrowD1F, aRotCentre, aAngle );
134  RotatePoint( &m_arrowD2F, aRotCentre, aAngle );
135 }
136 
137 
138 void DIMENSION::Flip( const wxPoint& aCentre )
139 {
140  Mirror( aCentre );
141 
142  // DIMENSION items are not usually on copper layers, so
143  // copper layers count is not taken in accoun in Flip transform
144  SetLayer( FlipLayer( GetLayer() ) );
145 }
146 
147 
148 void DIMENSION::Mirror( const wxPoint& axis_pos )
149 {
150  wxPoint newPos = m_Text.GetTextPos();
151 
152 #define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
153  INVERT( newPos.y );
154 
155  m_Text.SetTextPos( newPos );
156 
157  // invert angle
159 
160  INVERT( m_crossBarO.y );
161  INVERT( m_crossBarF.y );
166  INVERT( m_arrowG1F.y );
167  INVERT( m_arrowG2F.y );
168  INVERT( m_arrowD1F.y );
169  INVERT( m_arrowD2F.y );
170 }
171 
172 
173 void DIMENSION::SetOrigin( const wxPoint& aOrigin )
174 {
175  m_featureLineGO = aOrigin;
176 
178 }
179 
180 
181 void DIMENSION::SetEnd( const wxPoint& aEnd )
182 {
183  m_featureLineDO = aEnd;
184 
186 }
187 
188 
189 void DIMENSION::SetHeight( int aHeight )
190 {
191  m_Height = aHeight;
192 
194 }
195 
196 
198 {
199  VECTOR2D featureLine( m_crossBarO - m_featureLineGO );
201 
202  if( featureLine.Cross( crossBar ) > 0 )
203  m_Height = -featureLine.EuclideanNorm();
204  else
205  m_Height = featureLine.EuclideanNorm();
206 }
207 
208 
209 void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
210 {
211  const int arrowz = Mils2iu( 50 ); // size of arrows
212  int ii;
213  int measure, deltax, deltay; // value of the measure on X and Y axes
214  int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
215  int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
216  int hx, hy; // dimension line interval
217  double angle, angle_f;
218  wxString msg;
219 
220  // Init layer :
221  m_Text.SetLayer( GetLayer() );
222 
223  // calculate the size of the dimension (text + line above the text)
225 
226  deltax = m_featureLineDO.x - m_featureLineGO.x;
227  deltay = m_featureLineDO.y - m_featureLineGO.y;
228 
229  // Calculate dimension value
230  measure = KiROUND( hypot( deltax, deltay ) );
231 
232  angle = atan2( (double)deltay, (double)deltax );
233 
234  // Calculation of parameters X and Y dimensions of the arrows and lines.
235  hx = hy = ii;
236 
237  // Taking into account the slope of the side lines.
238  if( measure )
239  {
240  hx = abs( KiROUND( ( (double) deltay * hx ) / measure ) );
241  hy = abs( KiROUND( ( (double) deltax * hy ) / measure ) );
242 
244  hx = -hx;
245 
246  if( m_featureLineGO.x == m_crossBarO.x )
247  hx = 0;
248 
250  hy = -hy;
251 
252  if( m_featureLineGO.y == m_crossBarO.y )
253  hy = 0;
254 
255  angle_f = angle + DEG2RAD( 27.5 );
256  arrow_up_X = wxRound( arrowz * cos( angle_f ) );
257  arrow_up_Y = wxRound( arrowz * sin( angle_f ) );
258  angle_f = angle - DEG2RAD( 27.5 );
259  arrow_dw_X = wxRound( arrowz * cos( angle_f ) );
260  arrow_dw_Y = wxRound( arrowz * sin( angle_f ) );
261  }
262 
263  int dx = KiROUND( m_Height * cos( angle + M_PI / 2 ) );
264  int dy = KiROUND( m_Height * sin( angle + M_PI / 2 ) );
269 
270  m_arrowG1F.x = m_crossBarO.x + arrow_up_X;
271  m_arrowG1F.y = m_crossBarO.y + arrow_up_Y;
272 
273  m_arrowG2F.x = m_crossBarO.x + arrow_dw_X;
274  m_arrowG2F.y = m_crossBarO.y + arrow_dw_Y;
275 
276  /* The right arrow is symmetrical to the left.
277  * / = -\ and \ = -/
278  */
279  m_arrowD1F.x = m_crossBarF.x - arrow_dw_X;
280  m_arrowD1F.y = m_crossBarF.y - arrow_dw_Y;
281 
282  m_arrowD2F.x = m_crossBarF.x - arrow_up_X;
283  m_arrowD2F.y = m_crossBarF.y - arrow_up_Y;
284 
285  // Length of feature lines
286  double radius = ( m_Height +
287  ( std::copysign( 1.0, m_Height ) *
288  arrowz * sin( DEG2RAD( 27.5 ) ) ) );
289 
290  m_featureLineGF.x = m_featureLineGO.x - wxRound( radius * sin( angle ) );
291  m_featureLineGF.y = m_featureLineGO.y + wxRound( radius * cos( angle ) );
292 
293  m_featureLineDF.x = m_featureLineDO.x - wxRound( radius * sin( angle ) );
294  m_featureLineDF.y = m_featureLineDO.y + wxRound( radius * cos( angle ) );
295 
296  // Calculate the better text position and orientation:
297  radius = ( std::copysign( 1.0, m_Height ) * ii );
298 
299  wxPoint textPos;
300  textPos.x = ( m_crossBarF.x + m_crossBarO.x ) / 2;
301  textPos.y = ( m_crossBarF.y + m_crossBarO.y ) / 2;
302 
303  textPos.x -= KiROUND( radius * sin( angle ) );
304  textPos.y += KiROUND( radius * cos( angle ) );
305 
306  m_Text.SetTextPos( textPos );
307 
308  double newAngle = -RAD2DECIDEG( angle );
309 
310  NORMALIZE_ANGLE_POS( newAngle );
311 
312  if( newAngle > 900 && newAngle < 2700 )
313  newAngle -= 1800;
314 
315  m_Text.SetTextAngle( newAngle );
316 
317  if( !aDoNotChangeText )
318  {
319  m_Value = measure;
320  msg = ::CoordinateToString( m_Value );
321  SetText( msg );
322  }
323 }
324 
325 
326 void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
327  const wxPoint& offset )
328 {
329  BOARD* brd = GetBoard();
330 
331  if( brd->IsLayerVisible( m_Layer ) == false )
332  return;
333 
334  m_Text.Draw( panel, DC, mode_color, offset );
335 
336  auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() );
337  auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer );
338 
339  GRSetDrawMode( DC, mode_color );
340  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );
341  bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;
342  int width = m_Width;
343 
344  if( filled )
345  {
346  GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
347  m_crossBarF + offset, width, gcolor );
348  GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset,
349  m_featureLineGF + offset, width, gcolor );
350  GRLine( panel->GetClipBox(), DC, m_featureLineDO + offset,
351  m_featureLineDF + offset, width, gcolor );
352  GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
353  m_arrowD1F + offset, width, gcolor );
354  GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
355  m_arrowD2F + offset, width, gcolor );
356  GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
357  m_arrowG1F + offset, width, gcolor );
358  GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
359  m_arrowG2F + offset, width, gcolor );
360  }
361  else
362  {
363  GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
364  m_crossBarF + offset, width, gcolor );
365  GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset,
366  m_featureLineGF + offset, width, gcolor );
367  GRCSegm( panel->GetClipBox(), DC, m_featureLineDO + offset,
368  m_featureLineDF + offset, width, gcolor );
369  GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
370  m_arrowD1F + offset, width, gcolor );
371  GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
372  m_arrowD2F + offset, width, gcolor );
373  GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
374  m_arrowG1F + offset, width, gcolor );
375  GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
376  m_arrowG2F + offset, width, gcolor );
377  }
378 }
379 
380 
381 // see class_cotation.h
382 void DIMENSION::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
383 {
384  // for now, display only the text within the DIMENSION using class TEXTE_PCB.
385  m_Text.GetMsgPanelInfo( aList );
386 }
387 
388 
389 bool DIMENSION::HitTest( const wxPoint& aPosition ) const
390 {
391  if( m_Text.TextHitTest( aPosition ) )
392  return true;
393 
394  int dist_max = m_Width / 2;
395 
396  // Locate SEGMENTS
397 
398  if( TestSegmentHit( aPosition, m_crossBarO, m_crossBarF, dist_max ) )
399  return true;
400 
401  if( TestSegmentHit( aPosition, m_featureLineGO, m_featureLineGF, dist_max ) )
402  return true;
403 
404  if( TestSegmentHit( aPosition, m_featureLineDO, m_featureLineDF, dist_max ) )
405  return true;
406 
407  if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD1F, dist_max ) )
408  return true;
409 
410  if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD2F, dist_max ) )
411  return true;
412 
413  if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG1F, dist_max ) )
414  return true;
415 
416  if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG2F, dist_max ) )
417  return true;
418 
419  return false;
420 }
421 
422 
423 bool DIMENSION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
424 {
425  EDA_RECT arect = aRect;
426  arect.Inflate( aAccuracy );
427 
428  EDA_RECT rect = GetBoundingBox();
429  if( aAccuracy )
430  rect.Inflate( aAccuracy );
431 
432  if( aContained )
433  return arect.Contains( rect );
434 
435  return arect.Intersects( rect );
436 }
437 
438 
440 {
441  EDA_RECT bBox;
442  int xmin, xmax, ymin, ymax;
443 
444  bBox = m_Text.GetTextBox( -1 );
445  xmin = bBox.GetX();
446  xmax = bBox.GetRight();
447  ymin = bBox.GetY();
448  ymax = bBox.GetBottom();
449 
450  xmin = std::min( xmin, m_crossBarO.x );
451  xmin = std::min( xmin, m_crossBarF.x );
452  ymin = std::min( ymin, m_crossBarO.y );
453  ymin = std::min( ymin, m_crossBarF.y );
454  xmax = std::max( xmax, m_crossBarO.x );
455  xmax = std::max( xmax, m_crossBarF.x );
456  ymax = std::max( ymax, m_crossBarO.y );
457  ymax = std::max( ymax, m_crossBarF.y );
458 
459  xmin = std::min( xmin, m_featureLineGO.x );
460  xmin = std::min( xmin, m_featureLineGF.x );
461  ymin = std::min( ymin, m_featureLineGO.y );
462  ymin = std::min( ymin, m_featureLineGF.y );
463  xmax = std::max( xmax, m_featureLineGO.x );
464  xmax = std::max( xmax, m_featureLineGF.x );
465  ymax = std::max( ymax, m_featureLineGO.y );
466  ymax = std::max( ymax, m_featureLineGF.y );
467 
468  xmin = std::min( xmin, m_featureLineDO.x );
469  xmin = std::min( xmin, m_featureLineDF.x );
470  ymin = std::min( ymin, m_featureLineDO.y );
471  ymin = std::min( ymin, m_featureLineDF.y );
472  xmax = std::max( xmax, m_featureLineDO.x );
473  xmax = std::max( xmax, m_featureLineDF.x );
474  ymax = std::max( ymax, m_featureLineDO.y );
475  ymax = std::max( ymax, m_featureLineDF.y );
476 
477  bBox.SetX( xmin );
478  bBox.SetY( ymin );
479  bBox.SetWidth( xmax - xmin + 1 );
480  bBox.SetHeight( ymax - ymin + 1 );
481 
482  bBox.Normalize();
483 
484  return bBox;
485 }
486 
487 
489 {
490  wxString text;
491  text.Printf( _( "Dimension \"%s\" on %s" ),
492  GetChars( GetText() ), GetChars( GetLayerName() ) );
493 
494  return text;
495 }
496 
497 
499 {
500  return add_dimension_xpm;
501 }
502 
503 
505 {
506  BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
507  VECTOR2I( GetBoundingBox().GetSize() ) );
508  dimBBox.Merge( m_Text.ViewBBox() );
509 
510  return dimBBox;
511 }
512 
513 
515 {
516  return new DIMENSION( *this );
517 }
518 
520 {
521  assert( aImage->Type() == PCB_DIMENSION_T );
522 
523  std::swap( *((DIMENSION*) this), *((DIMENSION*) aImage) );
524 }
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:118
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:227
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
void SetTextAngle(double aAngle)
void Mirror(const wxPoint &axis_pos)
Function Mirror Mirror the Dimension , relative to a given horizontal axis the text is not mirrored...
void SetPosition(const wxPoint &aPos) override
PNG memory record (file in memory).
Definition: bitmap_types.h:41
TEXTE_PCB class definition.
void SetText(const wxString &NewText)
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
Implementation of conversion functions that require both schematic and board internal units...
wxPoint m_crossBarF
int m_Height
length of feature lines
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
wxPoint m_arrowD1F
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
bool Contains(const wxPoint &aPoint) const
Function Contains.
DIMENSION(BOARD_ITEM *aParent)
Class BOARD to handle a board.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:472
const wxString GetText() const
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:221
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aColorMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
double RAD2DECIDEG(double rad)
Definition: trigo.h:204
TEXTE_PCB m_Text
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:510
int m_Shape
Currently always 0.
wxPoint m_featureLineDF
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:241
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
#define abs(a)
Definition: auxiliary.h:84
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
double GetTextAngle() const
Definition: eda_text.h:162
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
This file contains miscellaneous commonly used macros and functions.
wxPoint m_featureLineGO
PCB_LAYER_ID m_Layer
DIMENSION class definition.
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
void SetOrigin(const wxPoint &aOrigin)
Function SetOrigin Sets a new origin of the crossbar line.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false) const
Function GetTextBox useful in multiline texts to calculate the full text or a line area (for zones fi...
Definition: eda_text.cpp:102
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:294
void SetHeight(int val)
Definition: eda_rect.h:133
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Function TextHitTest Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:254
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
PCB_GENERAL_SETTINGS & Settings()
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
void SetEnd(const wxPoint &aEnd)
Function SetEnd Sets a new end of the crossbar line.
Definition: common.h:145
wxPoint m_arrowG1F
wxPoint m_arrowD2F
wxPoint m_arrowG2F
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
EDA_RECT * GetClipBox()
void SetX(int val)
Definition: eda_rect.h:130
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:180
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
int GetBottom() const
Definition: eda_rect.h:122
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect...
Definition: box2.h:350
int GetRight() const
Definition: eda_rect.h:119
void SetWidth(int val)
Definition: eda_rect.h:132
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:380
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
COLORS_DESIGN_SETTINGS & Colors()
void SetY(int val)
Definition: eda_rect.h:131
void AdjustDimensionDetails(bool aDoNotChangeText=false)
Function AdjustDimensionDetails Calculate coordinates of segments used to draw the dimension...
extended_type Cross(const VECTOR2< T > &aVector) const
Function Cross() computes cross product of self with aVector.
Definition: vector2d.h:479
int m_Width
Line width.
void Normalize()
Function Normalize ensures that the height ant width are positive.
#define INVERT(pos)
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it&#39;s internal state for displ...
double DEG2RAD(double deg)
Definition: trigo.h:199
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it&#39;s internal state for displ...
void Move(const wxPoint &offset) override
Function Move.
void SetHeight(int aHeight)
Function SetHeight Sets the length of feature lines.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetX() const
Definition: eda_rect.h:109
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
int GetY() const
Definition: eda_rect.h:110
int GetTextHeight() const
Definition: eda_text.h:219
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
wxPoint m_crossBarO
const wxPoint GetPosition() const override
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_panel.cpp:187
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:122
void UpdateHeight()
Function UpdateHeight Updates stored height basing on points coordinates.
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
wxPoint m_featureLineDO
int m_Value
value of PCB dimensions.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Class DIMENSION.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
#define min(a, b)
Definition: auxiliary.h:85
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:451
virtual void SetText(const wxString &aText)
Definition: eda_text.h:139
wxPoint m_featureLineGF