[Commits] r1627 - in sandbox/cmoullet/ux/LayerManager: examples ux/data

commits at geoext.org commits at geoext.org
Tue Dec 29 06:26:51 CET 2009


Author: cmoullet
Date: 2009-12-29 06:26:50 +0100 (Tue, 29 Dec 2009)
New Revision: 1627

Added:
   sandbox/cmoullet/ux/LayerManager/examples/line_absolute_extruded.kml
   sandbox/cmoullet/ux/LayerManager/examples/multigeometry_simple.kml
   sandbox/cmoullet/ux/LayerManager/examples/placemark_extruded.kml
   sandbox/cmoullet/ux/LayerManager/examples/polygon_google_campus.kml
Modified:
   sandbox/cmoullet/ux/LayerManager/examples/
   sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js
   sandbox/cmoullet/ux/LayerManager/examples/README.txt
   sandbox/cmoullet/ux/LayerManager/ux/data/Export.js
Log:
Add direct KML export function
Add KML samples


Property changes on: sandbox/cmoullet/ux/LayerManager/examples
___________________________________________________________________
Name: svn:ignore
   - line_style_export.kml
placemark_descriptive_export.kml
placemark_floating_export.kml
simple_placemark_export.kml

   + line_absolute_extruded_export.kml
line_style_export.kml
multigeometry_simple_export.kml
placemark_descriptive_export.kml
placemark_extruded_export.kml
placemark_floating_export.kml
polygon_google_campus_export.kml
simple_placemark_export.kml


Modified: sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js	2009-12-29 04:51:10 UTC (rev 1626)
+++ sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js	2009-12-29 05:26:50 UTC (rev 1627)
@@ -40,19 +40,13 @@
         }
     });
 
-    toolbar.push({
-        text: 'Export KML',
-        enableToggle: false,
-        handler: function() {
-            alert("Shortcut to export KML. To be implemented");
-        }
-    });
 
