TeLegendEntry Class Reference

#include <TeLegendEntry.h>


Detailed Description

A legend entry is associated to a group of a theme. It has a label and a TeSlice that defines a property of of the objects that fall into this legend. A legend entry has an associated label and the visual presentation characteristics of the objects that fall into this legend.

Definition at line 54 of file TeLegendEntry.h.


Public Member Functions

void clear ()
 Clear the legend.
void color (TeColor &color)
 Sets the color associated to the legend.
void count (int n)
 Sets the number of objects with the legend.
int count ()
 Returns the number of objects of the legend.
void from (string &s)
 Sets the lower value associated to the legend.
string from ()
 Returns the lower value associated to the legend.
TeGeomRepVisualMapgetVisualMap ()
 Return the visual presentation characteristics map.
void group (int i)
 Sets the group identification to which this legend refers to.
int group ()
 Returns the group identifier associated to the legend.
void id (int i)
 Sets the legend id.
int id ()
 Returns the legend id.
void incCount (int n=1)
 Increase the number of objects with the legend.
void label (string &s)
 Sets the label associated to the legend.
string label ()
 Returns the label associated to the legend.
TeLegendEntryoperator= (const TeLegendEntry &leg)
 Operator =.
void setSlice (const TeSlice &sl)
void setVisual (TeVisual &vis, TeGeomRep rep)
 Sets the visual presentation characteristics associated to a given representation.
void setVisual (TeVisual *vis, TeGeomRep rep)
 Sets the visual presentation characteristics associated to a given representation.
TeSliceslice ()
 Returns the slice associated to this legend.
 TeLegendEntry (const TeLegendEntry &leg)
 Copy constructor.
 TeLegendEntry (const TeSlice &slice)
 Constructor from a slice.
 TeLegendEntry ()
 Empty constructor.
void theme (int i)
 Sets the theme id to which this legend belongs to.
int theme ()
 Returns the theme identifier to which the legend belongs.
void to (string &s)
 Sets the upper value associated to the legend.
string to ()
 Returns the upper value associated to the legend.
TeVisualvisual (TeGeomRep rep, const string &visualType="tevisual")
 Returns the visual presentation characteristics associated to a given representation.
virtual ~TeLegendEntry ()
 Destructor.

Private Attributes

int group_
int id_
string label_
TeSlice slice_
int theme_
TeGeomRepVisualMap visualMap_

Constructor & Destructor Documentation

TeLegendEntry::TeLegendEntry (  )  [inline]

Definition at line 59 of file TeLegendEntry.h.

00059                          : 
00060                 label_(""),
00061                 id_(-1),
00062                 theme_(0),
00063                 group_(0)
00064                 {}

TeLegendEntry::TeLegendEntry ( const TeSlice slice  ) 

Definition at line 25 of file TeLegendEntry.cpp.

References TeSlice::from_, label_, slice_, and TeSlice::to_.

00025                                                  :
00026         slice_(slice),
00027         id_(-1),
00028         theme_(0),
00029         group_(0)
00030 {
00031         if (slice_.from_ == "Missing Data")
00032                 label_ = "Missing Data";
00033         else 
00034         {
00035                 int i = slice_.from_.find("mean = ");
00036                 if (i >= 0 || slice_.to_.empty())
00037                         label_ = slice_.from_;
00038                 else
00039                         label_ = slice_.from_ + " ~ " + slice_.to_;
00040         }
00041 }

TeLegendEntry::TeLegendEntry ( const TeLegendEntry leg  ) 

Definition at line 44 of file TeLegendEntry.cpp.

00045 {
00046         *this = leg;
00047 }

virtual TeLegendEntry::~TeLegendEntry (  )  [inline, virtual]

Definition at line 76 of file TeLegendEntry.h.

00077         {       clear(); }


Member Function Documentation

void TeLegendEntry::clear ( void   ) 

Definition at line 87 of file TeLegendEntry.cpp.

References TeSlice::from_, label_, NULL, slice_, TeSlice::to_, and visualMap_.

Referenced by TeAbstractTheme::~TeAbstractTheme().

00088 {
00089         slice_.from_.clear();
00090         slice_.to_.clear();
00091         label_.clear();
00092 
00093         //clears the current map
00094         TeGeomRepVisualMap::iterator currMapIt = visualMap_.begin();
00095         while( currMapIt != visualMap_.end() )
00096         {
00097                 if (currMapIt->second)
00098                 {
00099                         delete currMapIt->second;
00100                         currMapIt->second = NULL;
00101                 }
00102                 ++currMapIt;
00103         }
00104         visualMap_.clear();
00105 }

