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)
224  ii = m_Text.GetTextHeight() + m_Text.GetThickness() + (m_Width * 3);
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 
287 
290 
291  // Calculate the better text position and orientation:
292  wxPoint textPos;
293  textPos.x = (m_crossBarF.x + m_featureLineGF.x) / 2;
294  textPos.y = (m_crossBarF.y + m_featureLineGF.y) / 2;
295  m_Text.SetTextPos( textPos );
296 
297  double newAngle = -RAD2DECIDEG( angle );
298 
299  NORMALIZE_ANGLE_POS( newAngle );
300 
301  if( newAngle > 900 && newAngle < 2700 )
302  newAngle -= 1800;
303 
304  m_Text.SetTextAngle( newAngle );
305 
306  if( !aDoNotChangeText )
307  {
308  m_Value = measure;
309  msg = ::CoordinateToString( m_Value );
310  SetText( msg );
311  }
312 }
313 
314 
315 void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
316  const wxPoint& offset )
317 {
318  BOARD* brd = GetBoard();
319 
320  if( brd->IsLayerVisible( m_Layer ) == false )
321  return;
322 
323  m_Text.Draw( panel, DC, mode_color, offset );
324 
325  auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() );
326  auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer );
327 
328  GRSetDrawMode( DC, mode_color );
329  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );
330  bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;
331  int width = m_Width;
332 
333  if( filled )
334  {
335  GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
336  m_crossBarF + offset, width, gcolor );
337  GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset,
338  m_featureLineGF + offset, width, gcolor );
339  GRLine( panel->GetClipBox(), DC, m_featureLineDO + offset,
340  m_featureLineDF + offset, width, gcolor );
341  GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
342  m_arrowD1F + offset, width, gcolor );
343  GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
344  m_arrowD2F + offset, width, gcolor );
345  GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
346  m_arrowG1F + offset, width, gcolor );
347  GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
348  m_arrowG2F + offset, width, gcolor );
349  }
350  else
351  {
352  GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
353  m_crossBarF + offset, width, gcolor );
354  GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset,
355  m_featureLineGF + offset, width, gcolor );
356  GRCSegm( panel->GetClipBox(), DC, m_featureLineDO + offset,
357  m_featureLineDF + offset, width, gcolor );
358  GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
359  m_arrowD1F + offset, width, gcolor );
360  GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
361  m_arrowD2F + offset, width, gcolor );
362  GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
363  m_arrowG1F + offset, width, gcolor );
364  GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
365  m_arrowG2F + offset, width, gcolor );
366  }
367 }
368 
369 
370 // see class_cotation.h
371 void DIMENSION::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
372 {
373  // for now, display only the text within the DIMENSION using class TEXTE_PCB.
374  m_Text.GetMsgPanelInfo( aList );
375 }
376 
377 
378 bool DIMENSION::HitTest( const wxPoint& aPosition ) const
379 {
380  if( m_Text.TextHitTest( aPosition ) )
381  return true;
382 
383  int dist_max = m_Width / 2;
384 
385  // Locate SEGMENTS
386 
387  if( TestSegmentHit( aPosition, m_crossBarO, m_crossBarF, dist_max ) )
388  return true;
389 
390  if( TestSegmentHit( aPosition, m_featureLineGO, m_featureLineGF, dist_max ) )
391  return true;
392 
393  if( TestSegmentHit( aPosition, m_featureLineDO, m_featureLineDF, dist_max ) )
394  return true;
395 
396  if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD1F, dist_max ) )
397  return true;
398 
399  if( TestSegmentHit( aPosition, m_crossBarF, m_arrowD2F, dist_max ) )
400  return true;
401 
402  if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG1F, dist_max ) )
403  return true;
404 
405  if( TestSegmentHit( aPosition, m_crossBarO, m_arrowG2F, dist_max ) )
406  return true;
407 
408  return false;
409 }
410 
411 
412 bool DIMENSION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
413 {
414  EDA_RECT arect = aRect;
415  arect.Inflate( aAccuracy );
416 
417  EDA_RECT rect = GetBoundingBox();
418  if( aAccuracy )
419  rect.Inflate( aAccuracy );
420 
421  if( aContained )
422  return arect.Contains( rect );
423 
424  return arect.Intersects( rect );
425 }
426 
427 
429 {
430  EDA_RECT bBox;
431  int xmin, xmax, ymin, ymax;
432 
433  bBox = m_Text.GetTextBox( -1 );
434  xmin = bBox.GetX();
435  xmax = bBox.GetRight();
436  ymin = bBox.GetY();
437  ymax = bBox.GetBottom();
438 
439  xmin = std::min( xmin, m_crossBarO.x );
440  xmin = std::min( xmin, m_crossBarF.x );
441  ymin = std::min( ymin, m_crossBarO.y );
442  ymin = std::min( ymin, m_crossBarF.y );
443  xmax = std::max( xmax, m_crossBarO.x );
444  xmax = std::max( xmax, m_crossBarF.x );
445  ymax = std::max( ymax, m_crossBarO.y );
446  ymax = std::max( ymax, m_crossBarF.y );
447 
448  xmin = std::min( xmin, m_featureLineGO.x );
449  xmin = std::min( xmin, m_featureLineGF.x );
450  ymin = std::min( ymin, m_featureLineGO.y );
451  ymin = std::min( ymin, m_featureLineGF.y );
452  xmax = std::max( xmax, m_featureLineGO.x );
453  xmax = std::max( xmax, m_featureLineGF.x );
454  ymax = std::max( ymax, m_featureLineGO.y );
455  ymax = std::max( ymax, m_featureLineGF.y );
456 
457  xmin = std::min( xmin, m_featureLineDO.x );
458  xmin = std::min( xmin, m_featureLineDF.x );
459  ymin = std::min( ymin, m_featureLineDO.y );
460  ymin = std::min( ymin, m_featureLineDF.y );
461  xmax = std::max( xmax, m_featureLineDO.x );
462  xmax = std::max( xmax, m_featureLineDF.x );
463  ymax = std::max( ymax, m_featureLineDO.y );
464  ymax = std::max( ymax, m_featureLineDF.y );
465 
466  bBox.SetX( xmin );
467  bBox.SetY( ymin );
468  bBox.SetWidth( xmax - xmin + 1 );
469  bBox.SetHeight( ymax - ymin + 1 );
470 
471  bBox.Normalize();
472 
473  return bBox;
474 }
475 
476 
478 {
479  wxString text;
480  text.Printf( _( "Dimension \"%s\" on %s" ),
481  GetChars( GetText() ), GetChars( GetLayerName() ) );
482 
483  return text;
484 }
485 
486 
488 {
489  return add_dimension_xpm;
490 }
491 
492 
494 {
495  BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
496  VECTOR2I( GetBoundingBox().GetSize() ) );
497  dimBBox.Merge( m_Text.ViewBBox() );
498 
499  return dimBBox;
500 }
501 
502 
504 {
505  return new DIMENSION( *this );
506 }
507 
509 {
510  assert( aImage->Type() == PCB_DIMENSION_T );
511 
512  std::swap( *((DIMENSION*) this), *((DIMENSION*) aImage) );
513 }
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:227
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:317
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:181
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:180
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:188
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:142
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