27 #include "../../../dataaccess/dataset/DataSet.h" 
   28 #include "../../../dataaccess/dataset/ObjectId.h" 
   29 #include "../../../dataaccess/dataset/ObjectIdSet.h" 
   30 #include "../../../dataaccess/utils/Utils.h" 
   31 #include "../../../geometry/Geometry.h" 
   32 #include "../../../geometry/Envelope.h" 
   33 #include "../../../geometry/Utils.h" 
   34 #include "../../../maptools/Utils.h" 
   35 #include "../../../srs/Config.h" 
   36 #include "../../widgets/canvas/Canvas.h" 
   37 #include "../../widgets/canvas/EyeBirdMapDisplayWidget.h" 
   38 #include "../../widgets/canvas/MapDisplay.h" 
   39 #include "../../widgets/canvas/ZoomInMapDisplayWidget.h" 
   40 #include "../../widgets/tools/AbstractTool.h" 
   41 #include "../../widgets/tools/ZoomWheel.h" 
   42 #include "../../widgets/tools/CoordTracking.h" 
   43 #include "../../widgets/Utils.h" 
   44 #include "../events/LayerEvents.h" 
   45 #include "../events/MapEvents.h" 
   46 #include "../events/ProjectEvents.h" 
   47 #include "../events/ToolEvents.h" 
   48 #include "../ApplicationController.h" 
   49 #include "../Project.h" 
   54 #include <QtGui/QContextMenuEvent> 
   55 #include <QtGui/QMessageBox> 
   67     m_currentExtentIndex(-1),
 
   68     m_extentStackMaxSize(5),
 
   74   connect(coordTracking, SIGNAL(coordTracked(QPointF&)), SLOT(
onCoordTracked(QPointF&)));
 
   75   m_display->installEventFilter(coordTracking);
 
  109   m_zoomInDisplay = display;
 
  114   m_eyeBirdDisplay = display;
 
  121     case QEvent::ContextMenu:
 
  123         m_menu->exec(static_cast<QContextMenuEvent*>(e)->globalPos());
 
  141   std::list<te::map::AbstractLayerPtr> visibleLayers;
 
  144   configSRS(visibleLayers);
 
  146   if(!m_display->getExtent().isValid())
 
  149     m_display->setExtent(displayExtent, 
false);
 
  152   m_display->setLayerList(layers);
 
  154   m_display->refresh();
 
  157     m_zoomInDisplay->setList(visibleLayers, m_display->getSRID());
 
  160     m_eyeBirdDisplay->setList(visibleLayers, m_display->getSRID());
 
  166   std::list<te::map::AbstractLayerPtr> empty;
 
  167   m_display->setLayerList(empty);
 
  168   m_display->refresh();
 
  176   m_display->installEventFilter(m_tool);
 
  181   if(m_extentStack.empty())
 
  184   if(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1))
 
  186     m_currentExtentIndex += 1;
 
  187     m_display->setExtent(m_extentStack[m_currentExtentIndex]);
 
  190   emit hasNextExtent(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1));
 
  191   emit hasPreviousExtent(m_currentExtentIndex > 0);
 
  196   if(m_extentStack.empty())
 
  199   if(m_currentExtentIndex > 0)
 
  201     m_currentExtentIndex -= 1;
 
  202     m_display->setExtent(m_extentStack[m_currentExtentIndex]);
 
  205   emit hasNextExtent(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1));
 
  206   emit hasPreviousExtent(m_currentExtentIndex > 0);
 
  211   std::list<te::map::AbstractLayerPtr> visibleLayers;
 
  214   configSRS(visibleLayers);
 
  218   m_display->setExtent(displayExtent, 
false);
 
  220   m_display->setLayerList(layers);
 
  222   m_display->refresh();
 
  225     m_zoomInDisplay->setList(visibleLayers, m_display->getSRID());
 
  228     m_eyeBirdDisplay->setList(visibleLayers, m_display->getSRID());
 
  237     m_zoomInDisplay->drawCursorPosition(static_cast<double>(coordinate.x()), static_cast<double>(coordinate.ry()));
 
  243   m_lastDisplayContent = QPixmap(*m_display->getDisplayPixmap());
 
  259       QPixmap* content = m_display->getDisplayPixmap();
 
  260       content->fill(Qt::transparent);
 
  262       QPainter painter(content);
 
  263       painter.drawPixmap(0, 0, m_lastDisplayContent);
 
  274       m_display->repaint();
 
  294       m_display->setBackgroundColor(mapColorChanged->
m_color);
 
  295       m_display->refresh();
 
  309   std::list<te::map::AbstractLayerPtr>::const_iterator it;
 
  310   for(it = layers.begin(); it != layers.end(); ++it)
 
  311       drawLayerSelection(*it);
 
  313   m_display->repaint();
 
  323   std::auto_ptr<te::da::DataSetType> dsType = layer->getSchema();
 
  325   if(!dsType->hasGeom())
 
  329   if(oids == 0 || oids->
size() == 0)
 
  334     std::size_t maxOids = 4000;
 
  336     if(oids->
size() <= maxOids)
 
  339       std::auto_ptr<te::da::DataSet> selected(layer->getData(oids));
 
  350     std::size_t nOids = 0;
 
  353     std::size_t nProcessedOids = 0;
 
  355     std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
 
  356     for(it = oids->
begin(); it != oids->
end(); ++it)
 
  358       oidsBatch->add((*it)->clone());
 
  363       if(nProcessedOids == maxOids || nOids == oids->
size())
 
  366         std::auto_ptr<te::da::DataSet> selected(layer->getData(oidsBatch.get()));
 
  376   catch(std::exception& e)
 
  378     QMessageBox::critical(m_display, tr(
"Error"), QString(tr(
"The layer selection cannot be drawn. Details:") + 
" %1.").arg(e.what()));
 
  386   assert(color.isValid());
 
  391   bool needRemap = 
