Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

DrawingCanvas.h

Go to the documentation of this file.
00001 
00002 //
00003 // This file is part of the MADELINE 2 program 
00004 // written by Edward H. Trager, Ritu Khanna and Adrian Marrs
00005 // Copyright (c) 2005 by the
00006 // Regents of the University of Michigan.
00007 // All Rights Reserved.
00008 // 
00009 // The latest version of this program is available from:
00010 // 
00011 //   http://eyegene.ophthy.med.umich.edu/madeline/
00012 //   
00013 // Released under the GNU General Public License.
00014 // A copy of the GPL is included in the distribution
00015 // package of this software, or see:
00016 // 
00017 //   http://www.gnu.org/copyleft/
00018 //   
00019 // ... for licensing details.
00020 // 
00022 //
00023 // 2006.03.01.RK.
00024 // 2006.08.10.ET: Revised
00025 //
00026 
00027 //
00028 // DrawingCanvas.h
00029 //
00030 // -- Contains SVG methods used for drawing and graphing
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; // For curved connectors ...
00056         
00057         bool _layerFlag;
00058         DrawingMedia _media;
00059         const LabelSet * _labelSet;
00060         bool _iconLegendFlag;
00061         
00062         //
00063         // For font metrics and postscript:
00064         //
00065         LASiWrapper _lasiWrapper;
00066         
00067         //
00068         // DrawingLabelManager:
00069         //
00070         DrawingLabelManager _labelManager;
00071         LabelLegend _labelLegend;
00072         IconLegend  _iconLegend;
00073         SVG _svg;
00074         void _setHeader();
00075         void _setFooter();
00076         
00077         //
00078         // _setCSS() and _setJavascript()
00079         // are used privately by _setHeader():
00080         // 
00081         void _setJavascript();
00082         void _setCSS();
00083         void _setSVGDefinitions();
00084         
00085         std::vector< std::string > _layers;
00086         
00087         //
00088         // ColorSeries: 
00089         //
00090         //std::vector<ColorSeries> *pColorSeriesVector=0;
00091         
00092         //
00093         // 2006.09.05.ET ADDENDUM:
00094         // Keep track of minimum and maximum x and y
00095         // so that we know true dimensions:
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         // Constructor
00113         //
00114         DrawingCanvas(const LabelSet * labelSet,const std::string name);
00115         
00116         //
00117         // Media methods:
00118         //
00119         void setDrawingMedia(std::string name);
00120         double getWidth(); // gets the media width
00121         double getHeight(); // gets the media height
00122         
00123         //
00124         // Layer Methods:
00125         // 
00126         void startLayer();
00127         void endLayer();
00128         
00129         
00130         // Drawing Methods:
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         // 2009.05.11.ET ADDENDUM:
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         // Getters:
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

Generated on Fri Nov 18 16:24:39 2011 for MADELINE by  doxygen 1.4.4