27 #include "../../../geometry/Envelope.h" 
   28 #include "../../../geometry/Geometry.h" 
   29 #include "../../../geometry/LinearRing.h" 
   30 #include "../../../geometry/LineString.h" 
   31 #include "../../../geometry/Point.h" 
   32 #include "../../../geometry/Polygon.h" 
   33 #include "../../../qt/widgets/canvas/MapDisplay.h" 
   34 #include "../../../qt/widgets/Utils.h" 
   35 #include "../../RepositoryManager.h" 
   36 #include "../../Utils.h" 
   37 #include "../Renderer.h" 
   42 #include <QMouseEvent> 
   51   : AbstractTool(display, parent),
 
   53     m_continuousMode(false),
 
   66   QPixmap* draft = m_display->getDraftPixmap();
 
   67   draft->fill(Qt::transparent);
 
   72   if(e->button() != Qt::LeftButton)
 
   85   TrySnap(coord, m_display->getSRID());
 
   87   m_coords.push_back(coord);
 
   94   if(m_coords.size() < 1 || m_isFinished)
 
   98   pos += QPointF(0.0001, 0.0001); 
 
  100   QPointF pw = m_display->transform(pos);
 
  104   TrySnap(coord, m_display->getSRID());
 
  106   m_coords.push_back(coord);
 
  110   Qt::KeyboardModifiers keys = e->modifiers();
 
  112   if(keys == Qt::NoModifier)
 
  113     m_continuousMode = 
false;
 
  114   else if(keys == Qt::ShiftModifier)
 
  115     m_continuousMode = 
true;
 
  129   if(e->button() != Qt::LeftButton)
 
  132   if(m_coords.size() < 3) 
 
  149   QPixmap* draft = m_display->getDraftPixmap();
 
  150   draft->fill(Qt::transparent);
 
  154   renderer.
begin(draft, env, m_display->getSRID());
 
  157   renderer.
drawRepository(m_layer->getId(), env, m_display->getSRID());
 
  159   if(!m_coords.empty())
 
  162     if(m_coords.size() < 3)
 
  167     if(m_continuousMode == 
false)
 
  173   m_display->repaint();
 
  183   renderer.
draw(polygon, 
true);
 
  195   renderer.
draw(line, 
true);
 
  209   for(std::size_t i = 0; i < m_coords.size(); ++i)
 
  210     ring->
setPoint(i, m_coords[i].x, m_coords[i].y);
 
  211   ring->
setPoint(m_coords.size(), m_coords[0].x, m_coords[0].y); 
 
  216   polygon->
setSRID(m_display->getSRID());
 
  218   if(polygon->
getSRID() == m_layer->getSRID())
 
  230   for(std::size_t i = 0; i < m_coords.size(); ++i)
 
  231     line->
setPoint(i, m_coords[i].x, m_coords[i].y);
 
  233   line->
setSRID(m_display->getSRID());
 
  235   if(line->
getSRID() == m_layer->getSRID())
 
  254   m_coords.push_back(m_lastPos);
 
int getSRID() const 
It returns the Spatial Reference System ID associated to this geometric object. 
void addGeometry(const std::string &source, te::gm::Geometry *geom)
void transform(int srid)
It converts the coordinate values of the geometry to the new spatial reference system. 
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
An utility struct for representing 2D coordinates. 
A LinearRing is a LineString that is both closed and simple. 
LineString is a curve with linear interpolation between points. 
static Renderer & getInstance()
It returns a reference to the singleton instance. 
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point. 
An Envelope defines a 2D rectangular region. 
TEEDITQTEXPORT QPointF GetPosition(QMouseEvent *e)
void draw(te::gm::Geometry *geom, bool showVertexes=false)
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
This is a singleton for rendering geometries and features. 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
TEEDITEXPORT void TrySnap(te::gm::Coord2D &coord, int srid)
void begin(QPaintDevice *device, const te::gm::Envelope &e, int srid)
void drawRepository(const std::string &source, const te::gm::Envelope &e, int srid)
void setSRID(int srid)
It sets the Spatial Reference System ID of the linestring. 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
bool isValid() const 
It tells if the rectangle is valid or not. 
void transform(int srid)
It converts the coordinate values of the linestring to the new spatial reference system. 
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.