Chemical Data Processing Library C++ API - Version 1.2.0
GraphicsPrimitive2D.hpp
Go to the documentation of this file.
1 /*
2  * GraphicsPrimitive2D.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_GRAPHICSPRIMITIVE2D_HPP
30 #define CDPL_VIS_GRAPHICSPRIMITIVE2D_HPP
31 
32 #include <memory>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
35 
36 
37 namespace CDPL
38 {
39 
40  namespace Vis
41  {
42 
43  class Renderer2D;
44  class FontMetrics;
45  class Rectangle2D;
46 
57  {
58 
59  public:
63  typedef std::shared_ptr<GraphicsPrimitive2D> SharedPointer;
64 
68  virtual ~GraphicsPrimitive2D() {}
69 
74  virtual void render(Renderer2D& renderer) const = 0;
75 
80  virtual SharedPointer clone() const = 0;
81 
87  virtual void getBounds(Rectangle2D& bounds, FontMetrics* font_metrics = 0) const = 0;
88  };
89  } // namespace Vis
90 } // namespace CDPL
91 
92 #endif // CDPL_VIS_GRAPHICSPRIMITIVE2D_HPP
Definition of the preprocessor macro CDPL_VIS_API.
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
An interface class with methods that provide information about the metrics of a font.
Definition: FontMetrics.hpp:71
The abstract base class of all 2D graphics primitives.
Definition: GraphicsPrimitive2D.hpp:57
virtual void render(Renderer2D &renderer) const =0
Visualizes the graphics primitive by means of the Renderer2D instance renderer.
virtual SharedPointer clone() const =0
Creates a dynamically allocated copy of the graphics primitive.
virtual ~GraphicsPrimitive2D()
Virtual destructor.
Definition: GraphicsPrimitive2D.hpp:68
std::shared_ptr< GraphicsPrimitive2D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated GraphicsPrimitive2D instances.
Definition: GraphicsPrimitive2D.hpp:63
virtual void getBounds(Rectangle2D &bounds, FontMetrics *font_metrics=0) const =0
Calculates the bounds of the graphics primitive.
Specifies an axis aligned rectangular area in 2D space.
Definition: Rectangle2D.hpp:51
An interface that provides methods for low level 2D drawing operations.
Definition: Renderer2D.hpp:86
The namespace of the Chemical Data Processing Library.