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