88 default: wxFAIL_MSG( wxT(
"SCH_BUS_WIRE_ENTRY ctor: unexpected quadrant" ) );
127 return (
m_pos == aPosition ||
GetEnd() == aPosition );
140 wxCHECK_RET( item, wxT(
"Cannot swap bus entry data with invalid item." ) );
250 aItemList.push_back( item );
253 aItemList.push_back( item1 );
260 aItemList.push_back( item );
263 aItemList.push_back( item1 );
272 wxPoint start =
m_pos + aOffset;
273 wxPoint end =
GetEnd() + aOffset;
278 GRLine(
nullptr, DC, start.x, start.y, end.x, end.y, penWidth,
color );
282 EDA_RECT clip( (wxPoint) start, wxSize( end.x - start.x, end.y - start.y ) );
285 double theta = atan2( end.y - start.y, end.x - start.x );
303 for(
size_t i = 0; i < 10000; ++i )
307 wxPoint
next( start.x + strokes[ i % 4 ] * cos( theta ),
308 start.y + strokes[ i % 4 ] * sin( theta ) );
314 if(
ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
316 else if( i % 2 == 0 )
317 GRLine(
nullptr, DC, segStart.x, segStart.y, segEnd.x, segEnd.y, penWidth,
color );
355 bool has_wire[2] = {
false };
356 bool has_bus[2] = {
false };
358 for(
unsigned ii = 0; ii < aItemList.size(); ii++ )
394 if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
396 else if( has_wire[0] || has_bus[0] )
398 else if( has_wire[1] || has_bus[1] )
413 for(
unsigned ii = 0; ii < aItemList.size(); ii++ )
457 return wxString(
_(
"Bus to Wire Entry" ) );
463 return wxString(
_(
"Bus to Bus Entry" ) );
504 auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->
RenderSettings() );
510 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
521 std::vector<MSG_PANEL_ITEM>& aList )
532 aList.emplace_back(
_(
"Bus Entry Type" ), msg );
546 wxString netname = conn->
Name();
552 aList.emplace_back(
_(
"Assigned Netclass" ), netclassName );
563 auto symbol = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
565 if(
GetLayer() != symbol->GetLayer() )
566 return GetLayer() < symbol->GetLayer();
574 if(
GetEnd().x != symbol->GetEnd().x )
575 return GetEnd().x < symbol->GetEnd().x;
577 return GetEnd().y < symbol->GetEnd().y;
586 ( static_cast<const SCH_LINE*>( aItem )->GetLayer() ==
LAYER_BUS ) )
void FinishTo(const wxPoint &pos)
std::map< wxString, wxString > m_NetClassAssignments
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
void SetWidth(int aWidth)
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
wxPoint GetPosition() const
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
#define DEFAULT_SCH_ENTRY_SIZE
The default text size in mils. (can be changed in preference menu)
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
SCH_ITEM * m_connected_bus_item
Pointer to the bus item (usually a bus wire) connected to this bus-wire entry, if it is connected to ...
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
SCH_ITEM * m_connected_bus_items[2]
Pointer to the bus items (usually bus wires) connected to this bus-bus entry (either or both may be n...
SCH_BUS_BUS_ENTRY(const wxPoint &pos=wxPoint(0, 0), bool aFlipY=false)
static bool IsBusLabel(const wxString &aLabel)
Test if aLabel has a bus notation.
bool IsConnectable() const override
virtual PROJECT_FILE & GetProjectFile() const
SCH_BUS_ENTRY_BASE(KICAD_T aType, const wxPoint &pos=wxPoint(0, 0), bool aFlipY=false)
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
SCH_BUS_WIRE_ENTRY(const wxPoint &pos=wxPoint(0, 0), bool aFlipY=false)
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
void SetOrigin(const wxPoint &pos)
NET_SETTINGS & NetSettings()
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void RotatePoint(int *pX, int *pY, double angle)
The base class for create windows for drawing purpose.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool Contains(const wxPoint &aPoint) const
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
bool ClipLine(const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
bool IsConnectivityDirty() const
COLOR4D m_lastResolvedColor
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Base class for a bus or wire entry.
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
PLOT_DASH_TYPE GetStrokeStyle() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
NETCLASSPTR NetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool IsDangling() const override
wxString Name(bool aIgnoreSheet=false) const
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
constexpr double dot_mark_len(double aLineWidth)
Dashed and dotted line patterns.
void SetEnd(int x, int y)
bool TestSegmentHit(const wxPoint &aRefPoint, const wxPoint &aStart, const wxPoint &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
PLOT_DASH_TYPE m_lastResolvedLineStyle
EDA_ITEM * GetItem() const
PLOT_DASH_TYPE GetPlotStyle() const
NET_SETTINGS stores various net-related settings in a project context.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
wxDC * GetPrintDC() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
constexpr double dash_gap_len(double aLineWidth)
NETCLASS * GetDefaultPtr() const
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
virtual int GetPenWidth() const
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual void SetColor(const COLOR4D &color)=0
PLOT_DASH_TYPE
Dashed line types.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
void MoveTo(const wxPoint &pos)
void Normalize()
Ensures that the height ant width are positive.
Base plotter engine class.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
const wxString GetName() const
RENDER_SETTINGS * RenderSettings()
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
BITMAPS
A list of all bitmap identifiers.
int GetPenWidth() const override
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Handle the component boundary box.
DANGLING_END_T GetType() const
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
A base class for most all the KiCad significant classes used in schematics and boards.
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
int GetDefaultPenWidth() const
void SetColor(const COLOR4D &aColor)
COLOR4D GetStrokeColor() const
bool operator<(const SCH_ITEM &aItem) const override
Helper class used to store the state of schematic items that can be connected to other schematic item...
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.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
constexpr double dash_mark_len(double aLineWidth)
virtual void SetDash(PLOT_DASH_TYPE dashed)=0
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
int GetPenWidth() const override
KICAD_T Type() const
Returns the type of object.
A color representation with 4 components: red, green, blue, alpha.
wxPoint GetPosition() const override