IExportShape.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/IAddInfoLayout.hpp"
9 #include "DM/IO/IExport.hpp"
10 #include "DM/IO/IShapeTableDefinition.hpp"
11 
12 DM_NAMESPACE_BEGIN
13 
14 enum struct ShapeGeometry
15 {
16  none = 0,
17 
18  point2d = 1,
19  polyline2d = 3,
20  polygon2d = 5,
21  pointSet2d = 8,
22 
23  point = 11,
24  polyline = 13,
25  polygon = 15,
26  pointSet = 18
27 
28  //SHPT_POINTM 21
29  //SHPT_ARCM 23
30  //SHPT_POLYGONM 25
31  //SHPT_MULTIPOINTM 28
32  //SHPT_MULTIPATCH 31
33 };
34 
35 /// Specific import class for handling shape file imports
36 class DM_API IExportShape : public virtual IExport
37 {
38 public:
39  static IExportShape* New( const char *file, FilterHandle filter = FilterHandle(), ControlObjectHandle control = ControlObjectHandle(),
40  const AddInfoLayoutHandle &layout = AddInfoLayoutHandle(),
42  int idCountIdx = -1,
43  int semanticColIdx = -1,
44  unsigned mapSize = 0, std::pair<int, const char*> *translationMap = 0);
45 
46 protected:
47  virtual ~IExportShape() {}
48 
49 public:
50  /// \brief set shape geometry type (optional)
51  /** The shape format only one geometry type. Setting the corresponding type is not necessary, since it is automatically determined
52  based on the first geometry that is exported. Please note that point data are usually exported as pointsets using a default chunk
53  size of 1000 points. To force each point written as a separate object, set type ShapeGeometry::point (or ShapeGeometry::point2d).
54  This allows exporting attributes (within the dbf file) for each point.
55  NOTE: this function must be called before the first object is exported
56  */
57  virtual void setShapeGeometryType(ShapeGeometry type) = 0;
58 
59  /// \brief setting this flag prevents the export of throwing an exception if geometries that do not match the shape geometry type are tried to export
60  virtual void setSkipUnmatchTypesFlag(bool skipUnmatchTypes) = 0;
61 
62  /// \brief set a mapping between dbf attributes and an add info layout for importing the attribute information as well
63  /** This is optional import definition must be set before the first element (and file header) is read. If nothing is set no
64  dbf attributes will be imported.
65  \param[in] layout layout that should be attached to each geometry object
66  \param[in] dbfTable size of the idxMap, which has to be a corresponding C array
67  \param[in] idCounterIdx output a counter id at the given column index
68  */
69  virtual void setAttributeMapping(AddInfoLayoutHandle layout, ShapeTableDefinitionHandle dbfTable, int idCounterIdx = -1) = 0;
70 
71  /// \brief set a translation map between the scop sematic and dbf attribute value
72  /** This is optional import definition must be set before the first element (and file header) is read.
73  \param[in] columnIdx index of the dbf attribute to be used
74  \param[in] mapSize size of the idxMap, which has to be a corresponding C array
75  \param[in] translationMap C array mapping string values (first value of std::pair) to the scop semantic (second value of std::pair)
76  */
77  virtual void setSemanticTranslation(unsigned columnIdx, unsigned mapSize, std::pair<int, const char*> *translationMap ) = 0;
78 
79 };
80 
82 
83 DM_NAMESPACE_END
@ polyline
polyline type
Specific import class for handling shape file imports.
Definition: IExportShape.hpp:36
Definition: Handle.hpp:427
@ point
pixel (center) represents a point, mainly used for DTM grids
base class for exporting original geometry data file
Definition: M/c++_api/inc/DM/IO/IExport.hpp:50
@ pointSet
3d point set (3D)
@ polygon
polygon type
static IExport * New(const char *file, DM::DataFormat format=DM::DataFormat::null, const FilterHandle filter=FilterHandle(), ControlObjectHandle control=ControlObjectHandle(), bool collectHdrContents=false, double invalidHeight=DBL_MAX)
creates new export object
@ none
Suppress all logging output.