30 #include "../core/ContextItem.h" 
   31 #include "../../maptools/Canvas.h" 
   32 #include "../../srs/SpatialReferenceSystemManager.h" 
   33 #include "../../common/StringUtils.h" 
   34 #include "../core/pattern/singleton/Context.h" 
   35 #include "../core/Systematic.h" 
   36 #include "../core/property/Property.h" 
   37 #include "../core/property/Properties.h" 
   38 #include "../core/WorldTransformer.h" 
   39 #include "../../common/STLUtils.h" 
   40 #include "../../geometry/Polygon.h" 
   41 #include "../../geometry/LinearRing.h" 
   42 #include "../core/enum/Enums.h" 
   43 #include "../core/property/SharedProperties.h" 
   51   m_mapDisplacementX(0),
 
   52   m_mapDisplacementY(0),
 
   84   if((!canvas) || (!utils))
 
   90   drawBackground(context);
 
  105   std::string name = 
"";
 
  108     name = m_layer->getTitle();
 
  115   m_properties->addProperty(pro_layer);
 
  117   Property pro_mapbackgroundcolor(m_hashCode);
 
  118   pro_mapbackgroundcolor.
setName(
"map_color");
 
  120   pro_mapbackgroundcolor.
setMenu(
true);
 
  121   m_properties->addProperty(pro_mapbackgroundcolor);
 
  124   pro_fixed.
setName(
"fixedScale");
 
  126   m_properties->addProperty(pro_fixed);
 
  128   Property pro_mapDisplacementX(m_hashCode);
 
  129   pro_mapDisplacementX.
setName(
"map_displacementX");
 
  131   m_properties->addProperty(pro_mapDisplacementX);
 
  133   Property pro_mapDisplacementY(m_hashCode);
 
  134   pro_mapDisplacementY.
setName(
"map_displacementY");
 
  136   m_properties->addProperty(pro_mapDisplacementY);
 
  154   if(!pro_mapbackgroundcolor.
isNull())
 
  166   if(!pro_mapDisplacementX.
isNull())
 
  168     double d_differenceX = 0;
 
  171       d_differenceX = pro_mapDisplacementX.
getValue().
toDouble() - m_mapDisplacementX;
 
  172       m_box.m_urx = m_box.m_urx + d_differenceX;
 
  173       m_mapBoxMM.m_urx = m_mapBoxMM.m_urx + d_differenceX;
 
  177       d_differenceX = m_mapDisplacementX - pro_mapDisplacementX.
getValue().
toDouble();
 
  178       m_box.m_urx = m_box.m_urx - d_differenceX;
 
  179       m_mapBoxMM.m_urx = m_mapBoxMM.m_urx - d_differenceX;
 
  185   if(!pro_mapDisplacementY.
isNull())
 
  187     double d_differenceY = 0;
 
  190       d_differenceY = pro_mapDisplacementY.
getValue().
toDouble() - m_mapDisplacementY; 
 
  191       m_box.m_ury = m_box.m_ury + d_differenceY;
 
  192       m_mapBoxMM.m_ury = m_mapBoxMM.m_ury + d_differenceY;
 
  196       d_differenceY = m_mapDisplacementY - pro_mapDisplacementY.
getValue().
toDouble();
 
  197       m_box.m_ury = m_box.m_ury - d_differenceY;
 
  198       m_mapBoxMM.m_ury = m_mapBoxMM.m_ury - d_differenceY;
 
  213     if(m_layer->getId() == layer->getId())
 
  219   m_loadedLayer = 
true;
 
  236   if(m_layer.get() == 0)
 
  248   std::string nameUnit = unitPtr->getName();
 
  257   wMM = m_box.getWidth();
 
  258   fx = m_box.getWidth()/worldBox.
getWidth();
 
  259   fy = m_box.getHeight()/worldBox.
getHeight();
 
  264     area = (int)(factor * worldBox.
getWidth() + .5);
 
  269     area = (int)(factor * worldBox.
getHeight() + .5);
 
  272   if (nameUnit.compare(
"METRE") == 0)
 
  274   else if (nameUnit.compare(
"KILOMETRE") == 0)
 
  276   else if (nameUnit.compare(
"FOOT") == 0)
 
  278   else if (nameUnit.compare(
"DEGREE") == 0)
 
  281   double scale = (1. / factor ) /(wMM / area);
 
  282   if(m_systematic && m_fixedScale)
 
  284     scale = m_systematic->getScale();
 
  296   if(m_layer.get() == 0)
 
  300   worldBox = m_layer->getExtent();
 
  301   int srid = m_layer->getSRID();
 
  309   std::string unitPtrStr = unitPtr->getName(); 
 
  312   if(unitPtrStr.compare(
"DEGREE") == 0)
 
  324     worldBox.
