28 #include "../../../common/STLUtils.h" 29 #include "../../../common/StringUtils.h" 30 #include "../../../geometry/Coord2D.h" 31 #include "../../../geometry/Envelope.h" 32 #include "../../../maptools/AbstractLayer.h" 33 #include "../../../maptools/Utils.h" 34 #include "../tools/AbstractTool.h" 35 #include "../utils/ScopedCursor.h" 42 #include <QPaintDevice> 43 #include <QResizeEvent> 46 #include <QGraphicsView> 52 m_displayPixmap(new QPixmap(size)),
53 m_draftPixmap(new QPixmap(size)),
54 m_backgroundColor(Qt::white),
56 m_timer(new QTimer(this)),
64 m_digitalization(0.0),
66 m_graphicScale(nullptr),
105 setAcceptDrops(
true);
129 if(al.get() ==
nullptr)
132 std::list<te::map::AbstractLayerPtr> vis, visibleLayers;
135 std::list<te::map::AbstractLayerPtr>::iterator vit;
136 for(vit = vis.begin(); vit != vis.end(); ++vit)
138 if((*vit)->getType() ==
"DATASETLAYER" ||
139 (*vit)->getType() ==
"QUERYLAYER" ||
140 (*vit)->getType() ==
"RASTERLAYER")
142 visibleLayers.push_front(*vit);
153 std::list<te::map::AbstractLayerPtr>::iterator lit;
154 for(lit = visibleLayers.begin(); lit != visibleLayers.end(); ++lit)
158 int srid = (*lit)->getSRID();
216 return static_cast<unsigned int>(width());
221 return static_cast<unsigned int>(height());
228 unsigned int widthPixels =
getWidth();
230 double widthMM = widthInches * 25.4;
235 return static_cast<double>(widthMM());
244 double heightMM = heightInches * 25.4;
249 return static_cast<double>(heightMM());
286 draw(boost::dynamic_pointer_cast<te::map::AbstractLayer>(layer->
getChild(i)).
get(), painter);
304 QPaintDevice* device = canvas->
getDevice();
306 if(device->devType() == QInternal::Pixmap)
307 painter.drawPixmap(0, 0, *static_cast<QPixmap*>(device));
308 else if(device->devType() == QInternal::Image)
309 painter.drawImage(0, 0, *static_cast<QImage*>(device));
335 QPainter painter(
this);
345 QWidget::resizeEvent(e);
431 double newWidthW = (size.width() * widthW) / oldSize.width();
432 double newHeightW = (size.height() * heightW) / oldSize.height();
446 e.
m_llx = center.
x - (newWidthW * 0.5);
447 e.
m_urx = center.
x + (newWidthW * 0.5);
448 e.
m_lly = center.
y - (newHeightW * 0.5);
449 e.
m_ury = center.
y + (newHeightW * 0.5);
475 if (unitPtr !=
nullptr) {
477 std::string unit = unitPtr->getName();
479 if (unit ==
"DEGREE")
486 wdx = envelope.
getWidth() * 111133.;
500 wdx = envelope.
getWidth() * 111133.;
508 double dx = wPixels / wdx, dy = hPixels / wdy, f = (dx > dy) ? dx : dy;
514 else if (unit ==
"KILOMETRE")
516 else if (unit ==
"FOOT")
517 wT = wMM / (12. * 25.4);
519 double wp = wT / wPixels;
529 double ff = scale / oldScale;
530 double xmin, ymin, xmax, ymax;
538 double dx = (wdx - (wdx * ff)) / 2.;
539 double dy = (wdy - (wdy * ff)) / 2.;
547 double dx = ((wdx * ff) - wdx) / 2.;
548 double dy = ((wdy * ff) - wdy) / 2.;
573 dpiX = this->logicalDpiX();
574 dpiY = this->logicalDpiY();
594 removeEventFilter(
m_tool);
603 installEventFilter(
m_tool);
608 if ((minScale > maxScale) || (minScale < 1 || maxScale < 1))
const TreeItemPtr & getChild(std::size_t i) const
It returns the n-th child.
std::size_t getChildrenCount() const
It returns the number of children of this node.
This is the base class for layers.
te::map::AlignType m_hAlign
The display horizontal align.
static te::dt::Date dx(2010, 12, 31)
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
double m_urx
Upper right corner x-coordinate.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
double getWidth() const
It returns the envelope width.
te::map::AlignType m_vAlign
The display vertical align.
virtual Visibility getVisibility() const
It returns the layer visibility.
An utility struct for representing 2D coordinates.
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
void Union(const Envelope &rhs)
It updates the envelop with coordinates of another envelope.
virtual void setExtent(te::gm::Envelope &e, bool doRefresh=true)
It sets the world visible area and refreshes the contents in the map display.
Coord2D getCenter() const
It returns the rectangle's center coordinate.
virtual void setLayerList(const std::list< te::map::AbstractLayerPtr > &layers)
It sets the layer list to be showed in the Map Display.
MapDisplay()
It initializes a new MapDisplay.
double m_llx
Lower left corner x-coordinate.
static SpatialReferenceSystemManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
virtual void setSRID(const int &srid, bool doRefresh=true)
It sets a new Spatial Reference System to be used by the Map Display.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
int m_srid
The display SRS.
te::gm::Envelope m_extent
The display extent.
double m_lly
Lower left corner y-coordinate.
virtual void draw(Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)=0
It draws the layer geographic objects in the given canvas using the informed SRS. ...
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
double m_ury
Upper right corner y-coordinate.
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
double getHeight() const
It returns the envelope height.
bool isValid() const
It tells if the rectangle is valid or not.
TEMAPEXPORT te::gm::Envelope GetWorldBoxInPlanar(const te::gm::Envelope &worldBox, int srid)
It gets the requested envelope on a UTM planar projection.
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.