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 //
00047 // For font metrics
00048 // and Postscript output:
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         // For font metrics and postscript:
00068         //
00069         LASi::PostscriptDocument _doc;
00070         
00071         //
00072         // DrawingLabelManager:
00073         //
00074         DrawingLabelManager _labelManager;
00075         LabelLegend _labelLegend;
00076         IconLegend  _iconLegend;
00077         SVG _svg;
00078         void _setHeader();
00079         void _setFooter();
00080         
00081         //
00082         // _setCSS() and _setJavascript()
00083         // are used privately by _setHeader():
00084         // 
00085         void _setJavascript();
00086         void _setCSS();
00087         void _setSVGDefinitions();
00088         
00089         std::vector< std::string > _layers;
00090         
00091         //
00092         // ColorSeries: 
00093         //
00094         //std::vector<ColorSeries> *pColorSeriesVector=0;
00095         
00096         //
00097         // 2006.09.05.ET ADDENDUM:
00098         // Keep track of minimum and maximum x and y
00099         // so that we know true dimensions:
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         // Constructor
00115         //
00116         DrawingCanvas(const LabelSet * labelSet,const std::string name);
00117         
00118         //
00119         // Media methods:
00120         //
00121         void setDrawingMedia(std::string name);
00122         double getWidth(); // gets the media width
00123         double getHeight(); // gets the media height
00124         
00125         //
00126         // Layer Methods:
00127         // 
00128         void startLayer();
00129         void endLayer();
00130         
00131         
00132         // Drawing Methods:
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         // Getters:
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

Generated on Tue Feb 27 14:39:23 2007 for MINIMADELINE by  doxygen 1.4.4