KiCad PCB EDA Suite
Loading...
Searching...
No Matches
snap_inference.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef SNAP_INFERENCE_H
21#define SNAP_INFERENCE_H
22
23#include <snap/snap_resolver.h>
24
26
27#include <optional>
28#include <vector>
29
30
38
39
41{
44 std::optional<SNAP_TARGET_ID> parent;
45};
46
47
50{
53 std::optional<SNAP_TARGET_ID> parent;
54};
55
56
58{
59public:
60 void AddPath( SNAP_OBJECT_PATH aPath );
61 void AddBounds( SNAP_OBJECT_BOUNDS aBounds );
63 void Clear();
64
65 void ActivateExtension( const SNAP_STABLE_ID& aId );
66 void ClearExtensions();
67
68 std::vector<SNAP_CANDIDATE> CollectObjectGeometry( const SNAP_SOURCE_CONTEXT& aContext, int aRadius ) const;
69 std::vector<SNAP_CANDIDATE> CollectTangentNormal( const SNAP_SOURCE_CONTEXT& aContext, int aRadius,
70 bool aTangentEnabled, bool aNormalEnabled ) const;
71 std::vector<SNAP_CANDIDATE> CollectAlignment( const SNAP_SOURCE_CONTEXT& aContext, int aRadius ) const;
72 std::vector<SNAP_CANDIDATE> CollectEqualSpacing( const SNAP_SOURCE_CONTEXT& aContext, int aRadius ) const;
73
74private:
75 bool eligible( const SNAP_SOURCE_CONTEXT& aContext, const SNAP_STABLE_ID& aId ) const;
76 bool eligible( const SNAP_SOURCE_CONTEXT& aContext, const SNAP_OBJECT_BOUNDS& aBounds ) const;
77 bool eligible( const SNAP_SOURCE_CONTEXT& aContext, const SNAP_ALIGNMENT_POINT& aPoint ) const;
78
79 std::vector<SNAP_OBJECT_PATH> m_paths;
80 std::vector<SNAP_OBJECT_BOUNDS> m_bounds;
81 std::vector<SNAP_ALIGNMENT_POINT> m_alignmentPoints;
82 std::vector<SNAP_STABLE_ID> m_activeExtensions;
83};
84
85#endif
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
std::vector< SNAP_STABLE_ID > m_activeExtensions
std::vector< SNAP_CANDIDATE > CollectObjectGeometry(const SNAP_SOURCE_CONTEXT &aContext, int aRadius) const
bool eligible(const SNAP_SOURCE_CONTEXT &aContext, const SNAP_STABLE_ID &aId) const
std::vector< SNAP_OBJECT_BOUNDS > m_bounds
std::vector< SNAP_CANDIDATE > CollectEqualSpacing(const SNAP_SOURCE_CONTEXT &aContext, int aRadius) const
void AddBounds(SNAP_OBJECT_BOUNDS aBounds)
std::vector< SNAP_ALIGNMENT_POINT > m_alignmentPoints
void ActivateExtension(const SNAP_STABLE_ID &aId)
std::vector< SNAP_OBJECT_PATH > m_paths
std::vector< SNAP_CANDIDATE > CollectTangentNormal(const SNAP_SOURCE_CONTEXT &aContext, int aRadius, bool aTangentEnabled, bool aNormalEnabled) const
void AddPath(SNAP_OBJECT_PATH aPath)
void AddAlignmentPoint(SNAP_ALIGNMENT_POINT aPoint)
std::vector< SNAP_CANDIDATE > CollectAlignment(const SNAP_SOURCE_CONTEXT &aContext, int aRadius) const
std::variant< LINE, HALF_LINE, SEG, CIRCLE, SHAPE_ARC, BOX2I > INTERSECTABLE_GEOM
A variant type that can hold any of the supported geometry types for intersection calculations.
A named point a parent object offers for alignment, such as a pad center or a pin end.
std::optional< SNAP_TARGET_ID > parent
SNAP_STABLE_ID id
std::optional< SNAP_TARGET_ID > parent
SNAP_STABLE_ID id
INTERSECTABLE_GEOM geometry
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683