IImportShape.hpp
1 #ifndef DM_IO_IMPORT_SHAPE_HPP_INCLUDED
2 #define DM_IO_IMPORT_SHAPE_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5  #pragma once
6 #endif
7 
8 //DM
9 #include "DM/config.hpp"
10 #include "DM/AutoLink.hpp" //enable autolink
11 
12 #include "DM/ColumnTypes.hpp"
13 #include "DM/IO/IImport.hpp"
14 #include "DM/IO/IShapeTableDefinition.hpp"
15 
16 DM_NAMESPACE_BEGIN
17 
18 /// Specific import class for handling shape file imports
19 class DM_API IImportShape : public virtual IImport
20 {
21 public:
22  static IImportShape* New( const char *file, FilterHandle filter = FilterHandle(), ControlObjectHandle control = ControlObjectHandle(),
23  bool collectHdrContents = false, unsigned maxBulkPoints = 1000, AddInfoLayoutHandle defaultLayout = AddInfoLayoutHandle() );
24 
25  /// retrieve the table definition of corresponding dbf file
26  static ShapeTableDefinitionHandle getTableDefinition(const char *file);
27 
28 protected:
29  virtual ~IImportShape() {}
30 
31 public:
32  /// \brief set a mapping between dbf attributes and an add info layout for importing the attribute information as well
33  /** This is optional import definition must be set before the first element (and file header) is read. If nothing is set no
34  dbf attributes will be imported.
35  \param[in] layout layout that should be attached to each geometry object
36  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
37  \param[in] idxMap C array mapping the dbf attribute index (first value of std::pair) to the add info layout index (second value of std::pair)
38  */
39  virtual void setAttributeMapping(AddInfoLayoutHandle layout, unsigned mapSize, std::pair<unsigned, unsigned> *idxMap) = 0;
40 
41  /// \brief set a mapping between dbf attributes and an add info layout for importing the attribute information as well
42  /** This is optional import definition must be set before the first element (and file header) is read. If nothing is set no
43  dbf attributes will be imported.
44  \param[in] layout layout that should be attached to each geometry object
45  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
46  \param[in] idxMap C array mapping the dbf attribute name (first value of std::pair) to the add info layout index (second value of std::pair)
47  */
48  virtual void setAttributeMapping(AddInfoLayoutHandle layout, unsigned mapSize, std::pair<const char*, unsigned> *idxMap) = 0;
49 
50  /// \brief set a translation map between a dbf attribute and the scop semantic
51  /** This is optional import definition must be set before the first element (and file header) is read.
52  \param[in] columnIdx index of the dbf attribute to be used
53  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
54  \param[in] translationMap C array mapping string values (first value of std::pair) to the scop semantic (second value of std::pair)
55  */
56  virtual void setSemanticTranslation(unsigned columnIdx, unsigned mapSize, std::pair<const char*, int> *translationMap ) = 0;
57 
58  /// \brief set a translation map between a dbf attribute and the scop semantic
59  /** This is optional import definition must be set before the first element (and file header) is read.
60  \param[in] columnName dbf attribute name to be used
61  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
62  \param[in] translationMap C array mapping string values (first value of std::pair) to the scop semantic (second value of std::pair)
63  */
64  virtual void setSemanticTranslation(const char* columnName, unsigned mapSize, std::pair<const char*, int> *translationMap ) = 0;
65 
66 };
67 
69 
70 DM_NAMESPACE_END
71 
72 #endif //DM_IO_IMPORT_SHAPE_HPP_INCLUDED