Chemical Data Processing Library C++ API - Version 1.4.0
ImageWriter.hpp
Go to the documentation of this file.
1 /*
2  * ImageWriter.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_IMAGEWRITER_HPP
30 #define CDPL_VIS_IMAGEWRITER_HPP
31 
32 #include <memory>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
35 
36 
37 typedef struct _cairo_surface cairo_surface_t;
38 
39 
40 namespace CDPL
41 {
42 
43  namespace Base
44  {
45 
46  class DataIOBase;
47  }
48 
49  namespace Chem
50  {
51 
52  class Reaction;
53  class MolecularGraph;
54  } // namespace Chem
55 
56  namespace Vis
57  {
58 
59  class View2D;
60  class ReactionView2D;
61  class StructureView2D;
62  class Rectangle2D;
63 
73  {
74 
75  protected:
76  ImageWriter(const Base::DataIOBase& io_base);
77 
78  ImageWriter(const ImageWriter&) = delete;
79 
80  virtual ~ImageWriter();
81 
82  ImageWriter& operator=(const ImageWriter&) = delete;
83 
86 
87  virtual cairo_surface_t* createCairoSurface(double, double) const = 0;
88  virtual cairo_surface_t* createCairoSurface() const = 0;
89 
90  private:
91  cairo_surface_t* renderImage(View2D&) const;
92 
93  void getImageBounds(View2D&, Rectangle2D&) const;
94 
95  typedef std::unique_ptr<StructureView2D> StructureViewPtr;
96  typedef std::unique_ptr<ReactionView2D> ReactionViewPtr;
97 
98  const Base::DataIOBase& ioBase;
99  StructureViewPtr structureView;
100  ReactionViewPtr reactionView;
101  };
102  } // namespace Vis
103 } // namespace CDPL
104 
105 #endif // CDPL_VIS_IMAGEWRITER_HPP
struct _cairo_surface cairo_surface_t
Definition: CairoPointer.hpp:36
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.
Provides infrastructure for the registration of I/O callback functions.
Definition: DataIOBase.hpp:59
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
Abstract base class for chemical reactions composed of role-tagged Chem::Molecule components.
Definition: Reaction.hpp:59
Abstract base class for writers that render Chem::MolecularGraph or Chem::Reaction instances into a r...
Definition: ImageWriter.hpp:73
cairo_surface_t * renderMolGraphImage(const Chem::MolecularGraph &)
cairo_surface_t * renderReactionImage(const Chem::Reaction &)
ImageWriter(const ImageWriter &)=delete
virtual cairo_surface_t * createCairoSurface() const =0
ImageWriter(const Base::DataIOBase &io_base)
virtual cairo_surface_t * createCairoSurface(double, double) const =0
ImageWriter & operator=(const ImageWriter &)=delete
Specifies an axis aligned rectangular area in 2D space.
Definition: Rectangle2D.hpp:51
The abstract base of classes implementing the 2D visualization of data objects.
Definition: View2D.hpp:59
The namespace of the Chemical Data Processing Library.