KiCad PCB EDA Suite
sch_line.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) 2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.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 
30 #include <fctsys.h>
31 #include <gr_basic.h>
32 #include <macros.h>
33 #include <class_drawpanel.h>
34 #include <plot_common.h>
35 #include <base_units.h>
36 #include <eeschema_config.h>
37 #include <general.h>
38 #include <protos.h>
39 #include <sch_line.h>
40 #include <class_netlist_object.h>
41 
42 
43 SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
44  SCH_ITEM( NULL, SCH_LINE_T )
45 {
46  m_start = pos;
47  m_end = pos;
49 
50  switch( layer )
51  {
52  default:
54  break;
55 
56  case LAYER_WIRE:
58  break;
59 
60  case LAYER_BUS:
62  break;
63  }
64 }
65 
66 
67 SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) :
68  SCH_ITEM( aLine )
69 {
70  m_start = aLine.m_start;
71  m_end = aLine.m_end;
73 }
74 
75 
77 {
78  return new SCH_LINE( *this );
79 }
80 
81 
82 void SCH_LINE::Move( const wxPoint& aOffset )
83 {
84  if( (m_Flags & STARTPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
85  {
86  m_start += aOffset;
87  SetModified();
88  }
89 
90  if( (m_Flags & ENDPOINT) == 0 && aOffset != wxPoint( 0, 0 ) )
91  {
92  m_end += aOffset;
93  SetModified();
94  }
95 }
96 
97 
98 #if defined(DEBUG)
99 
100 void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
101 {
102  NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
103  << " layer=\"" << m_Layer << '"'
104  << " startIsDangling=\"" << m_startIsDangling
105  << '"' << " endIsDangling=\""
106  << m_endIsDangling << '"' << ">"
107  << " <start" << m_start << "/>"
108  << " <end" << m_end << "/>" << "</"
109  << GetClass().Lower().mb_str() << ">\n";
110 }
111 
112 #endif
113 
114 
116 {
117  int width = 25;
118 
119  int xmin = std::min( m_start.x, m_end.x ) - width;
120  int ymin = std::min( m_start.y, m_end.y ) - width;
121 
122  int xmax = std::max( m_start.x, m_end.x ) + width;
123  int ymax = std::max( m_start.y, m_end.y ) + width;
124 
125  // return a rectangle which is [pos,dim) in nature. therefore the +1
126  EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
127 
128  return ret;
129 }
130 
131 
132 double SCH_LINE::GetLength() const
133 {
134  return GetLineLength( m_start, m_end );
135 }
136 
137 
138 bool SCH_LINE::Save( FILE* aFile ) const
139 {
140  bool success = true;
141 
142  const char* layer = "Notes";
143  const char* width = "Line";
144 
145  if( GetLayer() == LAYER_WIRE )
146  layer = "Wire";
147 
148  if( GetLayer() == LAYER_BUS )
149  layer = "Bus";
150 
151  if( fprintf( aFile, "Wire %s %s\n", layer, width ) == EOF )
152  {
153  success = false;
154  }
155 
156  if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_start.x, m_start.y,
157  m_end.x, m_end.y ) == EOF )
158  {
159  success = false;
160  }
161 
162  return success;
163 }
164 
165 
166 bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
167 {
168  char Name1[256];
169  char Name2[256];
170  char* line = (char*) aLine;
171 
172  while( (*line != ' ' ) && *line )
173  line++;
174 
175  if( sscanf( line, "%255s %255s", Name1, Name2 ) != 2 )
176  {
177  aErrorMsg.Printf( wxT( "Eeschema file segment error at line %d, aborted" ),
178  aLine.LineNumber() );
179  aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
180  return false;
181  }
182 
184 
185  if( Name1[0] == 'W' )
187 
188  if( Name1[0] == 'B' )
189  m_Layer = LAYER_BUS;
190 
191  if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ",
192  &m_start.x, &m_start.y, &m_end.x, &m_end.y ) != 4 )
193  {
194  aErrorMsg.Printf( wxT( "Eeschema file Segment struct error at line %d, aborted" ),
195  aLine.LineNumber() );
196  aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
197  return false;
198  }
199 
200  return true;
201 }
202 
203 
205 {
206 
207  if( m_Layer == LAYER_BUS )
208  return GetDefaultBusThickness();
209 
210  return GetDefaultLineThickness();
211 }
212 
213 
214 void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
215  GR_DRAWMODE DrawMode, COLOR4D Color )
216 {
217  COLOR4D color;
218  int width = GetPenSize();
219 
220  if( Color != COLOR4D::UNSPECIFIED )
221  color = Color;
222  else
224 
225  GRSetDrawMode( DC, DrawMode );
226 
227  wxPoint start = m_start;
228  wxPoint end = m_end;
229 
230  if( ( m_Flags & STARTPOINT ) == 0 )
231  start += offset;
232 
233  if( ( m_Flags & ENDPOINT ) == 0 )
234  end += offset;
235 
236  if( m_Layer == LAYER_NOTES )
237  GRDashedLine( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, width, color );
238  else
239  GRLine( panel->GetClipBox(), DC, start, end, width, color );
240 
241  if( m_startIsDangling )
242  DrawDanglingSymbol( panel, DC, start, color );
243 
244  if( m_endIsDangling )
245  DrawDanglingSymbol( panel, DC, end, color );
246 }
247 
248 
249 void SCH_LINE::MirrorX( int aXaxis_position )
250 {
251  MIRROR( m_start.y, aXaxis_position );
252  MIRROR( m_end.y, aXaxis_position );
253 }
254 
255 
256 void SCH_LINE::MirrorY( int aYaxis_position )
257 {
258  MIRROR( m_start.x, aYaxis_position );
259  MIRROR( m_end.x, aYaxis_position );
260 }
261 
262 
263 void SCH_LINE::Rotate( wxPoint aPosition )
264 {
265  RotatePoint( &m_start, aPosition, 900 );
266  RotatePoint( &m_end, aPosition, 900 );
267 }
268 
269 
270 /*
271  * MergeOverlap try to merge 2 lines that are colinear.
272  * this function expects these 2 lines have at least a common end
273  */
275 {
276  wxCHECK_MSG( aLine != NULL && aLine->Type() == SCH_LINE_T, false,
277  wxT( "Cannot test line segment for overlap." ) );
278 
279  if( this == aLine || GetLayer() != aLine->GetLayer() )
280  return false;
281 
282  // Search for a common end:
283  if( m_start == aLine->m_start )
284  {
285  if( m_end == aLine->m_end ) // Trivial case
286  return true;
287  }
288  else if( m_start == aLine->m_end )
289  {
290  if( m_end == aLine->m_start ) // Trivial case
291  return true;
292  }
293  else if( m_end == aLine->m_end )
294  {
295  std::swap( aLine->m_start, aLine->m_end );
296  }
297  else if( m_end != aLine->m_start )
298  {
299  // No common end point, segments cannot be merged.
300  return false;
301  }
302 
303  bool colinear = false;
304 
305  /* Test alignment: */
306  if( m_start.y == m_end.y ) // Horizontal segment
307  {
308  if( aLine->m_start.y == aLine->m_end.y )
309  {
310  colinear = true;
311  }
312  }
313  else if( m_start.x == m_end.x ) // Vertical segment
314  {
315  if( aLine->m_start.x == aLine->m_end.x )
316  {
317  colinear = true;
318  }
319  }
320  else
321  {
322  if( atan2( (double) ( m_start.x - m_end.x ), (double) ( m_start.y - m_end.y ) )
323  == atan2( (double) ( aLine->m_start.x - aLine->m_end.x ),
324  (double) ( aLine->m_start.y - aLine->m_end.y ) ) )
325  {
326  colinear = true;
327  }
328  }
329 
330  // Make a segment which merge the 2 segments
331  // we must find the extremums
332  // i.e. the more to the left and to the right points, or
333  // for horizontal segments the uppermost and the lowest point
334  if( colinear )
335  {
336  auto less = []( const wxPoint& lhs, const wxPoint& rhs ) -> bool
337  {
338  if( lhs.x == rhs.x )
339  return lhs.y < rhs.y;
340  return lhs.x < rhs.x;
341  };
342 
343  wxPoint top_left = std::min( { m_start, m_end, aLine->m_start, aLine->m_end }, less );
344  wxPoint bottom_right = std::max( { m_start, m_end, aLine->m_start, aLine->m_end }, less );
345 
346  m_start = top_left;
347  m_end = bottom_right;
348  return true;
349  }
350  return false;
351 }
352 
353 
354 void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
355 {
356  if( GetLayer() == LAYER_NOTES )
357  return;
358 
359  if( ( GetLayer() == LAYER_BUS ) || ( GetLayer() == LAYER_WIRE ) )
360  {
362  m_start );
363  aItemList.push_back( item );
364 
366  m_end );
367  aItemList.push_back( item1 );
368  }
369 }
370 
371 
372 bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList )
373 {
374  bool previousStartState = m_startIsDangling;
375  bool previousEndState = m_endIsDangling;
376 
378 
379  if( GetLayer() == LAYER_WIRE )
380  {
381  for( DANGLING_END_ITEM item : aItemList )
382  {
383  if( item.GetItem() == this )
384  continue;
385 
386  if( item.GetType() == NO_CONNECT_END )
387  continue;
388 
389  if( m_start == item.GetPosition() )
390  m_startIsDangling = false;
391 
392  if( m_end == item.GetPosition() )
393  m_endIsDangling = false;
394 
395  if( (m_startIsDangling == false) && (m_endIsDangling == false) )
396  break;
397  }
398  }
399  else if( GetLayer() == LAYER_BUS || GetLayer() == LAYER_NOTES )
400  {
401  // Lines on the notes layer and the bus layer cannot be tested for dangling ends.
402  previousStartState = previousEndState = m_startIsDangling = m_endIsDangling = false;
403  }
404 
405  return ( previousStartState != m_startIsDangling ) || ( previousEndState != m_endIsDangling );
406 }
407 
408 
409 bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect )
410 {
411  bool previousState = IsSelected();
412 
413  if( aRect.Contains( m_start ) && aRect.Contains( m_end ) )
414  {
415  SetFlags( SELECTED );
417  }
418  else if( aRect.Contains( m_start ) )
419  {
422  }
423  else if( aRect.Contains( m_end ) )
424  {
425  ClearFlags( ENDPOINT );
427  }
428  else
429  {
431  }
432 
433  return previousState != IsSelected();
434 }
435 
436 
438 {
439  if( m_Layer == LAYER_WIRE || m_Layer == LAYER_BUS )
440  return true;
441 
442  return false;
443 }
444 
445 
446 void SCH_LINE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
447 {
448  aPoints.push_back( m_start );
449  aPoints.push_back( m_end );
450 }
451 
452 
454 {
455  wxString menuText, txtfmt, orient;
456 
457  if( m_start.x == m_end.x )
458  orient = _("Vert.");
459  else if( m_start.y == m_end.y )
460  orient = _("Horiz.");
461 
462  switch( m_Layer )
463  {
464  case LAYER_NOTES:
465  txtfmt = _( "%s Graphic Line from (%s,%s) to (%s,%s)" );
466  break;
467 
468  case LAYER_WIRE:
469  txtfmt = _( "%s Wire from (%s,%s) to (%s,%s)" );
470  break;
471 
472  case LAYER_BUS:
473  txtfmt = _( "%s Bus from (%s,%s) to (%s,%s)" );
474  break;
475 
476  default:
477  txtfmt += _( "%s Line on Unknown Layer from (%s,%s) to (%s,%s)" );
478  }
479 
480  menuText.Printf( txtfmt, GetChars( orient ),
485 
486  return menuText;
487 }
488 
489 
491 {
492  if( m_Layer == LAYER_NOTES )
493  return add_dashed_line_xpm;
494  else if( m_Layer == LAYER_WIRE )
495  return add_line_xpm;
496 
497  return add_bus_xpm;
498 }
499 
500 
502  SCH_SHEET_PATH* aSheetPath )
503 {
504  // Net list item not required for graphic lines.
505  if( (GetLayer() != LAYER_BUS) && (GetLayer() != LAYER_WIRE) )
506  return;
507 
508  NETLIST_OBJECT* item = new NETLIST_OBJECT();
509  item->m_SheetPath = *aSheetPath;
510  item->m_SheetPathInclude = *aSheetPath;
511  item->m_Comp = (SCH_ITEM*) this;
512  item->m_Start = m_start;
513  item->m_End = m_end;
514 
515  if( GetLayer() == LAYER_BUS )
516  {
517  item->m_Type = NET_BUS;
518  }
519  else /* WIRE */
520  {
521  item->m_Type = NET_SEGMENT;
522  }
523 
524  aNetListItems.push_back( item );
525 }
526 
527 
528 bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
529 {
530  if( Type() != aItem.Type() )
531  return Type() < aItem.Type();
532 
533  SCH_LINE* line = (SCH_LINE*) &aItem;
534 
535  if( GetLength() != line->GetLength() )
536  return GetLength() < line->GetLength();
537 
538  if( m_start.x != line->m_start.x )
539  return m_start.x < line->m_start.x;
540 
541  if( m_start.y != line->m_start.y )
542  return m_start.y < line->m_start.y;
543 
544  return false;
545 }
546 
547 
548 bool SCH_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
549 {
550  return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
551 }
552 
553 
554 bool SCH_LINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
555 {
556  if( m_Flags & ( STRUCT_DELETED | SKIP_STRUCT ) )
557  return false;
558 
559  EDA_RECT rect = aRect;
560 
561  if ( aAccuracy )
562  rect.Inflate( aAccuracy );
563 
564  if( aContained )
565  return rect.Contains( m_start ) && rect.Contains( m_end );
566 
567  return rect.Intersects( m_start, m_end );
568 }
569 
570 
571 bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
572 {
573  if( m_Layer != LAYER_WIRE && m_Layer != LAYER_BUS )
574  return false;
575 
576  return IsEndPoint( aPosition );
577 }
578 
579 
580 void SCH_LINE::Plot( PLOTTER* aPlotter )
581 {
582  aPlotter->SetColor( GetLayerColor( GetLayer() ) );
583  aPlotter->SetCurrentLineWidth( GetPenSize() );
584 
585  if( m_Layer == LAYER_NOTES )
586  aPlotter->SetDash( true );
587 
588  aPlotter->MoveTo( m_start );
589  aPlotter->FinishTo( m_end );
590 
591  if( m_Layer == LAYER_NOTES )
592  aPlotter->SetDash( false );
593 }
594 
595 
596 void SCH_LINE::SetPosition( const wxPoint& aPosition )
597 {
598  m_end = m_end - ( m_start - aPosition );
599  m_start = aPosition;
600 }
void Rotate(wxPoint aPosition) override
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_line.cpp:263
void GetConnectionPoints(std::vector< wxPoint > &aPoints) const override
Function GetConnectionPoints add all the connection points for this item to aPoints.
Definition: sch_line.cpp:446
void FinishTo(const wxPoint &pos)
Definition: plot_common.h:241
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
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Function GetEndPoints adds the schematic item end points to aItemList if the item has end points...
Definition: sch_line.cpp:354
SCH_LAYER_ID m_Layer
void SetModified()
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_line.h:59
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB...
Definition: trigo.h:183
bool IsSelectStateChanged(const wxRect &aRect) override
Function IsSelectStateChanged checks if the selection state of an item inside aRect has changed...
Definition: sch_line.cpp:409
virtual unsigned LineNumber() const
Function Line Number returns the line number of the last line read from this LINE_READER.
Definition: richio.h:159
PNG memory record (file in memory).
Definition: bitmap_types.h:38
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
Implementation of conversion functions that require both schematic and board internal units...
SCH_SHEET_PATH m_SheetPathInclude
virtual void SetColor(COLOR4D color)=0
bool Contains(const wxPoint &aPoint) const
Function Contains.
bool m_endIsDangling
True if end point is not connected.
Definition: sch_line.h:45
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:138
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
void Plot(PLOTTER *aPlotter) override
Function Plot plots the schematic item to aPlotter.
Definition: sch_line.cpp:580
bool IsSelected() const
Definition: base_struct.h:235
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
SCH_SHEET_PATH m_SheetPath
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
NETLIST_ITEM_T m_Type
int GetState(int type) const
Definition: base_struct.h:251
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
Definition: sch_line.cpp:82
This file contains miscellaneous commonly used macros and functions.
Class NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected item...
bool MergeOverlap(SCH_LINE *aLine)
Check line against aLine to see if it overlaps and merge if it does.
Definition: sch_line.cpp:274
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
#define SELECTED
Definition: base_struct.h:134
bool IsConnectable() const override
Function IsConnectable returns true if the schematic item can connect to another schematic item...
Definition: sch_line.cpp:437
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...
Definition: sch_line.cpp:548
virtual void SetDash(bool dashed)=0
void MirrorX(int aXaxis_position) override
Function MirrorX mirrors item relative to the X axis about aXaxis_position.
Definition: sch_line.cpp:249
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: sch_line.cpp:490
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
bool m_startIsDangling
True if start point is not connected.
Definition: sch_line.h:44
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:136
EDA_RECT * GetClipBox()
Common plot library Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF) ...
Class SCH_SHEET_PATH.
bool doIsConnected(const wxPoint &aPosition) const override
Function doIsConnected provides the object specific test to see if it is connected to aPosition...
Definition: sch_line.cpp:571
wxPoint m_end
Line end point.
Definition: sch_line.h:47
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_line.cpp:453
void MoveTo(const wxPoint &pos)
Definition: plot_common.h:231
Definition of the NETLIST_OBJECT class.
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:64
Base plotter engine class.
Definition: plot_common.h:86
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
void GRDashedLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:374
virtual char * ReadLine()=0
Function ReadLine reads a line of text into the buffer and increments the line number counter...
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
Class SCH_LINE is a segment description base class to describe items which have 2 end points (track...
Definition: sch_line.h:42
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_line.cpp:76
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_line.cpp:528
#define max(a, b)
Definition: auxiliary.h:86
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define ENDPOINT
Definition: base_struct.h:133
Class EDA_RECT handles the component boundary box.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
bool Load(LINE_READER &aLine, wxString &aErrorMsg) override
Function Load reads a schematic item from aLine in a .sch file.
Definition: sch_line.cpp:166
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void MirrorY(int aYaxis_position) override
Function MirrorY mirrors item relative to the Y axis about aYaxis_position.
Definition: sch_line.cpp:256
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_line.cpp:204
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_line.cpp:115
Class DANGLING_END_ITEM is a helper class used to store the state of schematic items that can be conn...
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
Definition: sch_line.cpp:214
void DrawDanglingSymbol(EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &pos, COLOR4D Color)
Definition: eeredraw.cpp:37
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 SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
Definition: sch_line.cpp:596
double GetLength() const
Function GetLength.
Definition: sch_line.cpp:132
bool Save(FILE *aFile) const override
Function Save writes the data structures for this object out to a FILE in "*.sch" format...
Definition: sch_line.cpp:138
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
int GetDefaultBusThickness()
Default line thickness used to draw/plot busses.
wxPoint m_start
Line start point.
Definition: sch_line.h:46
SCH_LINE(const wxPoint &pos=wxPoint(0, 0), int layer=LAYER_NOTES)
Definition: sch_line.cpp:43
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
#define STARTPOINT
Definition: base_struct.h:132
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
void GetNetListItem(NETLIST_OBJECT_LIST &aNetListItems, SCH_SHEET_PATH *aSheetPath) override
Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetList...
Definition: sch_line.cpp:501
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool IsDanglingStateChanged(std::vector< DANGLING_END_ITEM > &aItemList) override
Function IsDanglingStateChanged tests the schematic item to aItemList to check if it's dangling state...
Definition: sch_line.cpp:372