TerraLib 4.1
E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeVisual.h
Go to the documentation of this file.
00001 /************************************************************************************
00002 TerraLib - a library for developing GIS applications.
00003 Copyright Đ 2001-2007 INPE and Tecgraf/PUC-Rio.
00004 
00005 This code is part of the TerraLib library.
00006 This library is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Lesser General Public
00008 License as published by the Free Software Foundation; either
00009 version 2.1 of the License, or (at your option) any later version.
00010 
00011 You should have received a copy of the GNU Lesser General Public
00012 License along with this library.
00013 
00014 The authors reassure the license terms regarding the warranties.
00015 They specifically disclaim any warranties, including, but not limited to,
00016 the implied warranties of merchantability and fitness for a particular purpose.
00017 The library provided hereunder is on an "as is" basis, and the authors have no
00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
00020 indirect, special, incidental, or consequential damages arising out of the use
00021 of this library and its documentation.
00022 *************************************************************************************/
00026 #ifndef  __TERRALIB_INTERNAL_VISUAL_H
00027 #define  __TERRALIB_INTERNAL_VISUAL_H
00028 
00029 #include "TeDefines.h"
00030 #include "TeDataTypes.h"
00031 #include "TeAbstractFactory.h"
00032 
00033 class TeRasterTransform;
00034 
00035 #include <string>
00036 #include <map>
00037 
00038 using namespace std;
00039 
00040 
00042 struct TL_DLL TeColor
00043 {
00045            int red_;
00046 
00048            int green_;           
00049            
00051            int blue_; 
00052            
00054            string name_;
00055            
00057            TeColor () : red_(0),green_(0),blue_(0), name_("") {}
00058 
00060            TeColor (int r, int g, int b, const string& name="") : red_(r),green_(g),blue_(b), name_(name) {}
00061 
00063            void init (int r, int g, int b, const string& name="") {red_=r,green_=g,blue_=b;name_=name; }
00064 
00065 
00067            bool operator== (const TeColor& color)
00068            {
00069                       return (red_==color.red_ && green_==color.green_ && blue_==color.blue_);
00070            }
00071 
00073            TeColor& operator= ( const TeColor& color )
00074            {
00075                       if ( this != &color )
00076                       {          
00077                                  red_ = color.red_;
00078                                  green_ = color.green_;
00079                                  blue_ = color.blue_;
00080                                  name_ = color.name_;
00081                       }
00082                       return *this;
00083            }
00084 };
00085 
00087 
00094 class TL_DLL TeBaseVisualParams
00095 {
00096 public:
00098            TeBaseVisualParams(TeGeomRep rep = TePOLYGONS, const string& visualType = "tevisual"); 
00099 
00101            TeBaseVisualParams(const TeBaseVisualParams& other);
00102 
00104            virtual ~TeBaseVisualParams() {}
00105 
00107            virtual TeBaseVisualParams& operator=(const TeBaseVisualParams& visParams);
00108 
00110            virtual bool operator== (const TeBaseVisualParams& visParams);
00111 
00113            virtual void clear();
00114 
00116            virtual void setBasic (TeBaseVisualParams &visParams);
00117 
00119            string getProductId() { return visualType_; }
00120 
00122     int                          symbId_;                         
00124            TeColor               color_;                                     
00126            int                              transparency_;                   
00128            int                              width_;                                     
00129            
00131            int                              contourSymbId_;                             
00133            TeColor               contourColor_;                              
00135            int                              contourTransparency_; 
00137            int                              contourWidth_;                              
00138 
00140            int                              sizeValue_;           
00142            int                              ptAngle_;                                   
00143            
00144            // Text attributes
00146            string                family_;   
00148            bool                  bold_;                           
00150            bool                  italic_;   
00152            double                alignmentVert_;                  
00154            double                alignmentHoriz_;      
00156            int                              tabSize_;             
00158            int                              lineSpace_;           
00160            bool                  fixedSize_;                                 
00161 
00163            string                visualType_;
00165            TeGeomRep   geomRep_;                                  
00166 };
00167 
00169 class TL_DLL TeVisual
00170 {
00171 public :
00172            
00174            TeVisual(TeGeomRep rep = TePOLYGONS);
00175 
00177            virtual ~TeVisual() {}
00178 
00180            TeVisual(const TeVisual& other);
00181 
00183            virtual TeVisual& operator=(const TeVisual& vis);
00184 
00186            virtual bool operator== (const TeVisual& vis);
00187 
00189            virtual void clear();
00190 
00192            virtual void setBasic (TeVisual &vis);
00193 
00195            virtual void color(const TeColor& color) 
00196            {          params_.color_ = color;}
00197 
00199            virtual TeColor& color() 
00200            { return params_.color_; }
00201 
00203            virtual void style(int s) 
00204            { params_.symbId_ = s; }
00205 
00207            virtual int           style() 
00208            { return params_.symbId_; }
00209 
00211            virtual void transparency(int t)
00212            { params_.transparency_ = t; }
00213 
00215            virtual int transparency()
00216            { return params_.transparency_; }
00217 
00219            virtual void contourColor(const TeColor& color) 
00220            { params_.contourColor_ = color;}
00221 
00223            virtual TeColor& contourColor() 
00224            { return params_.contourColor_; }
00225 
00227            virtual void contourTransparency(int t) 
00228            { params_.contourTransparency_ = t;}
00229 
00231            virtual int           contourTransparency() 
00232            { return params_.contourTransparency_; }
00233 
00235            virtual void contourWidth(int w) 
00236            { params_.contourWidth_ = w; }
00237 
00239            virtual int           contourWidth()  
00240            { return params_.contourWidth_; }
00241 
00243            virtual void contourStyle(int s) 
00244            { params_.contourSymbId_ = s; }
00245 
00247            virtual int           contourStyle() 
00248            { return params_.contourSymbId_; }
00249 
00251            virtual void width(int w) 
00252            { params_.width_ = w; }
00253 
00255            virtual int            width ()  
00256            { return params_.width_; }
00257 
00259            virtual void size (int s)  
00260            { params_.sizeValue_ = s; }
00261 
00263            virtual int           size ()  
00264            { return params_.sizeValue_; }
00265 
00267            virtual void family (string f) 
00268            { params_.family_ = f; }
00269 
00271            virtual string family () 
00272            { return params_.family_ ; }
00273 
00275            virtual void bold (bool b) 
00276            { params_.bold_ = b; }
00277 
00279            virtual bool bold () 
00280            { return params_.bold_; }
00281 
00283            virtual void italic (bool i) 
00284            { params_.italic_ = i; }
00285 
00287            virtual bool italic () 
00288            { return params_.italic_; }
00289 
00291            virtual void fixedSize (bool i) 
00292            { params_.fixedSize_ = i; }
00293 
00295            virtual bool fixedSize () 
00296            { return params_.fixedSize_; }
00297 
00299            virtual void alignmentVert(double a) 
00300            { params_.alignmentVert_ = a; }
00301 
00303            virtual double alignmentVert() 
00304            { return params_.alignmentVert_; }
00305 
00307            virtual void alignmentHoriz(double a) 
00308            { params_.alignmentHoriz_ = a; }
00309 
00311            virtual double alignmentHoriz() 
00312            { return params_.alignmentHoriz_; }
00313 
00315            virtual void tabSize (int s) 
00316            { params_.tabSize_ = s; }
00317 
00319            virtual int           tabSize () 
00320            { return params_.tabSize_; }
00321 
00323            virtual void lineSpace (int s) 
00324            { params_.lineSpace_ = s; }
00325 
00327            virtual int           lineSpace () 
00328            { return params_.lineSpace_; }
00329 
00331            virtual int   ptAngle() 
00332            {return params_.ptAngle_; }
00333 
00335            virtual void  ptAngle(int p) 
00336            {params_.ptAngle_ = p;}
00337 
00339            virtual TeVisual* copy()
00340            {
00341                       TeVisual* retval = new TeVisual();
00342                       *retval = *this;
00343                       return retval;
00344            }
00345 
00347            static TeVisual* DefaultObject()  
00348            { return new TeVisual(); }
00349 
00350 protected:
00351            TeBaseVisualParams    params_;
00352 };
00353 
00354 
00356 class TL_DLL TeVisualFactory : public TeAbstractFactory<TeVisual, TeBaseVisualParams, string>
00357 {
00358 public:
00359            TeVisualFactory(const string& facName) : TeAbstractFactory<TeVisual, TeBaseVisualParams, string>(facName)
00360            {}
00361                       virtual TeVisual* build ()
00362            {          return new TeVisual(); }
00363 };
00364 
00366 typedef TeRasterTransform TeRasterVisual;
00367 
00368 #endif
00369 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines