27 #include "../common/ByteSwapUtils.h" 
   28 #include "../common/Globals.h" 
   29 #include "../common/HexUtils.h" 
   30 #include "../common/Translator.h" 
   52   const char* aux = wkb;
 
   70   assert(wkb && endptr);
 
   73   unsigned int gType = 0;
 
   75   memcpy(&byteOrder, wkb, 1);
 
   76   memcpy(&gType, wkb + 1, 4);
 
   86       return getPoint(wkb, endptr);
 
   89       return getPointZ(wkb, endptr);
 
   92       return getPointM(wkb, endptr);
 
   95       return getPointZM(wkb, endptr);
 
  102       return getLineString(wkb, endptr);
 
  111        return getPolygon(wkb, endptr);
 
  129       return getGeometryCollection(wkb, endptr);
 
  139       return getPolyhedralSurface(wkb, endptr);
 
  142       throw Exception(
TE_TR(
"Could not read WKB due to an invalid geometry type!"));
 
  148   assert(wkb && endptr);
 
  155   memcpy(&byteOrder, wkb, 1);
 
  158   memcpy(&x, wkb + 5, 8);        
 
  159   memcpy(&y, wkb + 13, 8);
 
  172   return new Point(x, y, 0, 0);
 
  177   assert(wkb && endptr);
 
  185   memcpy(&byteOrder, wkb, 1);
 
  187   memcpy(&x, wkb + 5, 8);        
 
  188   memcpy(&y, wkb + 13, 8);
 
  189   memcpy(&z, wkb + 21, 8);
 
  201   return new PointZ(x, y, z, 0, 0);
 
  206   assert(wkb && endptr);
 
  214   memcpy(&byteOrder, wkb, 1);
 
  216   memcpy(&x, wkb + 5, 8);
 
  217   memcpy(&y, wkb + 13, 8);
 
  218   memcpy(&m, wkb + 21, 8);
 
  230   return new PointM(x, y, m, 0, 0);
 
  235   assert(wkb && endptr);
 
  245   memcpy(&byteOrder, wkb, 1);
 
  247   memcpy(&x, wkb + 5, 8);
 
  248   memcpy(&y, wkb + 13, 8);
 
  249   memcpy(&z, wkb + 21, 8);
 
  250   memcpy(&m, wkb + 29, 8);
 
  264   return new PointZM(x, y, z, m, 0, 0);
 
  269   assert(wkb && endptr);
 
  272   unsigned int gType = 0;
 
  274   unsigned int nPts = 0;
 
  276   memcpy(&byteOrder, wkb, 1);
 
  277   memcpy(&gType, wkb + 1, 4);
 
  278   memcpy(&nPts, wkb + 5, 4);
 
  292   double* zA = l->
getZ();
 
  294   double* mA = l->
getM();
 
  299       memcpy(coords, wkb, 16 * nPts);
 
  304       for(
unsigned int i = 0; i < nPts; ++i)
 
  306         memcpy(&(coords[i]), wkb, 16);
 
  307         memcpy(&(zA[i]), wkb + 16, 8);
 
  313       for(
unsigned int i = 0; i < nPts; ++i)
 
  315         memcpy(&(coords[i]), wkb, 16);
 
  316         memcpy(&(mA[i]), wkb + 16, 8);
 
  322       for(
unsigned int i = 0; i < nPts; ++i)
 
  324         memcpy(&(coords[i]), wkb, 16);
 
  325         memcpy(&(zA[i]), wkb + 16, 8);
 
  326         memcpy(&(mA[i]), wkb + 24, 8);
 
  332       throw Exception(
TE_TR(
"Could not read WKB due to an invalid line string type!"));
 
  337     for(
unsigned int i = 0; i < nPts; ++i)
 
  344       for(
unsigned int i = 0; i < nPts; ++i)
 
  348       for(
unsigned int i = 0; i < nPts; ++i)
 
  359   assert(wkb && endptr);
 
  361   unsigned int nPts = 0;
 
  363   memcpy(&nPts, wkb, 4);
 
  373   double* zA = r->
getZ();
 
  375   double* mA = r->
getM();
 
  380       memcpy(coords, wkb, 16 * nPts);
 
  385       for(
unsigned int i = 0; i < nPts; ++i)
 
  387         memcpy(&(coords[i]), wkb, 16);
 
  388         memcpy(&(zA[i]), wkb + 16, 8);
 
  394       for(
unsigned int i = 0; i < nPts; ++i)
 
  396         memcpy(&(coords[i]), wkb, 16);
 
  397         memcpy(&(mA[i]), wkb + 16, 8);
 
  403       for(
unsigned int i = 0; i < nPts; ++i)
 
  405         memcpy(&(coords[i]), wkb, 16);
 
  406         memcpy(&(zA[i]), wkb + 16, 8);
 
  407         memcpy(&(mA[i]), wkb + 24, 8);
 
  413       throw Exception(
TE_TR(
"Could not read WKB due to an invalid linear ring type!"));
 
  418     for(
unsigned int i = 0; i < nPts; ++i)
 
  425       for(
unsigned int i = 0; i < nPts; ++i)
 
  429       for(
unsigned int i = 0; i < nPts; ++i)
 
  440   assert(wkb && endptr);
 
  443   unsigned int gType = 0;
 
  444   unsigned int nRings = 0;
 
  446   memcpy(&byteOrder, wkb, 1);
 
  447   memcpy(&gType, wkb + 1, 4);
 
  448   memcpy(&nRings, wkb + 5, 4);
 
  521       throw Exception(
TE_TR(
"Could not read WKB due to an invalid polygon type!"));
 
  529   for(
unsigned int i = 0; i < nRings; ++i)
 
  531     LinearRing* r = getLinearRing(wkb, endptr, byteOrder, rType);
 
  541   assert(wkb && endptr);
 
  544   unsigned int gType = 0;
 
  545   unsigned int nGeoms = 0;
 
  547   memcpy(&byteOrder, wkb, 1);
 
  548   memcpy(&gType, wkb + 1, 4);
 
  549   memcpy(&nGeoms, wkb + 5, 4);
 
  567       gc = 