transform(srid, projMeters.second);   
 
  339   int srid = m_layer->getSRID();
 
  353   if(m_layer.get() == 0)
 
  357   worldBox = m_layer->getExtent();
 
  358   int srid = m_layer->getSRID();
 
  366   std::string unitPtrStr = unitPtr->getName(); 
 
  369   if(unitPtrStr.compare(
"DEGREE") != 0)
 
  378     worldBox.
transform(srid, projMeters.second);
 
  388   m_mapBoxMM.m_llx = box.
m_llx + m_mapDisplacementX;
 
  389   m_mapBoxMM.m_lly = box.
m_lly + m_mapDisplacementY;
 
  390   m_mapBoxMM.m_urx = box.
m_urx - m_mapDisplacementX;
 
  391   m_mapBoxMM.m_ury = box.
m_ury - m_mapDisplacementY;
 
  403   m_mapBoxMM.m_llx = m_box.m_llx + m_mapDisplacementX;
 
  404   m_mapBoxMM.m_lly = m_box.m_lly + m_mapDisplacementY;
 
  405   m_mapBoxMM.m_urx = m_box.m_urx - m_mapDisplacementX;
 
  406   m_mapBoxMM.m_ury = m_box.m_ury - m_mapDisplacementY;
 
  411   return m_mapDisplacementX;
 
  416   return m_mapDisplacementY;
 
  427   m_systematic = systematic;
 
  438   if(m_layer.get() == 0)
 
  441   int srid = m_layer->getSRID();  
 
  454   height = m_systematic->getHeight();
 
  455   width = m_systematic->getWidth();
 
  484   m_worldBox.m_lly = polEnv->
m_lly;
 
  485   m_worldBox.m_urx = polEnv->
m_urx;
 
  486   m_worldBox.m_ury = polEnv->
m_ury;
 
  498   m_fixedScale = fixed;
 
  508   if(m_layer.get() == 0)
 
  517   std::string unitPtrStr = unitPtr->getName(); 
 
  520   if(unitPtrStr.compare(
"DEGREE") != 0)
 
  535   if(m_layer.get() == 0)
 
  539   worldBox = m_layer->getExtent();
 
  540   int srid = m_layer->getSRID();
 
  542   if(!m_worldBox.isValid())
 
  546   worldBox = m_worldBox;
 
  557     worldBox.
transform(srid, projMeters.second); 
 
  565   std::map<te::gm::Point*, std::string>  map;
 
  572   m_mapbackgroundColor = color;
 
  577   return m_mapbackgroundColor;
 
  587   return m_loadedLayer;
 
virtual void setPosition(const double &x, const double &y)
Change coordinate llx,lly of the MVC component. 
 
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
 
virtual std::map< te::gm::Point *, std::string > getTextMapAsObjectInfo()
 
virtual bool isLoadedLayer()
 
virtual std::string getNameLayer()
 
virtual double getDisplacementX()
 
virtual te::gm::Envelope getWorldInMeters()
 
virtual te::layout::Properties * getProperties() const 
Reimplemented from Observable. 
 
virtual double getScale()
 
virtual void setPixmap(te::color::RGBAColor **pixmap)
Stores pixmap generated after drawing. 
 
Variant getValue()
Returns stored value. 
 
virtual EnumDataType * getEnumDataType()
Returns data type enumeration. 
 
virtual te::gm::Envelope getWorldInDegrees()
 
virtual EnumType * getDataTypeBool() const 
Returns value that represents type bool belonging to enumeration. 
 
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 EnumType * getDataTypeDouble() const 
Returns value that represents type double belonging to enumeration. 
 
std::string proj4DescToPlanar(int zone)
Returns string wkt with UTM projection in the specified zone. 
 
bool isNull()
Returns true if no value has been set, false otherwise. 
 
te::gm::Envelope m_mapBoxMM
 
double m_urx
Upper right corner x-coordinate. 
 
virtual void generateSystematic(te::gm::Coord2D coord)
 
std::string Convert2UCase(const std::string &value)
It converts a string to upper case. 
 
double getWidth() const 
It returns the envelope width. 
 
std::string proj4DescToGeodesic()
Returns string wkt with non-planar projection. 
 
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
 
An utility struct for representing 2D coordinates. 
 
virtual void setPosition(const double &x, const double &y)
Change coordinate llx,lly of the MVC component. 
 
EnumType * m_type
type of the MVC component 
 
