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"
37 #include <QApplication>
41 #include <QMessageBox>
45 #include <QTreeWidgetItem>
46 #include <QTreeWidgetItemIterator>
50 if(item && item->child(0))
52 QTreeWidgetItemIterator it(item->child(0));
56 (*it)->setCheckState(column, state);
65 QImage* qimg =
new QImage(width, height, QImage::Format_ARGB32);
67 for(
int i = 0; i < height; ++i)
69 unsigned char* u = qimg->scanLine(i);
71 for(
int j = 0; j < width; ++j)
75 QRgb* v = (QRgb*)(u+j*4);
86 for(
int i = 0; i < img->height(); ++i)
90 for(
int j = 0; j < img->width(); ++j)
91 s[j] = img->pixel(j, i);
99 QStyle::StandardPixmap
toQStyle(
const QMessageBox::Icon& icon)
103 case QMessageBox::Question:
104 return QStyle::SP_MessageBoxQuestion;
107 case QMessageBox::Warning:
108 return QStyle::SP_MessageBoxWarning;
111 case QMessageBox::Critical:
112 return QStyle::SP_MessageBoxCritical;
116 return QStyle::SP_MediaVolumeMuted;
123 return mnu->findChild<QMenu*>(mnuText);
128 return bar->findChild<QMenu*>(mnuText);
133 return mnu->findChild<QAction*>(actText);
138 return mnuBar->findChild<QAction*>(actText);
143 QMenu* mnu = p->findChild<QMenu*>(mnuName);
147 QStringList ls = mnuName.split(
".");
148 mnu = p->addMenu(ls[ls.size()-1]);
150 mnu->setObjectName(mnuName);
162 QStringList ls = mnuName.split(
".");
163 mnu =
new QMenu(ls[ls.size()-1], p);
164 mnu->setObjectName(mnuName);
168 QAction* act = (helpMnu == 0) ? 0 : helpMnu->menuAction();
170 p->insertMenu(act, mnu);
178 QMenu* res =
FindMenu(mnuText, mnu);
180 QStringList mnus = mnuText.split(
'.');
182 for(
int i=1; i<mnus.size(); i++)
183 mnus[i] = mnus[i-1] +
"." + mnus[i];
185 for(
int i=0; i<mnus.size(); i++)
195 QMenu* res =
FindMenu(mnuText, bar);
197 QStringList mnus = mnuText.split(
'.');
199 for(
int i=1; i<mnus.size(); i++)
200 mnus[i] = mnus[i-1] +
"." + mnus[i];
202 for(
int i=0; i<mnus.size(); i++)
218 QColor qcolor(color.
getRgba());
219 qcolor.setAlpha(qAlpha(color.
getRgba()));
243 const QColor& fillColor,
const QColor& contourColor,
const std::size_t& contourWidth)
246 QString::number(contourWidth).toStdString(),
247 QString::number(contourColor.alphaF()).toStdString());
250 QString::number(fillColor.alphaF()).toStdString());
277 QColor fillColor = selectionColor;
278 fillColor.setAlpha(128);
293 QColor fillColor = selectionColor;
294 fillColor.setAlpha(128);
309 QColor fillColor = selectionColor;
310 fillColor.setAlpha(70);
312 QColor contourColor = selectionColor;
313 contourColor.setAlpha(150);
326 QPixmap pix(size, size);
327 pix.fill(Qt::transparent);
332 path.addRect(offset, offset, pix.width() - 2 * offset, pix.height() - 2 * offset);
335 pen.setColor(penColor);
336 pen.setWidth(contourSize);
339 brush.setColor(brushColor);
343 p.setBrush(brushColor);
345 p.fillPath(path, brush);
353 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
355 QString key =
"Last used file path/" + typeFile;
357 sett.setValue(key, path);
362 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
364 QString key =
"Last used file path/" + typeFile;
366 return sett.value(key).toString();
379 return QString::fromUtf8(text.c_str());
382 return QString::fromLatin1(text.c_str());
388 #ifdef TERRALIB_CHARENCODING_ENABLED
390 return QString::fromLatin1(latin1.c_str());
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.
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).
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).
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.
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.