KiCad PCB EDA Suite
sch_bus_entry.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) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2021 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 
25 #include <sch_draw_panel.h>
26 #include <bitmaps.h>
27 #include <core/mirror.h>
28 #include <schematic.h>
29 #include <sch_bus_entry.h>
30 #include <sch_edit_frame.h>
31 #include <sch_junction.h>
32 #include <sch_line.h>
33 #include <sch_text.h>
35 #include <netclass.h>
36 #include <trigo.h>
37 #include <board_item.h>
38 #include "sch_painter.h"
39 
40 
41 SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, bool aFlipY ) :
42  SCH_ITEM( nullptr, aType )
43 {
44  m_pos = pos;
45  m_size.x = Mils2iu( DEFAULT_SCH_ENTRY_SIZE );
46  m_size.y = Mils2iu( DEFAULT_SCH_ENTRY_SIZE );
47 
48  m_stroke.SetWidth( 0 );
50  m_stroke.SetColor( COLOR4D::UNSPECIFIED );
51 
52  if( aFlipY )
53  m_size.y *= -1;
54 
56 }
57 
58 
59 SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, bool aFlipY ) :
61 {
63  m_connected_bus_item = nullptr;
64 }
65 
66 
67 SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, int aQuadrant ) :
69 {
70  switch( aQuadrant )
71  {
72  case 1: m_size.x *= 1; m_size.y *= -1; break;
73  case 2: m_size.x *= 1; m_size.y *= 1; break;
74  case 3: m_size.x *= -1; m_size.y *= 1; break;
75  case 4: m_size.x *= -1; m_size.y *= -1; break;
76  default: wxFAIL_MSG( "SCH_BUS_WIRE_ENTRY ctor: unexpected quadrant" );
77  }
78 
80  m_connected_bus_item = nullptr;
81 }
82 
83 
84 SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const wxPoint& pos, bool aFlipY ) :
86 {
88  m_connected_bus_items[0] = nullptr;
89  m_connected_bus_items[1] = nullptr;
90 }
91 
92 
94 {
95  return new SCH_BUS_WIRE_ENTRY( *this );
96 }
97 
98 
100 {
101  return new SCH_BUS_BUS_ENTRY( *this );
102 }
103 
104 
105 bool SCH_BUS_ENTRY_BASE::doIsConnected( const wxPoint& aPosition ) const
106 {
107  return ( m_pos == aPosition || GetEnd() == aPosition );
108 }
109 
110 
112 {
113  return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y );
114 }
115 
116 
118 {
119  SCH_BUS_ENTRY_BASE* item = dynamic_cast<SCH_BUS_ENTRY_BASE*>( aItem );
120  wxCHECK_RET( item, wxT( "Cannot swap bus entry data with invalid item." ) );
121 
122  std::swap( m_pos, item->m_pos );
123  std::swap( m_size, item->m_size );
124  std::swap( m_stroke, item->m_stroke );
125 }
126 
127 
128 void SCH_BUS_ENTRY_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
129 {
130  aCount = 2;
131  aLayers[0] = Type() == SCH_BUS_BUS_ENTRY_T ? LAYER_BUS : LAYER_WIRE;
132  aLayers[1] = LAYER_SELECTION_SHADOWS;
133 }
134 
135 
137 {
138  EDA_RECT box;
139 
140  box.SetOrigin( m_pos );
141  box.SetEnd( GetEnd() );
142 
143  box.Normalize();
144  box.Inflate( ( GetPenWidth() / 2 ) + 1 );
145 
146  return box;
147 }
148 
149 
151 {
152  NETCLASSPTR netclass = NetClass();
153 
154  if( netclass && netclass->GetSchematicColor() != COLOR4D::UNSPECIFIED )
155  return netclass->GetSchematicColor();
156 
157  return m_stroke.GetColor();
158 }
159 
160 
162 {
163  NETCLASSPTR netclass = NetClass();
164 
165  if( netclass )
166  return (PLOT_DASH_TYPE) netclass->GetLineStyle();
167 
168  return m_stroke.GetPlotStyle();
169 }
170 
171 
173 {
174  if( m_stroke.GetWidth() > 0 )
175  return m_stroke.GetWidth();
176 
177  NETCLASSPTR netclass = NetClass();
178 
179  if( netclass )
180  return netclass->GetWireWidth();
181 
182  if( Schematic() )
183  return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 );
184 
185  return DEFAULT_WIRE_THICKNESS;
186 }
187 
188 
190 {
191  if( m_stroke.GetWidth() > 0 )
192  return m_stroke.GetWidth();
193 
194  NETCLASSPTR netclass = NetClass();
195 
196  if( netclass )
197  return netclass->GetBusWidth();
198 
199  if( Schematic() )
200  return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 );
201 
202  return DEFAULT_BUS_THICKNESS;
203 }
204 
205 
206 void SCH_BUS_WIRE_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
207 {
208  DANGLING_END_ITEM item( WIRE_ENTRY_END, this, m_pos );
209  aItemList.push_back( item );
210 
211  DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, GetEnd() );
212  aItemList.push_back( item1 );
213 }
214 
215 
216 void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
217 {
218  DANGLING_END_ITEM item( BUS_ENTRY_END, this, m_pos );
219  aItemList.push_back( item );
220 
221  DANGLING_END_ITEM item1( BUS_ENTRY_END, this, GetEnd() );
222  aItemList.push_back( item1 );
223 }
224 
225 
226 void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
227 {
228  wxDC* DC = aSettings->GetPrintDC();
229  COLOR4D color = ( GetStrokeColor() == COLOR4D::UNSPECIFIED ) ?
230  aSettings->GetLayerColor( m_layer ) : GetStrokeColor();
231  wxPoint start = m_pos + aOffset;
232  wxPoint end = GetEnd() + aOffset;
233  int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
234 
236  {
237  GRLine( nullptr, DC, start.x, start.y, end.x, end.y, penWidth, color );
238  }
239  else
240  {
241  EDA_RECT clip( (wxPoint) start, wxSize( end.x - start.x, end.y - start.y ) );
242  clip.Normalize();
243 
244  double theta = atan2( end.y - start.y, end.x - start.x );
245  double strokes[] = { 1.0, DASH_GAP_LEN( penWidth ), 1.0, DASH_GAP_LEN( penWidth ) };
246 
247  switch( GetStrokeStyle() )
248  {
249  default:
251  strokes[0] = strokes[2] = DASH_MARK_LEN( penWidth );
252  break;
253  case PLOT_DASH_TYPE::DOT:
254  strokes[0] = strokes[2] = DOT_MARK_LEN( penWidth );
255  break;
257  strokes[0] = DASH_MARK_LEN( penWidth );
258  strokes[2] = DOT_MARK_LEN( penWidth );
259  break;
260  }
261 
262  for( size_t i = 0; i < 10000; ++i )
263  {
264  // Calculations MUST be done in doubles to keep from accumulating rounding
265  // errors as we go.
266  wxPoint next( start.x + strokes[ i % 4 ] * cos( theta ),
267  start.y + strokes[ i % 4 ] * sin( theta ) );
268 
269  // Drawing each segment can be done rounded to ints.
270  wxPoint segStart( KiROUND( start.x ), KiROUND( start.y ) );
271  wxPoint segEnd( KiROUND( next.x ), KiROUND( next.y ) );
272 
273  if( ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
274  break;
275  else if( i % 2 == 0 )
276  GRLine( nullptr, DC, segStart.x, segStart.y, segEnd.x, segEnd.y, penWidth, color );
277 
278  start = next;
279  }
280  }
281 }
282 
283 
285 {
286  MIRROR( m_pos.y, aCenter );
287  m_size.y = -m_size.y;
288 }
289 
290 
292 {
293  MIRROR( m_pos.x, aCenter );
294  m_size.x = -m_size.x;
295 }
296 
297 
298 void SCH_BUS_ENTRY_BASE::Rotate( const wxPoint& aCenter )
299 {
300  RotatePoint( &m_pos, aCenter, 900 );
301  RotatePoint( &m_size.x, &m_size.y, 900 );
302 }
303 
304 
305 bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
306  const SCH_SHEET_PATH* aPath )
307 {
308  bool previousStateStart = m_isDanglingStart;
309  bool previousStateEnd = m_isDanglingEnd;
310 
312 
313  // Wires and buses are stored in the list as a pair, start and end. This
314  // variable holds the start position from one iteration so it can be used
315  // when the end position is found.
316  wxPoint seg_start;
317 
318  // Store the connection type and state for the start (0) and end (1)
319  bool has_wire[2] = { false };
320  bool has_bus[2] = { false };
321 
322  for( const DANGLING_END_ITEM& each_item : aItemList )
323  {
324  if( each_item.GetItem() == this )
325  continue;
326 
327  switch( each_item.GetType() )
328  {
329  case WIRE_START_END:
330  case WIRE_END_END:
331  if( m_pos == each_item.GetPosition() )
332  has_wire[0] = true;
333  else if( GetEnd() == each_item.GetPosition() )
334  has_wire[1] = true;
335 
336  break;
337 
338  case BUS_START_END:
339  seg_start = each_item.GetPosition();
340  break;
341 
342  case BUS_END_END:
343  if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
344  has_bus[0] = true;
345  else if( IsPointOnSegment( seg_start, each_item.GetPosition(), GetEnd() ) )
346  has_bus[1] = true;
347 
348  break;
349 
350  default:
351  break;
352  }
353  }
354 
355  // A bus-wire entry is connected at both ends if it has a bus and a wire on its
356  // ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
357  if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
359  else if( has_wire[0] || has_bus[0] )
360  m_isDanglingStart = false;
361  else if( has_wire[1] || has_bus[1] )
362  m_isDanglingEnd = false;
363 
364  return (previousStateStart != m_isDanglingStart) || (previousStateEnd != m_isDanglingEnd);
365 }
366 
367 
368 bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
369  const SCH_SHEET_PATH* aPath )
370 {
371  bool previousStateStart = m_isDanglingStart;
372  bool previousStateEnd = m_isDanglingEnd;
373 
375 
376  // Wires and buses are stored in the list as a pair, start and end. This
377  // variable holds the start position from one iteration so it can be used
378  // when the end position is found.
379  wxPoint seg_start;
380 
381  for( const DANGLING_END_ITEM& each_item : aItemList )
382  {
383  if( each_item.GetItem() == this )
384  continue;
385 
386  switch( each_item.GetType() )
387  {
388  case BUS_START_END:
389  seg_start = each_item.GetPosition();
390  break;
391  case BUS_END_END:
392  if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
393  m_isDanglingStart = false;
394  if( IsPointOnSegment( seg_start, each_item.GetPosition(), GetEnd() ) )
395  m_isDanglingEnd = false;
396  break;
397  default:
398  break;
399  }
400  }
401 
402  return (previousStateStart != m_isDanglingStart) || (previousStateEnd != m_isDanglingEnd);
403 }
404 
405 
407 {
409 }
410 
411 
412 std::vector<wxPoint> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
413 {
414  return { m_pos, GetEnd() };
415 }
416 
417 
419 {
420  return wxString( _( "Bus to Wire Entry" ) );
421 }
422 
423 
425 {
426  return wxString( _( "Bus to Bus Entry" ) );
427 }
428 
429 
431 {
432  return BITMAPS::add_line2bus;
433 }
434 
435 
437 {
438  return BITMAPS::add_bus2bus;
439 }
440 
441 
442 bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
443 {
444  // Insure minimum accuracy
445  if( aAccuracy == 0 )
446  aAccuracy = ( GetPenWidth() / 2 ) + 4;
447 
448  return TestSegmentHit( aPosition, m_pos, GetEnd(), aAccuracy );
449 }
450 
451 
452 bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
453 {
454  EDA_RECT rect = aRect;
455 
456  rect.Inflate( aAccuracy );
457 
458  if( aContained )
459  return rect.Contains( GetBoundingBox() );
460 
461  return rect.Intersects( GetBoundingBox() );
462 }
463 
464 
465 void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) const
466 {
467  auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
468 
469  COLOR4D color = ( GetStrokeColor() == COLOR4D::UNSPECIFIED ) ?
470  settings->GetLayerColor( m_layer ) : GetStrokeColor();
471  int penWidth = ( GetPenWidth() == 0 ) ? settings->GetDefaultPenWidth() : GetPenWidth();
472 
473  penWidth = std::max( penWidth, settings->GetMinPenWidth() );
474 
475  aPlotter->SetCurrentLineWidth( penWidth );
476  aPlotter->SetColor( color );
477  aPlotter->SetDash( GetStrokeStyle() );
478  aPlotter->MoveTo( m_pos );
479  aPlotter->FinishTo( GetEnd() );
480 }
481 
482 
484 {
485  wxString msg;
486 
487  switch( GetLayer() )
488  {
489  default:
490  case LAYER_WIRE: msg = _( "Wire" ); break;
491  case LAYER_BUS: msg = _( "Bus" ); break;
492  }
493 
494  aList.push_back( MSG_PANEL_ITEM( _( "Bus Entry Type" ), msg ) );
495 
496  SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
497 
498  if( !frame )
499  return;
500 
501  if( SCH_CONNECTION* conn = Connection() )
502  conn->AppendInfoToMsgPanel( aList );
503 }
504 
505 
506 bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
507 {
508  if( Type() != aItem.Type() )
509  return Type() < aItem.Type();
510 
511  auto symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
512 
513  if( GetLayer() != symbol->GetLayer() )
514  return GetLayer() < symbol->GetLayer();
515 
516  if( GetPosition().x != symbol->GetPosition().x )
517  return GetPosition().x < symbol->GetPosition().x;
518 
519  if( GetPosition().y != symbol->GetPosition().y )
520  return GetPosition().y < symbol->GetPosition().y;
521 
522  if( GetEnd().x != symbol->GetEnd().x )
523  return GetEnd().x < symbol->GetEnd().x;
524 
525  return GetEnd().y < symbol->GetEnd().y;
526 }
527 
528 
530 {
531  // Don't generate connections between bus entries and buses, since there is
532  // a connectivity change at that point (e.g. A[7..0] to A7)
533  if( ( aItem->Type() == SCH_LINE_T ) &&
534  ( static_cast<const SCH_LINE*>( aItem )->GetLayer() == LAYER_BUS ) )
535  {
536  return false;
537  }
538 
539  // Same for bus junctions
540  if( ( aItem->Type() == SCH_JUNCTION_T ) &&
541  ( static_cast<const SCH_JUNCTION*>( aItem )->GetLayer() == LAYER_BUS_JUNCTION ) )
542  {
543  return false;
544  }
545 
546  // Don't generate connections between bus entries and bus labels that happen
547  // to land at the same point on the bus wire as this bus entry
548  if( ( aItem->Type() == SCH_LABEL_T ) &&
549  SCH_CONNECTION::IsBusLabel( static_cast<const SCH_LABEL*>( aItem )->GetText() ) )
550  {
551  return false;
552  }
553 
554  // Don't generate connections between two bus-wire entries
555  if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
556  return false;
557 
558  return true;
559 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:273
CITER next(CITER it)
Definition: ptree.cpp:126
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
void SetWidth(int aWidth)
Definition: sch_item.h:168
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
#define DEFAULT_SCH_ENTRY_SIZE
The default text size in mils. (can be changed in preference menu)
SCH_ITEM * m_connected_bus_item
Pointer to the bus item (usually a bus wire) connected to this bus-wire entry, if it is connected to ...
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
SCH_ITEM * m_connected_bus_items[2]
Pointer to the bus items (usually bus wires) connected to this bus-bus entry (either or both may be n...
SCH_BUS_BUS_ENTRY(const wxPoint &pos=wxPoint(0, 0), bool aFlipY=false)
static bool IsBusLabel(const wxString &aLabel)
Test if aLabel has a bus notation.
SCH_BUS_ENTRY_BASE(KICAD_T aType, const wxPoint &pos=wxPoint(0, 0), bool aFlipY=false)
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
int color
Definition: DXF_plotter.cpp:60
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
SCH_BUS_WIRE_ENTRY(const wxPoint &pos=wxPoint(0, 0), bool aFlipY=false)
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:42
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
#define DASH_MARK_LEN(aLineWidth)
Schematic editor (Eeschema) main window.
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
Definition: sch_item.h:171
wxPoint m_pos
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
wxSize m_size
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
The base class for create windows for drawing purpose.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
bool ClipLine(const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:131
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:42
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
PLOT_DASH_TYPE GetStrokeStyle() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
NETCLASSPTR NetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:145
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
SCH_LAYER_ID m_layer
Definition: sch_item.h:496
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool IsDangling() const override
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
void SetEnd(int x, int y)
Definition: eda_rect.h:182
#define DOT_MARK_LEN(aLineWidth)
bool m_isDanglingStart
PLOT_DASH_TYPE GetPlotStyle() const
Definition: sch_item.h:170
#define _(s)
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
wxDC * GetPrintDC() const
int GetWidth() const
Definition: sch_item.h:167
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
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:231
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
STROKE_PARAMS m_stroke
virtual int GetPenWidth() const
Definition: sch_item.h:289
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual void SetColor(const COLOR4D &color)=0
PLOT_DASH_TYPE
Dashed line types.
Definition: plotter.h:104
#define DEFAULT_BUS_THICKNESS
The default noconnect size in mils.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:272
void MoveTo(const wxPoint &pos)
Definition: plotter.h:263
EDA_UNITS
Definition: eda_units.h:38
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
Base plotter engine class.
Definition: plotter.h:121
COLOR4D GetColor() const
Definition: sch_item.h:173
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:156
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
int GetPenWidth() const override
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
#define DEFAULT_WIRE_THICKNESS
The default bus width in mils. (can be changed in preference menu)
Handle the component boundary box.
Definition: eda_rect.h:42
bool m_isDanglingEnd
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
#define DASH_GAP_LEN(aLineWidth)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
int GetDefaultPenWidth() const
void SetColor(const COLOR4D &aColor)
Definition: sch_item.h:174
COLOR4D GetStrokeColor() const
bool operator<(const SCH_ITEM &aItem) const override
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:87
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:53
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void SetDash(PLOT_DASH_TYPE dashed)=0
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
int GetPenWidth() const override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
wxPoint GetEnd() const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
wxPoint GetPosition() const override