From 13833e0a671caef3748e8347842b92f75e56e7b7 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 12 Mar 2009 20:04:34 +0000 Subject: [PATCH] Unmixing line endings. No functional change. git-svn-id: http://svn.openlayers.org/trunk/openlayers@9038 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- art/marker.svg | 48 +-- doc/customization | 98 +++--- doc/readme.txt | 14 +- examples/pan-zoom-panels.html | 112 +++---- lib/OpenLayers/Control/Pan.js | 170 +++++----- lib/OpenLayers/Control/PanPanel.js | 88 ++--- lib/OpenLayers/Control/ZoomIn.js | 68 ++-- lib/OpenLayers/Control/ZoomOut.js | 68 ++-- lib/OpenLayers/Control/ZoomPanel.js | 100 +++--- lib/OpenLayers/Lang/nb.js | 242 +++++++------- lib/OpenLayers/Lang/sv-SE.js | 242 +++++++------- lib/OpenLayers/Layer/KaMapCache.js | 294 ++++++++-------- tests/Layer/georss.txt | 10 +- tests/georss.txt | 10 +- tools/exampleparser.py | 502 ++++++++++++++-------------- 15 files changed, 1033 insertions(+), 1033 deletions(-) diff --git a/art/marker.svg b/art/marker.svg index b35c293cd9..9f0d8dc49a 100644 --- a/art/marker.svg +++ b/art/marker.svg @@ -1,25 +1,25 @@ - - - - -]> + + + + +]> - - - - - - - - - - - - - - - - + xmlns="&ns_svg;" width="20.5" height="24.5" viewBox="0 0 20.5 24.5" + overflow="visible" enable-background="new 0 0 20.5 24.5" xml:space="preserve"> + + + + + + + + + + + + + + + + diff --git a/doc/customization b/doc/customization index 61b4184e7c..f4b5b98aa9 100644 --- a/doc/customization +++ b/doc/customization @@ -1,49 +1,49 @@ -Customizing OpenLayers -====================== - -OpenLayers is designed to fit many needs -- fitting in alongside all kinds of -various applications which are currently in use. - -Currently, OpenLayers supports a 'theme' option when creating a map. This -theme option allows you to specify the location of a CSS theme which should -be included. - -A default theme is available as an example in the theme/ directory: the setup -is: - - * theme/ - * theme/default/ - * theme/default/style.css - * theme/default/img/ - -Currently, the OpenLayers code does not support class names, and therefore, -it is not possible to control many aspects of OpenLayers code with CSS -classes. However, with this framework in place, we expect to invest time -to make existing features and new features use the CSS theming framework -where apropriate. - - -Class Naming -============ -Elements should have class names which are descriptive of the Javascript -class from which they come. For example, the main layer switcher element -in the OpenLayers.Control.LayerSwitcher would be classed: - - olControlLayerSwitcher - -This would allow users to add to their style.css class in their theme, -changing, for example: - -:: - - .olControlLayerSwitcher input { - width:10px; - } - -Sub elements of a particular control can add to the class name: - -:: - - .olControlLayerSwitcherBaseLabel { - color: red; - } +Customizing OpenLayers +====================== + +OpenLayers is designed to fit many needs -- fitting in alongside all kinds of +various applications which are currently in use. + +Currently, OpenLayers supports a 'theme' option when creating a map. This +theme option allows you to specify the location of a CSS theme which should +be included. + +A default theme is available as an example in the theme/ directory: the setup +is: + + * theme/ + * theme/default/ + * theme/default/style.css + * theme/default/img/ + +Currently, the OpenLayers code does not support class names, and therefore, +it is not possible to control many aspects of OpenLayers code with CSS +classes. However, with this framework in place, we expect to invest time +to make existing features and new features use the CSS theming framework +where apropriate. + + +Class Naming +============ +Elements should have class names which are descriptive of the Javascript +class from which they come. For example, the main layer switcher element +in the OpenLayers.Control.LayerSwitcher would be classed: + + olControlLayerSwitcher + +This would allow users to add to their style.css class in their theme, +changing, for example: + +:: + + .olControlLayerSwitcher input { + width:10px; + } + +Sub elements of a particular control can add to the class name: + +:: + + .olControlLayerSwitcherBaseLabel { + color: red; + } diff --git a/doc/readme.txt b/doc/readme.txt index b5d0084ef1..d02540af67 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,7 +1,7 @@ -Automatically generated OpenLayers API documentation is online: - - http://dev.openlayers.org/apidocs - -More information on documentation is available from: - - http://trac.openlayers.org/wiki/Documentation +Automatically generated OpenLayers API documentation is online: + + http://dev.openlayers.org/apidocs + +More information on documentation is available from: + + http://trac.openlayers.org/wiki/Documentation diff --git a/examples/pan-zoom-panels.html b/examples/pan-zoom-panels.html index 78b9ec26a8..ab633fb895 100644 --- a/examples/pan-zoom-panels.html +++ b/examples/pan-zoom-panels.html @@ -1,56 +1,56 @@ - - - Pan and Zoom Panels - - - - - - - - - - - -

Pan and Zoom Panels

-
-

Customizable pan and zoom panels

-

-
-

- The pan and zoom panels allow you to use CSS styling to change the - look and feel of the panels, including changing their position - and their icons without needing to change any code. -

- - + + + Pan and Zoom Panels + + + + + + + + + + + +

Pan and Zoom Panels

+
+

Customizable pan and zoom panels

+

+
+

+ The pan and zoom panels allow you to use CSS styling to change the + look and feel of the panels, including changing their position + and their icons without needing to change any code. +

