37 m_parentView( aView ),
38 m_frame( aFrame ), m_toolManager( aMgr )
54 std::unique_ptr<SCH_RULE_AREA> ruleArea = std::make_unique<SCH_RULE_AREA>();
55 ruleArea->SetLineStyle( LINE_STYLE::DASH );
56 ruleArea->SetLineColor( COLOR4D::UNSPECIFIED );
69 commit.
Push(
_(
"Draw Rule Area" ) );
124 if( finalPoints.PointCount() < 3 )
134 auto& outline = ruleShape.
Outline( 0 );
136 for(
int i = 0; i < finalPoints.PointCount(); ++i )
137 outline.
Append( finalPoints.CPoint( i ) );
144 for(
int i = 1; i < leaderPts.
PointCount(); i++ )
148 for(
int i = 1; i < loopPts.
PointCount() - 1; i++ )
152 outline.SetClosed(
true );
153 outline.Simplify(
true );
157 if( outline.PointCount() >= 3 )
159 SEG seg( outline.CPoint( -1 ), outline.CPoint( 1 ) );
Color settings are a bit different than most of the settings objects in that there can be more than o...
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
A base class for most all the KiCad significant classes used in schematics and boards.
static TOOL_ACTION clearSelection
Clears the current selection.
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
A color representation with 4 components: red, green, blue, alpha.
void SetLeaderColor(KIGFX::COLOR4D leaderColor)
Gets the bounding box of the polygon.
void SetLineColor(KIGFX::COLOR4D lineColor)
Sets the color of the outline leader line.
void SetPoints(const SHAPE_LINE_CHAIN &aLockedInPts, const SHAPE_LINE_CHAIN &aLeaderPts, const SHAPE_LINE_CHAIN &aLoopPts)
Set the polygon points.
void SetFillColor(const COLOR4D &aNewColor)
Set the line width to set before drawing preview.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Class that handles the drawing of a polygon, including management of last corner deletion and drawing...
const SHAPE_LINE_CHAIN & GetLockedInPoints() const
Get the "locked-in" points that describe the polygon itself.
LEADER_MODE GetLeaderMode() const
void SetLeaderMode(LEADER_MODE aMode)
Set the leader mode to use when calculating the leader/returner lines.
bool IsPolygonInProgress() const
const SHAPE_LINE_CHAIN & GetLoopLinePoints() const
Get the points from the current cursor position to the polygon start point.
const SHAPE_LINE_CHAIN & GetLeaderLinePoints() const
Get the points comprising the leader line (the line from the last locked-in point to the current curs...
std::unique_ptr< SCH_RULE_AREA > createNewRuleArea()
Create a new SCH_RULE_AREA.
RULE_AREA_CREATE_HELPER(KIGFX::VIEW &aView, SCH_EDIT_FRAME *aFrame, TOOL_MANAGER *aMgr)
std::unique_ptr< SCH_RULE_AREA > m_rule_area
The TOOL_MANAGER running the tool.
void OnGeometryChange(const POLYGON_GEOM_MANAGER &aMgr) override
Called when the polygon is complete.
void OnComplete(const POLYGON_GEOM_MANAGER &aMgr) override
virtual ~RULE_AREA_CREATE_HELPER()
KIGFX::VIEW & m_parentView
The active schematic edit frame.
bool OnFirstPoint(POLYGON_GEOM_MANAGER &aMgr) override
Called before the first point is added - clients can do initialization here, and can veto the start o...
void commitRuleArea(std::unique_ptr< SCH_RULE_AREA > aRuleArea)
Commit the current rule area in progress to the schematic.
TOOL_MANAGER * m_toolManager
KIGFX::PREVIEW::POLYGON_ITEM m_previewItem
< The preview item to display
SCH_EDIT_FRAME * m_frame
The rule area in progress.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void LoadColors(const COLOR_SETTINGS *aSettings) override
int LineDistance(const VECTOR2I &aP, bool aDetermineSide=false) const
Return the closest Euclidean distance between point aP and the line defined by the ends of segment (t...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
@ GEOMETRY
Position or shape has changed.