KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ellipse_draw_behavior.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
22#include <geometry/eda_angle.h>
23#include <math/vector2d.h>
24#include <eda_units.h>
25#include <eda_shape.h>
28
29struct EDA_IU_SCALE;
30
31
37 : public MANAGED_DRAW_BEHAVIOR<KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT>
38{
39public:
41
44
45 bool OnProperties( EDA_SHAPE& aShape ) override
46 {
48 }
49
50 void ApplyToShape( EDA_SHAPE& aShape ) const override
51 {
52 const ELLIPSE<int> ellipse = m_manager.GetEllipse();
53
54 aShape.SetCenter( ellipse.Center );
55 aShape.SetEllipseMajorRadius( ellipse.MajorRadius );
56 aShape.SetEllipseMinorRadius( ellipse.MinorRadius );
57 aShape.SetEllipseRotation( ellipse.Rotation );
58 aShape.SetEllipseStartAngle( ellipse.StartAngle );
59 aShape.SetEllipseEndAngle( ellipse.EndAngle );
60 }
61};
void SetCenter(const VECTOR2I &aCenter)
virtual void SetEllipseEndAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:416
virtual void SetEllipseRotation(const EDA_ANGLE &aA)
Definition eda_shape.h:397
virtual void SetEllipseMinorRadius(int aR)
Definition eda_shape.h:388
virtual void SetEllipseMajorRadius(int aR)
Definition eda_shape.h:379
virtual void SetEllipseStartAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:407
bool OnProperties(EDA_SHAPE &aShape) override
Called when the user invokes the properties action mid-draw.
void ApplyToShape(EDA_SHAPE &aShape) const override
Transfer the current geometry to an EDA_SHAPE.
ELLIPSE_ARC_DRAW_BEHAVIOR(const ELLIPSE_ARC_DRAW_BEHAVIOR &)=delete
MANAGED_DRAW_BEHAVIOR(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits)
ELLIPSE_ARC_DRAW_BEHAVIOR & operator=(const ELLIPSE_ARC_DRAW_BEHAVIOR &)=delete
Plain ellipse / elliptical-arc data.
Definition ellipse.h:32
NumericType MinorRadius
Definition ellipse.h:103
EDA_ANGLE Rotation
Definition ellipse.h:104
EDA_ANGLE StartAngle
Definition ellipse.h:105
NumericType MajorRadius
Definition ellipse.h:102
EDA_ANGLE EndAngle
Definition ellipse.h:106
VECTOR2< NumericType > Center
Definition ellipse.h:101
@ SET_BBOX_C1
Waiting to lock in first bbox corner.
MANAGED_DRAW_BEHAVIOR(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits)