KiCad PCB EDA Suite
Loading...
Searching...
No Matches
EE_GRID_HELPER Class Reference

#include <ee_grid_helper.h>

Inheritance diagram for EE_GRID_HELPER:
GRID_HELPER TEST_GRID_HELPER

Public Types

enum  ANCHOR_FLAGS {
  CORNER = 1 , OUTLINE = 2 , SNAPPABLE = 4 , ORIGIN = 8 ,
  VERTICAL = 16 , HORIZONTAL = 32 , CONSTRUCTED = 64 , ALL = CORNER | OUTLINE | SNAPPABLE | ORIGIN | VERTICAL | HORIZONTAL | CONSTRUCTED
}
 

Public Member Functions

 EE_GRID_HELPER ()
 
 EE_GRID_HELPER (TOOL_MANAGER *aToolMgr)
 
 ~EE_GRID_HELPER () override
 
SCH_ITEMGetSnapped () const
 Function GetSnapped If the EE_GRID_HELPER has highlighted a snap point (target shown), this function will return a pointer to the item to which it snapped.
 
VECTOR2D GetGridSize (GRID_HELPER_GRIDS aGrid) const override
 Return the size of the specified grid.
 
GRID_HELPER_GRIDS GetItemGrid (const EDA_ITEM *aItem) const override
 Get the coarsest grid that applies to an item.
 
VECTOR2I BestDragOrigin (const VECTOR2I &aMousePos, GRID_HELPER_GRIDS aGrid, const SCH_SELECTION &aItems)
 
SNAP_RESULT ResolveSnap (const VECTOR2I &aOrigin, GRID_HELPER_GRIDS aGrid, SCH_ITEM *aSkip)
 
SNAP_RESULT ResolveSnap (const VECTOR2I &aOrigin, GRID_HELPER_GRIDS aGrid, const SCH_SELECTION &aSkip={}, std::optional< VECTOR2I > aMovingReferencePoint=std::nullopt)
 
void AddConstructionItems (std::vector< SCH_ITEM * > aItems, bool aExtensionOnly, bool aIsPersistent)
 
VECTOR2I GetGrid () const
 
VECTOR2D GetVisibleGrid () const
 
VECTOR2I GetOrigin () const
 
virtual void FullReset ()
 Reset all internal state.
 
void SetGridSize (const VECTOR2D &aGrid)
 
void SetVisibleGridSize (const VECTOR2D &aGrid)
 
void SetOrigin (const VECTOR2I &aOrigin)
 
void SetGridSnapping (bool aEnable)
 
void SetAuxAxes (bool aEnable, const VECTOR2I &aOrigin=VECTOR2I(0, 0))
 