void TeLegendEntry::color ( TeColor color  ) 

Definition at line 133 of file TeLegendEntry.cpp.

References TeVisual::color(), TeVisual::contourColor(), TeVisual::style(), TeLINES, TePOINTS, TePOLYGONS, and visualMap_.

00134 {
00135         if(visualMap_.find(TePOLYGONS) != visualMap_.end())
00136         {
00137                 TeVisual* tmpVisual = visualMap_[TePOLYGONS];
00138                 if (tmpVisual)
00139                 {
00140                         tmpVisual->color( color );
00141                         if ( tmpVisual->style() != 1 ) 
00142                                 tmpVisual->contourColor( color );
00143                 }               
00144         }
00145         if(visualMap_.find(TeLINES) != visualMap_.end())
00146         {
00147                 TeVisual* tmpVisual = visualMap_[TeLINES];
00148                 if (tmpVisual)
00149                         tmpVisual->color( color );
00150         }
00151         if(visualMap_.find(TePOINTS) != visualMap_.end())       
00152         {
00153                 TeVisual* tmpVisual = visualMap_[TePOINTS];
00154                 if (tmpVisual)
00155                         tmpVisual->color( color );
00156         }
00157 }

void TeLegendEntry::count ( int  n  )  [inline]

Definition at line 121 of file TeLegendEntry.h.

00122         { slice_.count_ = n; }

int TeLegendEntry::count (  )  [inline]

Definition at line 118 of file TeLegendEntry.h.

Referenced by generateCountLegends(), TeDatabasePortal::getLegend(), TeSQLite::insertLegend(), TePostgreSQL::insertLegend(), TeOCIOracle::insertLegend(), TeMySQL::insertLegend(), TeFirebird::insertLegend(), TeOracle::insertLegend(), TeAdo::insertLegend(), TeGraphPlot::loadHistogram(), TeGraphPlot::loadPie(), and TeDatabase::updateLegend().

00119         { return slice_.count_; }

void TeLegendEntry::from ( string s  )  [inline]

Definition at line 131 of file TeLegendEntry.h.

00132         { slice_.from_ = s; }

string TeLegendEntry::from (  )  [inline]

Definition at line 128 of file TeLegendEntry.h.

Referenced by generateCountLegends(), TeDatabasePortal::getLegend(), getVisual(), TeSQLite::insertLegend(), TePostgreSQL::insertLegend(), TeOCIOracle::insertLegend(), TeMySQL::insertLegend(), TeFirebird::insertLegend(), TeOracle::insertLegend(), TeAdo::insertLegend(), TeTheme::saveLegendInCollection(), TeExternalTheme::saveLegendInCollection(), TeTheme::setLegendsForObjects(), and TeDatabase::updateLegend().

00129         {       return slice_.from_; }

TeGeomRepVisualMap& TeLegendEntry::getVisualMap (  )  [inline]

Definition at line 108 of file TeLegendEntry.h.

Referenced by TeQtLegendItem::createPixmap(), getVisual(), getVisualRemote(), TeDatabase::insertVisual(), TeQtCanvas::plotLegend(), and TeDatabase::updateVisual().

00109         {       return visualMap_; }

void TeLegendEntry::group ( int  i  )  [inline]

Definition at line 96 of file TeLegendEntry.h.

00096 { group_ = i; }

int TeLegendEntry::group (  )  [inline]

Definition at line 94 of file TeLegendEntry.h.

Referenced by TeTheme::buildGrouping(), TeExternalTheme::buildGrouping(), TeAbstractTheme::buildGrouping(), generateCountLegends(), TeDatabasePortal::getLegend(), TeSQLite::insertLegend(), TePostgreSQL::insertLegend(), TeOCIOracle::insertLegend(), TeMySQL::insertLegend(), TeFirebird::insertLegend(), TeOracle::insertLegend(), TeAdo::insertLegend(), TeAbstractTheme::legend(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), and TeDatabase::updateLegend().

00094 { return group_; }

void TeLegendEntry::id ( int  i  )  [inline]

Definition at line 86 of file TeLegendEntry.h.

