00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPDISPLAY_BILD_WRITER_H
00009 #define IMPDISPLAY_BILD_WRITER_H
00010
00011 #include "display_config.h"
00012 #include "display_macros.h"
00013
00014 #include <IMP/PairContainer.h>
00015 #include <IMP/SingletonContainer.h>
00016 #include <IMP/display/Writer.h>
00017
00018 IMPDISPLAY_BEGIN_NAMESPACE
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 class IMPDISPLAYEXPORT BildWriter: public Writer
00029 {
00030 protected:
00031 void process(Color color) {
00032 get_stream() << ".color " << color << "\n";
00033 }
00034 bool process(PointGeometry *g, Color color, std::string name) {
00035 process(color);
00036 get_stream() << ".dotat " << algebra::spaces_io(*g)
00037 << "\n";
00038 return true;
00039 }
00040 bool process(SegmentGeometry *g, Color color, std::string name) {
00041 process(color);
00042 get_stream() << ".move "
00043 << algebra::spaces_io(g->get_point(0)) << "\n";
00044 get_stream() << ".draw "
00045 << algebra::spaces_io(g->get_point(1))
00046 << "\n";
00047 return true;
00048 }
00049 bool process(PolygonGeometry *g, Color color, std::string name) {
00050 process(color);
00051 get_stream() << ".polygon ";
00052 for (unsigned int i=0; i< g->size(); ++i) {
00053 get_stream() << " " << algebra::spaces_io(g->at(i));
00054 }
00055 get_stream() << "\n";
00056 return true;
00057 }
00058 bool process(TriangleGeometry *g, Color color, std::string name) {
00059 process(color);
00060 get_stream() << ".polygon ";
00061 for (unsigned int i=0; i< 3; ++i) {
00062 get_stream() << " " << algebra::spaces_io(g->at(i));
00063 }
00064 get_stream() << "\n";
00065 return true;
00066 }
00067 bool process(SphereGeometry *g, Color color, std::string name) {
00068 process(color);
00069 get_stream() << ".sphere "
00070 << algebra::spaces_io(g->get_center()) << " "
00071 << g->get_radius() << "\n";
00072 return true;
00073 }
00074 bool process(CylinderGeometry *g, Color color, std::string name) {
00075 process(color);
00076 get_stream() << ".cylinder "
00077 << algebra::spaces_io(g->get_segment().get_point(0))
00078 << " "
00079 << algebra::spaces_io(g->get_segment().get_point(1)) << " "
00080 << g->get_radius() << "\n";
00081 return true;
00082 }
00083 public:
00084
00085 IMP_WRITER(BildWriter);
00086 };
00087
00088
00089
00090 IMPDISPLAY_END_NAMESPACE
00091
00092 #endif