ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
ShpDBFFields.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
// local
13
#include "
CV_io.h
"
14
15
// cloudViewer
16
#include <
CVGeom.h
>
17
18
// Qt
19
#include <QString>
20
21
// system
22
#include <vector>
23
24
// Shapelib
25
#include <shapefil.h>
26
28
30
class
GenericDBFField {
31
public
:
33
GenericDBFField(QString
name
) : m_name(
name
) {}
34
36
const
QString&
name
()
const
{
return
m_name; }
37
39
virtual
bool
is3D()
const
{
return
false
; }
40
41
// to be reimplemented by siblings
42
virtual
DBFFieldType
type
()
const
= 0;
43
virtual
int
width
()
const
= 0;
44
virtual
int
decimal()
const
= 0;
45
virtual
bool
save(DBFHandle handle,
int
fieldIndex)
const
{
46
return
false
;
47
}
// 1D version
48
virtual
bool
save(DBFHandle handle,
49
int
xFieldIndex,
50
int
yFieldIndex,
51
int
zFieldIndex)
const
{
52
return
false
;
53
}
// 3D version
54
55
protected
:
57
QString m_name;
58
};
59
61
class
CV_IO_LIB_API
IntegerDBFField :
public
GenericDBFField {
62
public
:
64
IntegerDBFField(QString
name
) : GenericDBFField(
name
) {}
65
66
// inherited from GenericDBFField
67
virtual
DBFFieldType
type
()
const
{
return
FTInteger; }
68
virtual
int
width
()
const
{
return
6; }
69
virtual
int
decimal()
const
{
return
0; }
70
virtual
bool
save(DBFHandle handle,
int
fieldIndex)
const
;
71
73
std::vector<int> values;
74
};
75
77
class
CV_IO_LIB_API
DoubleDBFField :
public
GenericDBFField {
78
public
:
80
DoubleDBFField(QString
name
) : GenericDBFField(
name
) {}
81
82
// inherited from GenericDBFField
83
virtual
DBFFieldType
type
()
const
{
return
FTDouble; }
84
virtual
int
width
()
const
{
return
8; }
85
virtual
int
decimal()
const
{
return
8; }
86
virtual
bool
save(DBFHandle handle,
int
fieldIndex)
const
;
87
89
std::vector<double> values;
90
};
91
93
class
CV_IO_LIB_API
DoubleDBFField3D :
public
GenericDBFField {
94
public
:
96
DoubleDBFField3D(QString
name
) : GenericDBFField(
name
) {}
97
virtual
~DoubleDBFField3D() {}
98
99
// inherited from GenericDBFField
100
virtual
bool
is3D()
const
{
return
true
; }
101
virtual
DBFFieldType
type
()
const
{
return
FTDouble; }
102
virtual
int
width
()
const
{
return
8; }
103
virtual
int
decimal()
const
{
return
8; }
104
virtual
bool
save(DBFHandle handle,
105
int
xFieldIndex,
106
int
yFieldIndex,
107
int
zFieldIndex)
const
;
108
110
std::vector<CCVector3d> values;
111
};
112
113
#endif
// CV_SHP_SUPPORT
CVGeom.h
CV_io.h
CV_IO_LIB_API
#define CV_IO_LIB_API
Definition:
CV_io.h:15
width
int width
Definition:
FileIOFactory.cpp:142
name
std::string name
Definition:
FileIOFactory.cpp:129
type
char type
Definition:
FileIOFactory.cpp:131
libs
CV_io
include
ShpDBFFields.h
Generated on Wed Jan 28 2026 09:00:58 for ACloudViewer by
1.9.1