/src/com/google/maps/extras/xmlparsers/kml/Placemark.as
http://gmaps-utility-library-flash.googlecode.com/ · ActionScript · 68 lines · 42 code · 6 blank · 20 comment · 6 complexity · c5e7f5de94f30db1ce0dd2fe4578f56f MD5 · raw file
- /*
- * Copyright 2008 Google Inc.
- * Licensed under the Apache License, Version 2.0:
- * http://www.apache.org/licenses/LICENSE-2.0
- */
- package com.google.maps.extras.xmlparsers.kml
- {
- import com.google.maps.extras.xmlparsers.Namespaces;
- import com.google.maps.extras.xmlparsers.ParsingTools;
- import com.google.maps.extras.xmlparsers.XmlElement;
-
- /**
- * Class that represents a <Placemark> element.
- *
- * @see http://code.google.com/apis/kml/documentation/kmlreference.html#placemark
- */
- public class Placemark extends Feature
- {
- private var _geometry:Geometry;
- private var _extended_data:ExtendedData;
-
- /**
- * Constructor for class.
- *
- * @param x
- */
- public function Placemark(x:XMLList)
- {
- super(x);
-
- // Features are: <Point>, <LineString>, <LinearRing>, <Polygon>, <MultiGeometry>, <Model>
- // We'll only support <Point>, <LineString>, <LinearRing>, <Polygon>, <MultiGeometry>
- if (ParsingTools.nullCheck(this.x.kml::Point)) {
- this._geometry = new KmlPoint(this.x.kml::Point);
- }
- if (ParsingTools.nullCheck(this.x.kml::LineString)) {
- this._geometry = new LineString(this.x.kml::LineString);
- }
- if (ParsingTools.nullCheck(this.x.kml::LinearRing)) {
- this._geometry = new LinearRing(this.x.kml::LinearRing);
- }
- if (ParsingTools.nullCheck(this.x.kml::Polygon)) {
- this._geometry = new KmlPolygon(this.x.kml::Polygon);
- }
- if (ParsingTools.nullCheck(this.x.kml::MultiGeometry)) {
- this._geometry = new MultiGeometry(this.x.kml::MultiGeometry);
- }
- if (ParsingTools.nullCheck(this.x.kml::ExtendedData)) {
- this._extended_data = new ExtendedData(this.x.kml::ExtendedData);
- }
- }
-
- /**
- * Represents the child geometry element (there can be only one).
- */
- public function get geometry():Geometry {
- return this._geometry;
- }
-
- public function get extendedData():ExtendedData {
- return this._extended_data;
- }
-
- public override function toString():String {
- return "Placemark: " + " geometry: " + this._geometry;
- }
- }
- }