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 (C) 2004-2022 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>
34#include <sch_label.h>
38#include <netclass.h>
39#include <trigo.h>
40#include <board_item.h>
41#include <advanced_config.h>
42#include <connection_graph.h>
43#include "sch_painter.h"
44#include "plotters/plotter.h"
45
46
47SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool aFlipY ) :
48 SCH_ITEM( nullptr, aType )
49{
50 m_pos = pos;
53
54 m_stroke.SetWidth( 0 );
55 m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
56 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
57
58 if( aFlipY )
59 m_size.y *= -1;
60
62
64 m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
65 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
66}
67
68
71{
73 m_connected_bus_item = nullptr;
74
76 m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
77 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
78}
79
80
83{
84 switch( aQuadrant )
85 {
86 case 1: m_size.x *= 1; m_size.y *= -1; break;
87 case 2: m_size.x *= 1; m_size.y *= 1; break;
88 case 3: m_size.x *= -1; m_size.y *= 1; break;
89 case 4: m_size.x *= -1; m_size.y *= -1; break;
90 default: wxFAIL_MSG( wxS( "SCH_BUS_WIRE_ENTRY ctor: unexpected quadrant" ) );
91 }
92
94 m_connected_bus_item = nullptr;
95
97 m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
98 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
99}
100
101
104{
106 m_connected_bus_items[0] = nullptr;
107 m_connected_bus_items[1] = nullptr;
108
110 m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
111 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
112}
113
114
116{
117 return new SCH_BUS_WIRE_ENTRY( *this );
118}
119
120
122{
123 return new SCH_BUS_BUS_ENTRY( *this );
124}
125
126
127bool SCH_BUS_ENTRY_BASE::doIsConnected( const VECTOR2I& aPosition ) const
128{
129 return ( m_pos == aPosition || GetEnd() == aPosition );
130}
131
132
134{
135 return VECTOR2I( m_pos.x + m_size.x, m_pos.y + m_size.y );
136}
137
138
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
154void SCH_BUS_ENTRY_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
155{
156 aCount = 3;
157 aLayers[0] = LAYER_DANGLING;
158 aLayers[1] = Type() == SCH_BUS_BUS_ENTRY_T ? LAYER_BUS : LAYER_WIRE;
159 aLayers[2] = LAYER_SELECTION_SHADOWS;
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 m_stroke.SetColor( aColor );
196 m_lastResolvedColor = aColor;
197}
198
199
201{
202 if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
204 else if( IsConnectable() && !IsConnectivityDirty() )
206
208}
209
210
212{
213 m_stroke.SetPlotStyle( aStyle );
215}
216
217
219{
220 if( m_stroke.GetWidth() > 0 )
222 else if( IsConnectable() && !IsConnectivityDirty() )
223 m_lastResolvedWidth = GetEffectiveNetClass()->GetWireWidth();
224
225 return m_lastResolvedWidth;
226}
227
228
230{
231 if( m_stroke.GetWidth() > 0 )
233 else if( IsConnectable() && !IsConnectivityDirty() )
234 m_lastResolvedWidth = GetEffectiveNetClass()->GetBusWidth();
235
236 return m_lastResolvedWidth;
237}
238
239
240void SCH_BUS_WIRE_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
241{
243 aItemList.push_back( item );
244
245 DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, GetEnd() );
246 aItemList.push_back( item1 );
247}
248
249
250void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
251{
253 aItemList.push_back( item );
254
255 DANGLING_END_ITEM item1( BUS_ENTRY_END, this, GetEnd() );
256 aItemList.push_back( item1 );
257}
258
259
260void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
261{
262 wxDC* DC = aSettings->GetPrintDC();
263 COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED ) ?
264 aSettings->GetLayerColor( m_layer ) : GetBusEntryColor();
265 VECTOR2I start = m_pos + aOffset;
266 VECTOR2I end = GetEnd() + aOffset;
267 int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
268
269 if( GetLineStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
270 {
271 GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
272 }
273 else
274 {
275 SHAPE_SEGMENT segment( start, end );
276
277 STROKE_PARAMS::Stroke( &segment, GetLineStyle(), penWidth, aSettings,
278 [&]( const VECTOR2I& a, const VECTOR2I& b )
279 {
280 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
281 } );
282 }
283}
284
285
287{
288 MIRROR( m_pos.y, aCenter );
289 m_size.y = -m_size.y;
290}
291
292
294{
295 MIRROR( m_pos.x, aCenter );
296 m_size.x = -m_size.x;
297}
298
299
301{
302 RotatePoint( m_pos, aCenter, ANGLE_90 );
304}
305
306
307bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
308 const SCH_SHEET_PATH* aPath )
309{
310 bool previousStateStart = m_isDanglingStart;
311 bool previousStateEnd = m_isDanglingEnd;
312
314
315 // Store the connection type and state for the start (0) and end (1)
316 bool has_wire[2] = { false };
317 bool has_bus[2] = { false };
318
319 for( unsigned ii = 0; ii < aItemList.size(); ii++ )
320 {
321 DANGLING_END_ITEM& item = aItemList[ii];
322
323 if( item.GetItem() == this )
324 continue;
325
326 switch( item.GetType() )
327 {
328 case WIRE_END:
329 if( m_pos == item.GetPosition() )
330 has_wire[0] = true;
331 else if( GetEnd() == item.GetPosition() )
332 has_wire[1] = true;
333
334 break;
335
336 case BUS_END:
337 {
338 // The bus has created 2 DANGLING_END_ITEMs, one per end.
339 DANGLING_END_ITEM& nextItem = aItemList[++ii];
340
341 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
342 has_bus[0] = true;
343 else if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
344 has_bus[1] = true;
345 }
346 break;
347
348 default:
349 break;
350 }
351 }
352
353 // A bus-wire entry is connected at both ends if it has a bus and a wire on its
354 // ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
355 if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
357 else if( has_wire[0] || has_bus[0] )
358 m_isDanglingStart = false;
359 else if( has_wire[1] || has_bus[1] )
360 m_isDanglingEnd = false;
361
362 return (previousStateStart != m_isDanglingStart) || (previousStateEnd != m_isDanglingEnd);
363}
364
365
366bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
367 const SCH_SHEET_PATH* aPath )
368{
369 bool previousStateStart = m_isDanglingStart;
370 bool previousStateEnd = m_isDanglingEnd;
371
373
374 for( unsigned ii = 0; ii < aItemList.size(); ii++ )
375 {
376 DANGLING_END_ITEM& item = aItemList[ii];
377
378 if( item.GetItem() == this )
379 continue;
380
381 switch( item.GetType() )
382 {
383 case BUS_END:
384 {
385 // The bus has created 2 DANGLING_END_ITEMs, one per end.
386 DANGLING_END_ITEM& nextItem = aItemList[++ii];
387
388 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
389 m_isDanglingStart = false;
390 if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
391 m_isDanglingEnd = false;
392 }
393 break;
394
395 default:
396 break;
397 }
398 }
399
400 return (previousStateStart != m_isDanglingStart) || (previousStateEnd != m_isDanglingEnd);
401}
402
403
405{
407}
408
409
410std::vector<VECTOR2I> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
411{
412 return { m_pos, GetEnd() };
413}
414
415
417{
418 return wxString( _( "Bus to Wire Entry" ) );
419}
420
421
423{
424 return wxString( _( "Bus to Bus Entry" ) );
425}
426
427
429{
430 return BITMAPS::add_line2bus;
431}
432
433
435{
436 return BITMAPS::add_bus2bus;
437}
438
439
440bool SCH_BUS_ENTRY_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
441{
442 // Insure minimum accuracy
443 if( aAccuracy == 0 )
444 aAccuracy = ( GetPenWidth() / 2 ) + 4;
445
446 return TestSegmentHit( aPosition, m_pos, GetEnd(), aAccuracy );
447}
448
449
450bool SCH_BUS_ENTRY_BASE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
451{
452 BOX2I rect = aRect;
453
454 rect.Inflate( aAccuracy );
455
456 if( aContained )
457 return rect.Contains( GetBoundingBox() );
458
459 return rect.Intersects( GetBoundingBox() );
460}
461
462
463void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
464{
465 if( aBackground )
466 return;
467
468 auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
469
470 COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED )
471 ? settings->GetLayerColor( m_layer )
473
474 int penWidth = ( GetPenWidth() == 0 ) ? settings->GetDefaultPenWidth() : GetPenWidth();
475
476 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
477
478 aPlotter->SetCurrentLineWidth( penWidth );
479 aPlotter->SetColor( color );
480 aPlotter->SetDash( penWidth, GetLineStyle() );
481 aPlotter->MoveTo( m_pos );
482 aPlotter->FinishTo( GetEnd() );
483
484 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
485}
486
487
489 std::vector<MSG_PANEL_ITEM>& aList )
490{
491 wxString msg;
492
493 switch( GetLayer() )
494 {
495 default:
496 case LAYER_WIRE: msg = _( "Wire" ); break;
497 case LAYER_BUS: msg = _( "Bus" ); break;
498 }
499
500 aList.emplace_back( _( "Bus Entry Type" ), msg );
501
502 SCH_CONNECTION* conn = nullptr;
503
504 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
505 conn = Connection();
506
507 if( conn )
508 {
509 conn->AppendInfoToMsgPanel( aList );
510
511 if( !conn->IsBus() )
512 aList.emplace_back( _( "Resolved Netclass" ), GetEffectiveNetClass()->GetName() );
513 }
514}
515
516
517bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
518{
519 if( Type() != aItem.Type() )
520 return Type() < aItem.Type();
521
522 auto symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
523
524 if( GetLayer() != symbol->GetLayer() )
525 return GetLayer() < symbol->GetLayer();
526
527 if( GetPosition().x != symbol->GetPosition().x )
528 return GetPosition().x < symbol->GetPosition().x;
529
530 if( GetPosition().y != symbol->GetPosition().y )
531 return GetPosition().y < symbol->GetPosition().y;
532
533 if( GetEnd().x != symbol->GetEnd().x )
534 return GetEnd().x < symbol->GetEnd().x;
535
536 return GetEnd().y < symbol->GetEnd().y;
537}
538
539
541{
542 // Don't generate connections between bus entries and buses, since there is
543 // a connectivity change at that point (e.g. A[7..0] to A7)
544 if( ( aItem->Type() == SCH_LINE_T ) &&
545 ( static_cast<const SCH_LINE*>( aItem )->GetLayer() == LAYER_BUS ) )
546 {
547 return false;
548 }
549
550 // Same for bus junctions
551 if( ( aItem->Type() == SCH_JUNCTION_T ) &&
552 ( static_cast<const SCH_JUNCTION*>( aItem )->GetLayer() == LAYER_BUS_JUNCTION ) )
553 {
554 return false;
555 }
556
557 // Don't generate connections between bus entries and bus labels that happen
558 // to land at the same point on the bus wire as this bus entry
559 if( ( aItem->Type() == SCH_LABEL_T ) &&
560 SCH_CONNECTION::IsBusLabel( static_cast<const SCH_LABEL*>( aItem )->GetText() ) )
561 {
562 return false;
563 }
564
565 // Don't generate connections between two bus-wire entries
566 if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
567 return false;
568
569 return true;
570}
int color
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:255
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:82
DANGLING_END_T GetType() const
Definition: sch_item.h:126
EDA_ITEM * GetItem() const
Definition: sch_item.h:124
VECTOR2I GetPosition() const
Definition: sch_item.h:123
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:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
Store schematic specific render settings.
Definition: sch_painter.h:71
Base plotter engine class.
Definition: plotter.h:110
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle)=0
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void SetColor(const COLOR4D &color)=0
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.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
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.
SCH_BUS_BUS_ENTRY(const VECTOR2I &pos=VECTOR2I(0, 0), bool aFlipY=false)
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...
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:38
PLOT_DASH_TYPE GetLineStyle() const
VECTOR2I m_pos
bool m_isDanglingStart
COLOR4D GetBusEntryColor() const
bool m_isDanglingEnd
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)
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a schematic item.
VECTOR2I GetPosition() const override
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
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 MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
int m_lastResolvedWidth
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
bool IsConnectable() const override
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
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
void SetLineStyle(PLOT_DASH_TYPE aStyle)
SCH_BUS_ENTRY_BASE(KICAD_T aType, const VECTOR2I &pos=VECTOR2I(0, 0), bool aFlipY=false)
PLOT_DASH_TYPE m_lastResolvedLineStyle
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
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)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
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.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) 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.
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.
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:147
virtual int GetPenWidth() const
Definition: sch_item.h:266
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:174
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:249
bool IsConnectivityDirty() const
Definition: sch_item.h:416
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:147
SCH_LAYER_ID m_layer
Definition: sch_item.h:497
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
int GetWidth() const
Definition: stroke_params.h:98
void SetWidth(int aWidth)
Definition: stroke_params.h:99
void SetColor(const KIGFX::COLOR4D &aColor)
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
KIGFX::COLOR4D GetColor() const
PLOT_DASH_TYPE GetPlotStyle() const
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
#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:431
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
@ LAYER_DANGLING
Definition: layer_ids.h:372
@ LAYER_WIRE
Definition: layer_ids.h:348
@ LAYER_BUS
Definition: layer_ids.h:349
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:385
@ LAYER_BUS_JUNCTION
Definition: layer_ids.h:388
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
@ BUS_END
Definition: sch_item.h:66
@ BUS_ENTRY_END
Definition: sch_item.h:70
@ WIRE_END
Definition: sch_item.h:65
@ WIRE_ENTRY_END
Definition: sch_item.h:71
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
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:129
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
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:42
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LINE_T
Definition: typeinfo.h:136
@ SCH_LABEL_T
Definition: typeinfo.h:141
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:135
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:134
@ SCH_JUNCTION_T
Definition: typeinfo.h:132
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588