Fire Core  8.0.0.alpha
GIS framework per tutti gli usi
 Tutto Classi Namespace Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Friend
VectorLayerInfo.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_DATA_VECTORLAYERINFO_HPP_INCLUDED
5 #define FIRE_DATA_VECTORLAYERINFO_HPP_INCLUDED
6 
7 #include <fire/gear/geom/Envelope.hpp>
8 #include <fire/gear/projection/Projection.hpp>
9 #include <fire/gear/projection/ProjectionsManager.hpp>
10 
11 #include <string>
12 #include <vector>
13 #include <exception>
14 
15 #include "fire/gis/export.hpp"
16 #include "fire/source/vector/VectorLayerType.hpp"
17 #include "fire/source/exception/LayerException.hpp"
18 #include "fire/source/vector/shared/MetadataSh.hpp"
19 
20 namespace fire {
21 namespace source {
22 namespace vector {
23 
24 namespace shared {
25 class VectorLayerInfoSh;
26 } // namespace shared
27 
31 class FIRE_GIS_DLL VectorLayerInfo {
32  public:
34  typedef std::vector< gear::geom::Envelope::EnvelopeShp > VctEnvelope;
35 
36  friend class shared::VectorLayerInfoSh;
37 
42  VectorLayerInfo(VectorLayerInfo const & source) {}
43 
47  virtual ~VectorLayerInfo() {}
48 
49  protected:
54 
60  virtual void getExtent(VctEnvelope & list, const int & srid = gear::projection::ProjectionsManager::getUnknownSrid()) const = 0;
61 
67  virtual gear::geom::Envelope::EnvelopeShp getExtent(const int &srid) const = 0;
68 
75  virtual gear::geom::Envelope::EnvelopeShp getExtent(const std::string & geomFld, const int & srid = gear::projection::ProjectionsManager::getUnknownSrid()) const = 0;
76 
81  virtual std::string getName() const = 0;
82 
87  virtual std::string getSchema() const = 0;
88 
93  virtual VectorLayerType::VectorLayerType getType() const = 0;
94 
99  virtual Metadata::MetadataShp const getMetadata() const = 0;
100 
105  virtual int getSrid(const std::string& geomFld) const {
106  Metadata::MetadataShp mtd = getMetadata();
107  if (!mtd) {
108  std::stringstream ss;
109  ss << "Invalid metadata for layer " << getSchema() << "." << getName();
110  throw exception::LayerException(ss.str());
111  }
112 
113  Field::FieldShp fld = mtd.get(geomFld);
114  if (fld.existsExtraParam(Field::SRID))
115  return fld.getExtraParam(Field::SRID);
116  else
118  }
119 
124  virtual size_t getCount() const = 0;
125 
126  private:
127  VectorLayerInfo& operator=(VectorLayerInfo const & source);
128 };
129 
130 } // namespace vector
131 } // namespace source
132 } // namespace fire
133 
134 #endif
Definition: EnvelopeSh.hpp:18
static int getUnknownSrid()
Restituisce l'identificativo del sistema di riferimento sconosciuto.
Definition: VectorLayerInfo.hpp:31
Definition: FieldSh.hpp:21
Definition: LayerException.hpp:16
Definition: MetadataSh.hpp:22
VectorLayerInfo(VectorLayerInfo const &source)
VectorLayerInfo.
Definition: VectorLayerInfo.hpp:42
VectorLayerInfo()
VectorLayerInfo.
Definition: VectorLayerInfo.hpp:53
virtual int getSrid(const std::string &geomFld) const
Definition: VectorLayerInfo.hpp:105
Definition: VectorLayerInfoSh.hpp:23