+ + diff --git a/lib/OpenLayers/Control/Pan.js b/lib/OpenLayers/Control/Pan.js index db3e217ede..9e6c4128aa 100644 --- a/lib/OpenLayers/Control/Pan.js +++ b/lib/OpenLayers/Control/Pan.js @@ -1,85 +1,85 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.Pan - * The Pan control is a single button to pan the map in one direction. For - * a more complete control see . - * - * Inherits from: - * - - */ -OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: slideFactor - * {Integer} Number of pixels by which we'll pan the map in any direction - * on clicking the arrow buttons. - */ - slideFactor: 50, - - /** - * Property: direction - * {String} in {'North', 'South', 'East', 'West'} - */ - direction: null, - - /** - * Property: type - * {String} The type of -- When added to a - * , 'type' is used by the panel to determine how to - * handle our events. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /** - * Constructor: OpenLayers.Control.Pan - * Control which handles the panning (in any of the cardinal directions) - * of the map by a set px distance. - * - * Parameters: - * direction - {String} The direction this button should pan. - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(direction, options) { - - this.direction = direction; - this.CLASS_NAME += this.direction; - - OpenLayers.Control.prototype.initialize.apply(this, [options]); - }, - - /** - * Method: trigger - */ - trigger: function(){ - - switch (this.direction) { - case OpenLayers.Control.Pan.NORTH: - this.map.pan(0, -this.slideFactor); - break; - case OpenLayers.Control.Pan.SOUTH: - this.map.pan(0, this.slideFactor); - break; - case OpenLayers.Control.Pan.WEST: - this.map.pan(-this.slideFactor, 0); - break; - case OpenLayers.Control.Pan.EAST: - this.map.pan(this.slideFactor, 0); - break; - } - }, - - CLASS_NAME: "OpenLayers.Control.Pan" -}); - -OpenLayers.Control.Pan.NORTH = "North"; -OpenLayers.Control.Pan.SOUTH = "South"; -OpenLayers.Control.Pan.EAST = "East"; -OpenLayers.Control.Pan.WEST = "West"; +/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Control.js + */ + +/** + * Class: OpenLayers.Control.Pan + * The Pan control is a single button to pan the map in one direction. For + * a more complete control see . + * + * Inherits from: + * - + */ +OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, { + + /** + * APIProperty: slideFactor + * {Integer} Number of pixels by which we'll pan the map in any direction + * on clicking the arrow buttons. + */ + slideFactor: 50, + + /** + * Property: direction + * {String} in {'North', 'South', 'East', 'West'} + */ + direction: null, + + /** + * Property: type + * {String} The type of -- When added to a + * , 'type' is used by the panel to determine how to + * handle our events. + */ + type: OpenLayers.Control.TYPE_BUTTON, + + /** + * Constructor: OpenLayers.Control.Pan + * Control which handles the panning (in any of the cardinal directions) + * of the map by a set px distance. + * + * Parameters: + * direction - {String} The direction this button should pan. + * options - {Object} An optional object whose properties will be used + * to extend the control. + */ + initialize: function(direction, options) { + + this.direction = direction; + this.CLASS_NAME += this.direction; + + OpenLayers.Control.prototype.initialize.apply(this, [options]); + }, + + /** + * Method: trigger + */ + trigger: function(){ + + switch (this.direction) { + case OpenLayers.Control.Pan.NORTH: + this.map.pan(0, -this.slideFactor); + break; + case OpenLayers.Control.Pan.SOUTH: + this.map.pan(0, this.slideFactor); + break; + case OpenLayers.Control.Pan.WEST: + this.map.pan(-this.slideFactor, 0); + break; + case OpenLayers.Control.Pan.EAST: + this.map.pan(this.slideFactor, 0); + break; + } + }, + + CLASS_NAME: "OpenLayers.Control.Pan" +}); + +OpenLayers.Control.Pan.NORTH = "North"; +OpenLayers.Control.Pan.SOUTH = "South"; +OpenLayers.Control.Pan.EAST = "East"; +OpenLayers.Control.Pan.WEST = "West"; diff --git a/lib/OpenLayers/Control/PanPanel.js b/lib/OpenLayers/Control/PanPanel.js index afb608174e..2d5864bb23 100644 --- a/lib/OpenLayers/Control/PanPanel.js +++ b/lib/OpenLayers/Control/PanPanel.js @@ -1,44 +1,44 @@ -/** - * @requires OpenLayers/Control/Panel.js - * @requires OpenLayers/Control/Pan.js - */ - -/** - * Class: OpenLayers.Control.PanPanel - * The PanPanel is visible control for panning the map North, South, East or - * West in small steps. By default it is drawn in the top left corner of the - * map. - * - * Note: If you wish to use this class with the default images and you want - * it to look nice in ie6, you should add the following, conditionally - * added css stylesheet to your HTML file: - * - * - * - * Inherits from: - * - - */ -OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, { - - /** - * Constructor: OpenLayers.Control.PanPanel - * Add the four directional pan buttons. - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); - this.addControls([ - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH), - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH), - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST), - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST) - ]); - }, - - CLASS_NAME: "OpenLayers.Control.PanPanel" -}); +/** + * @requires OpenLayers/Control/Panel.js + * @requires OpenLayers/Control/Pan.js + */ + +/** + * Class: OpenLayers.Control.PanPanel + * The PanPanel is visible control for panning the map North, South, East or + * West in small steps. By default it is drawn in the top left corner of the + * map. + * + * Note: If you wish to use this class with the default images and you want + * it to look nice in ie6, you should add the following, conditionally + * added css stylesheet to your HTML file: + * + * + * + * Inherits from: + * - + */ +OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, { + + /** + * Constructor: OpenLayers.Control.PanPanel + * Add the four directional pan buttons. + * + * Parameters: + * options - {Object} An optional object whose properties will be used + * to extend the control. + */ + initialize: function(options) { + OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); + this.addControls([ + new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH), + new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH), + new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST), + new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST) + ]); + }, + + CLASS_NAME: "OpenLayers.Control.PanPanel" +}); diff --git a/lib/OpenLayers/Control/ZoomIn.js b/lib/OpenLayers/Control/ZoomIn.js index 78764e0e71..8173df3fe0 100644 --- a/lib/OpenLayers/Control/ZoomIn.js +++ b/lib/OpenLayers/Control/ZoomIn.js @@ -1,34 +1,34 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.ZoomIn - * The ZoomIn control is a button to increase the zoom level of a map. - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: type - * {String} The type of -- When added to a - * , 'type' is used by the panel to determine how to - * handle our events. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /** - * Method: trigger - */ - trigger: function(){ - this.map.zoomIn(); - }, - - CLASS_NAME: "OpenLayers.Control.ZoomIn" -}); +/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Control.js + */ + +/** + * Class: OpenLayers.Control.ZoomIn + * The ZoomIn control is a button to increase the zoom level of a map. + * + * Inherits from: + * - + */ +OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, { + + /** + * Property: type + * {String} The type of -- When added to a + * , 'type' is used by the panel to determine how to + * handle our events. + */ + type: OpenLayers.Control.TYPE_BUTTON, + + /** + * Method: trigger + */ + trigger: function(){ + this.map.zoomIn(); + }, + + CLASS_NAME: "OpenLayers.Control.ZoomIn" +}); diff --git a/lib/OpenLayers/Control/ZoomOut.js b/lib/OpenLayers/Control/ZoomOut.js index 9f17d4b8a6..48b8ac5b22 100644 --- a/lib/OpenLayers/Control/ZoomOut.js +++ b/lib/OpenLayers/Control/ZoomOut.js @@ -1,34 +1,34 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.ZoomOut - * The ZoomOut control is a button to decrease the zoom level of a map. - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: type - * {String} The type of -- When added to a - * , 'type' is used by the panel to determine how to - * handle our events. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /** - * Method: trigger - */ - trigger: function(){ - this.map.zoomOut(); - }, - - CLASS_NAME: "OpenLayers.Control.ZoomOut" -}); +/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Control.js + */ + +/** + * Class: OpenLayers.Control.ZoomOut + * The ZoomOut control is a button to decrease the zoom level of a map. + * + * Inherits from: + * - + */ +OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, { + + /** + * Property: type + * {String} The type of -- When added to a + * , 'type' is used by the panel to determine how to + * handle our events. + */ + type: OpenLayers.Control.TYPE_BUTTON, + + /** + * Method: trigger + */ + trigger: function(){ + this.map.zoomOut(); + }, + + CLASS_NAME: "OpenLayers.Control.ZoomOut" +}); diff --git a/lib/OpenLayers/Control/ZoomPanel.js b/lib/OpenLayers/Control/ZoomPanel.js index 12d22dd0db..263e6143e7 100644 --- a/lib/OpenLayers/Control/ZoomPanel.js +++ b/lib/OpenLayers/Control/ZoomPanel.js @@ -1,50 +1,50 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control/Panel.js - * @requires OpenLayers/Control/ZoomIn.js - * @requires OpenLayers/Control/ZoomOut.js - * @requires OpenLayers/Control/ZoomToMaxExtent.js - */ - -/** - * Class: OpenLayers.Control.ZoomPanel - * The ZoomPanel control is a compact collecton of 3 zoom controls - a - * , a , and a - * . By default it is drawn in the upper left - * corner of the map. - * - * Note: If you wish to use this class with the default images and you want - * it to look nice in ie6, you should add the following, conditionally - * added css stylesheet to your HTML file: - * - * - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomPanel = OpenLayers.Class(OpenLayers.Control.Panel, { - - /** - * Constructor: OpenLayers.Control.ZoomPanel - * Add the three zooming controls. - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); - this.addControls([ - new OpenLayers.Control.ZoomIn(), - new OpenLayers.Control.ZoomToMaxExtent(), - new OpenLayers.Control.ZoomOut() - ]); - }, - - CLASS_NAME: "OpenLayers.Control.ZoomPanel" -}); +/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Control/Panel.js + * @requires OpenLayers/Control/ZoomIn.js + * @requires OpenLayers/Control/ZoomOut.js + * @requires OpenLayers/Control/ZoomToMaxExtent.js + */ + +/** + * Class: OpenLayers.Control.ZoomPanel + * The ZoomPanel control is a compact collecton of 3 zoom controls - a + * , a , and a + * . By default it is drawn in the upper left + * corner of the map. + * + * Note: If you wish to use this class with the default images and you want + * it to look nice in ie6, you should add the following, conditionally + * added css stylesheet to your HTML file: + * + * + * + * Inherits from: + * - + */ +OpenLayers.Control.ZoomPanel = OpenLayers.Class(OpenLayers.Control.Panel, { + + /** + * Constructor: OpenLayers.Control.ZoomPanel + * Add the three zooming controls. + * + * Parameters: + * options - {Object} An optional object whose properties will be used + * to extend the control. + */ + initialize: function(options) { + OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); + this.addControls([ + new OpenLayers.Control.ZoomIn(), + new OpenLayers.Control.ZoomToMaxExtent(), + new OpenLayers.Control.ZoomOut() + ]); + }, + + CLASS_NAME: "OpenLayers.Control.ZoomPanel" +}); diff --git a/lib/OpenLayers/Lang/nb.js b/lib/OpenLayers/Lang/nb.js index 9fd6d48d97..1470567d3b 100644 --- a/lib/OpenLayers/Lang/nb.js +++ b/lib/OpenLayers/Lang/nb.js @@ -1,121 +1,121 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Lang.js - */ - -/** - * Namespace: OpenLayers.Lang["nb"] - * Dictionary for norwegian bokmål (Norway). Keys for entries are used in calls to - * . Entry bodies are normal strings or - * strings formatted for use with calls. - */ -OpenLayers.Lang["nb"] = { - - 'unhandledRequest': "Ubehandlet forespørsel returnerte ${statusText}", - - 'permalink': "Kobling til denne siden", - - 'overlays': "Kartlag", - - 'baseLayer': "Bakgrunnskart", - - 'sameProjection': - "Oversiktskartet fungerer bare når det har samme projeksjon som hovedkartet", - - 'readNotImplemented': "Lesing er ikke implementert.", - - 'writeNotImplemented': "Skriving er ikke implementert.", - - 'noFID': "Kan ikke oppdatere feature (objekt) som ikke har FID.", - - 'errorLoadingGML': "Feil under lasting av GML-fil ${url}", - - 'browserNotSupported': - "Din nettleser støtter ikke vektortegning. Følgende tegnemetoder støttes:\n${renderers}", - - 'componentShouldBe': "addFeatures : komponenten må være en ${geomType}", - - // console message - 'getFeatureError': - "getFeatureFromEvent kjørt mot lag uten tegnemetode. Dette betyr som regel at du " + - "fjernet et lag uten å fjerne alle handlere tilknyttet laget.", - - // console message - 'minZoomLevelError': - "Egenskapen minZoomLevel er kun tenkt for bruk på lag " + - "basert på FixedZoomLevels. At dette wfs-laget sjekker " + - "minZoomLevel er en fortidslevning. Det kan dog ikke " + - "tas bort uten å risikere at OL-baserte applikasjoner " + - "slutter å virke, så det er merket som foreldet: " + - "minZoomLevel i sjekken nedenfor vil fjernes i 3.0. " + - "Vennligst bruk innstillingene for min/maks oppløsning " + - "som er beskrevet her: "+ - "http://trac.openlayers.org/wiki/SettingZoomLevels", - - 'commitSuccess': "WFS-transaksjon: SUKSESS ${response}", - - 'commitFailed': "WFS-transaksjon: FEILET ${response}", - - 'googleWarning': - "Google-laget kunne ikke lastes.

" + - "Bytt til et annet bakgrunnslag i lagvelgeren i " + - "øvre høyre hjørne for å slippe denne meldingen.

" + - "Sannsynligvis forårsakes feilen av at Google Maps-biblioteket " + - "ikke er riktig inkludert på nettsiden, eller at det ikke er " + - "angitt riktig API-nøkkel for nettstedet.

" + - "Utviklere: For hjelp til å få dette til å virke se "+ - "her.", - - 'getLayerWarning': - "${layerType}-laget kunne ikke lastes.

" + - "Bytt til et annet bakgrunnslag i lagvelgeren i " + - "øvre høyre hjørne for å slippe denne meldingen.

" + - "Sannsynligvis forårsakes feilen av at " + - "${layerLib}-biblioteket ikke var riktig inkludert " + - "på nettsiden.

" + - "Utviklere: For hjelp til å få dette til å virke se " + - "her.", - - 'scale': "Skala 1 : ${scaleDenom}", - - // console message - 'layerAlreadyAdded': - "Du forsøkte å legge til laget ${layerName} på kartet, men det er allerede lagt til", - - // console message - 'reprojectDeprecated': - "Du bruker innstillingen 'reproject' på laget ${layerName}. " + - "Denne innstillingen er foreldet, den var ment for å støtte " + - "visning av kartdata over kommersielle bakgrunnskart, men det " + - "bør nå gjøres med støtten for Spherical Mercator. Mer informasjon " + - "finnes på " + - "http://trac.openlayers.org/wiki/SphericalMercator.", - - // console message - 'methodDeprecated': - "Denne metoden er markert som foreldet og vil bli fjernet i 3.0. " + - "Bruk ${newMethod} i stedet.", - - // console message - 'boundsAddError': "Du må gi både x- og y-verdier til funksjonen add.", - - // console message - 'lonlatAddError': "Du må gi både lon- og lat-verdier til funksjonen add.", - - // console message - 'pixelAddError': "Du må gi både x- og y-verdier til funksjonen add.", - - // console message - 'unsupportedGeometryType': "Ustøttet geometritype: ${geomType}", - - // console message - 'pagePositionFailed': - "OpenLayers.Util.pagePosition feilet: elementet med id ${elemId} kan være feilplassert.", - - 'end': '' -}; +/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Lang.js + */ + +/** + * Namespace: OpenLayers.Lang["nb"] + * Dictionary for norwegian bokmål (Norway). Keys for entries are used in calls to + * . Entry bodies are normal strings or + * strings formatted for use with calls. + */ +OpenLayers.Lang["nb"] = { + + 'unhandledRequest': "Ubehandlet forespørsel returnerte ${statusText}", + + 'permalink': "Kobling til denne siden", + + 'overlays': "Kartlag", + + 'baseLayer': "Bakgrunnskart", + + 'sameProjection': + "Oversiktskartet fungerer bare når det har samme projeksjon som hovedkartet", + + 'readNotImplemented': "Lesing er ikke implementert.", + + 'writeNotImplemented': "Skriving er ikke implementert.", + + 'noFID': "Kan ikke oppdatere feature (objekt) som ikke har FID.", + + 'errorLoadingGML': "Feil under lasting av GML-fil ${url}", + + 'browserNotSupported': + "Din nettleser støtter ikke vektortegning. Følgende tegnemetoder støttes:\n${renderers}", + + 'componentShouldBe': "addFeatures : komponenten må være en ${geomType}", + + // console message + 'getFeatureError': + "getFeatureFromEvent kjørt mot lag uten tegnemetode. Dette betyr som regel at du " + + "fjernet et lag uten å fjerne alle handlere tilknyttet laget.", + + // console message + 'minZoomLevelError': + "Egenskapen minZoomLevel er kun tenkt for bruk på lag " + + "basert på FixedZoomLevels. At dette wfs-laget sjekker " + + "minZoomLevel er en fortidslevning. Det kan dog ikke " + + "tas bort uten å risikere at OL-baserte applikasjoner " + + "slutter å virke, så det er merket som foreldet: " + + "minZoomLevel i sjekken nedenfor vil fjernes i 3.0. " + + "Vennligst bruk innstillingene for min/maks oppløsning " + + "som er beskrevet her: "+ + "http://trac.openlayers.org/wiki/SettingZoomLevels", + + 'commitSuccess': "WFS-transaksjon: SUKSESS ${response}", + + 'commitFailed': "WFS-transaksjon: FEILET ${response}", + + 'googleWarning': + "Google-laget kunne ikke lastes.

" + + "Bytt til et annet bakgrunnslag i lagvelgeren i " + + "øvre høyre hjørne for å slippe denne meldingen.

" + + "Sannsynligvis forårsakes feilen av at Google Maps-biblioteket " + + "ikke er riktig inkludert på nettsiden, eller at det ikke er " + + "angitt riktig API-nøkkel for nettstedet.

" + + "Utviklere: For hjelp til å få dette til å virke se "+ + "her.", + + 'getLayerWarning': + "${layerType}-laget kunne ikke lastes.

" + + "Bytt til et annet bakgrunnslag i lagvelgeren i " + + "øvre høyre hjørne for å slippe denne meldingen.

" + + "Sannsynligvis forårsakes feilen av at " + + "${layerLib}-biblioteket ikke var riktig inkludert " + + "på nettsiden.

" + + "Utviklere: For hjelp til å få dette til å virke se " + + "her.", + + 'scale': "Skala 1 : ${scaleDenom}", + + // console message + 'layerAlreadyAdded': + "Du forsøkte å legge til laget ${layerName} på kartet, men det er allerede lagt til", + + // console message + 'reprojectDeprecated': + "Du bruker innstillingen 'reproject' på laget ${layerName}. " + + "Denne innstillingen er foreldet, den var ment for å støtte " + + "visning av kartdata over kommersielle bakgrunnskart, men det " + + "bør nå gjøres med støtten for Spherical Mercator. Mer informasjon " + + "finnes på " + + "http://trac.openlayers.org/wiki/SphericalMercator.", + + // console message + 'methodDeprecated': + "Denne metoden er markert som foreldet og vil bli fjernet i 3.0. " + + "Bruk ${newMethod} i stedet.", + + // console message + 'boundsAddError': "Du må gi både x- og y-verdier til funksjonen add.", + + // console message + 'lonlatAddError': "Du må gi både lon- og lat-verdier til funksjonen add.", + + // console message + 'pixelAddError': "Du må gi både x- og y-verdier til funksjonen add.", + + // console message + 'unsupportedGeometryType': "Ustøttet geometritype: ${geomType}", + + // console message + 'pagePositionFailed': + "OpenLayers.Util.pagePosition feilet: elementet med id ${elemId} kan være feilplassert.", + + 'end': '' +}; diff --git a/lib/OpenLayers/Lang/sv-SE.js b/lib/OpenLayers/Lang/sv-SE.js index a9b0be02dd..667177474f 100644 --- a/lib/OpenLayers/Lang/sv-SE.js +++ b/lib/OpenLayers/Lang/sv-SE.js @@ -1,121 +1,121 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Lang.js - */ - -/** - * Namespace: OpenLayers.Lang["sv-SE"] - * Dictionary for swedish (Sweden). Keys for entries are used in calls to - * . Entry bodies are normal strings or - * strings formatted for use with calls. - */ -OpenLayers.Lang["sv-SE"] = { - - 'unhandledRequest': "Ej hanterad fråga retur ${statusText}", - - 'permalink': "Permalänk", - - 'overlays': "Kartlager", - - 'baseLayer': "Bakgrundskarta", - - 'sameProjection': - "Översiktskartan fungerar endast när den har samma projektion som huvudkartan", - - 'readNotImplemented': "Läsning ej implementerad.", - - 'writeNotImplemented': "Skrivning ej implementerad.", - - 'noFID': "Kan ej uppdatera feature (objekt) för vilket FID saknas.", - - 'errorLoadingGML': "Fel i laddning av GML-fil ${url}", - - 'browserNotSupported': - "Din webbläsare stöder inte vektorvisning. För närvarande stöds följande visning:\n${renderers}", - - 'componentShouldBe': "addFeatures : komponenten skall vara en ${geomType}", - - // console message - 'getFeatureError': - "getFeatureFromEvent anropad för lager utan utritning. Detta betyder oftast att man " + - "raderat ett lager, men inte en hanterare som är knuten till lagret.", - - // console message - 'minZoomLevelError': - "Egenskapen minZoomLevel är endast avsedd att användas " + - "med lager med FixedZoomLevels. Att detta WFS-lager " + - "kontrollerar minZoomLevel är en relik från äldre versioner. " + - "Vi kan dock inte ta bort det utan att riskera att " + - "OL-baserade tillämpningar som använder detta slutar " + - "fungera. Därför är det satt som deprecated, minZoomLevel " + - "kommer att tas bort i version 3.0. Använd i stället " + - "inställning av min/max resolution som beskrivs här: " + - "http://trac.openlayers.org/wiki/SettingZoomLevels", - - 'commitSuccess': "WFS-transaktion: LYCKADES ${response}", - - 'commitFailed': "WFS-transaktion: MISSLYCKADES ${response}", - - 'googleWarning': - "Google-lagret kunde inte laddas korrekt.

" + - "För att slippa detta meddelande, välj en annan bakgrundskarta " + - "i lagerväljaren i övre högra hörnet.

" + - "Sannolikt beror felet på att Google Maps-biblioteket " + - "inte är inkluderat på webbsidan eller på att sidan " + - "inte anger korrekt API-nyckel för webbplatsen.

" + - "Utvecklare: hjälp för att åtgärda detta, " + - "klicka här.", - - 'getLayerWarning': - "${layerType}-lagret kunde inte laddas korrekt.

" + - "För att slippa detta meddelande, välj en annan bakgrundskarta " + - "i lagerväljaren i övre högra hörnet.

" + - "Sannolikt beror felet på att ${layerLib}-biblioteket " + - "inte är inkluderat på webbsidan.

" + - "Utvecklare: hjälp för att åtgärda detta, " + - "klicka här.", - - 'scale': "Skala 1 : ${scaleDenom}", - - // console message - 'layerAlreadyAdded': - "Du försökte lägga till lagret: ${layerName} på kartan, men det har lagts till tidigare", - - // console message - 'reprojectDeprecated': - "Du använder inställningen 'reproject' på lagret ${layerName}. " + - "Denna inställning markerad som deprecated: den var avsedd " + - "att användas för att stödja visning av kartdata på kommersiella " + - "bakgrundskartor, men nu bör man i stället " + - "använda Spherical Mercator-stöd för den funktionaliteten. " + - "Mer information finns " + - "på http://trac.openlayers.org/wiki/SphericalMercator.", - - // console message - 'methodDeprecated': - "Denna metod är markerad som deprecated och kommer att tas bort i 3.0. " + - "Använd ${newMethod} i stället.", - - // console message - 'boundsAddError': "Du måste skicka både x- och y-värde till funktionen add.", - - // console message - 'lonlatAddError': "Du måste skicka både lon- och lat-värde till funktionen add.", - - // console message - 'pixelAddError': "Du måste skicka både x- och y-värde till funktionen add.", - - // console message - 'unsupportedGeometryType': "Stöd saknas för geometritypen: ${geomType}", - - // console message - 'pagePositionFailed': - "OpenLayers.Util.pagePosition misslyckades: elementet med id ${elemId} kan placeras fel.", - - 'end': '' -}; +/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Lang.js + */ + +/** + * Namespace: OpenLayers.Lang["sv-SE"] + * Dictionary for swedish (Sweden). Keys for entries are used in calls to + * . Entry bodies are normal strings or + * strings formatted for use with calls. + */ +OpenLayers.Lang["sv-SE"] = { + + 'unhandledRequest': "Ej hanterad fråga retur ${statusText}", + + 'permalink': "Permalänk", + + 'overlays': "Kartlager", + + 'baseLayer': "Bakgrundskarta", + + 'sameProjection': + "Översiktskartan fungerar endast när den har samma projektion som huvudkartan", + + 'readNotImplemented': "Läsning ej implementerad.", + + 'writeNotImplemented': "Skrivning ej implementerad.", + + 'noFID': "Kan ej uppdatera feature (objekt) för vilket FID saknas.", + + 'errorLoadingGML': "Fel i laddning av GML-fil ${url}", + + 'browserNotSupported': + "Din webbläsare stöder inte vektorvisning. För närvarande stöds följande visning:\n${renderers}", + + 'componentShouldBe': "addFeatures : komponenten skall vara en ${geomType}", + + // console message + 'getFeatureError': + "getFeatureFromEvent anropad för lager utan utritning. Detta betyder oftast att man " + + "raderat ett lager, men inte en hanterare som är knuten till lagret.", + + // console message + 'minZoomLevelError': + "Egenskapen minZoomLevel är endast avsedd att användas " + + "med lager med FixedZoomLevels. Att detta WFS-lager " + + "kontrollerar minZoomLevel är en relik från äldre versioner. " + + "Vi kan dock inte ta bort det utan att riskera att " + + "OL-baserade tillämpningar som använder detta slutar " + + "fungera. Därför är det satt som deprecated, minZoomLevel " + + "kommer att tas bort i version 3.0. Använd i stället " + + "inställning av min/max resolution som beskrivs här: " + + "http://trac.openlayers.org/wiki/SettingZoomLevels", + + 'commitSuccess': "WFS-transaktion: LYCKADES ${response}", + + 'commitFailed': "WFS-transaktion: MISSLYCKADES ${response}", + + 'googleWarning': + "Google-lagret kunde inte laddas korrekt.

" + + "För att slippa detta meddelande, välj en annan bakgrundskarta " + + "i lagerväljaren i övre högra hörnet.

" + + "Sannolikt beror felet på att Google Maps-biblioteket " + + "inte är inkluderat på webbsidan eller på att sidan " + + "inte anger korrekt API-nyckel för webbplatsen.

" + + "Utvecklare: hjälp för att åtgärda detta, " + + "klicka här.", + + 'getLayerWarning': + "${layerType}-lagret kunde inte laddas korrekt.

" + + "För att slippa detta meddelande, välj en annan bakgrundskarta " + + "i lagerväljaren i övre högra hörnet.

" + + "Sannolikt beror felet på att ${layerLib}-biblioteket " + + "inte är inkluderat på webbsidan.

" + + "Utvecklare: hjälp för att åtgärda detta, " + + "klicka här.", + + 'scale': "Skala 1 : ${scaleDenom}", + + // console message + 'layerAlreadyAdded': + "Du försökte lägga till lagret: ${layerName} på kartan, men det har lagts till tidigare", + + // console message + 'reprojectDeprecated': + "Du använder inställningen 'reproject' på lagret ${layerName}. " + + "Denna inställning markerad som deprecated: den var avsedd " + + "att användas för att stödja visning av kartdata på kommersiella " + + "bakgrundskartor, men nu bör man i stället " + + "använda Spherical Mercator-stöd för den funktionaliteten. " + + "Mer information finns " + + "på http://trac.openlayers.org/wiki/SphericalMercator.", + + // console message + 'methodDeprecated': + "Denna metod är markerad som deprecated och kommer att tas bort i 3.0. " + + "Använd ${newMethod} i stället.", + + // console message + 'boundsAddError': "Du måste skicka både x- och y-värde till funktionen add.", + + // console message + 'lonlatAddError': "Du måste skicka både lon- och lat-värde till funktionen add.", + + // console message + 'pixelAddError': "Du måste skicka både x- och y-värde till funktionen add.", + + // console message + 'unsupportedGeometryType': "Stöd saknas för geometritypen: ${geomType}", + + // console message + 'pagePositionFailed': + "OpenLayers.Util.pagePosition misslyckades: elementet med id ${elemId} kan placeras fel.", + + 'end': '' +}; diff --git a/lib/OpenLayers/Layer/KaMapCache.js b/lib/OpenLayers/Layer/KaMapCache.js index c7d41d34d9..35af24add9 100644 --- a/lib/OpenLayers/Layer/KaMapCache.js +++ b/lib/OpenLayers/Layer/KaMapCache.js @@ -1,147 +1,147 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Layer/Grid.js - * @requires OpenLayers/Layer/KaMap.js - */ - -/** - * Class: OpenLayers.Layer.KaMapCache - * - * This class is designed to talk directly to a web-accessible ka-Map - * cache generated by the precache2.php script. - * - * To create a a new KaMapCache layer, you must indicate also the "i" parameter - * (that will be used to calculate the file extension), and another special - * parameter, object names "metaTileSize", with "h" (height) and "w" (width) - * properties. - * - * // Create a new kaMapCache layer. - * var kamap_base = new OpenLayers.Layer.KaMapCache( - * "Satellite", - * "http://www.example.org/web/acessible/cache", - * {g: "satellite", map: "world", i: 'png24', metaTileSize: {w: 5, h: 5} } - * ); - * - * // Create an kaMapCache overlay layer (using "isBaseLayer: false"). - * // Forces the output to be a "gif", using the "i" parameter. - * var kamap_overlay = new OpenLayers.Layer.KaMapCache( - * "Streets", - * "http://www.example.org/web/acessible/cache", - * {g: "streets", map: "world", i: "gif", metaTileSize: {w: 5, h: 5} }, - * {isBaseLayer: false} - * ); - * - * The cache URLs must look like: - * var/cache/World/50000/Group_Name/def/t-440320/l20480 - * - * This means that the cache generated via tile.php will *not* work with - * this class, and should instead use the KaMap layer. - * - * More information is available in Ticket #1518. - * - * Inherits from: - * - - * - - */ -OpenLayers.Layer.KaMapCache = OpenLayers.Class(OpenLayers.Layer.KaMap, { - - /** - * Constant: IMAGE_EXTENSIONS - * {Object} Simple hash map to convert format to extension. - */ - IMAGE_EXTENSIONS: { - 'jpeg': 'jpg', - 'gif' : 'gif', - 'png' : 'png', - 'png8' : 'png', - 'png24' : 'png', - 'dithered' : 'png' - }, - - /** - * Constant: DEFAULT_FORMAT - * {Object} Simple hash map to convert format to extension. - */ - DEFAULT_FORMAT: 'jpeg', - - /** - * Constructor: OpenLayers.Layer.KaMapCache - * - * Parameters: - * name - {String} - * url - {String} - * params - {Object} Parameters to be sent to the HTTP server in the - * query string for the tile. The format can be set via the 'i' - * parameter (defaults to jpg) , and the map should be set via - * the 'map' parameter. It has been reported that ka-Map may behave - * inconsistently if your format parameter does not match the format - * parameter configured in your config.php. (See ticket #327 for more - * information.) - * options - {Object} Additional options for the layer. Any of the - * APIProperties listed on this layer, and any layer types it - * extends, can be overridden through the options parameter. - */ - initialize: function(name, url, params, options) { - OpenLayers.Layer.KaMap.prototype.initialize.apply(this, arguments); - this.extension = this.IMAGE_EXTENSIONS[this.params.i.toLowerCase() || DEFAULT_FORMAT]; - }, - - /** - * Method: getURL - * - * Parameters: - * bounds - {} - * - * Returns: - * {String} A string with the layer's url and parameters and also the - * passed-in bounds and appropriate tile size specified as - * parameters - */ - getURL: function (bounds) { - bounds = this.adjustBounds(bounds); - var mapRes = this.map.getResolution(); - var scale = Math.round((this.map.getScale() * 10000)) / 10000; - var pX = Math.round(bounds.left / mapRes); - var pY = -Math.round(bounds.top / mapRes); - - var metaX = Math.floor(pX / this.tileSize.w / this.params.metaTileSize.w) * this.tileSize.w * this.params.metaTileSize.w; - var metaY = Math.floor(pY / this.tileSize.h / this.params.metaTileSize.h) * this.tileSize.h * this.params.metaTileSize.h; - - // if url is not a string, it should be an array of strings, - // in which case we will deterministically select one of them in - // order to evenly distribute requests to different urls. - // - var url = this.url; - if (url instanceof Array) { - url = this.selectUrl(paramsString, url); - } - - var components = [ - url, - "/", - this.params.map, - "/", - scale, - "/", - this.params.g.replace(/\s/g, '_'), - "/def/t", - metaY, - "/l", - metaX, - "/t", - pY, - "l", - pX, - ".", - this.extension - ]; - - return components.join(""); - }, - - CLASS_NAME: "OpenLayers.Layer.KaMapCache" -}); +/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + + +/** + * @requires OpenLayers/Layer/Grid.js + * @requires OpenLayers/Layer/KaMap.js + */ + +/** + * Class: OpenLayers.Layer.KaMapCache + * + * This class is designed to talk directly to a web-accessible ka-Map + * cache generated by the precache2.php script. + * + * To create a a new KaMapCache layer, you must indicate also the "i" parameter + * (that will be used to calculate the file extension), and another special + * parameter, object names "metaTileSize", with "h" (height) and "w" (width) + * properties. + * + * // Create a new kaMapCache layer. + * var kamap_base = new OpenLayers.Layer.KaMapCache( + * "Satellite", + * "http://www.example.org/web/acessible/cache", + * {g: "satellite", map: "world", i: 'png24', metaTileSize: {w: 5, h: 5} } + * ); + * + * // Create an kaMapCache overlay layer (using "isBaseLayer: false"). + * // Forces the output to be a "gif", using the "i" parameter. + * var kamap_overlay = new OpenLayers.Layer.KaMapCache( + * "Streets", + * "http://www.example.org/web/acessible/cache", + * {g: "streets", map: "world", i: "gif", metaTileSize: {w: 5, h: 5} }, + * {isBaseLayer: false} + * ); + * + * The cache URLs must look like: + * var/cache/World/50000/Group_Name/def/t-440320/l20480 + * + * This means that the cache generated via tile.php will *not* work with + * this class, and should instead use the KaMap layer. + * + * More information is available in Ticket #1518. + * + * Inherits from: + * - + * - + */ +OpenLayers.Layer.KaMapCache = OpenLayers.Class(OpenLayers.Layer.KaMap, { + + /** + * Constant: IMAGE_EXTENSIONS + * {Object} Simple hash map to convert format to extension. + */ + IMAGE_EXTENSIONS: { + 'jpeg': 'jpg', + 'gif' : 'gif', + 'png' : 'png', + 'png8' : 'png', + 'png24' : 'png', + 'dithered' : 'png' + }, + + /** + * Constant: DEFAULT_FORMAT + * {Object} Simple hash map to convert format to extension. + */ + DEFAULT_FORMAT: 'jpeg', + + /** + * Constructor: OpenLayers.Layer.KaMapCache + * + * Parameters: + * name - {String} + * url - {String} + * params - {Object} Parameters to be sent to the HTTP server in the + * query string for the tile. The format can be set via the 'i' + * parameter (defaults to jpg) , and the map should be set via + * the 'map' parameter. It has been reported that ka-Map may behave + * inconsistently if your format parameter does not match the format + * parameter configured in your config.php. (See ticket #327 for more + * information.) + * options - {Object} Additional options for the layer. Any of the + * APIProperties listed on this layer, and any layer types it + * extends, can be overridden through the options parameter. + */ + initialize: function(name, url, params, options) { + OpenLayers.Layer.KaMap.prototype.initialize.apply(this, arguments); + this.extension = this.IMAGE_EXTENSIONS[this.params.i.toLowerCase() || DEFAULT_FORMAT]; + }, + + /** + * Method: getURL + * + * Parameters: + * bounds - {} + * + * Returns: + * {String} A string with the layer's url and parameters and also the + * passed-in bounds and appropriate tile size specified as + * parameters + */ + getURL: function (bounds) { + bounds = this.adjustBounds(bounds); + var mapRes = this.map.getResolution(); + var scale = Math.round((this.map.getScale() * 10000)) / 10000; + var pX = Math.round(bounds.left / mapRes); + var pY = -Math.round(bounds.top / mapRes); + + var metaX = Math.floor(pX / this.tileSize.w / this.params.metaTileSize.w) * this.tileSize.w * this.params.metaTileSize.w; + var metaY = Math.floor(pY / this.tileSize.h / this.params.metaTileSize.h) * this.tileSize.h * this.params.metaTileSize.h; + + // if url is not a string, it should be an array of strings, + // in which case we will deterministically select one of them in + // order to evenly distribute requests to different urls. + // + var url = this.url; + if (url instanceof Array) { + url = this.selectUrl(paramsString, url); + } + + var components = [ + url, + "/", + this.params.map, + "/", + scale, + "/", + this.params.g.replace(/\s/g, '_'), + "/def/t", + metaY, + "/l", + metaX, + "/t", + pY, + "l", + pX, + ".", + this.extension + ]; + + return components.join(""); + }, + + CLASS_NAME: "OpenLayers.Layer.KaMapCache" +}); diff --git a/tests/Layer/georss.txt b/tests/Layer/georss.txt index 8ad15617c1..053749b943 100644 --- a/tests/Layer/georss.txt +++ b/tests/Layer/georss.txt @@ -1,8 +1,8 @@ - - - + + This is an RSS file. Copy the URL into your aggregator of choice. If you don't know what this means and want to learn more, please see: http://platial.typepad.com/news/2006/04/really_simple_t.html for more info. http://platial.com diff --git a/tests/georss.txt b/tests/georss.txt index 8ad15617c1..053749b943 100644 --- a/tests/georss.txt +++ b/tests/georss.txt @@ -1,8 +1,8 @@ - - - + + This is an RSS file. Copy the URL into your aggregator of choice. If you don't know what this means and want to learn more, please see: http://platial.typepad.com/news/2006/04/really_simple_t.html for more info. http://platial.com diff --git a/tools/exampleparser.py b/tools/exampleparser.py index cca3c28b52..11b183e0f1 100755 --- a/tools/exampleparser.py +++ b/tools/exampleparser.py @@ -1,251 +1,251 @@ -#!/usr/bin/env python - -import sys -import os -import re -import urllib2 -import time -from xml.dom.minidom import Document - -try: - import xml.etree.ElementTree as ElementTree -except ImportError: - try: - import cElementTree as ElementTree - except ImportError: - try: - import elementtree.ElementTree as ElementTree - except ImportError: - import lxml.etree as ElementTree - -missing_deps = False -try: - import simplejson - from BeautifulSoup import BeautifulSoup -except ImportError, E: - missing_deps = E - -feedName = "example-list.xml" -feedPath = "http://openlayers.org/dev/examples/" - -def getListOfOnlineExamples(baseUrl): - """ - useful if you want to get a list of examples a url. not used by default. - """ - html = urllib2.urlopen(baseUrl) - soup = BeautifulSoup(html) - examples = soup.findAll('li') - examples = [example.find('a').get('href') for example in examples] - examples = [example for example in examples if example.endswith('.html')] - examples = [example for example in examples] - return examples - -def getListOfExamples(relPath): - """ - returns list of .html filenames within a given path - excludes example-list.html - """ - examples = os.listdir(relPath) - examples = [example for example in examples if example.endswith('.html') and example != "example-list.html"] - return examples - - -def getExampleHtml(location): - """ - returns html of a specific example that is available online or locally - """ - print '.', - if location.startswith('http'): - return urllib2.urlopen(location).read() - else: - f = open(location) - html = f.read() - f.close() - return html - - -def extractById(soup, tagId, value=None): - """ - returns full contents of a particular tag id - """ - beautifulTag = soup.find(id=tagId) - if beautifulTag: - if beautifulTag.contents: - value = str(beautifulTag.renderContents()).strip() - value = value.replace('\t','') - value = value.replace('\n','') - return value - -def getRelatedClasses(html): - """ - parses the html, and returns a list of all OpenLayers Classes - used within (ie what parts of OL the javascript uses). - """ - rawstr = r'''(?POpenLayers\..*?)\(''' - return re.findall(rawstr, html) - -def parseHtml(html,ids): - """ - returns dictionary of items of interest - """ - soup = BeautifulSoup(html) - d = {} - for tagId in ids: - d[tagId] = extractById(soup,tagId) - #classes should eventually be parsed from docs - not automatically created. - classes = getRelatedClasses(html) - d['classes'] = classes - return d - -def getSvnInfo(path): - h = os.popen("svn info %s --xml" % path) - tree = ElementTree.fromstring(h.read()) - h.close() - d = { - 'url': tree.findtext('entry/url'), - 'author': tree.findtext('entry/commit/author'), - 'date': tree.findtext('entry/commit/date') - } - return d - -def createFeed(examples): - doc = Document() - atomuri = "http://www.w3.org/2005/Atom" - feed = doc.createElementNS(atomuri, "feed") - feed.setAttribute("xmlns", atomuri) - title = doc.createElementNS(atomuri, "title") - title.appendChild(doc.createTextNode("OpenLayers Examples")) - feed.appendChild(title) - link = doc.createElementNS(atomuri, "link") - link.setAttribute("rel", "self") - link.setAttribute("href", feedPath + feedName) - - modtime = time.strftime("%Y-%m-%dT%I:%M:%SZ", time.gmtime()) - id = doc.createElementNS(atomuri, "id") - id.appendChild(doc.createTextNode("%s%s#%s" % (feedPath, feedName, modtime))) - feed.appendChild(id) - - updated = doc.createElementNS(atomuri, "updated") - updated.appendChild(doc.createTextNode(modtime)) - feed.appendChild(updated) - - examples.sort(key=lambda x:x["modified"]) - for example in sorted(examples, key=lambda x:x["modified"], reverse=True): - entry = doc.createElementNS(atomuri, "entry") - - title = doc.createElementNS(atomuri, "title") - title.appendChild(doc.createTextNode(example["title"] or example["example"])) - entry.appendChild(title) - - link = doc.createElementNS(atomuri, "link") - link.setAttribute("href", "%s%s" % (feedPath, example["example"])) - entry.appendChild(link) - - summary = doc.createElementNS(atomuri, "summary") - summary.appendChild(doc.createTextNode(example["shortdesc"] or example["example"])) - entry.appendChild(summary) - - updated = doc.createElementNS(atomuri, "updated") - updated.appendChild(doc.createTextNode(example["modified"])) - entry.appendChild(updated) - - author = doc.createElementNS(atomuri, "author") - name = doc.createElementNS(atomuri, "name") - name.appendChild(doc.createTextNode(example["author"])) - author.appendChild(name) - entry.appendChild(author) - - id = doc.createElementNS(atomuri, "id") - id.appendChild(doc.createTextNode("%s%s#%s" % (feedPath, example["example"], example["modified"]))) - entry.appendChild(id) - - feed.appendChild(entry) - - doc.appendChild(feed) - return doc - -def wordIndex(examples): - """ - Create an inverted index based on words in title and shortdesc. Keys are - lower cased words. Values are dictionaries with example index keys and - count values. - """ - index = {} - unword = re.compile("\\W+") - keys = ["shortdesc", "title"] - for i in range(len(examples)): - for key in keys: - text = examples[i][key] - if text: - words = unword.split(text) - for word in words: - if word: - word = word.lower() - if index.has_key(word): - if index[word].has_key(i): - index[word][i] += 1 - else: - index[word][i] = 1 - else: - index[word] = {i: 1} - return index - -if __name__ == "__main__": - - if missing_deps: - print "This script requires simplejson and BeautifulSoup. You don't have them. \n(%s)" % E - sys.exit() - - if len(sys.argv) > 1: - outFile = open(sys.argv[1],'w') - else: - outFile = open('../examples/example-list.js','w') - - examplesLocation = '../examples' - print 'Reading examples from %s and writing out to %s' % (examplesLocation, outFile.name) - - exampleList = [] - docIds = ['title','shortdesc'] - - #comment out option to create docs from online resource - #examplesLocation = 'http://svn.openlayers.org/sandbox/docs/examples/' - #examples = getListOfOnlineExamples(examplesLocation) - - examples = getListOfExamples(examplesLocation) - - modtime = time.strftime("%Y-%m-%dT%I:%M:%SZ", time.gmtime()) - - for example in examples: - url = os.path.join(examplesLocation,example) - html = getExampleHtml(url) - tagvalues = parseHtml(html,docIds) - tagvalues['example'] = example - # add in svn info - d = getSvnInfo(url) - tagvalues["modified"] = d["date"] or modtime - tagvalues["author"] = d["author"] or "anonymous" - tagvalues['link'] = example - - exampleList.append(tagvalues) - - print - - exampleList.sort(key=lambda x:x['example'].lower()) - - index = wordIndex(exampleList) - - json = simplejson.dumps({"examples": exampleList, "index": index}) - #give the json a global variable we can use in our js. This should be replaced or made optional. - json = 'var info=' + json - outFile.write(json) - outFile.close() - - print "writing feed to ../examples/%s " % feedName - atom = open('../examples/%s' % feedName, 'w') - doc = createFeed(exampleList) - atom.write(doc.toxml()) - atom.close() - - - print 'complete' - - +#!/usr/bin/env python + +import sys +import os +import re +import urllib2 +import time +from xml.dom.minidom import Document + +try: + import xml.etree.ElementTree as ElementTree +except ImportError: + try: + import cElementTree as ElementTree + except ImportError: + try: + import elementtree.ElementTree as ElementTree + except ImportError: + import lxml.etree as ElementTree + +missing_deps = False +try: + import simplejson + from BeautifulSoup import BeautifulSoup +except ImportError, E: + missing_deps = E + +feedName = "example-list.xml" +feedPath = "http://openlayers.org/dev/examples/" + +def getListOfOnlineExamples(baseUrl): + """ + useful if you want to get a list of examples a url. not used by default. + """ + html = urllib2.urlopen(baseUrl) + soup = BeautifulSoup(html) + examples = soup.findAll('li') + examples = [example.find('a').get('href') for example in examples] + examples = [example for example in examples if example.endswith('.html')] + examples = [example for example in examples] + return examples + +def getListOfExamples(relPath): + """ + returns list of .html filenames within a given path - excludes example-list.html + """ + examples = os.listdir(relPath) + examples = [example for example in examples if example.endswith('.html') and example != "example-list.html"] + return examples + + +def getExampleHtml(location): + """ + returns html of a specific example that is available online or locally + """ + print '.', + if location.startswith('http'): + return urllib2.urlopen(location).read() + else: + f = open(location) + html = f.read() + f.close() + return html + + +def extractById(soup, tagId, value=None): + """ + returns full contents of a particular tag id + """ + beautifulTag = soup.find(id=tagId) + if beautifulTag: + if beautifulTag.contents: + value = str(beautifulTag.renderContents()).strip() + value = value.replace('\t','') + value = value.replace('\n','') + return value + +def getRelatedClasses(html): + """ + parses the html, and returns a list of all OpenLayers Classes + used within (ie what parts of OL the javascript uses). + """ + rawstr = r'''(?POpenLayers\..*?)\(''' + return re.findall(rawstr, html) + +def parseHtml(html,ids): + """ + returns dictionary of items of interest + """ + soup = BeautifulSoup(html) + d = {} + for tagId in ids: + d[tagId] = extractById(soup,tagId) + #classes should eventually be parsed from docs - not automatically created. + classes = getRelatedClasses(html) + d['classes'] = classes + return d + +def getSvnInfo(path): + h = os.popen("svn info %s --xml" % path) + tree = ElementTree.fromstring(h.read()) + h.close() + d = { + 'url': tree.findtext('entry/url'), + 'author': tree.findtext('entry/commit/author'), + 'date': tree.findtext('entry/commit/date') + } + return d + +def createFeed(examples): + doc = Document() + atomuri = "http://www.w3.org/2005/Atom" + feed = doc.createElementNS(atomuri, "feed") + feed.setAttribute("xmlns", atomuri) + title = doc.createElementNS(atomuri, "title") + title.appendChild(doc.createTextNode("OpenLayers Examples")) + feed.appendChild(title) + link = doc.createElementNS(atomuri, "link") + link.setAttribute("rel", "self") + link.setAttribute("href", feedPath + feedName) + + modtime = time.strftime("%Y-%m-%dT%I:%M:%SZ", time.gmtime()) + id = doc.createElementNS(atomuri, "id") + id.appendChild(doc.createTextNode("%s%s#%s" % (feedPath, feedName, modtime))) + feed.appendChild(id) + + updated = doc.createElementNS(atomuri, "updated") + updated.appendChild(doc.createTextNode(modtime)) + feed.appendChild(updated) + + examples.sort(key=lambda x:x["modified"]) + for example in sorted(examples, key=lambda x:x["modified"], reverse=True): + entry = doc.createElementNS(atomuri, "entry") + + title = doc.createElementNS(atomuri, "title") + title.appendChild(doc.createTextNode(example["title"] or example["example"])) + entry.appendChild(title) + + link = doc.createElementNS(atomuri, "link") + link.setAttribute("href", "%s%s" % (feedPath, example["example"])) + entry.appendChild(link) + + summary = doc.createElementNS(atomuri, "summary") + summary.appendChild(doc.createTextNode(example["shortdesc"] or example["example"])) + entry.appendChild(summary) + + updated = doc.createElementNS(atomuri, "updated") + updated.appendChild(doc.createTextNode(example["modified"])) + entry.appendChild(updated) + + author = doc.createElementNS(atomuri, "author") + name = doc.createElementNS(atomuri, "name") + name.appendChild(doc.createTextNode(example["author"])) + author.appendChild(name) + entry.appendChild(author) + + id = doc.createElementNS(atomuri, "id") + id.appendChild(doc.createTextNode("%s%s#%s" % (feedPath, example["example"], example["modified"]))) + entry.appendChild(id) + + feed.appendChild(entry) + + doc.appendChild(feed) + return doc + +def wordIndex(examples): + """ + Create an inverted index based on words in title and shortdesc. Keys are + lower cased words. Values are dictionaries with example index keys and + count values. + """ + index = {} + unword = re.compile("\\W+") + keys = ["shortdesc", "title"] + for i in range(len(examples)): + for key in keys: + text = examples[i][key] + if text: + words = unword.split(text) + for word in words: + if word: + word = word.lower() + if index.has_key(word): + if index[word].has_key(i): + index[word][i] += 1 + else: + index[word][i] = 1 + else: + index[word] = {i: 1} + return index + +if __name__ == "__main__": + + if missing_deps: + print "This script requires simplejson and BeautifulSoup. You don't have them. \n(%s)" % E + sys.exit() + + if len(sys.argv) > 1: + outFile = open(sys.argv[1],'w') + else: + outFile = open('../examples/example-list.js','w') + + examplesLocation = '../examples' + print 'Reading examples from %s and writing out to %s' % (examplesLocation, outFile.name) + + exampleList = [] + docIds = ['title','shortdesc'] + + #comment out option to create docs from online resource + #examplesLocation = 'http://svn.openlayers.org/sandbox/docs/examples/' + #examples = getListOfOnlineExamples(examplesLocation) + + examples = getListOfExamples(examplesLocation) + + modtime = time.strftime("%Y-%m-%dT%I:%M:%SZ", time.gmtime()) + + for example in examples: + url = os.path.join(examplesLocation,example) + html = getExampleHtml(url) + tagvalues = parseHtml(html,docIds) + tagvalues['example'] = example + # add in svn info + d = getSvnInfo(url) + tagvalues["modified"] = d["date"] or modtime + tagvalues["author"] = d["author"] or "anonymous" + tagvalues['link'] = example + + exampleList.append(tagvalues) + + print + + exampleList.sort(key=lambda x:x['example'].lower()) + + index = wordIndex(exampleList) + + json = simplejson.dumps({"examples": exampleList, "index": index}) + #give the json a global variable we can use in our js. This should be replaced or made optional. + json = 'var info=' + json + outFile.write(json) + outFile.close() + + print "writing feed to ../examples/%s " % feedName + atom = open('../examples/%s' % feedName, 'w') + doc = createFeed(exampleList) + atom.write(doc.toxml()) + atom.close() + + + print 'complete' + +