86 return (
m_pos == aPosition ||
GetEnd() == aPosition );
99 wxCHECK_RET( item, wxT(
"Cannot swap bus entry data with invalid item." ) );
133 if( netclass && netclass->GetSchematicColor() != COLOR4D::UNSPECIFIED )
134 return netclass->GetSchematicColor();
156 return netclass->GetWireWidth();
170 return netclass->GetBusWidth();
182 aItemList.push_back( item );
185 aItemList.push_back( item1 );
192 aItemList.push_back( item );
195 aItemList.push_back( item1 );
204 wxPoint start =
m_pos + aOffset;
205 wxPoint end =
GetEnd() + aOffset;
210 GRLine(
nullptr, DC, start.x, start.y, end.x, end.y, penWidth,
color );
214 EDA_RECT clip( (wxPoint) start, wxSize( end.x - start.x, end.y - start.y ) );
217 double theta = atan2( end.y - start.y, end.x - start.x );
235 for(
size_t i = 0; i < 10000; ++i )
239 wxPoint
next( start.x + strokes[ i % 4 ] * cos( theta ),
240 start.y + strokes[ i % 4 ] * sin( theta ) );
246 if(
ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
248 else if( i % 2 == 0 )
249 GRLine(
nullptr, DC, segStart.x, segStart.y, segEnd.x, segEnd.y, penWidth,
color );
292 bool has_wire[2] = {
false };
293 bool has_bus[2] = {
false };
297 if( each_item.GetItem() == this )
300 switch( each_item.GetType() )
304 if(
m_pos == each_item.GetPosition() )
306 else if(
GetEnd() == each_item.GetPosition() )
312 seg_start = each_item.GetPosition();
330 if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
332 else if( has_wire[0] || has_bus[0] )
334 else if( has_wire[1] || has_bus[1] )
356 if( each_item.GetItem() == this )
359 switch( each_item.GetType() )
362 seg_start = each_item.GetPosition();
393 return wxString(
_(
"Bus to Wire Entry" ) );
399 return wxString(
_(
"Bus to Bus Entry" ) );
440 auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->
RenderSettings() );
446 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
475 conn->AppendInfoToMsgPanel( aList );
484 auto component = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
486 if(
GetLayer() != component->GetLayer() )
487 return GetLayer() < component->GetLayer();
489 if(
GetPosition().x != component->GetPosition().x )
490 return GetPosition().x < component->GetPosition().x;
492 if(
GetPosition().y != component->GetPosition().y )
493 return GetPosition().y < component->GetPosition().y;
495 if(
GetEnd().x != component->GetEnd().x )
496 return GetEnd().x < component->GetEnd().x;
498 return GetEnd().y < component->GetEnd().y;
507 ( static_cast<const SCH_LINE*>( aItem )->GetLayer() ==
LAYER_BUS ) )
void FinishTo(const wxPoint &pos)
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 MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
PNG memory record (file in memory).
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)
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...
const BITMAP_OPAQUE add_line2bus_xpm[1]
virtual void SetColor(COLOR4D color)=0
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.
SCH_BUS_ENTRY_BASE(KICAD_T aType, const wxPoint &pos=wxPoint(0, 0), bool aFlipY=false)
SCHEMATIC_SETTINGS & Settings() const
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.
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
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)
#define DASH_MARK_LEN(aLineWidth)
Schematic editor (Eeschema) main window.
const BITMAP_OPAQUE add_bus2bus_xpm[1]
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.
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.
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.
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Base class for a bus or wire entry.
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Returns 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
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
void SetEnd(int x, int y)
#define DOT_MARK_LEN(aLineWidth)
int m_DefaultWireThickness
PLOT_DASH_TYPE GetPlotStyle() const
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...
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
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.
PLOT_DASH_TYPE
Dashed line types.
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.
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.
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.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
#define DASH_GAP_LEN(aLineWidth)
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
A base class for most all the KiCad significant classes used in schematics and boards.
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
int GetDefaultPenWidth() const
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.
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Base class for any item which can be embedded within the SCHEMATIC container class,...
int m_DefaultBusThickness
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.
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
A color representation with 4 components: red, green, blue, alpha.
wxPoint GetPosition() const override