Loading [MathJax]/extensions/tex2jax.js
IImportShape.hpp
1 #pragma once
2 
3 //DM
4 #include "DM/config.hpp"
5 #include "DM/AutoLink.hpp" //enable autolink
6 
7 #include "DM/ColumnTypes.hpp"
8 #include "DM/IO/IImport.hpp"
9 #include "DM/IO/IShapeTableDefinition.hpp"
10 
11 DM_NAMESPACE_BEGIN
12 
13 /// Specific import class for handling shape file imports
14 class DM_API IImportShape : public virtual IImport
15 {
16 public:
17  /// \brief creates new shape import object
18  /**
19  interface for importing geometry objects from a shpae file
20  \param[in] file shape filename
21  \param[in] filter filter for subselecting/transforming objects during export
22  \param[in] control control object for retrieving export progress information
23  \param[in] collectHdrContents flag for explicitly collecting header information while exporting
24  \param[in] maxBulkPoints chunk size for bulk points being imported at once
25  \param[in] defaultLayout default attribute layout for objects while importing (attribute stored within the file, will be extended to this layout)
26  */ static IImportShape* New( const char *file, FilterHandle filter = FilterHandle(), ControlObjectHandle control = ControlObjectHandle(),
27  bool collectHdrContents = false, unsigned maxBulkPoints = 1000, AddInfoLayoutHandle defaultLayout = AddInfoLayoutHandle() );
28 
29  /// retrieve the table definition of corresponding dbf file (deprecated. use attribute information in file header instead)
30  static ShapeTableDefinitionHandle getTableDefinition(const char *file);
31 
32 protected:
33  virtual ~IImportShape() {}
34 
35 public:
36  /// \brief enable (default) or disable dbf attribute import.
37  /// any subsequent importAttribute, v_setAddInfoMapping or v_setSemanticMapping call will automatic re-enable the dbf import flag
38  virtual void importDBFAttributes(bool flag) = 0;
39 
40  /// \brief import a dbf column as predefined DM attribute specified by its ColumnSemantic
41  virtual void importAttribute(int dbfAttrIndex, ColumnSemantic ngCol) = 0;
42 
43  /// \brief import a dbf column as predefined or user-defined DM attribute
44  virtual void importAttribute(int dbfAttrIndex, const char *ngName = 0, ColumnType ngType = ColumnType::count) = 0;
45 
46  /// \brief set a mapping between dbf attributes and an add info layout for importing the attribute information as well (deprecated)
47  /** This is optional import definition must be set before the first element (and file header) is read. If nothing is set no
48  dbf attributes will be imported.
49  \param[in] layout layout that should be attached to each geometry object
50  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
51  \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)
52  */
53  virtual void setAttributeMapping(AddInfoLayoutHandle layout, unsigned mapSize, std::pair<unsigned, unsigned> *idxMap) = 0;
54 
55  /// \brief set a mapping between dbf attributes and an add info layout for importing the attribute information as well (deprecated)
56  /** This is optional import definition must be set before the first element (and file header) is read. If nothing is set no
57  dbf attributes will be imported.
58  \param[in] layout layout that should be attached to each geometry object
59  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
60  \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)
61  */
62  virtual void setAttributeMapping(AddInfoLayoutHandle layout, unsigned mapSize, std::pair<const char*, unsigned> *idxMap) = 0;
63 
64  /// \brief set a translation map between a dbf attribute and the scop semantic
65  /** This is optional import definition must be set before the first element (and file header) is read.
66  \param[in] columnIdx index of the dbf attribute to be used
67  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
68  \param[in] translationMap C array mapping string values (first value of std::pair) to the scop semantic (second value of std::pair)
69  */
70  virtual void setSemanticTranslation(unsigned columnIdx, unsigned mapSize, std::pair<const char*, int> *translationMap ) = 0;
71 
72  /// \brief set a translation map between a dbf attribute and the scop semantic
73  /** This is optional import definition must be set before the first element (and file header) is read.
74  \param[in] columnName dbf attribute name to be used
75  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
76  \param[in] translationMap C array mapping string values (first value of std::pair) to the scop semantic (second value of std::pair)
77  */
78  virtual void setSemanticTranslation(const char* columnName, unsigned mapSize, std::pair<const char*, int> *translationMap ) = 0;
79 
80 };
81 
83 
84 DM_NAMESPACE_END
ColumnSemantic
Pre-defined attributes (attributes with semantic)
Definition: ColumnTypes.hpp:38
base class for importing original geometry data file
Definition: M/c++_api/inc/DM/IO/IImport.hpp:45
Specific import class for handling shape file imports.
Definition: IImportShape.hpp:14
Definition: Handle.hpp:427
ColumnType
Supported attribute type.
Definition: ColumnTypes.hpp:8
static IImport * New(const char *file, DataFormat format, FilterHandle filter=FilterHandle(), ControlObjectHandle control=ControlObjectHandle(), bool collectHdrContents=false, unsigned maxBulkPoints=1000, AddInfoLayoutHandle defaultLayout=AddInfoLayoutHandle())
creates new import object