PageRenderTime 27ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://gmaps-utility-library-flash.googlecode.com/
ActionScript | 60 lines | 37 code | 4 blank | 19 comment | 4 complexity | 833a392c80d26bf91a445dd352d8ecb8 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. import com.google.maps.extras.xmlparsers.XmlParser;
  12. /**
  13. * Class that represents a KML2.2 feed.
  14. *
  15. * @see http://code.google.com/apis/kml/documentation/kmlreference.html
  16. */
  17. public class Kml22 extends XmlParser
  18. {
  19. private var kml:Namespace = Namespaces.KML_NS;
  20. private var _feature:Feature;
  21. /**
  22. * Constructor for class.
  23. *
  24. * @param xmlStr An Xml string containing valid KML.
  25. */
  26. public function Kml22(xmlStr:String)
  27. {
  28. super();
  29. parse(xmlStr);
  30. kml = Namespaces.determineNamespace(this.x);
  31. // todo support other features
  32. if (ParsingTools.nullCheck(this.x.kml::Placemark)) {
  33. this._feature = new Placemark(this.x.kml::Placemark);
  34. }
  35. if (ParsingTools.nullCheck(this.x.kml::GroundOverlay)) {
  36. this._feature = new KmlGroundOverlay(this.x.kml::GroundOverlay);
  37. }
  38. if (ParsingTools.nullCheck(this.x.kml::Folder)) {
  39. this._feature = new Folder(this.x.kml::Folder);
  40. }
  41. if (ParsingTools.nullCheck(this.x.kml::Document)) {
  42. this._feature = new Document(this.x.kml::Document);
  43. }
  44. }
  45. /**
  46. * Represents the child feature of the KML root (there can only be one).
  47. */
  48. public function get feature():Feature
  49. {
  50. return this._feature;
  51. }
  52. public function toString():String {
  53. return "Kml22: " + this._feature.toString();
  54. }
  55. }
  56. }