KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_line.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) 2015 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, see <https://www.gnu.org/licenses/>.
19 */
20
22#include <base_units.h>
23#include <bitmaps.h>
24#include <string_utils.h>
25#include <core/mirror.h>
26#include <sch_painter.h>
27#include <sch_plotter.h>
32#include <sch_line.h>
33#include <eda_shape.h>
34#include <sch_edit_frame.h>
37#include <sch_netchain.h>
38#include <schematic.h>
41#include <trigo.h>
42#include <api/api_enums.h>
43#include <api/api_utils.h>
44#include <api/schematic/schematic_types.pb.h>
45#include <properties/property.h>
47#include <origin_transforms.h>
48#include <math/util.h>
49
50
51namespace
52{
53
54bool hasLineEnding( const SCH_LINE& aLine )
55{
58}
59
60
61EDA_SHAPE makeLineEndingShape( const SCH_LINE& aLine )
62{
64 shape.SetStart( aLine.GetStartPoint() );
65 shape.SetEnd( aLine.GetEndPoint() );
66 shape.SetStartEnding( aLine.GetStartEnding() );
67 shape.SetEndEnding( aLine.GetEndEnding() );
68
69 return shape;
70}
71
72} // namespace
73
74
75SCH_LINE::SCH_LINE( const VECTOR2I& pos, int layer ) :
76 SCH_ITEM( nullptr, SCH_LINE_T )
77{
78 m_start = pos;
79 m_end = pos;
80 m_stroke.SetWidth( 0 );
81 m_stroke.SetLineStyle( LINE_STYLE::DEFAULT );
83
84 switch( layer )
85 {
86 default: m_layer = LAYER_NOTES; break;
87 case LAYER_WIRE: m_layer = LAYER_WIRE; break;
88 case LAYER_BUS: m_layer = LAYER_BUS; break;
89 }
90
91 if( layer == LAYER_NOTES )
93 else
95
96 if( layer == LAYER_WIRE )
98 else if( layer == LAYER_BUS )
100 else
102
105}
106
107
109 SCH_ITEM( aLine )
110{
111 m_start = aLine.m_start;
112 m_end = aLine.m_end;
113 m_stroke = aLine.m_stroke;
116
120
123 m_endEnding = aLine.m_endEnding;
124
125 // Don't apply groups to cloned lines. We have too many areas where we clone them
126 // temporarily, then modify/split/join them in the line movement routines after the
127 // segments are committed. Rely on the commit framework to add the lines to the
128 // entered group as appropriate.
129 m_group = nullptr;
130}
131
132
133void SCH_LINE::Serialize( google::protobuf::Any &aContainer ) const
134{
135 using namespace kiapi::common;
136
137 kiapi::schematic::types::SchematicLine line;
138 types::StrokeAttributes* stroke = line.mutable_stroke();
139
140 line.mutable_id()->set_value( m_Uuid.AsStdString() );
141 PackVector2( *line.mutable_start(), GetStartPoint(), schIUScale );
142 PackVector2( *line.mutable_end(), GetEndPoint(), schIUScale );
143 line.set_locked( IsLocked() ? types::LockedState::LS_LOCKED : types::LockedState::LS_UNLOCKED );
144
145 PackDistance( *stroke->mutable_width(), m_stroke.GetWidth(), schIUScale );
146 stroke->set_style( ToProtoEnum<LINE_STYLE, types::StrokeLineStyle>( m_stroke.GetLineStyle() ) );
147
148 if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
149 PackColor( *stroke->mutable_color(), m_stroke.GetColor() );
150
151 switch( GetLayer() )
152 {
153 case LAYER_WIRE:
154 line.set_type( kiapi::schematic::types::SLT_WIRE );
155 break;
156
157 case LAYER_BUS:
158 line.set_type( kiapi::schematic::types::SLT_BUS );
159 break;
160
161 case LAYER_NOTES:
162 line.set_type( kiapi::schematic::types::SLT_GRAPHIC );
163 break;
164
165 default:
166 line.set_type( kiapi::schematic::types::SLT_UNKNOWN );
167 break;
168 }
169
170 if( GetStartEnding().GetStyle() != LINE_ENDING_STYLE::NONE )
171 PackLineEnding( *line.mutable_start_ending(), GetStartEnding(), schIUScale );
172
173 if( GetEndEnding().GetStyle() != LINE_ENDING_STYLE::NONE )
174 PackLineEnding( *line.mutable_end_ending(), GetEndEnding(), schIUScale );
175
176 kiapi::common::PackCustomProperties( line.mutable_custom_properties(), *this );
177
178 if( !aContainer.PackFrom( line ) )
179 wxFAIL_MSG( wxT( "Failed to pack SCH_LINE" ) );
180}
181
182
183bool SCH_LINE::Deserialize( const google::protobuf::Any &aContainer )
184{
185 using namespace kiapi::common;
186
187 kiapi::schematic::types::SchematicLine line;
188
189 if( !aContainer.UnpackTo( &line ) )
190 return false;
191
192 const_cast<KIID&>( m_Uuid ) = KIID( line.id().value() );
193 SetStartPoint( UnpackVector2( line.start(), schIUScale ) );
194 SetEndPoint( UnpackVector2( line.end(), schIUScale ) );
195 SetLocked( line.locked() == types::LockedState::LS_LOCKED );
196 kiapi::common::UnpackCustomProperties( line.custom_properties(), *this );
197
198 m_stroke.SetWidth( UnpackDistance( line.stroke().width(), schIUScale ) );
199 m_stroke.SetLineStyle( FromProtoEnum<LINE_STYLE, types::StrokeLineStyle>( line.stroke().style() ) );
200
201 if( line.stroke().has_color() )
202 m_stroke.SetColor( UnpackColor( line.stroke().color() ) );
203 else
204 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
205
206 switch( line.type() )
207 {
208 case kiapi::schematic::types::SLT_WIRE:
210 break;
211
212 case kiapi::schematic::types::SLT_BUS:
214 break;
215
216 default:
217 case kiapi::schematic::types::SLT_GRAPHIC:
219 break;
220 }
221
222 SetStartEnding( line.has_start_ending() ? UnpackLineEnding( line.start_ending(), schIUScale )
223 : LINE_ENDING() );
224
225 SetEndEnding( line.has_end_ending() ? UnpackLineEnding( line.end_ending(), schIUScale )
226 : LINE_ENDING() );
227
228 return true;
229}
230
231
233{
234 switch( GetLayer() )
235 {
236 case LAYER_WIRE: return _( "Wire" );
237 case LAYER_BUS: return _( "Bus" );
238 default: return _( "Graphic Line" );
239 }
240}
241
242
244{
245 return new SCH_LINE( *this );
246}
247
248
249void SCH_LINE::Move( const VECTOR2I& aOffset )
250{
251 m_start += aOffset;
252 m_end += aOffset;
253}
254
255
256void SCH_LINE::MoveStart( const VECTOR2I& aOffset )
257{
258 m_start += aOffset;
259}
260
261
262void SCH_LINE::MoveEnd( const VECTOR2I& aOffset )
263{
264 m_end += aOffset;
265}
266
267
268#if defined(DEBUG)
269
270void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
271{
272 NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
273 << " layer=\"" << m_layer << '"'
274 << " startIsDangling=\"" << m_startIsDangling
275 << '"' << " endIsDangling=\""
276 << m_endIsDangling << '"' << ">"
277 << " <start" << m_start << "/>"
278 << " <end" << m_end << "/>" << "</"
279 << GetClass().Lower().mb_str() << ">\n";
280}
281
282#endif
283
284
293
294
295double SCH_LINE::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
296{
297 if( aLayer == LAYER_OP_VOLTAGES )
298 {
299 // Nothing is drawn without a value, and a threshold per wire would redraw a kept canvas on every zoom
300 if( m_start == m_end || m_operatingPoint.IsEmpty() )
301 return LOD_HIDE;
302
303 const int height = std::abs( m_end.y - m_start.y );
304
305 // Operating points will be shown only if zoom is appropriate
306 if( height > 0 )
307 return lodScaleForThreshold( aView, height, schIUScale.mmToIU( 5 ) );
308
309 const int width = std::abs( m_end.x - m_start.x );
310 return lodScaleForThreshold( aView, width, schIUScale.mmToIU( 15 ) );
311 }
312
313 // Other layers are always drawn.
314 return LOD_SHOW;
315}
316
317
319{
320 int width = GetPenWidth() / 2;
321
322 int xmin = std::min( m_start.x, m_end.x ) - width;
323 int ymin = std::min( m_start.y, m_end.y ) - width;
324
325 int xmax = std::max( m_start.x, m_end.x ) + width + 1;
326 int ymax = std::max( m_start.y, m_end.y ) + width + 1;
327
328 BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );
329
330 if( IsGraphicLine() )
331 {
332 EDA_SHAPE tempShape = makeLineEndingShape( *this );
333 BOX2I endingsBBox;
334
335 if( tempShape.GetLineEndingsBoundingBox( endingsBBox, GetPenWidth() ) )
336 ret.Merge( endingsBBox );
337 }
338
339 return ret;
340}
341
342
344{
345 return m_start.Distance( m_end );
346}
347
348
349void SCH_LINE::SetLength( double aLength )
350{
351 if( aLength < 0.0 )
352 aLength = 0.0;
353
354 double currentLength = GetLength();
355 VECTOR2I start = GetStartPoint();
357
358 if( currentLength <= 0.0 )
359 {
360 end = start + KiROUND( aLength, 0.0 );
361 }
362 else
363 {
364 VECTOR2I delta = GetEndPoint() - start;
365 double scale = aLength / currentLength;
366
367 end = start + KiROUND( delta * scale );
368 }
369
370 SetEndPoint( end );
371}
372
373
374void SCH_LINE::SetLineColor( const COLOR4D& aColor )
375{
376 m_stroke.SetColor( aColor );
378}
379
380
381void SCH_LINE::SetLineColor( const double r, const double g, const double b, const double a )
382{
383 COLOR4D newColor(r, g, b, a);
384
385 if( newColor == COLOR4D::UNSPECIFIED )
386 {
387 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
388 }
389 else
390 {
391 // Eeschema does not allow alpha channel in colors
392 newColor.a = 1.0;
393 m_stroke.SetColor( newColor );
394 }
395}
396
397
409
410
412{
413 m_stroke.SetLineStyle( aStyle );
415}
416
417
419{
420 if( IsGraphicLine() && m_stroke.GetLineStyle() == LINE_STYLE::DEFAULT )
421 return LINE_STYLE::SOLID;
422 else
423 return m_stroke.GetLineStyle();
424}
425
426
438
439
440void SCH_LINE::SetLineWidth( const int aSize )
441{
442 m_stroke.SetWidth( aSize );
444}
445
446
448{
450
451 switch ( m_layer )
452 {
453 default:
454 if( m_stroke.GetWidth() > 0 )
455 return m_stroke.GetWidth();
456
457 if( schematic )
458 return schematic->Settings().m_DefaultLineWidth;
459
460 return schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
461
462 case LAYER_WIRE:
463 if( m_stroke.GetWidth() > 0 )
464 m_lastResolvedWidth = m_stroke.GetWidth();
465 else if( !IsConnectivityDirty() )
467
468 return m_lastResolvedWidth;
469
470 case LAYER_BUS:
471 if( m_stroke.GetWidth() > 0 )
472 m_lastResolvedWidth = m_stroke.GetWidth();
473 else if( !IsConnectivityDirty() )
475
476 return m_lastResolvedWidth;
477 }
478}
479
480
481void SCH_LINE::MirrorVertically( int aCenter )
482{
483 if( m_flags & STARTPOINT )
484 MIRROR( m_start.y, aCenter );
485
486 if( m_flags & ENDPOINT )
487 MIRROR( m_end.y, aCenter );
488}
489
490
492{
493 if( m_flags & STARTPOINT )
494 MIRROR( m_start.x, aCenter );
495
496 if( m_flags & ENDPOINT )
497 MIRROR( m_end.x, aCenter );
498}
499
500
501void SCH_LINE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
502{
503 if( m_flags & STARTPOINT )
504 RotatePoint( m_start, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
505
506 if( m_flags & ENDPOINT )
507 RotatePoint( m_end, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
508}
509
510
511int SCH_LINE::GetAngleFrom( const VECTOR2I& aPoint ) const
512{
513 VECTOR2I vec;
514
515 if( aPoint == m_start )
516 vec = m_end - aPoint;
517 else
518 vec = m_start - aPoint;
519
520 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
521}
522
523
524int SCH_LINE::GetReverseAngleFrom( const VECTOR2I& aPoint ) const
525{
526 VECTOR2I vec;
527
528 if( aPoint == m_end )
529 vec = m_start - aPoint;
530 else
531 vec = m_end - aPoint;
532
533 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
534}
535
536
537bool SCH_LINE::IsParallel( const SCH_LINE* aLine ) const
538{
539 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false,
540 wxT( "Cannot test line segment for overlap." ) );
541
542 VECTOR2I firstSeg = m_end - m_start;
543 VECTOR2I secondSeg = aLine->m_end - aLine->m_start;
544
545 // Use long long here to avoid overflow in calculations
546 return !( (long long) firstSeg.x * secondSeg.y - (long long) firstSeg.y * secondSeg.x );
547}
548
549
550SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCheckJunctions )
551{
552 auto less =
553 []( const VECTOR2I& lhs, const VECTOR2I& rhs ) -> bool
554 {
555 if( lhs.x == rhs.x )
556 return lhs.y < rhs.y;
557
558 return lhs.x < rhs.x;
559 };
560
561 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, nullptr,
562 wxT( "Cannot test line segment for overlap." ) );
563
564 if( this == aLine || GetLayer() != aLine->GetLayer() || GetStroke() != aLine->GetStroke() )
565 return nullptr;
566
567 VECTOR2I leftmost_start = aLine->m_start;
568 VECTOR2I leftmost_end = aLine->m_end;
569
570 VECTOR2I rightmost_start = m_start;
571 VECTOR2I rightmost_end = m_end;
572
573 // We place the start to the left and below the end of both lines
574 if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) )
575 std::swap( leftmost_start, leftmost_end );
576 if( rightmost_start != std::min( { rightmost_start, rightmost_end }, less ) )
577 std::swap( rightmost_start, rightmost_end );
578
579 // - leftmost is the line that starts farthest to the left
580 // - other is the line that is _not_ leftmost
581 // - rightmost is the line that ends farthest to the right. This may or may not be 'other'
582 // as the second line may be completely covered by the first.
583 if( less( rightmost_start, leftmost_start ) )
584 {
585 std::swap( leftmost_start, rightmost_start );
586 std::swap( leftmost_end, rightmost_end );
587 }
588
589 VECTOR2I other_start = rightmost_start;
590 VECTOR2I other_end = rightmost_end;
591
592 if( less( rightmost_end, leftmost_end ) )
593 {
594 rightmost_start = leftmost_start;
595 rightmost_end = leftmost_end;
596 }
597
598 // If we end one before the beginning of the other, no overlap is possible
599 if( less( leftmost_end, other_start ) )
600 {
601 return nullptr;
602 }
603
604 // Search for a common end:
605 if( ( leftmost_start == other_start ) && ( leftmost_end == other_end ) ) // Trivial case
606 {
607 SCH_LINE* ret = new SCH_LINE( *aLine );
608 ret->SetStartPoint( leftmost_start );
609 ret->SetEndPoint( leftmost_end );
610 // Only insertion should invalidate the screen; junction queries also merge temporary copies
611 ret->m_connectivity_dirty = true;
612
613 if( IsSelected() || aLine->IsSelected() )
614 ret->SetSelected();
615
616 return ret;
617 }
618
619 bool colinear = false;
620
621 /* Test alignment: */
622 if( ( leftmost_start.y == leftmost_end.y ) &&
623 ( other_start.y == other_end.y ) ) // Horizontal segment
624 {
625 colinear = ( leftmost_start.y == other_start.y );
626 }
627 else if( ( leftmost_start.x == leftmost_end.x ) &&
628 ( other_start.x == other_end.x ) ) // Vertical segment
629 {
630 colinear = ( leftmost_start.x == other_start.x );
631 }
632 else
633 {
634 // We use long long here to avoid overflow -- it enforces promotion
635 // The slope of the left-most line is dy/dx. Then we check that the slope from the
636 // left most start to the right most start is the same as well as the slope from the
637 // left most start to right most end.
638 long long dx = leftmost_end.x - leftmost_start.x;
639 long long dy = leftmost_end.y - leftmost_start.y;
640 colinear = ( ( ( other_start.y - leftmost_start.y ) * dx ==
641 ( other_start.x - leftmost_start.x ) * dy ) &&
642 ( ( other_end.y - leftmost_start.y ) * dx ==
643 ( other_end.x - leftmost_start.x ) * dy ) );
644 }
645
646 if( !colinear )
647 return nullptr;
648
649 // We either have a true overlap or colinear touching segments. We always want to merge
650 // the former, but the later only get merged if there no junction at the touch point.
651
652 bool touching = leftmost_end == rightmost_start;
653
654 if( touching && aCheckJunctions && aScreen->IsJunction( leftmost_end ) )
655 return nullptr;
656
657 // Make a new segment that merges the 2 segments
658 leftmost_end = rightmost_end;
659
660 SCH_LINE* ret = new SCH_LINE( *aLine );
661 ret->SetStartPoint( leftmost_start );
662 ret->SetEndPoint( leftmost_end );
663 // This result is not on the screen yet, even though its copy retains the parent
664 ret->m_connectivity_dirty = true;
665
666 if( IsSelected() || aLine->IsSelected() )
667 ret->SetSelected();
668
669 return ret;
670}
671
672
674{
675 SCH_LINE* newSegment = static_cast<SCH_LINE*>( Duplicate( true /* addToParentGroup */, aCommit ) );
676
677 newSegment->SetStartPoint( aPoint );
678 newSegment->SetConnectivityDirty( true );
679 SetEndPoint( aPoint );
680
681 return newSegment;
682}
683
684
686{
687 SCH_LINE* newSegment = static_cast<SCH_LINE*>( Duplicate( false /* addToParentGroup */, nullptr ) );
688
689 newSegment->SetStartPoint( aPoint );
690 newSegment->SetConnectivityDirty( true );
691 SetEndPoint( aPoint );
692
693 return newSegment;
694}
695
696
697void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
698{
699 if( IsConnectable() )
700 {
701 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_start );
702 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_end );
703 }
704}
705
706
707bool SCH_LINE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
708 std::vector<DANGLING_END_ITEM>& aItemListByPos,
709 const SCH_SHEET_PATH* aPath )
710{
711 if( !IsConnectable() )
712 return false;
713
714 bool previousStartState = m_startIsDangling;
715 bool previousEndState = m_endIsDangling;
716
718
719 for( auto it = DANGLING_END_ITEM_HELPER::get_lower_pos( aItemListByPos, m_start );
720 it < aItemListByPos.end() && it->GetPosition() == m_start; it++ )
721 {
722 DANGLING_END_ITEM& item = *it;
723
724 if( item.GetItem() == this )
725 continue;
726
727 if( ( IsWire() && item.GetType() != BUS_END && item.GetType() != BUS_ENTRY_END )
728 || ( IsBus() && item.GetType() != WIRE_END && item.GetType() != PIN_END ) )
729 {
730 m_startIsDangling = false;
731 break;
732 }
733 }
734
735 for( auto it = DANGLING_END_ITEM_HELPER::get_lower_pos( aItemListByPos, m_end );
736 it < aItemListByPos.end() && it->GetPosition() == m_end; it++ )
737 {
738 DANGLING_END_ITEM& item = *it;
739
740 if( item.GetItem() == this )
741 continue;
742
743 if( ( IsWire() && item.GetType() != BUS_END && item.GetType() != BUS_ENTRY_END )
744 || ( IsBus() && item.GetType() != WIRE_END && item.GetType() != PIN_END ) )
745 {
746 m_endIsDangling = false;
747 break;
748 }
749 }
750
751 // We only use the bus dangling state for automatic line starting, so we don't care if it
752 // has changed or not (and returning true will result in extra work)
753 if( IsBus() )
754 return false;
755
756 return previousStartState != m_startIsDangling || previousEndState != m_endIsDangling;
757}
758
759
761{
762 if( m_layer == LAYER_WIRE || m_layer == LAYER_BUS )
763 return true;
764
765 return false;
766}
767
768
769bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
770{
771 switch( aItem->Type() )
772 {
773 case SCH_NO_CONNECT_T:
774 case SCH_SYMBOL_T:
775 return IsWire();
776
777 case SCH_JUNCTION_T:
778 case SCH_LABEL_T:
780 case SCH_HIER_LABEL_T:
783 case SCH_SHEET_T:
784 case SCH_SHEET_PIN_T:
785 return IsWire() || IsBus();
786
787 default:
788 return m_layer == aItem->GetLayer();
789 }
790}
791
792
793bool SCH_LINE::HasConnectivityChanges( const SCH_ITEM* aItem, const SCH_SHEET_PATH* aInstance ) const
794{
795 // Do not compare to ourself.
796 if( aItem == this || !IsConnectable() )
797 return false;
798
799 const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( aItem );
800
801 // Don't compare against a different SCH_ITEM.
802 wxCHECK( line, false );
803
804 if( GetStartPoint() != line->GetStartPoint() )
805 return true;
806
807 return GetEndPoint() != line->GetEndPoint();
808}
809
810
811std::vector<VECTOR2I> SCH_LINE::GetConnectionPoints() const
812{
813 return { m_start, m_end };
814}
815
816
818{
819 switch( aItem->Type() )
820 {
821 case SCH_LINE_T:
822 return IsBus() == static_cast<const SCH_LINE*>( aItem )->IsBus();
823
824 default:
825 return true;
826 }
827}
828
829
830void SCH_LINE::GetSelectedPoints( std::vector<VECTOR2I>& aPoints ) const
831{
832 if( m_flags & STARTPOINT )
833 aPoints.push_back( m_start );
834
835 if( m_flags & ENDPOINT )
836 aPoints.push_back( m_end );
837}
838
839
840wxString SCH_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
841{
842 wxString txtfmt;
843
844 if( m_start.x == m_end.x )
845 {
846 switch( m_layer )
847 {
848 case LAYER_WIRE: txtfmt = _( "Vertical Wire, length %s" ); break;
849 case LAYER_BUS: txtfmt = _( "Vertical Bus, length %s" ); break;
850 default: txtfmt = _( "Vertical Graphic Line, length %s" ); break;
851 }
852 }
853 else if( m_start.y == m_end.y )
854 {
855 switch( m_layer )
856 {
857 case LAYER_WIRE: txtfmt = _( "Horizontal Wire, length %s" ); break;
858 case LAYER_BUS: txtfmt = _( "Horizontal Bus, length %s" ); break;
859 default: txtfmt = _( "Horizontal Graphic Line, length %s" ); break;
860 }
861 }
862 else
863 {
864 switch( m_layer )
865 {
866 case LAYER_WIRE: txtfmt = _( "Wire, length %s" ); break;
867 case LAYER_BUS: txtfmt = _( "Bus, length %s" ); break;
868 default: txtfmt = _( "Graphic Line, length %s" ); break;
869 }
870 }
871
872 return wxString::Format( txtfmt, aUnitsProvider->MessageTextFromValue( m_start.Distance( m_end ) ) );
873}
874
875
877{
878 if( m_layer == LAYER_NOTES )
880 else if( m_layer == LAYER_WIRE )
881 return BITMAPS::add_line;
882
883 return BITMAPS::add_bus;
884}
885
886
887bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
888{
889 if( Type() != aItem.Type() )
890 return Type() < aItem.Type();
891
892 const SCH_LINE* line = static_cast<const SCH_LINE*>( &aItem );
893
894 if( GetLayer() != line->GetLayer() )
895 return GetLayer() < line->GetLayer();
896
897 if( GetStartPoint().x != line->GetStartPoint().x )
898 return GetStartPoint().x < line->GetStartPoint().x;
899
900 if( GetStartPoint().y != line->GetStartPoint().y )
901 return GetStartPoint().y < line->GetStartPoint().y;
902
903 if( GetEndPoint().x != line->GetEndPoint().x )
904 return GetEndPoint().x < line->GetEndPoint().x;
905
906 return GetEndPoint().y < line->GetEndPoint().y;
907}
908
909
910bool SCH_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
911{
912 // Performance enhancement for connection-building
913 if( aPosition == m_start || aPosition == m_end )
914 return true;
915
916 if( IsGraphicLine() && hasLineEnding( *this ) )
917 {
918 EDA_SHAPE tempShape = makeLineEndingShape( *this );
920 const SHAPE& hitShape = shape;
921 int accuracy = aAccuracy >= 0 ? aAccuracy : abs( aAccuracy );
922
923 return hitShape.Collide( aPosition, accuracy );
924 }
925
926 if( aAccuracy >= 0 )
927 aAccuracy += GetPenWidth() / 2;
928 else
929 aAccuracy = abs( aAccuracy );
930
931 return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
932}
933
934
935bool SCH_LINE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
936{
938 return false;
939
940 BOX2I rect = aRect;
941
942 if ( aAccuracy )
943 rect.Inflate( aAccuracy );
944
945 if( IsGraphicLine() && hasLineEnding( *this ) )
946 {
947 EDA_SHAPE tempShape = makeLineEndingShape( *this );
950
951 return KIGEOM::ShapeHitTest( selection, shape, aContained );
952 }
953
954 if( aContained )
955 return rect.Contains( m_start ) && rect.Contains( m_end );
956
957 return rect.Intersects( m_start, m_end );
958}
959
960
961bool SCH_LINE::HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const
962{
964 return false;
965
966 if( IsGraphicLine() && hasLineEnding( *this ) )
967 {
968 EDA_SHAPE tempShape = makeLineEndingShape( *this );
970
971 return KIGEOM::ShapeHitTest( aPoly, shape, aContained );
972 }
973
975 return KIGEOM::ShapeHitTest( aPoly, line, aContained );
976}
977
978
980{
981 SCH_LINE* item = (SCH_LINE*) aItem;
982
983 std::swap( m_start, item->m_start );
984 std::swap( m_end, item->m_end );
985 std::swap( m_startIsDangling, item->m_startIsDangling );
986 std::swap( m_endIsDangling, item->m_endIsDangling );
987 std::swap( m_stroke, item->m_stroke );
988 std::swap( m_startEnding, item->m_startEnding );
989 std::swap( m_endEnding, item->m_endEnding );
990}
991
992
993bool SCH_LINE::doIsConnected( const VECTOR2I& aPosition ) const
994{
995 if( m_layer != LAYER_WIRE && m_layer != LAYER_BUS )
996 return false;
997
998 return IsEndPoint( aPosition );
999}
1000
1001
1002void SCH_LINE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
1003 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
1004{
1005 if( aBackground )
1006 return;
1007
1008 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
1009 int penWidth = GetEffectivePenWidth( renderSettings );
1010 COLOR4D color = GetLineColor();
1011
1012 if( color == COLOR4D::UNSPECIFIED )
1013 color = renderSettings->GetLayerColor( GetLayer() );
1014
1015 if( color.m_text && Schematic() )
1016 color = COLOR4D( ResolveText( *color.m_text, &Schematic()->CurrentSheet() ) );
1017
1018 aPlotter->SetColor( color );
1019
1020 aPlotter->SetCurrentLineWidth( penWidth );
1021 aPlotter->SetDash( penWidth, GetEffectiveLineStyle() );
1022
1023 VECTOR2I plotStart = m_start;
1024 VECTOR2I plotEnd = m_end;
1025 bool drawLineBody = true;
1026
1027 if( IsGraphicLine() )
1028 {
1029 drawLineBody = EDA_SHAPE::ShortenSegmentForEndings( plotStart, plotEnd, GetStartEnding(), GetEndEnding(),
1030 penWidth );
1031 }
1032
1033 if( drawLineBody )
1034 {
1035 aPlotter->MoveTo( plotStart );
1036 aPlotter->FinishTo( plotEnd );
1037 }
1038
1039 aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
1040
1041 if( IsGraphicLine() )
1042 {
1043 EDA_ANGLE lineAngle( m_end - m_start );
1044 GetStartEnding().Plot( aPlotter, m_start, lineAngle + ANGLE_180, penWidth );
1045 GetEndEnding().Plot( aPlotter, m_end, lineAngle, penWidth );
1046 }
1047
1048 // Plot attributes to a hypertext menu
1049 std::vector<wxString> properties;
1050 BOX2I bbox = GetBoundingBox();
1051 bbox.Inflate( penWidth * 3 );
1052
1053 if( aPlotOpts.m_PDFPropertyPopups )
1054 {
1055 if( GetLayer() == LAYER_WIRE )
1056 {
1057 if( const auto name = GetConnectionName() )
1058 {
1059 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
1060 _( "Net" ),
1061 *name ) );
1062
1063 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
1064 _( "Resolved netclass" ),
1065 GetEffectiveNetClass()->GetHumanReadableName() ) );
1066 }
1067 }
1068 else if( GetLayer() == LAYER_BUS )
1069 {
1070 for( const wxString& member : GetBusMemberNames() )
1071 properties.emplace_back( wxT( "!" ) + member );
1072 }
1073
1074 if( !properties.empty() )
1075 aPlotter->HyperlinkMenu( bbox, properties );
1076 }
1077}
1078
1079
1080void SCH_LINE::SetPosition( const VECTOR2I& aPosition )
1081{
1082 m_end = m_end - ( m_start - aPosition );
1083 m_start = aPosition;
1084}
1085
1086
1087void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
1088{
1089 wxString msg;
1090
1091 switch( GetLayer() )
1092 {
1093 case LAYER_WIRE: msg = _( "Wire" ); break;
1094 case LAYER_BUS: msg = _( "Bus" ); break;
1095 default: msg = _( "Graphical" ); break;
1096 }
1097
1098 aList.emplace_back( _( "Line Type" ), msg );
1099
1100 LINE_STYLE lineStyle = GetStroke().GetLineStyle();
1101
1102 if( ( IsWire() || IsBus() ) && GetEffectiveLineStyle() != lineStyle )
1103 aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
1104 else
1105 m_stroke.GetMsgPanelInfo( aFrame, aList, true, false );
1106
1107 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
1108 {
1109 if( const auto name = SCH_CONNECTIVITY::AppendConnectionInfo( *this, aList ) )
1110 {
1111 if( SCHEMATIC* schematic = Schematic() )
1112 {
1113 if( SCH_NETCHAIN* chain = schematic->NetChains().GetNetChainForNet( *name ) )
1114 aList.emplace_back( _( "Net Chain" ), UnescapeString( chain->GetName() ) );
1115 }
1116 }
1117 }
1118}
1119
1120
1122{
1123 return ( GetLayer() == LAYER_NOTES );
1124}
1125
1126
1128{
1129 return ( GetLayer() == LAYER_WIRE );
1130}
1131
1132
1134{
1135 return ( GetLayer() == LAYER_BUS );
1136}
1137
1138
1139bool SCH_LINE::operator==( const SCH_ITEM& aOther ) const
1140{
1141 if( Type() != aOther.Type() )
1142 return false;
1143
1144 const SCH_LINE& other = static_cast<const SCH_LINE&>( aOther );
1145
1146 if( GetLayer() != other.GetLayer() )
1147 return false;
1148
1149 if( m_start != other.m_start )
1150 return false;
1151
1152 if( m_end != other.m_end )
1153 return false;
1154
1155 if( m_stroke.GetWidth() != other.m_stroke.GetWidth() )
1156 return false;
1157
1158 if( m_stroke.GetColor() != other.m_stroke.GetColor() )
1159 return false;
1160
1161 if( m_stroke.GetLineStyle() != other.m_stroke.GetLineStyle() )
1162 return false;
1163
1164 if( m_startEnding != other.m_startEnding )
1165 return false;
1166
1167 if( m_endEnding != other.m_endEnding )
1168 return false;
1169
1170 return true;
1171}
1172
1173
1174double SCH_LINE::Similarity( const SCH_ITEM& aOther ) const
1175{
1176 if( m_Uuid == aOther.m_Uuid )
1177 return 1.0;
1178
1179 if( Type() != aOther.Type() )
1180 return 0.0;
1181
1182 const SCH_LINE& other = static_cast<const SCH_LINE&>( aOther );
1183
1184 if( GetLayer() != other.GetLayer() )
1185 return 0.0;
1186
1187 double similarity = 1.0;
1188
1189 if( m_start != other.m_start )
1190 similarity *= 0.9;
1191
1192 if( m_end != other.m_end )
1193 similarity *= 0.9;
1194
1195 if( m_stroke.GetWidth() != other.m_stroke.GetWidth() )
1196 similarity *= 0.9;
1197
1198 if( m_stroke.GetColor() != other.m_stroke.GetColor() )
1199 similarity *= 0.9;
1200
1201 if( m_stroke.GetLineStyle() != other.m_stroke.GetLineStyle() )
1202 similarity *= 0.9;
1203
1204 if( m_startEnding != other.m_startEnding )
1205 similarity *= 0.9;
1206
1207 if( m_endEnding != other.m_endEnding )
1208 similarity *= 0.9;
1209
1210 return similarity;
1211}
1212
1213
1214bool SCH_LINE::ShouldHopOver( const SCH_LINE* aLine ) const
1215{
1216 // try to find if this should hop over aLine. Horizontal wires have preference for hop.
1217 bool isMeVertical = ( m_end.x == m_start.x );
1218 bool isCandidateVertical = ( aLine->GetEndPoint().x == aLine->GetStartPoint().x );
1219
1220 // Vertical vs. Horizontal: Horizontal should hop
1221 if( isMeVertical && !isCandidateVertical )
1222 return false;
1223
1224 if( isCandidateVertical && !isMeVertical )
1225 return true;
1226
1227 // Both this and aLine have a slope. Try to find the best candidate
1228 double slopeMe = ( m_end.y - m_start.y ) / (double) ( m_end.x - m_start.x );
1229 double slopeCandidate = ( aLine->GetEndPoint().y - aLine->GetStartPoint().y )
1230 / (double) ( aLine->GetEndPoint().x - aLine->GetStartPoint().x );
1231
1232 if( fabs( slopeMe ) == fabs( slopeCandidate ) ) // Can easily happen with 45 deg wires
1233 return slopeMe < slopeCandidate; // signs are certainly different
1234
1235 return fabs( slopeMe ) < fabs( slopeCandidate ); // The shallower line should hop
1236}
1237
1238
1239std::vector<VECTOR3I> SCH_LINE::BuildWireWithHopShape( const SCH_SCREEN* aScreen, double aArcRadius ) const
1240{
1241 // Note: Points are VECTOR3D, with Z coord used as flag
1242 // for segments: start point and end point have the Z coord = 0
1243 // for arcs: start point middle point and end point have the Z coord = 1
1244
1245 std::vector<VECTOR3I> wire_shape; // List of coordinates:
1246 // 2 points for a segment, 3 points for an arc
1247
1248 if( !IsWire() && !IsBus() )
1249 {
1250 wire_shape.emplace_back( GetStartPoint().x,GetStartPoint().y, 0 );
1251 wire_shape.emplace_back( GetEndPoint().x, GetEndPoint().y, 0 );
1252 return wire_shape;
1253 }
1254
1255 std::vector<SCH_LINE*> existingWires; // wires to test (candidates)
1256 std::vector<VECTOR2I> intersections;
1257
1258 for( SCH_ITEM* item : aScreen->Items().Overlapping( SCH_LINE_T, GetBoundingBox() ) )
1259 {
1260 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1261
1262 if( line->IsWire() || line->IsBus() )
1263 existingWires.push_back( line );
1264 }
1265
1266 VECTOR2I currentLineStartPoint = GetStartPoint();
1267 VECTOR2I currentLineEndPoint = GetEndPoint();
1268
1269 for( SCH_LINE* existingLine : existingWires )
1270 {
1271 VECTOR2I extLineStartPoint = existingLine->GetStartPoint();
1272 VECTOR2I extLineEndPoint = existingLine->GetEndPoint();
1273
1274 if( extLineStartPoint == currentLineStartPoint && extLineEndPoint == currentLineEndPoint )
1275 continue;
1276
1277 if( !ShouldHopOver( existingLine ) )
1278 continue;
1279
1280 SEG currentSegment = SEG( currentLineStartPoint, currentLineEndPoint );
1281 SEG existingSegment = SEG( extLineStartPoint, extLineEndPoint );
1282
1283 if( OPT_VECTOR2I intersect = currentSegment.Intersect( existingSegment, true, false ) )
1284 {
1285 if( IsEndPoint( *intersect ) || existingLine->IsEndPoint( *intersect ) )
1286 continue;
1287
1288 // Ensure intersecting point is not yet entered. it can be already just entered
1289 // if more than two wires are intersecting at the same point,
1290 // creating bad hop over shapes for the current wire
1291 if( intersections.size() == 0 || intersections.back() != *intersect )
1292 intersections.push_back( *intersect );
1293 }
1294 }
1295
1296 if( intersections.empty() )
1297 {
1298 wire_shape.emplace_back( currentLineStartPoint.x, currentLineStartPoint.y, 0 );
1299 wire_shape.emplace_back( currentLineEndPoint.x, currentLineEndPoint.y, 0 );
1300 }
1301 else
1302 {
1303 auto getDistance =
1304 []( const VECTOR2I& a, const VECTOR2I& b ) -> double
1305 {
1306 return std::sqrt( std::pow( a.x - b.x, 2 ) + std::pow( a.y - b.y, 2 ) );
1307 };
1308
1309 std::sort( intersections.begin(), intersections.end(),
1310 [&]( const VECTOR2I& a, const VECTOR2I& b )
1311 {
1312 return getDistance( GetStartPoint(), a ) < getDistance( GetStartPoint(), b );
1313 } );
1314
1315 VECTOR2I currentStart = GetStartPoint();
1316 double R = aArcRadius;
1317
1318 for( const VECTOR2I& hopMid : intersections )
1319 {
1320 // Calculate the angle of the line from start point to end point in radians
1321 double lineAngle = std::atan2( GetEndPoint().y - GetStartPoint().y,
1322 GetEndPoint().x - GetStartPoint().x );
1323
1324 // Normalize to [0, pi) so the arc side doesn't depend
1325 // on which endpoint is start vs end
1326 double arcAngle = lineAngle;
1327
1328 if( arcAngle < 0.0 )
1329 arcAngle += M_PI;
1330 else if( arcAngle >= M_PI )
1331 arcAngle -= M_PI;
1332
1333 VECTOR2I arcMidPoint = { hopMid.x + static_cast<int>( R * std::sin( arcAngle ) ),
1334 hopMid.y - static_cast<int>( R * std::cos( arcAngle ) ) };
1335
1336 VECTOR2I beforeHop = hopMid - KiROUND( R * std::cos( lineAngle ), R * std::sin( lineAngle ) );
1337 VECTOR2I afterHop = hopMid + KiROUND( R * std::cos( lineAngle ), R * std::sin( lineAngle ) );
1338
1339 // Draw the line from the current start point to the before-hop point
1340 wire_shape.emplace_back( currentStart.x, currentStart.y, 0 );
1341 wire_shape.emplace_back( beforeHop.x, beforeHop.y, 0 );
1342
1343 // Create an arc object
1344 wire_shape.emplace_back( beforeHop.x, beforeHop.y, 1 );
1345 wire_shape.emplace_back( arcMidPoint.x, arcMidPoint.y, 1 );
1346 wire_shape.emplace_back( afterHop.x, afterHop.y, 1 );
1347
1348 currentStart = afterHop;
1349 }
1350
1351 // Draw the final line from the current start point to the end point of the original line
1352 wire_shape.emplace_back( currentStart. x,currentStart.y, 0 );
1353 wire_shape.emplace_back( GetEndPoint().x, GetEndPoint().y, 0 );
1354 }
1355
1356 return wire_shape;
1357}
1358
1359
1360static struct SCH_LINE_DESC
1361{
1363 {
1365
1366 if( endingStyleEnum.Choices().GetCount() == 0 )
1367 {
1368 endingStyleEnum.Map( LINE_ENDING_STYLE::NONE, _HKI( "None" ) )
1369 .Map( LINE_ENDING_STYLE::ARROW, _HKI( "Arrow" ) )
1370 .Map( LINE_ENDING_STYLE::CIRCLE, _HKI( "Circle" ) )
1371 .Map( LINE_ENDING_STYLE::SQUARE, _HKI( "Square" ) )
1372 .Map( LINE_ENDING_STYLE::ARROW_OPEN, _HKI( "Open Arrow" ) );
1373 }
1374
1376
1377 if( lineStyleEnum.Choices().GetCount() == 0 )
1378 {
1379 lineStyleEnum.Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
1380 .Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
1381 .Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
1382 .Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
1383 .Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
1384 }
1385
1387
1388 if( wireLineStyleEnum.Choices().GetCount() == 0 )
1389 {
1390 wireLineStyleEnum.Map( WIRE_STYLE::DEFAULT, _HKI( "Default" ) )
1391 .Map( WIRE_STYLE::SOLID, _HKI( "Solid" ) )
1392 .Map( WIRE_STYLE::DASH, _HKI( "Dashed" ) )
1393 .Map( WIRE_STYLE::DOT, _HKI( "Dotted" ) )
1394 .Map( WIRE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
1395 .Map( WIRE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
1396 }
1397
1401
1402 auto isGraphicLine =
1403 []( INSPECTABLE* aItem ) -> bool
1404 {
1405 if( SCH_LINE* line = dynamic_cast<SCH_LINE*>( aItem ) )
1406 return line->IsGraphicLine();
1407
1408 return false;
1409 };
1410
1411 auto isWireOrBus =
1412 []( INSPECTABLE* aItem ) -> bool
1413 {
1414 if( SCH_LINE* line = dynamic_cast<SCH_LINE*>( aItem ) )
1415 return line->IsWire() || line->IsBus();
1416
1417 return false;
1418 };
1419
1420 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Start X" ),
1423
1424 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Start Y" ),
1427
1428 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "End X" ),
1431
1432 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "End Y" ),
1435
1436 propMgr.AddProperty( new PROPERTY<SCH_LINE, double>( _HKI( "Length" ),
1438
1439 propMgr.AddProperty( new PROPERTY_ENUM<SCH_LINE, LINE_STYLE>( _HKI( "Line Style" ),
1441 .SetAvailableFunc( isGraphicLine );
1442
1443 propMgr.AddProperty( new PROPERTY_ENUM<SCH_LINE, WIRE_STYLE>( _HKI( "Wire Style" ),
1445 .SetAvailableFunc( isWireOrBus );
1446
1447 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Line Width" ),
1449
1450 propMgr.AddProperty( new PROPERTY<SCH_LINE, COLOR4D>( _HKI( "Color" ),
1452
1453 propMgr.AddProperty( new PROPERTY_ENUM<SCH_LINE, LINE_ENDING_STYLE>( _HKI( "Start Shape" ),
1455 .SetAvailableFunc( isGraphicLine );
1456
1457 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Start Length" ),
1459 .SetAvailableFunc( isGraphicLine );
1460
1461 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Start Width" ),
1463 .SetAvailableFunc( isGraphicLine );
1464
1465 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Start Stroke Width" ),
1468 .SetAvailableFunc( isGraphicLine );
1469
1470 propMgr.AddProperty( new PROPERTY_ENUM<SCH_LINE, LINE_ENDING_STYLE>( _HKI( "End Shape" ),
1472 .SetAvailableFunc( isGraphicLine );
1473
1474 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "End Length" ),
1476 .SetAvailableFunc( isGraphicLine );
1477
1478 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "End Width" ),
1480 .SetAvailableFunc( isGraphicLine );
1481
1482 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "End Stroke Width" ),
1485 .SetAvailableFunc( isGraphicLine );
1486 }
1488
const char * name
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
Definition api_enums.cpp:56
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
BITMAPS
A list of all bitmap identifiers.
@ add_dashed_line
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:985
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:556
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:597
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:400
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition sch_item.h:101
DANGLING_END_T GetType() const
Definition sch_item.h:137
EDA_ITEM * GetItem() const
Definition sch_item.h:135
The base class for create windows for drawing purpose.
const KIID m_Uuid
Definition eda_item.h:599
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM_FLAGS m_flags
Definition eda_item.h:608
EDA_GROUP * m_group
The group this item belongs to, if any. No ownership implied.
Definition eda_item.h:610
bool IsSelected() const
Definition eda_item.h:134
void SetSelected()
Definition eda_item.h:150
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
static bool ShortenSegmentForEndings(VECTOR2I &aStart, VECTOR2I &aEnd, const LINE_ENDING &aStartEnding, const LINE_ENDING &aEndEnding, int aLineWidth)
Shorten a segment body for line endings.
bool GetLineEndingsBoundingBox(BOX2I &aBBox, int aLineWidth) const
std::vector< SHAPE * > MakeEffectiveShapesWithLineEndings(int aLineWidth) const
Make effective geometry for the shape body shortened for line endings plus the line-ending geometry i...
EE_TYPE Overlapping(const BOX2I &aRect) const
Definition sch_rtree.h:253
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition property.h:817
static ENUM_MAP< T > & Instance()
Definition property.h:811
wxPGChoices & Choices()
Definition property.h:862
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:39
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
std::shared_ptr< wxString > m_text
Definition color4d.h:397
double a
Alpha component.
Definition color4d.h:394
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
static double lodScaleForThreshold(const KIGFX::VIEW *aView, int aWhatIu, int aThresholdIu)
Get the scale at which aWhatIu would be drawn at the same size as aThresholdIu on screen.
Definition view_item.cpp:35
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
Definition view_item.h:176
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Definition view_item.h:181
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:68
Definition kiid.h:46
Decorative shape (arrowhead, circle, square) at the start or end of a graphic line,...
Definition line_ending.h:62
void Plot(PLOTTER *aPlotter, const VECTOR2I &aPoint, const EDA_ANGLE &aTangent, int aLineWidth, void *aData=nullptr) const
int GetLineStyle() const
Definition netclass.h:259
int GetWireWidth() const
Definition netclass.h:229
COLOR4D GetSchematicColor(bool aIsForSave=false) const
Definition netclass.h:244
int GetBusWidth() const
Definition netclass.h:237
Base plotter engine class.
Definition plotter.h:138
void MoveTo(const VECTOR2I &pos)
Definition plotter.h:325
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
Definition plotter.h:335
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
Definition plotter.h:538
virtual void SetColor(const COLOR4D &color)=0
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
Definition property.h:275
Provide class metadata.
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.
Holds all the data relating to one schematic.
Definition schematic.h:155
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
Definition sch_item.cpp:191
void SetLocked(bool aLocked) override
Definition sch_item.h:262
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.cpp:46
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:302
bool IsLocked() const override
Definition sch_item.cpp:179
std::vector< wxString > GetBusMemberNames(const SCH_SHEET_PATH *aSheet=nullptr) const
Names of the bus members of this item's connection, empty when it does not have a bus.
Definition sch_item.cpp:647
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:733
bool m_connectivity_dirty
Definition sch_item.h:857
void SetLayer(SCH_LAYER_ID aLayer)
Definition sch_item.h:354
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:353
void SetConnectivityDirty(bool aDirty=true)
Set the dirty flag.
Definition sch_item.cpp:314
bool IsConnectivityDirty() const
Definition sch_item.h:635
std::optional< wxString > GetConnectionName(const SCH_SHEET_PATH *aSheet=nullptr, bool aLocal=false, bool aIgnoreSheet=false) const
Return the active connection name; absent for missing or stale published rows.
Definition sch_item.cpp:629
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:65
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:464
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
SCH_LAYER_ID m_layer
Definition sch_item.h:843
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:39
int GetPenWidth() const override
Definition sch_line.cpp:447
void SetStartY(int aY)
Definition sch_line.h:141
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition sch_line.cpp:993
int GetStartEndingStrokeWidth() const
Definition sch_line.h:223
int GetEndY() const
Definition sch_line.h:149
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
Definition sch_line.cpp:697
void SetStartPoint(const VECTOR2I &aPosition)
Definition sch_line.h:137
void SetEndEnding(const LINE_ENDING &aEnding)
Definition sch_line.h:205
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition sch_line.cpp:243
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition sch_line.cpp:876
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.
Definition sch_line.cpp:707
bool m_startIsDangling
True if start point is not connected.
Definition sch_line.h:417
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition sch_line.cpp:910
void SetPosition(const VECTOR2I &aPosition) override
void SetEndEndingStyle(LINE_ENDING_STYLE aStyle)
Definition sch_line.h:211
std::vector< VECTOR3I > BuildWireWithHopShape(const SCH_SCREEN *aScreen, double aArcRadius) const
For wires only: build the list of points to draw the shape using segments and 180 deg arcs Points are...
int GetStartX() const
Definition sch_line.h:138
SCH_LINE * NonGroupAware_BreakAt(const VECTOR2I &aPoint)
This version should only be used when importing files.
Definition sch_line.cpp:685
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition sch_line.cpp:811
int GetReverseAngleFrom(const VECTOR2I &aPoint) const
Definition sch_line.cpp:524
SCH_LINE(const VECTOR2I &pos=VECTOR2I(0, 0), int layer=LAYER_NOTES)
Definition sch_line.cpp:75
bool IsWire() const
Return true if the line is a wire.
void SetStartEndingStyle(LINE_ENDING_STYLE aStyle)
Definition sch_line.h:208
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition sch_line.cpp:318
void SetEndEndingWidth(int aWidth)
Definition sch_line.h:221
void SetWireStyle(const WIRE_STYLE aStyle)
Definition sch_line.h:183
bool CanConnect(const SCH_ITEM *aItem) const override
Definition sch_line.cpp:769
bool IsParallel(const SCH_LINE *aLine) const
Definition sch_line.cpp:537
int GetStartY() const
Definition sch_line.h:140
int GetEndEndingLength() const
Definition sch_line.h:218
void SetLineWidth(const int aSize)
Definition sch_line.cpp:440
bool ShouldHopOver(const SCH_LINE *aLine) const
For wires only:
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition sch_line.cpp:491
virtual STROKE_PARAMS GetStroke() const override
Definition sch_line.h:198
LINE_ENDING m_startEnding
Line ending at start point.
Definition sch_line.h:423
int GetAngleFrom(const VECTOR2I &aPoint) const
Definition sch_line.cpp:511
void GetSelectedPoints(std::vector< VECTOR2I > &aPoints) const
Definition sch_line.cpp:830
LINE_STYLE GetEffectiveLineStyle() const
Definition sch_line.cpp:427
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 SetEndEndingStrokeWidth(int aWidth)
Definition sch_line.h:226
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.
wxString m_operatingPoint
Definition sch_line.h:433
void SetLength(double aLength)
Definition sch_line.cpp:349
const LINE_ENDING & GetEndEnding() const
Definition sch_line.h:204
wxString GetClass() const override
Return the class name.
Definition sch_line.h:61
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition sch_line.cpp:501
VECTOR2I GetEndPoint() const
Definition sch_line.h:145
VECTOR2I GetStartPoint() const
Definition sch_line.h:136
bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
Definition sch_line.cpp:817
LINE_STYLE m_lastResolvedLineStyle
Definition sch_line.h:429
SCH_LINE * MergeOverlap(SCH_SCREEN *aScreen, SCH_LINE *aLine, bool aCheckJunctions)
Check line against aLine to see if it overlaps and merge if it does.
Definition sch_line.cpp:550
int GetEndEndingWidth() const
Definition sch_line.h:220
void SetEndY(int aY)
Definition sch_line.h:150
int GetStartEndingWidth() const
Definition sch_line.h:215
VECTOR2I m_start
Line start point.
Definition sch_line.h:419
bool IsBus() const
Return true if the line is a bus.
int m_lastResolvedWidth
Definition sch_line.h:430
void SetStartEndingLength(int aLength)
Definition sch_line.h:214
LINE_ENDING m_endEnding
Line ending at end point.
Definition sch_line.h:424
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
Definition sch_line.cpp:793
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition sch_line.cpp:133
LINE_ENDING_STYLE GetEndEndingStyle() const
Definition sch_line.h:210
void SetLineStyle(const LINE_STYLE aStyle)
Definition sch_line.cpp:411
VECTOR2I m_end
Line end point.
Definition sch_line.h:420
void SetEndEndingLength(int aLength)
Definition sch_line.h:219
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition sch_line.cpp:249
int GetEndX() const
Definition sch_line.h:147
LINE_STYLE GetLineStyle() const
Definition sch_line.cpp:418
void SetStartEndingWidth(int aWidth)
Definition sch_line.h:216
int GetEndEndingStrokeWidth() const
Definition sch_line.h:225
LINE_ENDING_STYLE GetStartEndingStyle() const
Definition sch_line.h:207
void SetStartEnding(const LINE_ENDING &aEnding)
Definition sch_line.h:202
void MoveEnd(const VECTOR2I &aMoveVector)
Definition sch_line.cpp:262
KIGFX::COLOR4D m_lastResolvedColor
Definition sch_line.h:431
STROKE_PARAMS m_stroke
Line stroke properties.
Definition sch_line.h:422
SCH_LINE * BreakAt(SCH_COMMIT *aCommit, const VECTOR2I &aPoint)
Break this segment into two at the specified point.
Definition sch_line.cpp:673
bool m_endIsDangling
True if end point is not connected.
Definition sch_line.h:418
bool IsConnectable() const override
Definition sch_line.cpp:760
wxString GetFriendlyName() const override
Definition sch_line.cpp:232
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition sch_line.cpp:295
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition sch_line.cpp:481
bool operator==(const SCH_ITEM &aOther) const override
bool operator<(const SCH_ITEM &aItem) const override
Definition sch_line.cpp:887
WIRE_STYLE GetWireStyle() const
Definition sch_line.h:184
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition sch_line.cpp:840
bool IsEndPoint(const VECTOR2I &aPoint) const override
Test if aPt is an end point of this schematic object.
Definition sch_line.h:88
bool IsGraphicLine() const
Return if the line is a graphic (non electrical line)
int GetLineWidth() const
Definition sch_line.h:195
KIGFX::COLOR4D GetLineColor() const
Return COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.
Definition sch_line.cpp:398
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition sch_line.cpp:285
void MoveStart(const VECTOR2I &aMoveVector)
Definition sch_line.cpp:256
void SetLineColor(const KIGFX::COLOR4D &aColor)
Definition sch_line.cpp:374
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition sch_line.cpp:183
double GetLength() const
Definition sch_line.cpp:343
void SetEndX(int aX)
Definition sch_line.h:148
void SetStartEndingStrokeWidth(int aWidth)
Definition sch_line.h:224
const LINE_ENDING & GetStartEnding() const
Definition sch_line.h:201
int GetStartEndingLength() const
Definition sch_line.h:213
void SetEndPoint(const VECTOR2I &aPosition)
Definition sch_line.h:146
void SetStartX(int aX)
Definition sch_line.h:139
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition sch_line.cpp:979
A net chain is a collection of nets that are connected together through passive components.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:122
bool IsJunction(const VECTOR2I &aPosition) const
Test if a junction is required for the items at aPosition on the screen.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Definition seg.h:38
OPT_VECTOR2I Intersect(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
Compute intersection point of segment (this) with segment aSeg.
Definition seg.cpp:401
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
An abstract shape on 2D plane.
Definition shape.h:124
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Definition shape.h:181
int GetWidth() const
LINE_STYLE GetLineStyle() const
KIGFX::COLOR4D GetColor() const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
#define DEFAULT_BUS_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
#define DEFAULT_WIRE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define DEFAULT_LINE_WIDTH_MILS
The default line width in mils. (can be changed in preference menu)
#define _(s)
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:474
static constexpr EDA_ANGLE ANGLE_270
Definition eda_angle.h:477
static constexpr EDA_ANGLE ANGLE_180
Definition eda_angle.h:476
@ NO_FILL
Definition eda_fill.h:30
#define STRUCT_DELETED
flag indication structures to be erased
#define ENDPOINT
ends. (Used to support dragging.)
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define STARTPOINT
When a line is selected, these flags indicate which.
static bool hasLineEnding(const LINE_ENDING &aStartEnding, const LINE_ENDING &aEndEnding)
@ SEGMENT
Definition eda_shape.h:57
a few functions useful in geometry calculations.
@ LAYER_DANGLING
Definition layer_ids.h:508
@ LAYER_WIRE
Definition layer_ids.h:483
@ LAYER_NOTES
Definition layer_ids.h:498
@ LAYER_NET_COLOR_HIGHLIGHT
Definition layer_ids.h:524
@ LAYER_BUS
Definition layer_ids.h:484
@ LAYER_SELECTION_SHADOWS
Definition layer_ids.h:526
@ LAYER_OP_VOLTAGES
Definition layer_ids.h:532
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition mirror.h:44
bool ShapeHitTest(const SHAPE_LINE_CHAIN &aHitter, const SHAPE &aHittee, bool aHitteeContained)
Perform a shape-to-shape hit test.
SHAPE_LINE_CHAIN BoxToLineChain(const BOX2I &aBox)
Get a SHAPE_LINE_CHAIN representing the outline of a box.
std::optional< wxString > AppendConnectionInfo(const SCH_ITEM &aItem, std::vector< MSG_PANEL_ITEM > &aList, const SCH_SHEET_PATH *aPath=nullptr)
Append connection details; return its name for a signal, or no value for a bus/missing row.
KICOMMON_API void PackLineEnding(types::LineEnding &aOutput, const LINE_ENDING &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackColor(types::Color &aOutput, const KIGFX::COLOR4D &aInput)
KICOMMON_API int UnpackDistance(const types::Distance &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API LINE_ENDING UnpackLineEnding(const types::LineEnding &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API KIGFX::COLOR4D UnpackColor(const types::Color &aInput)
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackDistance(types::Distance &aOutput, int aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:461
#define _HKI(x)
Definition page_info.cpp:40
static bool intersect(const SEGMENT_WITH_NORMALS &aSeg, const SFVEC2F &aStart, const SFVEC2F &aEnd)
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
Definition property.h:74
#define IMPLEMENT_ENUM_TO_WXANY(type)
Definition property.h:916
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
Definition property.h:65
@ PT_SIZE
Size expressed in distance units (mm/inch)
Definition property.h:63
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
@ BUS_END
Definition sch_item.h:85
@ PIN_END
Definition sch_item.h:87
@ BUS_ENTRY_END
Definition sch_item.h:89
@ WIRE_END
Definition sch_item.h:84
static struct SCH_LINE_DESC _SCH_LINE_DESC
std::optional< VECTOR2I > OPT_VECTOR2I
Definition seg.h:35
Utility functions for working with shapes.
const int scale
wxString UnescapeString(const wxString &aSource)
LINE_STYLE
Dashed line types.
WIRE_STYLE
bool m_PDFPropertyPopups
Definition sch_plotter.h:66
const SHAPE_LINE_CHAIN chain
VECTOR2I end
const int accuracy
int delta
#define M_PI
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:173
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:227
@ SCH_LINE_T
Definition typeinfo.h:159
@ SCH_NO_CONNECT_T
Definition typeinfo.h:156
@ SCH_SYMBOL_T
Definition typeinfo.h:168
@ SCH_DIRECTIVE_LABEL_T
Definition typeinfo.h:167
@ SCH_LABEL_T
Definition typeinfo.h:163
@ SCH_SHEET_T
Definition typeinfo.h:171
@ SCH_HIER_LABEL_T
Definition typeinfo.h:165
@ SCH_SHEET_PIN_T
Definition typeinfo.h:170
@ SCH_BUS_WIRE_ENTRY_T
Definition typeinfo.h:157
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:164
@ SCH_JUNCTION_T
Definition typeinfo.h:155
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
static PIECE rect(double aLeft, double aTop, double aRight, double aBottom, bool aMixed=false)