27 #include "../../../common/Exception.h" 
   28 #include "../../../common/Translator.h" 
   29 #include "../../../dataaccess/dataset/ObjectId.h" 
   30 #include "../../../dataaccess/utils/Utils.h" 
   31 #include "../../../edit/Feature.h" 
   32 #include "../../../edit/Repository.h" 
   33 #include "../../../edit/RepositoryManager.h" 
   34 #include "../../../edit/qt/tools/CreateLineTool.h" 
   35 #include "../../../edit/qt/tools/CreatePolygonTool.h" 
   36 #include "../../../edit/qt/tools/MoveGeometryTool.h" 
   37 #include "../../../edit/qt/tools/VertexTool.h" 
   38 #include "../../../edit/qt/SnapOptionsDialog.h" 
   39 #include "../../../maptools/DataSetLayer.h" 
   40 #include "../../../memory/DataSet.h" 
   41 #include "../../../memory/DataSetItem.h" 
   42 #include "../../af/events/LayerEvents.h" 
   43 #include "../../af/events/MapEvents.h" 
   44 #include "../../af/ApplicationController.h" 
   45 #include "../../af/Project.h" 
   49 #include <QActionGroup> 
   50 #include <QMessageBox> 
   53 #include <boost/ptr_container/ptr_vector.hpp> 
   64     m_vertexToolAction(0),
 
   65     m_createPolygonToolAction(0),
 
   66     m_createLineToolAction(0),
 
   67     m_moveGeometryToolAction(0),
 
   68     m_snapOptionsAction(0)
 
   97   std::list<te::map::AbstractLayerPtr>::iterator it;
 
   98   for(it = layers.begin(); it != layers.end(); ++it)
 
  100     if((*it)->getId() == id)
 
  110   m_toolBar = 
new QToolBar;
 
  118   createAction(m_editAction, tr(
"Turn on/off edition mode"), 
"edit-enable", 
true, 
true,  SLOT(onEditActivated(
bool)));
 
  119   m_toolBar->addAction(m_editAction);
 
  122   createAction(m_saveAction, tr(
"Save edition"), 
"edit-save", 
false, 
false,  SLOT(onSaveActivated()));
 
  123   m_toolBar->addAction(m_saveAction);
 
  125   m_toolBar->addSeparator();
 
  128   createAction(m_vertexToolAction, tr(
"Vertex Tool - Move, add and remove"), 
"edit-vertex-tool", 
true, 
false,  SLOT(onVertexToolActivated(
bool)));
 
  129   createAction(m_createPolygonToolAction, tr(
"Create Polygon"), 
"edit-create-polygon", 
true, 
false,  SLOT(onCreatePolygonToolActivated(
bool)));
 
  130   createAction(m_createLineToolAction, tr(
"Create Line"), 
"edit-create-line", 
true, 
false,  SLOT(onCreateLineToolActivated(
bool)));
 
  131   createAction(m_moveGeometryToolAction, tr(
"Move Geometry"), 
"edit-move-geometry", 
true, 
false,  SLOT(onMoveGeometryToolActivated(
bool)));
 
  138   toolsGroup->addAction(m_vertexToolAction);
 
  139   toolsGroup->addAction(m_createPolygonToolAction);
 
  140   toolsGroup->addAction(m_createLineToolAction);
 
  141   toolsGroup->addAction(m_moveGeometryToolAction);
 
  144   m_tools.push_back(m_vertexToolAction);
 
  145   m_tools.push_back(m_createPolygonToolAction);
 
  146   m_tools.push_back(m_createLineToolAction);
 
  147   m_tools.push_back(m_moveGeometryToolAction);
 
  150   for(
int i = 0; i < m_tools.size(); ++i)
 
  151     m_toolBar->addAction(m_tools[i]);
 
  154   createAction(m_snapOptionsAction, tr(
"Snap Options"), 
"edit-snap", 
false, 
false,  SLOT(onSnapOptionsActivated()));
 
  155   m_toolBar->addSeparator();
 
  156   m_toolBar->addAction(m_snapOptionsAction);
 
  161   action = 
