KiCad PCB EDA Suite
Loading...
Searching...
No Matches
bezier_geom_manager.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 2
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#pragma once
21
23#include <geometry/eda_angle.h>
24#include <geometry/seg.h>
25
26namespace KIGFX
27{
28namespace PREVIEW
29{
30
40{
41public:
43
52
53 int getMaxStep() const override { return COMPLETE; }
54
59 BEZIER_STEPS GetStep() const { return static_cast<BEZIER_STEPS>( getStep() ); }
60
61 bool acceptPoint( const VECTOR2I& aPt ) override;
62
63 /*
64 * Geometry query interface - used by clients of the manager
65 */
66
68 VECTOR2I GetStart() const;
69
71 VECTOR2I GetControlC1() const;
72 VECTOR2I GetControlC2() const;
73
75 VECTOR2I GetEnd() const;
76
77private:
78 /*
79 * Point acceptor functions
80 */
81
83 bool setStart( const VECTOR2I& aOrigin );
84 bool setControlC1( const VECTOR2I& aControl );
85 bool setEnd( const VECTOR2I& aCursor );
86 bool setControlC2( const VECTOR2I& aControl );
87
88 /*
89 * Bezier geometry
90 */
95};
96
97} // namespace PREVIEW
98} // namespace KIGFX
VECTOR2I GetEnd() const
Get the coordinates of the arc end point.
VECTOR2I GetControlC1() const
Get the coordinates of the arc start.
VECTOR2I GetStart() const
Get the center point of the arc (valid when state > SET_ORIGIN)
bool acceptPoint(const VECTOR2I &aPt) override
Function that accepts a point for a stage, or rejects it to return to the previous stage.
int getMaxStep() const override
The highest step this manager has - used to recognize completion and to clamp the step as it advances...
bool setEnd(const VECTOR2I &aCursor)
@ SET_CONTROL2
Waiting to lock in the second control point.
@ SET_END
Waiting to lock in the end point.
@ SET_CONTROL1
Waiting to lock in the first control point.
@ SET_START
Waiting to lock in the start point.
bool setControlC1(const VECTOR2I &aControl)
bool setControlC2(const VECTOR2I &aControl)
BEZIER_STEPS GetStep() const
Get the current step the manager is on (useful when drawing something depends on the current state)
bool setStart(const VECTOR2I &aOrigin)
Set the center point of the arc.
A geometry manager that works by accepting a sequence of points and advancing though stages of geomet...
int getStep() const
Get the current stage of the manager.
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708