Ilwis-Objects  1.0
GIS and Remote Sensing framework for data access and processing
 All Classes Functions Enumerations Pages
georeference.h
1 #ifndef GEOREFERENCE_H
2 #define GEOREFERENCE_H
3 
4 #include "Kernel_global.h"
5 #include "georefadapter.h"
6 
7 namespace Ilwis {
8 
9 class GeoRefImplementation;
10 
12 public:
13  virtual Coordinate pixel2Coord(const Pixeld&) const = 0;
14  virtual Pixeld coord2Pixel(const Coordinate& crd) const = 0;
15  virtual double pixelSize() const = 0;
16  virtual bool compute() = 0;
17  virtual void coordinateSystem(const ICoordinateSystem& csy)=0;
18  virtual Size<> size() const=0;
19  virtual void size(const Size<>& sz)=0;
20  virtual bool centerOfPixel() const=0;
21  virtual void centerOfPixel(bool yesno)=0;
22 };
23 
24 class KERNELSHARED_EXPORT GeoReference : public IlwisObject, public GeoRefInterface
25 {
26 public:
27  GeoReference();
28  GeoReference(const Resource& resource);
29  ~GeoReference();
30 
31  Coordinate pixel2Coord(const Pixeld& pixel) const;
32  Pixeld coord2Pixel(const Coordinate& crd) const;
33  double pixelSize() const;
34  bool compute();
35 
36  virtual Envelope pixel2Coord(const BoundingBox &box ) const;
37  virtual BoundingBox coord2Pixel(const Envelope &box) const;
38  ICoordinateSystem coordinateSystem() const;
39  void coordinateSystem(const ICoordinateSystem& csy);
40  Size<> size() const;
41  void size(const Size<>& sz);
42  bool centerOfPixel() const;
43  void centerOfPixel(bool yesno);
44  bool isCompatible(const IlwisData<GeoReference>& georefOther) const;
45  void adapter(GeoRefAdapter* adapt);
46  bool isValid() const;
47  void impl(GeoRefImplementation *impl);
48  template<typename GrfT> QSharedPointer<GrfT> impl(){
49  QSharedPointer<GrfT> sptr = _georefImpl.dynamicCast<GrfT>();
50  if ( sptr.isNull())
51  throw ErrorObject(TR(ERR_COULD_NOT_CONVERT_2).arg("georef").arg(GrfT::typeName()));
52  return sptr;
53  }
54  template<typename GrfT> bool grfType() const {
55  return dynamic_cast<GrfT *>(_georefImpl.data()) != 0;
56  }
57 
58  static GeoReference *create(const QString& type, const Ilwis::Resource &resource=Resource());
59 
60  IlwisTypes ilwisType() const;
61 
62 
63 protected:
64  const QScopedPointer<GeoRefAdapter> &adapter() const;
65 private:
66  QSharedPointer<GeoRefImplementation> _georefImpl;
67  QScopedPointer<GeoRefAdapter> _adapter;
68 
69 };
70 
72 }
73 
74 Q_DECLARE_METATYPE(Ilwis::IGeoReference)
75 
76 #endif // GEOREFERENCE_H