27 #include "../../common/STLUtils.h" 
   28 #include "../../maptools/MarkRendererManager.h" 
   29 #include "../../maptools/Canvas.h" 
   30 #include "../../se/Fill.h" 
   31 #include "../../se/Mark.h" 
   32 #include "../../se/Stroke.h" 
   33 #include "../../se/Utils.h" 
   34 #include "../../dataaccess/datasource/DataSourceCapabilities.h" 
   35 #include "../../dataaccess/datasource/DataSourceFactory.h" 
   36 #include "../../dataaccess/datasource/DataSource.h" 
   37 #include "../../common/StringUtils.h" 
   41 #include <QApplication> 
   42 #include <QActionGroup> 
   46 #include <QMessageBox> 
   50 #include <QTreeWidgetItem> 
   51 #include <QTreeWidgetItemIterator> 
   56   if(item && item->child(0))
 
   58     QTreeWidgetItemIterator it(item->child(0));
 
   62       (*it)->setCheckState(column, state);
 
   71   QImage* qimg = 
new QImage(width, height, QImage::Format_ARGB32);
 
   73   for(
int i = 0; i < height; ++i)
 
   75     unsigned char* u = qimg->scanLine(i);
 
   77     for(
int j = 0; j < width; ++j)
 
   81       QRgb* v = (QRgb*)(u+j*4);
 
   92   for(
int i = 0; i < img->height(); ++i)
 
   96     for(
int j = 0; j < img->width(); ++j)
 
   97       s[j] = img->pixel(j, i);
 
  105 QStyle::StandardPixmap 
toQStyle(
const QMessageBox::Icon& icon)
 
  109     case QMessageBox::Question:
 
  110       return QStyle::SP_MessageBoxQuestion;
 
  113     case QMessageBox::Warning:
 
  114       return QStyle::SP_MessageBoxWarning;
 
  117     case QMessageBox::Critical:
 
  118       return QStyle::SP_MessageBoxCritical;
 
  122       return QStyle::SP_MediaVolumeMuted;
 
  129   return mnu->findChild<QMenu*>(mnuText);
 
  134   return bar->findChild<QMenu*>(mnuText);
 
  139   return mnu->findChild<QAction*>(actText);
 
  144   return mnuBar->findChild<QAction*>(actText);
 
  149   return mnu->findChild<QActionGroup*>(actGroupText);
 
  154   return mnuBar->findChild<QActionGroup*>(actGroupText);
 
  159   QMenu* mnu = p->findChild<QMenu*>(mnuName);
 
  163     QStringList ls = mnuName.split(
"."); 
 
  164     mnu = p->addMenu(ls[ls.size()-1]);
 
  166     mnu->setObjectName(mnuName);
 
  178     QStringList ls = mnuName.split(
"."); 
 
  179     mnu = 
new QMenu(ls[ls.size()-1], p);
 
  180     mnu->setObjectName(mnuName);
 
  184     QAction* act = (helpMnu == 0) ? 0 : helpMnu->menuAction();
 
  186     p->insertMenu(act, mnu);
 
  194   QMenu* res = 
FindMenu(mnuText, mnu);
 
  196   QStringList mnus = mnuText.split(
'.');
 
  198   for(
int i=1; i<mnus.size(); i++)
 
  199     mnus[i] = mnus[i-1] + 
"." + mnus[i];
 
  201   for(
int i=0; i<mnus.size(); i++)
 
  211   QMenu* res = 
FindMenu(mnuText, bar);
 
  213   QStringList mnus = mnuText.split(
'.');
 
  215   for(
int i=1; i<mnus.size(); i++)
 
  216     mnus[i] = mnus[i-1] + 
"." + mnus[i];
 
  218   for(
int i=0; i<mnus.size(); i++)
 
  234   QColor qcolor(color.
getRgba());
 
  235   qcolor.setAlpha(qAlpha(color.
getRgba()));
 
  259                                         const QColor& fillColor, 
const QColor& contourColor, 
const std::size_t& contourWidth)
 
  262                                                 QString::number(contourWidth).toStdString(),
 
  263                                                 QString::number(contourColor.alphaF()).toStdString());
 
  266                                           QString::number(fillColor.alphaF()).toStdString());
 
  293       QColor fillColor = selectionColor;
 
  294       fillColor.setAlpha(128);
 
  309       QColor fillColor = selectionColor;
 
  310       fillColor.setAlpha(128);
 
  325       QColor fillColor = selectionColor;
 
  326       fillColor.setAlpha(70);
 
  328       QColor contourColor = selectionColor;
 
  329       contourColor.setAlpha(150);
 
  342   QPixmap pix(size, size);
 
  343   pix.fill(Qt::transparent);
 
  348   path.addRect(offset, offset, pix.width() -  2 * offset, pix.height() - 2 * offset);
 
  351   pen.setColor(penColor);
 
  352   pen.setWidth(contourSize);
 
  355   brush.setColor(brushColor);
 
  359   p.setBrush(brushColor);
 
  361   p.fillPath(path, brush);
 
  369   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  371   QString key = 
