00001
00002
00003 #pragma once
00004
00005
00006 # include <shape/graph.hpp>
00007 # include <shape/viewer_axel.hpp>
00008 # include <shape/bcell2d.hpp>
00009
00010 # define TMPL template<class T>
00011 # define AXEL viewer<axel,K>
00012 # define BoundingBox (*T)::BoundingBox
00013
00014
00015
00016
00017 #define CHECK if (false) {}
00018
00019 namespace mmx {
00020
00021 namespace shape {
00022
00023
00024 template<class T>
00025 void write_ok(gNode<T>* v)
00026 {
00027 std::cout<<"Ok"<<std::endl;
00028 }
00029 }
00030
00031
00032 namespace shape {
00033
00034 template<class K, class T> AXEL&
00035 print_boxes(AXEL& out, Graph<T> g) {
00036
00037
00038
00039 double xmin,xmax,ymin,ymax;
00040 Seq<T> v;
00041
00042 g.dfs(v);
00043
00044
00045
00046 unsigned n=0;
00047
00048
00049 for (unsigned i=0; i<v.size(); i++)
00050 {
00051 CHECK;
00052 n+=4;
00053 }
00054
00055 out<<" <curve type=\"mesh\" color=\"255 255 0\" >\n<vect>\nVECT\n";
00056 out<<n <<" "
00057 <<2*n <<" "
00058 <<n <<"\n";
00059
00060 for(unsigned i=0; i<n; i++) out<<"2 ";
00061 out<<"\n";
00062
00063 for(unsigned i=0; i<n; i++) out<<"1 ";
00064 out<<"\n";
00065
00066
00067 for (unsigned i=0; i<v.size(); i++)
00068 {
00069 CHECK;
00070
00071 xmin= v[i]->boundingBox().xmin();
00072 xmax= v[i]->boundingBox().xmax();
00073 ymin= v[i]->boundingBox().ymin();
00074 ymax= v[i]->boundingBox().ymax();
00075
00076
00077
00078 out <<xmin <<" "<<ymin <<" 0 "
00079 <<xmax <<" "<<ymin <<" 0 "
00080 <<"\n";
00081
00082 out <<xmax <<" "<<ymin <<" 0 "
00083 <<xmax <<" "<<ymax <<" 0 "
00084 <<"\n";
00085
00086 out <<xmax <<" "<<ymax <<" 0 "
00087 <<xmin <<" "<<ymax <<" 0 "
00088 <<"\n";
00089
00090 out <<xmin <<" "<<ymax <<" 0 "
00091 <<xmin <<" "<<ymin <<" 0 "
00092 <<"\n";
00093 }
00094
00095
00096 for(unsigned i=0; i<n; i++)
00097 out<< "0.314 0.979 1 1\n";
00098
00099 out<<" </vect>\n </curve>\n";
00100
00101 return out;
00102 }
00103
00104 }
00105 }
00106
00107 # undef TMPL
00108 # undef CHECK
00109 # undef BoundingBox
00110 # undef AXEL