-
Notifications
You must be signed in to change notification settings - Fork 339
Expand file tree
/
Copy pathKMLPoint.java
More file actions
94 lines (78 loc) · 2.51 KB
/
KMLPoint.java
File metadata and controls
94 lines (78 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* Copyright (C) 2012 United States Government as represented by the Administrator of the
* National Aeronautics and Space Administration.
* All Rights Reserved.
*/
package gov.nasa.worldwind.ogc.kml;
import gov.nasa.worldwind.geom.Position;
import gov.nasa.worldwind.util.Logging;
import gov.nasa.worldwind.util.xml.XMLEventParserContext;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/**
* Represents the KML <i>Point</i> element and provides access to its contents.
*
* @author tag
* @version $Id: KMLPoint.java 1171 2013-02-11 21:45:02Z dcollins $
*/
public class KMLPoint extends KMLAbstractGeometry
{
protected Position coordinates;
/**
* Construct an instance.
*
* @param namespaceURI the qualifying namespace URI. May be null to indicate no namespace qualification.
*/
public KMLPoint(String namespaceURI)
{
super(namespaceURI);
}
@Override
protected void doAddEventContent(Object o, XMLEventParserContext ctx, XMLEvent event, Object... args)
throws XMLStreamException
{
if (event.asStartElement().getName().getLocalPart().equals("coordinates"))
this.setCoordinates((Position.PositionList) o);
else
super.doAddEventContent(o, ctx, event, args);
}
public boolean isExtrude()
{
return this.getExtrude() == Boolean.TRUE;
}
public Boolean getExtrude()
{
return (Boolean) this.getField("extrude");
}
public String getAltitudeMode()
{
return (String) this.getField("altitudeMode");
}
public Position getCoordinates()
{
return this.coordinates;
}
public void setCoordinates(Position coordinates)
{
this.coordinates = coordinates;
}
protected void setCoordinates(Position.PositionList coordsList)
{
if (coordsList != null && coordsList.list.size() > 0)
this.coordinates = coordsList.list.get(0);
}
@Override
public void applyChange(KMLAbstractObject sourceValues)
{
if (!(sourceValues instanceof KMLPoint))
{
String message = Logging.getMessage("nullValue.SourceIsNull");
Logging.logger().warning(message);
throw new IllegalArgumentException(message);
}
KMLPoint point = (KMLPoint) sourceValues;
if (point.getCoordinates() != null)
this.coordinates = point.getCoordinates();
super.applyChange(sourceValues); // sends geometry-changed notification
}
}