virtual VECTOR2I Align (const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
 
virtual VECTOR2I Align (const VECTOR2I &aPoint) const
 
virtual VECTOR2I Align (const VECTOR2I &aPoint, const VECTOR2D &aGrid, const VECTOR2D &aOffset) const
 
virtual VECTOR2I AlignGrid (const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
 
VECTOR2I AlignGrid (const VECTOR2I &aPoint) const
 
VECTOR2I AlignGrid (const VECTOR2I &aPoint, const VECTOR2D &aGrid, const VECTOR2D &aOffset) const
 
virtual GRID_HELPER_GRIDS GetSelectionGrid (const SELECTION &aSelection) const
 Gets the coarsest grid that applies to a selecion of items.
 
void SetSkipPoint (const VECTOR2I &aPoint)
 
void ClearSkipPoint ()
 Clear the skip point by setting it to an unreachable position, thereby preventing matching.
 
void SetSnap (bool aSnap)
 
bool GetSnap () const
 
void SetUseGrid (bool aSnapToGrid)
 
bool GetUseGrid () const
 
void SetSnapLine (bool aSnap)
 
void SetSnapLineDirections (const std::vector< VECTOR2I > &aDirections)
 
void SetSnapLineOrigin (const VECTOR2I &aOrigin)
 
void SetSnapLineEnd (const std::optional< VECTOR2I > &aEnd)
 
void ClearSnapLine ()
 
std::optional< VECTOR2ISnapToConstructionLines (const VECTOR2I &aPoint, const VECTOR2I &aNearestGrid, const VECTOR2D &aGrid, double aSnapRange) const
 
void SetMask (int aMask)
 
void SetMaskFlag (int aFlag)
 
void ClearMaskFlag (int aFlag)
 
std::optional< VECTOR2IGetSnappedPoint () const
 
void SetAngleRestriction (std::optional< VECTOR2I > aOrigin, double aStepDegrees)
 Restrict snapping to a set of angle branches emanating from an origin.
 
void SetPointEditProfile (bool aEnabled)
 
void SetStationarySelfGeometry (std::vector< VECTOR2I > aPoints, std::vector< SEG > aSegments)
 
void SetFeasibilityCallback (SNAP_RESOLVER::FEASIBILITY_CALLBACK aCallback)
 

Protected Member Functions

void addAnchor (const VECTOR2I &aPos, int aFlags, EDA_ITEM *aItem, int aPointTypes=POINT_TYPE::PT_NONE)
 
void addAnchor (const VECTOR2I &aPos, int aFlags, std::vector< EDA_ITEM * > aItems, int aPointTypes)
 
void clearAnchors ()
 
bool canUseGrid () const
 Check whether it is possible to use the grid – this depends both on local grid helper settings and global (tool manager) KiCad settings.
 
VECTOR2I computeNearest (const VECTOR2I &aPoint, const VECTOR2I &aGrid, const VECTOR2I &aOffset) const
 
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 current frame.
 
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.
 
SNAP_RESOLVER::TRACE_CALLBACK snapTraceCallback (const SNAP_SOURCE_CONTEXT &aContext) const
 
void retainAcceptedSnaps (const SNAP_RESULT &aResult)
 Record which snaps the resolver accepted so they can be re-biased on the next resolve, and separately track the accepted angle branch for the next frame.
 
void applySnapResultGuides (const SNAP_RESULT &aResult)
 
void showConstructionGeometry (bool aShow)
 
SNAP_MANAGERgetSnapManager ()
 
void updateSnapPoint (const TYPED_POINT2I &aPoint)
 
KIGFX::ANCHOR_DEBUGenableAndGetAnchorDebug ()
 Enable the anchor debug if permitted and return it.
 
void setLayoutReference (const VECTOR2I &aPoint, const std::optional< BOX2I > &aBounds, bool aAnchorPoint)
 Record the classified drag reference and trace it.
 

Static Protected Member Functions

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.
 

Protected Attributes

std::vector< ANCHORm_anchors
 
TOOL_MANAGERm_toolMgr
 
std::optional< VECTOR2Im_auxAxis
 
int m_maskTypes
 
bool m_enableSnap
 
bool m_enableGrid
 
bool m_enableSnapLine
 
std::optional< ANCHORm_snapItem
 
VECTOR2I m_skipPoint
 
KIGFX::SNAP_INDICATOR m_viewSnapPoint
 
KIGFX::ORIGIN_VIEWITEM m_viewAxis
 
VECTOR2D m_manualGrid
 
VECTOR2D m_manualVisibleGrid
 
VECTOR2I m_manualOrigin
 
bool m_manualGridSnapping
 
std::optional< VECTOR2Im_angleOrigin
 
double m_angleStepDegrees = 0.0
 
std::optional< SNAP_STABLE_IDm_retainedAngleBranch
 
std::vector< SNAP_STABLE_IDm_stickySnapIds
 
SNAP_RESOLVER::FEASIBILITY_CALLBACK m_feasibilityCallback
 
std::vector< VECTOR2Im_stationarySelfPoints
 
std::vector< SEGm_stationarySelfSegments
 
bool m_pointEditProfile = false
 
SNAP_REFERENCE_PREFERENCE m_layoutReferencePreference
 

Private Member Functions

SNAP_INFERENCE_SETTINGS snapInferenceSettings () const
 Snap inference settings for whichever editor owns this helper.
 
std::set< SCH_ITEM * > queryVisible (const BOX2I &aArea, const SCH_SELECTION &aSkipList) const
 
ANCHORnearestAnchor (const VECTOR2I &aPos, int aFlags, GRID_HELPER_GRIDS aGrid)
 
void computeAnchors (SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom=false, bool aIncludeText=false)
 Insert the local anchor points in to the grid helper for the specified schematic item, given the reference point and the direction of use for the point.
 

Static Private Member Functions

static BOX2I layoutBounds (const SCH_ITEM &aItem)
 Bounds a layout relation should align to.
 
static std::vector< std::pair< const SCH_PIN *, VECTOR2I > > layoutPins (SCH_ITEM &aItem)
 Pin connection points the item offers as alignment anchors.
 

Private Attributes

KIGFX::CONSTRUCTION_GEOM m_constructionGeomPreview
 Show construction geometry (if any) on the canvas.
 
SNAP_MANAGER m_snapManager
 Manage the construction geometry, snap lines, reference points, etc.
 
std::unique_ptr< KIGFX::ANCHOR_DEBUGm_anchorDebug
 #VIEW_ITEM for visualising anchor points, if enabled.
 

Friends

class EEGridHelperTestFixture
 

Detailed Description

Definition at line 36 of file ee_grid_helper.h.

Member Enumeration Documentation

◆ ANCHOR_FLAGS

enum GRID_HELPER::ANCHOR_FLAGS
inherited
Enumerator
CORNER 
OUTLINE 
SNAPPABLE 
ORIGIN 
VERTICAL 
HORIZONTAL 
CONSTRUCTED 
ALL 

Definition at line 197 of file grid_helper.h.

Constructor & Destructor Documentation

◆ EE_GRID_HELPER() [1/2]

EE_GRID_HELPER::EE_GRID_HELPER ( )

Definition at line 77 of file ee_grid_helper.cpp.

References GRID_HELPER::GRID_HELPER().

Referenced by TEST_GRID_HELPER::TEST_GRID_HELPER().

◆ EE_GRID_HELPER() [2/2]

◆ ~EE_GRID_HELPER()

EE_GRID_HELPER::~EE_GRID_HELPER ( )
override

Member Function Documentation

◆ addAnchor() [1/2]

void GRID_HELPER::addAnchor ( const VECTOR2I & aPos,
int aFlags,
EDA_ITEM * aItem,
int aPointTypes = POINT_TYPE::PT_NONE )
inlineprotectedinherited

◆ addAnchor() [2/2]

void GRID_HELPER::addAnchor ( const VECTOR2I & aPos,
int aFlags,
std::vector< EDA_ITEM * > aItems,
int aPointTypes )
inlineprotectedinherited

Definition at line 255 of file grid_helper.h.

References m_anchors, and m_maskTypes.

◆ AddConstructionItems()

◆ Align() [1/3]

VECTOR2I GRID_HELPER::Align ( const VECTOR2I & aPoint) const
virtualinherited

Reimplemented in PCB_GRID_HELPER.

Definition at line 537 of file grid_helper.cpp.

References Align(), GetGrid(), and GetOrigin().

◆ Align() [2/3]

VECTOR2I GRID_HELPER::Align ( const VECTOR2I & aPoint,
const VECTOR2D & aGrid,
const VECTOR2D & aOffset ) const
virtualinherited

Reimplemented in PCB_GRID_HELPER.

Definition at line 543 of file grid_helper.cpp.

References std::abs(), AlignGrid(), canUseGrid(), m_auxAxis, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Align() [3/3]

◆ AlignGrid() [1/3]

VECTOR2I GRID_HELPER::AlignGrid ( const VECTOR2I & aPoint) const
inherited

Definition at line 512 of file grid_helper.cpp.

References computeNearest(), GetGrid(), and GetOrigin().

◆ AlignGrid() [2/3]

VECTOR2I GRID_HELPER::AlignGrid ( const VECTOR2I & aPoint,
const VECTOR2D & aGrid,
const VECTOR2D & aOffset ) const
inherited

Definition at line 518 of file grid_helper.cpp.

References computeNearest(), and KiROUND().

◆ AlignGrid() [3/3]

◆ applySnapResultGuides()

◆ BestDragOrigin()

◆ canUseGrid()

bool GRID_HELPER::canUseGrid ( ) const
protectedinherited

Check whether it is possible to use the grid – this depends both on local grid helper settings and global (tool manager) KiCad settings.

Definition at line 564 of file grid_helper.cpp.

References m_enableGrid, m_manualGridSnapping, and m_toolMgr.

Referenced by Align(), EE_GRID_HELPER::ResolveSnap(), and SnapToConstructionLines().

◆ classifyReference()

SNAP_REFERENCE_PREFERENCE GRID_HELPER::classifyReference ( const VECTOR2I & aPoint,
const BOX2I & aBounds,
bool aAnchorPoint )
staticprotectedinherited

Classify the point a drag was started from against the moving object's bounds.

Layout inference prefers a stationary feature matching the one the user grabbed, so a left-edge grab aligns to left edges and a centre grab aligns to centres. An anchor-point grab (a pad centre or a pin end) instead prefers the stationary anchor points of the same kind, which is what makes pad-to-pad and pin-to-pin alignment feel deliberate.

Parameters
aPointThe drag origin.
aBoundsThe bounds of everything being moved.
aAnchorPointTrue when the drag origin is a published anchor point.

Definition at line 197 of file grid_helper.cpp.

References std::abs(), ANCHOR_POINT, BOUNDS_FEATURE, BOX2< Vec >::Centre(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), index, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCBGridHelperTestFixture::ClassifyReference(), and setLayoutReference().

◆ clearAnchors()

void GRID_HELPER::clearAnchors ( )
inlineprotectedinherited

◆ ClearMaskFlag()

void GRID_HELPER::ClearMaskFlag ( int aFlag)
inlineinherited

Definition at line 165 of file grid_helper.h.

References m_maskTypes.

◆ ClearSkipPoint()

void GRID_HELPER::ClearSkipPoint ( )
inlineinherited

Clear the skip point by setting it to an unreachable position, thereby preventing matching.

Definition at line 142 of file grid_helper.h.

References m_skipPoint.

Referenced by BOOST_AUTO_TEST_CASE(), and GRID_HELPER().

◆ ClearSnapLine()

void GRID_HELPER::ClearSnapLine ( )
inherited

Definition at line 160 of file grid_helper.cpp.

References m_snapManager.

◆ computeAnchors()

void EE_GRID_HELPER::computeAnchors ( SCH_ITEM * aItem,
const VECTOR2I & aRefPos,
bool aFrom = false,
bool aIncludeText = false )
private

Insert the local anchor points in to the grid helper for the specified schematic item, given the reference point and the direction of use for the point.

Parameters
aItemThe schematic item for which to compute the anchors
aRefPosThe point for which to compute the anchors (if used by the symbol)
aFromIs this for an anchor that is designating a source point (aFrom=true) or not
aIncludeTextif true will compute anchors for text items

Definition at line 884 of file ee_grid_helper.cpp.

References GRID_HELPER::addAnchor(), GRID_HELPER::Align(), computeAnchors(), GRID_HELPER::CORNER, SCH_ITEM::GetConnectionPoints(), SCH_LINE::GetEndPoint(), EDA_ITEM::GetPosition(), SCH_LINE::GetStartPoint(), GRID_HELPER::HORIZONTAL, KI_FALLTHROUGH, GRID_HELPER::ORIGIN, pin, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_GROUP_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TABLE_T, SCH_TABLECELL_T, SCH_TEXT_T, SCH_TEXTBOX_T, GRID_HELPER::SNAPPABLE, TestSegmentHit(), EDA_ITEM::Type(), GRID_HELPER::VERTICAL, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BestDragOrigin(), computeAnchors(), and ResolveSnap().

◆ computeNearest()

VECTOR2I GRID_HELPER::computeNearest ( const VECTOR2I & aPoint,
const VECTOR2I & aGrid,
const VECTOR2I & aOffset ) const
protectedinherited

Definition at line 529 of file grid_helper.cpp.

References KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by AlignGrid(), and AlignGrid().

◆ computeSnapRanges()

◆ emitAngleBranchCandidates()

void GRID_HELPER::emitAngleBranchCandidates ( std::vector< SNAP_CANDIDATE > & aCandidates,
const VECTOR2I & aOrigin,
double aSnapScale ) const
protectedinherited

Emit the angle-restriction snap candidates (the two branches bracketing the cursor angle) into the current frame.

Shared by the derived helpers so the stringly-typed "angle" protocol lives in one place.

Definition at line 601 of file grid_helper.cpp.

References std::abs(), ANGLE, ANGLE_BRANCH, delta, SNAP_CANDIDATE::Line(), m_angleOrigin, m_angleStepDegrees, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EE_GRID_HELPER::ResolveSnap(), and PCB_GRID_HELPER::ResolveSnap().

◆ emitSelfAndGridCandidates()

void GRID_HELPER::emitSelfAndGridCandidates ( std::vector< SNAP_CANDIDATE > & aCandidates,
const SNAP_SOURCE_CONTEXT & aContext,
const VECTOR2I & aOrigin,
const VECTOR2I & aNearestGrid,
double aSnapScale,
int aSnapRange,
bool aUseGrid ) const
protectedinherited

Emit the point editor's unchanged self-geometry and the independent grid axes.

The two editors disagree on when the grid may be used, so the caller supplies that gate rather than the base guessing at it.

Definition at line 659 of file grid_helper.cpp.

References std::abs(), SNAP_CANDIDATE::AxisX(), SNAP_CANDIDATE::AxisY(), GRID, GRID_AXIS, GRID_X, GRID_Y, INTRINSIC_ANCHOR, m_stationarySelfPoints, MakeDerivedSnapId(), SNAP_SOURCE_CONTEXT::movingItem, OBJECT, SNAP_CANDIDATE::Point(), POINT_EDIT, SNAP_SOURCE_CONTEXT::profile, SELF_ENDPOINT, SELF_POINT, SNAP_SOURCE_CONTEXT::stationarySourceLeg, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EE_GRID_HELPER::ResolveSnap(), and PCB_GRID_HELPER::ResolveSnap().

◆ enableAndGetAnchorDebug()

KIGFX::ANCHOR_DEBUG * GRID_HELPER::enableAndGetAnchorDebug ( )
protectedinherited

Enable the anchor debug if permitted and return it.

Returns nullptr if not permitted by the advancd config

Definition at line 118 of file grid_helper.cpp.

References KIGFX::VIEW::Add(), ADVANCED_CFG::GetCfg(), m_anchorDebug, ADVANCED_CFG::m_EnableSnapAnchorsDebug, m_toolMgr, and KIGFX::VIEW::SetVisible().

Referenced by EE_GRID_HELPER::ResolveSnap(), and PCB_GRID_HELPER::ResolveSnap().

◆ FullReset()

virtual void GRID_HELPER::FullReset ( )
inlinevirtualinherited

Reset all internal state.

Used to remove any dangling pointers to items that have been deleted.

Definition at line 83 of file grid_helper.h.

References m_anchors, m_constructionGeomPreview, m_layoutReferencePreference, m_retainedAngleBranch, m_snapManager, and m_stickySnapIds.

◆ GetGrid()

◆ GetGridSize()

VECTOR2D EE_GRID_HELPER::GetGridSize ( GRID_HELPER_GRIDS aGrid) const
overridevirtual

Return the size of the specified grid.

Reimplemented from GRID_HELPER.

Reimplemented in TEST_GRID_HELPER.

Definition at line 712 of file ee_grid_helper.cpp.

References grid, GRID_CONNECTABLE, GRID_GRAPHICS, GRID_TEXT, GRID_WIRES, GRID_HELPER::m_toolMgr, and schIUScale.

Referenced by GetItemGrid(), and ResolveSnap().

◆ GetItemGrid()

◆ GetOrigin()

VECTOR2I GRID_HELPER::GetOrigin ( ) const
inherited

◆ GetSelectionGrid()

GRID_HELPER_GRIDS GRID_HELPER::GetSelectionGrid ( const SELECTION & aSelection) const
virtualinherited

Gets the coarsest grid that applies to a selecion of items.

Definition at line 471 of file grid_helper.cpp.

References SELECTION::Front(), GetGridSize(), GetItemGrid(), and grid.

◆ GetSnap()

bool GRID_HELPER::GetSnap ( ) const
inlineinherited

Definition at line 148 of file grid_helper.h.

References m_enableSnap.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and DRAWING_TOOL::DrawVia().

◆ getSnapManager()

◆ GetSnapped()

SCH_ITEM * EE_GRID_HELPER::GetSnapped ( ) const

Function GetSnapped If the EE_GRID_HELPER has highlighted a snap point (target shown), this function will return a pointer to the item to which it snapped.

Returns
NULL if not snapped. Pointer to snapped item otherwise

Definition at line 759 of file ee_grid_helper.cpp.

References GRID_HELPER::m_snapItem.

◆ GetSnappedPoint()

std::optional< VECTOR2I > GRID_HELPER::GetSnappedPoint ( ) const
inherited

Definition at line 571 of file grid_helper.cpp.

References m_snapItem.

Referenced by BOOST_AUTO_TEST_CASE(), and PCB_PICKER_TOOL::SelectPointInteractively().

◆ GetUseGrid()

bool GRID_HELPER::GetUseGrid ( ) const
inlineinherited

Definition at line 151 of file grid_helper.h.

References m_enableGrid.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ GetVisibleGrid()

VECTOR2D GRID_HELPER::GetVisibleGrid ( ) const
inherited

Definition at line 453 of file grid_helper.cpp.

References m_manualVisibleGrid, and m_toolMgr.

Referenced by BOOST_AUTO_TEST_CASE(), and computeSnapRanges().

◆ layoutBounds()

BOX2I EE_GRID_HELPER::layoutBounds ( const SCH_ITEM & aItem)
staticprivate

Bounds a layout relation should align to.

Fields travel with their symbol and are moved independently, so including them would make a symbol's alignment edges shift for reasons unrelated to the symbol's placement.

Definition at line 215 of file ee_grid_helper.cpp.

References EDA_ITEM::GetBoundingBox(), SCH_SYMBOL_T, and EDA_ITEM::Type().

Referenced by BestDragOrigin(), EEGridHelperTestFixture::LayoutBounds(), and ResolveSnap().

◆ layoutPins()

std::vector< std::pair< const SCH_PIN *, VECTOR2I > > EE_GRID_HELPER::layoutPins ( SCH_ITEM & aItem)
staticprivate

Pin connection points the item offers as alignment anchors.

Definition at line 224 of file ee_grid_helper.cpp.

References pin, SCH_PIN_T, SCH_SYMBOL_T, and EDA_ITEM::Type().

Referenced by BestDragOrigin(), EEGridHelperTestFixture::LayoutPins(), and ResolveSnap().

◆ nearestAnchor()

EE_GRID_HELPER::ANCHOR * EE_GRID_HELPER::nearestAnchor ( const VECTOR2I & aPos,
int aFlags,
GRID_HELPER_GRIDS aGrid )
private

◆ queryVisible()

◆ ResolveSnap() [1/2]

SNAP_RESULT EE_GRID_HELPER::ResolveSnap ( const VECTOR2I & aOrigin,
GRID_HELPER_GRIDS aGrid,
const SCH_SELECTION & aSkip = {},
std::optional< VECTOR2I > aMovingReferencePoint = std::nullopt )

Definition at line 353 of file ee_grid_helper.cpp.

References SNAP_INFERENCE_PROVIDER::AddAlignmentPoint(), SNAP_INFERENCE_PROVIDER::AddBounds(), AddConstructionItems(), SNAP_INFERENCE_PROVIDER::AddPath(), GRID_HELPER::Align(), SNAP_INFERENCE_SETTINGS::alignmentDistribution, anchor, GRID_HELPER::applySnapResultGuides(), SELECTION::begin(), CONSTRUCTION_MANAGER::CancelProposal(), SNAP_FRAME_INPUT< Payload >::candidates, GRID_HELPER::canUseGrid(), CONSTRUCTION_MANAGER::Clear(), GRID_HELPER::clearAnchors(), SNAP_INFERENCE_PROVIDER::CollectAlignment(), SNAP_INFERENCE_PROVIDER::CollectEqualSpacing(), SNAP_INFERENCE_PROVIDER::CollectObjectGeometry(), SNAP_INFERENCE_PROVIDER::CollectTangentNormal(), computeAnchors(), GRID_HELPER::computeSnapRanges(), GRID_HELPER::CONSTRUCTED, CONSTRUCTED_ANCHOR, CONSTRUCTED_POINT, CONSTRUCTION, SNAP_INFERENCE_SETTINGS::constructionExtensions, SNAP_FRAME_INPUT< Payload >::context, GRID_HELPER::ANCHOR::Distance(), CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::DRAWABLE_ENTRY::Drawable, GRID_HELPER::emitAngleBranchCandidates(), GRID_HELPER::emitSelfAndGridCandidates(), SELECTION::Empty(), GRID_HELPER::enableAndGetAnchorDebug(), SNAP_FRAME_INPUT< Payload >::feasibility, GRID_HELPER::ANCHOR::flags, KIGFX::GEOMETRY, ADVANCED_CFG::GetCfg(), SNAP_MANAGER::GetConstructionManager(), SCH_LINE::GetEndPoint(), GetGridSize(), SELECTION::GetSize(), SNAP_MANAGER::GetSnapLineManager(), GRID_HELPER::getSnapManager(), SCH_LINE::GetStartPoint(), GRID_HELPER::SNAP_RANGES::in, INTRINSIC_ANCHOR, KIGFX::VIEW_ITEM::IsSCH_ITEM(), ITEM_GEOMETRY, layoutBounds(), layoutPins(), GRID_HELPER::m_anchors, ADVANCED_CFG::m_EnableExtensionSnaps, GRID_HELPER::m_enableSnap, GRID_HELPER::m_enableSnapLine, GRID_HELPER::m_feasibilityCallback, GRID_HELPER::m_layoutReferencePreference, GRID_HELPER::m_pointEditProfile, GRID_HELPER::m_retainedAngleBranch, GRID_HELPER::m_skipPoint, GRID_HELPER::m_snapItem, GRID_HELPER::m_stationarySelfSegments, GRID_HELPER::m_stickySnapIds, GRID_HELPER::m_toolMgr, EDA_ITEM::m_Uuid, GRID_HELPER::m_viewSnapPoint, MakeCompositeSnapId(), MakeDerivedSnapId(), MakePointSnapId(), SNAP_SOURCE_CONTEXT::movingBounds, SNAP_SOURCE_CONTEXT::movingItem, SNAP_SOURCE_CONTEXT::movingReferencePoint, nearestAnchor(), OBJECT, SNAP_INFERENCE_SETTINGS::objectGeometry, GRID_HELPER::SNAP_RANGES::out, PICKER, pin, SNAP_CANDIDATE::Point(), POINT_EDIT, GRID_HELPER::ANCHOR::pos, SNAP_FRAME_INPUT< Payload >::presentation, SNAP_FRAME_OUTPUT< Payload >::presentation, SNAP_SOURCE_CONTEXT::profile, queryVisible(), GRID_HELPER::SNAP_RANGES::range, GRID_HELPER::SNAP_RANGES::rankingHysteresis, SNAP_FRAME_INPUT< Payload >::rankingHysteresis, SNAP_SOURCE_CONTEXT::referencePreference, ResolveSnapFrame(), result, SNAP_FRAME_OUTPUT< Payload >::result, GRID_HELPER::retainAcceptedSnaps(), SNAP_FRAME_INPUT< Payload >::retainedId, RIGID_PLACEMENT, GRID_HELPER::SNAP_RANGES::scale, SCH_LINE_T, SELF_SEGMENT, SNAP_LINE_MANAGER::SetSnapLineEnd(), SNAP_LINE_MANAGER::SetSnapLineOrigin(), GRID_HELPER::showConstructionGeometry(), snapInferenceSettings(), GRID_HELPER::SNAPPABLE, SnapTargetId(), GRID_HELPER::SnapToConstructionLines(), GRID_HELPER::snapTraceCallback(), SNAP_SOURCE_CONTEXT::sourcePoint, VECTOR2< T >::SquaredDistance(), SNAP_SOURCE_CONTEXT::stationarySelfFeatures, SNAP_SOURCE_CONTEXT::stationarySourceLeg, SNAP_FRAME_INPUT< Payload >::stickyIds, SNAP_INFERENCE_SETTINGS::tangentNormal, SNAP_FRAME_INPUT< Payload >::trace, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ ResolveSnap() [2/2]

SNAP_RESULT EE_GRID_HELPER::ResolveSnap ( const VECTOR2I & aOrigin,
GRID_HELPER_GRIDS aGrid,
SCH_ITEM * aSkip )

Definition at line 341 of file ee_grid_helper.cpp.

References SELECTION::Add(), and ResolveSnap().

Referenced by SCH_SELECTION_TOOL::autostartEvent(), and ResolveSnap().

◆ retainAcceptedSnaps()

void GRID_HELPER::retainAcceptedSnaps ( const SNAP_RESULT & aResult)
protectedinherited

Record which snaps the resolver accepted so they can be re-biased on the next resolve, and separately track the accepted angle branch for the next frame.

Definition at line 702 of file grid_helper.cpp.

References SNAP_RESULT::accepted, ANGLE_BRANCH, m_retainedAngleBranch, and m_stickySnapIds.

Referenced by EE_GRID_HELPER::ResolveSnap(), and PCB_GRID_HELPER::ResolveSnap().

◆ SetAngleRestriction()

void GRID_HELPER::SetAngleRestriction ( std::optional< VECTOR2I > aOrigin,
double aStepDegrees )
inlineinherited

Restrict snapping to a set of angle branches emanating from an origin.

Passing an empty origin clears the restriction and any retained branch so the next resolve starts fresh.

Definition at line 175 of file grid_helper.h.

References m_angleOrigin, m_angleStepDegrees, and m_retainedAngleBranch.

◆ SetAuxAxes()

void GRID_HELPER::SetAuxAxes ( bool aEnable,
const VECTOR2I & aOrigin = VECTOR2I( 0, 0 ) )
inherited

Definition at line 494 of file grid_helper.cpp.

References m_auxAxis, m_toolMgr, and m_viewAxis.

Referenced by BOOST_AUTO_TEST_CASE().

◆ SetFeasibilityCallback()

void GRID_HELPER::SetFeasibilityCallback ( SNAP_RESOLVER::FEASIBILITY_CALLBACK aCallback)
inlineinherited

Definition at line 192 of file grid_helper.h.

References m_feasibilityCallback.

◆ SetGridSize()

◆ SetGridSnapping()

◆ setLayoutReference()

void GRID_HELPER::setLayoutReference ( const VECTOR2I & aPoint,
const std::optional< BOX2I > & aBounds,
bool aAnchorPoint )
protectedinherited

Record the classified drag reference and trace it.

Definition at line 225 of file grid_helper.cpp.

References ANCHOR_POINT, BOUNDS_FEATURE, classifyReference(), and m_layoutReferencePreference.

Referenced by EE_GRID_HELPER::BestDragOrigin(), and PCB_GRID_HELPER::BestDragOrigin().

◆ SetMask()

void GRID_HELPER::SetMask ( int aMask)
inlineinherited

Definition at line 163 of file grid_helper.h.

References m_maskTypes.

◆ SetMaskFlag()

void GRID_HELPER::SetMaskFlag ( int aFlag)
inlineinherited

Definition at line 164 of file grid_helper.h.

References m_maskTypes.

◆ SetOrigin()

◆ SetPointEditProfile()

void GRID_HELPER::SetPointEditProfile ( bool aEnabled)
inlineinherited

Definition at line 184 of file grid_helper.h.

References m_pointEditProfile.

◆ SetSkipPoint()

void GRID_HELPER::SetSkipPoint ( const VECTOR2I & aPoint)
inlineinherited

Definition at line 134 of file grid_helper.h.

References m_skipPoint.

Referenced by BOOST_AUTO_TEST_CASE().

◆ SetSnap()

void GRID_HELPER::SetSnap ( bool aSnap)
inlineinherited

◆ SetSnapLine()

void GRID_HELPER::SetSnapLine ( bool aSnap)
inlineinherited

Definition at line 153 of file grid_helper.h.

References m_enableSnapLine.

◆ SetSnapLineDirections()

void GRID_HELPER::SetSnapLineDirections ( const std::vector< VECTOR2I > & aDirections)
inherited

Definition at line 144 of file grid_helper.cpp.

References m_snapManager.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SetSnapLineEnd()

void GRID_HELPER::SetSnapLineEnd ( const std::optional< VECTOR2I > & aEnd)
inherited

Definition at line 155 of file grid_helper.cpp.

References m_snapManager.

◆ SetSnapLineOrigin()

void GRID_HELPER::SetSnapLineOrigin ( const VECTOR2I & aOrigin)
inherited

Definition at line 150 of file grid_helper.cpp.

References m_snapManager.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SetStationarySelfGeometry()

void GRID_HELPER::SetStationarySelfGeometry ( std::vector< VECTOR2I > aPoints,
std::vector< SEG > aSegments )
inlineinherited

Definition at line 186 of file grid_helper.h.

References m_stationarySelfPoints, and m_stationarySelfSegments.

◆ SetUseGrid()

void GRID_HELPER::SetUseGrid ( bool aSnapToGrid)
inlineinherited

Definition at line 150 of file grid_helper.h.

References m_enableGrid.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SetVisibleGridSize()

void GRID_HELPER::SetVisibleGridSize ( const VECTOR2D & aGrid)
inlineinherited

Definition at line 95 of file grid_helper.h.

References m_manualVisibleGrid.

Referenced by BOOST_AUTO_TEST_CASE().

◆ showConstructionGeometry()

void GRID_HELPER::showConstructionGeometry ( bool aShow)
protectedinherited

◆ snapInferenceSettings()

SNAP_INFERENCE_SETTINGS EE_GRID_HELPER::snapInferenceSettings ( ) const
private

Snap inference settings for whichever editor owns this helper.

Definition at line 189 of file ee_grid_helper.cpp.

References FRAME_SCH_SYMBOL_EDITOR, and GRID_HELPER::m_toolMgr.

Referenced by AddConstructionItems(), and ResolveSnap().

◆ SnapToConstructionLines()

std::optional< VECTOR2I > GRID_HELPER::SnapToConstructionLines ( const VECTOR2I & aPoint,
const VECTOR2I & aNearestGrid,
const VECTOR2D & aGrid,
double aSnapRange ) const
inherited

◆ snapTraceCallback()

◆ updateSnapPoint()

void GRID_HELPER::updateSnapPoint ( const TYPED_POINT2I & aPoint)
protectedinherited

Friends And Related Symbol Documentation

◆ EEGridHelperTestFixture

friend class EEGridHelperTestFixture
friend

Definition at line 38 of file ee_grid_helper.h.

References EEGridHelperTestFixture, and GRID_HELPER::GetGrid().

Referenced by EEGridHelperTestFixture.

Member Data Documentation

◆ m_anchorDebug

std::unique_ptr<KIGFX::ANCHOR_DEBUG> GRID_HELPER::m_anchorDebug
privateinherited

#VIEW_ITEM for visualising anchor points, if enabled.

Definition at line 397 of file grid_helper.h.

Referenced by PCB_GRID_HELPER::Align(), and enableAndGetAnchorDebug().

◆ m_anchors

◆ m_angleOrigin

std::optional<VECTOR2I> GRID_HELPER::m_angleOrigin
protectedinherited

Definition at line 361 of file grid_helper.h.

Referenced by emitAngleBranchCandidates(), and SetAngleRestriction().

◆ m_angleStepDegrees

double GRID_HELPER::m_angleStepDegrees = 0.0
protectedinherited

Definition at line 362 of file grid_helper.h.

Referenced by emitAngleBranchCandidates(), and SetAngleRestriction().

◆ m_auxAxis

std::optional<VECTOR2I> GRID_HELPER::m_auxAxis
protectedinherited

Definition at line 340 of file grid_helper.h.

Referenced by Align(), and SetAuxAxes().

◆ m_constructionGeomPreview

KIGFX::CONSTRUCTION_GEOM GRID_HELPER::m_constructionGeomPreview
privateinherited

Show construction geometry (if any) on the canvas.

Definition at line 391 of file grid_helper.h.

Referenced by PCB_GRID_HELPER::Align(), FullReset(), EE_GRID_HELPER::GetGrid(), GRID_HELPER(), GRID_HELPER(), and showConstructionGeometry().

◆ m_enableGrid

bool GRID_HELPER::m_enableGrid
protectedinherited

◆ m_enableSnap

bool GRID_HELPER::m_enableSnap
protectedinherited

◆ m_enableSnapLine

bool GRID_HELPER::m_enableSnapLine
protectedinherited

◆ m_feasibilityCallback

SNAP_RESOLVER::FEASIBILITY_CALLBACK GRID_HELPER::m_feasibilityCallback
protectedinherited

◆ m_layoutReferencePreference

SNAP_REFERENCE_PREFERENCE GRID_HELPER::m_layoutReferencePreference
protectedinherited

◆ m_manualGrid

VECTOR2D GRID_HELPER::m_manualGrid
protectedinherited

Definition at line 355 of file grid_helper.h.

Referenced by GetGrid(), GetGridSize(), GRID_HELPER(), and SetGridSize().

◆ m_manualGridSnapping

bool GRID_HELPER::m_manualGridSnapping
protectedinherited

Definition at line 358 of file grid_helper.h.

Referenced by canUseGrid(), GRID_HELPER(), and SetGridSnapping().

◆ m_manualOrigin

VECTOR2I GRID_HELPER::m_manualOrigin
protectedinherited

Definition at line 357 of file grid_helper.h.

Referenced by GetOrigin(), GRID_HELPER(), and SetOrigin().

◆ m_manualVisibleGrid

VECTOR2D GRID_HELPER::m_manualVisibleGrid
protectedinherited

Definition at line 356 of file grid_helper.h.

Referenced by GetVisibleGrid(), GRID_HELPER(), and SetVisibleGridSize().

◆ m_maskTypes

int GRID_HELPER::m_maskTypes
protectedinherited

Definition at line 342 of file grid_helper.h.

Referenced by addAnchor(), ClearMaskFlag(), GRID_HELPER(), SetMask(), and SetMaskFlag().

◆ m_pointEditProfile

bool GRID_HELPER::m_pointEditProfile = false
protectedinherited

◆ m_retainedAngleBranch

std::optional<SNAP_STABLE_ID> GRID_HELPER::m_retainedAngleBranch
protectedinherited

◆ m_skipPoint

VECTOR2I GRID_HELPER::m_skipPoint
protectedinherited

◆ m_snapItem

◆ m_snapManager

SNAP_MANAGER GRID_HELPER::m_snapManager
privateinherited

Manage the construction geometry, snap lines, reference points, etc.

Definition at line 394 of file grid_helper.h.

Referenced by applySnapResultGuides(), ClearSnapLine(), FullReset(), EE_GRID_HELPER::GetGrid(), getSnapManager(), GRID_HELPER(), SetSnapLineDirections(), SetSnapLineEnd(), SetSnapLineOrigin(), and SnapToConstructionLines().

◆ m_stationarySelfPoints

std::vector<VECTOR2I> GRID_HELPER::m_stationarySelfPoints
protectedinherited

Definition at line 366 of file grid_helper.h.

Referenced by emitSelfAndGridCandidates(), and SetStationarySelfGeometry().

◆ m_stationarySelfSegments

std::vector<SEG> GRID_HELPER::m_stationarySelfSegments
protectedinherited

◆ m_stickySnapIds

std::vector<SNAP_STABLE_ID> GRID_HELPER::m_stickySnapIds
protectedinherited

◆ m_toolMgr

◆ m_viewAxis

◆ m_viewSnapPoint


The documentation for this class was generated from the following files: