SVGImage.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: SVGImage.hpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002 
00004 
00005 //============================================================================
00006 //
00007 //  This file is part of GPSTk, the GPS Toolkit.
00008 //
00009 //  The GPSTk is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU Lesser General Public License as published
00011 //  by the Free Software Foundation; either version 2.1 of the License, or
00012 //  any later version.
00013 //
00014 //  The GPSTk is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with GPSTk; if not, write to the Free Software Foundation,
00021 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 
00028 #ifndef VDRAW_SVGIMAGE_H
00029 #define VDRAW_SVGIMAGE_H
00030 
00031 #include <string>
00032 #include <iostream>
00033 #include <fstream>
00034 #include "VGImage.hpp"
00035 #include "ViewerManager.hpp"
00036 
00037 namespace vdraw
00038 {
00041 
00048    class SVGImage : public VGImage
00049    {
00050    public:
00051 
00063       SVGImage(std::ostream& stream, double width=US_LETTER_WIDTH_PTS, 
00064                 double height=US_LETTER_HEIGHT_PTS, 
00065                 ORIGIN_LOCATION iloc=LOWER_LEFT);
00066 
00074       SVGImage(const char* fname, double width=US_LETTER_WIDTH_PTS, 
00075                 double height=US_LETTER_HEIGHT_PTS, 
00076                 ORIGIN_LOCATION iloc=LOWER_LEFT);
00077 
00079       ~SVGImage(void);
00080  
00081 
00090       void setMarker( const Marker& newMarker ) 
00091       {
00092         VGImage::setMarker(newMarker);
00093         defineMarker(newMarker);
00094       }
00095 
00096       void comment(const Comment& comment);
00097 
00098       using VGImage::comment;
00099       
00100       void line (const Line& line);
00101 
00102       using VGImage::line;
00103 
00104       void rectangle (const Rectangle& rect);
00105 
00106       void circle (const Circle& circle);
00107 
00108       void text (const Text& text);
00109 
00110       void polygon(const Polygon& polygon);
00111 
00112       void bitmap(const Bitmap& bitmap);
00113 
00114       void view (void) throw (VDrawException);
00115 
00118       ViewerManager viewerManager;
00119 
00120    protected:
00125 
00126       std::string filename;
00127 
00129       std::ofstream myfstream;
00130 
00132       std::ostream& ostr;
00133 
00134       //using VGImage::StyleType;
00135       //using VGImage::getCorrectStrokeStyle;
00136       //using VGImage::getCorrectMarker;
00137       //using VGImage::getCorrectTextStyle;
00138       //using VGImage::getCorrectFillColor;
00139 
00140    private:
00141 
00146       // Most drawing elements are in the same group a simple list.
00147       // This element is used to align them or indent them consistently.
00148       std::string tab;
00149 
00150       // This determines if a marker of some sort has been defined yet.
00151       bool markerDefined;
00152 
00153       // This contains the last defined marker.
00154       Marker lastMarker;
00155 
00160 
00161       void outputHeader(void);
00162 
00164       virtual void outputFooter(void);
00165 
00171       std::string convertStrokeStyle (const StrokeStyle& ss) const;
00172 
00179       std::string fill (Color& fc, StyleType tfc) const;
00180 
00188       std::string strokeDesc (StrokeStyle& ss, StyleType tss, bool noneclear=false) const;
00189 
00195       std::string convertFillColor (const Color& color) const;
00196 
00200       void defineMarker(const Marker& mark, int dfltnum=0);
00201 
00203       void outputPoints(const Path& path, std::ostream& ostr); 
00204 
00205    }; // class SVGImage
00206 
00208 
00209 } // namespace GPSTK
00210 
00211 #endif //VDRAW_SVGIMAGE_H

Generated on Wed Feb 8 03:31:03 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1