00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef DrawingCanvas_INCLUDED
00033 #define DrawingCanvas_INCLUDED
00034
00035 #include <sstream>
00036 #include <fstream>
00037 #include <iostream>
00038 #include "DrawingMetrics.h"
00039 #include "Individual.h"
00040 #include "LabelSet.h"
00041 #include "LabelLegend.h"
00042 #include "IconLegend.h"
00043 #include "SVG.h"
00044 #include "utility.h"
00045
00046
00047
00048
00049
00050 #include <LASi.h>
00051 #include "DrawingLabelManager.h"
00052
00053 class DrawingCanvas{
00054
00055 private:
00056 std::ostringstream _header;
00057 std::ostringstream _body;
00058 std::ostringstream _footer;
00059 std::ostringstream _layer;
00060
00061 bool _layerFlag;
00062 DrawingMedia _media;
00063 const LabelSet * _labelSet;
00064 bool _iconLegendFlag;
00065
00066
00067
00068
00069 LASi::PostscriptDocument _doc;
00070
00071
00072
00073
00074 DrawingLabelManager _labelManager;
00075 LabelLegend _labelLegend;
00076 IconLegend _iconLegend;
00077 SVG _svg;
00078 void _setHeader();
00079 void _setFooter();
00080
00081
00082
00083
00084
00085 void _setJavascript();
00086 void _setCSS();
00087 void _setSVGDefinitions();
00088
00089 std::vector< std::string > _layers;
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 double _xMinimum;
00101 double _xMaximum;
00102 double _yMinimum;
00103 double _yMaximum;
00104
00105 void _trackMinimaAndMaxima(double x,double y);
00106 void _drawDeceasedLine(double x,double y);
00107 void _drawProbandArrow(double x,double y);
00108 void _drawNorthEastArrow(double x, double y, double scale);
00109 void _drawLegends(void);
00110 void _drawSampledIndicator(double x, double y);
00111
00112 public:
00113
00114
00115
00116 DrawingCanvas(const LabelSet * labelSet,const std::string name);
00117
00118
00119
00120
00121 void setDrawingMedia(std::string name);
00122 double getWidth();
00123 double getHeight();
00124
00125
00126
00127
00128 void startLayer();
00129 void endLayer();
00130
00131
00132
00133 void startGroup(const std::string& cssClass=std::string(""));
00134 void endGroup();
00135 void drawTitle(const std::string title);
00136 void drawLine(double x1,double y1,double x2,double y2);
00137 void drawHorizontalLine(double y,double x1,double x2);
00138 void drawVerticalLine(double x,double y1,double y2,const std::string & className=std::string(""), const std::string & id=std::string(""));
00139 void drawPolyline(const std::string points,const std::string& id=std::string(""),const std::string& myclass=std::string(""));
00140 void drawText(double x,double y,std::string text,std::string myclass="");
00141 void drawRectangle(double x,double y,double width,double height);
00142
00143 void drawIndividual(Individual* pIndividual,double x,double y,bool isDashed=false);
00144
00145 void drawLabelSet(Individual* pIndividual);
00146 void drawEncircledText(std::string text,double x,double y,double xradius, double yradius,const std::string& myclass=std::string(""));
00147 void show(const char* filename);
00148
00149
00150 double getXMinimum();
00151 double getYMinimum();
00152 double getXMaximum();
00153 double getYMaximum();
00154 double getXRange();
00155 double getYRange();
00156
00157 void arc( double x, double y, double r, double startAngle, double endAngle,const std::string &color,const std::string &arcLabel,const std::string &arcClass,bool isMale);
00158 void setClipPath(double x, double y, const std::string &id);
00159 void iconPie( double x, double y, Individual *pIndividual );
00160 };
00161
00162 #endif