new QAction(
this);
 
  162   action->setIcon(QIcon::fromTheme(icon));
 
  163   action->setToolTip(tooltip);
 
  164   action->setCheckable(checkable);
 
  165   action->setEnabled(enabled);
 
  166   connect(action, SIGNAL(triggered(
bool)), 
this, member);
 
  171   m_saveAction->setEnabled(checked);
 
  173   for(
int i = 0; i < m_tools.size(); ++i)
 
  174     m_tools[i]->setEnabled(checked);
 
  176   m_snapOptionsAction->setEnabled(checked);
 
  185     std::map<std::string, te::edit::Repository*>::iterator it;
 
  186     for(it = repositories.begin(); it != repositories.end(); ++it) 
 
  197       std::auto_ptr<te::map::LayerSchema> schema(layer->getSchema());
 
  198       assert(schema.get());
 
  201       std::vector<std::string> oidPropertyNames;
 
  205       const std::vector<te::edit::Feature*>& features = repo->
getAllFeatures();
 
  212       assert(gpos != std::string::npos);
 
  214       for(std::size_t i = 0; i < features.size(); ++i) 
 
  223         const boost::ptr_vector<te::dt::AbstractData>& values = oid->getValue();
 
  224         assert(values.size() == oidPropertyNames.size());
 
  231         for(std::size_t j = 0; j < values.size(); ++j)
 
  232           item->
setValue(oidPropertyNames[j], values[j].clone());
 
  234         item->
setGeometry(gpos, static_cast<te::gm::Geometry*>(geom->clone()));
 
  246       std::set<int> gproperty;
 
  247       gproperty.insert(gpos);
 
  249       std::vector<std::set<int> > properties;
 
  250       for(std::size_t i = 0; i < memds->size(); ++i)
 
  251         properties.push_back(gproperty);
 
  253       std::vector<std::size_t> oidPropertyPosition;
 
  254       for(std::size_t i = 0; i < oidPropertyNames.size(); ++i)
 
  257       ds->update(dslayer->
getDataSetName(), memds.get(), properties, oidPropertyPosition);
 
  264     QMessageBox::critical(0, tr(
"TerraLib Edit Qt Plugin"), e.
what());
 
  274     QMessageBox::information(0, tr(
"TerraLib Edit Qt Plugin"), tr(
"Select a layer first!"));
 
  292     QMessageBox::information(0, tr(
"TerraLib Edit Qt Plugin"), tr(
"Select a layer first!"));
 
  310     QMessageBox::information(0, tr(
"TerraLib Edit Qt Plugin"), tr(
"Select a layer first!"));
 
  328     QMessageBox::information(0, tr(
"TerraLib Edit Qt Plugin"), tr(
"Select a layer first!"));
 
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager. 
 
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property. 
 
const std::string & getDataSetName() const 
 
te::map::AbstractLayerPtr m_layer
Layer selected. 
 
This event is used to get a single layer selected in layer tree. 
 
const std::vector< Feature * > & getAllFeatures() const 
 
boost::shared_ptr< DataSource > DataSourcePtr
 
A dialog used to configure geometry snap options. 
 
te::qt::widgets::MapDisplay * getDisplay()
 
virtual const char * what() const 
It outputs the exception message. 
 
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
 
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
void setLayers(const std::list< te::map::AbstractLayerPtr > &layers)
 
This class implements a concrete tool for vertex operations (move, add, etc.). 
 
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
 
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found. 
 
static ApplicationController & getInstance()
It returns a reference to the singleton instance. 
 
void setCurrentTool(te::qt::widgets::AbstractTool *tool)
Updates the current tool being used on te::qt::widgets::MapDisplay. 
 
const std::string & getDataSourceId() const 
 
This class represents an unique id for a data set element. 
 
This event can be used to retrieve the MapDisplat component. 
 
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
 
TEDATAACCESSEXPORT void GetOIDPropertyNames(const DataSetType *type, std::vector< std::string > &pnames)
 
This class represents a repository of geometries and features. 
 
A layer with reference to a dataset. 
 
te::qt::af::MapDisplay * m_display
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr