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-2020 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( NULL, 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  if( aFlipY )
49  m_size.y *= -1;
50 
52 }
53 
54 
55 SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, bool aFlipY ) :
57 {
59  m_connected_bus_item = nullptr;
60 }
61 
62 
63 SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const wxPoint& pos, bool aFlipY ) :
65 {
67  m_connected_bus_items[0] = nullptr;
68  m_connected_bus_items[1] = nullptr;
69 }
70 
71 
73 {
74  return new SCH_BUS_WIRE_ENTRY( *this );
75 }
76 
77 
79 {
80  return new SCH_BUS_BUS_ENTRY( *this );
81 }
82 
83 
84 bool SCH_BUS_ENTRY_BASE::doIsConnected( const wxPoint& aPosition ) const
85 {
86  return ( m_pos == aPosition || GetEnd() == aPosition );
87 }
88 
89 
91 {
92  return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y );
93 }
94 
95 
97 {
98  SCH_BUS_ENTRY_BASE* item = dynamic_cast<SCH_BUS_ENTRY_BASE*>( aItem );
99  wxCHECK_RET( item, wxT( "Cannot swap bus entry data with invalid item." ) );
100 
101  std::swap( m_pos, item->m_pos );
102  std::swap( m_size, item->m_size );
103  std::swap( m_stroke, item->m_stroke );
104 }
105 
106 
107 void SCH_BUS_ENTRY_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
108 {
109  aCount = 2;
110  aLayers[0] = Type() == SCH_BUS_BUS_ENTRY_T ? LAYER_BUS : LAYER_WIRE;
111  aLayers[1] = LAYER_SELECTION_SHADOWS;
112 }
113 
114 
116 {
117  EDA_RECT box;
118 
119  box.SetOrigin( m_pos );
120  box.SetEnd( GetEnd() );
121 
122  box.Normalize();
123  box.Inflate( ( GetPenWidth() / 2 ) + 1 );
124 
125  return box;
126 }
127 
128 
130 {
131  NETCLASSPTR netclass = NetClass();
132 
133  if( netclass && netclass->GetSchematicColor() != COLOR4D::UNSPECIFIED )
134  return netclass->GetSchematicColor();
135 
136  return m_stroke.GetColor();
137 }
138 
139 
141 {
142  NETCLASSPTR netclass = NetClass();
143 
144  if( netclass )
145  return (PLOT_DASH_TYPE) netclass->GetLineStyle();
146 
147  return m_stroke.GetPlotStyle();
148 }
149 
150 
152 {
153  NETCLASSPTR netclass = NetClass();
154 
155  if( netclass )
156  return netclass->GetWireWidth();
157 
158  if( m_stroke.GetWidth() == 0 && Schematic() )
159  return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 );
160 
161  return ( m_stroke.GetWidth() == 0 ) ? 1 : m_stroke.GetWidth();
162 }
163 
164 
166 {
167  NETCLASSPTR netclass = NetClass();
168 
169  if( netclass )
170  return netclass->GetBusWidth();
171 
172  if( m_stroke.GetWidth() == 0 && Schematic() )
173  return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 );
174 
175  return ( m_stroke.GetWidth() == 0 ) ? 1 : m_stroke.GetWidth();
176 }
177 
178 
179 void SCH_BUS_WIRE_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
180 {
181  DANGLING_END_ITEM item( WIRE_ENTRY_END, this, m_pos );
182  aItemList.push_back( item );
183 
184  DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, GetEnd() );
185  aItemList.push_back( item1 );
186 }
187 
188 
189 void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
190 {
191  DANGLING_END_ITEM item( BUS_ENTRY_END, this, m_pos );
192  aItemList.push_back( item );
193 
194  DANGLING_END_ITEM item1( BUS_ENTRY_END, this, GetEnd() );
195  aItemList.push_back( item1 );
196 }
197 
198 
199 void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
200 {
201  wxDC* DC = aSettings->GetPrintDC();
202  COLOR4D color = ( GetStrokeColor() == COLOR4D::UNSPECIFIED ) ?
203  aSettings->GetLayerColor( m_layer ) : GetStrokeColor();
204  wxPoint start = m_pos + aOffset;
205  wxPoint end = GetEnd() + aOffset;
206  int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
207 
209  {
210  GRLine( nullptr, DC, start.x, start.y, end.x, end.y, penWidth, color );
211  }
212  else
213  {
214  EDA_RECT clip( (wxPoint) start, wxSize( end.x - start.x, end.y - start.y ) );
215  clip.Normalize();
216 
217  double theta = atan2( end.y - start.y, end.x - start.x );
218  double strokes[] = { 1.0, DASH_GAP_LEN( penWidth ), 1.0, DASH_GAP_LEN( penWidth ) };
219 
220  switch( GetStrokeStyle() )
221  {
222  default:
224  strokes[0] = strokes[2] = DASH_MARK_LEN( penWidth );
225  break;
226  case PLOT_DASH_TYPE::DOT:
227  strokes[0] = strokes[2] = DOT_MARK_LEN( penWidth );
228  break;
230  strokes[0] = DASH_MARK_LEN( penWidth );
231  strokes[2] = DOT_MARK_LEN( penWidth );
232  break;
233  }
234 
235  for( size_t i = 0; i < 10000; ++i )
236  {
237  // Calculations MUST be done in doubles to keep from accumulating rounding
238  // errors as we go.
239  wxPoint next( start.x + strokes[ i % 4 ] * cos( theta ),
240  start.y + strokes[ i % 4 ] * sin( theta ) );
241 
242  // Drawing each segment can be done rounded to ints.
243  wxPoint segStart( KiROUND( start.x ), KiROUND( start.y ) );
244  wxPoint segEnd( KiROUND( next.x ), KiROUND( next.y ) );
245 
246  if( ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
247  break;
248  else if( i % 2 == 0 )
249  GRLine( nullptr, DC, segStart.x, segStart.y, segEnd.x, segEnd.y, penWidth, color );
250 
251  start = next;
252  }
253  }
254 }
255 
256 
258 {
259  MIRROR( m_pos.y, aCenter );
260  m_size.y = -m_size.y;
261 }
262 
263 
265 {
266  MIRROR( m_pos.x, aCenter );
267  m_size.x = -m_size.x;
268 }
269 
270 
271 void SCH_BUS_ENTRY_BASE::Rotate( wxPoint aPosition )
272 {
273  RotatePoint( &m_pos, aPosition, 900 );
274  RotatePoint( &m_size.x, &m_size.y, 900 );
275 }
276 
277 
278 bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
279  const SCH_SHEET_PATH* aPath )
280 {
281  bool previousStateStart = m_isDanglingStart;
282  bool previousStateEnd = m_isDanglingEnd;
283 
285 
286  // Wires and buses are stored in the list as a pair, start and end. This
287  // variable holds the start position from one iteration so it can be used
288  // when the end position is found.
289  wxPoint seg_start;
290 
291  // Store the connection type and state for the start (0) and end (1)
292  bool has_wire[2] = { false };
293  bool has_bus[2] = { false };
294 
295  for( DANGLING_END_ITEM& each_item : aItemList )
296  {
297  if( each_item.GetItem() == this )
298  continue;
299 
300  switch( each_item.GetType() )
301  {
302  case WIRE_START_END:
303  case WIRE_END_END:
304  if( m_pos == each_item.GetPosition() )
305  has_wire[0] = true;
306  else if( GetEnd() == each_item.GetPosition() )
307  has_wire[1] = true;
308 
309  break;
310 
311  case BUS_START_END:
312  seg_start = each_item.GetPosition();
313  break;
314 
315  case BUS_END_END:
316  if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
317  has_bus[0] = true;
318  else if( IsPointOnSegment( seg_start, each_item.GetPosition(), GetEnd() ) )
319  has_bus[1] = true;
320 
321  break;
322 
323  default:
324  break;
325  }
326  }
327 
328  // A bus-wire entry is connected at both ends if it has a bus and a wire on its
329  // ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
330  if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
332  else if( has_wire[0] || has_bus[0] )
333  m_isDanglingStart = false;
334  else if( has_wire[1] || has_bus[1] )
335  m_isDanglingEnd = false;
336 
337  return (previousStateStart != m_isDanglingStart) || (previousStateEnd != m_isDanglingEnd);
338 }
339 
340 
341 bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
342  const SCH_SHEET_PATH* aPath )
343 {
344  bool previousStateStart = m_isDanglingStart;
345  bool previousStateEnd = m_isDanglingEnd;
346 
348 
349  // Wires and buses are stored in the list as a pair, start and end. This
350  // variable holds the start position from one iteration so it can be used
351  // when the end position is found.
352  wxPoint seg_start;
353 
354  for( DANGLING_END_ITEM& each_item : aItemList )
355  {
356  if( each_item.GetItem() == this )
357  continue;
358 
359  switch( each_item.GetType() )
360  {
361  case BUS_START_END:
362  seg_start = each_item.GetPosition();
363  break;
364  case BUS_END_END:
365  if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
366  m_isDanglingStart = false;
367  if( IsPointOnSegment( seg_start, each_item.GetPosition(), GetEnd() ) )
368  m_isDanglingEnd = false;
369  break;
370  default:
371  break;
372  }
373  }
374 
375  return (previousStateStart != m_isDanglingStart) || (previousStateEnd != m_isDanglingEnd);
376 }
377 
378 
380 {
382 }
383 
384 
385 std::vector<wxPoint> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
386 {
387  return { m_pos, GetEnd() };
388 }
389 
390 
392 {
393  return wxString( _( "Bus to Wire Entry" ) );
394 }
395 
396 
398 {
399  return wxString( _( "Bus to Bus Entry" ) );
400 }
401 
402 
404 {
405  return add_line2bus_xpm;
406 }
407 
408 
410 {
411  return add_bus2bus_xpm;
412 }
413 
414 
415 bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
416 {
417  // Insure minimum accuracy
418  if( aAccuracy == 0 )
419  aAccuracy = ( GetPenWidth() / 2 ) + 4;
420 
421  return TestSegmentHit( aPosition, m_pos, GetEnd(), aAccuracy );
422 }
423 
424 
425 bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
426 {
427  EDA_RECT rect = aRect;
428 
429  rect.Inflate( aAccuracy );
430 
431  if( aContained )
432  return rect.Contains( GetBoundingBox() );
433 
434  return rect.Intersects( GetBoundingBox() );
435 }
436 
437 
439 {
440  auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
441 
442  COLOR4D color = ( GetStrokeColor() == COLOR4D::UNSPECIFIED ) ?
443  settings->GetLayerColor( m_layer ) : GetStrokeColor();
444  int penWidth = ( GetPenWidth() == 0 ) ? settings->GetDefaultPenWidth() : GetPenWidth();
445 
446  penWidth = std::max( penWidth, settings->GetMinPenWidth() );
447 
448  aPlotter->SetCurrentLineWidth( penWidth );
449  aPlotter->SetColor( color );
450  aPlotter->SetDash( GetStrokeStyle() );
451  aPlotter->MoveTo( m_pos );
452  aPlotter->FinishTo( GetEnd() );
453 }
454 
455 
457 {
458  wxString msg;
459 
460  switch( GetLayer() )
461  {
462  default:
463  case LAYER_WIRE: msg = _( "Wire" ); break;
464  case LAYER_BUS: msg = _( "Bus" ); break;
465  }
466 
467  aList.push_back( MSG_PANEL_ITEM( _( "Bus Entry Type" ), msg ) );
468 
469  SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
470 
471  if( !frame )
472  return;
473 
474  if( SCH_CONNECTION* conn = Connection() )
475  conn->AppendInfoToMsgPanel( aList );
476 }
477 
478 
479 bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
480 {
481  if( Type() != aItem.Type() )
482  return Type() < aItem.Type();
483 
484  auto component = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
485 
486  if( GetLayer() != component->GetLayer() )
487  return GetLayer() < component->GetLayer();
488 
489  if( GetPosition().x != component->GetPosition().x )
490  return GetPosition().x < component->GetPosition().x;
491 
492  if( GetPosition().y != component->GetPosition().y )
493  return GetPosition().y < component->GetPosition().y;
494 
495  if( GetEnd().x != component->GetEnd().x )
496  return GetEnd().x < component->GetEnd().x;
497 
498  return GetEnd().y < component->GetEnd().y;
499 }
500 
501 
503 {
504  // Don't generate connections between bus entries and buses, since there is
505  // a connectivity change at that point (e.g. A[7..0] to A7)
506  if( ( aItem->Type() == SCH_LINE_T ) &&
507  ( static_cast<const SCH_LINE*>( aItem )->GetLayer() == LAYER_BUS ) )
508  {
509  return false;
510  }
511 
512  // Same for bus junctions
513  if( ( aItem->Type() == SCH_JUNCTION_T ) &&
514  ( static_cast<const SCH_JUNCTION*>( aItem )->GetLayer() == LAYER_BUS_JUNCTION ) )
515  {
516  return false;
517  }
518 
519  // Don't generate connections between bus entries and bus labels that happen
520  // to land at the same point on the bus wire as this bus entry
521  if( ( aItem->Type() == SCH_LABEL_T ) &&
522  SCH_CONNECTION::IsBusLabel( static_cast<const SCH_LABEL*>( aItem )->GetText() ) )
523  {
524  return false;
525  }
526 
527  // Don't generate connections between two bus-wire entries
528  if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
529  return false;
530 
531  return true;
532 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
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 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.
PNG memory record (file in memory).
Definition: bitmap_def.h:29
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...
const BITMAP_OPAQUE add_line2bus_xpm[1]
virtual void SetColor(COLOR4D color)=0
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)
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
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
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
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:126
#define DASH_MARK_LEN(aLineWidth)
Schematic editor (Eeschema) main window.
const BITMAP_OPAQUE add_bus2bus_xpm[1]
Definition: add_bus2bus.cpp:45
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.
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
Returns 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:201
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.
#define NULL
void SetEnd(int x, int y)
Definition: eda_rect.h:187
#define DOT_MARK_LEN(aLineWidth)
bool m_isDanglingStart
PLOT_DASH_TYPE GetPlotStyle() const
Definition: sch_item.h:174
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:171
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:228
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:304
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
PLOT_DASH_TYPE
Dashed line types.
Definition: plotter.h:104
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:287
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
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:177
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:155
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
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 _(s)
Definition: 3d_actions.cpp:33
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:68
#define DASH_GAP_LEN(aLineWidth)
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
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
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_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:54
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
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:363
int GetPenWidth() const override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
wxPoint GetEnd() const
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98
wxPoint GetPosition() const override