virtual void updateProperties(te::layout::Properties *properties)
Reimplemented from Observable. 
 
virtual void setSystematic(Systematic *systematic)
 
te::common::UnitOfMeasurePtr unitMeasure(int srid)
Returns a UnitOfMeasurePtr pointer. 
 
virtual void setMapBackgroundColor(te::color::RGBAColor color)
 
virtual void updateProperties(te::layout::Properties *properties)
Reimplemented from Observable. 
 
A LinearRing is a LineString that is both closed and simple. 
 
te::color::RGBAColor m_mapbackgroundColor
 
double m_llx
Lower left corner x-coordinate. 
 
static Enums & getInstance()
It returns a reference to the singleton instance. 
 
A point with x and y coordinate values. 
 
int calculatePlanarZone(te::gm::Envelope latLongBox)
Calculates the area from a box in coordinated latlong. 
 
An Envelope defines a 2D rectangular region. 
 
virtual Utils * getUtils()
 
Class to represent a data type enumeration. Ex.: int, double, bool, te::color::RGBAColor (color)...
 
te::gm::Envelope m_box
bounding rectangle 
 
virtual te::map::AbstractLayerPtr getLayer()
 
Class that represents a "Model" part of Map MVC component. Its coordinate system is the same of scene...
 
Utils * getUtils()
Returns pointer with functions to manipulate the canvas and conversion between projections. 
 
virtual void setFixedScale(bool fixed)
 
virtual te::gm::Envelope getWorldBox()
 
virtual EnumType * getDataTypeColor() const 
Returns value that represents type te::color::RGBAColor** (color) belonging to enumeration. 
 
te::color::RGBAColor m_backgroundColor
background color 
 
virtual te::map::Canvas * getCanvas()
Return canvas. 
 
virtual ~MapModel()
Destructor. 
 
double toDouble()
Returns the value of double type. (The setValue method received a double) 
 
double m_lly
Lower left corner y-coordinate. 
 
bool m_enableChildren
true if MVC component can have children, false otherwise 
 
virtual te::gm::Envelope getMapBox()
 
virtual te::color::RGBAColor getMapBackgroundColor()
 
A canvas is an abstraction of a drawing area. 
 
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
 
virtual Properties * getProperties() const 
Reimplemented from Observable. 
 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
 
void setValue(ValueType value, EnumType *type)
Stores a copy of value. 
 
double m_ury
Upper right corner y-coordinate. 
 
virtual te::color::RGBAColor ** getImageW(te::gm::Envelope boxmm)
Returns a pointer RGBA colors that representing an image. 
 
virtual void draw(ContextItem context)
Drawing method of the MVC component. 
 
virtual double getDisplacementY()
 
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color. 
 
std::string toString()
Returns the value of string type. (The setValue method received a string) 
 
void setEditable(bool editable)
Sets true if property is editable, false otherwise. 
 
virtual void configCanvas(te::gm::Envelope box, bool resize=true, bool applyZoom=true)
Sets the viewport and window of the canvas. The viewport is only changed if the resize parameter is t...
 
void setName(std::string name)
Sets the name of this property. 
 
virtual bool refreshLayer(te::map::AbstractLayerPtr layer)
 
void setPointN(std::size_t i, const Point &p)
It sets the value of the specified point to this new one. 
 
virtual void setMenu(bool menu)
Sets true if property will be used in a menu, false otherwise. 
 
virtual void setBox(te::gm::Envelope box)
Change the bounding rectangle. 
 
te::color::RGBAColor toColor()
Returns the value of te::color::RGBAColor type. (The setValue method received a te::color::RGBAColor)...
 
virtual EnumType * getDataTypeString() const 
Returns value that represents type string belonging to enumeration. 
 
Utility class with functions to manipulate the canvas and conversion between projections. 
 
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. 
 
virtual void setBox(te::gm::Envelope box)
Change the bounding rectangle. 
 
virtual bool isResizeCanvas()
Returns whether the canvas should or should not be resized. 
 
virtual te::common::UnitOfMeasurePtr unitMeasureLayer()
 
double getHeight() const 
It returns the envelope height. 
 
const Envelope * getMBR() const 
It returns the minimum bounding rectangle for the geometry in an internal representation. 
 
virtual bool contains(Property property)
Checks if the property is contained within the set of properties. 
 
A property acts like a attribute member of a object and stores the state of this attribute. A set of properties stores the state of an object. Any data type, not included in the convertValue method in the class te::layout::Variant, it will be by default "std::string" value. 
 
virtual bool isFixedScale()
 
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one. 
 
bool toBool()
Returns the value of boolean type. (The setValue method received a boolean)