8 #ifndef IMPDISPLAY_GEOMETRY_MACROS_H
9 #define IMPDISPLAY_GEOMETRY_MACROS_H
15 #define IMP_GEOMETRY(Name) \
16 IMPDISPLAY_DEPRECATED_MACRO(2.1, "Just declare the method."); \
17 virtual IMP::display::Geometries get_components() const IMP_OVERRIDE; \
18 IMP_OBJECT_NO_WARNING(Name)
20 #define IMP_DISPLAY_GEOMETRY_DEF(Name, Type) \
21 Name::Name(std::string name) : display::Geometry(name) {} \
22 Name::Name(const Type &v) : display::Geometry(#Name), v_(v) {} \
23 Name::Name(const Type &v, const Color &c) \
24 : display::Geometry(c, #Name), v_(v) {} \
25 Name::Name(const Type &v, const std::string n) \
26 : display::Geometry(n), v_(v) {} \
27 Name::Name(const Type &v, const Color &c, std::string n) \
28 : display::Geometry(c, n), v_(v) {} \
29 display::Geometries Name::get_components() const { \
30 return display::Geometries(1, const_cast<Name *>(this)); \
32 IMP_REQUIRE_SEMICOLON_NAMESPACE
34 #if defined(IMP_DOXYGEN) || defined(SWIG)
36 #define IMP_DISPLAY_GEOMETRY_DECL(Name, Names, Type) \
38 class IMPDISPLAYEXPORT Name : public display::Geometry { \
40 Name(const Type &v); \
41 Name(const Type &v, const display::Color &c); \
42 Name(const Type &v, const std::string n); \
43 Name(const Type &v, const display::Color &c, std::string n); \
44 virtual const Type &get_geometry() const { return v_; } \
45 void set_geometry(const Type &v) { v_ = v; } \
46 virtual IMP::display::Geometries get_components() const IMP_OVERRIDE; \
47 IMP_OBJECT_METHODS(Name); \
50 inline Name *create_geometry(const Type &t, std::string name = #Type + \
54 #define IMP_DISPLAY_GEOMETRY_DECOMPOSABLE_DECL(Name, Names, Type) \
56 class IMPDISPLAYEXPORT Name : public display::Geometry { \
58 Name(const Type &v); \
59 Name(const Type &v, const display::Color &c); \
60 Name(const Type &v, const std::string n); \
61 Name(const Type &v, const display::Color &c, std::string n); \
62 virtual const Type &get_geometry() const { return v_; } \
63 void set_geometry(const Type &v) { v_ = v; } \
64 virtual IMP::display::Geometries get_components() const IMP_OVERRIDE; \
65 IMP_OBJECT_METHODS(Name); \
68 inline Name *create_geometry(const Type &t, std::string name = #Type + \
75 #define IMP_DISPLAY_GEOMETRY_DECL(Name, Names, Type) \
77 class IMPDISPLAYEXPORT Name : public display::Geometry { \
81 Name(std::string name); \
82 Name(const Type &v); \
83 Name(const Type &v, const display::Color &c); \
84 Name(const Type &v, const std::string n); \
85 Name(const Type &v, const display::Color &c, std::string n); \
86 virtual const Type &get_geometry() const { return v_; } \
87 void set_geometry(const Type &v) { v_ = v; } \
88 virtual IMP::display::Geometries get_components() const IMP_OVERRIDE; \
89 IMP_OBJECT_METHODS(Name); \
91 inline Name *create_geometry( \
92 const Type &t, std::string name = std::string(#Type) + "%1%") { \
93 return new Name(t, name); \
95 IMP_OBJECTS(Name, Names)
97 #define IMP_DISPLAY_GEOMETRY_DECOMPOSABLE_DECL(Name, Names, Type) \
99 class IMPDISPLAYEXPORT Name : public display::Geometry { \
103 Name(std::string name); \
104 Name(const Type &v); \
105 Name(const Type &v, const display::Color &c); \
106 Name(const Type &v, const std::string n); \
107 Name(const Type &v, const display::Color &c, std::string n); \
108 virtual const Type &get_geometry() const { return v_; } \
109 void set_geometry(const Type &v) { v_ = v; } \
110 virtual IMP::display::Geometries get_components() const IMP_OVERRIDE; \
111 IMP_OBJECT_METHODS(Name); \
113 inline Name *create_geometry( \
114 const Type &t, std::string name = std::string(#Type) + "%1%") { \
115 return new Name(t, name); \
117 IMP_OBJECTS(Name, Names)
120 #define IMP_DISPLAY_GEOMETRY_DECOMPOSABLE_DEF(Name, Type, decomp) \
121 Name::Name(std::string name) : display::Geometry(name) {} \
122 Name::Name(const Type &v) : display::Geometry(#Name), v_(v) {} \
123 Name::Name(const Type &v, const display::Color &c) \
124 : display::Geometry(c, #Name), v_(v) {} \
125 Name::Name(const Type &v, const std::string n) \
126 : display::Geometry(n), v_(v) {} \
127 Name::Name(const Type &v, const display::Color &c, std::string n) \
128 : display::Geometry(c, n), v_(v) {} \
129 display::Geometries Name::get_components() const { \
130 display::Geometries ret; \
134 IMP_REQUIRE_SEMICOLON_NAMESPACE
136 #define IMP_PARTICLE_GEOMETRY(Name, Decorator, action) \
138 class Name##Geometry : public display::SingletonGeometry { \
140 Name##Geometry(kernel::Particle *p) : display::SingletonGeometry(p) {} \
141 Name##Geometry(Decorator d) : display::SingletonGeometry(d) {} \
142 IMP_IMPLEMENT_INLINE(display::Geometries get_components() const, { \
143 display::Geometries ret; \
144 Decorator d(get_particle()); \
148 IMP_OBJECT_METHODS(Name##Geometry); \
151 class Name##sGeometry : public display::SingletonsGeometry { \
153 Name##sGeometry(SingletonContainer *sc) \
154 : display::SingletonsGeometry(sc) {} \
155 IMP_IMPLEMENT_INLINE(display::Geometries get_components() const, { \
156 display::Geometries ret; \
157 IMP_CONTAINER_FOREACH(SingletonContainer, get_container(), { \
158 Decorator d(get_container()->get_model(), _1); \
163 IMP_OBJECT_METHODS(Name##sGeometry); \
166 #define IMP_PARTICLE_PAIR_GEOMETRY(Name, Decorator, action) \
168 class Name##Geometry : public display::PairGeometry { \
170 Name##Geometry(const kernel::ParticlePair &pp) \
171 : display::PairGeometry(pp) {} \
172 IMP_IMPLEMENT_INLINE(display::Geometries get_components() const, { \
173 display::Geometries ret; \
174 Decorator d0(get_particle_pair()[0]); \
175 Decorator d1(get_particle_pair()[1]); \
178 }) IMP_OBJECT_METHODS(Name##Geometry); \
181 class Name##sGeometry : public display::PairsGeometry { \
183 Name##sGeometry(PairContainer *sc) : display::PairsGeometry(sc) {} \
184 IMP_IMPLEMENT_INLINE(display::Geometries get_components() const, { \
185 display::Geometries ret; \
186 IMP_CONTAINER_FOREACH(PairContainer, get_container(), { \
187 Decorator d0(get_container()->get_model(), _1[0]); \
188 Decorator d1(get_container()->get_model(), _1[1]); \
193 IMP_OBJECT_METHODS(Name##sGeometry); \
Import IMP/kernel/pair_macros.h in the namespace.
Import IMP/kernel/singleton_macros.h in the namespace.
Implement geometry for the basic shapes from IMP.algebra.