use of org.geotoolkit.data.kml.model.AbstractView in project geotoolkit by Geomatys.
the class KmlReader method readFolder.
private Feature readFolder() throws XMLStreamException, KmlException, URISyntaxException {
// AbstractObject
List<SimpleTypeContainer> objectSimpleExtensions = new ArrayList<>();
IdAttributes idAttributes = readIdAttributes();
// AbstractFeature
String name = null;
boolean visibility = DEF_VISIBILITY;
boolean open = DEF_OPEN;
AtomPersonConstruct author = null;
AtomLink link = null;
String address = null;
AddressDetails addressDetails = null;
String phoneNumber = null;
Object snippet = null;
Object description = null;
AbstractView view = null;
AbstractTimePrimitive timePrimitive = null;
URI styleUrl = null;
List<AbstractStyleSelector> styleSelector = new ArrayList<>();
Region region = null;
Object extendedData = null;
List<SimpleTypeContainer> featureSimpleExtensions = new ArrayList<>();
List<Object> featureObjectExtensions = new ArrayList<>();
// Container
List<SimpleTypeContainer> abstractContainerSimpleExtensions = new ArrayList<>();
List<Object> abstractContainerObjectExtensions = new ArrayList<>();
// Folder
List<Feature> features = new ArrayList<>();
List<SimpleTypeContainer> folderSimpleExtensions = new ArrayList<>();
List<Object> folderObjectExtensions = new ArrayList<>();
boucle: while (reader.hasNext()) {
switch(reader.next()) {
case XMLStreamConstants.START_ELEMENT:
{
final String eName = reader.getLocalName();
final String eUri = reader.getNamespaceURI();
if (equalsNamespace(eUri)) {
switch(eName) {
case TAG_NAME:
name = reader.getElementText();
break;
case TAG_VISIBILITY:
visibility = parseBoolean(reader.getElementText());
break;
case TAG_OPEN:
open = parseBoolean(reader.getElementText());
break;
case TAG_ADDRESS:
address = reader.getElementText();
break;
case TAG_PHONE_NUMBER:
phoneNumber = reader.getElementText();
break;
case TAG_SNIPPET:
snippet = readElementText();
break;
case TAG_SNIPPET_BIG:
snippet = readSnippet();
break;
case TAG_DESCRIPTION:
description = readElementText();
break;
case TAG_STYLE_URL:
styleUrl = new URI(reader.getElementText());
break;
case TAG_REGION:
region = readRegion();
break;
case TAG_EXTENDED_DATA:
extendedData = readExtendedData();
break;
case TAG_META_DATA:
extendedData = readMetaData();
break;
default:
{
if (isAbstractFeature(eName)) {
features.add(readAbstractFeature(eName));
} else if (isAbstractStyleSelector(eName)) {
styleSelector.add(readAbstractStyleSelector(eName));
} else if (isAbstractView(eName)) {
view = readAbstractView(eName);
} else if (isAbstractTimePrimitive(eName)) {
timePrimitive = readAbstractTimePrimitive(eName);
}
break;
}
}
} else // ATOM
if (URI_ATOM.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_ATOM_AUTHOR.equals(eName)) {
author = readAtomPersonConstruct();
} else if (TAG_ATOM_LINK.equals(eName)) {
link = readAtomLink();
}
} else // XAL
if (URI_XAL.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_XAL_ADDRESS_DETAILS.equals(eName)) {
addressDetails = readXalAddressDetails();
}
} else // EXTENSIONS
{
KmlExtensionReader r;
if ((r = this.getComplexExtensionReader(TAG_FOLDER, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_FOLDER, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureObjectExtensions.add(ext);
} else if (Extensions.Names.CONTAINER.equals(extensionLevel)) {
abstractContainerObjectExtensions.add(ext);
} else if (Extensions.Names.FOLDER.equals(extensionLevel)) {
folderObjectExtensions.add(ext);
} else if (extensionLevel == null) {
if (ext instanceof Feature) {
features.add((Feature) ext);
}
}
} else if ((r = getSimpleExtensionReader(TAG_FOLDER, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_FOLDER, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.OBJECT.equals(extensionLevel)) {
objectSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.CONTAINER.equals(extensionLevel)) {
abstractContainerSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.FOLDER.equals(extensionLevel)) {
folderSimpleExtensions.add((SimpleTypeContainer) ext);
}
}
}
break;
}
case XMLStreamConstants.END_ELEMENT:
{
if (TAG_FOLDER.equals(reader.getLocalName()) && containsNamespace(reader.getNamespaceURI())) {
break boucle;
}
break;
}
}
}
return KmlReader.KML_FACTORY.createFolder(objectSimpleExtensions, idAttributes, name, visibility, open, author, link, address, addressDetails, phoneNumber, snippet, description, view, timePrimitive, styleUrl, styleSelector, region, extendedData, featureSimpleExtensions, featureObjectExtensions, abstractContainerSimpleExtensions, abstractContainerObjectExtensions, features, folderSimpleExtensions, folderObjectExtensions);
}
use of org.geotoolkit.data.kml.model.AbstractView in project geotoolkit by Geomatys.
the class KmlReader method readPlacemark.
private Feature readPlacemark() throws XMLStreamException, KmlException, URISyntaxException {
// AbstractObject
List<SimpleTypeContainer> objectSimpleExtensions = new ArrayList<SimpleTypeContainer>();
IdAttributes idAttributes = readIdAttributes();
// AbstractFeature
String name = null;
boolean visibility = DEF_VISIBILITY;
boolean open = DEF_OPEN;
AtomPersonConstruct author = null;
AtomLink link = null;
String address = null;
AddressDetails addressDetails = null;
String phoneNumber = null;
Object snippet = null;
Object description = null;
AbstractView view = null;
AbstractTimePrimitive timePrimitive = null;
URI styleUrl = null;
List<AbstractStyleSelector> styleSelector = new ArrayList<AbstractStyleSelector>();
Region region = null;
Object extendedData = null;
List<SimpleTypeContainer> featureSimpleExtensions = new ArrayList<SimpleTypeContainer>();
List<Object> featureObjectExtensions = new ArrayList<Object>();
// Placemark
AbstractGeometry abstractGeometry = null;
List<SimpleTypeContainer> placemarkSimpleExtensions = new ArrayList<SimpleTypeContainer>();
List<Object> placemarkObjectExtensions = new ArrayList<Object>();
boucle: while (reader.hasNext()) {
switch(reader.next()) {
case XMLStreamConstants.START_ELEMENT:
final String eName = reader.getLocalName();
final String eUri = reader.getNamespaceURI();
// KML
if (equalsNamespace(eUri)) {
switch(eName) {
case TAG_NAME:
name = reader.getElementText();
break;
case TAG_VISIBILITY:
visibility = parseBoolean(reader.getElementText());
break;
case TAG_OPEN:
open = parseBoolean(reader.getElementText());
break;
case TAG_ADDRESS:
address = reader.getElementText();
break;
case TAG_PHONE_NUMBER:
phoneNumber = reader.getElementText();
break;
case TAG_SNIPPET:
snippet = readElementText();
break;
case TAG_SNIPPET_BIG:
snippet = readSnippet();
break;
case TAG_DESCRIPTION:
description = readElementText();
break;
case TAG_STYLE_URL:
styleUrl = new URI(reader.getElementText());
break;
case TAG_REGION:
region = readRegion();
break;
case TAG_EXTENDED_DATA:
extendedData = readExtendedData();
break;
case TAG_META_DATA:
extendedData = readMetaData();
break;
default:
{
if (isAbstractView(eName)) {
view = readAbstractView(eName);
} else if (isAbstractStyleSelector(eName)) {
styleSelector.add(readAbstractStyleSelector(eName));
} else if (isAbstractTimePrimitive(eName)) {
timePrimitive = readAbstractTimePrimitive(eName);
} else if (isAbstractGeometry(eName)) {
abstractGeometry = readAbstractGeometry(eName);
}
break;
}
}
} else // ATOM
if (URI_ATOM.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_ATOM_AUTHOR.equals(eName)) {
author = readAtomPersonConstruct();
} else if (TAG_ATOM_LINK.equals(eName)) {
link = readAtomLink();
}
} else // XAL
if (URI_XAL.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_XAL_ADDRESS_DETAILS.equals(eName)) {
addressDetails = readXalAddressDetails();
}
} else // EXTENSIONS
{
KmlExtensionReader r;
if ((r = this.getComplexExtensionReader(TAG_PLACEMARK, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_PLACEMARK, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureObjectExtensions.add(ext);
} else if (Extensions.Names.PLACEMARK.equals(extensionLevel)) {
placemarkObjectExtensions.add(ext);
} else if (extensionLevel == null) {
if (ext instanceof AbstractGeometry) {
abstractGeometry = (AbstractGeometry) ext;
}
}
} else if ((r = getSimpleExtensionReader(TAG_PLACEMARK, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_PLACEMARK, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.OBJECT.equals(extensionLevel)) {
objectSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.PLACEMARK.equals(extensionLevel)) {
placemarkSimpleExtensions.add((SimpleTypeContainer) ext);
}
}
}
break;
case XMLStreamConstants.END_ELEMENT:
if (TAG_PLACEMARK.equals(reader.getLocalName()) && containsNamespace(reader.getNamespaceURI())) {
break boucle;
}
break;
}
}
return KmlReader.KML_FACTORY.createPlacemark(objectSimpleExtensions, idAttributes, name, visibility, open, author, link, address, addressDetails, phoneNumber, snippet, description, view, timePrimitive, styleUrl, styleSelector, region, extendedData, featureSimpleExtensions, featureObjectExtensions, abstractGeometry, placemarkSimpleExtensions, placemarkObjectExtensions);
}
use of org.geotoolkit.data.kml.model.AbstractView in project geotoolkit by Geomatys.
the class KmlReader method readNetworkLink.
private Feature readNetworkLink() throws XMLStreamException, KmlException, URISyntaxException {
// AbstractObject
List<SimpleTypeContainer> objectSimpleExtensions = new ArrayList<>();
IdAttributes idAttributes = readIdAttributes();
// AbstractFeature
String name = null;
boolean visibility = DEF_VISIBILITY;
boolean open = DEF_OPEN;
AtomPersonConstruct author = null;
AtomLink atomLink = null;
String address = null;
AddressDetails addressDetails = null;
String phoneNumber = null;
Object snippet = null;
Object description = null;
AbstractView view = null;
AbstractTimePrimitive timePrimitive = null;
URI styleUrl = null;
List<AbstractStyleSelector> styleSelector = new ArrayList<>();
Region region = null;
Object extendedData = null;
List<SimpleTypeContainer> featureSimpleExtensions = new ArrayList<>();
List<Object> featureObjectExtensions = new ArrayList<>();
// NetworkLink
boolean refreshVisibility = DEF_REFRESH_VISIBILITY;
boolean flyToView = DEF_FLY_TO_VIEW;
Link link = null;
List<SimpleTypeContainer> networkLinkSimpleExtensions = new ArrayList<>();
List<Object> networkLinkObjectExtensions = new ArrayList<>();
boucle: while (reader.hasNext()) {
switch(reader.next()) {
case XMLStreamConstants.START_ELEMENT:
{
final String eName = reader.getLocalName();
final String eUri = reader.getNamespaceURI();
if (equalsNamespace(eUri)) {
switch(eName) {
case TAG_NAME:
name = reader.getElementText();
break;
case TAG_VISIBILITY:
visibility = parseBoolean(reader.getElementText());
break;
case TAG_OPEN:
open = parseBoolean(reader.getElementText());
break;
case TAG_ADDRESS:
address = reader.getElementText();
break;
case TAG_PHONE_NUMBER:
phoneNumber = reader.getElementText();
break;
case TAG_SNIPPET:
snippet = readElementText();
break;
case TAG_SNIPPET_BIG:
snippet = readSnippet();
break;
case TAG_DESCRIPTION:
description = readElementText();
break;
case TAG_STYLE_URL:
styleUrl = new URI(reader.getElementText());
break;
case TAG_REGION:
region = readRegion();
break;
case TAG_EXTENDED_DATA:
extendedData = readExtendedData();
break;
case TAG_META_DATA:
extendedData = readMetaData();
break;
case TAG_REFRESH_VISIBILITY:
refreshVisibility = parseBoolean(reader.getElementText());
break;
case TAG_FLY_TO_VIEW:
flyToView = parseBoolean(reader.getElementText());
break;
case TAG_LINK:
link = readLink(eName);
break;
case TAG_URL:
link = readUrl(eName);
break;
default:
{
if (isAbstractView(eName)) {
view = readAbstractView(eName);
} else if (isAbstractStyleSelector(eName)) {
styleSelector.add(readAbstractStyleSelector(eName));
} else if (isAbstractTimePrimitive(eName)) {
timePrimitive = readAbstractTimePrimitive(eName);
}
break;
}
}
} else // ATOM
if (URI_ATOM.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_ATOM_AUTHOR.equals(eName)) {
author = readAtomPersonConstruct();
} else if (TAG_ATOM_LINK.equals(eName)) {
atomLink = readAtomLink();
}
} else // XAL
if (URI_XAL.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_XAL_ADDRESS_DETAILS.equals(eName)) {
addressDetails = readXalAddressDetails();
}
} else // EXTENSIONS
{
KmlExtensionReader r;
if ((r = this.getComplexExtensionReader(TAG_NETWORK_LINK, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_NETWORK_LINK, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureObjectExtensions.add(ext);
} else if (Extensions.Names.NETWORK_LINK.equals(extensionLevel)) {
networkLinkObjectExtensions.add(ext);
}
} else if ((r = getSimpleExtensionReader(TAG_NETWORK_LINK, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_NETWORK_LINK, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.OBJECT.equals(extensionLevel)) {
objectSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.NETWORK_LINK.equals(extensionLevel)) {
networkLinkSimpleExtensions.add((SimpleTypeContainer) ext);
}
}
}
break;
}
case XMLStreamConstants.END_ELEMENT:
{
if (TAG_NETWORK_LINK.equals(reader.getLocalName()) && containsNamespace(reader.getNamespaceURI())) {
break boucle;
}
break;
}
}
}
return KmlReader.KML_FACTORY.createNetworkLink(objectSimpleExtensions, idAttributes, name, visibility, open, author, atomLink, address, addressDetails, phoneNumber, snippet, description, view, timePrimitive, styleUrl, styleSelector, region, extendedData, featureSimpleExtensions, featureObjectExtensions, refreshVisibility, flyToView, link, networkLinkSimpleExtensions, networkLinkObjectExtensions);
}
use of org.geotoolkit.data.kml.model.AbstractView in project geotoolkit by Geomatys.
the class KmlReader method readGroundOverlay.
private Feature readGroundOverlay() throws XMLStreamException, KmlException, URISyntaxException {
// AbstractObject
List<SimpleTypeContainer> objectSimpleExtensions = new ArrayList<>();
IdAttributes idAttributes = readIdAttributes();
// AbstractFeature
String name = null;
boolean visibility = DEF_VISIBILITY;
boolean open = DEF_OPEN;
AtomPersonConstruct author = null;
AtomLink link = null;
String address = null;
AddressDetails addressDetails = null;
String phoneNumber = null;
Object snippet = null;
Object description = null;
AbstractView view = null;
AbstractTimePrimitive timePrimitive = null;
URI styleUrl = null;
List<AbstractStyleSelector> styleSelector = new ArrayList<>();
Region region = null;
Object extendedData = null;
List<SimpleTypeContainer> featureSimpleExtensions = new ArrayList<>();
List<Object> featureObjectExtensions = new ArrayList<>();
// AbstractOverlay
Color color = DEF_COLOR;
int drawOrder = DEF_DRAW_ORDER;
Icon icon = null;
List<SimpleTypeContainer> abstractOverlaySimpleExtensions = new ArrayList<>();
List<Object> abstractOverlayObjectExtensions = new ArrayList<>();
// GroundOverlay
double altitude = DEF_ALTITUDE;
AltitudeMode altitudeMode = DEF_ALTITUDE_MODE;
LatLonBox latLonBox = null;
List<SimpleTypeContainer> groundOverlaySimpleExtensions = new ArrayList<>();
List<Object> groundOverlayObjectExtensions = new ArrayList<>();
boucle: while (reader.hasNext()) {
switch(reader.next()) {
case XMLStreamConstants.START_ELEMENT:
{
final String eName = reader.getLocalName();
final String eUri = reader.getNamespaceURI();
// KML
if (equalsNamespace(eUri)) {
switch(eName) {
case TAG_NAME:
name = reader.getElementText();
break;
case TAG_VISIBILITY:
visibility = parseBoolean(reader.getElementText());
break;
case TAG_OPEN:
open = parseBoolean(reader.getElementText());
break;
case TAG_ADDRESS:
address = reader.getElementText();
break;
case TAG_PHONE_NUMBER:
phoneNumber = reader.getElementText();
break;
case TAG_SNIPPET:
snippet = readElementText();
break;
case TAG_SNIPPET_BIG:
snippet = readSnippet();
break;
case TAG_DESCRIPTION:
description = readElementText();
break;
case TAG_STYLE_URL:
styleUrl = new URI(reader.getElementText());
break;
case TAG_REGION:
region = readRegion();
break;
case TAG_EXTENDED_DATA:
extendedData = readExtendedData();
break;
case TAG_META_DATA:
extendedData = readMetaData();
break;
case TAG_COLOR:
color = KmlUtilities.parseColor(reader.getElementText());
break;
case TAG_DRAW_ORDER:
drawOrder = Integer.parseInt(reader.getElementText());
break;
case TAG_ICON:
icon = readIcon(eName);
break;
case TAG_ALTITUDE:
altitude = parseDouble(reader.getElementText());
break;
case TAG_ALTITUDE_MODE:
altitudeMode = readAltitudeMode();
break;
case TAG_LAT_LON_BOX:
latLonBox = readLatLonBox();
break;
default:
{
if (isAbstractView(eName)) {
view = readAbstractView(eName);
} else if (isAbstractTimePrimitive(eName)) {
timePrimitive = readAbstractTimePrimitive(eName);
} else if (isAbstractStyleSelector(eName)) {
styleSelector.add(readAbstractStyleSelector(eName));
}
break;
}
}
} else if (URI_ATOM.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_ATOM_AUTHOR.equals(eName)) {
author = readAtomPersonConstruct();
} else if (TAG_ATOM_LINK.equals(eName)) {
link = readAtomLink();
}
} else if (URI_XAL.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_XAL_ADDRESS_DETAILS.equals(eName)) {
addressDetails = readXalAddressDetails();
}
} else // EXTENSIONS
{
KmlExtensionReader r;
if ((r = this.getComplexExtensionReader(TAG_GROUND_OVERLAY, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_GROUND_OVERLAY, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureObjectExtensions.add(ext);
} else if (Extensions.Names.OVERLAY.equals(extensionLevel)) {
abstractOverlayObjectExtensions.add(ext);
} else if (Extensions.Names.GROUND_OVERLAY.equals(extensionLevel)) {
groundOverlayObjectExtensions.add(ext);
} else if (extensionLevel == null) {
if (ext instanceof AltitudeMode) {
altitudeMode = (AltitudeMode) ext;
}
}
} else if ((r = getSimpleExtensionReader(TAG_GROUND_OVERLAY, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_GROUND_OVERLAY, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.OBJECT.equals(extensionLevel)) {
objectSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.OVERLAY.equals(extensionLevel)) {
abstractOverlaySimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.GROUND_OVERLAY.equals(extensionLevel)) {
groundOverlaySimpleExtensions.add((SimpleTypeContainer) ext);
}
}
}
break;
}
case XMLStreamConstants.END_ELEMENT:
{
if (TAG_GROUND_OVERLAY.equals(reader.getLocalName()) && containsNamespace(reader.getNamespaceURI())) {
break boucle;
}
break;
}
}
}
return KmlReader.KML_FACTORY.createGroundOverlay(objectSimpleExtensions, idAttributes, name, visibility, open, author, link, address, addressDetails, phoneNumber, snippet, description, view, timePrimitive, styleUrl, styleSelector, region, extendedData, featureSimpleExtensions, featureObjectExtensions, color, drawOrder, icon, abstractOverlaySimpleExtensions, abstractOverlayObjectExtensions, altitude, altitudeMode, latLonBox, groundOverlaySimpleExtensions, groundOverlayObjectExtensions);
}
use of org.geotoolkit.data.kml.model.AbstractView in project geotoolkit by Geomatys.
the class KmlReader method readScreenOverlay.
private Feature readScreenOverlay() throws XMLStreamException, KmlException, URISyntaxException {
// AbstractObject
List<SimpleTypeContainer> objectSimpleExtensions = new ArrayList<>();
IdAttributes idAttributes = readIdAttributes();
// AbstractFeature
String name = null;
boolean visibility = DEF_VISIBILITY;
boolean open = DEF_OPEN;
AtomPersonConstruct author = null;
AtomLink link = null;
String address = null;
AddressDetails addressDetails = null;
String phoneNumber = null;
Object snippet = null;
Object description = null;
AbstractView view = null;
AbstractTimePrimitive timePrimitive = null;
URI styleUrl = null;
List<AbstractStyleSelector> styleSelector = new ArrayList<>();
Region region = null;
Object extendedData = null;
List<SimpleTypeContainer> featureSimpleExtensions = new ArrayList<>();
List<Object> featureObjectExtensions = new ArrayList<>();
// AbstractOverlay
Color color = DEF_COLOR;
int drawOrder = DEF_DRAW_ORDER;
Icon icon = null;
List<SimpleTypeContainer> abstractOverlaySimpleExtensions = new ArrayList<>();
List<Object> abstractOverlayObjectExtensions = new ArrayList<>();
// ScreenOverlay
Vec2 overlayXY = null;
Vec2 screenXY = null;
Vec2 rotationXY = null;
Vec2 size = null;
double rotation = DEF_ROTATION;
List<SimpleTypeContainer> screenOverlaySimpleExtensions = new ArrayList<>();
List<Object> screenOverlayObjectExtensions = new ArrayList<>();
boucle: while (reader.hasNext()) {
switch(reader.next()) {
case XMLStreamConstants.START_ELEMENT:
{
final String eName = reader.getLocalName();
final String eUri = reader.getNamespaceURI();
if (equalsNamespace(eUri)) {
switch(eName) {
case TAG_NAME:
name = reader.getElementText();
break;
case TAG_VISIBILITY:
visibility = parseBoolean(reader.getElementText());
break;
case TAG_OPEN:
open = parseBoolean(reader.getElementText());
break;
case TAG_ADDRESS:
address = reader.getElementText();
break;
case TAG_PHONE_NUMBER:
phoneNumber = reader.getElementText();
break;
case TAG_SNIPPET:
snippet = readElementText();
break;
case TAG_SNIPPET_BIG:
snippet = readSnippet();
break;
case TAG_DESCRIPTION:
description = readElementText();
break;
case TAG_STYLE_URL:
styleUrl = new URI(reader.getElementText());
break;
case TAG_REGION:
region = readRegion();
break;
case TAG_EXTENDED_DATA:
extendedData = readExtendedData();
break;
case TAG_META_DATA:
extendedData = readMetaData();
break;
case TAG_COLOR:
color = KmlUtilities.parseColor(reader.getElementText());
break;
case TAG_DRAW_ORDER:
drawOrder = Integer.parseInt(reader.getElementText());
break;
case TAG_ICON:
icon = readIcon(eName);
break;
case TAG_OVERLAY_XY:
overlayXY = readVec2(eName);
break;
case TAG_SCREEN_XY:
screenXY = readVec2(eName);
break;
case TAG_ROTATION_XY:
rotationXY = readVec2(eName);
break;
case TAG_SIZE:
size = readVec2(eName);
break;
case TAG_ROTATION:
rotation = parseDouble(reader.getElementText());
break;
default:
{
if (isAbstractStyleSelector(eName)) {
styleSelector.add(readAbstractStyleSelector(eName));
} else if (isAbstractView(eName)) {
view = readAbstractView(eName);
} else if (isAbstractTimePrimitive(eName)) {
timePrimitive = readAbstractTimePrimitive(eName);
}
break;
}
}
} else // ATOM
if (URI_ATOM.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_ATOM_AUTHOR.equals(eName)) {
author = readAtomPersonConstruct();
} else if (TAG_ATOM_LINK.equals(eName)) {
link = readAtomLink();
}
} else // XAL
if (URI_XAL.equals(eUri)) {
checkVersion(URI_KML_2_2);
// ABSTRACT FEATURE
if (TAG_XAL_ADDRESS_DETAILS.equals(eName)) {
addressDetails = readXalAddressDetails();
}
} else // EXTENSIONS
{
KmlExtensionReader r;
if ((r = this.getComplexExtensionReader(TAG_SCREEN_OVERLAY, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_SCREEN_OVERLAY, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureObjectExtensions.add(ext);
} else if (Extensions.Names.OVERLAY.equals(extensionLevel)) {
abstractOverlayObjectExtensions.add(ext);
} else if (Extensions.Names.SCREEN_OVERLAY.equals(extensionLevel)) {
screenOverlayObjectExtensions.add(ext);
}
} else if ((r = getSimpleExtensionReader(TAG_SCREEN_OVERLAY, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_SCREEN_OVERLAY, eUri, eName);
Object ext = result.getKey();
Extensions.Names extensionLevel = result.getValue();
if (Extensions.Names.OBJECT.equals(extensionLevel)) {
objectSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.FEATURE.equals(extensionLevel)) {
featureSimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.OVERLAY.equals(extensionLevel)) {
abstractOverlaySimpleExtensions.add((SimpleTypeContainer) ext);
} else if (Extensions.Names.SCREEN_OVERLAY.equals(extensionLevel)) {
screenOverlaySimpleExtensions.add((SimpleTypeContainer) ext);
}
}
}
break;
}
case XMLStreamConstants.END_ELEMENT:
{
if (TAG_SCREEN_OVERLAY.equals(reader.getLocalName()) && containsNamespace(reader.getNamespaceURI())) {
break boucle;
}
break;
}
}
}
return KmlReader.KML_FACTORY.createScreenOverlay(objectSimpleExtensions, idAttributes, name, visibility, open, author, link, address, addressDetails, phoneNumber, snippet, description, view, timePrimitive, styleUrl, styleSelector, region, extendedData, featureSimpleExtensions, featureObjectExtensions, color, drawOrder, icon, abstractOverlaySimpleExtensions, abstractOverlayObjectExtensions, overlayXY, screenXY, rotationXY, size, rotation, screenOverlaySimpleExtensions, screenOverlayObjectExtensions);
}
Aggregations