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 #include "DrawingLabelManager.h"
00047
00048 class DrawingCanvas{
00049
00050 private:
00051 std::ostringstream _header;
00052 std::ostringstream _body;
00053 std::ostringstream _footer;
00054 std::ostringstream _layer;
00055 std::ostringstream _bottomLayer;
00056
00057 bool _layerFlag;
00058 DrawingMedia _media;
00059 const LabelSet * _labelSet;
00060 bool _iconLegendFlag;
00061
00062
00063
00064
00065 LASiWrapper _lasiWrapper;
00066
00067
00068
00069
00070 DrawingLabelManager _labelManager;
00071 LabelLegend _labelLegend;
00072 IconLegend _iconLegend;
00073 SVG _svg;
00074 void _setHeader();
00075 void _setFooter();
00076
00077
00078
00079
00080
00081 void _setJavascript();
00082 void _setCSS();
00083 void _setSVGDefinitions();
00084
00085 std::vector< std::string > _layers;
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 double _xMinimum;
00097 double _xMaximum;
00098 double _yMinimum;
00099 double _yMaximum;
00100
00101 void _trackMinimaAndMaxima(double x,double y);
00102 void _drawDeceasedLine(double x,double y);
00103 void _drawProbandArrow(double x,double y);
00104 void _drawConsultandArrow(double x, double y);
00105 void _drawNorthEastArrow(double x, double y, double scale);
00106 void _drawLegends(void);
00107 void _drawSampledIndicator(double x, double y);
00108 void _drawSuperScript(const std::string &label,double x, double y);
00109
00110 public:
00111
00112
00113
00114 DrawingCanvas(const LabelSet * labelSet,const std::string name);
00115
00116
00117
00118
00119 void setDrawingMedia(std::string name);
00120 double getWidth();
00121 double getHeight();
00122
00123
00124
00125
00126 void startLayer();
00127 void endLayer();
00128
00129
00130
00131 void startGroup(const std::string& cssClass=std::string(""));
00132 void endGroup();
00133 void drawTitle(const std::string title);
00134 void drawLine(double x1,double y1,double x2,double y2);
00135 void drawHorizontalLine(double y,double x1,double x2);
00136 void drawVerticalLine(double x,double y1,double y2,const std::string & className=std::string(""), const std::string & id=std::string(""));
00137 void drawPolyline(const std::string points,const std::string& id=std::string(""),const std::string& myclass=std::string(""));
00138 void drawText(double x,double y,std::string text,std::string myclass="");
00139 void drawIconText(double x,double y,std::string text,std::string myclass="");
00140 void drawRectangle(double x,double y,double width,double height);
00141
00142 void drawIndividual(Individual* pIndividual,double x,double y,bool isDashed=false);
00143
00144
00145 void drawDivorcedLine(double x,double y);
00146 void drawSeparatedLine(double x,double y);
00147 void drawRelationshipEndedLine(double x,double y);
00148
00149 void drawLabelSet(Individual* pIndividual);
00150 void drawSuperscriptData(Individual *pIndividual,double x, double y);
00151 void drawEncircledText(std::string text,double x,double y,double xradius, double yradius,const std::string& myclass=std::string(""));
00152 void show(const char* filename);
00153
00154
00155 double getXMinimum();
00156 double getYMinimum();
00157 double getXMaximum();
00158 double getYMaximum();
00159 double getXRange();
00160 double getYRange();
00161
00162 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);
00163 void setClipPath(double x, double y, const std::string &id);
00164 void iconPie( double x, double y, Individual *pIndividual );
00165 void iconQuadrantFill( double x, double y, Individual *pIndividual );
00166
00167 };
00168
00169 #endif