00001 #pragma ident "$Id: SVGImage.hpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
00135
00136
00137
00138
00139
00140 private:
00141
00146
00147
00148 std::string tab;
00149
00150
00151 bool markerDefined;
00152
00153
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 };
00206
00208
00209 }
00210
00211 #endif