KiCad PCB EDA Suite
lib_polyline.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, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #include <fctsys.h>
30 #include <gr_basic.h>
31 #include <macros.h>
32 #include <class_drawpanel.h>
33 #include <plot_common.h>
34 #include <trigo.h>
35 #include <wxstruct.h>
36 #include <richio.h>
37 #include <base_units.h>
38 #include <msgpanel.h>
39 #include <bitmaps.h>
40 
41 #include <general.h>
42 #include <lib_polyline.h>
43 #include <transform.h>
44 
45 
47  LIB_ITEM( LIB_POLYLINE_T, aParent )
48 {
49  m_Fill = NO_FILL;
50  m_Width = 0;
51  m_isFillable = true;
52  m_typeName = _( "PolyLine" );
53  m_ModifyIndex = 0;
54 }
55 
56 
58 {
59  int ccount = GetCornerCount();
60 
61  aFormatter.Print( 0, "P %d %d %d %d", ccount, m_Unit, m_Convert, m_Width );
62 
63  for( unsigned i = 0; i < GetCornerCount(); i++ )
64  {
65  aFormatter.Print( 0, " %d %d", m_PolyPoints[i].x, m_PolyPoints[i].y );
66  }
67 
68  aFormatter.Print( 0, " %c\n", fill_tab[m_Fill] );
69 
70  return true;
71 }
72 
73 
74 bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
75 {
76  char* p;
77  int i, ccount = 0;
78  wxPoint pt;
79  char* line = (char*) aLineReader;
80 
81  i = sscanf( line + 2, "%d %d %d %d", &ccount, &m_Unit, &m_Convert, &m_Width );
82 
83  m_Fill = NO_FILL;
84 
85  if( i < 4 )
86  {
87  aErrorMsg.Printf( _( "Polyline only had %d parameters of the required 4" ), i );
88  return false;
89  }
90 
91  if( ccount <= 0 )
92  {
93  aErrorMsg.Printf( _( "Polyline count parameter %d is invalid" ), ccount );
94  return false;
95  }
96 
97  strtok( line + 2, " \t\n" ); // Skip field
98  strtok( NULL, " \t\n" ); // Skip field
99  strtok( NULL, " \t\n" ); // Skip field
100  strtok( NULL, " \t\n" );
101 
102  for( i = 0; i < ccount; i++ )
103  {
104  p = strtok( NULL, " \t\n" );
105 
106  if( p == NULL || sscanf( p, "%d", &pt.x ) != 1 )
107  {
108  aErrorMsg.Printf( _( "Polyline point %d X position not defined" ), i );
109  return false;
110  }
111 
112  p = strtok( NULL, " \t\n" );
113 
114  if( p == NULL || sscanf( p, "%d", &pt.y ) != 1 )
115  {
116  aErrorMsg.Printf( _( "Polyline point %d Y position not defined" ), i );
117  return false;
118  }
119 
120  AddPoint( pt );
121  }
122 
123  if( ( p = strtok( NULL, " \t\n" ) ) != NULL )
124  {
125  if( p[0] == 'F' )
127 
128  if( p[0] == 'f' )
130  }
131 
132  return true;
133 }
134 
135 
137 {
138  return new LIB_POLYLINE( *this );
139 }
140 
141 
142 int LIB_POLYLINE::compare( const LIB_ITEM& aOther ) const
143 {
144  wxASSERT( aOther.Type() == LIB_POLYLINE_T );
145 
146  const LIB_POLYLINE* tmp = (LIB_POLYLINE*) &aOther;
147 
148  if( m_PolyPoints.size() != tmp->m_PolyPoints.size() )
149  return m_PolyPoints.size() - tmp->m_PolyPoints.size();
150 
151  for( size_t i = 0; i < m_PolyPoints.size(); i++ )
152  {
153  if( m_PolyPoints[i].x != tmp->m_PolyPoints[i].x )
154  return m_PolyPoints[i].x - tmp->m_PolyPoints[i].x;
155 
156  if( m_PolyPoints[i].y != tmp->m_PolyPoints[i].y )
157  return m_PolyPoints[i].y - tmp->m_PolyPoints[i].y;
158  }
159 
160  return 0;
161 }
162 
163 
164 void LIB_POLYLINE::SetOffset( const wxPoint& aOffset )
165 {
166  for( size_t i = 0; i < m_PolyPoints.size(); i++ )
167  m_PolyPoints[i] += aOffset;
168 }
169 
170 
171 bool LIB_POLYLINE::Inside( EDA_RECT& aRect ) const
172 {
173  for( size_t i = 0; i < m_PolyPoints.size(); i++ )
174  {
175  if( aRect.Contains( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
176  return true;
177  }
178 
179  return false;
180 }
181 
182 
183 void LIB_POLYLINE::Move( const wxPoint& aPosition )
184 {
185  SetOffset( aPosition - m_PolyPoints[0] );
186 }
187 
188 
190 {
191  size_t i, imax = m_PolyPoints.size();
192 
193  for( i = 0; i < imax; i++ )
194  {
195  m_PolyPoints[i].x -= aCenter.x;
196  m_PolyPoints[i].x *= -1;
197  m_PolyPoints[i].x += aCenter.x;
198  }
199 }
200 
201 void LIB_POLYLINE::MirrorVertical( const wxPoint& aCenter )
202 {
203  size_t i, imax = m_PolyPoints.size();
204 
205  for( i = 0; i < imax; i++ )
206  {
207  m_PolyPoints[i].y -= aCenter.y;
208  m_PolyPoints[i].y *= -1;
209  m_PolyPoints[i].y += aCenter.y;
210  }
211 }
212 
213 void LIB_POLYLINE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
214 {
215  int rot_angle = aRotateCCW ? -900 : 900;
216 
217  size_t i, imax = m_PolyPoints.size();
218 
219  for( i = 0; i < imax; i++ )
220  {
221  RotatePoint( &m_PolyPoints[i], aCenter, rot_angle );
222  }
223 }
224 
225 
226 void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
227  const TRANSFORM& aTransform )
228 {
229  wxASSERT( aPlotter != NULL );
230 
231  static std::vector< wxPoint > cornerList;
232  cornerList.clear();
233 
234  for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
235  {
236  wxPoint pos = m_PolyPoints[ii];
237  pos = aTransform.TransformCoordinate( pos ) + aOffset;
238  cornerList.push_back( pos );
239  }
240 
241  if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
242  {
244  aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
245  }
246 
247  bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
248  aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) );
249  aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() );
250 }
251 
252 
253 void LIB_POLYLINE::AddPoint( const wxPoint& point )
254 {
255  m_PolyPoints.push_back( point );
256 }
257 
258 
260 {
261  return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
262 }
263 
264 
265 void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
266  COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
267  const TRANSFORM& aTransform )
268 {
269  wxPoint pos1;
271  wxPoint* buffer = NULL;
272 
273  if( aColor == COLOR4D::UNSPECIFIED ) // Used normal color or selected color
274  {
275  if( IsSelected() )
276  color = GetItemSelectedColor();
277  }
278  else
279  {
280  color = aColor;
281  }
282 
283  buffer = new wxPoint[ m_PolyPoints.size() ];
284 
285  for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
286  {
287  buffer[ii] = aTransform.TransformCoordinate( m_PolyPoints[ii] ) + aOffset;
288  }
289 
290  FILL_T fill = aData ? NO_FILL : m_Fill;
291 
292  if( aColor != COLOR4D::UNSPECIFIED )
293  fill = NO_FILL;
294 
295  GRSetDrawMode( aDC, aDrawMode );
296 
297  EDA_RECT* const clipbox = aPanel? aPanel->GetClipBox() : NULL;
298  if( fill == FILLED_WITH_BG_BODYCOLOR )
299  GRPoly( clipbox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(),
302  else if( fill == FILLED_SHAPE )
303  GRPoly( clipbox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(),
304  color, color );
305  else
306  GRPoly( clipbox, aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(),
307  color, color );
308 
309  delete[] buffer;
310 
311  /* Set to one (1) to draw bounding box around polyline to validate
312  * bounding box calculation. */
313 #if 0
314  EDA_RECT bBox = GetBoundingBox();
315  bBox.RevertYAxis();
316  bBox = aTransform.TransformCoordinate( bBox );
317  bBox.Move( aOffset );
318  GRRect( clipbox, aDC, bBox, 0, LIGHTMAGENTA );
319 #endif
320 }
321 
322 
323 bool LIB_POLYLINE::HitTest( const wxPoint& aPosition ) const
324 {
325  int mindist = GetPenSize() / 2;
326 
327  // Have a minimal tolerance for hit test
328  if( mindist < MINIMUM_SELECTION_DISTANCE )
329  mindist = MINIMUM_SELECTION_DISTANCE;
330 
331  return HitTest( aPosition, mindist, DefaultTransform );
332 }
333 
334 
335 bool LIB_POLYLINE::HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM& aTransform ) const
336 {
337  wxPoint start, end;
338 
339  if( aThreshold < 0 )
340  aThreshold = GetPenSize() / 2;
341 
342  for( unsigned ii = 1; ii < GetCornerCount(); ii++ )
343  {
344  start = aTransform.TransformCoordinate( m_PolyPoints[ii - 1] );
345  end = aTransform.TransformCoordinate( m_PolyPoints[ii] );
346 
347  if( TestSegmentHit( aPosition, start, end, aThreshold ) )
348  return true;
349  }
350 
351  return false;
352 }
353 
354 
356 {
357  EDA_RECT rect;
358  int xmin, xmax, ymin, ymax;
359 
360  xmin = xmax = m_PolyPoints[0].x;
361  ymin = ymax = m_PolyPoints[0].y;
362 
363  for( unsigned ii = 1; ii < GetCornerCount(); ii++ )
364  {
365  xmin = std::min( xmin, m_PolyPoints[ii].x );
366  xmax = std::max( xmax, m_PolyPoints[ii].x );
367  ymin = std::min( ymin, m_PolyPoints[ii].y );
368  ymax = std::max( ymax, m_PolyPoints[ii].y );
369  }
370 
371  rect.SetOrigin( xmin, ymin );
372  rect.SetEnd( xmax, ymax );
373  rect.Inflate( ( GetPenSize()+1 ) / 2 );
374 
375  rect.RevertYAxis();
376 
377  return rect;
378 }
379 
380 
381 void LIB_POLYLINE::DeleteSegment( const wxPoint aPosition )
382 {
383  // First segment is kept, only its end point is changed
384  while( GetCornerCount() > 2 )
385  {
386  m_PolyPoints.pop_back();
387 
388  if( m_PolyPoints[ GetCornerCount() - 1 ] != aPosition )
389  {
390  m_PolyPoints[ GetCornerCount() - 1 ] = aPosition;
391  break;
392  }
393  }
394 }
395 
396 
398 {
399  wxString msg;
400  EDA_RECT bBox = GetBoundingBox();
401 
402  LIB_ITEM::GetMsgPanelInfo( aList );
403 
404  msg = StringFromValue( g_UserUnit, m_Width, true );
405 
406  aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
407 
408  msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
409  bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
410 
411  aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
412 }
413 
414 
416 {
417  return wxString::Format( _( "Polyline at (%s, %s) with %d points" ),
420  int( m_PolyPoints.size() ) );
421 }
422 
423 
425 {
426  return add_polygon_xpm;
427 }
428 
429 
430 void LIB_POLYLINE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
431 {
432  wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
433  wxT( "Invalid edit mode for LIB_POLYLINE object." ) );
434 
435  if( aEditMode == IS_NEW )
436  {
437  m_PolyPoints.push_back( aPosition ); // Start point of first segment.
438  m_PolyPoints.push_back( aPosition ); // End point of first segment.
439  }
440  else if( aEditMode == IS_RESIZED )
441  {
442  // Drag one edge point of the polyline
443  // Find the nearest edge point to be dragged
444  wxPoint startPoint = m_PolyPoints[0];
445 
446  // Begin with the first list point as nearest point
447  int index = 0;
448  m_ModifyIndex = 0;
449  m_initialPos = startPoint;
450 
451  // First distance is the current minimum distance
452  int distanceMin = (aPosition - startPoint).x * (aPosition - startPoint).x
453  + (aPosition - startPoint).y * (aPosition - startPoint).y;
454 
455  wxPoint prevPoint = startPoint;
456 
457  // Find the right index of the point to be dragged
458  for( wxPoint point : m_PolyPoints )
459  {
460  int distancePoint = (aPosition - point).x * (aPosition - point).x +
461  (aPosition - point).y * (aPosition - point).y;
462 
463  if( distancePoint < distanceMin )
464  {
465  // Save point.
466  m_initialPos = point;
467  m_ModifyIndex = index;
468  distanceMin = distancePoint;
469  }
470 
471  // check middle of an edge
472  wxPoint offset = ( aPosition + aPosition - point - prevPoint );
473  distancePoint = ( offset.x * offset.x + offset.y * offset.y ) / 4 + 1;
474 
475  if( distancePoint < distanceMin )
476  {
477  // Save point.
478  m_initialPos = point;
479  m_ModifyIndex = -index; // negative indicates new vertex is to be inserted
480  distanceMin = distancePoint;
481  }
482 
483  prevPoint = point;
484  index++;
485  }
486 
488  }
489  else if( aEditMode == IS_MOVED )
490  {
491  m_initialCursorPos = aPosition;
494  }
495 
496  m_Flags = aEditMode;
497 }
498 
499 
500 bool LIB_POLYLINE::ContinueEdit( const wxPoint aPosition )
501 {
502  wxCHECK_MSG( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, false,
503  wxT( "Bad call to ContinueEdit(). LIB_POLYLINE is not being edited." ) );
504 
505  if( m_Flags == IS_NEW )
506  {
507  // do not add zero length segments
508  if( m_PolyPoints[m_PolyPoints.size() - 2] != m_PolyPoints.back() )
509  m_PolyPoints.push_back( aPosition );
510 
511  return true;
512  }
513 
514  return false;
515 }
516 
517 
518 void LIB_POLYLINE::EndEdit( const wxPoint& aPosition, bool aAbort )
519 {
520  wxCHECK_RET( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
521  wxT( "Bad call to EndEdit(). LIB_POLYLINE is not being edited." ) );
522 
523  // do not include last point twice
524  if( m_Flags == IS_NEW && 2 < m_PolyPoints.size() )
525  {
526  if( m_PolyPoints[ m_PolyPoints.size() - 2 ] == m_PolyPoints.back() )
527  m_PolyPoints.pop_back();
528  }
529 
530  if( (m_Flags == IS_RESIZED) && (m_PolyPoints.size() > 2) ) // do not delete last two points... keep it alive
531  {
532  if( ( m_ModifyIndex > 0 && m_PolyPoints[ m_ModifyIndex ] ==
533  m_PolyPoints[ m_ModifyIndex - 1 ] )
534  || ( m_ModifyIndex < (int) m_PolyPoints.size() - 1
536  {
537  m_PolyPoints.erase( m_PolyPoints.begin() + m_ModifyIndex ); // delete a point on this
538  }
539  }
540 
541  m_Flags = 0;
542  SetEraseLastDrawItem( false );
543 }
544 
545 
546 void LIB_POLYLINE::calcEdit( const wxPoint& aPosition )
547 {
548  if( m_Flags == IS_NEW )
549  {
550  m_PolyPoints[ GetCornerCount() - 1 ] = aPosition;
552  }
553  else if( m_Flags == IS_RESIZED )
554  {
555  if( m_ModifyIndex < 0 ) // negative indicates new vertex is to be inserted
556  {
558  m_PolyPoints.insert( m_PolyPoints.begin() + m_ModifyIndex, aPosition );
559  }
560 
561  m_PolyPoints[ m_ModifyIndex ] = aPosition;
562  }
563  else if( m_Flags == IS_MOVED )
564  {
565  Move( m_initialPos + aPosition - m_initialCursorPos );
566  }
567 }
Definition: colors.h:57
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:117
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
bool Inside(EDA_RECT &aRect) const override
Function Inside tests if any part of the draw object is inside rectangle bounds of aRect...
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:767
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
void calcEdit(const wxPoint &aPosition) override
Calculates the attributes of an item at aPosition when it is being edited.
PNG memory record (file in memory).
Definition: bitmap_types.h:38
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
wxString m_typeName
Name of object displayed in the message panel.
void SetEraseLastDrawItem(bool aErase=true)
Implementation of conversion functions that require both schematic and board internal units...
virtual void SetColor(COLOR4D color)=0
#define MINIMUM_SELECTION_DISTANCE
Definition: lib_draw_item.h:52
bool Contains(const wxPoint &aPoint) const
Function Contains.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:203
int compare(const LIB_ITEM &aOther) const override
Function compare provides the draw object specific comparison called by the == and < operators...
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
void MirrorHorizontal(const wxPoint &aCenter) override
Function MirrorHorizontal mirrors the draw object along the horizontal (X) axis about aCenter point...
void MirrorVertical(const wxPoint &aCenter) override
Function MirrorVertical mirrors the draw object along the MirrorVertical (Y) axis about aCenter point...
bool IsSelected() const
Definition: base_struct.h:235
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo displays basic info (type, part and convert) about the current item in messa...
void SetOrigin(const wxPoint &pos)
int m_Unit
Unit identification for multiple parts per package.
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
bool Save(OUTPUTFORMATTER &aFormatter) override
Function Save writes draw item object to aFormatter in component library "*.lib" format.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Function PlotPoly.
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
void RevertYAxis()
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size) ...
void BeginEdit(STATUS_FLAGS aEditMode, const wxPoint aStartPoint=wxPoint(0, 0)) override
Begin an editing a component library draw item in aEditMode at aPosition.
unsigned GetCornerCount() const
Definition: lib_polyline.h:75
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
This file contains miscellaneous commonly used macros and functions.
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
void SetOffset(const wxPoint &aOffset) override
Function Offset sets the drawing object by aOffset from the current position.
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
const wxPoint & GetOrigin() const
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1077
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
int GetPenSize() const override
Function GetPenSize.
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
Base window classes and related definitions.
void SetEnd(int x, int y)
void Move(const wxPoint &aPosition) override
Function Move moves a draw object to aPosition.
bool ContinueEdit(const wxPoint aNextPoint) override
Continue an edit in progress at aPosition.
bool m_isFillable
Flag to indicate if draw item is fillable.
Class LIB_PART defines a library part object.
unsigned STATUS_FLAGS
Definition: base_struct.h:158
EDA_RECT * GetClipBox()
std::vector< wxPoint > m_PolyPoints
Definition: lib_polyline.h:38
Common plot library Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF) ...
void AddPoint(const wxPoint &aPoint)
bool Load(LINE_READER &aLineReader, wxString &aErrorMsg) override
virtual void Rotate()
Rotate the draw item.
const wxPoint GetEnd() const
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void DeleteSegment(const wxPoint aPosition)
Delete the segment at aPosition.
Base plotter engine class.
Definition: plot_common.h:86
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo displays basic info (type, part and convert) about the current item in messa...
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
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
const int fill_tab[3]
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
#define max(a, b)
Definition: auxiliary.h:86
wxPoint m_initialPos
Temporary position when moving an existing item.
FILL_T m_Fill
The body fill type.
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
Class EDA_RECT handles the component boundary box.
void drawGraphic(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform) override
Function drawGraphic.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:128
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
int m_Convert
Shape identification for alternate body styles.
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:70
const EDA_RECT GetBoundingBox() const override
COLOR4D GetItemSelectedColor()
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408
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 EndEdit(const wxPoint &aPosition, bool aAbort=false) override
End an object editing action.
Message panel definition file.
LIB_POLYLINE(LIB_PART *aParent)
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) override
Plot the draw item using the plot object.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
wxPoint m_initialCursorPos
Initial cursor position at the beginning of a move.
#define min(a, b)
Definition: auxiliary.h:85
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
#define IS_MOVED
Item being moved.
Definition: base_struct.h:126
Definition: colors.h:62