new MultiPolygon(nGeoms, static_cast<GeomType>(gType));
 
  574       gc = 
new MultiPoint(nGeoms, static_cast<GeomType>(gType));
 
  592       throw Exception(
TE_TR(
"Could not read WKB due to an invalid geometry collection type!"));
 
  598     throw Exception(
TE_TR(
"Could not create geometry collection from wkb!"));
 
  600   for(
unsigned int i = 0; i < nGeoms; ++i)
 
  602     Geometry* g = getGeometry(wkb, endptr);
 
  612   assert(wkb && endptr);
 
  615   unsigned int gType = 0;
 
  616   unsigned int nPols = 0;
 
  618   memcpy(&byteOrder, wkb, 1);
 
  619   memcpy(&gType, wkb + 1, 4);
 
  620   memcpy(&nPols, wkb + 5, 4);
 
  645       ph = 
new TIN(nPols, static_cast<GeomType>(gType), 0, 0);
 
  649       throw Exception(
TE_TR(
"Could not read WKB due to an invalid polyhedral surface type!"));
 
  655     throw Exception(
TE_TR(
"Could not create polyhedral surface from wkb!"));
 
  657   for(
unsigned int i = 0; i < nPols; ++i)
 
  659     Polygon* gptr = getPolygon(wkb, endptr);
 
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments...
 
MultiPolygon is a MultiSurface whose elements are Polygons. 
 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code. 
 
A LinearRing is a LineString that is both closed and simple. 
 
Coord2D * getCoordinates() const 
It returns a pointer to the internal array of coordinates. 
 
static Geometry * readHex(const char *hwkb)
It returns a valid geometry from a given hex-encoded WKB. 
 
static const MachineByteOrder sm_machineByteOrder
A flag that indicates the machine byte order (Big Endian or Little Endian). 
 
static te::gm::Point * getPoint(const char *wkb, const char **endptr)
 
static te::gm::Polygon * getPolygon(const char *wkb, const char **endptr)
 
An utility struct for representing 2D coordinates. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments...
 
static te::gm::Geometry * getGeometry(const char *wkb, const char **endptr)
 
MultiPoint is a GeometryCollection whose elements are restricted to points. 
 
A point with a z-coordinate value and an associated measurement. 
 
A point with an associated measure. 
 
TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches...
 
A LinearRing is a LineString that is both closed and simple. 
 
MultiPoint is a GeometryCollection whose elements are restricted to points. 
 
A point with z-coordinate value. 
 
LineString is a curve with linear interpolation between points. 
 
static te::gm::LinearRing * getLinearRing(const char *wkb, const char **endptr, te::common::MachineByteOrder byteOrder, GeomType gType)
 
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary. 
 
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary. 
 
A point with x and y coordinate values. 
 
static te::gm::GeometryCollection * getGeometryCollection(const char *wkb, const char **endptr)
 
MultiLineString is a MultiCurve whose elements are LineStrings. 
 
MultiPolygon is a MultiSurface whose elements are Polygons. 
 
MultiCurve is a class that represents a 1-dimensional GeometryCollection whose elements are curves...
 
static te::gm::PointM * getPointM(const char *wkb, const char **endptr)
 
static te::gm::LineString * getLineString(const char *wkb, const char **endptr)
 
MachineByteOrder
Endianness. 
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
static te::gm::PolyhedralSurface * getPolyhedralSurface(const char *wkb, const char **endptr)
 
An exception class for the Geometry module. 
 
TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches...
 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
 
MultiLineString is a MultiCurve whose elements are LineStrings. 
 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
 
A class that deserializes a geometry from a valid WKB. 
 
static te::gm::PointZM * getPointZM(const char *wkb, const char **endptr)
 
static te::gm::PointZ * getPointZ(const char *wkb, const char **endptr)
 
char * Hex2Binary(const char *hex)
It converts each pair of hex characters from a NULL-terminated string of hex characters into a binary...
 
void setGeometryN(std::size_t i, Geometry *g)
It sets the n-th geometry in this geometry collection. 
 
const double & getZ(std::size_t i) const 
It returns the n-th z coordinate value. 
 
const double & getM(std::size_t i) const 
It returns the n-th m measure value. 
 
void setPatchN(std::size_t i, Polygon *p)
It sets the informed position polygon to the new one. 
 
It is a collection of other geometric objects. 
 
A point with z-coordinate value. 
 
A point with a z-coordinate value and an associated measurement. 
 
A point with an associated measure. 
 
void SwapBytes(T &v)
It swaps the bytes in local. 
 
It is a collection of other geometric objects. 
 
static Geometry * read(const char *wkb)
It returns a valid geometry from a given WKB. 
 
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.