28 m_constructionGeomPreview( aHelper )
53 bool anyNewItems =
false;
71 const int maxTempItems = 2;
111 addBatchItems( batch,
false );
183std::vector<CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM_BATCH>
186 std::vector<CONSTRUCTION_ITEM_BATCH> batches;
195 batches.push_back( batch );
213 batches.push_back( std::move( batch ) );
228 int aEscapeRange,
EDA_ANGLE aLongRangeEscapeAngle )
230 if(
std::abs( aCursor.
x - aSnapLineOrigin.
x ) < aEscapeRange )
242 int aEscapeRange,
EDA_ANGLE aLongRangeEscapeAngle )
244 if(
std::abs( aCursor.
y - aSnapLineOrigin.
y ) < aEscapeRange )
255 std::optional<int> aDistToNearest,
256 int aSnapRange )
const
261 bool snapLine =
false;
262 VECTOR2I bestSnapPoint = aNearestGrid;
265 const bool gridBetterThanNearest = !aDistToNearest || *aDistToNearest > aSnapRange;
271 const int escapeRange = 2 * aSnapRange;
275 longRangeEscapeAngle );
277 longRangeEscapeAngle );
281 if( !escapedX && gridBetterThanNearest )
287 if( !escapedY && gridBetterThanNearest )
295 return bestSnapPoint;
KIGFX::CONSTRUCTION_GEOM & m_constructionGeomPreview
void AddConstructionItems(CONSTRUCTION_ITEM_BATCH aBatch, bool aIsPersistent)
Add a batch of construction items to the helper.
OPT_VECTOR2I m_snapLineEnd
void ClearSnapLine()
Clear the snap line origin and end points.
OPT_VECTOR2I m_snapLineOrigin
std::deque< CONSTRUCTION_ITEM_BATCH > m_temporaryConstructionBatches
GFX_UPDATE_CALLBACK m_updateCallback
void SetSnappedAnchor(const VECTOR2I &aAnchorPos)
Inform the construction manager that an anchor snap is wanted.
std::vector< CONSTRUCTION_ITEM_BATCH > GetConstructionItems() const
OPT_VECTOR2I GetNearestSnapLinePoint(const VECTOR2I &aCursor, const VECTOR2I &aNearestGrid, std::optional< int > aDistToNearest, int snapRange) const
If the snap line is active, return the best snap point that is closest to the cursor.
std::vector< CONSTRUCTION_ITEM > CONSTRUCTION_ITEM_BATCH
std::optional< CONSTRUCTION_ITEM_BATCH > m_persistentConstructionBatch
void SetSnapLineOrigin(const VECTOR2I &aOrigin)
The snap point is a special point that is located at the last point the cursor snapped to.
void SetSnapLineEnd(const OPT_VECTOR2I &aSnapPoint)
Set the end point of the snap line.
bool InvolvesAllGivenRealItems(const std::vector< EDA_ITEM * > &aItems) const
Check if all 'real' (non-null = constructed) the items in the batch are in the list of items currentl...
CONSTRUCTION_MANAGER(KIGFX::CONSTRUCTION_GEOM &aHelper)
std::set< EDA_ITEM * > m_involvedItems
A base class for most all the KiCad significant classes used in schematics and boards.
Shows construction geometry for things like line extensions, arc centers, etc.
void AddDrawable(const DRAWABLE &aItem, bool aIsPersistent)
std::variant< SEG, LINE, HALF_LINE, CIRCLE, SHAPE_ARC, VECTOR2I > DRAWABLE
void SetSnapLine(const SEG &aLine)
static bool pointHasEscapedSnapLineX(const VECTOR2I &aCursor, const VECTOR2I &aSnapLineOrigin, int aEscapeRange, EDA_ANGLE aLongRangeEscapeAngle)
Check if the cursor has moved far enough away from the snap line origin to escape snapping in the X d...
static bool pointHasEscapedSnapLineY(const VECTOR2I &aCursor, const VECTOR2I &aSnapLineOrigin, int aEscapeRange, EDA_ANGLE aLongRangeEscapeAngle)
As above, but for the Y direction.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
std::optional< VECTOR2I > OPT_VECTOR2I
std::vector< KIGFX::CONSTRUCTION_GEOM::DRAWABLE > Constructions
VECTOR2< int32_t > VECTOR2I