PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1/*
 2* Copyright 2008 Google Inc. 
 3* Licensed under the Apache License, Version 2.0:
 4*  http://www.apache.org/licenses/LICENSE-2.0
 5*/
 6package com.google.maps.extras.xmlparsers.kml
 7{
 8    import com.google.maps.extras.xmlparsers.Namespaces;
 9	import com.google.maps.extras.xmlparsers.ParsingTools;
10	import com.google.maps.extras.xmlparsers.XmlElement;
11
12	/**
13	*	Class that represents a <Placemark> element.
14	* 
15	* 	@see http://code.google.com/apis/kml/documentation/kmlreference.html#placemark
16	*/
17	public class Placemark extends Feature
18	{
19		private var _geometry:Geometry;
20		private var _extended_data:ExtendedData;
21		
22		/**
23		*	Constructor for class.
24		* 
25		*	@param x
26		*/	
27		public function Placemark(x:XMLList)
28		{
29			super(x);
30			
31			// Features are: <Point>, <LineString>, <LinearRing>, <Polygon>, <MultiGeometry>, <Model>
32			// We'll only support <Point>, <LineString>, <LinearRing>, <Polygon>, <MultiGeometry>
33			if (ParsingTools.nullCheck(this.x.kml::Point)) {
34				this._geometry = new KmlPoint(this.x.kml::Point);
35			}
36			if (ParsingTools.nullCheck(this.x.kml::LineString)) {
37				this._geometry = new LineString(this.x.kml::LineString);
38			}
39			if (ParsingTools.nullCheck(this.x.kml::LinearRing)) {
40				this._geometry = new LinearRing(this.x.kml::LinearRing);
41			}
42			if (ParsingTools.nullCheck(this.x.kml::Polygon)) {
43				this._geometry = new KmlPolygon(this.x.kml::Polygon);
44			}
45			if (ParsingTools.nullCheck(this.x.kml::MultiGeometry)) {
46        this._geometry = new MultiGeometry(this.x.kml::MultiGeometry);
47      }
48			if (ParsingTools.nullCheck(this.x.kml::ExtendedData)) {
49        this._extended_data = new ExtendedData(this.x.kml::ExtendedData);
50      }   
51		}
52		
53		/**
54		*	Represents the child geometry element (there can be only one).
55		*/
56		public function get geometry():Geometry {
57			return this._geometry;
58		}
59		
60		public function get extendedData():ExtendedData {
61			return this._extended_data;
62		}
63		
64		public override function toString():String {
65			return "Placemark: " + " geometry: " + this._geometry;
66		}
67	}
68}