44#include <api/schematic/schematic_types.pb.h>
137 kiapi::schematic::types::SchematicLine line;
138 types::StrokeAttributes* stroke = line.mutable_stroke();
140 line.mutable_id()->set_value(
m_Uuid.AsStdString() );
143 line.set_locked(
IsLocked() ? types::LockedState::LS_LOCKED : types::LockedState::LS_UNLOCKED );
154 line.set_type( kiapi::schematic::types::SLT_WIRE );
158 line.set_type( kiapi::schematic::types::SLT_BUS );
162 line.set_type( kiapi::schematic::types::SLT_GRAPHIC );
166 line.set_type( kiapi::schematic::types::SLT_UNKNOWN );
178 if( !aContainer.PackFrom( line ) )
179 wxFAIL_MSG( wxT(
"Failed to pack SCH_LINE" ) );
187 kiapi::schematic::types::SchematicLine line;
189 if( !aContainer.UnpackTo( &line ) )
195 SetLocked( line.locked() == types::LockedState::LS_LOCKED );
201 if( line.stroke().has_color() )
206 switch( line.type() )
208 case kiapi::schematic::types::SLT_WIRE:
212 case kiapi::schematic::types::SLT_BUS:
217 case kiapi::schematic::types::SLT_GRAPHIC:
238 default:
return _(
"Graphic Line" );
270void SCH_LINE::Show(
int nestLevel, std::ostream& os )
const
272 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
273 <<
" layer=\"" <<
m_layer <<
'"'
275 <<
'"' <<
" endIsDangling=\""
277 <<
" <start" <<
m_start <<
"/>"
278 <<
" <end" <<
m_end <<
"/>" <<
"</"
279 <<
GetClass().Lower().mb_str() <<
">\n";
332 EDA_SHAPE tempShape = makeLineEndingShape( *
this );
336 ret.
Merge( endingsBBox );
358 if( currentLength <= 0.0 )
365 double scale = aLength / currentLength;
458 return schematic->Settings().m_DefaultLineWidth;
516 vec =
m_end - aPoint;
528 if( aPoint ==
m_end )
531 vec =
m_end - aPoint;
539 wxCHECK_MSG( aLine !=
nullptr && aLine->
Type() ==
SCH_LINE_T,
false,
540 wxT(
"Cannot test line segment for overlap." ) );
546 return !( (
long long) firstSeg.
x * secondSeg.
y - (
long long) firstSeg.
y * secondSeg.
x );
556 return lhs.
y < rhs.y;
558 return lhs.
x < rhs.x;
561 wxCHECK_MSG( aLine !=
nullptr && aLine->
Type() ==
SCH_LINE_T,
nullptr,
562 wxT(
"Cannot test line segment for overlap." ) );
574 if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) )
575 std::swap( leftmost_start, leftmost_end );
576 if( rightmost_start != std::min( { rightmost_start, rightmost_end }, less ) )
577 std::swap( rightmost_start, rightmost_end );
583 if( less( rightmost_start, leftmost_start ) )
585 std::swap( leftmost_start, rightmost_start );
586 std::swap( leftmost_end, rightmost_end );
589 VECTOR2I other_start = rightmost_start;
592 if( less( rightmost_end, leftmost_end ) )
594 rightmost_start = leftmost_start;
595 rightmost_end = leftmost_end;
599 if( less( leftmost_end, other_start ) )
605 if( ( leftmost_start == other_start ) && ( leftmost_end == other_end ) )
619 bool colinear =
false;
622 if( ( leftmost_start.
y == leftmost_end.
y ) &&
623 ( other_start.
y == other_end.
y ) )
625 colinear = ( leftmost_start.
y == other_start.
y );
627 else if( ( leftmost_start.
x == leftmost_end.
x ) &&
628 ( other_start.
x == other_end.
x ) )
630 colinear = ( leftmost_start.
x == other_start.
x );
638 long long dx = leftmost_end.
x - leftmost_start.
x;
639 long long dy = leftmost_end.
y - leftmost_start.
y;
640 colinear = ( ( ( other_start.
y - leftmost_start.
y ) * dx ==
641 ( other_start.
x - leftmost_start.
x ) * dy ) &&
642 ( ( other_end.
y - leftmost_start.
y ) * dx ==
643 ( other_end.
x - leftmost_start.
x ) * dy ) );
652 bool touching = leftmost_end == rightmost_start;
654 if( touching && aCheckJunctions && aScreen->
IsJunction( leftmost_end ) )
658 leftmost_end = rightmost_end;
708 std::vector<DANGLING_END_ITEM>& aItemListByPos,
720 it < aItemListByPos.end() && it->GetPosition() ==
m_start; it++ )
736 it < aItemListByPos.end() && it->GetPosition() ==
m_end; it++ )
771 switch( aItem->
Type() )
802 wxCHECK( line,
false );
819 switch( aItem->
Type() )
836 aPoints.push_back(
m_end );
848 case LAYER_WIRE: txtfmt =
_(
"Vertical Wire, length %s" );
break;
849 case LAYER_BUS: txtfmt =
_(
"Vertical Bus, length %s" );
break;
850 default: txtfmt =
_(
"Vertical Graphic Line, length %s" );
break;
857 case LAYER_WIRE: txtfmt =
_(
"Horizontal Wire, length %s" );
break;
858 case LAYER_BUS: txtfmt =
_(
"Horizontal Bus, length %s" );
break;
859 default: txtfmt =
_(
"Horizontal Graphic Line, length %s" );
break;
866 case LAYER_WIRE: txtfmt =
_(
"Wire, length %s" );
break;
867 case LAYER_BUS: txtfmt =
_(
"Bus, length %s" );
break;
868 default: txtfmt =
_(
"Graphic Line, length %s" );
break;
918 EDA_SHAPE tempShape = makeLineEndingShape( *
this );
920 const SHAPE& hitShape = shape;
921 int accuracy = aAccuracy >= 0 ? aAccuracy : abs( aAccuracy );
929 aAccuracy = abs( aAccuracy );
943 rect.Inflate( aAccuracy );
947 EDA_SHAPE tempShape = makeLineEndingShape( *
this );
968 EDA_SHAPE tempShape = makeLineEndingShape( *
this );
1003 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
1025 bool drawLineBody =
true;
1035 aPlotter->
MoveTo( plotStart );
1049 std::vector<wxString> properties;
1059 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
1063 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
1064 _(
"Resolved netclass" ),
1071 properties.emplace_back( wxT(
"!" ) + member );
1074 if( !properties.empty() )
1095 default: msg =
_(
"Graphical" );
break;
1098 aList.emplace_back(
_(
"Line Type" ), msg );
1103 aList.emplace_back(
_(
"Line Style" ),
_(
"from netclass" ) );
1105 m_stroke.GetMsgPanelInfo( aFrame, aList,
true,
false );
1187 double similarity = 1.0;
1221 if( isMeVertical && !isCandidateVertical )
1224 if( isCandidateVertical && !isMeVertical )
1232 if( fabs( slopeMe ) == fabs( slopeCandidate ) )
1233 return slopeMe < slopeCandidate;
1235 return fabs( slopeMe ) < fabs( slopeCandidate );
1245 std::vector<VECTOR3I> wire_shape;
1255 std::vector<SCH_LINE*> existingWires;
1256 std::vector<VECTOR2I> intersections;
1263 existingWires.push_back( line );
1269 for(
SCH_LINE* existingLine : existingWires )
1271 VECTOR2I extLineStartPoint = existingLine->GetStartPoint();
1272 VECTOR2I extLineEndPoint = existingLine->GetEndPoint();
1274 if( extLineStartPoint == currentLineStartPoint && extLineEndPoint == currentLineEndPoint )
1280 SEG currentSegment =
SEG( currentLineStartPoint, currentLineEndPoint );
1281 SEG existingSegment =
SEG( extLineStartPoint, extLineEndPoint );
1291 if( intersections.size() == 0 || intersections.back() != *
intersect )
1296 if( intersections.empty() )
1298 wire_shape.emplace_back( currentLineStartPoint.
x, currentLineStartPoint.
y, 0 );
1299 wire_shape.emplace_back( currentLineEndPoint.
x, currentLineEndPoint.
y, 0 );
1306 return std::sqrt( std::pow( a.
x - b.x, 2 ) + std::pow( a.
y - b.y, 2 ) );
1309 std::sort( intersections.begin(), intersections.end(),
1312 return getDistance( GetStartPoint(), a ) < getDistance( GetStartPoint(), b );
1316 double R = aArcRadius;
1318 for(
const VECTOR2I& hopMid : intersections )
1326 double arcAngle = lineAngle;
1328 if( arcAngle < 0.0 )
1330 else if( arcAngle >=
M_PI )
1333 VECTOR2I arcMidPoint = { hopMid.x +
static_cast<int>( R * std::sin( arcAngle ) ),
1334 hopMid.y -
static_cast<int>( R * std::cos( arcAngle ) ) };
1336 VECTOR2I beforeHop = hopMid -
KiROUND( R * std::cos( lineAngle ), R * std::sin( lineAngle ) );
1337 VECTOR2I afterHop = hopMid +
KiROUND( R * std::cos( lineAngle ), R * std::sin( lineAngle ) );
1340 wire_shape.emplace_back( currentStart.
x, currentStart.
y, 0 );
1341 wire_shape.emplace_back( beforeHop.
x, beforeHop.
y, 0 );
1344 wire_shape.emplace_back( beforeHop.
x, beforeHop.
y, 1 );
1345 wire_shape.emplace_back( arcMidPoint.
x, arcMidPoint.
y, 1 );
1346 wire_shape.emplace_back( afterHop.
x, afterHop.
y, 1 );
1348 currentStart = afterHop;
1352 wire_shape.emplace_back( currentStart. x,currentStart.
y, 0 );
1366 if( endingStyleEnum.
Choices().GetCount() == 0 )
1377 if( lineStyleEnum.
Choices().GetCount() == 0 )
1388 if( wireLineStyleEnum.
Choices().GetCount() == 0 )
1402 auto isGraphicLine =
1406 return line->IsGraphicLine();
1415 return line->IsWire() || line->IsBus();
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Helper class used to store the state of schematic items that can be connected to other schematic item...
DANGLING_END_T GetType() const
EDA_ITEM * GetItem() const
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
EDA_GROUP * m_group
The group this item belongs to, if any. No ownership implied.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
static bool ShortenSegmentForEndings(VECTOR2I &aStart, VECTOR2I &aEnd, const LINE_ENDING &aStartEnding, const LINE_ENDING &aEndEnding, int aLineWidth)
Shorten a segment body for line endings.
bool GetLineEndingsBoundingBox(BOX2I &aBBox, int aLineWidth) const
std::vector< SHAPE * > MakeEffectiveShapesWithLineEndings(int aLineWidth) const
Make effective geometry for the shape body shortened for line endings plus the line-ending geometry i...
EE_TYPE Overlapping(const BOX2I &aRect) const
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
Class that other classes need to inherit from, in order to be inspectable.
A color representation with 4 components: red, green, blue, alpha.
std::shared_ptr< wxString > m_text
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.
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Decorative shape (arrowhead, circle, square) at the start or end of a graphic line,...
void Plot(PLOTTER *aPlotter, const VECTOR2I &aPoint, const EDA_ANGLE &aTangent, int aLineWidth, void *aData=nullptr) const
COLOR4D GetSchematicColor(bool aIsForSave=false) const
Base plotter engine class.
void MoveTo(const VECTOR2I &pos)
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
void FinishTo(const VECTOR2I &pos)
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.
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.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Holds all the data relating to one schematic.
Commit for the schematic and symbol editors.
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
void SetLocked(bool aLocked) override
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
bool IsLocked() const override
std::vector< wxString > GetBusMemberNames(const SCH_SHEET_PATH *aSheet=nullptr) const
Names of the bus members of this item's connection, empty when it does not have a bus.
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
bool m_connectivity_dirty
void SetLayer(SCH_LAYER_ID aLayer)
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
void SetConnectivityDirty(bool aDirty=true)
Set the dirty flag.
bool IsConnectivityDirty() const
std::optional< wxString > GetConnectionName(const SCH_SHEET_PATH *aSheet=nullptr, bool aLocal=false, bool aIgnoreSheet=false) const
Return the active connection name; absent for missing or stale published rows.
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Segment description base class to describe items which have 2 end points (track, wire,...
int GetPenWidth() const override
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
int GetStartEndingStrokeWidth() const
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
void SetStartPoint(const VECTOR2I &aPosition)
void SetEndEnding(const LINE_ENDING &aEnding)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &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.
bool m_startIsDangling
True if start point is not connected.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetPosition(const VECTOR2I &aPosition) override
void SetEndEndingStyle(LINE_ENDING_STYLE aStyle)
std::vector< VECTOR3I > BuildWireWithHopShape(const SCH_SCREEN *aScreen, double aArcRadius) const
For wires only: build the list of points to draw the shape using segments and 180 deg arcs Points are...
SCH_LINE * NonGroupAware_BreakAt(const VECTOR2I &aPoint)
This version should only be used when importing files.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
int GetReverseAngleFrom(const VECTOR2I &aPoint) const
SCH_LINE(const VECTOR2I &pos=VECTOR2I(0, 0), int layer=LAYER_NOTES)
bool IsWire() const
Return true if the line is a wire.
void SetStartEndingStyle(LINE_ENDING_STYLE aStyle)
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetEndEndingWidth(int aWidth)
void SetWireStyle(const WIRE_STYLE aStyle)
bool CanConnect(const SCH_ITEM *aItem) const override
bool IsParallel(const SCH_LINE *aLine) const
int GetEndEndingLength() const
void SetLineWidth(const int aSize)
bool ShouldHopOver(const SCH_LINE *aLine) const
For wires only:
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
virtual STROKE_PARAMS GetStroke() const override
LINE_ENDING m_startEnding
Line ending at start point.
int GetAngleFrom(const VECTOR2I &aPoint) const
void GetSelectedPoints(std::vector< VECTOR2I > &aPoints) const
LINE_STYLE GetEffectiveLineStyle() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void SetEndEndingStrokeWidth(int aWidth)
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
wxString m_operatingPoint
void SetLength(double aLength)
const LINE_ENDING & GetEndEnding() const
wxString GetClass() const override
Return the class name.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
LINE_STYLE m_lastResolvedLineStyle
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.
int GetEndEndingWidth() const
int GetStartEndingWidth() const
VECTOR2I m_start
Line start point.
bool IsBus() const
Return true if the line is a bus.
void SetStartEndingLength(int aLength)
LINE_ENDING m_endEnding
Line ending at end point.
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
LINE_ENDING_STYLE GetEndEndingStyle() const
void SetLineStyle(const LINE_STYLE aStyle)
VECTOR2I m_end
Line end point.
void SetEndEndingLength(int aLength)
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
LINE_STYLE GetLineStyle() const
void SetStartEndingWidth(int aWidth)
int GetEndEndingStrokeWidth() const
LINE_ENDING_STYLE GetStartEndingStyle() const
void SetStartEnding(const LINE_ENDING &aEnding)
void MoveEnd(const VECTOR2I &aMoveVector)
KIGFX::COLOR4D m_lastResolvedColor
STROKE_PARAMS m_stroke
Line stroke properties.
SCH_LINE * BreakAt(SCH_COMMIT *aCommit, const VECTOR2I &aPoint)
Break this segment into two at the specified point.
bool m_endIsDangling
True if end point is not connected.
bool IsConnectable() const override
wxString GetFriendlyName() const override
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool operator==(const SCH_ITEM &aOther) const override
bool operator<(const SCH_ITEM &aItem) const override
WIRE_STYLE GetWireStyle() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool IsEndPoint(const VECTOR2I &aPoint) const override
Test if aPt is an end point of this schematic object.
bool IsGraphicLine() const
Return if the line is a graphic (non electrical line)
KIGFX::COLOR4D GetLineColor() const
Return COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
void MoveStart(const VECTOR2I &aMoveVector)
void SetLineColor(const KIGFX::COLOR4D &aColor)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetStartEndingStrokeWidth(int aWidth)
const LINE_ENDING & GetStartEnding() const
int GetStartEndingLength() const
void SetEndPoint(const VECTOR2I &aPosition)
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
A net chain is a collection of nets that are connected together through passive components.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
bool IsJunction(const VECTOR2I &aPosition) const
Test if a junction is required for the items at aPosition on the screen.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
OPT_VECTOR2I Intersect(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
Compute intersection point of segment (this) with segment aSeg.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
An abstract shape on 2D plane.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
LINE_STYLE GetLineStyle() const
KIGFX::COLOR4D GetColor() const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
#define DEFAULT_BUS_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
#define DEFAULT_WIRE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define DEFAULT_LINE_WIDTH_MILS
The default line width in mils. (can be changed in preference menu)
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
#define STRUCT_DELETED
flag indication structures to be erased
#define ENDPOINT
ends. (Used to support dragging.)
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define STARTPOINT
When a line is selected, these flags indicate which.
static bool hasLineEnding(const LINE_ENDING &aStartEnding, const LINE_ENDING &aEndEnding)
a few functions useful in geometry calculations.
@ LAYER_NET_COLOR_HIGHLIGHT
@ LAYER_SELECTION_SHADOWS
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
bool ShapeHitTest(const SHAPE_LINE_CHAIN &aHitter, const SHAPE &aHittee, bool aHitteeContained)
Perform a shape-to-shape hit test.
SHAPE_LINE_CHAIN BoxToLineChain(const BOX2I &aBox)
Get a SHAPE_LINE_CHAIN representing the outline of a box.
std::optional< wxString > AppendConnectionInfo(const SCH_ITEM &aItem, std::vector< MSG_PANEL_ITEM > &aList, const SCH_SHEET_PATH *aPath=nullptr)
Append connection details; return its name for a signal, or no value for a bus/missing row.
KICOMMON_API void PackLineEnding(types::LineEnding &aOutput, const LINE_ENDING &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackColor(types::Color &aOutput, const KIGFX::COLOR4D &aInput)
KICOMMON_API int UnpackDistance(const types::Distance &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API LINE_ENDING UnpackLineEnding(const types::LineEnding &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API KIGFX::COLOR4D UnpackColor(const types::Color &aInput)
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackDistance(types::Distance &aOutput, int aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
static bool intersect(const SEGMENT_WITH_NORMALS &aSeg, const SFVEC2F &aStart, const SFVEC2F &aEnd)
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
#define IMPLEMENT_ENUM_TO_WXANY(type)
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
@ PT_SIZE
Size expressed in distance units (mm/inch)
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
static struct SCH_LINE_DESC _SCH_LINE_DESC
std::optional< VECTOR2I > OPT_VECTOR2I
Utility functions for working with shapes.
wxString UnescapeString(const wxString &aSource)
LINE_STYLE
Dashed line types.
const SHAPE_LINE_CHAIN chain
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.
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.
VECTOR2< int32_t > VECTOR2I
static PIECE rect(double aLeft, double aTop, double aRight, double aBottom, bool aMixed=false)