KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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>
30#include <sch_bus_entry.h>
31#include <sch_edit_frame.h>
32#include <sch_junction.h>
33#include <sch_line.h>
37#include <netclass.h>
38#include <trigo.h>
39#include <board_item.h>
40#include <connection_graph.h>
41#include "sch_painter.h"
42#include "plotters/plotter.h"
43
44
45SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool aFlipY ) :
46 SCH_ITEM( nullptr, aType )
47{
48 m_pos = pos;
51
52 m_stroke.SetWidth( 0 );
53 m_stroke.SetLineStyle( LINE_STYLE::DEFAULT );
54 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
55
56 if( aFlipY )
57 m_size.y *= -1;
58
60
62 m_lastResolvedLineStyle = LINE_STYLE::SOLID;
63 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
64}
65
66
69{
71 m_connected_bus_item = nullptr;
72
74 m_lastResolvedLineStyle = LINE_STYLE::SOLID;
75 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
76}
77
78
81{
82 switch( aQuadrant )
83 {
84 case 1: m_size.x *= 1; m_size.y *= -1; break;
85 case 2: m_size.x *= 1; m_size.y *= 1; break;
86 case 3: m_size.x *= -1; m_size.y *= 1; break;
87 case 4: m_size.x *= -1; m_size.y *= -1; break;
88 default: wxFAIL_MSG( wxS( "SCH_BUS_WIRE_ENTRY ctor: unexpected quadrant" ) );
89 }
90
92 m_connected_bus_item = nullptr;
93
95 m_lastResolvedLineStyle = LINE_STYLE::SOLID;
96 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
97}
98
99
102{
104 m_connected_bus_items[0] = nullptr;
105 m_connected_bus_items[1] = nullptr;
106
108 m_lastResolvedLineStyle = LINE_STYLE::SOLID;
109 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
110}
111
112
114{
115 return new SCH_BUS_WIRE_ENTRY( *this );
116}
117
118
120{
121 return new SCH_BUS_BUS_ENTRY( *this );
122}
123
124
125bool SCH_BUS_ENTRY_BASE::doIsConnected( const VECTOR2I& aPosition ) const
126{
127 return ( m_pos == aPosition || GetEnd() == aPosition );
128}
129
130
132{
133 return VECTOR2I( m_pos.x + m_size.x, m_pos.y + m_size.y );
134}
135
136
138{
139 SCH_BUS_ENTRY_BASE* item = dynamic_cast<SCH_BUS_ENTRY_BASE*>( aItem );
140 wxCHECK_RET( item, wxT( "Cannot swap bus entry data with invalid item." ) );
141
142 std::swap( m_pos, item->m_pos );
143 std::swap( m_size, item->m_size );
144 std::swap( m_stroke, item->m_stroke );
145
146 std::swap( m_lastResolvedWidth, item->m_lastResolvedWidth );
148 std::swap( m_lastResolvedColor, item->m_lastResolvedColor );
149}
150
151
152std::vector<int> SCH_BUS_ENTRY_BASE::ViewGetLayers() const
153{
154 if( Type() == SCH_BUS_BUS_ENTRY_T )
156
158}
159
160
162{
163 BOX2I bbox( m_pos );
164 bbox.SetEnd( GetEnd() );
165
166 bbox.Normalize();
167 bbox.Inflate( ( GetPenWidth() / 2 ) + 1 );
168
169 return bbox;
170}
171
172
174{
175 if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
177 else if( IsConnectable() && !IsConnectivityDirty() )
178 m_lastResolvedColor = GetEffectiveNetClass()->GetSchematicColor();
179
180 return m_lastResolvedColor;
181}
182
183
185{
186 m_stroke.SetWidth( aWidth );
187 m_lastResolvedWidth = aWidth;
188}
189
190
192{
193 return m_lastResolvedWidth;
194}
195
196
198{
199 m_stroke.SetColor( aColor );
200 m_lastResolvedColor = aColor;
201}
202
203
205{
206 if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
208 else if( IsConnectable() && !IsConnectivityDirty() )
210
212}
213
214
216{
217 m_stroke.SetLineStyle( aStyle );
219}
220
221
223{
224 if( m_stroke.GetWidth() > 0 )
226 else if( IsConnectable() && !IsConnectivityDirty() )
227 m_lastResolvedWidth = GetEffectiveNetClass()->GetWireWidth();
228
229 return m_lastResolvedWidth;
230}
231
232
234{
235 if( m_stroke.GetWidth() > 0 )
237 else if( IsConnectable() && !IsConnectivityDirty() )
238 m_lastResolvedWidth = GetEffectiveNetClass()->GetBusWidth();
239
240 return m_lastResolvedWidth;
241}
242
243
244void SCH_BUS_WIRE_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
245{
247 aItemList.push_back( item );
248
249 DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, GetEnd() );
250 aItemList.push_back( item1 );
251}
252
253
254void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
255{
257 aItemList.push_back( item );
258
259 DANGLING_END_ITEM item1( BUS_ENTRY_END, this, GetEnd() );
260 aItemList.push_back( item1 );
261}
262
263
265{
266 MIRROR( m_pos.y, aCenter );
267 m_size.y = -m_size.y;
268}
269
270
272{
273 MIRROR( m_pos.x, aCenter );
274 m_size.x = -m_size.x;
275}
276
277
278void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
279{
280 RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
281 RotatePoint( &m_size.x, &m_size.y, aRotateCCW ? ANGLE_90 : ANGLE_270 );
282}
283
284
285bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
286 std::vector<DANGLING_END_ITEM>& aItemListByPos,
287 const SCH_SHEET_PATH* aPath )
288{
289 bool previousStateStart = m_isStartDangling;
290 bool previousStateEnd = m_isEndDangling;
291
293
294 // Store the connection type and state for the start (0) and end (1)
295 bool has_wire[2] = { false };
296 bool has_bus[2] = { false };
297
298 for( unsigned ii = 0; ii < aItemListByType.size(); ii++ )
299 {
300 DANGLING_END_ITEM& item = aItemListByType[ii];
301
302 if( item.GetItem() == this )
303 continue;
304
305 switch( item.GetType() )
306 {
307 case WIRE_END:
308 if( m_pos == item.GetPosition() )
309 has_wire[0] = true;
310 else if( GetEnd() == item.GetPosition() )
311 has_wire[1] = true;
312
313 break;
314
315 case BUS_END:
316 {
317 // The bus has created 2 DANGLING_END_ITEMs, one per end.
318 DANGLING_END_ITEM& nextItem = aItemListByType[++ii];
319
320 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
321 has_bus[0] = true;
322 else if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
323 has_bus[1] = true;
324 }
325 break;
326
327 default:
328 break;
329 }
330 }
331
332 // A bus-wire entry is connected at both ends if it has a bus and a wire on its
333 // ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
334 if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
336 else if( has_wire[0] || has_bus[0] )
337 m_isStartDangling = false;
338 else if( has_wire[1] || has_bus[1] )
339 m_isEndDangling = false;
340
341 return (previousStateStart != m_isStartDangling) || (previousStateEnd != m_isEndDangling);
342}
343
344
345bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
346 std::vector<DANGLING_END_ITEM>& aItemListByPos,
347 const SCH_SHEET_PATH* aPath )
348{
349 bool previousStateStart = m_isStartDangling;
350 bool previousStateEnd = m_isEndDangling;
351
353
354 // TODO: filter using get_lower as we only use one item type
355 for( unsigned ii = 0; ii < aItemListByType.size(); ii++ )
356 {
357 DANGLING_END_ITEM& item = aItemListByType[ii];
358
359 if( item.GetItem() == this )
360 continue;
361
362 switch( item.GetType() )
363 {
364 case BUS_END:
365 {
366 // The bus has created 2 DANGLING_END_ITEMs, one per end.
367 DANGLING_END_ITEM& nextItem = aItemListByType[++ii];
368
369 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
370 m_isStartDangling = false;
371
372 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
373 m_isEndDangling = false;
374 }
375 break;
376
377 default:
378 break;
379 }
380 }
381
382 return (previousStateStart != m_isStartDangling) || (previousStateEnd != m_isEndDangling);
383}
384
385
387{
389}
390
391
392std::vector<VECTOR2I> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
393{
394 return { m_pos, GetEnd() };
395}
396
397
399 const SCH_SHEET_PATH* aInstance ) const
400{
401 // Do not compare to ourselves.
402 if( aItem == this )
403 return false;
404
405 const SCH_BUS_ENTRY_BASE* busEntry = dynamic_cast<const SCH_BUS_ENTRY_BASE*>( aItem );
406
407 // Don't compare against a different SCH_ITEM.
408 wxCHECK( busEntry, false );
409
410 if( GetPosition() != busEntry->GetPosition() )
411 return true;
412
413 return GetEnd() != busEntry->GetEnd();
414}
415
416
417wxString SCH_BUS_WIRE_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
418{
419 return wxString( _( "Bus to Wire Entry" ) );
420}
421
422
423wxString SCH_BUS_BUS_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
424{
425 return wxString( _( "Bus to Bus Entry" ) );
426}
427
428
430{
431 return BITMAPS::add_line2bus;
432}
433
434
436{
437 return BITMAPS::add_bus2bus;
438}
439
440
441bool SCH_BUS_ENTRY_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
442{
443 // Insure minimum accuracy
444 if( aAccuracy == 0 )
445 aAccuracy = ( GetPenWidth() / 2 ) + 4;
446
447 return TestSegmentHit( aPosition, m_pos, GetEnd(), aAccuracy );
448}
449
450
451bool SCH_BUS_ENTRY_BASE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
452{
453 BOX2I rect = aRect;
454
455 rect.Inflate( aAccuracy );
456
457 if( aContained )
458 return rect.Contains( GetBoundingBox() );
459
460 return rect.Intersects( GetBoundingBox() );
461}
462
463
464void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
465 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
466{
467 if( aBackground )
468 return;
469
470 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
471
472 COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED )
473 ? renderSettings->GetLayerColor( m_layer ) : GetBusEntryColor();
474
475 int penWidth = ( GetPenWidth() == 0 ) ? renderSettings->GetDefaultPenWidth() : GetPenWidth();
476
477 penWidth = std::max( penWidth, renderSettings->GetMinPenWidth() );
478
479 aPlotter->SetCurrentLineWidth( penWidth );
480 aPlotter->SetColor( color );
481 aPlotter->SetDash( penWidth, GetEffectiveLineStyle() );
482 aPlotter->MoveTo( m_pos );
483 aPlotter->FinishTo( GetEnd() );
484
485 aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
486}
487
488
490 std::vector<MSG_PANEL_ITEM>& aList )
491{
492 wxString msg;
493
494 switch( GetLayer() )
495 {
496 default:
497 case LAYER_WIRE: msg = _( "Wire" ); break;
498 case LAYER_BUS: msg = _( "Bus" ); break;
499 }
500
501 aList.emplace_back( _( "Bus Entry Type" ), msg );
502
503 SCH_CONNECTION* conn = nullptr;
504
505 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
506 conn = Connection();
507
508 if( conn )
509 {
510 conn->AppendInfoToMsgPanel( aList );
511
512 if( !conn->IsBus() )
513 aList.emplace_back( _( "Resolved Netclass" ),
514 GetEffectiveNetClass()->GetHumanReadableName() );
515 }
516}
517
518
519bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
520{
521 if( Type() != aItem.Type() )
522 return Type() < aItem.Type();
523
524 auto symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
525
526 if( GetLayer() != symbol->GetLayer() )
527 return GetLayer() < symbol->GetLayer();
528
529 if( GetPosition().x != symbol->GetPosition().x )
530 return GetPosition().x < symbol->GetPosition().x;
531
532 if( GetPosition().y != symbol->GetPosition().y )
533 return GetPosition().y < symbol->GetPosition().y;
534
535 if( GetEnd().x != symbol->GetEnd().x )
536 return GetEnd().x < symbol->GetEnd().x;
537
538 return GetEnd().y < symbol->GetEnd().y;
539}
540
541
543{
544 // Don't generate connections between bus entries and buses, since there is
545 // a connectivity change at that point (e.g. A[7..0] to A7)
546 if( ( aItem->Type() == SCH_LINE_T ) &&
547 ( static_cast<const SCH_LINE*>( aItem )->GetLayer() == LAYER_BUS ) )
548 {
549 return false;
550 }
551
552 // Same for bus junctions
553 if( ( aItem->Type() == SCH_JUNCTION_T ) &&
554 ( static_cast<const SCH_JUNCTION*>( aItem )->GetLayer() == LAYER_BUS_JUNCTION ) )
555 {
556 return false;
557 }
558
559 // Don't generate connections between bus entries and bus labels that happen
560 // to land at the same point on the bus wire as this bus entry
561 if( ( aItem->Type() == SCH_LABEL_T ) &&
562 SCH_CONNECTION::IsBusLabel( static_cast<const SCH_LABEL*>( aItem )->GetText() ) )
563 {
564 return false;
565 }
566
567 // Don't generate connections between two bus-wire entries
568 if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
569 return false;
570
571 return true;
572}
573
574bool SCH_BUS_ENTRY_BASE::operator==( const SCH_ITEM& aItem ) const
575{
576 if( Type() != aItem.Type() )
577 return false;
578
579 const SCH_BUS_ENTRY_BASE* symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
580
581 if( GetLayer() != symbol->GetLayer() )
582 return false;
583
584 if( GetPosition() != symbol->GetPosition() )
585 return false;
586
587 if( GetEnd() != symbol->GetEnd() )
588 return false;
589
590 return true;
591}
592
593
594double SCH_BUS_ENTRY_BASE::Similarity( const SCH_ITEM& aItem ) const
595{
596 if( aItem.Type() != Type() )
597 return 0.0;
598
599 if( m_Uuid == aItem.m_Uuid )
600 return 1.0;
601
602 const SCH_BUS_ENTRY_BASE& other = static_cast<const SCH_BUS_ENTRY_BASE&>( aItem );
603
604 if( GetLayer() != other.GetLayer() )
605 return 0.0;
606
607 if( GetPosition() != other.GetPosition() )
608 return 0.0;
609
610 return 1.0;
611}
612
613
615{
617 {
625
627
628 if( wireLineStyleEnum.Choices().GetCount() == 0 )
629 {
630 wireLineStyleEnum.Map( WIRE_STYLE::DEFAULT, _HKI( "Default" ) )
631 .Map( WIRE_STYLE::SOLID, _HKI( "Solid" ) )
632 .Map( WIRE_STYLE::DASH, _HKI( "Dashed" ) )
633 .Map( WIRE_STYLE::DOT, _HKI( "Dotted" ) )
634 .Map( WIRE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
635 .Map( WIRE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
636 }
637
639 WIRE_STYLE>( _HKI( "Line Style" ),
642
643 propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, int>( _HKI( "Line Width" ),
645 PROPERTY_DISPLAY::PT_SIZE ) );
646
650 }
int color
Definition: DXF_plotter.cpp:63
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:114
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:558
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:146
constexpr bool Contains(const Vec &aPoint) const
Definition: box2.h:168
constexpr void SetEnd(coord_type x, coord_type y)
Definition: box2.h:297
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:311
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:97
DANGLING_END_T GetType() const
Definition: sch_item.h:133
EDA_ITEM * GetItem() const
Definition: sch_item.h:131
VECTOR2I GetPosition() const
Definition: sch_item.h:130
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:97
const KIID m_Uuid
Definition: eda_item.h:502
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:109
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:97
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:687
static ENUM_MAP< T > & Instance()
Definition: property.h:681
wxPGChoices & Choices()
Definition: property.h:730
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
int GetDefaultPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
Base plotter engine class.
Definition: plotter.h:121
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:261
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:271
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void SetColor(const COLOR4D &color)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:85
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:87
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Class for a bus to bus entry.
int GetPenWidth() const override
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
SCH_BUS_BUS_ENTRY(const VECTOR2I &pos=VECTOR2I(0, 0), bool aFlipY=false)
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
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...
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:38
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
double Similarity(const SCH_ITEM &aItem) const override
Return a measure of how likely the other object is to represent the same object.
VECTOR2I m_pos
LINE_STYLE m_lastResolvedLineStyle
COLOR4D GetBusEntryColor() const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetBusEntryColor(const COLOR4D &aColor)
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
VECTOR2I GetPosition() const override
bool m_isEndDangling
void SetPenWidth(int aWidth)
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.
void SetWireStyle(WIRE_STYLE aStyle)
Definition: sch_bus_entry.h:90
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
bool operator==(const SCH_ITEM &aItem) const override
int m_lastResolvedWidth
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
void SetLineStyle(LINE_STYLE aStyle)
bool IsConnectable() const override
int GetPenWidth() const override
WIRE_STYLE GetWireStyle() const
Definition: sch_bus_entry.h:91
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
VECTOR2I GetEnd() const
bool IsDangling() const override
COLOR4D m_lastResolvedColor
STROKE_PARAMS m_stroke
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
VECTOR2I m_size
SCH_BUS_ENTRY_BASE(KICAD_T aType, const VECTOR2I &pos=VECTOR2I(0, 0), bool aFlipY=false)
LINE_STYLE GetEffectiveLineStyle() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
bool m_isStartDangling
bool operator<(const SCH_ITEM &aItem) const override
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Class for a wire to bus entry.
SCH_BUS_WIRE_ENTRY(const VECTOR2I &pos=VECTOR2I(0, 0), bool aFlipY=false)
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
int GetPenWidth() const override
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
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 ...
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
bool IsBus() const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
static bool IsBusLabel(const wxString &aLabel)
Test if aLabel has a bus notation.
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition: sch_item.h:685
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:347
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:309
bool IsConnectivityDirty() const
Definition: sch_item.h:555
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:318
SCH_LAYER_ID m_layer
Definition: sch_item.h:738
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:42
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
int GetWidth() const
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
void SetColor(const KIGFX::COLOR4D &aColor)
LINE_STYLE GetLineStyle() const
KIGFX::COLOR4D GetColor() const
#define DEFAULT_SCH_ENTRY_SIZE
The default text size in mils. (can be changed in preference menu)
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
#define _HKI(x)
#define _(s)
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:413
static constexpr EDA_ANGLE ANGLE_270
Definition: eda_angle.h:416
@ LAYER_WIRE
Definition: layer_ids.h:442
@ LAYER_NET_COLOR_HIGHLIGHT
Definition: layer_ids.h:483
@ LAYER_BUS
Definition: layer_ids.h:443
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:484
@ LAYER_BUS_JUNCTION
Definition: layer_ids.h:487
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:45
#define TYPE_HASH(x)
Definition: property.h:72
#define REGISTER_TYPE(x)
Definition: property_mgr.h:371
static struct SCH_BUS_ENTRY_DESC _SCH_BUS_ENTRY_DESC
@ BUS_END
Definition: sch_item.h:81
@ BUS_ENTRY_END
Definition: sch_item.h:85
@ WIRE_END
Definition: sch_item.h:80
@ WIRE_ENTRY_END
Definition: sch_item.h:86
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:46
WIRE_STYLE
Definition: stroke_params.h:68
constexpr int MilsToIU(int mils) const
Definition: base_units.h:97
SCH_BUS_ENTRY_DESC()
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:175
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition: trigo.cpp:229
bool IsPointOnSegment(const VECTOR2I &aSegStart, const VECTOR2I &aSegEnd, const VECTOR2I &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:89
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LINE_T
Definition: typeinfo.h:164
@ SCH_LABEL_T
Definition: typeinfo.h:168
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:163
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:162
@ SCH_JUNCTION_T
Definition: typeinfo.h:160
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695