144 m_skipPoint =
VECTOR2I( std::numeric_limits<int>::min(), std::numeric_limits<int>::min() );
161 double aSnapRange )
const;
224 ANCHOR(
const VECTOR2I& aPos,
int aFlags,
int aPointTypes, std::vector<EDA_ITEM*> aItems ) :
252 addAnchor( aPos, aFlags, std::vector<EDA_ITEM*>{ aItem }, aPointTypes );
259 m_anchors.emplace_back(
ANCHOR( aPos, aFlags, aPointTypes, std::move( aItems ) ) );
301 double aSnapScale )
const;
311 int aSnapRange,
bool aUseGrid )
const;
A base class for most all the KiCad significant classes used in schematics and boards.
KIGFX::CONSTRUCTION_GEOM m_constructionGeomPreview
Show construction geometry (if any) on the canvas.
std::optional< VECTOR2I > m_auxAxis
VECTOR2I computeNearest(const VECTOR2I &aPoint, const VECTOR2I &aGrid, const VECTOR2I &aOffset) const
void retainAcceptedSnaps(const SNAP_RESULT &aResult)
Record which snaps the resolver accepted so they can be re-biased on the next resolve,...
std::optional< VECTOR2I > SnapToConstructionLines(const VECTOR2I &aPoint, const VECTOR2I &aNearestGrid, const VECTOR2D &aGrid, double aSnapRange) const
void SetSnapLineDirections(const std::vector< VECTOR2I > &aDirections)
void addAnchor(const VECTOR2I &aPos, int aFlags, EDA_ITEM *aItem, int aPointTypes=POINT_TYPE::PT_NONE)
SNAP_MANAGER & getSnapManager()
SNAP_RANGES computeSnapRanges(bool aClampToVisibleGrid) const
Compute the snap thresholds.
void emitAngleBranchCandidates(std::vector< SNAP_CANDIDATE > &aCandidates, const VECTOR2I &aOrigin, double aSnapScale) const
Emit the angle-restriction snap candidates (the two branches bracketing the cursor angle) into the cu...
virtual GRID_HELPER_GRIDS GetItemGrid(const EDA_ITEM *aItem) const
Get the coarsest grid that applies to an item.
void SetSkipPoint(const VECTOR2I &aPoint)
void showConstructionGeometry(bool aShow)
SNAP_RESOLVER::FEASIBILITY_CALLBACK m_feasibilityCallback
void SetAngleRestriction(std::optional< VECTOR2I > aOrigin, double aStepDegrees)
Restrict snapping to a set of angle branches emanating from an origin.
SNAP_MANAGER m_snapManager
Manage the construction geometry, snap lines, reference points, etc.
std::vector< SEG > m_stationarySelfSegments
double m_angleStepDegrees
VECTOR2D m_manualVisibleGrid
void addAnchor(const VECTOR2I &aPos, int aFlags, std::vector< EDA_ITEM * > aItems, int aPointTypes)
void SetOrigin(const VECTOR2I &aOrigin)
void SetSnapLineOrigin(const VECTOR2I &aOrigin)
void SetVisibleGridSize(const VECTOR2D &aGrid)
void ClearSkipPoint()
Clear the skip point by setting it to an unreachable position, thereby preventing matching.
bool m_manualGridSnapping
void SetGridSnapping(bool aEnable)
friend void TEST_CLEAR_ANCHORS(GRID_HELPER &helper)
virtual GRID_HELPER_GRIDS GetSelectionGrid(const SELECTION &aSelection) const
Gets the coarsest grid that applies to a selecion of items.
void SetUseGrid(bool aSnapToGrid)
std::optional< VECTOR2I > GetSnappedPoint() const
void SetAuxAxes(bool aEnable, const VECTOR2I &aOrigin=VECTOR2I(0, 0))
VECTOR2D GetVisibleGrid() const
std::unique_ptr< KIGFX::ANCHOR_DEBUG > m_anchorDebug
#VIEW_ITEM for visualising anchor points, if enabled.
std::vector< VECTOR2I > m_stationarySelfPoints
virtual VECTOR2D GetGridSize(GRID_HELPER_GRIDS aGrid) const
Return the size of the specified grid.
SNAP_RESOLVER::TRACE_CALLBACK snapTraceCallback(const SNAP_SOURCE_CONTEXT &aContext) const
static SNAP_REFERENCE_PREFERENCE classifyReference(const VECTOR2I &aPoint, const BOX2I &aBounds, bool aAnchorPoint)
Classify the point a drag was started from against the moving object's bounds.
VECTOR2I GetOrigin() const
bool canUseGrid() const
Check whether it is possible to use the grid – this depends both on local grid helper settings and gl...
void SetGridSize(const VECTOR2D &aGrid)
std::optional< SNAP_STABLE_ID > m_retainedAngleBranch
std::optional< ANCHOR > m_snapItem
SNAP_REFERENCE_PREFERENCE m_layoutReferencePreference
void SetFeasibilityCallback(SNAP_RESOLVER::FEASIBILITY_CALLBACK aCallback)
virtual void FullReset()
Reset all internal state.
KIGFX::ANCHOR_DEBUG * enableAndGetAnchorDebug()
Enable the anchor debug if permitted and return it.
void SetMaskFlag(int aFlag)
void SetSnapLineEnd(const std::optional< VECTOR2I > &aEnd)
KIGFX::SNAP_INDICATOR m_viewSnapPoint
virtual VECTOR2I Align(const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
void updateSnapPoint(const TYPED_POINT2I &aPoint)
void SetStationarySelfGeometry(std::vector< VECTOR2I > aPoints, std::vector< SEG > aSegments)
KIGFX::ORIGIN_VIEWITEM m_viewAxis
std::optional< VECTOR2I > m_angleOrigin
void ClearMaskFlag(int aFlag)
std::vector< SNAP_STABLE_ID > m_stickySnapIds
void SetSnapLine(bool aSnap)
void setLayoutReference(const VECTOR2I &aPoint, const std::optional< BOX2I > &aBounds, bool aAnchorPoint)
Record the classified drag reference and trace it.
void emitSelfAndGridCandidates(std::vector< SNAP_CANDIDATE > &aCandidates, const SNAP_SOURCE_CONTEXT &aContext, const VECTOR2I &aOrigin, const VECTOR2I &aNearestGrid, double aSnapScale, int aSnapRange, bool aUseGrid) const
Emit the point editor's unchanged self-geometry and the independent grid axes.
void SetPointEditProfile(bool aEnabled)
void applySnapResultGuides(const SNAP_RESULT &aResult)
std::vector< ANCHOR > m_anchors
virtual VECTOR2I AlignGrid(const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
View item to draw debug items for anchors.
Shows construction geometry for things like line extensions, arc centers, etc.
View item to draw an origin marker with an optional snap type indicator.
std::array< uint8_t, 16 > AsBytes() const
A SNAP_MANAGER glues together the snap line manager and construction manager., along with some other ...
std::function< SNAP_RESULT(const SNAP_SOURCE_CONTEXT &, const std::vector< SNAP_CANDIDATE > &)> FEASIBILITY_CALLBACK
std::function< void(const std::string &)> TRACE_CALLBACK
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
SNAP_TARGET_ID SnapTargetId(const KIID &aId)
The snap identity of a document item.
@ PT_NONE
No specific point type.
std::array< uint8_t, 16 > SNAP_TARGET_ID
ANCHOR(const VECTOR2I &aPos, int aFlags, int aPointTypes, std::vector< EDA_ITEM * > aItems)
std::vector< EDA_ITEM * > items
Items that are associated with this anchor (can be more than one, e.g.
double Distance(const VECTOR2I &aP) const
bool InvolvesItem(const EDA_ITEM &aItem) const
World-space snap thresholds derived from the screen-space snap radius.
int range
Snap radius, optionally clamped to the visible grid.
int in
Distance at which a candidate is picked up.
double scale
SNAP_SCREEN_RADIUS in world units.
int out
Distance at which a held candidate is released.
double rankingHysteresis
Resolver ranking stickiness, as a fraction of the radius.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D