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 (C) 1992-2024 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 <base_units.h>
26#include <bitmaps.h>
27#include <string_utils.h>
28#include <core/mirror.h>
29#include <sch_painter.h>
30#include <sch_plotter.h>
32#include <sch_line.h>
33#include <sch_edit_frame.h>
35#include <connection_graph.h>
38#include <trigo.h>
39#include <board_item.h>
40#include <api/api_enums.h>
41#include <api/api_utils.h>
42#include <api/schematic/schematic_types.pb.h>
43
44
45SCH_LINE::SCH_LINE( const VECTOR2I& pos, int layer ) :
46 SCH_ITEM( nullptr, SCH_LINE_T )
47{
48 m_start = pos;
49 m_end = pos;
50 m_stroke.SetWidth( 0 );
51 m_stroke.SetLineStyle( LINE_STYLE::DEFAULT );
52 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
53
54 switch( layer )
55 {
56 default: m_layer = LAYER_NOTES; break;
57 case LAYER_WIRE: m_layer = LAYER_WIRE; break;
58 case LAYER_BUS: m_layer = LAYER_BUS; break;
59 }
60
61 if( layer == LAYER_NOTES )
63 else
65
66 if( layer == LAYER_WIRE )
68 else if( layer == LAYER_BUS )
70 else
72
73 m_lastResolvedLineStyle = LINE_STYLE::SOLID;
74 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
75}
76
77
79 SCH_ITEM( aLine )
80{
81 m_start = aLine.m_start;
82 m_end = aLine.m_end;
83 m_stroke = aLine.m_stroke;
86
90
92}
93
94
95void SCH_LINE::Serialize( google::protobuf::Any &aContainer ) const
96{
97 kiapi::schematic::types::Line line;
98
99 line.mutable_id()->set_value( m_Uuid.AsStdString() );
100 kiapi::common::PackVector2( *line.mutable_start(), GetStartPoint() );
101 kiapi::common::PackVector2( *line.mutable_end(), GetEndPoint() );
102 line.set_layer(
103 ToProtoEnum<SCH_LAYER_ID, kiapi::schematic::types::SchematicLayer>( GetLayer() ) );
104
105 aContainer.PackFrom( line );
106}
107
108
109bool SCH_LINE::Deserialize( const google::protobuf::Any &aContainer )
110{
111 kiapi::schematic::types::Line line;
112
113 if( !aContainer.UnpackTo( &line ) )
114 return false;
115
116 const_cast<KIID&>( m_Uuid ) = KIID( line.id().value() );
119 SCH_LAYER_ID layer =
120 FromProtoEnum<SCH_LAYER_ID, kiapi::schematic::types::SchematicLayer>( line.layer() );
121
122 switch( layer )
123 {
124 case LAYER_WIRE:
125 case LAYER_BUS:
126 case LAYER_NOTES:
127 SetLayer( layer );
128 break;
129
130 default:
131 break;
132 }
133
134 return true;
135}
136
137
139{
140 switch( GetLayer() )
141 {
142 case LAYER_WIRE: return _( "Wire" );
143 case LAYER_BUS: return _( "Bus" );
144 default: return _( "Graphic Line" );
145 }
146}
147
148
150{
151 return new SCH_LINE( *this );
152}
153
154
155void SCH_LINE::Move( const VECTOR2I& aOffset )
156{
157 m_start += aOffset;
158 m_end += aOffset;
159}
160
161
162void SCH_LINE::MoveStart( const VECTOR2I& aOffset )
163{
164 m_start += aOffset;
165}
166
167
168void SCH_LINE::MoveEnd( const VECTOR2I& aOffset )
169{
170 m_end += aOffset;
171}
172
173
174#if defined(DEBUG)
175
176void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
177{
178 NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
179 << " layer=\"" << m_layer << '"'
180 << " startIsDangling=\"" << m_startIsDangling
181 << '"' << " endIsDangling=\""
182 << m_endIsDangling << '"' << ">"
183 << " <start" << m_start << "/>"
184 << " <end" << m_end << "/>" << "</"
185 << GetClass().Lower().mb_str() << ">\n";
186}
187
188#endif
189
190
191void SCH_LINE::ViewGetLayers( int aLayers[], int& aCount ) const
192{
193 aCount = 5;
194 aLayers[0] = LAYER_DANGLING;
195 aLayers[1] = m_layer;
196 aLayers[2] = LAYER_SELECTION_SHADOWS;
197 aLayers[3] = LAYER_NET_COLOR_HIGHLIGHT;
198 aLayers[4] = LAYER_OP_VOLTAGES;
199}
200
201
202double SCH_LINE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
203{
204 constexpr double HIDE = std::numeric_limits<double>::max();
205 constexpr double SHOW = 0.0;
206
207 if( aLayer == LAYER_OP_VOLTAGES )
208 {
209 if( m_start == m_end )
210 return HIDE;
211
212 int height = std::abs( m_end.y - m_start.y );
213 int width = std::abs( m_end.x - m_start.x );
214
215 // Operating points will be shown only if zoom is appropriate
216 if( height == 0 )
217 return (double) schIUScale.mmToIU( 15 ) / width;
218 else
219 return (double) schIUScale.mmToIU( 5 ) / height;
220 }
221
222 // Other layers are always drawn.
223 return SHOW;
224}
225
226
228{
229 int width = GetPenWidth() / 2;
230
231 int xmin = std::min( m_start.x, m_end.x ) - width;
232 int ymin = std::min( m_start.y, m_end.y ) - width;
233
234 int xmax = std::max( m_start.x, m_end.x ) + width + 1;
235 int ymax = std::max( m_start.y, m_end.y ) + width + 1;
236
237 BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );
238
239 return ret;
240}
241
242
244{
245 return m_start.Distance( m_end );
246}
247
248
249void SCH_LINE::SetLineColor( const COLOR4D& aColor )
250{
251 m_stroke.SetColor( aColor );
253}
254
255
256void SCH_LINE::SetLineColor( const double r, const double g, const double b, const double a )
257{
258 COLOR4D newColor(r, g, b, a);
259
260 if( newColor == COLOR4D::UNSPECIFIED )
261 {
262 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
263 }
264 else
265 {
266 // Eeschema does not allow alpha channel in colors
267 newColor.a = 1.0;
268 m_stroke.SetColor( newColor );
269 }
270}
271
272
274{
275 if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
277 else if( !IsConnectable() )
278 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
279 else if( !IsConnectivityDirty() )
280 m_lastResolvedColor = GetEffectiveNetClass()->GetSchematicColor();
281
282 return m_lastResolvedColor;
283}
284
285
286void SCH_LINE::SetLineStyle( const int aStyleId )
287{
288 SetLineStyle( static_cast<LINE_STYLE>( aStyleId ) );
289}
290
291
293{
294 m_stroke.SetLineStyle( aStyle );
296}
297
298
300{
301 if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
302 return m_stroke.GetLineStyle();
303
304 return LINE_STYLE::SOLID;
305}
306
307
309{
310 if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
312 else if( !IsConnectable() )
313 m_lastResolvedLineStyle = LINE_STYLE::SOLID;
314 else if( !IsConnectivityDirty() )
316
318}
319
320
321void SCH_LINE::SetLineWidth( const int aSize )
322{
323 m_stroke.SetWidth( aSize );
325}
326
327
329{
330 SCHEMATIC* schematic = Schematic();
331
332 switch ( m_layer )
333 {
334 default:
335 if( m_stroke.GetWidth() > 0 )
336 return m_stroke.GetWidth();
337
338 if( schematic )
339 return schematic->Settings().m_DefaultLineWidth;
340
342
343 case LAYER_WIRE:
344 if( m_stroke.GetWidth() > 0 )
346 else if( !IsConnectivityDirty() )
347 m_lastResolvedWidth = GetEffectiveNetClass()->GetWireWidth();
348
349 return m_lastResolvedWidth;
350
351 case LAYER_BUS:
352 if( m_stroke.GetWidth() > 0 )
354 else if( !IsConnectivityDirty() )
355 m_lastResolvedWidth = GetEffectiveNetClass()->GetBusWidth();
356
357 return m_lastResolvedWidth;
358 }
359}
360
361
362void SCH_LINE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
363 const VECTOR2I& offset, bool aForceNoFill, bool aDimmed )
364{
365 wxDC* DC = aSettings->GetPrintDC();
367
368 if( color == COLOR4D::UNSPECIFIED )
369 color = aSettings->GetLayerColor( GetLayer() );
370
371 VECTOR2I start = m_start;
372 VECTOR2I end = m_end;
373 LINE_STYLE lineStyle = GetEffectiveLineStyle();
374 int penWidth = GetEffectivePenWidth( aSettings );
375
376 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
377 {
378 GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
379 }
380 else
381 {
382 SHAPE_SEGMENT segment( start, end );
383
384 STROKE_PARAMS::Stroke( &segment, lineStyle, penWidth, aSettings,
385 [&]( const VECTOR2I& a, const VECTOR2I& b )
386 {
387 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
388 } );
389 }
390}
391
392
393void SCH_LINE::MirrorVertically( int aCenter )
394{
395 if( m_flags & STARTPOINT )
396 MIRROR( m_start.y, aCenter );
397
398 if( m_flags & ENDPOINT )
399 MIRROR( m_end.y, aCenter );
400}
401
402
404{
405 if( m_flags & STARTPOINT )
406 MIRROR( m_start.x, aCenter );
407
408 if( m_flags & ENDPOINT )
409 MIRROR( m_end.x, aCenter );
410}
411
412
413void SCH_LINE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
414{
415 if( m_flags & STARTPOINT )
416 RotatePoint( m_start, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
417
418 if( m_flags & ENDPOINT )
419 RotatePoint( m_end, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
420}
421
422
423int SCH_LINE::GetAngleFrom( const VECTOR2I& aPoint ) const
424{
425 VECTOR2I vec;
426
427 if( aPoint == m_start )
428 vec = m_end - aPoint;
429 else
430 vec = m_start - aPoint;
431
432 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
433}
434
435
436int SCH_LINE::GetReverseAngleFrom( const VECTOR2I& aPoint ) const
437{
438 VECTOR2I vec;
439
440 if( aPoint == m_end )
441 vec = m_start - aPoint;
442 else
443 vec = m_end - aPoint;
444
445 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
446}
447
448
449bool SCH_LINE::IsParallel( const SCH_LINE* aLine ) const
450{
451 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false,
452 wxT( "Cannot test line segment for overlap." ) );
453
454 VECTOR2I firstSeg = m_end - m_start;
455 VECTOR2I secondSeg = aLine->m_end - aLine->m_start;
456
457 // Use long long here to avoid overflow in calculations
458 return !( (long long) firstSeg.x * secondSeg.y - (long long) firstSeg.y * secondSeg.x );
459}
460
461
462SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCheckJunctions )
463{
464 auto less =
465 []( const VECTOR2I& lhs, const VECTOR2I& rhs ) -> bool
466 {
467 if( lhs.x == rhs.x )
468 return lhs.y < rhs.y;
469
470 return lhs.x < rhs.x;
471 };
472
473 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, nullptr,
474 wxT( "Cannot test line segment for overlap." ) );
475
476 if( this == aLine || GetLayer() != aLine->GetLayer() )
477 return nullptr;
478
479 VECTOR2I leftmost_start = aLine->m_start;
480 VECTOR2I leftmost_end = aLine->m_end;
481
482 VECTOR2I rightmost_start = m_start;
483 VECTOR2I rightmost_end = m_end;
484
485 // We place the start to the left and below the end of both lines
486 if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) )
487 std::swap( leftmost_start, leftmost_end );
488 if( rightmost_start != std::min( { rightmost_start, rightmost_end }, less ) )
489 std::swap( rightmost_start, rightmost_end );
490
491 // - leftmost is the line that starts farthest to the left
492 // - other is the line that is _not_ leftmost
493 // - rightmost is the line that ends farthest to the right. This may or may not be 'other'
494 // as the second line may be completely covered by the first.
495 if( less( rightmost_start, leftmost_start ) )
496 {
497 std::swap( leftmost_start, rightmost_start );
498 std::swap( leftmost_end, rightmost_end );
499 }
500
501 VECTOR2I other_start = rightmost_start;
502 VECTOR2I other_end = rightmost_end;
503
504 if( less( rightmost_end, leftmost_end ) )
505 {
506 rightmost_start = leftmost_start;
507 rightmost_end = leftmost_end;
508 }
509
510 // If we end one before the beginning of the other, no overlap is possible
511 if( less( leftmost_end, other_start ) )
512 {
513 return nullptr;
514 }
515
516 // Search for a common end:
517 if( ( leftmost_start == other_start ) && ( leftmost_end == other_end ) ) // Trivial case
518 {
519 SCH_LINE* ret = new SCH_LINE( *aLine );
520 ret->SetStartPoint( leftmost_start );
521 ret->SetEndPoint( leftmost_end );
522 ret->SetConnectivityDirty( true );
523
524 if( IsSelected() || aLine->IsSelected() )
525 ret->SetSelected();
526
527 return ret;
528 }
529
530 bool colinear = false;
531
532 /* Test alignment: */
533 if( ( leftmost_start.y == leftmost_end.y ) &&
534 ( other_start.y == other_end.y ) ) // Horizontal segment
535 {
536 colinear = ( leftmost_start.y == other_start.y );
537 }
538 else if( ( leftmost_start.x == leftmost_end.x ) &&
539 ( other_start.x == other_end.x ) ) // Vertical segment
540 {
541 colinear = ( leftmost_start.x == other_start.x );
542 }
543 else
544 {
545 // We use long long here to avoid overflow -- it enforces promotion
546 // The slope of the left-most line is dy/dx. Then we check that the slope from the
547 // left most start to the right most start is the same as well as the slope from the
548 // left most start to right most end.
549 long long dx = leftmost_end.x - leftmost_start.x;
550 long long dy = leftmost_end.y - leftmost_start.y;
551 colinear = ( ( ( other_start.y - leftmost_start.y ) * dx ==
552 ( other_start.x - leftmost_start.x ) * dy ) &&
553 ( ( other_end.y - leftmost_start.y ) * dx ==
554 ( other_end.x - leftmost_start.x ) * dy ) );
555 }
556
557 if( !colinear )
558 return nullptr;
559
560 // We either have a true overlap or colinear touching segments. We always want to merge
561 // the former, but the later only get merged if there no junction at the touch point.
562
563 bool touching = leftmost_end == rightmost_start;
564
565 if( touching && aCheckJunctions && aScreen->IsJunction( leftmost_end ) )
566 return nullptr;
567
568 // Make a new segment that merges the 2 segments
569 leftmost_end = rightmost_end;
570
571 SCH_LINE* ret = new SCH_LINE( *aLine );
572 ret->SetStartPoint( leftmost_start );
573 ret->SetEndPoint( leftmost_end );
574 ret->SetConnectivityDirty( true );
575
576 if( IsSelected() || aLine->IsSelected() )
577 ret->SetSelected();
578
579 return ret;
580}
581
582
584{
585 SCH_LINE* newSegment = static_cast<SCH_LINE*>( Duplicate() );
586
587 newSegment->SetStartPoint( aPoint );
588 newSegment->SetConnectivityDirty( true );
589 SetEndPoint( aPoint );
590
591 return newSegment;
592}
593
594
595void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
596{
597 if( IsConnectable() )
598 {
599 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_start );
600 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_end );
601 }
602}
603
604
605bool SCH_LINE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
606 std::vector<DANGLING_END_ITEM>& aItemListByPos,
607 const SCH_SHEET_PATH* aPath )
608{
609 if( !IsConnectable() )
610 return false;
611
612 bool previousStartState = m_startIsDangling;
613 bool previousEndState = m_endIsDangling;
614
616
617 for( auto it = DANGLING_END_ITEM_HELPER::get_lower_pos( aItemListByPos, m_start );
618 it < aItemListByPos.end() && it->GetPosition() == m_start; it++ )
619 {
620 DANGLING_END_ITEM& item = *it;
621
622 if( item.GetItem() == this )
623 continue;
624
625 if( ( IsWire() && item.GetType() != BUS_END && item.GetType() != BUS_ENTRY_END )
626 || ( IsBus() && item.GetType() != WIRE_END && item.GetType() != PIN_END ) )
627 {
628 m_startIsDangling = false;
629 break;
630 }
631 }
632
633 for( auto it = DANGLING_END_ITEM_HELPER::get_lower_pos( aItemListByPos, m_end );
634 it < aItemListByPos.end() && it->GetPosition() == m_end; it++ )
635 {
636 DANGLING_END_ITEM& item = *it;
637
638 if( item.GetItem() == this )
639 continue;
640
641 if( ( IsWire() && item.GetType() != BUS_END && item.GetType() != BUS_ENTRY_END )
642 || ( IsBus() && item.GetType() != WIRE_END && item.GetType() != PIN_END ) )
643 {
644 m_endIsDangling = false;
645 break;
646 }
647 }
648
649 // We only use the bus dangling state for automatic line starting, so we don't care if it
650 // has changed or not (and returning true will result in extra work)
651 if( IsBus() )
652 return false;
653
654 return previousStartState != m_startIsDangling || previousEndState != m_endIsDangling;
655}
656
657
659{
660 if( m_layer == LAYER_WIRE || m_layer == LAYER_BUS )
661 return true;
662
663 return false;
664}
665
666
667bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
668{
669 switch( aItem->Type() )
670 {
671 case SCH_NO_CONNECT_T:
672 case SCH_SYMBOL_T:
673 return IsWire();
674
675 case SCH_JUNCTION_T:
676 case SCH_LABEL_T:
678 case SCH_HIER_LABEL_T:
681 case SCH_SHEET_T:
682 case SCH_SHEET_PIN_T:
683 return IsWire() || IsBus();
684
685 default:
686 return m_layer == aItem->GetLayer();
687 }
688}
689
690
692 const SCH_SHEET_PATH* aInstance ) const
693{
694 // Do not compare to ourself.
695 if( aItem == this || !IsConnectable() )
696 return false;
697
698 const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( aItem );
699
700 // Don't compare against a different SCH_ITEM.
701 wxCHECK( line, false );
702
703 if( GetStartPoint() != line->GetStartPoint() )
704 return true;
705
706 return GetEndPoint() != line->GetEndPoint();
707}
708
709
710std::vector<VECTOR2I> SCH_LINE::GetConnectionPoints() const
711{
712 return { m_start, m_end };
713}
714
715
717{
718 switch( aItem->Type() )
719 {
720 case SCH_LINE_T:
721 return IsBus() == static_cast<const SCH_LINE*>( aItem )->IsBus();
722
723 default:
724 return true;
725 }
726}
727
728
729void SCH_LINE::GetSelectedPoints( std::vector<VECTOR2I>& aPoints ) const
730{
731 if( m_flags & STARTPOINT )
732 aPoints.push_back( m_start );
733
734 if( m_flags & ENDPOINT )
735 aPoints.push_back( m_end );
736}
737
738
739wxString SCH_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
740{
741 wxString txtfmt;
742
743 if( m_start.x == m_end.x )
744 {
745 switch( m_layer )
746 {
747 case LAYER_WIRE: txtfmt = _( "Vertical Wire, length %s" ); break;
748 case LAYER_BUS: txtfmt = _( "Vertical Bus, length %s" ); break;
749 default: txtfmt = _( "Vertical Graphic Line, length %s" ); break;
750 }
751 }
752 else if( m_start.y == m_end.y )
753 {
754 switch( m_layer )
755 {
756 case LAYER_WIRE: txtfmt = _( "Horizontal Wire, length %s" ); break;
757 case LAYER_BUS: txtfmt = _( "Horizontal Bus, length %s" ); break;
758 default: txtfmt = _( "Horizontal Graphic Line, length %s" ); break;
759 }
760 }
761 else
762 {
763 switch( m_layer )
764 {
765 case LAYER_WIRE: txtfmt = _( "Wire, length %s" ); break;
766 case LAYER_BUS: txtfmt = _( "Bus, length %s" ); break;
767 default: txtfmt = _( "Graphic Line, length %s" ); break;
768 }
769 }
770
771 return wxString::Format( txtfmt,
772 aUnitsProvider->MessageTextFromValue( m_start.Distance( m_end ) ) );
773}
774
775
777{
778 if( m_layer == LAYER_NOTES )
779 return BITMAPS::add_dashed_line;
780 else if( m_layer == LAYER_WIRE )
781 return BITMAPS::add_line;
782
783 return BITMAPS::add_bus;
784}
785
786
787bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
788{
789 if( Type() != aItem.Type() )
790 return Type() < aItem.Type();
791
792 const SCH_LINE* line = static_cast<const SCH_LINE*>( &aItem );
793
794 if( GetLayer() != line->GetLayer() )
795 return GetLayer() < line->GetLayer();
796
797 if( GetStartPoint().x != line->GetStartPoint().x )
798 return GetStartPoint().x < line->GetStartPoint().x;
799
800 if( GetStartPoint().y != line->GetStartPoint().y )
801 return GetStartPoint().y < line->GetStartPoint().y;
802
803 if( GetEndPoint().x != line->GetEndPoint().x )
804 return GetEndPoint().x < line->GetEndPoint().x;
805
806 return GetEndPoint().y < line->GetEndPoint().y;
807}
808
809
810bool SCH_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
811{
812 // Performance enhancement for connection-building
813 if( aPosition == m_start || aPosition == m_end )
814 return true;
815
816 if( aAccuracy >= 0 )
817 aAccuracy += GetPenWidth() / 2;
818 else
819 aAccuracy = abs( aAccuracy );
820
821 return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
822}
823
824
825bool SCH_LINE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
826{
828 return false;
829
830 BOX2I rect = aRect;
831
832 if ( aAccuracy )
833 rect.Inflate( aAccuracy );
834
835 if( aContained )
836 return rect.Contains( m_start ) && rect.Contains( m_end );
837
838 return rect.Intersects( m_start, m_end );
839}
840
841
843{
844 SCH_ITEM::SwapFlags( aItem );
845
846 SCH_LINE* item = (SCH_LINE*) aItem;
847
848 std::swap( m_layer, item->m_layer );
849
850 std::swap( m_start, item->m_start );
851 std::swap( m_end, item->m_end );
852 std::swap( m_startIsDangling, item->m_startIsDangling );
853 std::swap( m_endIsDangling, item->m_endIsDangling );
854 std::swap( m_stroke, item->m_stroke );
855}
856
857
858bool SCH_LINE::doIsConnected( const VECTOR2I& aPosition ) const
859{
860 if( m_layer != LAYER_WIRE && m_layer != LAYER_BUS )
861 return false;
862
863 return IsEndPoint( aPosition );
864}
865
866
867void SCH_LINE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
868 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
869{
870 if( aBackground )
871 return;
872
873 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
874 int penWidth = GetEffectivePenWidth( renderSettings );
876
877 if( color == COLOR4D::UNSPECIFIED )
878 color = renderSettings->GetLayerColor( GetLayer() );
879
880 aPlotter->SetColor( color );
881
882 aPlotter->SetCurrentLineWidth( penWidth );
883 aPlotter->SetDash( penWidth, GetEffectiveLineStyle() );
884
885 aPlotter->MoveTo( m_start );
886 aPlotter->FinishTo( m_end );
887
888 aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
889
890 // Plot attributes to a hypertext menu
891 std::vector<wxString> properties;
892 BOX2I bbox = GetBoundingBox();
893 bbox.Inflate( penWidth * 3 );
894
895 if( aPlotOpts.m_PDFPropertyPopups )
896 {
897 if( GetLayer() == LAYER_WIRE )
898 {
899 if( SCH_CONNECTION* connection = Connection() )
900 {
901 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
902 _( "Net" ),
903 connection->Name() ) );
904
905 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
906 _( "Resolved netclass" ),
907 GetEffectiveNetClass()->GetName() ) );
908 }
909 }
910 else if( GetLayer() == LAYER_BUS )
911 {
912 if( SCH_CONNECTION* connection = Connection() )
913 {
914 for( const std::shared_ptr<SCH_CONNECTION>& member : connection->Members() )
915 properties.emplace_back( wxT( "!" ) + member->Name() );
916 }
917
918 }
919
920 if( !properties.empty() )
921 aPlotter->HyperlinkMenu( bbox, properties );
922 }
923}
924
925
926void SCH_LINE::SetPosition( const VECTOR2I& aPosition )
927{
928 m_end = m_end - ( m_start - aPosition );
929 m_start = aPosition;
930}
931
932
933void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
934{
935 wxString msg;
936
937 switch( GetLayer() )
938 {
939 case LAYER_WIRE: msg = _( "Wire" ); break;
940 case LAYER_BUS: msg = _( "Bus" ); break;
941 default: msg = _( "Graphical" ); break;
942 }
943
944 aList.emplace_back( _( "Line Type" ), msg );
945
946 LINE_STYLE lineStyle = GetLineStyle();
947
948 if( GetEffectiveLineStyle() != lineStyle )
949 aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
950 else
951 m_stroke.GetMsgPanelInfo( aFrame, aList, true, false );
952
953 SCH_CONNECTION* conn = nullptr;
954
955 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
956 conn = Connection();
957
958 if( conn )
959 {
960 conn->AppendInfoToMsgPanel( aList );
961
962 if( !conn->IsBus() )
963 {
964 aList.emplace_back( _( "Resolved Netclass" ),
965 UnescapeString( GetEffectiveNetClass()->GetName() ) );
966 }
967 }
968}
969
970
972{
973 return ( GetLayer() == LAYER_NOTES );
974}
975
976
978{
979 return ( GetLayer() == LAYER_WIRE );
980}
981
982
983bool SCH_LINE::IsBus() const
984{
985 return ( GetLayer() == LAYER_BUS );
986}
987
988
989bool SCH_LINE::operator==( const SCH_ITEM& aOther ) const
990{
991 if( Type() != aOther.Type() )
992 return false;
993
994 const SCH_LINE& other = static_cast<const SCH_LINE&>( aOther );
995
996 if( GetLayer() != other.GetLayer() )
997 return false;
998
999 if( m_start != other.m_start )
1000 return false;
1001
1002 if( m_end != other.m_end )
1003 return false;
1004
1005 if( m_stroke.GetWidth() != other.m_stroke.GetWidth() )
1006 return false;
1007
1008 if( m_stroke.GetColor() != other.m_stroke.GetColor() )
1009 return false;
1010
1011 if( m_stroke.GetLineStyle() != other.m_stroke.GetLineStyle() )
1012 return false;
1013
1014 return true;
1015}
1016
1017
1018double SCH_LINE::Similarity( const SCH_ITEM& aOther ) const
1019{
1020 if( m_Uuid == aOther.m_Uuid )
1021 return 1.0;
1022
1023 if( Type() != aOther.Type() )
1024 return 0.0;
1025
1026 const SCH_LINE& other = static_cast<const SCH_LINE&>( aOther );
1027
1028 if( GetLayer() != other.GetLayer() )
1029 return 0.0;
1030
1031 double similarity = 1.0;
1032
1033 if( m_start != other.m_start )
1034 similarity *= 0.9;
1035
1036 if( m_end != other.m_end )
1037 similarity *= 0.9;
1038
1039 if( m_stroke.GetWidth() != other.m_stroke.GetWidth() )
1040 similarity *= 0.9;
1041
1042 if( m_stroke.GetColor() != other.m_stroke.GetColor() )
1043 similarity *= 0.9;
1044
1045 if( m_stroke.GetLineStyle() != other.m_stroke.GetLineStyle() )
1046 similarity *= 0.9;
1047
1048 return similarity;
1049}
1050
1051
1052static struct SCH_LINE_DESC
1053{
1055 {
1057
1058 if( plotDashTypeEnum.Choices().GetCount() == 0 )
1059 {
1060 plotDashTypeEnum.Map( LINE_STYLE::DEFAULT, _HKI( "Default" ) )
1061 .Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
1062 .Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
1063 .Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
1064 .Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
1065 .Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
1066 }
1067
1071
1072 void ( SCH_LINE::*lineStyleSetter )( LINE_STYLE ) = &SCH_LINE::SetLineStyle;
1073
1074 propMgr.AddProperty( new PROPERTY_ENUM<SCH_LINE, LINE_STYLE>( _HKI( "Line Style" ),
1075 lineStyleSetter, &SCH_LINE::GetLineStyle ) );
1076
1077 propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Line Width" ),
1078 &SCH_LINE::SetLineWidth, &SCH_LINE::GetLineWidth, PROPERTY_DISPLAY::PT_SIZE ) );
1079
1080 propMgr.AddProperty( new PROPERTY<SCH_LINE, COLOR4D>( _HKI( "Color" ),
1082 }
int color
Definition: DXF_plotter.cpp:58
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition: box2.h:990
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 bool Contains(const Vec &aPoint) const
Definition: box2.h:168
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:311
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition: sch_item.cpp:594
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:95
DANGLING_END_T GetType() const
Definition: sch_item.h:131
EDA_ITEM * GetItem() const
Definition: sch_item.h:129
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
const KIID m_Uuid
Definition: eda_item.h:489
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:499
bool IsSelected() const
Definition: eda_item.h:110
void SetSelected()
Definition: eda_item.h:119
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:669
static ENUM_MAP< T > & Instance()
Definition: property.h:663
wxPGChoices & Choices()
Definition: property.h:712
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
double a
Alpha component.
Definition: color4d.h:395
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
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:49
std::string AsStdString() const
Definition: kiid.cpp:244
Base plotter engine class.
Definition: plotter.h:105
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:244
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:254
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:465
virtual void SetColor(const COLOR4D &color)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:85
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:87
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Holds all the data relating to one schematic.
Definition: schematic.h:77
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:314
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.
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition: sch_item.h:670
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:150
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:250
void SetLayer(SCH_LAYER_ID aLayer)
Definition: sch_item.h:282
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:281
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:512
bool IsConnectivityDirty() const
Definition: sch_item.h:510
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:354
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:221
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition: sch_item.cpp:475
SCH_LAYER_ID m_layer
Definition: sch_item.h:723
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:131
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:41
int GetPenWidth() const override
Definition: sch_line.cpp:328
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_line.cpp:858
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:595
void SetStartPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:137
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_line.cpp:149
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_line.cpp:776
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:605
bool m_startIsDangling
True if start point is not connected.
Definition: sch_line.h:345
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:810
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_line.cpp:926
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_line.cpp:710
int GetReverseAngleFrom(const VECTOR2I &aPoint) const
Definition: sch_line.cpp:436
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: sch_line.cpp:202
SCH_LINE(const VECTOR2I &pos=VECTOR2I(0, 0), int layer=LAYER_NOTES)
Definition: sch_line.cpp:45
bool IsWire() const
Return true if the line is a wire.
Definition: sch_line.cpp:977
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_line.cpp:227
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_line.cpp:191
void SetLineColor(const COLOR4D &aColor)
Definition: sch_line.cpp:249
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_line.cpp:667
bool IsParallel(const SCH_LINE *aLine) const
Definition: sch_line.cpp:449
void SetLineWidth(const int aSize)
Definition: sch_line.cpp:321
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_line.cpp:403
int GetAngleFrom(const VECTOR2I &aPoint) const
Definition: sch_line.cpp:423
void GetSelectedPoints(std::vector< VECTOR2I > &aPoints) const
Definition: sch_line.cpp:729
COLOR4D m_lastResolvedColor
Definition: sch_line.h:357
LINE_STYLE GetEffectiveLineStyle() const
Definition: sch_line.cpp:308
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.
Definition: sch_line.cpp:933
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.
Definition: sch_line.cpp:867
wxString m_operatingPoint
Definition: sch_line.h:359
wxString GetClass() const override
Return the class name.
Definition: sch_line.h:63
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_line.cpp:413
VECTOR2I GetEndPoint() const
Definition: sch_line.h:141
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:716
LINE_STYLE m_lastResolvedLineStyle
Definition: sch_line.h:355
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:462
VECTOR2I m_start
Line start point.
Definition: sch_line.h:347
bool IsBus() const
Return true if the line is a bus.
Definition: sch_line.cpp:983
int m_lastResolvedWidth
Definition: sch_line.h:356
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
Definition: sch_line.cpp:362
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:691
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_line.cpp:95
void SetLineStyle(const LINE_STYLE aStyle)
Definition: sch_line.cpp:292
VECTOR2I m_end
Line end point.
Definition: sch_line.h:348
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_line.cpp:155
LINE_STYLE GetLineStyle() const
Definition: sch_line.cpp:299
void MoveEnd(const VECTOR2I &aMoveVector)
Definition: sch_line.cpp:168
STROKE_PARAMS m_stroke
Line stroke properties.
Definition: sch_line.h:350
bool m_endIsDangling
True if end point is not connected.
Definition: sch_line.h:346
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_line.cpp:842
bool IsConnectable() const override
Definition: sch_line.cpp:658
wxString GetFriendlyName() const override
Definition: sch_line.cpp:138
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_line.cpp:393
bool operator==(const SCH_ITEM &aOther) const override
Definition: sch_line.cpp:989
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_line.cpp:787
bool IsEndPoint(const VECTOR2I &aPoint) const
Definition: sch_line.h:90
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_line.cpp:739
bool IsGraphicLine() const
Return if the line is a graphic (non electrical line)
Definition: sch_line.cpp:971
int GetLineWidth() const
Definition: sch_line.h:181
COLOR4D GetLineColor() const
Returns COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.
Definition: sch_line.cpp:273
void MoveStart(const VECTOR2I &aMoveVector)
Definition: sch_line.cpp:162
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_line.cpp:109
double GetLength() const
Definition: sch_line.cpp:243
SCH_LINE * BreakAt(const VECTOR2I &aPoint)
Break this segment into two at the specified point.
Definition: sch_line.cpp:583
void SetEndPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:142
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: sch_line.cpp:1018
bool IsJunction(const VECTOR2I &aPosition) const
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:479
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:89
void SetLineStyle(LINE_STYLE aLineStyle)
Definition: stroke_params.h:93
void SetWidth(int aWidth)
Definition: stroke_params.h:90
void SetColor(const KIGFX::COLOR4D &aColor)
Definition: stroke_params.h:96
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
LINE_STYLE GetLineStyle() const
Definition: stroke_params.h:92
KIGFX::COLOR4D GetColor() const
Definition: stroke_params.h:95
static void Stroke(const SHAPE *aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, const std::function< void(const VECTOR2I &a, const VECTOR2I &b)> &aStroker)
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
Definition: vector2d.h:557
#define DEFAULT_BUS_WIDTH_MILS
The default noconnect size in mils.
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _HKI(x)
#define _(s)
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:403
static constexpr EDA_ANGLE ANGLE_270
Definition: eda_angle.h:406
#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.
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:353
@ LAYER_DANGLING
Definition: layer_ids.h:381
@ LAYER_WIRE
Definition: layer_ids.h:356
@ LAYER_NOTES
Definition: layer_ids.h:371
@ LAYER_NET_COLOR_HIGHLIGHT
Definition: layer_ids.h:396
@ LAYER_BUS
Definition: layer_ids.h:357
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:397
@ LAYER_OP_VOLTAGES
Definition: layer_ids.h:403
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:45
VECTOR2I UnpackVector2(const types::Vector2 &aInput)
Definition: api_utils.cpp:76
void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput)
Definition: api_utils.cpp:69
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:390
#define TYPE_HASH(x)
Definition: property.h:71
#define REGISTER_TYPE(x)
Definition: property_mgr.h:371
@ BUS_END
Definition: sch_item.h:79
@ PIN_END
Definition: sch_item.h:81
@ BUS_ENTRY_END
Definition: sch_item.h:83
@ WIRE_END
Definition: sch_item.h:78
static struct SCH_LINE_DESC _SCH_LINE_DESC
wxString UnescapeString(const wxString &aSource)
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:46
constexpr int MilsToIU(int mils) const
Definition: base_units.h:93
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
bool m_PDFPropertyPopups
Definition: sch_plotter.h:91
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
@ SCH_LINE_T
Definition: typeinfo.h:163
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:160
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:171
@ SCH_LABEL_T
Definition: typeinfo.h:167
@ SCH_SHEET_T
Definition: typeinfo.h:174
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:169
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:173
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:161
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:168
@ SCH_JUNCTION_T
Definition: typeinfo.h:159
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691