use of org.geotoolkit.data.kml.model.ImagePyramid in project geotoolkit by Geomatys.
the class KmlReader method readPhotoOverlay.
private Feature readPhotoOverlay() 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<>();
// PhotoOverlay
double rotation = DEF_ROTATION;
ViewVolume viewVolume = null;
ImagePyramid imagePyramid = null;
Point point = null;
Shape shape = null;
List<SimpleTypeContainer> photoOverlaySimpleExtensions = new ArrayList<>();
List<Object> photoOverlayObjectExtensions = 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_ROTATION:
rotation = parseDouble(reader.getElementText());
break;
case TAG_VIEW_VOLUME:
viewVolume = readViewVolume();
break;
case TAG_IMAGE_PYRAMID:
imagePyramid = readImagePyramid();
break;
case TAG_POINT:
point = readPoint();
break;
case TAG_SHAPE:
shape = Shape.transform(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_PHOTO_OVERLAY, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_PHOTO_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.PHOTO_OVERLAY.equals(extensionLevel)) {
photoOverlayObjectExtensions.add(ext);
}
} else if ((r = getSimpleExtensionReader(TAG_PHOTO_OVERLAY, eUri, eName)) != null) {
Entry<Object, Extensions.Names> result = r.readExtensionElement(URI_KML, TAG_PHOTO_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.PHOTO_OVERLAY.equals(extensionLevel)) {
photoOverlaySimpleExtensions.add((SimpleTypeContainer) ext);
}
}
}
break;
}
case XMLStreamConstants.END_ELEMENT:
{
if (TAG_PHOTO_OVERLAY.equals(reader.getLocalName()) && containsNamespace(reader.getNamespaceURI())) {
break boucle;
}
break;
}
}
}
return KmlReader.KML_FACTORY.createPhotoOverlay(objectSimpleExtensions, idAttributes, name, visibility, open, author, link, address, addressDetails, phoneNumber, snippet, description, view, timePrimitive, styleUrl, styleSelector, region, extendedData, abstractOverlaySimpleExtensions, abstractOverlayObjectExtensions, color, drawOrder, icon, abstractOverlaySimpleExtensions, abstractOverlayObjectExtensions, rotation, viewVolume, imagePyramid, point, shape, photoOverlaySimpleExtensions, photoOverlayObjectExtensions);
}
Aggregations