"Last used file path/" + typeFile;
 
  373   sett.setValue(key, path);
 
  378   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  380   QString key = 
"Last used file path/" + typeFile;
 
  382   return sett.value(key).toString();
 
  395         return QString::fromUtf8(text.c_str());
 
  398         return QString::fromLatin1(text.c_str());
 
  404 #ifdef TERRALIB_CHARENCODING_ENABLED 
  406         return QString::fromLatin1(latin1.c_str());
 
  429       std::map< std::string, std::string > specCap = dsPtr->getCapabilities().getSpecificCapabilities();
 
  431       if( specCap.find( 
"SUPPORTED_EXTENSIONS" ) != specCap.end() )
 
  433         std::string fileExtensions = specCap[ 
"SUPPORTED_EXTENSIONS" ];
 
  434         std::string extFilter;
 
  435         std::string uCaseToken;
 
  436         std::string lCaseToken;
 
  437         std::vector< std::string > tokens;
 
  440         for( 
unsigned int tokensIdx = 0 ; tokensIdx < tokens.size() ; ++tokensIdx )
 
  444           extFilter = uCaseToken + 
" Raster File (" + 
"*." + lCaseToken + 
" *." +
 
  447           if( uCaseToken == 
"TIF" )
 
  449             filter = QString( extFilter.c_str() ) + ( filter.isEmpty() ? 
"" : 
";;" ) + filter;
 
  453             filter += ( filter.isEmpty() ? 
"" : 
";;" ) + QString( extFilter.c_str() );
 
  460   filter += QString( ( filter.isEmpty() ? 
"" : 
";;" ) ) + 
 
  461     "Web Map Service - WMS (*.xml *.wms);;Web Coverage Service - WCS (*.xml *.wcs);;All Files (*.*)";
 
void getRgba(int *r, int *g, int *b, int *a=0) const 
It gets the color value. 
 
virtual void setPointWidth(int w)=0
It sets the point width. If point has a patterns, this pattern is scaled to width. 
 
static bool find(const std::string &dsType)
 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code. 
 
CharEncoding
Supported charsets (character encoding). 
 
A Mark specifies a geometric shape and applies coloring to it. 
 
int getRed() const 
It returns the red component color value (a value from 0 to 255). 
 
std::string Convert2LCase(const std::string &value)
It converts a string to lower case. 
 
virtual void setPolygonFillColor(const te::color::RGBAColor &color)=0
It sets the color used to fill the draw of polygon geometries. 
 
virtual void setPointPattern(te::color::RGBAColor **pattern, int ncols, int nrows)=0
It sets the point pattern. 
 
virtual void setLineWidth(int w)=0
It sets the line width. 
 
int getBlue() const 
It returns the blue component color value (a value from 0 to 255). 
 
static std::string convert(const std::string &src, const CharEncoding &fromCode, const CharEncoding &toCode)
An static method that converts the source string to a target charset. 
 
int getGreen() const 
It returns the green component color value (a value from 0 to 255). 
 
std::string Convert2UCase(const std::string &value)
It converts a string to upper case. 
 
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
It tokenizes a given string with a delimiter of your own choice. 
 
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers. 
 
static MarkRendererManager & getInstance()
It returns a reference to the singleton instance. 
 
static std::auto_ptr< DataSource > make(const std::string &dsType)
 
TEOGREXPORT te::gm::Geometry * Convert2TerraLib(OGRGeometry *ogrGeom)
It converts the OGR Geometry to TerraLib Geometry. 
 
int getAlpha() const 
It returns the alpha component color value (a value from 0 to 255). 
 
A Fill specifies the pattern for filling an area geometry. 
 
TESEEXPORT Mark * CreateMark(const std::string &wellKnownName, Stroke *stroke, Fill *fill)
Creates a mark. 
 
virtual void setPolygonContourWidth(int w)=0
It sets the polygon contour width. 
 
TESEEXPORT Stroke * CreateStroke(const std::string &color, const std::string &width)
Creates a stroke. 
 
A canvas is an abstraction of a drawing area. 
 
virtual void setPointColor(const te::color::RGBAColor &color)=0
It sets the point drawing color. 
 
#define TE_TRANSPARENT
For an RGBA color this is the value of the alpha-channel for totally transparent. ...
 
A Stroke specifies the appearance of a linear geometry. 
 
virtual void setPolygonContourColor(const te::color::RGBAColor &color)=0
It sets the pen color used to draw the boundary of polygon geometries. 
 
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color. 
 
virtual void setLineColor(const te::color::RGBAColor &color)=0
It sets the pen color used to draw line geometries. 
 
TESEEXPORT Fill * CreateFill(const std::string &color, const std::string &opacity)
Creates a fill.