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