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>
27
28struct EDA_IU_SCALE;
29class EDA_SHAPE;
30
31
37 : public MANAGED_DRAW_BEHAVIOR<KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT>
38{
39public:
41
44
45 void ApplyToShape( EDA_SHAPE& aShape ) const override
46 {
47 const ELLIPSE<int> ellipse = m_manager.GetEllipse();
48
49 aShape.SetCenter( ellipse.Center );
50 aShape.SetEllipseMajorRadius( ellipse.MajorRadius );
51 aShape.SetEllipseMinorRadius( ellipse.MinorRadius );
52 aShape.SetEllipseRotation( ellipse.Rotation );
53 aShape.SetEllipseStartAngle( ellipse.StartAngle );
54 aShape.SetEllipseEndAngle( ellipse.EndAngle );
55 }
56};
void SetCenter(const VECTOR2I &aCenter)
virtual void SetEllipseEndAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:331
virtual void SetEllipseRotation(const EDA_ANGLE &aA)
Definition eda_shape.h:312
virtual void SetEllipseMinorRadius(int aR)
Definition eda_shape.h:303
virtual void SetEllipseMajorRadius(int aR)
Definition eda_shape.h:294
virtual void SetEllipseStartAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:322
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
MANAGED_DRAW_BEHAVIOR(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits)