KiCad PCB EDA Suite
Loading...
Searching...
No Matches
snap_resolver.h File Reference
#include <math/vector2d.h>
#include <math/box2.h>
#include <geometry/intersection.h>
#include <array>
#include <cstdint>
#include <chrono>
#include <functional>
#include <iosfwd>
#include <optional>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  SNAP_STABLE_ID
 
struct  SNAP_GUIDE
 
struct  SNAP_REFERENCE_PREFERENCE
 
struct  SNAP_SOURCE_CONTEXT
 
struct  SNAP_CANDIDATE
 
struct  SNAP_RESULT
 
class  SNAP_RESOLVER
 

Typedefs

using SNAP_TARGET_ID = std::array<uint8_t, 16>
 

Enumerations

enum class  SNAP_EDITOR_PROFILE {
  POINT_EDIT , CONSTRAINED_MOVE , DRAW , RIGID_PLACEMENT ,
  PICKER , VIEWER , MEASUREMENT
}
 
enum class  SNAP_PRIORITY_TIER {
  AUTHORED_INTRINSIC , ANGLE , OBJECT , GRID ,
  CURSOR
}
 
enum class  SNAP_CANDIDATE_SUBTYPE {
  INTRINSIC_ANCHOR , CONSTRUCTED_POINT , INTERSECTION , TANGENT_NORMAL ,
  BBOX_LAYOUT , FINITE_MANIFOLD , ACTIVE_EXTENSION , ANGLE_BRANCH ,
  GRID_AXIS , CURSOR
}
 
enum class  SNAP_RELATION {
  COINCIDENCE , X_COORDINATE , Y_COORDINATE , POINT_ON_LINE ,
  POINT_ON_RAY , POINT_ON_SEGMENT , POINT_ON_CIRCLE , POINT_ON_ARC ,
  ANGLE , TANGENT , NORMAL , BBOX_ALIGNMENT ,
  BBOX_EQUAL_GAP , GRID_X , GRID_Y
}
 
enum class  SNAP_RESULT_STATUS {
  SUCCESS , BASE_CONFLICT , INCOMPATIBLE , NONCONVERGENT ,
  INVALID_GEOMETRY , BUDGET_EXHAUSTED
}
 
enum class  SNAP_ID_KIND {
  ITEM_GEOMETRY , INTRINSIC_ANCHOR , CONSTRUCTED_ANCHOR , SELF_SEGMENT ,
  SELF_ENDPOINT , SELF_POINT , CONSTRUCTION , INTERSECTION ,
  TANGENT , NORMAL , ANGLE_BRANCH , BOUNDS_X ,
  BOUNDS_Y , ANCHOR_POINT_X , ANCHOR_POINT_Y , EQUAL_GAP_X ,
  EQUAL_GAP_Y , COPY_GAP_X , COPY_GAP_Y , GRID_X ,
  GRID_Y
}
 
enum class  SNAP_GUIDE_STYLE { SNAP_LINE , DIMENSION_BRACKET }
 
enum class  SNAP_REFERENCE_KIND { NONE , BOUNDS_FEATURE , ANCHOR_POINT }
 

Functions

std::ostream & operator<< (std::ostream &aStream, SNAP_RESULT_STATUS aStatus)
 
SNAP_STABLE_ID MakeDerivedSnapId (SNAP_ID_KIND aKind, const SNAP_STABLE_ID &aSource, int aFeatureIndex=0, int aSolutionBranch=0)
 
SNAP_STABLE_ID MakeIntersectionSnapId (const SNAP_STABLE_ID &aFirst, const SNAP_STABLE_ID &aSecond, int aSolutionBranch)
 
SNAP_STABLE_ID MakePointSnapId (SNAP_ID_KIND aKind, const VECTOR2I &aPoint, int aFeatureIndex=0)
 
SNAP_STABLE_ID MakeCompositeSnapId (SNAP_ID_KIND aKind, const std::vector< SNAP_TARGET_ID > &aTargets, int aFeatureIndex=0)
 

Variables

constexpr double SNAP_SCREEN_RADIUS = 25.0
 Screen-space radius (px) inside which a candidate is snappable.
 
constexpr double SNAP_DEFAULT_RANKING_HYSTERESIS = 5.0 / SNAP_SCREEN_RADIUS
 Default ranking stickiness, as a fraction of SNAP_SCREEN_RADIUS.
 

Typedef Documentation

◆ SNAP_TARGET_ID

using SNAP_TARGET_ID = std::array<uint8_t, 16>

Definition at line 143 of file snap_resolver.h.

Enumeration Type Documentation

◆ SNAP_CANDIDATE_SUBTYPE