false;
 
  398   QPixmap* content = m_display->getDisplayPixmap();
 
  411     std::auto_ptr<te::gm::Geometry> g(dataset->
getGeometry(gpos));
 
  416       g->transform(m_display->getSRID());
 
  419     if(currentGeomType != g->getGeomTypeId())
 
  421       currentGeomType = g->getGeomTypeId();
 
  425     canvas.
draw(g.get());
 
  431   if(!m_extentStack.empty() && m_display->getExtent().equals(m_extentStack[m_currentExtentIndex]))
 
  434   if(m_currentExtentIndex != m_extentStackMaxSize)
 
  436     m_extentStack.push_back(m_display->getExtent());
 
  437     m_currentExtentIndex += 1;
 
  441     m_extentStack.erase(m_extentStack.begin());
 
  442     m_extentStack.push_back(m_display->getExtent());
 
  443     m_currentExtentIndex = m_extentStackMaxSize;
 
  446   emit hasNextExtent(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1));
 
  447   emit hasPreviousExtent(m_currentExtentIndex > 0);
 
  458     std::pair<int, std::string> srid(layer->getSRID(), 
"EPSG");
 
  464     std::list<te::map::AbstractLayerPtr>::const_iterator it;
 
  466     for(it = layers.begin(); it != layers.end(); ++it)
 
  473       m_display->setSRID(layer->getSRID(), 
false);
 
  475       std::pair<int, std::string> srid(layer->getSRID(), 
"EPSG");
 
A connector of the te::qt::widgets::MapDisplay class to the Application Framework. 
 
QMenu * findMenu(const QString &id) const 
Returns the menu registered with key id. 
 
This class represents a set of unique ids created in the same context. i.e. from the same data set...
 
void drawLayerSelection(te::map::AbstractLayerPtr layer)
 
void clear()
It clears the map display. 
 
QColor getSelectionColor() const 
Returns the application selection color. 
 
This event signals that the color of the map display changed. 
 
void fit(const std::list< te::map::AbstractLayerPtr > &layers)
 
void onDrawLayersFinished(const QMap< QString, QString > &errors)
 
void setZoomInDisplay(te::qt::widgets::ZoomInMapDisplayWidget *display)
 
QMenu * m_menu
The map display popup menu. 
 
