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 
27 #include <fctsys.h>
28 #include <macros.h>
29 #include <gr_basic.h>
30 #include <trigo.h>
31 #include <kicad_string.h>
32 #include <richio.h>
33 #include <bitmaps.h>
34 #include <pcb_edit_frame.h>
35 
36 #include <class_board.h>
37 #include <class_pcb_text.h>
38 #include <class_dimension.h>
39 #include <base_units.h>
40 #include <math/util.h> // for KiROUND
41 
42 
44  : BOARD_ITEM( aParent, PCB_DIMENSION_T ),
45  m_Width( Millimeter2iu( 0.2 ) ),
46  m_Unit( EDA_UNITS::INCHES ),
47  m_UseMils( false ),
48  m_Value( 0 ),
49  m_Height( 0 ),
50  m_Text( this )
51 {
53  m_Shape = 0;
54 }
55 
56 
58 {
59 }
60 
61 
62 void DIMENSION::SetPosition( const wxPoint& aPos )
63 {
64  m_Text.SetTextPos( aPos );
65 }
66 
67 
69 {
70  return m_Text.GetTextPos();
71 }
72 
73 
74 void DIMENSION::SetText( const wxString& aNewText )
75 {
76  m_Text.SetText( aNewText );
77 }
78 
79 
80 const wxString DIMENSION::GetText() const
81 {
82  return m_Text.GetText();
83 }
84 
85 
87 {
88  m_Layer = aLayer;
89  m_Text.SetLayer( aLayer );
90 }
91 
92 
93 void DIMENSION::Move( const wxPoint& offset )
94 {
95  m_Text.Offset( offset );
96 
97  m_crossBarO += offset;
98  m_crossBarF += offset;
99  m_featureLineGO += offset;
100  m_featureLineGF += offset;
101  m_featureLineDO += offset;
102  m_featureLineDF += offset;
103  m_arrowG1F += offset;
104  m_arrowG2F += offset;
105  m_arrowD1F += offset;
106  m_arrowD2F += offset;
107 }
108 
109 
110 void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
111 {
112  wxPoint tmp = m_Text.GetTextPos();
113  RotatePoint( &tmp, aRotCentre, aAngle );
114  m_Text.SetTextPos( tmp );
115 
116  double newAngle = m_Text.GetTextAngle() + aAngle;
117 
118  if( newAngle >= 3600 )
119  newAngle -= 3600;
120 
121  if( newAngle > 900 && newAngle < 2700 )
122  newAngle -= 1800;
123 
124  m_Text.SetTextAngle( newAngle );
125 
126  RotatePoint( &m_crossBarO, aRotCentre, aAngle );
127  RotatePoint( &m_crossBarF, aRotCentre, aAngle );
128  RotatePoint( &m_featureLineGO, aRotCentre, aAngle );
129  RotatePoint( &m_featureLineGF, aRotCentre, aAngle );
130  RotatePoint( &m_featureLineDO, aRotCentre, aAngle );
131  RotatePoint( &m_featureLineDF, aRotCentre, aAngle );
132  RotatePoint( &m_arrowG1F, aRotCentre, aAngle );
133  RotatePoint( &m_arrowG2F, aRotCentre, aAngle );
134  RotatePoint( &m_arrowD1F, aRotCentre, aAngle );
135  RotatePoint( &m_arrowD2F, aRotCentre, aAngle );
136 }
137 
138 
139 void DIMENSION::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
140 {
141  Mirror( aCentre );
142 
143  // DIMENSION items are not usually on copper layers, so
144  // copper layers count is not taken in accoun in Flip transform
145  SetLayer( FlipLayer( GetLayer() ) );
146 }
147 
148 
149 void DIMENSION::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight )
150 {
151  int axis = aMirrorLeftRight ? axis_pos.x : axis_pos.y;
152  wxPoint newPos = m_Text.GetTextPos();
153 
154 #define INVERT( pos ) (pos) = axis - ( (pos) - axis )
155 
156  if( aMirrorLeftRight )
157  INVERT( newPos.x );
158  else
159  INVERT( newPos.y );
160 
161  m_Text.SetTextPos( newPos );
162 
163  // invert angle
165 
166  if( aMirrorLeftRight )
167  {
168  INVERT( m_crossBarO.y );
169  INVERT( m_crossBarF.y );
174  INVERT( m_arrowG1F.y );
175  INVERT( m_arrowG2F.y );
176  INVERT( m_arrowD1F.y );
177  INVERT( m_arrowD2F.y );
178  }
179  else
180  {
181  INVERT( m_crossBarO.y );
182  INVERT( m_crossBarF.y );
187  INVERT( m_arrowG1F.y );
188  INVERT( m_arrowG2F.y );
189  INVERT( m_arrowD1F.y );
190  INVERT( m_arrowD2F.y );
191  }
192 }
193 
194 
195 void DIMENSION::SetOrigin( const wxPoint& aOrigin, int aPrecision )
196 {
197  m_featureLineGO = aOrigin;
198 
199  AdjustDimensionDetails( aPrecision );
200 }
201 
202 
203 void DIMENSION::SetEnd( const wxPoint& aEnd, int aPrecision )
204 {
205  m_featureLineDO = aEnd;
206 
207  AdjustDimensionDetails( aPrecision );
208 }
209 
210 
211 void DIMENSION::SetHeight( int aHeight, int aPrecision )
212 {
213  m_Height = aHeight;
214 
215  AdjustDimensionDetails( aPrecision );
216 }
217 
218 
220 {
221  VECTOR2D featureLine( m_crossBarO - m_featureLineGO );
223 
224  if( featureLine.Cross( crossBar ) > 0 )
225  m_Height = -featureLine.EuclideanNorm();
226  else
227  m_Height = featureLine.EuclideanNorm();
228 }
229 
230 
231 void DIMENSION::AdjustDimensionDetails( int aPrecision )
232 {
233  const int arrowz = Mils2iu( 50 ); // size of arrows
234  int ii;
235  int measure, deltax, deltay; // value of the measure on X and Y axes
236  int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
237  int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
238  int hx, hy; // dimension line interval
239  double angle, angle_f;
240 
241  // Init layer :
242  m_Text.SetLayer( GetLayer() );
243 
244  // calculate the size of the dimension (text + line above the text)
246 
247  deltax = m_featureLineDO.x - m_featureLineGO.x;
248  deltay = m_featureLineDO.y - m_featureLineGO.y;
249 
250  // Calculate dimension value
251  measure = KiROUND( hypot( deltax, deltay ) );
252 
253  angle = atan2( (double)deltay, (double)deltax );
254 
255  // Calculation of parameters X and Y dimensions of the arrows and lines.
256  hx = hy = ii;
257 
258  // Taking into account the slope of the side lines.
259  if( measure )
260  {
261  hx = abs( KiROUND( ( (double) deltay * hx ) / measure ) );
262  hy = abs( KiROUND( ( (double) deltax * hy ) / measure ) );
263 
265  hx = -hx;
266 
267  if( m_featureLineGO.x == m_crossBarO.x )
268  hx = 0;
269 
271  hy = -hy;
272 
273  if( m_featureLineGO.y == m_crossBarO.y )
274  hy = 0;
275 
276  angle_f = angle + DEG2RAD( 27.5 );
277  arrow_up_X = wxRound( arrowz * cos( angle_f ) );
278  arrow_up_Y = wxRound( arrowz * sin( angle_f ) );
279  angle_f = angle - DEG2RAD( 27.5 );
280  arrow_dw_X = wxRound( arrowz * cos( angle_f ) );
281  arrow_dw_Y = wxRound( arrowz * sin( angle_f ) );
282  }
283 
284  int dx = KiROUND( m_Height * cos( angle + M_PI / 2 ) );
285  int dy = KiROUND( m_Height * sin( angle + M_PI / 2 ) );
290 
291  m_arrowG1F.x = m_crossBarO.x + arrow_up_X;
292  m_arrowG1F.y = m_crossBarO.y + arrow_up_Y;
293 
294  m_arrowG2F.x = m_crossBarO.x + arrow_dw_X;
295  m_arrowG2F.y = m_crossBarO.y + arrow_dw_Y;
296 
297  /* The right arrow is symmetrical to the left.
298  * / = -\ and \ = -/
299  */
300  m_arrowD1F.x = m_crossBarF.x - arrow_dw_X;
301  m_arrowD1F.y = m_crossBarF.y - arrow_dw_Y;
302 
303  m_arrowD2F.x = m_crossBarF.x - arrow_up_X;
304  m_arrowD2F.y = m_crossBarF.y - arrow_up_Y;
305 
306  // Length of feature lines
307  double radius = ( m_Height +
308  ( std::copysign( 1.0, m_Height ) *
309  arrowz * sin( DEG2RAD( 27.5 ) ) ) );
310 
311  m_featureLineGF.x = m_featureLineGO.x - wxRound( radius * sin( angle ) );
312  m_featureLineGF.y = m_featureLineGO.y + wxRound( radius * cos( angle ) );
313 
314  m_featureLineDF.x = m_featureLineDO.x - wxRound( radius * sin( angle ) );
315  m_featureLineDF.y = m_featureLineDO.y + wxRound( radius * cos( angle ) );
316 
317  // Calculate the better text position and orientation:
318  radius = ( std::copysign( 1.0, m_Height ) * ii );
319 
320  wxPoint textPos;
321  textPos.x = ( m_crossBarF.x + m_crossBarO.x ) / 2;
322  textPos.y = ( m_crossBarF.y + m_crossBarO.y ) / 2;
323 
324  textPos.x -= KiROUND( radius * sin( angle ) );
325  textPos.y += KiROUND( radius * cos( angle ) );
326 
327  m_Text.SetTextPos( textPos );
328 
329  double newAngle = -RAD2DECIDEG( angle );
330 
331  NORMALIZE_ANGLE_POS( newAngle );
332 
333  if( newAngle > 900 && newAngle < 2700 )
334  newAngle -= 1800;
335 
336  m_Text.SetTextAngle( newAngle );
337 
338  m_Value = measure;
339 
341  aPrecision += 2;
342  else if( !m_UseMils )
343  aPrecision += 3;
344 
345  wxString text;
346  wxString format = wxT( "%." ) + wxString::Format( "%i", aPrecision ) + wxT( "f" );
347 
348  text.Printf( format, To_User_Unit( m_Unit, m_Value, m_UseMils ) );
349  text += " ";
351 
352  SetText( text );
353 }
354 
355 
356 void DIMENSION::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
357 {
358  BOARD* brd = GetBoard();
359 
360  if( brd->IsLayerVisible( m_Layer ) == false )
361  return;
362 
363  m_Text.Print( aFrame, DC, offset );
364 
365  auto gcolor = aFrame->Settings().Colors().GetLayerColor( m_Layer );
366  auto displ_opts = aFrame->GetDisplayOptions();
367  bool filled = displ_opts.m_DisplayDrawItemsFill;
368  int width = m_Width;
369 
370  if( filled )
371  {
372  GRLine( nullptr, DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor );
373  GRLine( nullptr, DC, m_featureLineGO + offset, m_featureLineGF + offset, width, gcolor );
374  GRLine( nullptr, DC, m_featureLineDO + offset, m_featureLineDF + offset, width, gcolor );
375  GRLine( nullptr, DC, m_crossBarF + offset, m_arrowD1F + offset, width, gcolor );
376  GRLine( nullptr, DC, m_crossBarF + offset, m_arrowD2F + offset, width, gcolor );
377  GRLine( nullptr, DC, m_crossBarO + offset, m_arrowG1F + offset, width, gcolor );
378  GRLine( nullptr, DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor );
379  }
380  else
381  {
382  GRCSegm( nullptr, DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor );
383  GRCSegm( nullptr, DC, m_featureLineGO + offset, m_featureLineGF + offset, width, gcolor );
384  GRCSegm( nullptr, DC, m_featureLineDO + offset, m_featureLineDF + offset, width, gcolor );
385  GRCSegm( nullptr, DC, m_crossBarF + offset, m_arrowD1F + offset, width, gcolor );
386  GRCSegm( nullptr, DC, m_crossBarF + offset, m_arrowD2F + offset, width, gcolor );
387  GRCSegm( nullptr, DC, m_crossBarO + offset, m_arrowG1F + offset, width, gcolor );
388  GRCSegm( nullptr, DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor );
389  }
390 }
391 
392 
393 // see class_cotation.h
394 void DIMENSION::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
395 {
396  // for now, display only the text within the DIMENSION using class TEXTE_PCB.
397  m_Text.GetMsgPanelInfo( aUnits, aList );
398 }
399 
400 
401 bool DIMENSION::HitTest( const wxPoint& aPosition, int aAccuracy ) const
402 {
403  if( m_Text.TextHitTest( aPosition ) )
404  return true;
405 
406  int dist_max = aAccuracy + ( m_Width / 2 );
407 
408  // Locate SEGMENTS
409 
410  if( TestSegmentHit( aPosition, m_crossBarO, m_crossBarF, dist_max ) )
411  return true;
412 
413  if( TestSegmentHit( aPosition, m_featureLineGO, m_featureLineGF, dist_max ) )
414  return true;
415 
416  if( TestSegmentHit( aPosition, m_featureLineDO, m_featureLineDF, dist_max ) )
417  return true;
418 
419  if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD1F, dist_max ) )
420  return true;
421 
422  if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD2F, dist_max ) )
423  return true;
424 
425  if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG1F, dist_max ) )
426  return true;
427 
428  if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG2F, dist_max ) )
429  return true;
430 
431  return false;
432 }
433 
434 
435 bool DIMENSION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
436 {
437  EDA_RECT arect = aRect;
438  arect.Inflate( aAccuracy );
439 
440  EDA_RECT rect = GetBoundingBox();
441  if( aAccuracy )
442  rect.Inflate( aAccuracy );
443 
444  if( aContained )
445  return arect.Contains( rect );
446 
447  return arect.Intersects( rect );
448 }
449 
450 
452 {
453  EDA_RECT bBox;
454  int xmin, xmax, ymin, ymax;
455 
456  bBox = m_Text.GetTextBox( -1 );
457  xmin = bBox.GetX();
458  xmax = bBox.GetRight();
459  ymin = bBox.GetY();
460  ymax = bBox.GetBottom();
461 
462  xmin = std::min( xmin, m_crossBarO.x );
463  xmin = std::min( xmin, m_crossBarF.x );
464  ymin = std::min( ymin, m_crossBarO.y );
465  ymin = std::min( ymin, m_crossBarF.y );
466  xmax = std::max( xmax, m_crossBarO.x );
467  xmax = std::max( xmax, m_crossBarF.x );
468  ymax = std::max( ymax, m_crossBarO.y );
469  ymax = std::max( ymax, m_crossBarF.y );
470 
471  xmin = std::min( xmin, m_featureLineGO.x );
472  xmin = std::min( xmin, m_featureLineGF.x );
473  ymin = std::min( ymin, m_featureLineGO.y );
474  ymin = std::min( ymin, m_featureLineGF.y );
475  xmax = std::max( xmax, m_featureLineGO.x );
476  xmax = std::max( xmax, m_featureLineGF.x );
477  ymax = std::max( ymax, m_featureLineGO.y );
478  ymax = std::max( ymax, m_featureLineGF.y );
479 
480  xmin = std::min( xmin, m_featureLineDO.x );
481  xmin = std::min( xmin, m_featureLineDF.x );
482  ymin = std::min( ymin, m_featureLineDO.y );
483  ymin = std::min( ymin, m_featureLineDF.y );
484  xmax = std::max( xmax, m_featureLineDO.x );
485  xmax = std::max( xmax, m_featureLineDF.x );
486  ymax = std::max( ymax, m_featureLineDO.y );
487  ymax = std::max( ymax, m_featureLineDF.y );
488 
489  bBox.SetX( xmin );
490  bBox.SetY( ymin );
491  bBox.SetWidth( xmax - xmin + 1 );
492  bBox.SetHeight( ymax - ymin + 1 );
493 
494  bBox.Normalize();
495 
496  return bBox;
497 }
498 
499 
500 wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const
501 {
502  return wxString::Format( _( "Dimension \"%s\" on %s" ), GetText(), GetLayerName() );
503 }
504 
505 
507 {
508  return add_dimension_xpm;
509 }
510 
511 
513 {
514  BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
515  VECTOR2I( GetBoundingBox().GetSize() ) );
516  dimBBox.Merge( m_Text.ViewBBox() );
517 
518  return dimBBox;
519 }
520 
521 
523 {
524  return new DIMENSION( *this );
525 }
526 
528 {
529  assert( aImage->Type() == PCB_DIMENSION_T );
530 
531  std::swap( *((DIMENSION*) this), *((DIMENSION*) aImage) );
532 }
double To_User_Unit(EDA_UNITS aUnit, double aValue, bool aUseMils)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:95
EDA_UNITS
Definition: common.h:72
extended_type Cross(const VECTOR2< T > &aVector) const
Function Cross() computes cross product of self with aVector.
Definition: vector2d.h:484
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:237
BOX2< VECTOR2I > BOX2I
Definition: box2.h:521
void SetTextAngle(double aAngle)
void SetPosition(const wxPoint &aPos) override
PNG memory record (file in memory).
Definition: bitmap_def.h:29
TEXTE_PCB class definition.
void SetText(const wxString &NewText)
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
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
wxPoint m_arrowD1F
int GetX() const
Definition: eda_rect.h:111
DIMENSION(BOARD_ITEM *aParent)
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
double GetTextAngle() const
Definition: eda_text.h:158
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
double RAD2DECIDEG(double rad)
Definition: trigo.h:215
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:312
void SetHeight(int aHeight, int aPrecision)
Function SetHeight Sets the length of feature lines.
int GetThickness() const
Return the pen width.
Definition: eda_text.h:148
int m_Shape
Currently always 0.
wxPoint m_featureLineDF
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:252
void Mirror(const wxPoint &axis_pos, bool aMirrorLeftRight=false)
Function Mirror Mirror the Dimension , relative to a given horizontal axis the text is not mirrored.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions returns the display options current in use Display options are relative to...
bool Contains(const wxPoint &aPoint) const
Function Contains.
void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, bool aUseMils)
Get the units string for a given units type.
Definition: base_units.cpp:452
This file contains miscellaneous commonly used macros and functions.
int GetBottom() const
Definition: eda_rect.h:124
int GetTextHeight() const
Definition: eda_text.h:229
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:129
wxPoint m_featureLineGO
PCB_LAYER_ID m_Layer
DIMENSION class definition.
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
PCB_LAYER_ID
A quick note on layer IDs:
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
bool m_UseMils
If inches, use mils.
void SetOrigin(const wxPoint &aOrigin, int aPrecision)
Function SetOrigin Sets a new origin of the crossbar line.
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
void SetEnd(const wxPoint &aEnd, int aPrecision)
Function SetEnd Sets a new end of the crossbar line.
void SetHeight(int val)
Definition: eda_rect.h:186
PCB_GENERAL_SETTINGS & Settings()
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false, int aMarkupFlags=0) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:184
wxPoint m_arrowG1F
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetRight() const
Definition: eda_rect.h:121
wxPoint m_arrowD2F
wxPoint m_arrowG2F
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
void SetX(int val)
Definition: eda_rect.h:168
const BITMAP_OPAQUE add_dimension_xpm[1]
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:385
void SetWidth(int val)
Definition: eda_rect.h:180
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:230
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
void Print(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset) override
Function Print BOARD_ITEMs have their own color information.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
bool HitTest(const wxPoint &aPosition, int aAccuracy) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
COLORS_DESIGN_SETTINGS & Colors()
void SetY(int val)
Definition: eda_rect.h:174
int m_Width
Line width.
void AdjustDimensionDetails(int aPrecision)
Function AdjustDimensionDetails Calculate coordinates of segments used to draw the dimension.
void Normalize()
Function Normalize ensures that the height ant width are positive.
void Print(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset) override
Function Print BOARD_ITEMs have their own color information.
#define INVERT(pos)
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:449
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
double DEG2RAD(double deg)
Definition: trigo.h:210
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
#define _(s)
Definition: 3d_actions.cpp:31
void Move(const wxPoint &offset) override
Function Move.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:336
int GetY() const
Definition: eda_rect.h:112
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
wxPoint m_crossBarO
const wxPoint GetPosition() const override
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:299
const wxString GetText() const
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.
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
wxPoint m_featureLineDO
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
int m_Value
value of PCB dimensions.
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
DIMENSION.
EDA_UNITS m_Unit
0 = inches, 1 = mm
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
wxPoint m_featureLineGF