+
     var sundials = new OpenLayers.Layer.Vector("KML", {
         projection: map.displayProjection,
         strategies: [new OpenLayers.Strategy.Fixed()],
         protocol: new OpenLayers.Protocol.HTTP({
-            url: "placemark_descriptive.kml",
+            url: "placemark_floating.kml",
             format: new OpenLayers.Format.KML({
                 extractStyles: true,
                 extractAttributes: true,
@@ -61,6 +55,14 @@
         })
     });
 
+    toolbar.push({
+        text: 'Export KML',
+        enableToggle: false,
+        handler: function() {
+            GeoExt.ux.data.Export.KMLExport(map, sundials);
+        }
+    });
+
     var mapStore = new GeoExt.data.LayerStore({
         map: map,
         layers: [bluemarble,sundials]

Modified: sandbox/cmoullet/ux/LayerManager/examples/README.txt
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/README.txt	2009-12-29 04:51:10 UTC (rev 1626)
+++ sandbox/cmoullet/ux/LayerManager/examples/README.txt	2009-12-29 05:26:50 UTC (rev 1627)
@@ -10,10 +10,16 @@
 placemark_descriptive.kml: CDATA not supported
 placemark_floating.kml: need support of graphicXOffset / graphicYOffset / graphicWidth / graphicHeight
 simple_placemark.kml: ok
+placemark_extruded.kml: ok
+line_absolute_extruded.kml: ok
+polygon_google_campus.kml: ok
+multigeometry_simple.kml: ok
 
 Not supported:
 read/write: altitudeMode
 read/write: tessellate
+read/write: extruded
 read/write: CDATA in description
+read/write: <LookAt>
 write: graphicXOffset,graphicYOffset,graphicWidth,graphicHeight
 

Added: sandbox/cmoullet/ux/LayerManager/examples/line_absolute_extruded.kml
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/line_absolute_extruded.kml	                        (rev 0)
+++ sandbox/cmoullet/ux/LayerManager/examples/line_absolute_extruded.kml	2009-12-29 05:26:50 UTC (rev 1627)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+  <Document>
+    <name>KmlFile</name>
+    <Style id="yellowLineGreenPoly">
+      <LineStyle>
+        <color>7f00ffff</color>
+        <width>4</width>
+      </LineStyle>
+      <PolyStyle>
+        <color>7f00ff00</color>
+      </PolyStyle>
+    </Style>
+    <Placemark>
+      <name>Absolute Extruded</name>
+      <visibility>1</visibility>
+      <description>Transparent green wall with yellow outlines</description>
+      <styleUrl>#yellowLineGreenPoly</styleUrl>
+      <LineString>
+        <extrude>1</extrude>
+        <tessellate>1</tessellate>
+        <altitudeMode>absolute</altitudeMode>
+        <coordinates>
+          -112.2550785337791,36.07954952145647,2357
+          -112.2549277039738,36.08117083492122,2357
+          -112.2552505069063,36.08260761307279,2357
+          -112.2564540158376,36.08395660588506,2357
+          -112.2580238976449,36.08511401044813,2357
+          -112.2595218489022,36.08584355239394,2357
+          -112.2608216347552,36.08612634548589,2357
+          -112.262073428656,36.08626019085147,2357
+          -112.2633204928495,36.08621519860091,2357
+          -112.2644963846444,36.08627897945274,2357
+          -112.2656969554589,36.08649599090644,2357
+        </coordinates>
+      </LineString>
+    </Placemark>
+  </Document>
+</kml>
\ No newline at end of file

Added: sandbox/cmoullet/ux/LayerManager/examples/multigeometry_simple.kml
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/multigeometry_simple.kml	                        (rev 0)
+++ sandbox/cmoullet/ux/LayerManager/examples/multigeometry_simple.kml	2009-12-29 05:26:50 UTC (rev 1627)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+  <Placemark>
+    <name>Adelaide</name>
+    <Style>
+      <LineStyle>
+        <color>ff000000</color>
+      </LineStyle>
+      <PolyStyle>
+        <color>7f9f7fe0</color>
+      </PolyStyle>
+    </Style>
+    <MultiGeometry>
+      <Point>
+        <coordinates>138.600000,-34.910000</coordinates>
+      </Point>
+      <Polygon>
+        <outerBoundaryIs>
+          <LinearRing>
+            <coordinates>
+              138.64,-34.93 138.64,-34.94 138.63,-34.94 138.62,-34.94
+              138.62,-34.95 138.62,-34.96 138.63,-34.96 138.62,-34.96
+              138.61,-34.97 138.60,-34.97 138.59,-34.97 138.58,-34.97
+              138.57,-34.97 138.57,-34.96 138.57,-34.95 138.57,-34.95
+              138.57,-34.94 138.57,-34.93 138.57,-34.92 138.57,-34.92
+              138.57,-34.91 138.56,-34.91 138.56,-34.90 138.57,-34.90
+              138.57,-34.90 138.57,-34.89 138.57,-34.89 138.57,-34.89
+              138.56,-34.88 138.56,-34.88 138.56,-34.88 138.56,-34.88
+              138.57,-34.88 138.58,-34.87 138.58,-34.87 138.58,-34.86
+              138.58,-34.85 138.58,-34.85 138.60,-34.85 138.61,-34.85
+              138.63,-34.85 138.63,-34.85 138.64,-34.86 138.64,-34.87
+              138.64,-34.87 138.63,-34.87 138.63,-34.88 138.62,-34.88
+              138.62,-34.88 138.62,-34.89 138.62,-34.89 138.62,-34.89
+              138.63,-34.89 138.63,-34.90 138.64,-34.90 138.64,-34.90
+              138.64,-34.91 138.64,-34.91 138.64,-34.92 138.64,-34.92
+              138.64,-34.93 138.64,-34.93
+            </coordinates>
+          </LinearRing>
+        </outerBoundaryIs>
+      </Polygon>
+    </MultiGeometry>
+  </Placemark>
+</kml>
\ No newline at end of file

Added: sandbox/cmoullet/ux/LayerManager/examples/placemark_extruded.kml
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/placemark_extruded.kml	                        (rev 0)
+++ sandbox/cmoullet/ux/LayerManager/examples/placemark_extruded.kml	2009-12-29 05:26:50 UTC (rev 1627)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+  <Placemark>
+    <name>Extruded placemark</name>
+    <visibility>1</visibility>
+    <description>Tethered to the ground by a customizable
+        "tail"</description>
+    <LookAt>
+      <longitude>-122.0857667006183</longitude>
+      <latitude>37.42156927867553</latitude>
+      <altitude>50</altitude>
+      <heading>0</heading>
+      <tilt>45</tilt>
+      <range>50</range>
+      <altitudeMode>relativeToGround</altitudeMode>
+    </LookAt>
+    <Style>
+      <IconStyle>
+        <Icon>
+          <href>http://maps.google.com/mapfiles/kml/pal3/icon19.png</href>
+        </Icon>
+      </IconStyle>
+      <LineStyle>
+        <width>2</width>
+      </LineStyle>
+    </Style>
+    <Point>
+      <extrude>1</extrude>
+      <altitudeMode>relativeToGround</altitudeMode>
+      <coordinates>-122.0857667006183,37.42156927867553,50</coordinates>
+    </Point>
+  </Placemark>
+</kml>
\ No newline at end of file

Added: sandbox/cmoullet/ux/LayerManager/examples/polygon_google_campus.kml
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/polygon_google_campus.kml	                        (rev 0)
+++ sandbox/cmoullet/ux/LayerManager/examples/polygon_google_campus.kml	2009-12-29 05:26:50 UTC (rev 1627)
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+  <Document>
+    <name>KmlFile</name>
+    <Style id="transGreenPoly">
+      <LineStyle>
+        <width>1.5</width>
+      </LineStyle>
+      <PolyStyle>
+        <color>7d00ff00</color>
+      </PolyStyle>
+    </Style>
+    <Style id="transRedPoly">
+      <LineStyle>
+        <width>1.5</width>
+      </LineStyle>
+      <PolyStyle>
+        <color>7d0000ff</color>
+      </PolyStyle>
+    </Style>
+    <Style id="transBluePoly">
+      <LineStyle>
+        <width>1.5</width>
+      </LineStyle>
+      <PolyStyle>
+        <color>7dff0000</color>
+      </PolyStyle>
+    </Style>
+    <Style id="transYellowPoly">
+      <LineStyle>
+        <width>1.5</width>
+      </LineStyle>
+      <PolyStyle>
+        <color>7d00ffff</color>
+      </PolyStyle>
+    </Style>
+    <Folder>
+      <name>Google Campus</name>
+      <visibility>1</visibility>
+      <description>A collection showing how easy it is to create 3-dimensional
+          buildings</description>
+      <Placemark>
+        <name>Building 40</name>
+        <visibility>1</visibility>
+        <styleUrl>#transRedPoly</styleUrl>
+        <Polygon>
+          <extrude>1</extrude>
+          <altitudeMode>relativeToGround</altitudeMode>
+          <outerBoundaryIs>
+            <LinearRing>
+              <coordinates>
+                -122.0848938459612,37.42257124044786,17
+                -122.0849580979198,37.42211922626856,17
+                -122.0847469573047,37.42207183952619,17
+                -122.0845725380962,37.42209006729676,17
+                -122.0845954886723,37.42215932700895,17
+                -122.0838521118269,37.42227278564371,17
+                -122.083792243335,37.42203539112084,17
+                -122.0835076656616,37.42209006957106,17
+                -122.0834709464152,37.42200987395161,17
+                -122.0831221085748,37.4221046494946,17
+                -122.0829247374572,37.42226503990386,17
+                -122.0829339169385,37.42231242843094,17
+                -122.0833837359737,37.42225046087618,17
+                -122.0833607854248,37.42234159228745,17
+                -122.0834204551642,37.42237075460644,17
+                -122.083659133885,37.42251292011001,17
+                -122.0839758438952,37.42265873093781,17
+                -122.0842374743331,37.42265143972521,17
+                -122.0845036949503,37.4226514386435,17
+                -122.0848020460801,37.42261133916315,17
+                -122.0847882750515,37.42256395055121,17
+                -122.0848938459612,37.42257124044786,17
+              </coordinates>
+            </LinearRing>
+          </outerBoundaryIs>
+        </Polygon>
+      </Placemark>
+      <Placemark>
+        <name>Building 41</name>
+        <visibility>1</visibility>
+        <styleUrl>#transBluePoly</styleUrl>
+        <Polygon>
+          <extrude>1</extrude>
+          <altitudeMode>relativeToGround</altitudeMode>
+          <outerBoundaryIs>
+            <LinearRing>
+              <coordinates>
+                -122.0857412771483,37.42227033155257,17
+                -122.0858169768481,37.42231408832346,17
+                -122.085852582875,37.42230337469744,17
+                -122.0858799945639,37.42225686138789,17
+                -122.0858860101409,37.4222311076138,17
+                -122.0858069157288,37.42220250173855,17
+                -122.0858379542653,37.42214027058678,17
+                -122.0856732640519,37.42208690214408,17
+                -122.0856022926407,37.42214885429042,17
+                -122.0855902778436,37.422128290487,17
+                -122.0855841672237,37.42208171967246,17
+                -122.0854852065741,37.42210455874995,17
+                -122.0855067264352,37.42214267949824,17
+                -122.0854430712915,37.42212783846172,17
+                -122.0850990714904,37.42251282407603,17
+                -122.0856769818632,37.42281815323651,17
+                -122.0860162273783,37.42244918858722,17
+                -122.0857260327004,37.42229239604253,17
+                -122.0857412771483,37.42227033155257,17
+              </coordinates>
+            </LinearRing>
+          </outerBoundaryIs>
+        </Polygon>
+      </Placemark>
+      <Placemark>
+        <name>Building 42</name>
+        <visibility>1</visibility>
+        <styleUrl>#transGreenPoly</styleUrl>
+        <Polygon>
+          <extrude>1</extrude>
+          <altitudeMode>relativeToGround</altitudeMode>
+          <outerBoundaryIs>
+            <LinearRing>
+              <coordinates>
+                -122.0857862287242,37.42136208886969,25
+                -122.0857312990603,37.42136935989481,25
+                -122.0857312992918,37.42140934910903,25
+                -122.0856077073679,37.42138390166565,25
+                -122.0855802426516,37.42137299550869,25
+                -122.0852186221971,37.42137299504316,25
+                -122.0852277765639,37.42161656508265,25
+                -122.0852598189347,37.42160565894403,25
+                -122.0852598185499,37.42168200156,25
+                -122.0852369311478,37.42170017860346,25
+                -122.0852643957828,37.42176197982575,25
+                -122.0853239032746,37.42176198013907,25
+                -122.0853559454324,37.421852864452,25
+                -122.0854108752463,37.42188921823734,25
+                -122.0854795379357,37.42189285337048,25
+                -122.0855436229819,37.42188921797546,25
+                -122.0856260178042,37.42186013499926,25
+                -122.085937287963,37.42186013453605,25
+                -122.0859428718666,37.42160898590042,25
+                -122.0859655469861,37.42157992759144,25
+                -122.0858640462341,37.42147115002957,25
+                -122.0858548911215,37.42140571326184,25
+                -122.0858091162768,37.4214057134039,25
+                -122.0857862287242,37.42136208886969,25
+              </coordinates>
+            </LinearRing>
+          </outerBoundaryIs>
+        </Polygon>
+      </Placemark>
+      <Placemark>
+        <name>Building 43</name>
+        <visibility>1</visibility>
+        <styleUrl>#transYellowPoly</styleUrl>
+        <Polygon>
+          <extrude>1</extrude>
+          <altitudeMode>relativeToGround</altitudeMode>
+          <outerBoundaryIs>
+            <LinearRing>
+              <coordinates>
+                -122.0844371128284,37.42177253003091,19
+                -122.0845118855746,37.42191111542896,19
+                -122.0850470999805,37.42178755121535,19
+                -122.0850719913391,37.42143663023161,19
+                -122.084916406232,37.42137237822116,19
+                -122.0842193868167,37.42137237801626,19
+                -122.08421938659,37.42147617161496,19
+                -122.0838086419991,37.4214613409357,19
+                -122.0837899728564,37.42131306410796,19
+                -122.0832796534698,37.42129328840593,19
+                -122.0832609819207,37.42139213944298,19
+                -122.0829373621737,37.42137236399876,19
+                -122.0829062425667,37.42151569778871,19
+                -122.0828502269665,37.42176282576465,19
+                -122.0829435788635,37.42176776969635,19
+                -122.083217411188,37.42179248552686,19
+                -122.0835970430103,37.4217480074456,19
+                -122.0839455556771,37.42169364237603,19
+                -122.0840077894637,37.42176283815853,19
+                -122.084113587521,37.42174801104392,19
+                -122.0840762473784,37.42171341292375,19
+                -122.0841447047739,37.42167881534569,19
+                -122.084144704223,37.42181720660197,19
+                -122.0842503333074,37.4218170700446,19
+                -122.0844371128284,37.42177253003091,19
+              </coordinates>
+            </LinearRing>
+          </outerBoundaryIs>
+        </Polygon>
+      </Placemark>
+    </Folder>
+  </Document>
+</kml>

Modified: sandbox/cmoullet/ux/LayerManager/ux/data/Export.js
===================================================================
--- sandbox/cmoullet/ux/LayerManager/ux/data/Export.js	2009-12-29 04:51:10 UTC (rev 1626)
+++ sandbox/cmoullet/ux/LayerManager/ux/data/Export.js	2009-12-29 05:26:50 UTC (rev 1627)
@@ -93,6 +93,34 @@
 
 GeoExt.ux.data.Export.exportWindow = null;
 
+GeoExt.ux.data.Export.KMLExport = function(map, layer) {
+    GeoExt.ux.data.Export.format = 'KML';
+    GeoExt.ux.data.Export.content = GeoExt.ux.data.Export(map, GeoExt.ux.data.Export.format, [layer], null);
+    if (Ext.isIE) {
+        GeoExt.ux.data.Export.OpenWindowIE();
+    } else if (Ext.isGecko) {
+        if (GetFlashVersion() > 10.00) {
+            GeoExt.ux.data.Export.OpenWindowDownloadify();
+        } else {
+            alert('Please install Flash 10');
+        }
+    } else if (Ext.isChrome) {
+        if (GetFlashVersion() > 10.00) {
+            GeoExt.ux.data.Export.OpenWindowDownloadify();
+        } else {
+            alert('Please install Flash 10');
+        }
+    } else if (Ext.isSafari) {
+        if (GetFlashVersion() > 10.00) {
+            GeoExt.ux.data.Export.OpenWindowDownloadify();
+        } else {
+            alert('Please install Flash 10');
+        }
+    } else {
+        alert('Your browser is not supported. Patch welcome !');
+    }
+};
+
 GeoExt.ux.data.Export.SupportedLayerType = [
     ['OpenLayers.Layer.Vector'],
     ['OpenLayers.Layer.WFS'],



More information about the Commits mailing list