IMP  2.0.0
The Integrative Modeling Platform
PymolWriter.h
Go to the documentation of this file.
1 /**
2  * \file IMP/display/PymolWriter.h
3  * \brief Implement PymolWriter
4  *
5  * Copyright 2007-2013 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, cyliners, 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 {
36  std::string lastname_;
37  int last_frame_;
38  enum Type {NONE=0, LINES, TRIANGLES, OTHER};
39  Type open_type_;
40  friend class CGOAnimationWriter;
41  void setup(std::string name, Type type, bool opendata=true);
42  void cleanup(std::string name, bool close=true);
43  bool handle_sphere(SphereGeometry *g,
44  Color color, std::string name);
45  bool handle_cylinder(CylinderGeometry *g,
46  Color color, std::string name);
47  bool handle_point(PointGeometry *g,
48  Color color, std::string name);
49  bool handle_segment(SegmentGeometry *g,
50  Color color, std::string name);
51  bool handle_polygon(PolygonGeometry *g,
52  Color color, std::string name);
53  bool handle_triangle(TriangleGeometry *g,
54  Color color, std::string name);
55  bool handle_label(LabelGeometry *g,
56  Color color, std::string name);
57  bool handle_surface(SurfaceMeshGeometry *g,
58  Color color, std::string name);
59 
60  void do_set_frame();
61 
62 public:
64 };
65 
66 
67 
68 IMPDISPLAY_END_NAMESPACE
69 
70 #endif /* IMPDISPLAY_PYMOL_WRITER_H */