00086 { id_ = i; }

int TeLegendEntry::id (  )  [inline]

Definition at line 83 of file TeLegendEntry.h.

Referenced by TeExternalTheme::createLegendMapId(), generateCountLegends(), TeDatabasePortal::getLegend(), TeQtThemeItem::getLegendItem(), TeSQLite::insertLegend(), TePostgreSQL::insertLegend(), TeOCIOracle::insertLegend(), TeMySQL::insertLegend(), TeFirebird::insertLegend(), TeOracle::insertLegend(), TeAdo::insertLegend(), TeDatabase::insertVisual(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), TeTheme::saveLegendInCollection(), TeExternalTheme::saveLegendInCollection(), TeTheme::setLegendsForObjects(), TeDatabase::updateLegend(), and TeDatabase::updateVisual().

00084         { return id_; }

void TeLegendEntry::incCount ( int  n = 1  )  [inline]

Definition at line 124 of file TeLegendEntry.h.

00125         {       slice_.count_ += n; }

void TeLegendEntry::label ( string s  )  [inline]

Definition at line 145 of file TeLegendEntry.h.

00146         {       label_ = s; }

string TeLegendEntry::label (  ) 

Definition at line 108 of file TeLegendEntry.cpp.

References TeSlice::from_, label_, slice_, and TeSlice::to_.

Referenced by generateCountLegends(), TeDatabasePortal::getLegend(), TeSQLite::insertLegend(), TePostgreSQL::insertLegend(), TeOCIOracle::insertLegend(), TeMySQL::insertLegend(), TeFirebird::insertLegend(), TeOracle::insertLegend(), TeAdo::insertLegend(), TeGraphPlot::pieLegends(), and TeDatabase::updateLegend().

00109 {
00110     if (label_.empty())
00111     {
00112         int npos = slice_.from_.find("mean = ");
00113         if (npos >= 0 || slice_.to_.empty())
00114             label_ = slice_.from_;
00115         else 
00116             label_ = slice_.from_ + " ~ " + slice_.to_;
00117     }
00118     return label_;
00119 } 

TeLegendEntry & TeLegendEntry::operator= ( const TeLegendEntry leg  ) 

Definition at line 50 of file TeLegendEntry.cpp.

References TeVisual::copy(), group_, id_, label_, NULL, slice_, theme_, visual(), and visualMap_.

00051 {
00052         if ( this != &leg )
00053         {       //clears the current map
00054                 TeGeomRepVisualMap::iterator currMapIt = visualMap_.begin();
00055                 while( currMapIt != visualMap_.end() )
00056                 {
00057                         if (currMapIt->second)
00058                         {
00059                                 delete currMapIt->second;
00060                                 currMapIt->second = NULL;
00061                         }                               
00062                         ++currMapIt;
00063                 }
00064                 visualMap_.clear();
00065                         
00066                 //copy the new map
00067                 TeGeomRepVisualMap::const_iterator it = leg.visualMap_.begin();
00068                 while( it != leg.visualMap_.end() )
00069                 {
00070                         if (it->second)
00071                         {
00072                                 TeVisual* visual = it->second->copy();
00073                                 visualMap_[ it->first ] = visual;
00074                         }
00075                         ++it;
00076                 }
00077                 slice_ = leg.slice_;
00078                 label_ = leg.label_;
00079                 id_ = leg.id_;
00080                 theme_ = leg.theme_;
00081                 group_ = leg.group_;
00082         }
00083         return *this;
00084 }

void TeLegendEntry::setSlice ( const TeSlice sl  )  [inline]

Definition at line 115 of file TeLegendEntry.h.

00116         {       slice_ = sl; }

void TeLegendEntry::setVisual ( TeVisual vis,
TeGeomRep  rep 
)

Definition at line 167 of file TeLegendEntry.cpp.

References TeVisual::copy(), and setVisual().

00168 {
00169         return (setVisual(vis.copy(), rep));
00170 }

void TeLegendEntry::setVisual ( TeVisual vis,
TeGeomRep  rep 
)

Definition at line 160 of file TeLegendEntry.cpp.

References visualMap_.

