/src/com/google/maps/extras/xmlparsers/kml/MultiGeometry.as

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