30 #include "../core/ContextItem.h"
31 #include "../core/pattern/singleton/Context.h"
32 #include "../../geometry/Envelope.h"
33 #include "../../geometry/Coord2D.h"
34 #include "../core/property/Property.h"
35 #include "../core/property/PlanarGridSettingsConfigProperties.h"
36 #include "../core/enum/Enums.h"
56 delete m_settingsConfig;
63 if((!canvas) || (!utils))
89 drawVerticalLines(canvas, utils, box);
90 drawHorizontalLines(canvas, utils, box);
103 yInit = m_initialGridPointY;
107 int nParts = (int)(dify/m_lneVrtGap);
110 yInit = m_initialGridPointY;
114 yInit = yInit + (nParts * m_lneVrtGap);
142 convert.precision(10);
143 double number = y1 / (double)m_unit;
148 if(m_visibleAllTexts)
152 canvas->
drawText(llx - m_lneHrzDisplacement - wtxt, y, convert.str(), 0);
154 m_gridTexts[coordLeft] = convert.str();
159 canvas->
drawText(urx + m_lneHrzDisplacement, y, convert.str(), 0);
161 m_gridTexts[coordRight] = convert.str();
183 xInit = m_initialGridPointX;
187 int nParts = (int)(difx/m_lneHrzGap);
190 xInit = m_initialGridPointX;
194 xInit = xInit + (nParts * m_lneHrzGap);
229 convert.precision(10);
230 double number = x1 / (double)m_unit;
235 if(m_visibleAllTexts)
239 canvas->
drawText(x - (wtxt/2.), lly - m_lneVrtDisplacement - htxt, convert.str(), 0);
240 te::gm::Point* coordBottom =
new te::gm::Point(m_mapDisplacementX + x - (wtxt/2.), m_mapDisplacementY + lly - m_lneVrtDisplacement - htxt);
241 m_gridTexts[coordBottom] = convert.str();
246 canvas->
drawText(x - (wtxt/2.), ury + m_lneVrtDisplacement, convert.str(), 0);
247 te::gm::Point* coordTop =
new te::gm::Point(m_mapDisplacementX + x - (wtxt/2.), m_mapDisplacementY + ury + m_lneVrtDisplacement);
248 m_gridTexts[coordTop] = convert.str();
264 m_lneHrzGap = m_mapScale * 0.05;
269 m_lneVrtGap = m_lneHrzGap;
272 if(m_initialGridPointX <= 0)
276 if(m_initialGridPointY <= 0)
virtual void drawHorizontalLines(te::map::Canvas *canvas, Utils *utils, te::gm::Envelope box)
Class that represents a "Model" part of GridMap MVC component. Its coordinate system is the same of s...
virtual void setFontFamily(const std::string &family)=0
It sets the text font family.
virtual void textBoundingBox(double &w, double &h, std::string txt)
A method that calculates the height and width of a text.
te::layout::WorldTransformer getTransformGeo(te::gm::Envelope boxgeo, te::gm::Envelope boxmm)
Returns a WorldTransformer object to transformations between geo coordinates and millimeter coordinat...
virtual void setPolygonFillColor(const te::color::RGBAColor &color)=0
It sets the color used to fill the draw of polygon geometries.
virtual void draw(te::map::Canvas *canvas, Utils *utils, te::gm::Envelope box, int srid)
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
virtual void drawText(int x, int y, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
It draws a text.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
EnumType * m_type
type of the MVC component
virtual te::gm::LinearRing * createSimpleLine(te::gm::Envelope box)
Creates a LinearRing (line) pointer from a box in world coordinates (mm)
A LinearRing is a LineString that is both closed and simple.
static Enums & getInstance()
It returns a reference to the singleton instance.
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
virtual ~GridPlanarModel()
Utils * getUtils()
Returns pointer with functions to manipulate the canvas and conversion between projections.
virtual void drawLineW(te::gm::LinearRing *line)
Draw a line in world coordinates (mm).
virtual void drawVerticalLines(te::map::Canvas *canvas, Utils *utils, te::gm::Envelope box)
virtual void calculateGaps(te::gm::Envelope box)
A canvas is an abstraction of a drawing area.
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
virtual void setPolygonContourColor(const te::color::RGBAColor &color)=0
It sets the pen color used to draw the boundary of polygon geometries.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
std::string convert(const path &v)
URI path to string.
double m_lneHrzDisplacement
virtual void setLineColor(const te::color::RGBAColor &color)=0
It sets the pen color used to draw line geometries.
Utility class with functions to manipulate the canvas and conversion between projections.
bool isValid() const
It tells if the rectangle is valid or not.
double m_lneVrtDisplacement
virtual void setTextPointSize(double size)=0
It sets the text point Size.