enum class SNAP_CANDIDATE_SUBTYPE
strong
Enumerator
INTRINSIC_ANCHOR 
CONSTRUCTED_POINT 
INTERSECTION 
TANGENT_NORMAL 
BBOX_LAYOUT 
FINITE_MANIFOLD 
ACTIVE_EXTENSION 
ANGLE_BRANCH 
GRID_AXIS 
CURSOR 

Definition at line 67 of file snap_resolver.h.

◆ SNAP_EDITOR_PROFILE

enum class SNAP_EDITOR_PROFILE
strong
Enumerator
POINT_EDIT 
CONSTRAINED_MOVE 
DRAW 
RIGID_PLACEMENT 
PICKER 
VIEWER 
MEASUREMENT 

Definition at line 45 of file snap_resolver.h.

◆ SNAP_GUIDE_STYLE

enum class SNAP_GUIDE_STYLE
strong
Enumerator
SNAP_LINE 
DIMENSION_BRACKET 

Definition at line 167 of file snap_resolver.h.

◆ SNAP_ID_KIND

enum class SNAP_ID_KIND
strong
Enumerator
ITEM_GEOMETRY 
INTRINSIC_ANCHOR 
CONSTRUCTED_ANCHOR 
SELF_SEGMENT 
SELF_ENDPOINT 
SELF_POINT 
CONSTRUCTION 
INTERSECTION 
TANGENT 
NORMAL 
ANGLE_BRANCH 
BOUNDS_X 
BOUNDS_Y 
ANCHOR_POINT_X 
ANCHOR_POINT_Y 
EQUAL_GAP_X 
EQUAL_GAP_Y 
COPY_GAP_X 
COPY_GAP_Y 
GRID_X 
GRID_Y 

Definition at line 116 of file snap_resolver.h.

◆ SNAP_PRIORITY_TIER

enum class SNAP_PRIORITY_TIER
strong
Enumerator
AUTHORED_INTRINSIC 
ANGLE 
OBJECT 
GRID 
CURSOR 

Definition at line 57 of file snap_resolver.h.

◆ SNAP_REFERENCE_KIND

enum class SNAP_REFERENCE_KIND
strong
Enumerator
NONE 
BOUNDS_FEATURE 
ANCHOR_POINT 

Definition at line 182 of file snap_resolver.h.

◆ SNAP_RELATION

enum class SNAP_RELATION
strong
Enumerator
COINCIDENCE 
X_COORDINATE 
Y_COORDINATE 
POINT_ON_LINE 
POINT_ON_RAY 
POINT_ON_SEGMENT 
POINT_ON_CIRCLE 
POINT_ON_ARC 
ANGLE 
TANGENT 
NORMAL 
BBOX_ALIGNMENT 
BBOX_EQUAL_GAP 
GRID_X 
GRID_Y 

Definition at line 82 of file snap_resolver.h.

◆ SNAP_RESULT_STATUS

enum class SNAP_RESULT_STATUS
strong
Enumerator
SUCCESS 
BASE_CONFLICT 
INCOMPATIBLE 
NONCONVERGENT 
INVALID_GEOMETRY 
BUDGET_EXHAUSTED 

Definition at line 102 of file snap_resolver.h.

Function Documentation

◆ MakeCompositeSnapId()

SNAP_STABLE_ID MakeCompositeSnapId ( SNAP_ID_KIND aKind,
const std::vector< SNAP_TARGET_ID > & aTargets,
int aFeatureIndex = 0 )

◆ MakeDerivedSnapId()

◆ MakeIntersectionSnapId()

SNAP_STABLE_ID MakeIntersectionSnapId ( const SNAP_STABLE_ID & aFirst,
const SNAP_STABLE_ID & aSecond,
int aSolutionBranch )

◆ MakePointSnapId()

◆ operator<<()

std::ostream & operator<< ( std::ostream & aStream,
SNAP_RESULT_STATUS aStatus )

Definition at line 440 of file snap_resolver.cpp.

Variable Documentation

◆ SNAP_DEFAULT_RANKING_HYSTERESIS

double SNAP_DEFAULT_RANKING_HYSTERESIS = 5.0 / SNAP_SCREEN_RADIUS
constexpr

Default ranking stickiness, as a fraction of SNAP_SCREEN_RADIUS.

Definition at line 42 of file snap_resolver.h.

◆ SNAP_SCREEN_RADIUS

double SNAP_SCREEN_RADIUS = 25.0
constexpr

Screen-space radius (px) inside which a candidate is snappable.

Editors scale this to world units; it lives here so the resolver and its callers agree on what "normalized residual" means.

Definition at line 39 of file snap_resolver.h.

Referenced by GRID_HELPER::computeSnapRanges().