31 #include "../../Config.h" 54 #include <QActionGroup> 55 #include <QContextMenuEvent> 56 #include <QDockWidget> 57 #include <QFileDialog> 63 #include <boost/lexical_cast.hpp> 98 connect(coordTracking, SIGNAL(coordTracked(QPointF&)), SLOT(
onCoordTracked(QPointF&)));
99 m_display->installEventFilter(coordTracking);
103 statusBar()->addPermanentWidget(pb);
109 docWidget->setWidget(pbw);
110 docWidget->setFixedWidth(250);
111 docWidget->setAllowedAreas(Qt::RightDockWidgetArea);
112 docWidget->setWindowTitle(tr(
"Threads Progress"));
113 addDockWidget(Qt::RightDockWidgetArea, docWidget);
116 setWindowTitle(tr(
"TerraLib Qt Tools Example"));
117 setMinimumSize(60, 60);
129 QAction* addVectorData =
new QAction(QIcon::fromTheme(
"list-add"), tr(
"Add Vector Data..."),
this);
134 QAction* addRasterData =
new QAction(QIcon::fromTheme(
"list-add"), tr(
"Add Raster Data..."),
this);
141 QList<QAction*> actions;
144 QAction* setPan =
new QAction(QIcon::fromTheme(
"pan"), tr(
"Pan"),
this);
145 setPan->setCheckable(
true);
150 QAction* setZoomIn =
new QAction(QIcon::fromTheme(
"zoom-in"), tr(
"Zoom In"),
this);
151 setZoomIn->setCheckable(
true);
153 actions << setZoomIn;
156 QAction* setZoomOut =
new QAction(QIcon::fromTheme(
"zoom-out"), tr(
"Zoom Out"),
this);
157 setZoomOut->setCheckable(
true);
159 actions << setZoomOut;
162 QAction* setZoomArea =
new QAction(QIcon::fromTheme(
"zoom-area"), tr(
"Zoom Area"),
this);
163 setZoomArea->setCheckable(
true);
165 actions << setZoomArea;
168 QAction* setDistance =
new QAction(QIcon::fromTheme(
"distance-measure"), tr(
"Measure Distance"),
this);
169 setDistance->setCheckable(
true);
171 actions << setDistance;
174 QAction* setArea =
new QAction(QIcon::fromTheme(
"area-measure"), tr(
"Measure Area"),
this);
175 setArea->setCheckable(
true);
180 QAction* setAngle =
new QAction(QIcon::fromTheme(
"angle-measure"), tr(
"Measure Angle"),
this);
181 setAngle->setCheckable(
true);
186 QAction* setSelection =
new QAction(QIcon::fromTheme(
"pointer"), tr(
"Selection"),
this);
187 setSelection->setCheckable(
true);
189 actions << setSelection;
192 QActionGroup* toolsGroup =
new QActionGroup(
this);
195 QList<QAction*>::iterator it;
196 for(it = actions.begin(); it != actions.end(); ++it)
198 toolsGroup->addAction(*it);
206 QAction* stopAll =
new QAction(QIcon::fromTheme(
"process-stop"), tr(
"Stop All"),
this);
214 std::string connInfo (
"file://");
215 connInfo += path.toUtf8().data();
220 std::unique_ptr<te::da::DataSourceTransactor> transactor(ds->getTransactor());
223 std::vector<std::string> datasets = transactor->getDataSetNames();
224 assert(!datasets.empty());
231 for(std::size_t i = 0; i < datasets.size(); ++i)
235 std::unique_ptr<te::da::DataSetType>
dt = transactor->getDataSetType(datasets[i]);
237 std::string propname = p->
getName();
249 e = (transactor->getExtent(datasets[i], propname)).
get();
253 e = raster->getExtent();
254 layer->
setSRID(raster->getSRID());
255 srid = raster->getSRID();
278 m_menu->popup(e->globalPos());
283 QString path = QFileDialog::getOpenFileName(
this, tr(
"Select a vector file..."), TERRALIB_DATA_DIR
"/shp/", tr(
"ShapeFile *.shp"));
290 QString path = QFileDialog::getOpenFileName(
this, tr(
"Select a raster file..."), TERRALIB_DATA_DIR
"/rasters/", tr(
"TIFF *.tif"));
358 QString text = QString::fromUtf8(
"Coordinates: (") + QString::number(coordinate.x()) +
" , " + QString::number(coordinate.y()) +
")";
359 QStatusBar* sb = statusBar();
360 sb->showMessage(text);
This class implements a concrete tool to geographic zoom operation using the mouse click...
virtual void setDataSourceId(const std::string &id)
This class can be used to inform the progress of a task.
This class implements a concrete tool to geographic zoom operation using the mouse wheel...
boost::shared_ptr< DataSource > DataSourcePtr
A singleton class used to manage tasks progresses and their viewers.
void setDataSetName(const std::string &name)
void addDataSetLayer(const QString &path, const std::string &driver)
void setSRID(int srid)
It sets the Spatial Reference System ID associated to the Layer.
An abstract class for raster data strucutures.
This file contains include headers for TerraLib Symbology Encoding module.
static te::dt::Date ds(2010, 01, 01)
This class implements a concrete tool to geographic zoom in operation using a boundary rectangle...
It models a property definition.
A multi thread Qt4 widget to control the display of a set of layers.
This class implements a concrete tool to measure operation (distance, area, and angle).
void setRendererType(const std::string &t)
This class implements a concrete tool to geographic zoom operation using the keyboard.
virtual void setLayerList(const std::list< te::map::AbstractLayerPtr > &layers)
It sets the layer list to be showed in the Map Display.
void onAddVectorDataTriggered()
void contextMenuEvent(QContextMenuEvent *e)
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
std::list< te::map::AbstractLayer * > m_layers
An Envelope defines a 2D rectangular region.
void onSelectionTriggered()
te::qt::widgets::AbstractTool * m_tool
This class implements a concrete tool to geographic coordinate tracking on mouse move operation...
MainWindow(QWidget *parent=0)
Constructor.
static te::dt::TimeDuration dt(20, 30, 50, 11)
virtual void setVisibility(Visibility v)
It sets the layer visibility.
void onStopAllTriggered()
void cancelTasks(unsigned int type)
Cancels the task with the given task type and inform all viewers that a task was canceled.
virtual void setExtent(const te::gm::Envelope &mbr)
It sets the Layer extent (or minimum bounding box).
te::qt::widgets::MapDisplay * m_display
This class implements a concrete tool to geographic pan operation.
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
void onCoordTracked(QPointF &coordinate)
This file contains include headers for the TerraLib Common Runtime module.
A layer with reference to a dataset.
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
This file contains include headers for the Vector Geometry model of TerraLib.
This file contains include headers for the Data Access module of TerraLib.
A class that defines the interface of a qt bar progress viewer.
void onZoomOutTriggered()
void onAddRasterDataTriggered()
void onDistanceTriggered()
void onZoomAreaTriggered()
const std::string & getName() const
It returns the property name.