KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ellipse_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#ifndef PREVIEW_ITEMS_ELLIPSE_GEOMETRY_MANAGER_H
21#define PREVIEW_ITEMS_ELLIPSE_GEOMETRY_MANAGER_H
22
24#include <geometry/eda_angle.h>
25#include <geometry/ellipse.h>
26
27namespace KIGFX
28{
29namespace PREVIEW
30{
31
41{
42public:
44
53
54 int getMaxStep() const override { return COMPLETE; }
55
56 ELLIPSE_STEPS GetStep() const { return static_cast<ELLIPSE_STEPS>( getStep() ); }
57
62 void Reset() override;
63
64 /*
65 * Geometry query interface - used by clients of the manager
66 */
67
75
78
80 EDA_ANGLE GetEndAngle() const { return m_endAngle; }
81
83 VECTOR2I GetBboxCorner1() const { return m_bboxC1; }
84
86 VECTOR2I GetBboxCorner2() const { return m_bboxC2; }
87
88protected:
89 bool acceptPoint( const VECTOR2I& aPt ) override;
90
91private:
92 bool setBboxCorner1( const VECTOR2I& aPt );
93 bool setBboxCorner2( const VECTOR2I& aPt );
94 bool setStartAngle( const VECTOR2I& aPt );
95 bool setEndAngle( const VECTOR2I& aPt );
96
100 double m_majorRadius = 1.0;
101 double m_minorRadius = 1.0;
105};
106
107} // namespace PREVIEW
108} // namespace KIGFX
109
110#endif // PREVIEW_ITEMS_ELLIPSE_GEOMETRY_MANAGER_H
Plain ellipse / elliptical-arc data.
Definition ellipse.h:32
ELLIPSE< int > GetEllipse() const
Get the ellipse defined by the current geometry (valid after SET_BBOX_C2).
EDA_ANGLE GetEndAngle() const
Get the end angle (valid after SET_END_ANGLE). Always > startAngle.
void Reset() override
Reset the manager to its initial state, clearing all construction state so that the next ellipse in a...
VECTOR2I GetBboxCorner2() const
Get the second bbox corner (valid after SET_BBOX_C2).
bool acceptPoint(const VECTOR2I &aPt) override
Function that accepts a point for a stage, or rejects it to return to the previous stage.
EDA_ANGLE GetStartAngle() const
Get the start angle (valid after SET_START_ANGLE).
int getMaxStep() const override
The highest step this manager has - used to recognize completion and to clamp the step as it advances...
VECTOR2I GetBboxCorner1() const
Get the first bbox corner (valid after SET_BBOX_C1).
@ SET_START_ANGLE
Waiting to lock in the start angle.
@ SET_BBOX_C1
Waiting to lock in first bbox corner.
@ SET_END_ANGLE
Waiting to lock in the end angle.
@ SET_BBOX_C2
Waiting to lock in second bbox corner.
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.
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:448
static constexpr EDA_ANGLE ANGLE_360
Definition eda_angle.h:454
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708