VGImage.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: VGImage.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_VGIMAGE_H
00029 #define VDRAW_VGIMAGE_H
00030 
00031 #include <string>
00032 #include <stdarg.h>
00033 
00034 #include "Canvas.hpp"
00035 #include "VDrawException.hpp"
00036 
00040 namespace vdraw
00041 {
00044 
00052   class VGImage : public Canvas
00053   {
00054     public:
00055 
00057     static const double PTS_PER_INCH;
00058 
00060     static const double PTS_PER_CM;
00061 
00063     static const double US_LETTER_WIDTH_PTS;
00065     static const double US_LETTER_HEIGHT_PTS;
00066 
00067     // For the rest of the world... there's ISO 216-series sizes
00069     static const double A3_WIDTH_PTS;
00071     static const double A3_HEIGHT_PTS;
00072 
00073     // A4 and US customary letter are of comparable size
00075     static const double A4_WIDTH_PTS;
00077     static const double A4_HEIGHT_PTS;
00078 
00080     static const double A5_WIDTH_PTS;
00082     static const double A5_HEIGHT_PTS;
00083 
00085     enum ORIGIN_LOCATION { 
00087       LOWER_LEFT, 
00089       UPPER_LEFT 
00090     };
00091 
00102     VGImage(double width=US_LETTER_WIDTH_PTS, 
00103         double height=US_LETTER_HEIGHT_PTS,
00104         ORIGIN_LOCATION iloc=LOWER_LEFT): 
00105       Canvas(),
00106       canvasWidth(width), 
00107       canvasHeight(height),
00108       footerHasBeenWritten(false), 
00109       ll(iloc==LOWER_LEFT)
00110     { 
00111       //std::cout << height << " " << canvasHeight << "\n";
00112     }
00113 
00115     virtual ~VGImage() {}   
00116 
00118     inline double getWidth(void) const 
00119     {
00120       return canvasWidth;
00121     }
00122 
00124     inline double getHeight(void) const
00125     {
00126       return canvasHeight;
00127     }
00128 
00129     bool isLL() { return ll; }
00130 
00134     virtual void view(void) throw (VDrawException)
00135     { throw VDrawException("No appropriate viewer has been defined.");}
00136 
00137     protected:
00138 
00142     void rectangles(const Bitmap &bitmap);
00143 
00147     enum StyleType {
00149       NONE,
00151       CLEAR,
00153       DEFAULT, 
00155       SHAPE
00156     };
00157 
00165     StyleType getCorrectMarker(Marker *m, const Markable& mark);
00166 
00174     StyleType getCorrectStrokeStyle(StrokeStyle *s, const BasicShape& shape);
00175 
00183     StyleType getCorrectFillColor(Color *c, const Fillable& shape);
00184 
00192     StyleType getCorrectTextStyle(TextStyle *s, const Text& text);
00193 
00198     virtual void outputFooter(void) {}
00199 
00201     double canvasWidth;  
00202 
00204     double canvasHeight;
00205 
00207     bool footerHasBeenWritten;
00208 
00214     bool ll; 
00215 
00216     private:
00217 
00218 
00219   }; // class VGImage
00220 
00222 
00223 } // namespace vdraw
00224 
00225 #endif //VDRAW_VGIMAGE_H
00226 

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