Chemical Data Processing Library C++ API - Version 1.1.1
EllipsePrimitive2D.hpp
Go to the documentation of this file.
1 /*
2  * EllipsePrimitive2D.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_VIS_ELLIPSEPRIMITIVE2D_HPP
30 #define CDPL_VIS_ELLIPSEPRIMITIVE2D_HPP
31 
32 #include <memory>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
36 #include "CDPL/Vis/Pen.hpp"
37 #include "CDPL/Vis/Brush.hpp"
38 #include "CDPL/Math/Vector.hpp"
39 
40 
41 namespace CDPL
42 {
43 
44  namespace Vis
45  {
46 
51  {
52 
53  public:
57  typedef std::shared_ptr<EllipsePrimitive2D> SharedPointer;
58 
63  width(0.0), height(0.0) {}
64 
68  EllipsePrimitive2D(const Math::Vector2D& pos, double width, double height):
69  position(pos), width(width), height(height) {}
70 
71  void render(Renderer2D& renderer) const;
72 
77  void setPen(const Pen& pen);
78 
83  const Pen& getPen() const;
84 
89  void setBrush(const Brush& brush);
90 
95  const Brush& getBrush() const;
96 
101  void setPosition(const Math::Vector2D& pos);
102 
107  const Math::Vector2D& getPosition() const;
108 
113  void setWidth(double width);
114 
119  double getWidth() const;
120 
125  void setHeight(double height);
126 
131  double getHeight() const;
132 
134 
135  void getBounds(Rectangle2D& bounds, FontMetrics* font_metrics = 0) const;
136 
137  private:
138  Math::Vector2D position;
139  double width;
140  double height;
141  Pen pen;
142  Brush brush;
143  };
144  } // namespace Vis
145 } // namespace CDPL
146 
147 #endif // CDPL_VIS_ELLIPSEPRIMITIVE2D_HPP
CDPL::Vis::EllipsePrimitive2D::getBounds
void getBounds(Rectangle2D &bounds, FontMetrics *font_metrics=0) const
Calculates the bounds of the graphics primitive.
CDPL::Vis::Renderer2D
An interface that provides methods for low level 2D drawing operations.
Definition: Renderer2D.hpp:86
CDPL::Vis::EllipsePrimitive2D::clone
GraphicsPrimitive2D::SharedPointer clone() const
Creates a dynamically allocated copy of the graphics primitive.
CDPL::Vis::GraphicsPrimitive2D::SharedPointer
std::shared_ptr< GraphicsPrimitive2D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated GraphicsPrimitive2D instances.
Definition: GraphicsPrimitive2D.hpp:63
CDPL::Vis::Pen
Specifies how to draw lines and outlines of shapes.
Definition: Pen.hpp:53
CDPL::Vis::EllipsePrimitive2D::setBrush
void setBrush(const Brush &brush)
Sets the brush defining the fill color and fill pattern.
CDPL::Vis::EllipsePrimitive2D::getPosition
const Math::Vector2D & getPosition() const
Returns the position of the ellipse center.
CDPL::Vis::EllipsePrimitive2D::EllipsePrimitive2D
EllipsePrimitive2D(const Math::Vector2D &pos, double width, double height)
Constructs an undefined ellipse primitive.
Definition: EllipsePrimitive2D.hpp:68
CDPL::Vis::EllipsePrimitive2D::getBrush
const Brush & getBrush() const
Returns the brush defining the fill color and fill pattern.
CDPL::Vis::EllipsePrimitive2D::getHeight
double getHeight() const
Returns the diameter of the ellipse in y-direction.
CDPL::Vis::EllipsePrimitive2D::getWidth
double getWidth() const
Returns the diameter of the ellipse in x-direction.
CDPL::Vis::EllipsePrimitive2D::render
void render(Renderer2D &renderer) const
Visualizes the graphics primitive by means of the Renderer2D instance renderer.
CDPL::Vis::EllipsePrimitive2D::EllipsePrimitive2D
EllipsePrimitive2D()
Constructs an undefined ellipse primitive.
Definition: EllipsePrimitive2D.hpp:62
CDPL::Vis::EllipsePrimitive2D
A graphics primitive representing a ellipse.
Definition: EllipsePrimitive2D.hpp:51
Pen.hpp
Definition of the class CDPL::Vis::Pen.
CDPL::Vis::EllipsePrimitive2D::getPen
const Pen & getPen() const
Returns the pen defining the color, width, line style, cap style and join style of the ellipse outlin...
CDPL::Vis::EllipsePrimitive2D::setHeight
void setHeight(double height)
Sets the diameter of the ellipse in y-direction.
CDPL_VIS_API
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Vis::EllipsePrimitive2D::setWidth
void setWidth(double width)
Sets the diameter of the ellipse in x-direction.
GraphicsPrimitive2D.hpp
Definition of the class CDPL::Vis::GraphicsPrimitive2D.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Vis::GraphicsPrimitive2D
The abstract base class of all 2D graphics primitives.
Definition: GraphicsPrimitive2D.hpp:57
CDPL::Vis::Rectangle2D
Specifies an axis aligned rectangular area in 2D space.
Definition: Rectangle2D.hpp:51
CDPL::Math::Vector2D
CVector< double, 2 > Vector2D
A bounded 2 element vector holding floating point values of type double.
Definition: Vector.hpp:1632
CDPL::Vis::EllipsePrimitive2D::SharedPointer
std::shared_ptr< EllipsePrimitive2D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated EllipsePrimitive2D instances.
Definition: EllipsePrimitive2D.hpp:57
CDPL::Vis::EllipsePrimitive2D::setPosition
void setPosition(const Math::Vector2D &pos)
Sets the position of the ellipse center.
CDPL::Vis::Brush
Specifies the fill pattern and fill color of shapes.
Definition: Brush.hpp:50
CDPL::Vis::EllipsePrimitive2D::setPen
void setPen(const Pen &pen)
Sets the pen defining the color, width, line style, cap style and join style of the ellipse outline.
Brush.hpp
Definition of the class CDPL::Vis::Brush.
CDPL::Vis::FontMetrics
An interface class with methods that provide information about the metrics of a font.
Definition: FontMetrics.hpp:71
APIPrefix.hpp
Definition of the preprocessor macro CDPL_VIS_API.
Vector.hpp
Definition of vector data types.