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 ) ),
50  m_Unit( INCHES ),
51  m_UseMils( false ),
52  m_Value( 0 ),
53  m_Height( 0 ),
54  m_Text( this )
55 {
57  m_Shape = 0;
58 }
59 
60 
62 {
63 }
64 
65 
66 void DIMENSION::SetPosition( const wxPoint& aPos )
67 {
68  m_Text.SetTextPos( aPos );
69 }
70 
71 
72 const wxPoint DIMENSION::GetPosition() const
73 {
74  return m_Text.GetTextPos();
75 }
76 
77 
78 void DIMENSION::SetText( const wxString& aNewText )
79 {
80  m_Text.SetText( aNewText );
81 }
82 
83 
84 const wxString DIMENSION::GetText() const
85 {
86  return m_Text.GetText();
87 }
88 
89 
91 {
92  m_Layer = aLayer;
93  m_Text.SetLayer( aLayer );
94 }
95 
96 
97 void DIMENSION::Move( const wxPoint& offset )
98 {
99  m_Text.Offset( offset );
100 
101  m_crossBarO += offset;
102  m_crossBarF += offset;
103  m_featureLineGO += offset;
104  m_featureLineGF += offset;
105  m_featureLineDO += offset;
106  m_featureLineDF += offset;
107  m_arrowG1F += offset;
108  m_arrowG2F += offset;
109  m_arrowD1F += offset;
110  m_arrowD2F += offset;
111 }
112 
113 
114 void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
115 {
116  wxPoint tmp = m_Text.GetTextPos();
117  RotatePoint( &tmp, aRotCentre, aAngle );
118  m_Text.SetTextPos( tmp );
119 
120  double newAngle = m_Text.GetTextAngle() + aAngle;
121 
122  if( newAngle >= 3600 )
123  newAngle -= 3600;
124 
125  if( newAngle > 900 && newAngle < 2700 )
126  newAngle -= 1800;
127 
128  m_Text.SetTextAngle( newAngle );
129 
130  RotatePoint( &m_crossBarO, aRotCentre, aAngle );
131  RotatePoint( &m_crossBarF, aRotCentre, aAngle );
132  RotatePoint( &m_featureLineGO, aRotCentre, aAngle );
133  RotatePoint( &m_featureLineGF, aRotCentre, aAngle );
134  RotatePoint( &m_featureLineDO, aRotCentre, aAngle );
135  RotatePoint( &m_featureLineDF, aRotCentre, aAngle );
136  RotatePoint( &m_arrowG1F, aRotCentre, aAngle );
137  RotatePoint( &m_arrowG2F, aRotCentre, aAngle );
138  RotatePoint( &m_arrowD1F, aRotCentre, aAngle );
139  RotatePoint( &m_arrowD2F, aRotCentre, aAngle );
140 }
141 
142 
143 void DIMENSION::Flip( const wxPoint& aCentre )
144 {
145  Mirror( aCentre );
146 
147  // DIMENSION items are not usually on copper layers, so
148  // copper layers count is not taken in accoun in Flip transform
149  SetLayer( FlipLayer( GetLayer() ) );
150 }
151 
152 
153 void DIMENSION::Mirror( const wxPoint& axis_pos )
154 {
155  wxPoint newPos = m_Text.GetTextPos();
156 
157 #define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
158  INVERT( newPos.y );
159 
160  m_Text.SetTextPos( newPos );
161 
162  // invert angle
164 
165  INVERT( m_crossBarO.y );
166  INVERT( m_crossBarF.y );
167  INVERT( m_featureLineGO.y );
168  INVERT( m_featureLineGF.y );
169  INVERT( m_featureLineDO.y );
170  INVERT( m_featureLineDF.y );
171  INVERT( m_arrowG1F.y );
172  INVERT( m_arrowG2F.y );
173  INVERT( m_arrowD1F.y );
174  INVERT( m_arrowD2F.y );
175 }
176 
177 
178 void DIMENSION::SetOrigin( const wxPoint& aOrigin )
179 {
180  m_featureLineGO = aOrigin;
181 
183 }
184 
185 
186 void DIMENSION::SetEnd( const wxPoint& aEnd )
187 {
188  m_featureLineDO = aEnd;
189 
191 }
192 
193 
194 void DIMENSION::SetHeight( int aHeight )
195 {
196  m_Height = aHeight;
197 
199 }
200 
201 
203 {
204  VECTOR2D featureLine( m_crossBarO - m_featureLineGO );
206 
207  if( featureLine.Cross( crossBar ) > 0 )
208  m_Height = -featureLine.EuclideanNorm();
209  else
210  m_Height = featureLine.EuclideanNorm();
211 }
212 
213 
215 {
216  const int arrowz = Mils2iu( 50 ); // size of arrows
217  int ii;
218  int measure, deltax, deltay; // value of the measure on X and Y axes
219  int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
220  int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
221  int hx, hy; // dimension line interval
222  double angle, angle_f;
223 
224  // Init layer :
225  m_Text.SetLayer( GetLayer() );
226 
227  // calculate the size of the dimension (text + line above the text)
229 
230  deltax = m_featureLineDO.x - m_featureLineGO.x;
231  deltay = m_featureLineDO.y - m_featureLineGO.y;
232 
233  // Calculate dimension value
234  measure = KiROUND( hypot( deltax, deltay ) );
235 
236  angle = atan2( (double)deltay, (double)deltax );
237 
238  // Calculation of parameters X and Y dimensions of the arrows and lines.
239  hx = hy = ii;
240 
241  // Taking into account the slope of the side lines.
242  if( measure )
243  {
244  hx = abs( KiROUND( ( (double) deltay * hx ) / measure ) );
245  hy = abs( KiROUND( ( (double) deltax * hy ) / measure ) );
246 
247  if( m_featureLineGO.x > m_crossBarO.x )
248  hx = -hx;
249 
250  if( m_featureLineGO.x == m_crossBarO.x )
251  hx = 0;
252 
253  if( m_featureLineGO.y > m_crossBarO.y )
254  hy = -hy;
255 
256  if( m_featureLineGO.y == m_crossBarO.y )
257  hy = 0;
258 
259  angle_f = angle + DEG2RAD( 27.5 );
260  arrow_up_X = wxRound( arrowz * cos( angle_f ) );
261  arrow_up_Y = wxRound( arrowz * sin( angle_f ) );
262  angle_f = angle - DEG2RAD( 27.5 );
263  arrow_dw_X = wxRound( arrowz * cos( angle_f ) );
264  arrow_dw_Y = wxRound( arrowz * sin( angle_f ) );
265  }
266 
267  int dx = KiROUND( m_Height * cos( angle + M_PI / 2 ) );
268  int dy = KiROUND( m_Height * sin( angle + M_PI / 2 ) );
269  m_crossBarO.x = m_featureLineGO.x + dx;
270  m_crossBarO.y = m_featureLineGO.y + dy;
271  m_crossBarF.x = m_featureLineDO.x + dx;
272  m_crossBarF.y = m_featureLineDO.y + dy;
273 
274  m_arrowG1F.x = m_crossBarO.x + arrow_up_X;
275  m_arrowG1F.y = m_crossBarO.y + arrow_up_Y;
276 
277  m_arrowG2F.x = m_crossBarO.x + arrow_dw_X;
278  m_arrowG2F.y = m_crossBarO.y + arrow_dw_Y;
279 
280  /* The right arrow is symmetrical to the left.
281  * / = -\ and \ = -/
282  */
283  m_arrowD1F.x = m_crossBarF.x - arrow_dw_X;
284  m_arrowD1F.y = m_crossBarF.y - arrow_dw_Y;
285 
286  m_arrowD2F.x = m_crossBarF.x - arrow_up_X;
287  m_arrowD2F.y = m_crossBarF.y - arrow_up_Y;
288 
289  // Length of feature lines
290  double radius = ( m_Height +
291  ( std::copysign( 1.0, m_Height ) *
292  arrowz * sin( DEG2RAD( 27.5 ) ) ) );
293 
294  m_featureLineGF.x = m_featureLineGO.x - wxRound( radius * sin( angle ) );
295  m_featureLineGF.y = m_featureLineGO.y + wxRound( radius * cos( angle ) );
296 
297  m_featureLineDF.x = m_featureLineDO.x - wxRound( radius * sin( angle ) );
298  m_featureLineDF.y = m_featureLineDO.y + wxRound( radius * cos( angle ) );
299 
300  // Calculate the better text position and orientation:
301  radius = ( std::copysign( 1.0, m_Height ) * ii );
302 
303  wxPoint textPos;
304  textPos.x = ( m_crossBarF.x + m_crossBarO.x ) / 2;
305  textPos.y = ( m_crossBarF.y + m_crossBarO.y ) / 2;
306 
307  textPos.x -= KiROUND( radius * sin( angle ) );
308  textPos.y += KiROUND( radius * cos( angle ) );
309 
310  m_Text.SetTextPos( textPos );
311 
312  double newAngle = -RAD2DECIDEG( angle );
313 
314  NORMALIZE_ANGLE_POS( newAngle );
315 
316  if( newAngle > 900 && newAngle < 2700 )
317  newAngle -= 1800;
318 
319  m_Text.SetTextAngle( newAngle );
320 
321  m_Value = measure;
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( EDA_UNITS_T aUnits, 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( aUnits, 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  return wxString::Format( _( "Dimension \"%s\" on %s" ), GetText(), GetLayerName() );
491 }
492 
493 
495 {
496  return add_dimension_xpm;
497 }
498 
499 
501 {
502  BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
503  VECTOR2I( GetBoundingBox().GetSize() ) );
504  dimBBox.Merge( m_Text.ViewBBox() );
505 
506  return dimBBox;
507 }
508 
509 
511 {
512  return new DIMENSION( *this );
513 }
514 
516 {
517  assert( aImage->Type() == PCB_DIMENSION_T );
518 
519  std::swap( *((DIMENSION*) this), *((DIMENSION*) aImage) );
520 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:242
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
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 GetMsgPanelInfo(EDA_UNITS_T aUnits, 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 SetPosition(const wxPoint &aPos) override
PNG memory record (file in memory).
Definition: bitmap_types.h:43
TEXTE_PCB class definition.
void SetText(const wxString &NewText)
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
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:475
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:236
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:415
int m_Shape
Currently always 0.
wxPoint m_featureLineDF
virtual EDA_RECT * GetClipBox()
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:587
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:177
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:167
This file contains miscellaneous commonly used macros and functions.
wxPoint m_featureLineGO
wxString MessageTextFromValue(EDA_UNITS_T aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:125
virtual EDA_DRAW_FRAME * GetParent() const =0
PCB_LAYER_ID m_Layer
DIMENSION class definition.
EDA_UNITS_T m_Unit
0 = inches, 1 = mm
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it&#39;s internal state for displ...
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:103
bool m_UseMils
If inches, use mils.
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:292
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
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:255
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:143
void SetEnd(const wxPoint &aEnd)
Function SetEnd Sets a new end of the crossbar line.
Definition: common.h:160
wxPoint m_arrowG1F
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:130
void AdjustDimensionDetails()
Function AdjustDimensionDetails Calculate coordinates of segments used to draw the dimension...
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:384
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:285
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
COLORS_DESIGN_SETTINGS & Colors()
void SetY(int val)
Definition: eda_rect.h:131
extended_type Cross(const VECTOR2< T > &aVector) const
Function Cross() computes cross product of self with aVector.
Definition: vector2d.h:477
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.
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:199
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
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
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
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:154
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
int GetY() const
Definition: eda_rect.h:110
int GetTextHeight() const
Definition: eda_text.h:234
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
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
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_UNITS_T
Definition: common.h:159
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:458
virtual void SetText(const wxString &aText)
Definition: eda_text.h:154
wxPoint m_featureLineGF