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>
31#include <sch_bus_entry.h>
32#include <sch_edit_frame.h>
33#include <sch_junction.h>
34#include <sch_line.h>
38#include <netclass.h>
39#include <trigo.h>
40#include <board_item.h>
41#include <connection_graph.h>
42#include "sch_painter.h"
43#include "plotters/plotter.h"
44#include <properties/property.h>
46
47
48SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool aFlipY ) :
49 SCH_ITEM( nullptr, aType )
50{
51 m_pos = pos;
54
55 m_stroke.SetWidth( 0 );
56 m_stroke.SetLineStyle( LINE_STYLE::DEFAULT );
58
59 if( aFlipY )
60 m_size.y *= -1;
61
63
67}
68
69
80
81
84{
85 switch( aQuadrant )
86 {
87 case 1: m_size.x *= 1; m_size.y *= -1; break;
88 case 2: m_size.x *= 1; m_size.y *= 1; break;
89 case 3: m_size.x *= -1; m_size.y *= 1; break;
90 case 4: m_size.x *= -1; m_size.y *= -1; break;
91 default: wxFAIL_MSG( wxS( "SCH_BUS_WIRE_ENTRY ctor: unexpected quadrant" ) );
92 }
93
95 m_connected_bus_item = nullptr;
96
100}
101
102
114
115
117{
118 return new SCH_BUS_WIRE_ENTRY( *this );
119}
120
121
123{
124 return new SCH_BUS_BUS_ENTRY( *this );
125}
126
127
128bool SCH_BUS_ENTRY_BASE::doIsConnected( const VECTOR2I& aPosition ) const
129{
130 return ( m_pos == aPosition || GetEnd() == aPosition );
131}
132
133
135{
136 return VECTOR2I( m_pos.x + m_size.x, m_pos.y + m_size.y );
137}
138
139
141{
142 SCH_BUS_ENTRY_BASE* item = dynamic_cast<SCH_BUS_ENTRY_BASE*>( aItem );
143 wxCHECK_RET( item, wxT( "Cannot swap bus entry data with invalid item." ) );
144
145 std::swap( m_pos, item->m_pos );
146 std::swap( m_size, item->m_size );
147 std::swap( m_stroke, item->m_stroke );
148
149 std::swap( m_lastResolvedWidth, item->m_lastResolvedWidth );
151 std::swap( m_lastResolvedColor, item->m_lastResolvedColor );
152}
153
154
162
163
165{
166 BOX2I bbox( m_pos );
167 bbox.SetEnd( GetEnd() );
168
169 bbox.Normalize();
170 bbox.Inflate( ( GetPenWidth() / 2 ) + 1 );
171
172 return bbox;
173}
174
175
185
186
188{
189 m_stroke.SetWidth( aWidth );
190 m_lastResolvedWidth = aWidth;
191}
192
193
195{
196 return m_lastResolvedWidth;
197}
198
199
201{
202 m_stroke.SetColor( aColor );
203 m_lastResolvedColor = aColor;
204}
205
206
216
217
219{
220 m_stroke.SetLineStyle( aStyle );
222}
223
224
226{
227 if( m_stroke.GetWidth() > 0 )
228 m_lastResolvedWidth = m_stroke.GetWidth();
229 else if( IsConnectable() && !IsConnectivityDirty() )
231
232 return m_lastResolvedWidth;
233}
234
235
237{
238 if( m_stroke.GetWidth() > 0 )
239 m_lastResolvedWidth = m_stroke.GetWidth();
240 else if( IsConnectable() && !IsConnectivityDirty() )
242
243 return m_lastResolvedWidth;
244}
245
246
247void SCH_BUS_WIRE_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
248{
250 aItemList.push_back( item );
251
252 DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, GetEnd() );
253 aItemList.push_back( item1 );
254}
255
256
257void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
258{
260 aItemList.push_back( item );
261
262 DANGLING_END_ITEM item1( BUS_ENTRY_END, this, GetEnd() );
263 aItemList.push_back( item1 );
264}
265
266
268{
269 MIRROR( m_pos.y, aCenter );
270 m_size.y = -m_size.y;
271}
272
273
275{
276 MIRROR( m_pos.x, aCenter );
277 m_size.x = -m_size.x;
278}
279
280
281void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
282{
283 RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
284 RotatePoint( &m_size.x, &m_size.y, aRotateCCW ? ANGLE_90 : ANGLE_270 );
285}
286
287
288bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
289 std::vector<DANGLING_END_ITEM>& aItemListByPos,
290 const SCH_SHEET_PATH* aPath )
291{
292 bool previousStateStart = m_isStartDangling;
293 bool previousStateEnd = m_isEndDangling;
294
296
297 // Store the connection type and state for the start (0) and end (1)
298 bool has_wire[2] = { false };
299 bool has_bus[2] = { false };
300
301 for( unsigned ii = 0; ii < aItemListByType.size(); ii++ )
302 {
303 DANGLING_END_ITEM& item = aItemListByType[ii];
304
305 if( item.GetItem() == this )
306 continue;
307
308 switch( item.GetType() )
309 {
310 case WIRE_END:
311 if( m_pos == item.GetPosition() )
312 has_wire[0] = true;
313 else if( GetEnd() == item.GetPosition() )
314 has_wire[1] = true;
315
316 break;
317
318 case BUS_END:
319 {
320 // The bus has created 2 DANGLING_END_ITEMs, one per end.
321 DANGLING_END_ITEM& nextItem = aItemListByType[++ii];
322
323 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
324 has_bus[0] = true;
325 else if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
326 has_bus[1] = true;
327 }
328 break;
329
330 default:
331 break;
332 }
333 }
334
335 // A bus-wire entry is connected at both ends if it has a bus and a wire on its
336 // ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
337 if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
339 else if( has_wire[0] || has_bus[0] )
340 m_isStartDangling = false;
341 else if( has_wire[1] || has_bus[1] )
342 m_isEndDangling = false;
343
344 return (previousStateStart != m_isStartDangling) || (previousStateEnd != m_isEndDangling);
345}
346
347
348bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
349 std::vector<DANGLING_END_ITEM>& aItemListByPos,
350 const SCH_SHEET_PATH* aPath )
351{
352 bool previousStateStart = m_isStartDangling;
353 bool previousStateEnd = m_isEndDangling;
354
356
357 // TODO: filter using get_lower as we only use one item type
358 for( unsigned ii = 0; ii < aItemListByType.size(); ii++ )
359 {
360 DANGLING_END_ITEM& item = aItemListByType[ii];
361
362 if( item.GetItem() == this )
363 continue;
364
365 switch( item.GetType() )
366 {
367 case BUS_END:
368 {
369 // The bus has created 2 DANGLING_END_ITEMs, one per end.
370 DANGLING_END_ITEM& nextItem = aItemListByType[++ii];
371
372 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
373 m_isStartDangling = false;
374
375 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
376 m_isEndDangling = false;
377 }
378 break;
379
380 default:
381 break;
382 }
383 }
384
385 return (previousStateStart != m_isStartDangling) || (previousStateEnd != m_isEndDangling);
386}
387
388
393
394
395std::vector<VECTOR2I> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
396{
397 return { m_pos, GetEnd() };
398}
399
400
402 const SCH_SHEET_PATH* aInstance ) const
403{
404 // Do not compare to ourselves.
405 if( aItem == this )
406 return false;
407
408 const SCH_BUS_ENTRY_BASE* busEntry = dynamic_cast<const SCH_BUS_ENTRY_BASE*>( aItem );
409
410 // Don't compare against a different SCH_ITEM.
411 wxCHECK( busEntry, false );
412
413 if( GetPosition() != busEntry->GetPosition() )
414 return true;
415
416 return GetEnd() != busEntry->GetEnd();
417}
418
419
420wxString SCH_BUS_WIRE_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
421{
422 return wxString( _( "Bus to wire entry" ) );
423}
424
425
426wxString SCH_BUS_BUS_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
427{
428 return wxString( _( "Bus to bus entry" ) );
429}
430
431
436
437
442
443
444bool SCH_BUS_ENTRY_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
445{
446 // Insure minimum accuracy
447 if( aAccuracy == 0 )
448 aAccuracy = ( GetPenWidth() / 2 ) + 4;
449
450 return TestSegmentHit( aPosition, m_pos, GetEnd(), aAccuracy );
451}
452
453
454bool SCH_BUS_ENTRY_BASE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
455{
456 BOX2I rect = aRect;
457
458 rect.Inflate( aAccuracy );
459
460 if( aContained )
461 return rect.Contains( GetBoundingBox() );
462
463 return rect.Intersects( GetBoundingBox() );
464}
465
466
467bool SCH_BUS_ENTRY_BASE::HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const
468{
470 return KIGEOM::ShapeHitTest( aPoly, line, aContained );
471}
472
473
474void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
475 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
476{
477 if( aBackground )
478 return;
479
480 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
481
483 ? renderSettings->GetLayerColor( m_layer ) : GetBusEntryColor();
484
485 if( color.m_text && Schematic() )
486 color = COLOR4D( ResolveText( *color.m_text, &Schematic()->CurrentSheet() ) );
487
488 int penWidth = ( GetPenWidth() == 0 ) ? renderSettings->GetDefaultPenWidth() : GetPenWidth();
489
490 penWidth = std::max( penWidth, renderSettings->GetMinPenWidth() );
491
492 aPlotter->SetCurrentLineWidth( penWidth );
493 aPlotter->SetColor( color );
494 aPlotter->SetDash( penWidth, GetEffectiveLineStyle() );
495 aPlotter->MoveTo( m_pos );
496 aPlotter->FinishTo( GetEnd() );
497
498 aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
499}
500
501
503 std::vector<MSG_PANEL_ITEM>& aList )
504{
505 wxString msg;
506
507 switch( GetLayer() )
508 {
509 default:
510 case LAYER_WIRE: msg = _( "Wire" ); break;
511 case LAYER_BUS: msg = _( "Bus" ); break;
512 }
513
514 aList.emplace_back( _( "Bus Entry Type" ), msg );
515
516 SCH_CONNECTION* conn = nullptr;
517
518 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
519 conn = Connection();
520
521 if( conn )
522 {
523 conn->AppendInfoToMsgPanel( aList );
524
525 if( !conn->IsBus() )
526 aList.emplace_back( _( "Resolved Netclass" ),
527 GetEffectiveNetClass()->GetHumanReadableName() );
528 }
529}
530
531
532bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
533{
534 if( Type() != aItem.Type() )
535 return Type() < aItem.Type();
536
537 auto symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
538
539 if( GetLayer() != symbol->GetLayer() )
540 return GetLayer() < symbol->GetLayer();
541
542 if( GetPosition().x != symbol->GetPosition().x )
543 return GetPosition().x < symbol->GetPosition().x;
544
545 if( GetPosition().y != symbol->GetPosition().y )
546 return GetPosition().y < symbol->GetPosition().y;
547
548 if( GetEnd().x != symbol->GetEnd().x )
549 return GetEnd().x < symbol->GetEnd().x;
550
551 return GetEnd().y < symbol->GetEnd().y;
552}
553
554
556{
557 // Don't generate connections between bus entries and buses, since there is
558 // a connectivity change at that point (e.g. A[7..0] to A7)
559 if( ( aItem->Type() == SCH_LINE_T ) &&
560 ( static_cast<const SCH_LINE*>( aItem )->GetLayer() == LAYER_BUS ) )
561 {
562 return false;
563 }
564
565 // Same for bus junctions
566 if( ( aItem->Type() == SCH_JUNCTION_T ) &&
567 ( static_cast<const SCH_JUNCTION*>( aItem )->GetLayer() == LAYER_BUS_JUNCTION ) )
568 {
569 return false;
570 }
571
572 // Don't generate connections between bus entries and bus labels that happen
573 // to land at the same point on the bus wire as this bus entry
574 if( ( aItem->Type() == SCH_LABEL_T ) &&
575 SCH_CONNECTION::IsBusLabel( static_cast<const SCH_LABEL*>( aItem )->GetText() ) )
576 {
577 return false;
578 }
579
580 // Don't generate connections between two bus-wire entries
581 if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
582 return false;
583
584 return true;
585}
586
587bool SCH_BUS_ENTRY_BASE::operator==( const SCH_ITEM& aItem ) const
588{
589 if( Type() != aItem.Type() )
590 return false;
591
592 const SCH_BUS_ENTRY_BASE* symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
593
594 if( GetLayer() != symbol->GetLayer() )
595 return false;
596
597 if( GetPosition() != symbol->GetPosition() )
598 return false;
599
600 if( GetEnd() != symbol->GetEnd() )
601 return false;
602
603 return true;
604}
605
606
607double SCH_BUS_ENTRY_BASE::Similarity( const SCH_ITEM& aItem ) const
608{
609 if( aItem.Type() != Type() )
610 return 0.0;
611
612 if( m_Uuid == aItem.m_Uuid )
613 return 1.0;
614
615 const SCH_BUS_ENTRY_BASE& other = static_cast<const SCH_BUS_ENTRY_BASE&>( aItem );
616
617 if( GetLayer() != other.GetLayer() )
618 return 0.0;
619
620 if( GetPosition() != other.GetPosition() )
621 return 0.0;
622
623 return 1.0;
624}
625
626
628{
630 {
638
640
641 if( wireLineStyleEnum.Choices().GetCount() == 0 )
642 {
643 wireLineStyleEnum.Map( WIRE_STYLE::DEFAULT, _HKI( "Default" ) )
644 .Map( WIRE_STYLE::SOLID, _HKI( "Solid" ) )
645 .Map( WIRE_STYLE::DASH, _HKI( "Dashed" ) )
646 .Map( WIRE_STYLE::DOT, _HKI( "Dotted" ) )
647 .Map( WIRE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
648 .Map( WIRE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
649 }
650
653
654 propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, int>( _HKI( "Line Width" ),
657
660 }
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:114
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
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
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:402
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.
const KIID m_Uuid
Definition eda_item.h:522
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:111
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:41
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:727
static ENUM_MAP< T > & Instance()
Definition property.h:721
wxPGChoices & Choices()
Definition property.h:770
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
std::shared_ptr< wxString > m_text
Definition color4d.h:399
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
int GetLineStyle() const
Definition netclass.h:234
int GetWireWidth() const
Definition netclass.h:204
COLOR4D GetSchematicColor(bool aIsForSave=false) const
Definition netclass.h:219
int GetBusWidth() const
Definition netclass.h:212
Base plotter engine class.
Definition plotter.h:136
void MoveTo(const VECTOR2I &pos)
Definition plotter.h:308
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
Definition plotter.h:318
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.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
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.
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)
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
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:727
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:254
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:509
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:341
bool IsConnectivityDirty() const
Definition sch_item.h:588
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:56
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:473
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:363
SCH_LAYER_ID m_layer
Definition sch_item.h:778
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...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
#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 _(s)
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:413
static constexpr EDA_ANGLE ANGLE_270
Definition eda_angle.h:416
a few functions useful in geometry calculations.
@ LAYER_WIRE
Definition layer_ids.h:452
@ LAYER_NET_COLOR_HIGHLIGHT
Definition layer_ids.h:493
@ LAYER_BUS
Definition layer_ids.h:453
@ LAYER_SELECTION_SHADOWS
Definition layer_ids.h:495
@ LAYER_BUS_JUNCTION
Definition layer_ids.h:498
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition mirror.h:45
bool ShapeHitTest(const SHAPE_LINE_CHAIN &aHitter, const SHAPE &aHittee, bool aHitteeContained)
Perform a shape-to-shape hit test.
#define _HKI(x)
Definition page_info.cpp:44
#define TYPE_HASH(x)
Definition property.h:74
@ PT_SIZE
Size expressed in distance units (mm/inch)
Definition property.h:63
#define REGISTER_TYPE(x)
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.
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:167
@ SCH_LABEL_T
Definition typeinfo.h:171
@ SCH_BUS_BUS_ENTRY_T
Definition typeinfo.h:166
@ SCH_BUS_WIRE_ENTRY_T
Definition typeinfo.h:165
@ SCH_JUNCTION_T
Definition typeinfo.h:163
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695