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
58 /*
59 * Geometry query interface - used by clients of the manager
60 */
61
69
72
74 EDA_ANGLE GetEndAngle() const { return m_endAngle; }
75
77 VECTOR2I GetBboxCorner1() const { return m_bboxC1; }
78
80 VECTOR2I GetBboxCorner2() const { return m_bboxC2; }
81
82protected:
83 bool acceptPoint( const VECTOR2I& aPt ) override;
84
85private:
86 bool setBboxCorner1( const VECTOR2I& aPt );
87 bool setBboxCorner2( const VECTOR2I& aPt );
88 bool setStartAngle( const VECTOR2I& aPt );
89 bool setEndAngle( const VECTOR2I& aPt );
90
94 double m_majorRadius = 1.0;
95 double m_minorRadius = 1.0;
99};
100
101} // namespace PREVIEW
102} // namespace KIGFX
103
104#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 first bbox corner (valid after SET_BBOX_C1).
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 end angle (valid after SET_END_ANGLE). Always > startAngle.
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 second bbox corner (valid after SET_BBOX_C2).
@ 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...
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
static constexpr EDA_ANGLE ANGLE_360
Definition eda_angle.h:417
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683