KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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_ITEM::SwapFlags( aItem );
140
141 SCH_BUS_ENTRY_BASE* item = dynamic_cast<SCH_BUS_ENTRY_BASE*>( aItem );
142 wxCHECK_RET( item, wxT( "Cannot swap bus entry data with invalid item." ) );
143
144 std::swap( m_pos, item->m_pos );
145 std::swap( m_size, item->m_size );
146 std::swap( m_stroke, item->m_stroke );
147
148 std::swap( m_lastResolvedWidth, item->m_lastResolvedWidth );
150 std::swap( m_lastResolvedColor, item->m_lastResolvedColor );
151}
152
153
154std::vector<int> SCH_BUS_ENTRY_BASE::ViewGetLayers() const
155{
156 if( Type() == SCH_BUS_BUS_ENTRY_T )
158
160}
161
162
164{
165 BOX2I bbox( m_pos );
166 bbox.SetEnd( GetEnd() );
167
168 bbox.Normalize();
169 bbox.Inflate( ( GetPenWidth() / 2 ) + 1 );
170
171 return bbox;
172}
173
174
176{
177 if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
179 else if( IsConnectable() && !IsConnectivityDirty() )
180 m_lastResolvedColor = GetEffectiveNetClass()->GetSchematicColor();
181
182 return m_lastResolvedColor;
183}
184
185
187{
188 m_stroke.SetWidth( aWidth );
189 m_lastResolvedWidth = aWidth;
190}
191
192
194{
195 return m_lastResolvedWidth;
196}
197
198
200{
201 m_stroke.SetColor( aColor );
202 m_lastResolvedColor = aColor;
203}
204
205
207{
208 if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
210 else if( IsConnectable() && !IsConnectivityDirty() )
212
214}
215
216
218{
219 m_stroke.SetLineStyle( aStyle );
221}
222
223
225{
226 if( m_stroke.GetWidth() > 0 )
228 else if( IsConnectable() && !IsConnectivityDirty() )
229 m_lastResolvedWidth = GetEffectiveNetClass()->GetWireWidth();
230
231 return m_lastResolvedWidth;
232}
233
234
236{
237 if( m_stroke.GetWidth() > 0 )
239 else if( IsConnectable() && !IsConnectivityDirty() )
240 m_lastResolvedWidth = GetEffectiveNetClass()->GetBusWidth();
241
242 return m_lastResolvedWidth;
243}
244
245
246void SCH_BUS_WIRE_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
247{
249 aItemList.push_back( item );
250
251 DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, GetEnd() );
252 aItemList.push_back( item1 );
253}
254
255
256void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
257{
259 aItemList.push_back( item );
260
261 DANGLING_END_ITEM item1( BUS_ENTRY_END, this, GetEnd() );
262 aItemList.push_back( item1 );
263}
264
265
267{
268 MIRROR( m_pos.y, aCenter );
269 m_size.y = -m_size.y;
270}
271
272
274{
275 MIRROR( m_pos.x, aCenter );
276 m_size.x = -m_size.x;
277}
278
279
280void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
281{
282 RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
283 RotatePoint( &m_size.x, &m_size.y, aRotateCCW ? ANGLE_90 : ANGLE_270 );
284}
285
286
287bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
288 std::vector<DANGLING_END_ITEM>& aItemListByPos,
289 const SCH_SHEET_PATH* aPath )
290{
291 bool previousStateStart = m_isStartDangling;
292 bool previousStateEnd = m_isEndDangling;
293
295
296 // Store the connection type and state for the start (0) and end (1)
297 bool has_wire[2] = { false };
298 bool has_bus[2] = { false };
299
300 for( unsigned ii = 0; ii < aItemListByType.size(); ii++ )
301 {
302 DANGLING_END_ITEM& item = aItemListByType[ii];
303
304 if( item.GetItem() == this )
305 continue;
306
307 switch( item.GetType() )
308 {
309 case WIRE_END:
310 if( m_pos == item.GetPosition() )
311 has_wire[0] = true;
312 else if( GetEnd() == item.GetPosition() )
313 has_wire[1] = true;
314
315 break;
316
317 case BUS_END:
318 {
319 // The bus has created 2 DANGLING_END_ITEMs, one per end.
320 DANGLING_END_ITEM& nextItem = aItemListByType[++ii];
321
322 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
323 has_bus[0] = true;
324 else if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
325 has_bus[1] = true;
326 }
327 break;
328
329 default:
330 break;
331 }
332 }
333
334 // A bus-wire entry is connected at both ends if it has a bus and a wire on its
335 // ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
336 if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
338 else if( has_wire[0] || has_bus[0] )
339 m_isStartDangling = false;
340 else if( has_wire[1] || has_bus[1] )
341 m_isEndDangling = false;
342
343 return (previousStateStart != m_isStartDangling) || (previousStateEnd != m_isEndDangling);
344}
345
346
347bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
348 std::vector<DANGLING_END_ITEM>& aItemListByPos,
349 const SCH_SHEET_PATH* aPath )
350{
351 bool previousStateStart = m_isStartDangling;
352 bool previousStateEnd = m_isEndDangling;
353
355
356 // TODO: filter using get_lower as we only use one item type
357 for( unsigned ii = 0; ii < aItemListByType.size(); ii++ )
358 {
359 DANGLING_END_ITEM& item = aItemListByType[ii];
360
361 if( item.GetItem() == this )
362 continue;
363
364 switch( item.GetType() )
365 {
366 case BUS_END:
367 {
368 // The bus has created 2 DANGLING_END_ITEMs, one per end.
369 DANGLING_END_ITEM& nextItem = aItemListByType[++ii];
370
371 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
372 m_isStartDangling = false;
373
374 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
375 m_isEndDangling = false;
376 }
377 break;
378
379 default:
380 break;
381 }
382 }
383
384 return (previousStateStart != m_isStartDangling) || (previousStateEnd != m_isEndDangling);
385}
386
387
389{
391}
392
393
394std::vector<VECTOR2I> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
395{
396 return { m_pos, GetEnd() };
397}
398
399
401 const SCH_SHEET_PATH* aInstance ) const
402{
403 // Do not compare to ourselves.
404 if( aItem == this )
405 return false;
406
407 const SCH_BUS_ENTRY_BASE* busEntry = dynamic_cast<const SCH_BUS_ENTRY_BASE*>( aItem );
408
409 // Don't compare against a different SCH_ITEM.
410 wxCHECK( busEntry, false );
411
412 if( GetPosition() != busEntry->GetPosition() )
413 return true;
414
415 return GetEnd() != busEntry->GetEnd();
416}
417
418
419wxString SCH_BUS_WIRE_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
420{
421 return wxString( _( "Bus to Wire Entry" ) );
422}
423
424
425wxString SCH_BUS_BUS_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
426{
427 return wxString( _( "Bus to Bus Entry" ) );
428}
429
430
432{
433 return BITMAPS::add_line2bus;
434}
435
436
438{
439 return BITMAPS::add_bus2bus;
440}
441
442
443bool SCH_BUS_ENTRY_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
444{
445 // Insure minimum accuracy
446 if( aAccuracy == 0 )
447 aAccuracy = ( GetPenWidth() / 2 ) + 4;
448
449 return TestSegmentHit( aPosition, m_pos, GetEnd(), aAccuracy );
450}
451
452
453bool SCH_BUS_ENTRY_BASE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
454{
455 BOX2I rect = aRect;
456
457 rect.Inflate( aAccuracy );
458
459 if( aContained )
460 return rect.Contains( GetBoundingBox() );
461
462 return rect.Intersects( GetBoundingBox() );
463}
464
465
466void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
467 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
468{
469 if( aBackground )
470 return;
471
472 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
473
474 COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED )
475 ? renderSettings->GetLayerColor( m_layer ) : GetBusEntryColor();
476
477 int penWidth = ( GetPenWidth() == 0 ) ? renderSettings->GetDefaultPenWidth() : GetPenWidth();
478
479 penWidth = std::max( penWidth, renderSettings->GetMinPenWidth() );
480
481 aPlotter->SetCurrentLineWidth( penWidth );
482 aPlotter->SetColor( color );
483 aPlotter->SetDash( penWidth, GetEffectiveLineStyle() );
484 aPlotter->MoveTo( m_pos );
485 aPlotter->FinishTo( GetEnd() );
486
487 aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
488}
489
490
492 std::vector<MSG_PANEL_ITEM>& aList )
493{
494 wxString msg;
495
496 switch( GetLayer() )
497 {
498 default:
499 case LAYER_WIRE: msg = _( "Wire" ); break;
500 case LAYER_BUS: msg = _( "Bus" ); break;
501 }
502
503 aList.emplace_back( _( "Bus Entry Type" ), msg );
504
505 SCH_CONNECTION* conn = nullptr;
506
507 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
508 conn = Connection();
509
510 if( conn )
511 {
512 conn->AppendInfoToMsgPanel( aList );
513
514 if( !conn->IsBus() )
515 aList.emplace_back( _( "Resolved Netclass" ),
516 GetEffectiveNetClass()->GetHumanReadableName() );
517 }
518}
519
520
521bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
522{
523 if( Type() != aItem.Type() )
524 return Type() < aItem.Type();
525
526 auto symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
527
528 if( GetLayer() != symbol->GetLayer() )
529 return GetLayer() < symbol->GetLayer();
530
531 if( GetPosition().x != symbol->GetPosition().x )
532 return GetPosition().x < symbol->GetPosition().x;
533
534 if( GetPosition().y != symbol->GetPosition().y )
535 return GetPosition().y < symbol->GetPosition().y;
536
537 if( GetEnd().x != symbol->GetEnd().x )
538 return GetEnd().x < symbol->GetEnd().x;
539
540 return GetEnd().y < symbol->GetEnd().y;
541}
542
543
545{
546 // Don't generate connections between bus entries and buses, since there is
547 // a connectivity change at that point (e.g. A[7..0] to A7)
548 if( ( aItem->Type() == SCH_LINE_T ) &&
549 ( static_cast<const SCH_LINE*>( aItem )->GetLayer() == LAYER_BUS ) )
550 {
551 return false;
552 }
553
554 // Same for bus junctions
555 if( ( aItem->Type() == SCH_JUNCTION_T ) &&
556 ( static_cast<const SCH_JUNCTION*>( aItem )->GetLayer() == LAYER_BUS_JUNCTION ) )
557 {
558 return false;
559 }
560
561 // Don't generate connections between bus entries and bus labels that happen
562 // to land at the same point on the bus wire as this bus entry
563 if( ( aItem->Type() == SCH_LABEL_T ) &&
564 SCH_CONNECTION::IsBusLabel( static_cast<const SCH_LABEL*>( aItem )->GetText() ) )
565 {
566 return false;
567 }
568
569 // Don't generate connections between two bus-wire entries
570 if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
571 return false;
572
573 return true;
574}
575
576bool SCH_BUS_ENTRY_BASE::operator==( const SCH_ITEM& aItem ) const
577{
578 if( Type() != aItem.Type() )
579 return false;
580
581 const SCH_BUS_ENTRY_BASE* symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
582
583 if( GetLayer() != symbol->GetLayer() )
584 return false;
585
586 if( GetPosition() != symbol->GetPosition() )
587 return false;
588
589 if( GetEnd() != symbol->GetEnd() )
590 return false;
591
592 return true;
593}
594
595
596double SCH_BUS_ENTRY_BASE::Similarity( const SCH_ITEM& aItem ) const
597{
598 if( aItem.Type() != Type() )
599 return 0.0;
600
601 if( m_Uuid == aItem.m_Uuid )
602 return 1.0;
603
604 const SCH_BUS_ENTRY_BASE& other = static_cast<const SCH_BUS_ENTRY_BASE&>( aItem );
605
606 if( GetLayer() != other.GetLayer() )
607 return 0.0;
608
609 if( GetPosition() != other.GetPosition() )
610 return 0.0;
611
612 return 1.0;
613}
614
615
617{
619 {
627
629
630 if( wireLineStyleEnum.Choices().GetCount() == 0 )
631 {
632 wireLineStyleEnum.Map( WIRE_STYLE::DEFAULT, _HKI( "Default" ) )
633 .Map( WIRE_STYLE::SOLID, _HKI( "Solid" ) )
634 .Map( WIRE_STYLE::DASH, _HKI( "Dashed" ) )
635 .Map( WIRE_STYLE::DOT, _HKI( "Dotted" ) )
636 .Map( WIRE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
637 .Map( WIRE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
638 }
639
641 WIRE_STYLE>( _HKI( "Line Style" ),
644
645 propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, int>( _HKI( "Line Width" ),
647 PROPERTY_DISPLAY::PT_SIZE ) );
648
652 }
int color
Definition: DXF_plotter.cpp:60
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
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:96
DANGLING_END_T GetType() const
Definition: sch_item.h:132
EDA_ITEM * GetItem() const
Definition: sch_item.h:130
VECTOR2I GetPosition() const
Definition: sch_item.h:129
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:96
const KIID m_Uuid
Definition: eda_item.h:498
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:108
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:686
static ENUM_MAP< T > & Instance()
Definition: property.h:680
wxPGChoices & Choices()
Definition: property.h:729
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:105
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
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:167
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition: sch_item.h:653
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:248
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:291
bool IsConnectivityDirty() const
Definition: sch_item.h:523
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:371
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:219
SCH_LAYER_ID m_layer
Definition: sch_item.h:706
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:41
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:403
static constexpr EDA_ANGLE ANGLE_270
Definition: eda_angle.h:406
@ LAYER_WIRE
Definition: layer_ids.h:441
@ LAYER_NET_COLOR_HIGHLIGHT
Definition: layer_ids.h:482
@ LAYER_BUS
Definition: layer_ids.h:442
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:483
@ LAYER_BUS_JUNCTION
Definition: layer_ids.h:486
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:71
#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:80
@ BUS_ENTRY_END
Definition: sch_item.h:84
@ WIRE_END
Definition: sch_item.h:79
@ WIRE_ENTRY_END
Definition: sch_item.h:85
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:93
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:163
@ SCH_LABEL_T
Definition: typeinfo.h:167
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:162
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:161
@ SCH_JUNCTION_T
Definition: typeinfo.h:159
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695