IMP logo
IMP Reference Guide  develop.33c691def1,2022/08/08
The Integrative Modeling Platform
declare_Geometry.h
Go to the documentation of this file.
1 /**
2  * \file IMP/display/declare_Geometry.h
3  * \brief Implement geometry for the basic shapes from IMP.algebra.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPDISPLAY_DECLARE_GEOMETRY_H
9 #define IMPDISPLAY_DECLARE_GEOMETRY_H
10 
11 #include <IMP/display/display_config.h>
12 #include "Color.h"
13 #include <IMP/Object.h>
14 #include <IMP/object_macros.h>
15 #include <IMP/ref_counted_macros.h>
16 
17 IMPDISPLAY_BEGIN_NAMESPACE
18 class Geometry;
20 
21 //! The base class for geometry.
22 /** This class doesn't have much to say other than the color.
23 
24  \headerfile geometry.h "IMP/display/geometry.h"
25  */
26 class IMPDISPLAYEXPORT Geometry : public IMP::Object {
27  bool has_color_;
28  Color color_;
29 
30  public:
31  // Geometry();
32  Geometry(std::string name);
33  Geometry(Color c, std::string name);
34  // Geometry(Color c);
35  virtual Color get_color() const {
36  IMP_USAGE_CHECK(has_color_, "Color not set");
37  return color_;
38  }
39 
40  virtual bool get_has_color() const { return has_color_; }
41  void set_has_color(bool tf) { has_color_ = tf; }
42  void set_color(Color c) {
43  has_color_ = true;
44  color_ = c;
45  }
46 
47  //! Return a set of geometry composing this one
48  virtual Geometries get_components() const { return Geometries(); }
49 
51 };
52 
53 IMPDISPLAY_END_NAMESPACE
54 
55 #endif /* IMPDISPLAY_DECLARE_GEOMETRY_H */
Helper macros for implementing IMP Objects.
Macros to help with reference counting.
Represent an RGB color.
Definition: Color.h:24
The base class for geometry.
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Represent a color.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
IMP::Vector< IMP::Pointer< Geometry > > Geometries
virtual Geometries get_components() const
Return a set of geometry composing this one.
A shared base class to help in debugging and things.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168