/src/com/google/maps/extras/xmlparsers/kml/MultiGeometry.as
ActionScript | 63 lines | 38 code | 5 blank | 20 comment | 5 complexity | 9d2c1eb67ca9312ee1e5bdba2e73118f 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 * A container for zero or more geometry primitives associated with the same feature. 14 * 15 * @see http://code.google.com/apis/kml/documentation/kmlreference.html#multigeometry 16 */ 17 public class MultiGeometry extends Geometry 18 { 19 private var _geometries:Array; 20 21 /** 22 * Constructor for class. 23 * 24 * @param x 25 */ 26 public function MultiGeometry(x:XMLList) 27 { 28 super(x); 29 30 this._geometries = new Array(); 31 // Geometries are: Point, LineString, LinearRing, Polygon, MultiGeometry, Model 32 // We won't support Model 33 var i:XML; 34 for each (i in this.x.kml::KmlPoint) { 35 this._geometries.push(new KmlPoint(XMLList(i))); 36 } 37 for each (i in this.x.kml::LineString) { 38 this._geometries.push(new LineString(XMLList(i))); 39 } 40 for each (i in this.x.kml::LinearRing) { 41 this._geometries.push(new LinearRing(XMLList(i))); 42 } 43 for each (i in this.x.kml::Polygon) { 44 this._geometries.push(new KmlPolygon(XMLList(i))); 45 } 46 for each (i in this.x.kml::MultiGeometry) { 47 this._geometries.push(new MultiGeometry(XMLList(i))); 48 } 49 } 50 51 /** 52 * An array of child features of this container. 53 */ 54 public function get geometries():Array 55 { 56 return this._geometries; 57 } 58 59 public override function toString():String { 60 return "MultiGeometry: " + super.toString(); 61 } 62 } 63}