IMP logo
IMP Reference Guide  2.11.1
The Integrative Modeling Platform
PymolWriter.h
Go to the documentation of this file.
1 /**
2  * \file IMP/display/PymolWriter.h
3  * \brief Write a CGO file with the geometry.
4  *
5  * Copyright 2007-2019 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPDISPLAY_PYMOL_WRITER_H
9 #define IMPDISPLAY_PYMOL_WRITER_H
10 
11 #include <IMP/display/display_config.h>
12 #include "writer_macros.h"
13 
14 #include <IMP/PairContainer.h>
15 #include <IMP/SingletonContainer.h>
16 #include <IMP/display/Writer.h>
17 
18 IMPDISPLAY_BEGIN_NAMESPACE
19 
20 //! Write a CGO file with the geometry
21 /** The CGO file format is a simple format for displaying geometry in Pymol.
22  The CGO writer supports points, spheres, cylinders, and segments.
23  The file name should end in ".pym".
24 
25  The geometry is assembled into objects in pymol based on the passed
26  names. For example, all geometry named "box" becomes one pymol object.
27  If many files are loaded into Python defining the same objects, they
28  become sequential frames in a movie. The frame numbers are determined
29  sequentially from the file load order (so they can form a subset of
30  the generated files).
31 
32  This writer will write many frames to the same file.
33  */
34 class IMPDISPLAYEXPORT PymolWriter : public TextWriter {
35  std::string lastname_;
36  int last_frame_;
37  enum Type {
38  NONE = 0,
39  LINES,
40  TRIANGLES,
41  OTHER
42  };
43  Type open_type_;
44  friend class CGOAnimationWriter;
45  void setup(std::string name, Type type, bool opendata = true);
46  void cleanup(std::string name, bool close = true);
47  bool handle_sphere(SphereGeometry *g, Color color, std::string name);
48  bool handle_cylinder(CylinderGeometry *g, Color color, std::string name);
49  bool handle_point(PointGeometry *g, Color color, std::string name);
50  bool handle_segment(SegmentGeometry *g, Color color, std::string name);
51  bool handle_polygon(PolygonGeometry *g, Color color, std::string name);
52  bool handle_triangle(TriangleGeometry *g, Color color, std::string name);
53  bool handle_label(LabelGeometry *g, Color color, std::string name);
54  bool handle_surface(SurfaceMeshGeometry *g, Color color, std::string name);
55 
56  void do_set_frame();
57 
58  public:
60 };
61 
62 IMPDISPLAY_END_NAMESPACE
63 
64 #endif /* IMPDISPLAY_PYMOL_WRITER_H */
Represent an RGB color.
Definition: Color.h:24
A container for Singletons.
macros for display classes
A container for Pairs.
virtual void do_set_frame()
in case you want to take action on a new frame
Base class for writing geometry to a file.
Write a CGO file with the geometry.
Definition: PymolWriter.h:34
#define IMP_TEXT_WRITER(Name)
Define information for an TextWriter object.
Definition: writer_macros.h:18
A text label for a ball in space.