diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index b2c96f841..20b3ecc8e 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -1,4 +1,4 @@ -# DEPENDENCIES (08/12/2021) +# DEPENDENCIES (31/03/2022) * openlayers @@ -23,12 +23,12 @@ last * Sortable last -└── sortablejs@1.8.4 +└── sortablejs@1.14.0 * geoportal-access-lib last -└── geoportal-access-lib@3.0.5 +└── geoportal-access-lib@3.1.0 * leaflet diff --git a/DRAFT_CHANGELOG.md b/DRAFT_CHANGELOG.md index a43391c1c..e564acf17 100644 --- a/DRAFT_CHANGELOG.md +++ b/DRAFT_CHANGELOG.md @@ -1,7 +1,5 @@ - - # Extension Geoportail OpenLayers, version __VERSION__ **__DATE__** @@ -13,10 +11,9 @@ * [Added] -* [Changed] + - Ajout du menu des couleurs et de la taille des pictogramme dans l'outil de dessin - - DOM widget d'import : "Tuiles vectorielles" au lieu de "Vecteur tuilé" - - utilisation du service isochrone v2, access-lib 3.1.0 (#326) +* [Changed] * [Deprecated] @@ -24,11 +21,15 @@ * [Fixed] + - Amélioration du rendu vecteur des formats GPX et GeoJSON + - Gestion du nom d'une couche importée dans le gestionnaire et dans l'outil de dessin + * [Security] --- + # Extension Geoportail Leaflet, version __VERSION__ **__DATE__** @@ -42,8 +43,6 @@ * [Changed] - - utilisation du service isochrone v2, access-lib 3.1.0 (#326) - * [Deprecated] * [Removed] diff --git a/build/scripts/release/geoportal-extensions-itowns-2.3.6.tgz b/build/scripts/release/geoportal-extensions-itowns-2.3.6.tgz index fafdc0b75..37618764b 100644 Binary files a/build/scripts/release/geoportal-extensions-itowns-2.3.6.tgz and b/build/scripts/release/geoportal-extensions-itowns-2.3.6.tgz differ diff --git a/build/scripts/release/geoportal-extensions-leaflet-2.2.2.tgz b/build/scripts/release/geoportal-extensions-leaflet-2.2.2.tgz deleted file mode 100644 index 063853e3f..000000000 Binary files a/build/scripts/release/geoportal-extensions-leaflet-2.2.2.tgz and /dev/null differ diff --git a/build/scripts/release/geoportal-extensions-leaflet-2.2.4.tgz b/build/scripts/release/geoportal-extensions-leaflet-2.2.4.tgz new file mode 100644 index 000000000..2e22f59a6 Binary files /dev/null and b/build/scripts/release/geoportal-extensions-leaflet-2.2.4.tgz differ diff --git a/build/scripts/release/geoportal-extensions-openlayers-3.2.10.tgz b/build/scripts/release/geoportal-extensions-openlayers-3.2.10.tgz new file mode 100644 index 000000000..ed59b11d8 Binary files /dev/null and b/build/scripts/release/geoportal-extensions-openlayers-3.2.10.tgz differ diff --git a/build/scripts/release/geoportal-extensions-openlayers-3.2.11.tgz b/build/scripts/release/geoportal-extensions-openlayers-3.2.11.tgz new file mode 100644 index 000000000..49d980e79 Binary files /dev/null and b/build/scripts/release/geoportal-extensions-openlayers-3.2.11.tgz differ diff --git a/build/scripts/release/geoportal-extensions-openlayers-3.2.8.tgz b/build/scripts/release/geoportal-extensions-openlayers-3.2.8.tgz deleted file mode 100644 index f506748ac..000000000 Binary files a/build/scripts/release/geoportal-extensions-openlayers-3.2.8.tgz and /dev/null differ diff --git a/build/scripts/release/geoportal-extensions-openlayers-3.2.9.tgz b/build/scripts/release/geoportal-extensions-openlayers-3.2.9.tgz deleted file mode 100644 index 01b5474d2..000000000 Binary files a/build/scripts/release/geoportal-extensions-openlayers-3.2.9.tgz and /dev/null differ diff --git a/build/scripts/release/package-itowns.json b/build/scripts/release/package-itowns.json index 98f21afc6..abebf4fae 100644 --- a/build/scripts/release/package-itowns.json +++ b/build/scripts/release/package-itowns.json @@ -1,6 +1,6 @@ { - "scripts" : {}, - "author" : "IGNF", + "peerDependencies" : {}, + "name" : "geoportal-extensions-itowns", "files" : [ "dist/", "src/", @@ -8,37 +8,37 @@ "README.md", "package.json" ], + "directories" : {}, + "repository" : { + "type" : "git", + "url" : "https://github.com/IGNF/geoportal-extensions.git" + }, "dependencies" : { - "sortablejs" : "1.14.0", + "loglevel" : "1.6.7", "three" : "0.135.0", + "node-fetch" : "^2.6.1", "proj4" : "2.7.5", - "geoportal-access-lib" : "https://raw.githubusercontent.com/IGNF/geoportal-access-lib/new-iso/geoportal-access-lib-3.0.6.tgz", - "xmldom" : "^0.1.27", - "loglevel" : "1.6.7", "itowns" : "2.37.0", - "node-fetch" : "^2.6.1" + "sortablejs" : "1.14.0", + "xmldom" : "^0.1.27", + "geoportal-access-lib" : "3.1.0" }, - "devDependencies" : {}, - "version" : "2.3.6", - "directories" : {}, - "date" : "04/03/2022", - "license" : "CECILL-B", - "bugs" : {}, - "name" : "geoportal-extensions-itowns", - "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-itowns.html", + "module" : "src/Itowns/index.js", + "description" : "French Geoportal Extensions for iTowns", "bundleDependencies" : [], + "scripts" : {}, "main" : "dist/GpPluginItowns-src.js", - "peerDependencies" : {}, - "description" : "French Geoportal Extensions for iTowns", + "date" : "23/03/2022", "keywords" : [ "geoportail", "plugin", "javascript", "Itowns" ], - "repository" : { - "type" : "git", - "url" : "https://github.com/IGNF/geoportal-extensions.git" - }, - "module" : "src/Itowns/index.js" + "author" : "IGNF", + "bugs" : {}, + "version" : "2.3.6", + "devDependencies" : {}, + "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-itowns.html", + "license" : "CECILL-B" } diff --git a/build/scripts/release/package-leaflet.json b/build/scripts/release/package-leaflet.json index 36ae49edb..784ee38f2 100644 --- a/build/scripts/release/package-leaflet.json +++ b/build/scripts/release/package-leaflet.json @@ -1,19 +1,32 @@ { - "directories" : {}, + "name" : "geoportal-extensions-leaflet", "dependencies" : { - "node-fetch" : "^2.6.1", + "proj4" : "2.7.5", "proj4leaflet" : "1.0.2", - "loglevel" : "1.6.6", + "leaflet-draw" : "1.0.4", + "node-fetch" : "^2.6.1", "geoportal-access-lib" : "3.1.0", + "loglevel" : "1.6.6", + "leaflet" : "1.7.1", "sortablejs" : "1.8.4", - "xmldom" : "^0.1.27", - "leaflet-draw" : "1.0.4", - "proj4" : "2.7.2", - "leaflet" : "1.7.1" + "xmldom" : "^0.1.27" }, - "name" : "geoportal-extensions-leaflet", + "license" : "CECILL-B", + "directories" : {}, + "date" : "23/03/2022", + "repository" : { + "url" : "https://github.com/IGNF/geoportal-extensions.git", + "type" : "git" + }, + "keywords" : [ + "geoportail", + "plugin", + "javascript", + "leaflet", + "publish" + ], + "module" : "src/Leaflet/index.js", "peerDependencies" : {}, - "devDependencies" : {}, "bugs" : {}, "files" : [ "dist/", @@ -22,24 +35,11 @@ "README.md", "package.json" ], - "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-leaflet.html", - "keywords" : [ - "geoportail", - "plugin", - "javascript", - "leaflet", - "publish" - ], - "module" : "src/Leaflet/index.js", + "devDependencies" : {}, "scripts" : {}, - "bundleDependencies" : [], - "description" : "French Geoportal Extension for Leaflet", - "main" : "dist/GpPluginLeaflet-src.js", - "repository" : { - "type" : "git", - "url" : "https://github.com/IGNF/geoportal-extensions.git" - }, - "date" : "23/03/2022", "version" : "2.2.4", - "license" : "CECILL-B" + "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-leaflet.html", + "main" : "dist/GpPluginLeaflet-src.js", + "bundleDependencies" : [], + "description" : "French Geoportal Extension for Leaflet" } diff --git a/build/scripts/release/package-openlayers.json b/build/scripts/release/package-openlayers.json index 2ffc183b8..f62567e73 100644 --- a/build/scripts/release/package-openlayers.json +++ b/build/scripts/release/package-openlayers.json @@ -1,26 +1,31 @@ { + "module" : "src/OpenLayers/index.js", "repository" : { - "url" : "https://github.com/IGNF/geoportal-extensions.git", - "type" : "git" + "type" : "git", + "url" : "https://github.com/IGNF/geoportal-extensions.git" }, "author" : "IGNF", - "date" : "23/03/2022", - "module" : "src/OpenLayers/index.js", - "bundleDependencies" : [], - "directories" : {}, - "peerDependencies" : {}, + "description" : "French Geoportal Extensions for OpenLayers", "dependencies" : { - "xmldom" : "^0.1.27", "node-fetch" : "^2.6.1", - "proj4" : "2.7.2", + "@mapbox/mapbox-gl-style-spec" : "13.20.1", + "sortablejs" : "1.14.0", + "loglevel" : "1.6.6", "ol-mapbox-style" : "6.7.0", "ol" : "6.9.0", - "loglevel" : "1.6.6", + "proj4" : "2.7.5", + "xmldom" : "^0.1.27", "geoportal-access-lib" : "3.1.0", - "eventbusjs" : "0.2.0", - "sortablejs" : "1.14.0", - "@mapbox/mapbox-gl-style-spec" : "13.20.1" + "eventbusjs" : "0.2.0" }, + "main" : "dist/GpPluginOpenLayers-src.js", + "keywords" : [ + "geoportail", + "plugin", + "javascript", + "OpenLayers" + ], + "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-openlayers.html", "files" : [ "dist/", "src/", @@ -28,19 +33,14 @@ "README.md", "package.json" ], + "bundleDependencies" : [], + "date" : "31/03/2022", "devDependencies" : {}, + "bugs" : {}, + "peerDependencies" : {}, + "directories" : {}, "name" : "geoportal-extensions-openlayers", - "keywords" : [ - "geoportail", - "plugin", - "javascript", - "OpenLayers" - ], - "description" : "French Geoportal Extensions for OpenLayers", "scripts" : {}, - "homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-openlayers.html", - "main" : "dist/GpPluginOpenLayers-src.js", - "bugs" : {}, - "version" : "3.2.10", + "version" : "3.2.11", "license" : "CECILL-B" } diff --git a/build/webpack/webpack.config.itowns.js b/build/webpack/webpack.config.itowns.js index fdb7d8882..d6b475617 100644 --- a/build/webpack/webpack.config.itowns.js +++ b/build/webpack/webpack.config.itowns.js @@ -342,8 +342,7 @@ module.exports = (env, argv) => { new CopyWebpackPlugin([ { from : path.join(ROOT, "samples-src", "resources", "**/*"), - to : path.join(ROOT, "samples", "resources"), - context : path.join(ROOT, "samples-src", "resources") + to : path.join(ROOT, "samples", "resources") } ]) ] diff --git a/build/webpack/webpack.config.leaflet.js b/build/webpack/webpack.config.leaflet.js index ba915104d..d9821752a 100644 --- a/build/webpack/webpack.config.leaflet.js +++ b/build/webpack/webpack.config.leaflet.js @@ -314,8 +314,7 @@ module.exports = (env, argv) => { new CopyWebpackPlugin([ { from : path.join(ROOT, "samples-src", "resources", "**/*"), - to : path.join(ROOT, "samples", "resources"), - context : path.join(ROOT, "samples-src", "resources") + to : path.join(ROOT, "samples", "resources") } ]) ] diff --git a/build/webpack/webpack.config.openlayers.js b/build/webpack/webpack.config.openlayers.js index b88ed71ef..4d06840cf 100644 --- a/build/webpack/webpack.config.openlayers.js +++ b/build/webpack/webpack.config.openlayers.js @@ -169,11 +169,15 @@ module.exports = (env, argv) => { host : "localhost", https: true, port : 9001, + headers: { + 'Cache-Control': 'no-store' + }, hot : true, contentBase : path.join(__dirname), // publicPath : "/dist/openlayers/", // openPage : "/samples/index-openlayers-map.html", open : "google-chrome", + watchContentBase: true, watchOptions : { watch : true, poll : true @@ -481,10 +485,32 @@ module.exports = (env, argv) => { new CopyWebpackPlugin([ { from : path.join(ROOT, "samples-src", "resources", "**/*"), - to : path.join(ROOT, "samples", "resources"), - context : path.join(ROOT, "samples-src", "resources") + to : path.join(ROOT, "samples", "resources") + // context : path.join(ROOT, "samples-src", "resources"), + // force: true } - ]) + ]), + // FIXME les ressources exemples ne sont pas prises en compte dans le mode watch !? + // { + // apply: (compiler) => { + // compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => { + // // Debugging + // console.log("########-------------->>>>> Finished Copy Compile <<<<<------------#######"); + + // let source = path.join(ROOT, "samples-src", "resources"); + // let destination = path.join(ROOT, "samples", "resources"); + + // let options = { + // overwrite: true + // }; + // fs.copy(source, destination, options, err => { + // if (err) return console.error(err); { + // console.log('Copy resources success!'); + // } + // }) + // }); + // } + // } ] /** AJOUT DES LICENCES */ .concat([ diff --git a/doc/CHANGELOG-leaflet.md b/doc/CHANGELOG-leaflet.md index 28240c41c..ccec0d63d 100644 --- a/doc/CHANGELOG-leaflet.md +++ b/doc/CHANGELOG-leaflet.md @@ -72,6 +72,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Extension Geoportail Leaflet, version 2.2.3](#extension-geoportail-leaflet-version-223) * [Summary](#summary-20) * [Changelog](#changelog-17) +- [Extension Geoportail Leaflet, version 2.2.4](#extension-geoportail-leaflet-version-224) + * [Summary](#summary-21) + * [Changelog](#changelog-18) @@ -639,3 +642,27 @@ Corrections sur l'interface d'ajout des couches WMS/WMTS * [Security] --- +# Extension Geoportail Leaflet, version 2.2.4 + +**23/03/2022** +> Release Extension Geoportail leaflet + +## Summary + +## Changelog + +* [Added] + +* [Changed] + + - utilisation du service isochrone v2, access-lib 3.1.0 (#326) + +* [Deprecated] + +* [Removed] + +* [Fixed] + +* [Security] + +--- diff --git a/doc/CHANGELOG-openlayers.md b/doc/CHANGELOG-openlayers.md index 6bcd83be2..c92ea728d 100644 --- a/doc/CHANGELOG-openlayers.md +++ b/doc/CHANGELOG-openlayers.md @@ -115,6 +115,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Extension Geoportail OpenLayers, version 3.2.9](#extension-geoportail-openlayers-version-329) * [Summary](#summary-33) * [Changelog](#changelog-30) +- [Extension Geoportail OpenLayers, version 3.2.10](#extension-geoportail-openlayers-version-3210) + * [Summary](#summary-34) + * [Changelog](#changelog-31) @@ -1262,3 +1265,28 @@ Evolution de la documentation et correction du layerswitcher * [Security] --- +# Extension Geoportail OpenLayers, version 3.2.10 + +**23/03/2022** +> Release Extension Geoportail openlayers + +## Summary + +## Changelog + +* [Added] + +* [Changed] + + - DOM widget d'import : "Tuiles vectorielles" au lieu de "Vecteur tuilé" + - utilisation du service isochrone v2, access-lib 3.1.0 (#326) + +* [Deprecated] + +* [Removed] + +* [Fixed] + +* [Security] + +--- diff --git a/doc/README-itowns.md b/doc/README-itowns.md index 9e757d412..ce8b8d174 100644 --- a/doc/README-itowns.md +++ b/doc/README-itowns.md @@ -1,6 +1,6 @@ # Extension Géoportail pour iTowns -[![release](https://img.shields.io/badge/release%20-itowns%202.3.5-brightgreen.svg?style=flat)](https://github.com/IGNF/geoportal-extensions/releases/tag/itowns-2.3.5) +[![release](https://img.shields.io/badge/release%20-itowns%202.3.6-brightgreen.svg?style=flat)](https://github.com/IGNF/geoportal-extensions/releases/tag/itowns-2.3.6) @@ -50,9 +50,10 @@ - [Affichage d'une échelle graphique](#affichage-dune-échelle-graphique) - [Exemples d'utilisation](#exemples-dutilisation-4) - [Utilisation simple](#utilisation-simple-4) - - [Widget d'exageration du relief](#widget-exageration-relief) + - [Widget d'éxagération du relief](#widget-déxagération-du-relief) - [Exemples d'utilisation](#exemples-dutilisation-5) - [Utilisation simple](#utilisation-simple-5) + - [Utilisation avancée](#utilisation-avancée) L'extension Géoportail pour iTowns étend la librairie 3D iTowns afin de proposer l'ajout de widgets au globe. Les fonctionnalités suivantes sont proposées en complément de la bibliothèque [iTowns](http://www.itowns-project.org/) : diff --git a/doc/README-leaflet.md b/doc/README-leaflet.md index 32f64971d..25e083bd2 100644 --- a/doc/README-leaflet.md +++ b/doc/README-leaflet.md @@ -1,6 +1,6 @@ # Extension Géoportail pour Leaflet -[![release](https://img.shields.io/badge/release%20-leaflet%202.2.2-brightgreen.svg?style=flat)](https://github.com/IGNF/geoportal-extensions/releases/tag/leaflet-2.2.2) +[![release](https://img.shields.io/badge/release%20-leaflet%202.2.4-brightgreen.svg?style=flat)](https://github.com/IGNF/geoportal-extensions/releases/tag/leaflet-2.2.4) diff --git a/doc/README-openlayers.md b/doc/README-openlayers.md index 025209fc5..3466f864b 100644 --- a/doc/README-openlayers.md +++ b/doc/README-openlayers.md @@ -1,6 +1,6 @@ # Extension Géoportail pour OpenLayers -[![release](https://img.shields.io/badge/release%20-ol%203.2.8-brightgreen.svg?style=flat)](https://github.com/IGNF/geoportal-extensions/releases/tag/ol-3.2.8) +[![release](https://img.shields.io/badge/release%20-ol%203.2.11-brightgreen.svg?style=flat)](https://github.com/IGNF/geoportal-extensions/releases/tag/ol-3.2.11) diff --git a/package.json b/package.json index 6e7f075f9..995cd3613 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "geoportal-extensions", "description": "French Geoportal Extensions for OpenLayers, Leaflet and iTowns libraries", - "version": "2.6.11", - "date": "23/03/2022", + "version": "2.6.12", + "date": "31/03/2022", "leafletExtName": "French Geoportal Extension for Leaflet", "leafletExtVersion": "2.2.4", "olExtName": "French Geoportal Extension for OpenLayers", - "olExtVersion": "3.2.10", + "olExtVersion": "3.2.11", "itownsExtName": "French Geoportal Extension for Itowns", "itownsExtVersion": "2.3.6", "main": "dist/leaflet/GpPluginLeaflet.js, dist/openlayers/GpPluginOpenLayers.js, dist/itowns/GpPluginItowns.js", diff --git a/samples-src/pages/openlayers/Drawing/pages-ol-drawing-bundle-addlayer.html b/samples-src/pages/openlayers/Drawing/pages-ol-drawing-bundle-addlayer.html new file mode 100644 index 000000000..9a8cd478c --- /dev/null +++ b/samples-src/pages/openlayers/Drawing/pages-ol-drawing-bundle-addlayer.html @@ -0,0 +1,99 @@ +{{#extend "ol-sample-bundle-layout"}} + +{{#content "head"}} + Sample OpenLayers Drawing +{{/content}} + +{{#content "style"}} + +{{/content}} + +{{#content "body"}} +

