ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ShpFilter.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #ifdef CV_SHP_SUPPORT
11 
12 // qCC_io
13 #include <FileIOFilter.h>
14 
15 // Qt
16 #include <QString>
17 
18 // system
19 #include <vector>
20 
21 class GenericDBFField;
22 
24 
26 class CV_IO_LIB_API ShpFilter : public FileIOFilter {
27 public:
28  ShpFilter();
29 
30  // inherited from FileIOFilter
31  virtual CC_FILE_ERROR loadFile(const QString& filename,
32  ccHObject& container,
33  LoadParameters& parameters) override;
34 
35  virtual bool canSave(CV_CLASS_ENUM type,
36  bool& multiple,
37  bool& exclusive) const override;
38  virtual CC_FILE_ERROR saveToFile(ccHObject* entity,
39  const QString& filename,
40  const SaveParameters& parameters) override;
41 
43  virtual CC_FILE_ERROR saveToFile(
44  ccHObject* entity,
45  const std::vector<GenericDBFField*>& fields,
46  const QString& filename,
47  const SaveParameters& parameters);
48 
50  void treatClosedPolylinesAsPolygons(bool state) {
51  m_closedPolylinesAsPolygons = state;
52  }
54  bool areClosedPolylinesAsPolygons() const {
55  return m_closedPolylinesAsPolygons;
56  }
57 
59  void save3DPolyAs2D(bool state) { m_save3DPolyAs2D = state; }
60 
62  void save3DPolyHeightInDBF(bool state) { m_save3DPolyHeightInDBF = state; }
63 
64 protected:
66  bool m_closedPolylinesAsPolygons = true;
67 
70  bool m_save3DPolyAs2D = false;
71 
73  bool m_save3DPolyHeightInDBF = false;
74 };
75 
76 #endif // CV_SHP_SUPPORT
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
std::string filename
#define CV_IO_LIB_API
Definition: CV_io.h:15
std::vector< PCLPointField > fields
char type
CC_FILE_ERROR
Typical I/O filter errors.
Definition: FileIOFilter.h:20
Generic file I/O filter.
Definition: FileIOFilter.h:46
virtual bool canSave(CV_CLASS_ENUM type, bool &multiple, bool &exclusive) const
Returns whether this I/O filter can save the specified type of entity.
Definition: FileIOFilter.h:158
virtual CC_FILE_ERROR loadFile(const QString &filename, ccHObject &container, LoadParameters &parameters)
Loads one or more entities from a file.
Definition: FileIOFilter.h:124
virtual CC_FILE_ERROR saveToFile(ccHObject *entity, const QString &filename, const SaveParameters &parameters)
Saves an entity (or a group of) to a file.
Definition: FileIOFilter.h:141
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25