Umasoft
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
TerrainSDK
vtdata
Fence.h
1
//
2
// Fences.h
3
//
4
// Copyright (c) 2001-2011 Virtual Terrain Project
5
// Free for all uses, see license.txt for details.
6
//
7
8
#ifndef FENCESH
9
#define FENCESH
10
11
#include <stdio.h>
12
#include "
MathTypes.h
"
13
#include "
Structure.h
"
14
15
enum
vtLinearStyle
16
{
17
FS_WOOD_POSTS_WIRE,
18
FS_METAL_POSTS_WIRE,
19
FS_METAL_POSTS_HOGWIRE,
20
FS_CHAINLINK,
21
FS_SECURITY,
22
FS_DRYSTONE,
23
FS_STONE,
24
FS_PRIVET,
25
FS_BERM,
26
FS_RAILING_ROW,
27
FS_RAILING_CABLE,
28
FS_RAILING_EU,
29
FS_TOTAL
30
};
31
32
#define FENCE_DEFAULT_HEIGHT 1.2f
33
#define FENCE_DEFAULT_SPACING 2.5f
34
35
class
vtLinearParams
36
{
37
public
:
38
void
Defaults();
39
void
Blank
();
40
void
ApplyStyle(vtLinearStyle style);
41
void
WriteXML(
GZOutput
&out)
const
;
42
43
bool
operator==(
const
vtLinearParams
&rhs)
const
;
44
45
// Posts
46
vtString
m_PostType;
// wood, steel, none
47
float
m_fPostHeight;
48
float
m_fPostSpacing;
49
float
m_fPostWidth;
50
float
m_fPostDepth;
51
vtString
m_PostExtension;
// left, right, double, none
52
53
// Connect
54
int
m_iConnectType;
// 0=none, 1=wire, 2=simple, 3=profile
55
vtString
m_ConnectMaterial;
// chain-link, privet, drystone, etc.
56
float
m_fConnectTop;
57
float
m_fConnectBottom;
58
float
m_fConnectWidth;
59
short
m_iConnectSlope;
// slope on the sides of the connector
60
bool
m_bConstantTop;
// top of connector is constant height
61
vtString
m_ConnectProfile;
// filename of profile
62
};
63
69
class
vtFence
:
public
vtStructure
70
{
71
public
:
72
vtFence
();
73
74
// copy operator
75
vtFence
&operator=(
const
vtFence
&v);
76
77
// geometry methods
78
void
AddPoint(
const
DPoint2
&epos);
79
DLine2
&GetFencePoints() {
return
m_pFencePts; }
80
void
GetClosestPoint
(
const
DPoint2
&point,
DPoint2
&closest);
81
double
GetDistanceToLine
(
const
DPoint2
&point);
82
int
GetNearestPointIndex(
const
DPoint2
&point,
double
&fDist);
83
bool
IsContainedBy(
const
DRECT
&rect)
const
;
84
bool
GetExtents(
DRECT
&rect)
const
;
85
86
// IO
87
void
WriteXML(
GZOutput
&out,
bool
bDegrees)
const
;
88
89
// style
90
void
ApplyStyle(vtLinearStyle style);
91
vtLinearParams
&GetParams() {
return
m_Params; }
92
virtual
void
SetParams(
const
vtLinearParams
¶ms) { m_Params = params; }
93
virtual
void
ProfileChanged() {}
94
95
protected
:
96
DLine2
m_pFencePts;
// in earth coordinates
97
98
vtLinearParams
m_Params;
99
};
100
101
// Helpers
102
bool
LoadFLine2FromSHP(
const
char
*fname,
FLine2
&prof);
103
bool
SaveFLine2ToSHP(
const
char
*fname,
const
FLine2
&prof);
104
105
#endif // FENCESH
106
Generated on Fri Jun 7 2013 16:07:51 for Umasoft by
1.8.4