40 std::function<void(
SCH_ITEM* )> changeHandler =
41 [&](
SCH_ITEM* aChangedItem ) ->
void
56 std::vector<SCH_LINE*> wires;
68 wires.push_back( line );
77 if( !
IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), aStart ) ||
84 if( ( line->GetStartPoint() == aStart && line->GetEndPoint() == aEnd )
85 || ( line->GetStartPoint() == aEnd && line->GetEndPoint() == aStart ) )
106 aCommit->
Removed( line, screen );
123 aCommit->
Removed( aJunction, screen );
127 std::list<SCH_LINE*> lines;
137 lines.push_back( line );
144 if( ( firstLine->GetEditFlags() & STRUCT_DELETED )
145 || ( secondLine->GetEditFlags() & STRUCT_DELETED )
146 || !secondLine->IsParallel( firstLine ) )
155 firstLine->SetFlags( STRUCT_DELETED );
162 firstLine->SetFlags( STRUCT_DELETED );
163 secondLine->SetFlags( STRUCT_DELETED );
164 AddToScreen( new_line, screen );
165 aCommit->Added( new_line, screen );
167 if( new_line->IsSelected() )
168 selectionTool->AddItemToSel( new_line, true );
170 lines.push_back( new_line );
178 if( line->IsSelected() )
179 selectionTool->RemoveItemFromSel( line,
true );
181 RemoveFromScreen( line, screen );
182 aCommit->Removed( line, screen );
194 aCommit->
Added( junction, aScreen );
203 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
207 for(
const auto& it : items )
209 if( !it.first->IsSCH_ITEM() )
217 if( item->
IsType( { SCH_ITEM_LOCATE_WIRE_T } ) )
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
COMMIT & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
EE_TYPE Overlapping(const BOX2I &aRect) const
void Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
A holder to handle information on schematic or board items.
void BreakSegment(SCH_COMMIT *aCommit, SCH_LINE *aSegment, const VECTOR2I &aPoint, SCH_LINE **aNewSegment, SCH_SCREEN *aScreen)
Break a single segment into two at the specified point.
bool BreakSegments(SCH_COMMIT *aCommit, const VECTOR2I &aPoint, SCH_SCREEN *aScreen)
Check every wire and bus for a intersection at aPoint and break into two segments at aPoint if an int...
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen) override
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr) override
Add an item to the screen (and view) aScreen is the screen the item is located on,...
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCHEMATIC & Schematic() const
bool TrimWire(SCH_COMMIT *aCommit, const VECTOR2I &aStart, const VECTOR2I &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void DeleteJunction(SCH_COMMIT *aCommit, SCH_ITEM *aItem)
Remove a given junction and heals any wire segments under the junction.
void UpdateHopOveredWires(SCH_ITEM *aItem)
SCH_JUNCTION * AddJunction(SCH_COMMIT *aCommit, SCH_SCREEN *aScreen, const VECTOR2I &aPos)
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Segment description base class to describe items which have 2 end points (track, wire,...
bool IsWire() const
Return true if the line is a wire.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
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.
bool IsBus() const
Return true if the line is a bus.
bool IsEndPoint(const VECTOR2I &aPoint) const override
Test if aPt is an end point of this schematic object.
void TestDanglingEnds(const SCH_SHEET_PATH *aPath=nullptr, std::function< void(SCH_ITEM *)> *aChangedHandler=nullptr) const
Test all of the connectable objects in the schematic for unused connection points.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define IS_MOVING
Item being moved.
@ REPAINT
Item needs to be redrawn.
void for_all_pairs(_InputIterator __first, _InputIterator __last, _Function __f)
Apply a function to every possible pair of elements of a sequence.
bool IsPointOnSegment(const VECTOR2I &aSegStart, const VECTOR2I &aSegEnd, const VECTOR2I &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.