Referenced by generateCountLegends(), TeDatabase::loadLegend(), TeDatabase::loadTheme(), TeDatabase::loadThemes(), TeDatabase::loadView(), TeDatabase::loadViewSet(), loadViewSetAndThemeGroups(), setVisual(), TeAbstractTheme::setVisualDefault(), TeAbstractTheme::setVisualOutOfCollection(), TeAbstractTheme::setVisualPointing(), TeAbstractTheme::setVisualQuery(), TeAbstractTheme::setVisualQueryAndPointing(), TeAbstractTheme::setVisualWithoutDataConnection(), and TeAbstractTheme::TeAbstractTheme().

00161 { 
00162     delete visualMap_[rep];
00163     visualMap_[rep] = vis;
00164 }

TeSlice& TeLegendEntry::slice (  )  [inline]

Definition at line 112 of file TeLegendEntry.h.

00113         {  return slice_; }

void TeLegendEntry::theme ( int  i  )  [inline]

Definition at line 91 of file TeLegendEntry.h.

00091 { theme_ = i; }

int TeLegendEntry::theme (  )  [inline]

Definition at line 89 of file TeLegendEntry.h.

Referenced by TeTheme::buildGrouping(), TeExternalTheme::buildGrouping(), TeAbstractTheme::buildGrouping(), generateCountLegends(), TeDatabasePortal::getLegend(), TeSQLite::insertLegend(), TePostgreSQL::insertLegend(), TeOCIOracle::insertLegend(), TeMySQL::insertLegend(), TeFirebird::insertLegend(), TeOracle::insertLegend(), TeAdo::insertLegend(), and TeDatabase::updateLegend().

00089 { return theme_; }

void TeLegendEntry::to ( string s  )  [inline]

Definition at line 138 of file TeLegendEntry.h.

00139         {       slice_.to_ = s; }

string TeLegendEntry::to (  )  [inline]

Definition at line 135 of file TeLegendEntry.h.

Referenced by TeQtLegendItem::createPixmap(), generateCountLegends(), TeDatabasePortal::getLegend(), TeSQLite::insertLegend(), TePostgreSQL::insertLegend(), TeOCIOracle::insertLegend(), TeMySQL::insertLegend(), TeFirebird::insertLegend(), TeOracle::insertLegend(), TeAdo::insertLegend(), TeQtCanvas::plotLegend(), TeTheme::saveLegendInCollection(), TeExternalTheme::saveLegendInCollection(), TeTheme::setLegendsForObjects(), and TeDatabase::updateLegend().

00136         {       return slice_.to_; }

TeVisual * TeLegendEntry::visual ( TeGeomRep  rep,
const string visualType = "tevisual" 
)

Definition at line 122 of file TeLegendEntry.cpp.

References TeAbstractFactory< PRODUCT, PARAMS, PRODUCTIDTYPE >::make(), and visualMap_.

Referenced by TeTheme::createRasterVisual(), TeExternalTheme::createRasterVisual(), TeAbstractTheme::createRasterVisual(), TeQtLegendItem::drawLineRep(), TeQtLegendItem::drawPointRep(), TeQtLegendItem::drawPolygonRep(), getVisual(), getVisualRemote(), operator=(), and TeGraphPlot::plotCurves().

00123 { 
00124         if(visualMap_.find(rep) == visualMap_.end())
00125         {
00126                 TeVisual* visual = TeVisualFactory::make(visualType);
00127         visualMap_[rep] = visual; 
00128         }
00129         return visualMap_[rep];
00130 }


Field Documentation

int TeLegendEntry::group_ [private]

Definition at line 158 of file TeLegendEntry.h.

Referenced by operator=().

int TeLegendEntry::id_ [private]

Definition at line 156 of file TeLegendEntry.h.

Referenced by operator=().

string TeLegendEntry::label_ [private]

Definition at line 155 of file TeLegendEntry.h.

Referenced by clear(), label(), operator=(), and TeLegendEntry().

TeSlice TeLegendEntry::slice_ [private]

Definition at line 154 of file TeLegendEntry.h.

Referenced by clear(), label(), operator=(), and TeLegendEntry().

int TeLegendEntry::theme_ [private]

Definition at line 157 of file TeLegendEntry.h.

Referenced by operator=().

TeGeomRepVisualMap TeLegendEntry::visualMap_ [private]

Definition at line 153 of file TeLegendEntry.h.

Referenced by clear(), color(), operator=(), setVisual(), and visual().


The documentation for this class was generated from the following files:
Generated on Sun Jul 29 04:06:41 2012 for TerraLib - Development Source by  doxygen 1.5.3