Ajout des outils de dessin

+ +
+ + + +{{/content}} + +{{#content "js"}} + +{{/content}} + +{{/extend}} diff --git a/samples-src/pages/openlayers/Formats/pages-ol-geojsonextended-bundle-default.html b/samples-src/pages/openlayers/Formats/pages-ol-geojsonextended-bundle-default.html index f7eccb45b..045021a42 100644 --- a/samples-src/pages/openlayers/Formats/pages-ol-geojsonextended-bundle-default.html +++ b/samples-src/pages/openlayers/Formats/pages-ol-geojsonextended-bundle-default.html @@ -34,25 +34,56 @@

Ajout d'une couche GeoJSON

var _url = location.href.substring(0, location.href.lastIndexOf('/')) + "/../../resources/data/geojson/map.geojson"; + // 2 méthodes pour le style par defaut : + // - fonction de style vai option.style de ol.layer.Vector + // - style via option.defaultStyle de ol.format.GeoJSONExtended + + // FIXME : + // via la fonction, ça ne marche pas !? var defaultStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: [250,250,0,1] + color: [0,0,0,1] }), stroke: new ol.style.Stroke({ color: [125,125,0,1], width: 2 + }), + image: new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S4ZrA7tkxn/A5R8rRVFOAHjJjcZiGIZxsrW19U0hRCDAXDVHFPAxk24IHwB4Pea8LoRJRJp/bm624fr1qW7AuM93ayYM4CKAqCsXADRNm9qze/eRycnJe3Y5zGQQQ/UK/n1MVVVXbwCJRKIA4BUs2h0ZMDMfP3bseydGAICIPRC8QQdejUajUVdmACCRSAwAOOhGQxkcHPj53DnVhQR5THO9azMAMDMzsxeA5Vi/FO7cvn2js6PjVzf5TcA0hMiWxcy2bdt0AC/DxhC6GLquz3/W2XlK0zT5NmUukcdzWlXVm2UxAwCJRCJLRG1OOD/29Z29NDp6RzIlM3AlYBifZ7PZS0AFHs4VRekC0GoVN6GqY3va2r6WSKEx8yi83qFsNvu/D7fjBw0beKNUKm33+/2rlwu4p2mz7e3tZ+wKMpMO4gwLka6trb3S39+vLxVX9pMBgN7e3pbq6urvltHn40ePnuw5c+baShrMNC9g5kiItOnxjGUymTmrvBUxAwA9PT0nampqHpoOLo6M/HFg//6+ZWgaiMYFcNUXCl1Jp9MlJzkr0WYAgFAo9Nr09PTzq1atqr3/W6FQ+OfTw4d/WhzHQBHM17xCXG5MJDLd3d3SN1vFTgYAksnklng8/psQwqfrunH40KEvFEW5BaAAoowHuPpiLnftA8CsZB1lQzKZ/Oj8+fPawU8OJuN1ddvj8fh6VHgTHwn8B/S71Ufd4vUbAAAAAElFTkSuQmCC", + anchor: [17,48], + anchorOrigin : "top-left", + anchorXUnits : "pixels", + anchorYUnits : "pixels" }) }); - var _styleFunction = function (feature, resolution) { - return [defaultStyle]; - }; layer = new ol.layer.Vector({ source : new ol.source.Vector({ url: _url, - format: new ol.format.GeoJSONExtended() + format: new ol.format.GeoJSONExtended( + { + defaultStyle: new ol.style.Style({ + fill: new ol.style.Fill({ + color: [250,250,0,1] + }), + stroke: new ol.style.Stroke({ + color: [0,0,255,1], + width: 5 + }), + image: new ol.style.Icon({ + src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAsCAYAAAAATWqyAAAA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2Q0gzagnh/vdmVffmKXTyzK/Kvb+ivuACp0AzhDRIqZ6HK23Z6KtK0Hyjh6q/blZNkHAPfdBXDeACp0ADVks91hWbW25aBOei6tN5rqlD2v97t8dR2pbg+Qg6bZqlK3910xffX7NpPYFLXtNSxi+mEhlTEZ6msOoc9QyO2bQOcO4E+szlpD2D45rni4xA3tZ1FTvkuPQ5H3rF8vY9jlnFjbKdSTYvSBDf7h2RzFYRADiECJPgnstHWFEbFydQz4wLoZyHwlctH8HY4BA4IbgtUkXMMb47opG5l3x0weEJEnKXmte2y4EM+UYSCxlXZmgkGl7AdKHj4YJ0u84WW84ejClEILYXyCIshAgxTVwckbdXYU68w4RgrOhQH/nyLeZqtshllvDB58RFKZHNjqWkyIAVi0iOCpDGEviBrWpRUrU44ukQrfayDSD6VT6XRp7uLssW4cW+lXvS5Kjdj7EFB2nNCMR0Iq6g7u/lRq/vSlm2kHL29eMxBIp47K6l+umtnwW601zUor41PpTyFiKhzchPj5B8BWp5zDPW+mpti3K266iUchDatMHTZhFhAV706kKW/ifbAbX+qkLE9ipAEHV1NtCbBRma2bmc7R9+Pp3gA1+xVe8uW4gQgyB3CPXIkPX00uOJmkKKdiRKfQUO8Ri/afnYGrE+ZDuPyu5HYiglJshqR9zblRUzf1gLX3KIEPEfA1u6F9cHn01V5hLzQBvuCaBvofIfiCNmBGKQ6eyXf01V7E61yOhQhwjck7/HhA85VIgQgyTqJOoZ9wdLn5cyUE+PDVaeqvW0muBT2sh2Ff8up6ZnzMXV30mGugDuGWktwEQJbBNg7bgzJJkA2hJoLcGEZUv84C2jtYb4I32MbVTYMVv+MFvD/wIMAMn6dBKfJSmUAAAAAElFTkSuQmCC", + anchor: [17,48], + anchorOrigin : "top-left", + anchorXUnits : "pixels", + anchorYUnits : "pixels" + }) + }) + } + ) }), - style: _styleFunction + style: function (feature, resolution) { + return [defaultStyle]; + } }); map = new ol.Map({ @@ -91,9 +122,14 @@

Ajout d'une couche GeoJSON

var coord = evt.coordinate; var props = feature.getProperties(); var contents = ""; + var length = "30"; for (var key in props) { if (props.hasOwnProperty(key)) { - contents += key + " / " + props[key]; + var value = props[key]; + if (typeof value === "string") { + value = props[key].substring(0, length); + } + contents += key + " / " + value; contents += "
"; } } diff --git a/samples-src/pages/openlayers/Formats/pages-ol-gpxextended-bundle-default.html b/samples-src/pages/openlayers/Formats/pages-ol-gpxextended-bundle-default.html index 6984247ef..5dd10f2e8 100644 --- a/samples-src/pages/openlayers/Formats/pages-ol-gpxextended-bundle-default.html +++ b/samples-src/pages/openlayers/Formats/pages-ol-gpxextended-bundle-default.html @@ -95,9 +95,14 @@

Ajout d'une couche GPX

var coord = evt.coordinate; var props = feature.getProperties(); var contents = ""; + var length = "30"; for (var key in props) { if (props.hasOwnProperty(key)) { - contents += key + " / " + props[key]; + var value = props[key]; + if (typeof value === "string") { + value = props[key].substring(0, length); + } + contents += key + " / " + value; contents += "
"; } } diff --git a/samples-src/pages/openlayers/LayerImport/pages-ol-layerimport-bundle-default.html b/samples-src/pages/openlayers/LayerImport/pages-ol-layerimport-bundle-default.html index 1e314b4eb..eb1049934 100644 --- a/samples-src/pages/openlayers/LayerImport/pages-ol-layerimport-bundle-default.html +++ b/samples-src/pages/openlayers/LayerImport/pages-ol-layerimport-bundle-default.html @@ -73,11 +73,16 @@

Ajout du widget d'import de couches, avec les options par défaut

var coord = evt.coordinate; var props = feature.getProperties(); var contents = ""; + var length = "30"; for (var key in props) { - if (props.hasOwnProperty(key)) { - contents += key + " / " + props[key]; - contents += "
"; + if (props.hasOwnProperty(key)) { + var value = props[key]; + if (typeof value === "string") { + value = props[key].substring(0, length); } + contents += key + " / " + value; + contents += "
"; + } } // Offset the popup so it points at the middle of the marker not the tip popup.setOffset([0, -22]); diff --git a/samples-src/resources/data/geojson/map.geojson b/samples-src/resources/data/geojson/map.geojson index b27bb64b2..7ec5ed13e 100644 --- a/samples-src/resources/data/geojson/map.geojson +++ b/samples-src/resources/data/geojson/map.geojson @@ -1,18 +1,7 @@ { "type": "FeatureCollection", - "features": [{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "LineString", - "coordinates": [ - [85.42962178587914, 65.94648052208719], - [85.42975589632988, 65.94651441253684], - [85.42987659573555, 65.94644061875823], - [85.42973712086678, 65.94642695322028] - ] - } - }, { + "features": [ + { "type": "Feature", "properties": { "stroke": "#99229b", @@ -62,26 +51,6 @@ }, { "type": "Feature", "properties": {}, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [2.424545288085937, 48.853646831055556], - [2.424545288085937, 48.85387273165654], - [2.424545288085937, 48.85387273165654], - [2.424545288085937, 48.853646831055556] - ] - ] - } - }, { - "type": "Feature", - "properties": { - "stroke": "#555555", - "stroke-width": 2, - "stroke-opacity": 10, - "fill": "#dd2727", - "fill-opacity": 0.5 - }, "geometry": { "type": "Polygon", "coordinates": [ @@ -99,7 +68,7 @@ "properties": { "marker-color": "#d41616", "marker-size": "small", - "marker-symbol": "" + "marker-symbol": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAmCAYAAABpuqMCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAToSURBVFiF3VhdbFNlGH7ec05/F6IUE9GLIYgXXYpXJBBZE0xM9EausIl6ObzBGSHRdnEJ1p+RhnBBNF4YY/xJFigNaIwxLpFYB2WwMWCW0bG1W7eEdUBwQ0fb7fy83nQJjK3nnO90F/okvTnf+7zP+/Q75/ve7wP+R6BGJ4xGo+skSXqFmfcAaAHwFIANAO4CmCai64Zh/OT3+3+Nx+PzjdRumJmOjo71zNwB4B0APguUMjN/vri4mDh27NhcI2poiJloNLqXiL4EEBCg/8XMbx05cuS00zpkh3yKxWKHiOgLAH7BHD4iiuzatcvIZDJnnRTjyEw0Gv2QiD6C8xkmInqxtbVVy2QyvcJJRIm1V+ukkxwrwCCivYlE4gcRslAhBw4ceNzj8RQg9o2YYZa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YKZUupDp7e1ZhVYB0bgEjLr8/tzw8PCiHc2Gv2ZLmJ+fb1MUpdXj8TQvPatWq3f6+/rOPBjHQBnMY4okXX9++/Z8KpUSXtnWbGYAYN++fTsDgUAvEbkMw9AvnDv3ValUugXgHojyMjD6+sTEWBwwGqG3pmYAoK2t7ZNAIPDe1OTUqSuXBr6FouRGR0enAfBaa/+n8S8PPeWMetb8+wAAAABJRU5ErkJggg==" }, "geometry": { "type": "Point", @@ -110,7 +79,7 @@ "properties": { "marker-color": "#2a13d8", "marker-size": "medium", - "marker-symbol": "" + "marker-symbol": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAmCAYAAABpuqMCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAToSURBVFiF3VhdbFNlGH7ec05/F6IUE9GLIYgXXYpXJBBZE0xM9EausIl6ObzBGSHRdnEJ1p+RhnBBNF4YY/xJFigNaIwxLpFYB2WwMWCW0bG1W7eEdUBwQ0fb7fy83nQJjK3nnO90F/okvTnf+7zP+/Q75/ve7wP+R6BGJ4xGo+skSXqFmfcAaAHwFIANAO4CmCai64Zh/OT3+3+Nx+PzjdRumJmOjo71zNwB4B0APguUMjN/vri4mDh27NhcI2poiJloNLqXiL4EEBCg/8XMbx05cuS00zpkh3yKxWKHiOgLAH7BHD4iiuzatcvIZDJnnRTjyEw0Gv2QiD6C8xkmInqxtbVVy2QyvcJJRIm1V+ukkxwrwCCivYlE4gcRslAhBw4ceNzj8RQg9o2YYZaInk0kErN2iZKImtvt/gBrYwQA1gN4X4Roe2ai0eg6IroFa8uvKMo+n+9Ju/uQYleltiGaGnG73eVIJNIfDAa3yLK8Udf1mVwuN55MJneoqmrG91er1ZcBnLJVm51gAKjt7HXhdrvLnZ2d46FQaLcsy80A3LIsN4dCod2dnZ15l8tVaYTOcoh8M0GzgEgk0u/xeEIrjXm93m2R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8S8PPeWMetb8+wAAAABJRU5ErkJggg==" }, "geometry": { "type": "Point", @@ -121,11 +90,51 @@ "properties": { "marker-color": "#7e7e7e", "marker-size": "large", - "marker-symbol": "" + "marker-symbol": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAmCAYAAABpuqMCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAToSURBVFiF3VhdbFNlGH7ec05/F6IUE9GLIYgXXYpXJBBZE0xM9EausIl6ObzBGSHRdnEJ1p+RhnBBNF4YY/xJFigNaIwxLpFYB2WwMWCW0bG1W7eEdUBwQ0fb7fy83nQJjK3nnO90F/okvTnf+7zP+/Q75/ve7wP+R6BGJ4xGo+skSXqFmfcAaAHwFIANAO4CmCai64Zh/OT3+3+Nx+PzjdRumJmOjo71zNwB4B0APguUMjN/vri4mDh27NhcI2poiJloNLqXiL4EEBCg/8XMbx05cuS00zpkh3yKxWKHiOgLAH7BHD4iiuzatcvIZDJnnRTjyEw0Gv2QiD6C8xkmInqxtbVVy2QyvcJJRIm1V+ukkxwrwCCivYlE4gcRslAhBw4ceNzj8RQg9o2YYZaInk0kErN2iZKImtvt/gBrYwQA1gN4X4Roe2ai0eg6IroFa8uvKMo+n+9Ju/uQYleltiGaGnG73eVIJNIfDAa3yLK8Udf1mVwuN55MJneoqmrG91er1ZcBnLJVm51gAKjt7HXhdrvLnZ2d46FQaLcsy80A3LIsN4dCod2dnZ15l8tVaYTOcoh8M0GzgEgk0u/xeEIrjXm93m2RSOSiBZ0Wu4WJmHnaLCAYDG6pN97S0rK5ETrLIWJmg1mALMsbnYzX8ITlimoQMfOPWYCu6zMm4yULOn9brqgGETO3zAJyudx4vfFr164VzXIwc90/ZCWImOk3C0gmkzuq1Wp2pbFyuZxNpVI7zXIQkanOcoiY+d0sQFVVX1dX19ZsNpvWdX0SwKKu65NDQ0Ppw4cPP6dpmtcsBzOn7RZme9P0+XynK5XKZwAeqxenqqqvu7t79wOPNtV+VnDPMAzb5xvbM1NrMb6xy7OJr48ePXrfLkmo0SSijwHcFuFawG0i+lSEKGSm1p4fFOFawEGR9h9weLCKxWLdAN5wkuNBMPPxEydOvC1JksfD7Fsg8riYSdMlFwAosqFqkmQQUcW9sHB/282bcylAX+LbXgCWYT+AFwA84zAPVFWdO9PTM+WWpHcBQCeCAoCJICsMAGAQZGaAGZrLhcubNutbGUVF4rMjxWLR8ZE3Fou1AkjDwX0CM/OVwcHvJwqFomgKDfjO6e0MMpnMVDgc9gIIi+YoTU+fyw4NXXFQBpFh3BFaAJbD6/UeAmClrX8ElXK5dOnixT+c6BuAoUtSoSFm4vG4ZhjGm7DQhD5UhGGoAwMDp1RV1c2jVwHzIsny6WKxOOP4NVvC+fPnZ8Ph8F0Ar1rlFPL5X8bHxuo2pXXADIx4df3kjcnJSWANLs5jsdhJAK+Zxd2bmxv5racnKSBRYeY/oSiDhULhoY3b6dL8CDRN209EL8myvH7VGFW9f6Gv72erOZlJA3GeJWm4ubk5l06ntZXiGj4zANDe3r6nqanpx1Xyc/bq1eOjN26M1cvBTKoEY4IkadiQ5ZF8Pr9gprsmZgCgvb29u6mp6ZHuYKZUupDp7e1ZhVYB0bgEjLr8/tzw8PCiHc2Gv2ZLmJ+fb1MUpdXj8TQvPatWq3f6+/rOPBjHQBnMY4okXX9++/Z8KpUSXtnWbGYAYN++fTsDgUAvEbkMw9AvnDv3ValUugXgHojyMjD6+sTEWBwwGqG3pmYAoK2t7ZNAIPDe1OTUqSuXBr6FouRGR0enAfBaa/+n8S8PPeWMetb8+wAAAABJRU5ErkJggg==" }, "geometry": { "type": "Point", "coordinates": [2.3953628540039062, 48.85613168160397] } - }] + }, { + "type": "Feature", + "properties": { + "marker-symbol": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAmCAYAAABpuqMCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcB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PVFWdO9PTM+WWpHcBQCeCAoCJICsMAGAQZGaAGZrLhcubNutbGUVF4rMjxWLR8ZE3Fou1AkjDwX0CM/OVwcHvJwqFomgKDfjO6e0MMpnMVDgc9gIIi+YoTU+fyw4NXXFQBpFh3BFaAJbD6/UeAmClrX8ElXK5dOnixT+c6BuAoUtSoSFm4vG4ZhjGm7DQhD5UhGGoAwMDp1RV1c2jVwHzIsny6WKxOOP4NVvC+fPnZ8Ph8F0Ar1rlFPL5X8bHxuo2pXXADIx4df3kjcnJSWANLs5jsdhJAK+Zxd2bmxv5racnKSBRYeY/oSiDhULhoY3b6dL8CDRN209EL8myvH7VGFW9f6Gv72erOZlJA3GeJWm4ubk5l06ntZXiGj4zANDe3r6nqanpx1Xyc/bq1eOjN26M1cvBTKoEY4IkadiQ5ZF8Pr9gprsmZgCgvb29u6mp6ZHuYKZUupDp7e1ZhVYB0bgEjLr8/tzw8PCiHc2Gv2ZLmJ+fb1MUpdXj8TQvPatWq3f6+/rOPBjHQBnMY4okXX9++/Z8KpUSXtnWbGYAYN++fTsDgUAvEbkMw9AvnDv3ValUugXgHojyMjD6+sTEWBwwGqG3pmYAoK2t7ZNAIPDe1OTUqSuXBr6FouRGR0enAfBaa/+n8S8PPeWMetb8+wAAAABJRU5ErkJggg==" + }, + "geometry": { + "type": "Point", + "coordinates": [2.3753628548039062, 48.89613168160397] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [2.3853628548039062, 48.89613168160397] + } + }, { + "type": "Feature", + "properties": { + "name": "Ceci est un label" + }, + "geometry": { + "type": "Point", + "coordinates": [2.3953628548039062, 48.89613168160397] + } + }, { + "type": "Feature", + "properties": { + "name": "Ceci est un cercle", + "stroke": "#000000", + "stroke-width": 1, + "stroke-opacity": 0.8, + "fill": "#a03737", + "fill-opacity": 0.5 + }, + "geometry": { + "type": "Point", + "coordinates": [2.4053628548039062, 48.89613168160397] + } + } + ] } \ No newline at end of file diff --git a/samples-src/resources/data/gpx/Campomoro-Tizzano-Sartene_3029.gpx b/samples-src/resources/data/gpx/Campomoro-Tizzano-Sartene_3029.gpx index ec83521b2..e69681c40 100644 --- a/samples-src/resources/data/gpx/Campomoro-Tizzano-Sartene_3029.gpx +++ b/samples-src/resources/data/gpx/Campomoro-Tizzano-Sartene_3029.gpx @@ -19,9 +19,7 @@ 21/08/2005 Waypoint - medium - - #ffffff + small @@ -56,6 +54,29 @@ #ffffff + + 5.000000 + Tivell2 + 21/08/2005 + 21/08/2005 + Waypoint + + #ff0000 + small + data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAmCAYAAABpuqMCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAToSURBVFiF3VhdbFNlGH7ec05/F6IUE9GLIYgXXYpXJBBZE0xM9EausIl6ObzBGSHRdnEJ1p+RhnBBNF4YY/xJFigNaIwxLpFYB2WwMWCW0bG1W7eEdUBwQ0fb7fy83nQJjK3nnO90F/okvTnf+7zP+/Q75/ve7wP+R6BGJ4xGo+skSXqFmfcAaAHwFIANAO4CmCai64Zh/OT3+3+Nx+PzjdRumJmOjo71zNwB4B0APguUMjN/vri4mDh27NhcI2poiJloNLqXiL4EEBCg/8XMbx05cuS00zpkh3yKxWKHiOgLAH7BHD4iiuzatcvIZDJnnRTjyEw0Gv2QiD6C8xkmInqxtbVVy2QyvcJJRIm1V+ukkxwrwCCivYlE4gcRslAhBw4ceNzj8RQg9o2YYZaInk0kErN2iZKImtvt/gBrYwQA1gN4X4Roe2ai0eg6IroFa8uvKMo+n+9Ju/uQYleltiGaGnG73eVIJNIfDAa3yLK8Udf1mVwuN55MJneoqmrG91er1ZcBnLJVm51gAKjt7HXhdrvLnZ2d46FQaLcsy80A3LIsN4dCod2dnZ15l8tVaYTOcoh8M0GzgEgk0u/xeEIrjXm93m2RSOSiBZ0Wu4WJmHnaLCAYDG6p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6xy7OJr48ePXrfLkmo0SSijwHcFuFawG0i+lSEKGSm1p4fFOFawEGR9h9weLCKxWLdAN5wkuNBMPPxEydOvC1JksfD7Fsg8riYSdMlFwAosqFqkmQQUcW9sHB/282bcylAX+LbXgCWYT+AFwA84zAPVFWdO9PTM+WWpHcBQCeCAoCJICsMAGAQZGaAGZrLhcubNutbGUVF4rMjxWLR8ZE3Fou1AkjDwX0CM/OVwcHvJwqFomgKDfjO6e0MMpnMVDgc9gIIi+YoTU+fyw4NXXFQBpFh3BFaAJbD6/UeAmClrX8ElXK5dOnixT+c6BuAoUtSoSFm4vG4ZhjGm7DQhD5UhGGoAwMDp1RV1c2jVwHzIsny6WKxOOP4NVvC+fPnZ8Ph8F0Ar1rlFPL5X8bHxuo2pXXADIx4df3kjcnJSWANLs5jsdhJAK+Zxd2bmxv5racnKSBRYeY/oSiDhULhoY3b6dL8CDRN209EL8myvH7VGFW9f6Gv72erOZlJA3GeJWm4ubk5l06ntZXiGj4zANDe3r6nqanpx1Xyc/bq1eOjN26M1cvBTKoEY4IkadiQ5ZF8Pr9gprsmZgCgvb29u6mp6ZHuYKZUupDp7e1ZhVYB0bgEjLr8/tzw8PCiHc2Gv2ZLmJ+fb1MUpdXj8TQvPatWq3f6+/rOPBjHQBnMY4okXX9++/Z8KpUSXtnWbGYAYN++fTsDgUAvEbkMw9AvnDv3ValUugXgHojyMjD6+sTEWBwwGqG3pmYAoK2t7ZNAIPDe1OTUqSuXBr6FouRGR0enAfBaa/+n8S8PPeWMetb8+wAAAABJRU5ErkJggg== + + circuit_litoral_montagne 1 @@ -987,7 +1008,184 @@ 13.000000 + + #ff0000 + 12 + 0.5 + + + circuit_litoral_montagne 2 + 1 + + + 5.000000 + + + 7.000000 + + + 17.000000 + + + 27.000000 + + + 28.000000 + + + 50.000000 + + + 61.000000 + + + 68.000000 + + + 91.000000 + + + 93.000000 + + + 111.000000 + + + 110.000000 + + + 115.000000 + + + 105.000000 + + + 106.000000 + + + 92.000000 + + + 80.000000 + + + 54.000000 + + + 34.000000 + + + 15.000000 + + + 32.000000 + + + 13.000000 + + + 15.000000 + + + 18.000000 + + + 14.000000 + + + 10.000000 + + + 15.000000 + + + 11.000000 + + + 26.000000 + + + 12.000000 + + + 13.000000 + + + 12.000000 + + + 14.000000 + + + 13.000000 + + + 15.000000 + + + 12.000000 + + + 18.000000 + + + 18.000000 + + + 5.000000 + + + 8.000000 + + + 9.000000 + + + 46.000000 + + + 29.000000 + + + 13.000000 + + + 7.000000 + + + 7.000000 + + + 26.000000 + + + 62.000000 + + + 66.000000 + + + 69.000000 + + + 67.000000 + + + 54.000000 + + + 44.000000 + + + 37.000000 + + + + #ff00ff + 3 + 1 + \ No newline at end of file diff --git a/src/Common/Controls/DrawingDOM.js b/src/Common/Controls/DrawingDOM.js index 0b0c900ba..5251150ec 100644 --- a/src/Common/Controls/DrawingDOM.js +++ b/src/Common/Controls/DrawingDOM.js @@ -414,8 +414,8 @@ var DrawingDOM = { * * @param {Object} options - toolId selected * @param {String} options.geomType - gemeotryType selected ("Point", "Line" or "Polygon") + * @param {Object} options.labels - values to title * @param {Object} options.initValues - values to init fields - * @param {String} options.initValues.markerSrc - marker URL for Points * @param {Function} options.applyFunc - function called when apply is selected * @returns {DOMElement} DOM element created */ @@ -435,6 +435,28 @@ var DrawingDOM = { defaultValue : options.initValues.markerSrc }); ul.appendChild(li); + li = this._createStylingElement({ + type : "range", + className : "gp-styling-option", + label : this.options.labels.markerSize, + title : "petit, moyen ou grand", + id : this._addUID("markerSize"), + min : 5, + max : 15, + step : 5, + defaultValue : options.initValues.markerSize * 10 + }); + ul.appendChild(li); + if (options.initValues.markerCustom) { + li = this._createStylingElement({ + type : "color", + className : "gp-styling-option", + label : this.options.labels.markerColor, + id : this._addUID("markerColor"), + defaultValue : options.initValues.markerColor + }); + ul.appendChild(li); + } break; case "text": li = this._createStylingElement({ diff --git a/src/OpenLayers/Controls/Drawing.js b/src/OpenLayers/Controls/Drawing.js index 7485e33b8..8153923e1 100644 --- a/src/OpenLayers/Controls/Drawing.js +++ b/src/OpenLayers/Controls/Drawing.js @@ -105,6 +105,7 @@ var logger = Logger.getLogger("Drawing"); * @param {String} [options.labels.strokeWidth] - Label for stroke width. * @param {String} [options.labels.fillColor] - Label for fill color. * @param {String} [options.labels.fillOpacity] - Label for fillOpacity. + * @param {String} [options.labels.markerSize] - Label for markerSize. * @param {Array.} [options.markersList = [{"src" : "data:image/png;base64,xxxx", "anchor" : [0.5,1]}]] - List of markers src to be used for points with their anchor offsets See {@link http://openlayers.org/en/latest/apidoc/ol.style.Icon.html OpenLayers params} for anchor offset options. * @param {Object} options.defaultStyles - Default styles applying to geometries (labels, lines and polygons). * @param {String} [options.defaultStyles.textFillColor = "#000000"] - Text fill color for labels (RGB hex value). @@ -230,7 +231,9 @@ var Drawing = (function (Control) { strokeColor : "Couleur du trait : ", strokeWidth : "Epaisseur du trait : ", fillColor : "Couleur de remplissage : ", - fillOpacity : "Opacité du remplissage : " + fillOpacity : "Opacité du remplissage : ", + markerSize : "Taille du pictogramme : ", + markerColor : "Couleur du pictogramme : " }; /** @@ -251,7 +254,9 @@ var Drawing = (function (Control) { polyStrokeColor : "#ffcc33", polyStrokeWidth : 4, strokeColor : "#ffcc33", - strokeWidth : 4 + strokeWidth : 4, + markerSize : 1, + markerColor : "#ffcc33" }; /** @@ -493,7 +498,7 @@ var Drawing = (function (Control) { Drawing.prototype._getsMarkersOptionsFromSrc = function (src) { var markerOptions = null; for (var i = 0; i < this.options.markersList.length; i++) { - if (this.options.markersList[i].src === src) { + if (src && this.options.markersList[i].src === src) { markerOptions = this.options.markersList[i]; return markerOptions; } @@ -514,6 +519,8 @@ var Drawing = (function (Control) { switch (key) { case "src": case "size": + case "scale": + case "color": case "anchor": case "anchorOrigin": case "anchorXUnits": @@ -697,6 +704,15 @@ var Drawing = (function (Control) { } this.options.defaultStyles[key] = intValue; } + if (key === "markerSize") { + var floatValue = parseFloat(options.defaultStyles[key]); + if (isNaN(floatValue) || floatValue < 0) { + logger.log("Wrong value (" + options.defaultStyles[key] + ") for defaultStyles.markerSize. Must be a positive value."); + this.options.defaultStyles[key] = Drawing.DefaultStyles[key]; + return; + } + this.options.defaultStyles[key] = floatValue; + } }); this.interactionCurrent = null; @@ -1114,9 +1130,31 @@ var Drawing = (function (Control) { geomType = "Point"; if (style.getImage().getSrc()) { initValues.markerSrc = style.getImage().getSrc(); + initValues.markerSize = style.getImage().getScale() || 1; + initValues.markerAnchor = style.getImage().getAnchor(); + if (style.getImage().getColor()) { + valuesColor = style.getImage().getColor(); + if (Array.isArray(valuesColor)) { // FIXME Array !? + valuesColor = "rgba(" + valuesColor.join() + ")"; + } else { + initValues.markerColor = valuesColor; + } + hexColor = Color.isRGB(valuesColor) ? Color.rgbaToHex(valuesColor) : { + hex : valuesColor, + opacity : 1 + }; + initValues.markerColor = hexColor.hex; + initValues.markerOpacity = hexColor.opacity; + } else { + initValues.markerColor = this.options.markersList[0].color || "#ffffff"; + } } else { initValues.markerSrc = this.options.markersList[0].src; + initValues.markerSize = this.options.markersList[0].scale || 1; + initValues.markerColor = this.options.markersList[0].color || "#ffffff"; + initValues.markerAnchor = this.options.markersList[0].anchor; } + initValues.markerCustom = !(this._getsMarkersOptionsFromSrc(initValues.markerSrc)); } } else if (geom instanceof LineString || geom instanceof MultiLineString) { geomType = "Line"; @@ -1204,6 +1242,8 @@ var Drawing = (function (Control) { var fillOpacityElem = document.getElementById(dtObj._addUID("fillOpacity")); var strokeColorElem = document.getElementById(dtObj._addUID("strokeColor")); var strokeWidthElem = document.getElementById(dtObj._addUID("strokeWidth")); + var markerSizeElem = document.getElementById(dtObj._addUID("markerSize")); + var markerColorElem = document.getElementById(dtObj._addUID("markerColor")); switch (geomType.toLowerCase()) { case "text": if (setDefault) { @@ -1227,8 +1267,18 @@ var Drawing = (function (Control) { } break; case "point": - var markerSelected = dtObj._getsMarkersOptionsFromSrc(document.querySelector("input[name='marker']:checked").value); + // FIXME cas où le marker n'est pas dans la liste ? + // si le marker n'existe pas dans le liste, on ne souhaite donc que changer la couleur du + // pictogramme ou la taille..., on garde donc le picto initial. + var markerSelected = null; + var scale = parseInt(markerSizeElem.value, 10) / 10; + var markerChecked = document.querySelector("input[name='marker']:checked"); + if (markerChecked) { + markerSelected = dtObj._getsMarkersOptionsFromSrc(markerChecked.value); + markerSelected.scale = scale; + } if (setDefault) { + dtObj.options.defaultStyles.markerSize = scale; if (dtObj.options.markersList.length > 1) { // index du marker dans la liste des markers var idxMarker = dtObj.options.markersList.findIndex(function (mrk) { @@ -1245,9 +1295,24 @@ var Drawing = (function (Control) { } } } else { - seEv.selected[0].setStyle(new Style({ - image : new Icon(dtObj._getIconStyleOptions(markerSelected)) - })); + if (markerSelected) { + seEv.selected[0].setStyle(new Style({ + image : new Icon(dtObj._getIconStyleOptions(markerSelected)) + })); + } else { + // FIXME anchor !? + seEv.selected[0].setStyle(new Style({ + image : new Icon({ + src : initValues.markerSrc, // on garde le pictogramme initial ! + color : markerColorElem.value, // on recupère la couleur ! + anchor : initValues.markerAnchor, // on garde la position initial ! + anchorOrigin : "top-left", + anchorXUnits : "pixels", + anchorYUnits : "pixels", + scale : scale + }) + })); + } } break; case "line": diff --git a/src/OpenLayers/Controls/LayerImport.js b/src/OpenLayers/Controls/LayerImport.js index 4dfc25e8b..1e3567543 100644 --- a/src/OpenLayers/Controls/LayerImport.js +++ b/src/OpenLayers/Controls/LayerImport.js @@ -317,6 +317,15 @@ var LayerImport = (function (Control) { return this.contentService; }; + /** + * Returns layer name + * + * @returns {String} name - layer name + */ + LayerImport.prototype.getName = function () { + return this._name; + }; + // ################################################################### // // ##################### init component ############################## // // ################################################################### // @@ -491,6 +500,7 @@ var LayerImport = (function (Control) { this.contentStatic = null; this._url = null; this._file = null; + this._name = null; }; /** @@ -907,8 +917,6 @@ var LayerImport = (function (Control) { * @private */ LayerImport.prototype._importStaticLayerFromUrl = function (layerName) { - layerName = layerName || ""; - // 1. Récupération de l'url var url = this._staticUrlImportInput.value; logger.log("url : ", url); @@ -924,6 +932,14 @@ var LayerImport = (function (Control) { // sauvegarde this._url = url; + // si le nom n'est pas renseigné, on extrait le nom du fichier + if (!layerName) { + layerName = this._url.substring(this._url.lastIndexOf("/") + 1, this._url.lastIndexOf(".")); + } + + // sauvegarde + this._name = layerName; + // 2. récupération proxy if (!this.options.webServicesOptions || (!this.options.webServicesOptions.proxyUrl && !this.options.webServicesOptions.noProxyDomains)) { logger.error("[ol.control.LayerImport] options.webServicesOptions.proxyUrl parameter is mandatory to request resources on another domain (cross-domain)"); @@ -972,6 +988,14 @@ var LayerImport = (function (Control) { // sauvegarde this._file = file; + // si le nom n'est pas renseigné, on extrait le nom du fichier + if (!layerName) { + layerName = this._file.name.substring(this._file.name.lastIndexOf("/") + 1, this._file.name.lastIndexOf(".")); + } + + // sauvegarde + this._name = layerName; + // Création d'un objet FileReader qui permet de lire le contenu du fichier chargé var fReader = new FileReader(); @@ -1475,16 +1499,7 @@ var LayerImport = (function (Control) { logger.trace(vectorSource); // ajout des informations pour le layerSwitcher (titre, description) - if (layerName) { - vectorSource._title = vectorSource._description = layerName; - } else { - if (vectorFormat.readName && vectorFormat.readName(fileContent)) { - vectorSource._title = vectorSource._description = vectorFormat.readName(fileContent); - } else { - vectorSource._title = vectorSource._description = "Import " + this._currentImportType; - logger.log("[ol.control.LayerImport] set default name \"Import " + this._currentImportType + "\""); - } - } + vectorSource._title = vectorSource._description = layerName; vectorLayer = new VectorLayer({ source : vectorSource, @@ -1583,11 +1598,7 @@ var LayerImport = (function (Control) { } // ajout des informations pour le layerSwitcher (titre, description) - if (layerName) { - vectorSource._title = vectorSource._description = layerName; - } else { - vectorSource._title = vectorSource._description = "Import " + this._currentImportType; - } + vectorSource._title = vectorSource._description = layerName; vectorLayer = new VectorLayer({ source : vectorSource diff --git a/src/OpenLayers/Formats/GeoJSON.js b/src/OpenLayers/Formats/GeoJSON.js index 1ae5cfdc9..fd977d0c2 100644 --- a/src/OpenLayers/Formats/GeoJSON.js +++ b/src/OpenLayers/Formats/GeoJSON.js @@ -87,9 +87,9 @@ var GeoJSON = (function (olGeoJSON) { var options = {}; // properties : - // "marker-size" -> icon - // "marker-symbol" -> icon -> - // "marker-color" -> icon + // "marker-size" -> icon / label + // "marker-symbol" -> icon / label + // "marker-color" -> icon / label var marker = null; if (feature.get("marker-color") || feature.get("marker-size") || @@ -160,12 +160,7 @@ var GeoJSON = (function (olGeoJSON) { switch (type) { case "Point": case "MultiPoint": - if (marker) { - options["image"] = new IconStyle(marker); - } - break; - - case "Circle": + // Cercle var optionsCircle = {}; if (stroke) { optionsCircle["stroke"] = new StrokeStyle(stroke); @@ -177,6 +172,10 @@ var GeoJSON = (function (olGeoJSON) { optionsCircle["radius"] = 6; // param fixe options["image"] = new CircleStyle(optionsCircle); } + // Ponctuel ou label + if (marker) { + options["image"] = new IconStyle(marker); + } break; case "Polygon": @@ -218,8 +217,6 @@ var GeoJSON = (function (olGeoJSON) { case "Point": case "MultiPoint": case "Circle": - // FIXME - // comment doit on gerer les label ? if (this.options.defaultStyle.getImage()) { style = new Style({ image : this.options.defaultStyle.getImage() @@ -286,34 +283,46 @@ var GeoJSON = (function (olGeoJSON) { // * stroke // * fill // * image : - // * un marker + // * un marker ou un label // * un cercle si fill et/ou stroke est present ! - - // FIXME - // comment gere t on les labels ? - var fill = style.getFill(); if (fill) { - var colorFill = null; - if (Color.isRGB(fill.getColor())) { - colorFill = Color.rgbaToHex(fill.getColor()); - feature.set("fill", colorFill.hex); - feature.set("fill-opacity", colorFill.opacity); + var colorFill = fill.getColor(); + // array + if (Array.isArray(colorFill)) { + var cf = "rgba("; + cf += colorFill[0] + ","; + cf += colorFill[1] + ","; + cf += colorFill[2] + ","; + cf += colorFill[3] + ")"; + colorFill = cf; + } + if (Color.isRGB(colorFill)) { + var oColorFill = Color.rgbaToHex(colorFill); + feature.set("fill", oColorFill.hex); + feature.set("fill-opacity", oColorFill.opacity); } else { - colorFill = fill.getColor(); feature.set("fill", colorFill); feature.set("fill-opacity", 1); } } var stroke = style.getStroke(); if (stroke) { - var colorStroke = null; - if (Color.isRGB(stroke.getColor())) { - colorStroke = Color.rgbaToHex(stroke.getColor()); - feature.set("stroke", colorStroke.hex); - feature.set("stroke-opacity", colorStroke.opacity); + var colorStroke = stroke.getColor(); + // array + if (Array.isArray(colorStroke)) { + var cs = "rgba("; + cs += colorStroke[0] + ","; + cs += colorStroke[1] + ","; + cs += colorStroke[2] + ","; + cs += colorStroke[3] + ")"; + colorStroke = cs; + } + if (Color.isRGB(colorStroke)) { + var oColorStroke = Color.rgbaToHex(colorStroke); + feature.set("stroke", oColorStroke.hex); + feature.set("stroke-opacity", oColorStroke.opacity); } else { - colorStroke = stroke.getColor(); feature.set("stroke", colorStroke); feature.set("stroke-opacity", 1); } @@ -362,26 +371,42 @@ var GeoJSON = (function (olGeoJSON) { } else { var fillImg = image.getFill(); if (fillImg) { - var colorFillImg = null; - if (Color.isRGB(fillImg.getColor())) { - colorFillImg = Color.rgbaToHex(fillImg.getColor()); - feature.set("fill", colorFillImg.hex); - feature.set("fill-opacity", colorFillImg.opacity); + var colorFillImg = fillImg.getColor(); + // array + if (Array.isArray(colorFillImg)) { + var cfi = "rgba("; + cfi += colorFill[0] + ","; + cfi += colorFill[1] + ","; + cfi += colorFill[2] + ","; + cfi += colorFill[3] + ")"; + colorFillImg = cfi; + } + if (Color.isRGB(colorFillImg)) { + var oColorFillImg = Color.rgbaToHex(colorFillImg); + feature.set("fill", oColorFillImg.hex); + feature.set("fill-opacity", oColorFillImg.opacity); } else { - colorFillImg = fillImg.getColor(); feature.set("fill", colorFillImg); feature.set("fill-opacity", 1); } } var strokeImg = image.getStroke(); if (strokeImg) { - var colorStrokeImg = null; - if (Color.isRGB(strokeImg.getColor())) { - colorStrokeImg = Color.rgbaToHex(strokeImg.getColor()); - feature.set("stroke", colorStrokeImg.hex); - feature.set("stroke-opacity", colorStrokeImg.opacity); + var colorStrokeImg = strokeImg.getColor(); + // array + if (Array.isArray(colorStrokeImg)) { + var csi = "rgba("; + csi += colorFill[0] + ","; + csi += colorFill[1] + ","; + csi += colorFill[2] + ","; + csi += colorFill[3] + ")"; + colorStrokeImg = csi; + } + if (Color.isRGB(colorStrokeImg)) { + var oColorStrokeImg = Color.rgbaToHex(colorStrokeImg); + feature.set("stroke", oColorStrokeImg.hex); + feature.set("stroke-opacity", oColorStrokeImg.opacity); } else { - colorStrokeImg = strokeImg.getColor(); feature.set("stroke", colorStrokeImg); feature.set("stroke-opacity", 1); }