00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __INCLUDE_PCIDSK_VECTORSEGMENT_H
00029 #define __INCLUDE_PCIDSK_VECTORSEGMENT_H
00030
00031 #include <string>
00032 #include <vector>
00033 #include <iterator>
00034 #include "pcidsk_shape.h"
00035
00036 namespace PCIDSK
00037 {
00038 class ShapeIterator;
00039
00040
00041
00042
00043
00078 class PCIDSK_DLL PCIDSKVectorSegment
00079 {
00080 public:
00081 virtual ~PCIDSKVectorSegment() {}
00082
00093 virtual std::string GetRst() = 0;
00094
00095
00105 virtual std::vector<double> GetProjection( std::string &geosys ) = 0;
00106
00116 virtual int GetFieldCount() = 0;
00117
00124 virtual std::string GetFieldName(int field_index) = 0;
00125
00132 virtual std::string GetFieldDescription(int field_index) = 0;
00133
00140 virtual ShapeFieldType GetFieldType(int field_index) = 0;
00141
00148 virtual std::string GetFieldFormat(int field_index) = 0;
00149
00156 virtual ShapeField GetFieldDefault(int field_index) = 0;
00157
00162 virtual ShapeIterator begin() = 0;
00163
00168 virtual ShapeIterator end() = 0;
00169
00174 virtual ShapeId FindFirst() = 0;
00175
00181 virtual ShapeId FindNext(ShapeId id) = 0;
00182
00183
00189 virtual int GetShapeCount() = 0;
00190
00196 virtual void GetVertices( ShapeId id,
00197 std::vector<ShapeVertex>& list ) = 0;
00198
00204 virtual void GetFields( ShapeId id,
00205 std::vector<ShapeField>& list ) = 0;
00206
00207
00216 virtual void SetProjection(std::string geosys,
00217 std::vector<double> parms ) = 0;
00218
00229 virtual void AddField( std::string name, ShapeFieldType type,
00230 std::string description,
00231 std::string format,
00232 ShapeField *default_value=NULL ) = 0;
00233
00244 virtual ShapeId CreateShape( ShapeId id = NullShapeId ) = 0;
00245
00254 virtual void DeleteShape( ShapeId id ) = 0;
00255
00263 virtual void SetVertices( ShapeId id,
00264 const std::vector<ShapeVertex> &list ) = 0;
00265
00266
00276 virtual void SetFields( ShapeId id,
00277 const std::vector<ShapeField>& list) = 0;
00278
00279
00280
00281 };
00282
00283
00284
00285
00286
00288
00289 class ShapeIterator : public std::iterator<std::input_iterator_tag, ShapeId>
00290 {
00291 ShapeId id;
00292 PCIDSKVectorSegment *seg;
00293
00294 public:
00295 ShapeIterator(PCIDSKVectorSegment *seg_in)
00296 : seg(seg_in) { id = seg->FindFirst(); }
00297 ShapeIterator(PCIDSKVectorSegment *seg_in, ShapeId id_in )
00298 : id(id_in), seg(seg_in) {}
00299 ShapeIterator(const ShapeIterator& mit) : id(mit.id), seg(mit.seg) {}
00300 ShapeIterator& operator++() { id=seg->FindNext(id); return *this;}
00301 ShapeIterator& operator++(int) { id=seg->FindNext(id); return *this;}
00302 bool operator==(const ShapeIterator& rhs) {return id == rhs.id;}
00303 bool operator!=(const ShapeIterator& rhs) {return id != rhs.id;}
00304 ShapeId& operator*() {return id;}
00305 };
00306
00307 }
00308
00309 #endif // __INCLUDE_PCIDSK_VECTORSEGMENT_H