1
2
3
4
5
6
7 package nl.mineleni.openls.databinding.gml;
8
9 import java.util.Vector;
10
11 import nl.mineleni.openls.XmlNamespaceConstants;
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 public class Point implements XmlNamespaceConstants {
40
41
42
43
44 private static final long serialVersionUID = -163863783181316506L;
45
46
47 private final Vector<Pos> pos = new Vector<>();;
48
49
50 private String srsName;
51
52
53 private boolean hasSrsName;
54
55
56
57
58 public Point() {
59 this.hasSrsName = false;
60 }
61
62
63
64
65
66
67
68 public void addPos(final Pos p) {
69 this.pos.add(p);
70 }
71
72
73
74
75
76
77
78
79 public Pos getPosAt(final int i) {
80 return this.pos.get(i);
81 }
82
83
84
85
86
87
88 public int getPosSize() {
89 return this.pos.size();
90 }
91
92
93
94
95
96
97
98 public void setSrsName(final String srsName) {
99 this.hasSrsName = true;
100 this.srsName = srsName;
101 }
102
103
104
105
106
107
108 public String getSrsName() {
109 return this.srsName;
110 }
111
112
113
114
115
116
117 public boolean hasSrsName() {
118 return this.hasSrsName;
119 }
120
121
122
123
124
125
126 @Override
127 public String toXML() {
128 final StringBuilder sb = new StringBuilder("<"
129 + XmlNamespaceConstants.OGC_GML_NAMESPACE_PREFIX + ":Point");
130
131 if (this.hasSrsName()) {
132 sb.append(" srsName=\"").append(this.getSrsName()).append("\"");
133 }
134 sb.append(">");
135 for (final Pos p : this.pos) {
136 sb.append(p.toXML());
137 }
138 sb.append("</" + XmlNamespaceConstants.OGC_GML_NAMESPACE_PREFIX
139 + ":Point>");
140 return sb.toString();
141 }
142 }