This event signals that the srid of the map display changed. 
 
virtual void setBackgroundColor(const QColor &color)
Sets the map display background color. 
 
This class defines an interface for objects that can receive application events and respond to them...
 
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection. 
 
This class implements a concrete tool to geographic zoom operation using the mouse wheel...
 
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib. 
 
void configSRS(const std::list< te::map::AbstractLayerPtr > &layers)
 
void draw(const std::list< te::map::AbstractLayerPtr > &layers)
It draws the given layer list. 
 
static ApplicationController & getInstance()
It gives access to the controller singleton. 
 
TEMAPEXPORT te::gm::Envelope GetExtent(const std::list< te::map::AbstractLayerPtr > &layers, int srid, bool onlyVisibles)
It calculates the extent of the given layers in the given SRID. 
 
void onCoordTracked(QPointF &coordinate)
 
QColor m_color
The color used to highlight. 
 
te::qt::widgets::MapDisplay * getDisplay()
 
TEQTAFEXPORT QColor GetDefaultDisplayColorFromSettings()
 
This event indicates that the objects of the given layer must be highlighted. 
 
te::qt::widgets::MapDisplay * m_display
Pointer to a component te::qt::widgets::MapDisplay. 
 
void draw(const te::gm::Geometry *geom)
It draws the geometry on canvas. 
 
double m_lly
Lower left corner y-coordinate. 
 
te::da::DataSet * m_dataset
The dataset that represents the objects that must be highlighted. 
 
std::size_t size() const 
It returns the object id set size. 
 
This class defines the map display ZoomIn, this component is only a specific map that shows the curre...
 
double m_ury
Upper right corner y-coordinate. 
 
A canvas built on top of Qt. 
 
void drawDataSet(te::da::DataSet *dataset, int srid, const QColor &color)
 
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code. 
 
double m_urx
Upper right corner x-coordinate. 
 
A widget to control the display of a set of layers. 
 
TEMAPEXPORT void GetVisibleLayers(const std::list< te::map::AbstractLayerPtr > &layers, std::list< te::map::AbstractLayerPtr > &visibleLayers)
It gets the visible layers of the given layer list. 
 
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator begin() const 
Returns an iterator for the object ids in container. 
 
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator end() const 
Returns an iterator for the object ids in container. 
 
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection. 
 
void setCurrentTool(te::qt::widgets::AbstractTool *tool)
Updates the current tool being used on te::qt::widgets::MapDisplay. 
 
void drawLayersSelection(const std::list< te::map::AbstractLayerPtr > &layers)
 
virtual void setSRID(const int &srid, bool doRefresh=true)
It sets a new Spatial Reference System to be used by the Map Display. 
 
bool eventFilter(QObject *watched, QEvent *e)
 
te::map::AbstractLayerPtr m_layer
The layer whose objects must be highlighted. 
 
double m_llx
Lower left corner x-coordinate. 
 
A base class for application events. 
 
This class implements a concrete tool to geographic coordinate tracking on mouse move operation...
 
MapDisplay(te::qt::widgets::MapDisplay *display)
Constructor. 
 
TEQTWIDGETSEXPORT void Config2DrawLayerSelection(te::map::Canvas *canvas, const QColor &selectionColor, const te::gm::GeomType &type)
It configs (i.e. prepares) the given canvas to draw a layer selection. 
 
void setEyeBirdDisplay(te::qt::widgets::EyeBirdMapDisplayWidget *display)
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
 
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value. 
 
This class defines the map display EyeBird, this component is only a specific map that shows the orig...
 
An Envelope defines a 2D rectangular region. 
 
void setWindow(const double &llx, const double &lly, const double &urx, const double &ury)
It sets the world (or window) coordinates area (supposing a cartesian reference system). 
 
A dataset is the unit of information manipulated by the data access module of TerraLib. 
 
void broadcast(te::qt::af::evt::Event *evt)
Send events in broadcast for all registered components. 
 
Signals a mouse moved over the current display. 
 
void onApplicationTriggered(te::qt::af::evt::Event *e)
Listener to the application framewrork events.