9 #ifndef RMF_SHAPE_DECORATORS_H
10 #define RMF_SHAPE_DECORATORS_H
12 #include <RMF/config.h>
19 #include <RMF/internal/paths.h>
21 #include <boost/lexical_cast.hpp>
37 rgb_color_(rgb_color) {
43 return get_node().get_value(rgb_color_);
44 } RMF_DECORATOR_CATCH( );
46 Vector3 get_frame_rgb_color()
const {
48 return get_node().get_frame_value(rgb_color_);
49 } RMF_DECORATOR_CATCH( );
51 Vector3 get_static_rgb_color()
const {
53 return get_node().get_static_value(rgb_color_);
54 } RMF_DECORATOR_CATCH( );
57 static std::string get_decorator_type_name() {
58 return "ColoredConst";
75 } RMF_DECORATOR_CATCH( );
77 void set_frame_rgb_color(
Vector3 v) {
80 } RMF_DECORATOR_CATCH( );
82 void set_static_rgb_color(
Vector3 v) {
85 } RMF_DECORATOR_CATCH( );
88 static std::string get_decorator_type_name() {
102 cat_(fh.get_category(
"shape")),
106 cat_(fh.get_category(
"shape")),
112 + boost::lexical_cast<std::string>(nh.get_type())
113 +
"\" in decorator type Colored");
119 + boost::lexical_cast<std::string>(nh.get_type())
120 +
"\" in decorator type Colored");
121 return Colored(nh, rgb_color_);
127 && !nh.get_value(rgb_color_).get_is_null();
131 && !nh.get_static_value(rgb_color_).get_is_null();
133 RMF_SHOWABLE(ColoredFactory,
"ColoredFactory");
136 struct ColoredConstFactory:
public ColoredFactory {
137 ColoredConstFactory(FileConstHandle fh):
140 ColoredConstFactory(FileHandle fh):
161 coordinates_(coordinates),
166 Vector3 get_coordinates()
const {
168 return get_node().get_value(coordinates_);
169 } RMF_DECORATOR_CATCH( );
171 Vector3 get_frame_coordinates()
const {
173 return get_node().get_frame_value(coordinates_);
174 } RMF_DECORATOR_CATCH( );
176 Vector3 get_static_coordinates()
const {
178 return get_node().get_static_value(coordinates_);
179 } RMF_DECORATOR_CATCH( );
183 Float get_radius()
const {
185 return get_node().get_value(radius_);
186 } RMF_DECORATOR_CATCH( );
188 Float get_frame_radius()
const {
190 return get_node().get_frame_value(radius_);
191 } RMF_DECORATOR_CATCH( );
193 Float get_static_radius()
const {
195 return get_node().get_static_value(radius_);
196 } RMF_DECORATOR_CATCH( );
199 static std::string get_decorator_type_name() {
202 RMF_SHOWABLE(
BallConst,
"Ball: " << get_node());
216 void set_coordinates(
Vector3 v) {
219 } RMF_DECORATOR_CATCH( );
221 void set_frame_coordinates(
Vector3 v) {
224 } RMF_DECORATOR_CATCH( );
226 void set_static_coordinates(
Vector3 v) {
229 } RMF_DECORATOR_CATCH( );
233 void set_radius(
Float v) {
236 } RMF_DECORATOR_CATCH( );
238 void set_frame_radius(
Float v) {
241 } RMF_DECORATOR_CATCH( );
243 void set_static_radius(
Float v) {
246 } RMF_DECORATOR_CATCH( );
249 static std::string get_decorator_type_name() {
265 cat_(fh.get_category(
"shape")),
269 cat_(fh.get_category(
"shape")),
275 + boost::lexical_cast<std::string>(nh.
get_type())
276 +
"\" in decorator type Ball");
283 + boost::lexical_cast<std::string>(nh.
get_type())
284 +
"\" in decorator type Ball");
285 return Ball(nh, coordinates_,
292 && !nh.get_value(coordinates_).get_is_null();
296 && !nh.get_static_value(coordinates_).get_is_null()
297 && !nh.get_static_value(radius_).get_is_null();
299 RMF_SHOWABLE(BallFactory,
"BallFactory");
302 struct BallConstFactory:
public BallFactory {
303 BallConstFactory(FileConstHandle fh):
306 BallConstFactory(FileHandle fh):
329 axis_lengths_(axis_lengths),
330 orientation_(orientation),
331 coordinates_(coordinates) {
335 Vector3 get_axis_lengths()
const {
337 return get_node().get_value(axis_lengths_);
338 } RMF_DECORATOR_CATCH( );
340 Vector3 get_frame_axis_lengths()
const {
342 return get_node().get_frame_value(axis_lengths_);
343 } RMF_DECORATOR_CATCH( );
345 Vector3 get_static_axis_lengths()
const {
347 return get_node().get_static_value(axis_lengths_);
348 } RMF_DECORATOR_CATCH( );
352 Vector4 get_orientation()
const {
354 return get_node().get_value(orientation_);
355 } RMF_DECORATOR_CATCH( );
357 Vector4 get_frame_orientation()
const {
359 return get_node().get_frame_value(orientation_);
360 } RMF_DECORATOR_CATCH( );
362 Vector4 get_static_orientation()
const {
364 return get_node().get_static_value(orientation_);
365 } RMF_DECORATOR_CATCH( );
369 Vector3 get_coordinates()
const {
371 return get_node().get_value(coordinates_);
372 } RMF_DECORATOR_CATCH( );
374 Vector3 get_frame_coordinates()
const {
376 return get_node().get_frame_value(coordinates_);
377 } RMF_DECORATOR_CATCH( );
379 Vector3 get_static_coordinates()
const {
381 return get_node().get_static_value(coordinates_);
382 } RMF_DECORATOR_CATCH( );
385 static std::string get_decorator_type_name() {
386 return "EllipsoidConst";
404 void set_axis_lengths(
Vector3 v) {
407 } RMF_DECORATOR_CATCH( );
409 void set_frame_axis_lengths(
Vector3 v) {
412 } RMF_DECORATOR_CATCH( );
414 void set_static_axis_lengths(
Vector3 v) {
417 } RMF_DECORATOR_CATCH( );
421 void set_orientation(
Vector4 v) {
424 } RMF_DECORATOR_CATCH( );
426 void set_frame_orientation(
Vector4 v) {
429 } RMF_DECORATOR_CATCH( );
431 void set_static_orientation(
Vector4 v) {
434 } RMF_DECORATOR_CATCH( );
438 void set_coordinates(
Vector3 v) {
441 } RMF_DECORATOR_CATCH( );
443 void set_frame_coordinates(
Vector3 v) {
446 } RMF_DECORATOR_CATCH( );
448 void set_static_coordinates(
Vector3 v) {
451 } RMF_DECORATOR_CATCH( );
454 static std::string get_decorator_type_name() {
472 cat_(fh.get_category(
"shape")),
476 cat_(fh.get_category(
"shape")),
482 + boost::lexical_cast<std::string>(nh.
get_type())
483 +
"\" in decorator type Ellipsoid");
491 + boost::lexical_cast<std::string>(nh.
get_type())
492 +
"\" in decorator type Ellipsoid");
501 && !nh.get_value(axis_lengths_).get_is_null();
505 && !nh.get_static_value(axis_lengths_).get_is_null()
506 && !nh.get_static_value(orientation_).get_is_null()
507 && !nh.get_static_value(coordinates_).get_is_null();
509 RMF_SHOWABLE(EllipsoidFactory,
"EllipsoidFactory");
512 struct EllipsoidConstFactory:
public EllipsoidFactory {
513 EllipsoidConstFactory(FileConstHandle fh):
514 EllipsoidFactory(fh) {
516 EllipsoidConstFactory(FileHandle fh):
517 EllipsoidFactory(fh) {
538 coordinates_list_(coordinates_list) {
542 Float get_radius()
const {
544 return get_node().get_value(radius_);
545 } RMF_DECORATOR_CATCH( );
547 Float get_frame_radius()
const {
549 return get_node().get_frame_value(radius_);
550 } RMF_DECORATOR_CATCH( );
552 Float get_static_radius()
const {
554 return get_node().get_static_value(radius_);
555 } RMF_DECORATOR_CATCH( );
559 Vector3s get_coordinates_list()
const {
561 return get_node().get_value(coordinates_list_);
562 } RMF_DECORATOR_CATCH( );
564 Vector3s get_frame_coordinates_list()
const {
566 return get_node().get_frame_value(coordinates_list_);
567 } RMF_DECORATOR_CATCH( );
569 Vector3s get_static_coordinates_list()
const {
571 return get_node().get_static_value(coordinates_list_);
572 } RMF_DECORATOR_CATCH( );
575 static std::string get_decorator_type_name() {
576 return "CylinderConst";
592 void set_radius(
Float v) {
595 } RMF_DECORATOR_CATCH( );
597 void set_frame_radius(
Float v) {
600 } RMF_DECORATOR_CATCH( );
602 void set_static_radius(
Float v) {
605 } RMF_DECORATOR_CATCH( );
609 void set_coordinates_list(
Vector3s v) {
611 get_node().
set_value(coordinates_list_, v);
612 } RMF_DECORATOR_CATCH( );
614 void set_frame_coordinates_list(
Vector3s v) {
617 } RMF_DECORATOR_CATCH( );
619 void set_static_coordinates_list(
Vector3s v) {
622 } RMF_DECORATOR_CATCH( );
625 static std::string get_decorator_type_name() {
641 cat_(fh.get_category(
"shape")),
645 cat_(fh.get_category(
"shape")),
651 + boost::lexical_cast<std::string>(nh.
get_type())
652 +
"\" in decorator type Cylinder");
659 + boost::lexical_cast<std::string>(nh.
get_type())
660 +
"\" in decorator type Cylinder");
668 && !nh.get_value(radius_).get_is_null()
669 && !nh.get_value(coordinates_list_).get_is_null();
673 && !nh.get_static_value(radius_).get_is_null()
674 && !nh.get_static_value(coordinates_list_).get_is_null();
676 RMF_SHOWABLE(CylinderFactory,
"CylinderFactory");
679 struct CylinderConstFactory:
public CylinderFactory {
680 CylinderConstFactory(FileConstHandle fh):
681 CylinderFactory(fh) {
683 CylinderConstFactory(FileHandle fh):
684 CylinderFactory(fh) {
702 coordinates_list_(coordinates_list) {
706 Vector3s get_coordinates_list()
const {
708 return get_node().get_value(coordinates_list_);
709 } RMF_DECORATOR_CATCH( );
711 Vector3s get_frame_coordinates_list()
const {
713 return get_node().get_frame_value(coordinates_list_);
714 } RMF_DECORATOR_CATCH( );
716 Vector3s get_static_coordinates_list()
const {
718 return get_node().get_static_value(coordinates_list_);
719 } RMF_DECORATOR_CATCH( );
722 static std::string get_decorator_type_name() {
723 return "SegmentConst";
737 void set_coordinates_list(
Vector3s v) {
739 get_node().
set_value(coordinates_list_, v);
740 } RMF_DECORATOR_CATCH( );
742 void set_frame_coordinates_list(
Vector3s v) {
745 } RMF_DECORATOR_CATCH( );
747 void set_static_coordinates_list(
Vector3s v) {
750 } RMF_DECORATOR_CATCH( );
753 static std::string get_decorator_type_name() {
767 cat_(fh.get_category(
"shape")),
771 cat_(fh.get_category(
"shape")),
777 + boost::lexical_cast<std::string>(nh.
get_type())
778 +
"\" in decorator type Segment");
784 + boost::lexical_cast<std::string>(nh.
get_type())
785 +
"\" in decorator type Segment");
786 return Segment(nh, coordinates_list_);
792 && !nh.get_value(coordinates_list_).get_is_null();
796 && !nh.get_static_value(coordinates_list_).get_is_null();
798 RMF_SHOWABLE(SegmentFactory,
"SegmentFactory");
801 struct SegmentConstFactory:
public SegmentFactory {
802 SegmentConstFactory(FileConstHandle fh):
805 SegmentConstFactory(FileHandle fh):
Mostly empty base classes for decorators and factories.
bool get_is(NodeConstHandle nh) const
const NodeType REPRESENTATION
Represent part of a molecule.
const NodeType FEATURE
Store information about some feature of the system.
A handle for a particular node in the hierarchy.
The base class for decorators.
NodeType get_type() const
get the type of this node
bool get_is(NodeConstHandle nh) const
A handle for a particular node in a read-only hierarchy.
bool get_is(NodeConstHandle nh) const
std::vector< Vector3 > Vector3s
A handle for a read-only RMF file.
void set_value(ID< Tag > k, typename Tag::ArgumentType v) const
A handle for an RMF file.
The base class for Factories.
Declaration for RMF::FileHandle.
const NodeType GEOMETRY
Store a geometric object.
Declaration of NodeHandle.
bool get_is(NodeConstHandle nh) const
void set_static_value(ID< Tag > k, typename Tag::ArgumentType v) const
set the value of the attribute k for all frames.
ID< Tag > get_key(Category category, std::string name) const
bool get_is(NodeConstHandle nh) const
Various general useful macros for IMP.
const NodeType ORGANIZATIONAL
A node that is purely there for organizational purposes.
void set_frame_value(ID< Tag > k, typename Tag::ArgumentType v) const
set the value of the attribute k for this node on the current frame.
Traits classes describing how RMF uses types for storing data.