[Commits] r1623 - in sandbox/cmoullet/ux/LayerManager: examples ux/data
commits at geoext.org
commits at geoext.org
Mon Dec 28 14:45:27 CET 2009
Author: cmoullet
Date: 2009-12-28 14:45:26 +0100 (Mon, 28 Dec 2009)
New Revision: 1623
Added:
sandbox/cmoullet/ux/LayerManager/examples/line_style.kml
sandbox/cmoullet/ux/LayerManager/examples/simple_placemark.kml
Modified:
sandbox/cmoullet/ux/LayerManager/examples/
sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.html
sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js
sandbox/cmoullet/ux/LayerManager/ux/data/Export.js
sandbox/cmoullet/ux/LayerManager/ux/data/FormatStore.js
sandbox/cmoullet/ux/LayerManager/ux/data/Import.js
Log:
Add Import support.
Discover that OL needs some work to really support KML in read/write...
Property changes on: sandbox/cmoullet/ux/LayerManager/examples
___________________________________________________________________
Name: svn:ignore
+ line_style_export.kml
simple_placemark_export.kml
Modified: sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.html
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.html 2009-12-28 12:40:55 UTC (rev 1622)
+++ sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.html 2009-12-28 13:45:26 UTC (rev 1623)
@@ -5,7 +5,7 @@
<script type="text/javascript" src="../../../trunk/ext/ext-all.js"></script>
<link rel="stylesheet" type="text/css" href="../../../trunk/ext/resources/css/ext-all.css"/>
<link rel="stylesheet" type="text/css" href="../../../trunk/ext/examples/shared/examples.css"/>
- <script type="text/javascript" src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
+ <script type="text/javascript" src="../../../trunk/openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
<script type="text/javascript" src="../ux/downloadify/js/swfobject.js"></script>
<script type="text/javascript" src="../ux/downloadify/js/downloadify.min.js"></script>
Modified: sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js 2009-12-28 12:40:55 UTC (rev 1622)
+++ sandbox/cmoullet/ux/LayerManager/examples/LayerManagerExample.js 2009-12-28 13:45:26 UTC (rev 1623)
@@ -8,7 +8,7 @@
Ext.onReady(function() {
Ext.BLANK_IMAGE_URL = '../../../trunk/ext/resources/images/default/s.gif';
- OpenLayers.ImgPath = '../../../trunk/openlayers/img/';
+ OpenLayers.ImgPath = '../../../trunk/openlayers/img/';
var bluemarble = new OpenLayers.Layer.WMS(
"Bluemarble",
@@ -52,7 +52,7 @@
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
- url: "sundials.kml",
+ url: "line_style.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
@@ -88,7 +88,7 @@
map: map,
layers: mapStore,
center: center,
- zoom: 7,
+ zoom: 3,
split: true,
tbar: toolbar
},
Added: sandbox/cmoullet/ux/LayerManager/examples/line_style.kml
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/line_style.kml (rev 0)
+++ sandbox/cmoullet/ux/LayerManager/examples/line_style.kml 2009-12-28 13:45:26 UTC (rev 1623)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+ <Document>
+ <name>KmlFile</name>
+ <Style id="transPurpleLineGreenPoly">
+ <LineStyle>
+ <color>7fff00ff</color>
+ <width>4</width>
+ </LineStyle>
+ <PolyStyle>
+ <color>7f00ff00</color>
+ </PolyStyle>
+ </Style>
+ <Placemark>
+ <name>Absolute</name>
+ <visibility>1</visibility>
+ <description>Transparent purple line</description>
+ <styleUrl>#transPurpleLineGreenPoly</styleUrl>
+ <LineString>
+ <tessellate>1</tessellate>
+ <altitudeMode>absolute</altitudeMode>
+ <coordinates>
+ -112.265654928602,36.09447672602546,2357
+ -112.2660384528238,36.09342608838671,2357
+ -112.2668139013453,36.09251058776881,2357
+ -112.2677826834445,36.09189827357996,2357
+ -112.2688557510952,36.0913137941187,2357
+ -112.2694810717219,36.0903677207521,2357
+ -112.2695268555611,36.08932171487285,2357
+ -112.2690144567276,36.08850916060472,2357
+ -112.2681528815339,36.08753813597956,2357
+ -112.2670588176031,36.08682685262568,2357
+ -112.2657374587321,36.08646312301303,2357
+ </coordinates>
+ </LineString>
+ </Placemark>
+ </Document>
+</kml>
\ No newline at end of file
Added: sandbox/cmoullet/ux/LayerManager/examples/simple_placemark.kml
===================================================================
--- sandbox/cmoullet/ux/LayerManager/examples/simple_placemark.kml (rev 0)
+++ sandbox/cmoullet/ux/LayerManager/examples/simple_placemark.kml 2009-12-28 13:45:26 UTC (rev 1623)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+ <Placemark>
+ <name>Simple placemark</name>
+ <description>
+ Attached to the ground. Intelligently places itself at the
+ height of the underlying terrain.
+ </description>
+ <Point>
+ <coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
+ </Point>
+ </Placemark>
+</kml>
\ No newline at end of file
Modified: sandbox/cmoullet/ux/LayerManager/ux/data/Export.js
===================================================================
--- sandbox/cmoullet/ux/LayerManager/ux/data/Export.js 2009-12-28 12:40:55 UTC (rev 1622)
+++ sandbox/cmoullet/ux/LayerManager/ux/data/Export.js 2009-12-28 13:45:26 UTC (rev 1623)
@@ -41,16 +41,28 @@
}
if (format == 'KML') {
- var kmlWriter = new OpenLayers.Format.KML(GeoExt.ux.data.formats.getFormatConfig(format));
+ var kmlWriter = new OpenLayers.Format.KML({
+ extractStyles: true,
+ extractAttributes: true
+ });
return kmlWriter.write(exportFeatures);
} else if (format == 'GeoJSON') {
- var geojsonWriter = new OpenLayers.Format.GeoJSON(GeoExt.ux.data.formats.getFormatConfig(format));
+ var geojsonWriter = new OpenLayers.Format.GeoJSON({
+ extractStyles: true,
+ extractAttributes: true
+ });
return geojsonWriter.write(exportFeatures);
} else if (format == 'GeoRSS') {
- var georssWriter = new OpenLayers.Format.GeoRSS(GeoExt.ux.data.formats.getFormatConfig(format));
+ var georssWriter = new OpenLayers.Format.GeoRSS({
+ extractStyles: true,
+ extractAttributes: true
+ });
return georssWriter.write(exportFeatures);
} else if (format == 'GML') {
- var gmlWriter = new OpenLayers.Format.GML(GeoExt.ux.data.formats.getFormatConfig(format));
+ var gmlWriter = new OpenLayers.Format.GML({
+ extractStyles: true,
+ extractAttributes: true
+ });
return gmlWriter.write(exportFeatures);
} else {
return 'Format ' + format + ' not supported. Patch welcome !';
@@ -83,7 +95,7 @@
};
GeoExt.ux.data.Export.ChildOnLoad = function() {
- GeoExt.ux.data.Export.exportWindow.document.getElementById('filename').value = 'export.'+GeoExt.ux.data.Export.format.toLowerCase();
+ GeoExt.ux.data.Export.exportWindow.document.getElementById('filename').value = 'export.' + GeoExt.ux.data.Export.format.toLowerCase();
GeoExt.ux.data.Export.exportWindow.document.getElementById('data').value = GeoExt.ux.data.Export.content.replace(/</g, '<').replace(/>/g, '>');
};
Modified: sandbox/cmoullet/ux/LayerManager/ux/data/FormatStore.js
===================================================================
--- sandbox/cmoullet/ux/LayerManager/ux/data/FormatStore.js 2009-12-28 12:40:55 UTC (rev 1622)
+++ sandbox/cmoullet/ux/LayerManager/ux/data/FormatStore.js 2009-12-28 13:45:26 UTC (rev 1623)
@@ -9,21 +9,12 @@
Ext.namespace("GeoExt.ux.data");
GeoExt.ux.data.formats = [
- ['KML', 'OpenLayers.Format.KML', '{extractStyles: true,extractAttributes: true}'],
- ['GeoJSON', 'OpenLayers.Format.GeoJSON', '{}'],
- ['GeoRSS', 'OpenLayers.Format.GeoRSS', '{}'],
- ['GML', 'OpenLayers.Format.GML', '{}']
+ ['KML', 'OpenLayers.Format.KML'],
+ ['GeoJSON', 'OpenLayers.Format.GeoJSON'],
+ ['GeoRSS', 'OpenLayers.Format.GeoRSS'],
+ ['GML', 'OpenLayers.Format.GML']
];
-GeoExt.ux.data.formats.getFormatConfig = function(format) {
- for (var i = 0; i < GeoExt.ux.data.formats.length; i++) {
- if (GeoExt.ux.data.formats[i][0] === format) {
- return GeoExt.ux.data.formats[i][2];
- }
- }
- return '{}';
-};
-
GeoExt.ux.data.FormatStore = new Ext.data.SimpleStore({
fields: ['shortName', 'openLayersClass', 'formatExportConfig'],
data: GeoExt.ux.data.formats
Modified: sandbox/cmoullet/ux/LayerManager/ux/data/Import.js
===================================================================
--- sandbox/cmoullet/ux/LayerManager/ux/data/Import.js 2009-12-28 12:40:55 UTC (rev 1622)
+++ sandbox/cmoullet/ux/LayerManager/ux/data/Import.js 2009-12-28 13:45:26 UTC (rev 1623)
@@ -15,7 +15,10 @@
if (format && filecontent) {
if (format == 'KML') {
- var kmlReader = new OpenLayers.Format.KML(GeoExt.ux.data.formats.getFormatConfig(format));
+ var kmlReader = new OpenLayers.Format.KML({
+ extractStyles: true,
+ extractAttributes: true
+ });
importFeatures = kmlReader.read(filecontent);
} else {
return 'Format ' + format + ' not supported. Patch welcome !';
More information about the Commits
mailing list