TeVisual.cpp

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 *************************************************************************************/
00023 #include "TeVisual.h"
00024 
00025 TeBaseVisualParams::TeBaseVisualParams(TeGeomRep rep, const string& visualType) :
00026                 symbId_ (TePolyTypeFill),
00027                 color_ (255,0,0),
00028             transparency_ (0),
00029                 width_ (0),
00030                 contourSymbId_ (TeLnTypeContinuous),
00031                 contourColor_(0,255,255),
00032                 contourTransparency_ (0),
00033                 contourWidth_ (1),
00034                 sizeValue_ (0),
00035                 ptAngle_ (0),
00036                 family_ ("Verdana"),
00037                 bold_ (false),
00038                 italic_(false),
00039                 alignmentVert_(0),
00040                 alignmentHoriz_(0),
00041                 tabSize_(6),
00042                 lineSpace_(1),
00043                 fixedSize_(false),
00044                 visualType_(visualType),
00045                 geomRep_(rep)
00046 {
00047         switch (rep)
00048         {
00049                 case TePOLYGONS:
00050                 case TeCELLS:
00051                         symbId_= TePolyTypeFill;
00052                         contourSymbId_= TeLnTypeContinuous;
00053                         break;
00054                 case TeLINES:
00055                         symbId_= TeLnTypeContinuous;
00056                         width_ = 1;
00057                         break;
00058                 case TePOINTS:
00059                 case TeNODES:
00060                         symbId_= TePtTypeBox;
00061                         sizeValue_ = 3;
00062                         break;
00063                 case TeTEXT:
00064                         sizeValue_= 12;
00065                         break;
00066                 default:
00067                         break;
00068         }
00069 }
00070 
00071 // Copy constructor
00072 TeBaseVisualParams::TeBaseVisualParams(const TeBaseVisualParams& other)
00073 {       
00074         symbId_ = other.symbId_;
00075         color_ = other.color_;
00076         transparency_ = other.transparency_;
00077         width_ = other.width_;
00078 
00079         contourSymbId_ = other.contourSymbId_;
00080         contourColor_ = other.contourColor_;
00081         contourTransparency_ = other.contourTransparency_;
00082         contourWidth_ = other.contourWidth_;
00083                 
00084         sizeValue_ = other.sizeValue_;
00085         ptAngle_ = other.ptAngle_;
00086         
00087         family_ = other.family_;
00088         bold_ = other.bold_;
00089         italic_ = other.italic_;
00090         fixedSize_ = other.fixedSize_;
00091         alignmentVert_ = other.alignmentVert_;
00092         alignmentHoriz_ = other.alignmentHoriz_;
00093         tabSize_ = other.tabSize_;
00094         lineSpace_ = other.lineSpace_;
00095 
00096         visualType_ = other.visualType_;
00097         geomRep_ = other.geomRep_; 
00098 }
00099 
00100 // Assignment operator
00101 TeBaseVisualParams& 
00102 TeBaseVisualParams::operator=(const TeBaseVisualParams& vis)
00103 {
00104         if ( this != &vis )
00105         {
00106                 symbId_ = vis.symbId_;
00107                 color_ = vis.color_;
00108                 transparency_ = vis.transparency_;
00109                 width_ = vis.width_;
00110 
00111                 contourSymbId_ = vis.contourSymbId_;
00112                 contourColor_ = vis.contourColor_;
00113                 contourTransparency_ = vis.contourTransparency_;
00114                 contourWidth_ = vis.contourWidth_;
00115                 
00116                 sizeValue_ = vis.sizeValue_;
00117                 ptAngle_ = vis.ptAngle_;
00118                 
00119                 family_ = vis.family_;
00120                 bold_ = vis.bold_;
00121                 italic_ = vis.italic_;
00122                 fixedSize_ = vis.fixedSize_;
00123                 alignmentVert_ = vis.alignmentVert_;
00124                 alignmentHoriz_ = vis.alignmentHoriz_;
00125                 tabSize_ = vis.tabSize_;
00126                 lineSpace_ = vis.lineSpace_;
00127 
00128                 visualType_ = vis.visualType_;
00129                 geomRep_ = vis.geomRep_;
00130         }
00131         return *this;
00132 }
00133 
00134 // Returns TRUE if param1 is equal to param2 or FALSE if they are different.
00135 bool 
00136 TeBaseVisualParams::operator== (const TeBaseVisualParams& vis)
00137 {
00138         return ( symbId_ == vis.symbId_ &&
00139                 color_ == vis.color_ &&
00140                 transparency_ == vis.transparency_ &&
00141                 width_ == vis.width_ &&
00142                 contourSymbId_ == vis.contourSymbId_ &&
00143                 contourColor_ == vis.contourColor_ &&
00144                 contourTransparency_ == vis.contourTransparency_ &&
00145                 contourWidth_ == vis.contourWidth_ &&
00146                 sizeValue_ == vis.sizeValue_ &&
00147                 ptAngle_ == vis.ptAngle_ &&
00148                 family_ == vis.family_ &&
00149                 bold_ == vis.bold_ &&
00150                 italic_ == vis.italic_ &&
00151                 fixedSize_ == vis.fixedSize_ &&
00152                 alignmentVert_ == vis.alignmentVert_ &&
00153                 alignmentHoriz_ == vis.alignmentHoriz_ &&
00154                 tabSize_ == vis.tabSize_ && 
00155                 lineSpace_ == vis.lineSpace_  &&
00156                 visualType_ == vis.visualType_ &&
00157                 geomRep_ == vis.geomRep_);
00158 }
00159 
00160 // Returns visual to the default parameters 
00161 void 
00162 TeBaseVisualParams::clear()
00163 {
00164         symbId_ = TePolyTypeFill;
00165         color_ = TeColor(255,0,0);
00166         transparency_=0;
00167         width_ = 0; 
00168         contourSymbId_ = TeLnTypeContinuous;
00169         contourColor_ = TeColor (0,255,255);
00170         contourTransparency_ = 0;
00171         contourWidth_ = 1;
00172         sizeValue_ = 0;
00173         ptAngle_ = 0;
00174         family_ = "Verdana";
00175         bold_  = false;
00176         italic_ = false;
00177         alignmentVert_ = 0;
00178         alignmentHoriz_ = 0;
00179         tabSize_ = 6;
00180         lineSpace_ = 1;
00181         fixedSize_ = false;
00182         geomRep_ = TePOLYGONS;
00183         visualType_="tevisual";
00184 }
00185 
00186 // Copies only the basic visual parameters from another visual
00187 void 
00188 TeBaseVisualParams::setBasic (TeBaseVisualParams &vis)
00189 {
00190         symbId_ = vis.symbId_;
00191         color_ = vis.color_;
00192         transparency_ = vis.transparency_;
00193         width_ = vis.width_;
00194 
00195         contourSymbId_ = vis.contourSymbId_;
00196         contourColor_ = vis.contourColor_;
00197         contourTransparency_ = vis.contourTransparency_;
00198         contourWidth_ = vis.contourWidth_;
00199         
00200         sizeValue_ = vis.sizeValue_;
00201         ptAngle_ = vis.ptAngle_;
00202         
00203         family_ = vis.family_;
00204         bold_ = vis.bold_;
00205         italic_ = vis.italic_;
00206         fixedSize_ = vis.fixedSize_;
00207         alignmentVert_ = vis.alignmentVert_;
00208         alignmentHoriz_ = vis.alignmentHoriz_;
00209         tabSize_ = vis.tabSize_;
00210         lineSpace_ = vis.lineSpace_;
00211         geomRep_ = vis.geomRep_;
00212         visualType_="tevisual";
00213 }
00214 
00215 //--------------
00216 
00217 TeVisual::TeVisual(TeGeomRep rep) : 
00218                 params_ (TeBaseVisualParams(rep, "tevisual"))
00219 {
00220 }
00221                 
00222 // Copy constructor
00223 TeVisual::TeVisual(const TeVisual& other)
00224 {       
00225         params_ = other.params_;
00226 }
00227 
00228 // Assignment operator
00229 TeVisual& 
00230 TeVisual::operator=(const TeVisual& vis)
00231 {
00232         if ( this != &vis )
00233                 params_ = vis.params_;
00234         return *this;
00235 }
00236 
00237 // Returns TRUE if param1 is equal to param2 or FALSE if they are different.
00238 bool 
00239 TeVisual::operator== (const TeVisual& vis)
00240 {
00241         return ( params_ == vis.params_);
00242 }
00243 
00244 // Returns visual to the default parameters 
00245 void 
00246 TeVisual::clear()
00247 {
00248         params_.clear();
00249 }
00250 
00251 // Copies only the basic visual parameters from another visual
00252 void 
00253 TeVisual::setBasic (TeVisual &vis)
00254 {
00255         params_.setBasic(vis.params_);
00256 }
00257 
00258 

Generated on Sun Jul 29 04:01:29 2012 for TerraLib - Development Source by  doxygen 1.5.3