diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..d09a50ca3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "svg.preview.background": "transparent" +} \ No newline at end of file diff --git a/DRAFT_CHANGELOG.md b/DRAFT_CHANGELOG.md index ec0f848a9..2ab8b5433 100644 --- a/DRAFT_CHANGELOG.md +++ b/DRAFT_CHANGELOG.md @@ -9,11 +9,28 @@ ## Summary +- Ajout du widget *Export* +- Import des couches de calculs (itineraire, isochrone et profil altimétrique) + ## Changelog * [Added] - - Widget d'export des tracés et calculs des contrôles d'itineraire, d'isochrone et de profil altimétrique. + - Widget d'export des tracés et des calculs au format GPX, KML et GeoJSON sur les contôles d'itineraire, d'isochrone et de profil altimétrique (#363) : + + ``` js + // exemple + var route = new ol.control.Route(); + map.addControl(route); + var exportRoute = new ol.control.Export({ + control : route, + format : "GPX" + }); + map.addControl(exportRoute); + ``` + + - Import des couches de calculs (itineraire, isochrone et profil altimétrique) au format GPX, KML et GeoJSON (#363). + - Widget d'export des tracés et calculs des contrôles d'itineraire, d'isochrone et de profil altimétrique (#357). * [Changed] @@ -26,6 +43,7 @@ * [Fixed] + - Fix sur le format KML avec l'affichage des labels - Fix sur le profil altimétrique qui permet de construire le profil même si le panneau d'affichage est masqué (calcul en arrière plan). * [Security] diff --git a/build/scripts/release/geoportal-extensions-openlayers-3.2.21.tgz b/build/scripts/release/geoportal-extensions-openlayers-3.2.21.tgz index d9dbc7a48..9df9fdc50 100644 Binary files a/build/scripts/release/geoportal-extensions-openlayers-3.2.21.tgz and b/build/scripts/release/geoportal-extensions-openlayers-3.2.21.tgz differ diff --git a/build/scripts/release/package-openlayers.json b/build/scripts/release/package-openlayers.json index d3bf5d0c8..f47ebe2e9 100644 --- a/build/scripts/release/package-openlayers.json +++ b/build/scripts/release/package-openlayers.json @@ -1,17 +1,6 @@ { - "bugs" : {}, - "repository" : { - "url" : "https://github.com/IGNF/geoportal-extensions.git", - "type" : "git" - }, - "types" : "src/OpenLayers/index.d.ts", - "date" : "23/03/2023", - "keywords" : [ - "geoportail", - "plugin", - "javascript", - "OpenLayers" - ], + "peerDependencies" : {}, + "scripts" : {}, "files" : [ "dist/", "src/", @@ -19,23 +8,34 @@ "README.md", "package.json" ], - "scripts" : {}, - "version" : "3.2.21", - "peerDependencies" : {}, - "module" : "src/OpenLayers/index.js", - "devDependencies" : {}, + "date" : "23/03/2023", "license" : "CECILL-B", - "directories" : {}, "dependencies" : { - "sortablejs" : "1.14.0", - "proj4" : "2.7.5", - "eventbusjs" : "0.2.0", - "loglevel" : "1.6.6", + "ol" : "6.9.0", "geoportal-access-lib" : "3.2.1", "@mapbox/mapbox-gl-style-spec" : "13.20.1", - "ol" : "6.9.0", - "node-fetch" : "^2.6.1", - "xmldom" : "^0.1.27" + "xmldom" : "^0.1.27", + "loglevel" : "1.6.6", + "proj4" : "2.7.5", + "eventbusjs" : "0.2.0", + "sortablejs" : "1.14.0", + "node-fetch" : "^2.6.1" }, - "name" : "geoportal-extensions-openlayers" + "directories" : {}, + "repository" : { + "url" : "https://github.com/IGNF/geoportal-extensions.git", + "type" : "git" + }, + "name" : "geoportal-extensions-openlayers", + "bugs" : {}, + "version" : "3.2.21", + "types" : "src/OpenLayers/index.d.ts", + "module" : "src/OpenLayers/index.js", + "devDependencies" : {}, + "keywords" : [ + "geoportail", + "plugin", + "javascript", + "OpenLayers" + ] } diff --git a/resources/.gitignore b/resources/.gitignore new file mode 100644 index 000000000..5b19aa70f --- /dev/null +++ b/resources/.gitignore @@ -0,0 +1,2 @@ +base64.txt +png32/*.png \ No newline at end of file diff --git a/resources/README.md b/resources/README.md new file mode 100644 index 000000000..a7d2b2ca1 --- /dev/null +++ b/resources/README.md @@ -0,0 +1,48 @@ +# Ressources + +Les icones de l'outil de dessins se composent ainsi : + +```sh +. +├── api +│ ├── base64.txt +│ ├── icon_[1-24].png +│ ├── png32/ +│ └── script.sh +├── portail +│ ├── base64.txt +│ ├── icon_[1-24].png +│ ├── png32/ +│ └── script.sh +``` + +Le répertoire *api/* contient les icones originaux utilisés par les APIs au format PNG : + +```sh +image size : [51, 38] +scale : 32 / Math.min(size[0], size[1]) = 0.8421052631578947 +``` + +On les transforme dans un ratio correct pour le rendu graphique sur *OpenLayers* avec le script : `./script.sh` + +Le résultat du traitement est disponible dans le répertoire *api/png32/* et dans le fichier *base64.txt* pour obtenir les URI des PNG : + +```sh +image size : [43, 32] +scale : 32 / Math.min(size[0], size[1]) = 1 +``` + +et + +```json +[ + { + src : "data:image/png;base64,...", + anchor : [0.5, 1] + } + (...) +] +``` + +**NOTE :** +> On procéde aussi pour les icones du Portail ! diff --git a/resources/api/icon_1.png b/resources/api/icon_1.png new file mode 100644 index 000000000..6f96e66e9 Binary files /dev/null and b/resources/api/icon_1.png differ diff --git a/resources/api/icon_10.png b/resources/api/icon_10.png new file mode 100644 index 000000000..d70768456 Binary files /dev/null and b/resources/api/icon_10.png differ diff --git a/resources/api/icon_11.png b/resources/api/icon_11.png new file mode 100644 index 000000000..7d901f292 Binary files /dev/null and b/resources/api/icon_11.png differ diff --git a/resources/api/icon_12.png b/resources/api/icon_12.png new file mode 100644 index 000000000..8587a9e48 Binary files /dev/null and b/resources/api/icon_12.png differ diff --git a/resources/api/icon_13.png b/resources/api/icon_13.png new file mode 100644 index 000000000..6436a1911 Binary files /dev/null and b/resources/api/icon_13.png differ diff --git a/resources/api/icon_14.png b/resources/api/icon_14.png new file mode 100644 index 000000000..27108a502 Binary files /dev/null and b/resources/api/icon_14.png differ diff --git a/resources/api/icon_15.png b/resources/api/icon_15.png new file mode 100644 index 000000000..c5ece225b Binary files /dev/null and b/resources/api/icon_15.png differ diff --git a/resources/api/icon_16.png b/resources/api/icon_16.png new file mode 100644 index 000000000..b37109ffb Binary files /dev/null and b/resources/api/icon_16.png differ diff --git a/resources/api/icon_17.png b/resources/api/icon_17.png new file mode 100644 index 000000000..ca22ff1dc Binary files /dev/null and b/resources/api/icon_17.png differ diff --git a/resources/api/icon_18.png b/resources/api/icon_18.png new file mode 100644 index 000000000..20a75a534 Binary files /dev/null and b/resources/api/icon_18.png differ diff --git a/resources/api/icon_19.png b/resources/api/icon_19.png new file mode 100644 index 000000000..958148f75 Binary files /dev/null and b/resources/api/icon_19.png differ diff --git a/resources/api/icon_2.png b/resources/api/icon_2.png new file mode 100644 index 000000000..830c76e84 Binary files /dev/null and b/resources/api/icon_2.png differ diff --git a/resources/api/icon_20.png b/resources/api/icon_20.png new file mode 100644 index 000000000..7c8e23304 Binary files /dev/null and b/resources/api/icon_20.png differ diff --git a/resources/api/icon_21.png b/resources/api/icon_21.png new file mode 100644 index 000000000..bfe638b7d Binary files /dev/null and b/resources/api/icon_21.png differ diff --git a/resources/api/icon_22.png b/resources/api/icon_22.png new file mode 100644 index 000000000..aeae5f74a Binary files /dev/null and b/resources/api/icon_22.png differ diff --git a/resources/api/icon_23.png b/resources/api/icon_23.png new file mode 100644 index 000000000..ad45b454e Binary files /dev/null and b/resources/api/icon_23.png differ diff --git a/resources/api/icon_24.png b/resources/api/icon_24.png new file mode 100644 index 000000000..8b4487a59 Binary files /dev/null and b/resources/api/icon_24.png differ diff --git a/resources/api/icon_3.png b/resources/api/icon_3.png new file mode 100644 index 000000000..3c209a804 Binary files /dev/null and b/resources/api/icon_3.png differ diff --git a/resources/api/icon_4.png b/resources/api/icon_4.png new file mode 100644 index 000000000..19708d348 Binary files /dev/null and b/resources/api/icon_4.png differ diff --git a/resources/api/icon_5.png b/resources/api/icon_5.png new file mode 100644 index 000000000..9a6b04c82 Binary files /dev/null and b/resources/api/icon_5.png differ diff --git a/resources/api/icon_6.png b/resources/api/icon_6.png new file mode 100644 index 000000000..1cfb5f81d Binary files /dev/null and b/resources/api/icon_6.png differ diff --git a/resources/api/icon_7.png b/resources/api/icon_7.png new file mode 100644 index 000000000..d71f88510 Binary files /dev/null and b/resources/api/icon_7.png differ diff --git a/resources/api/icon_8.png b/resources/api/icon_8.png new file mode 100644 index 000000000..4e36bc6b5 Binary files /dev/null and b/resources/api/icon_8.png differ diff --git a/resources/api/icon_9.png b/resources/api/icon_9.png new file mode 100644 index 000000000..f2af3f8bc Binary files /dev/null and b/resources/api/icon_9.png differ diff --git a/resources/api/png32/.gitkeep b/resources/api/png32/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/resources/api/script.sh b/resources/api/script.sh new file mode 100755 index 000000000..83d05dc90 --- /dev/null +++ b/resources/api/script.sh @@ -0,0 +1,9 @@ +for file in $(ls -v *.png) +do + convert "$file" -resize 43x32! png32/"$file" + echo "{" >> base64.txt + echo -n " src : \"data:image/png;base64,$(cat png32/"$file" | base64 | tr -d '\r\n')\"," >> base64.txt + echo "" >> base64.txt + echo " anchor : [0.5, 1]" >> base64.txt + echo "}," >> base64.txt +done diff --git a/resources/portail/icon_1.png b/resources/portail/icon_1.png new file mode 100644 index 000000000..40c63640a Binary files /dev/null and b/resources/portail/icon_1.png differ diff --git a/resources/portail/icon_10.png b/resources/portail/icon_10.png new file mode 100644 index 000000000..d4255bef3 Binary files /dev/null and b/resources/portail/icon_10.png differ diff --git a/resources/portail/icon_11.png b/resources/portail/icon_11.png new file mode 100644 index 000000000..3fed98df6 Binary files /dev/null and b/resources/portail/icon_11.png differ diff --git a/resources/portail/icon_12.png b/resources/portail/icon_12.png new file mode 100644 index 000000000..b02ed56e7 Binary files /dev/null and b/resources/portail/icon_12.png differ diff --git a/resources/portail/icon_13.png b/resources/portail/icon_13.png new file mode 100644 index 000000000..5455529ff Binary files /dev/null and b/resources/portail/icon_13.png differ diff --git a/resources/portail/icon_14.png b/resources/portail/icon_14.png new file mode 100644 index 000000000..f7786a279 Binary files /dev/null and b/resources/portail/icon_14.png differ diff --git a/resources/portail/icon_15.png b/resources/portail/icon_15.png new file mode 100644 index 000000000..76b35c215 Binary files /dev/null and b/resources/portail/icon_15.png differ diff --git a/resources/portail/icon_16.png b/resources/portail/icon_16.png new file mode 100644 index 000000000..cf03e7261 Binary files /dev/null and b/resources/portail/icon_16.png differ diff --git a/resources/portail/icon_17.png b/resources/portail/icon_17.png new file mode 100644 index 000000000..83fc2bd08 Binary files /dev/null and b/resources/portail/icon_17.png differ diff --git a/resources/portail/icon_18.png b/resources/portail/icon_18.png new file mode 100644 index 000000000..f1bd37ba6 Binary files /dev/null and b/resources/portail/icon_18.png differ diff --git a/resources/portail/icon_19.png b/resources/portail/icon_19.png new file mode 100644 index 000000000..15df30b4a Binary files /dev/null and b/resources/portail/icon_19.png differ diff --git a/resources/portail/icon_2.png b/resources/portail/icon_2.png new file mode 100644 index 000000000..0e0786a48 Binary files /dev/null and b/resources/portail/icon_2.png differ diff --git a/resources/portail/icon_20.png b/resources/portail/icon_20.png new file mode 100644 index 000000000..6923d1970 Binary files /dev/null and b/resources/portail/icon_20.png differ diff --git a/resources/portail/icon_21.png b/resources/portail/icon_21.png new file mode 100644 index 000000000..3804dbbfb Binary files /dev/null and b/resources/portail/icon_21.png differ diff --git a/resources/portail/icon_22.png b/resources/portail/icon_22.png new file mode 100644 index 000000000..f237c3435 Binary files /dev/null and b/resources/portail/icon_22.png differ diff --git a/resources/portail/icon_23.png b/resources/portail/icon_23.png new file mode 100644 index 000000000..951db15a0 Binary files /dev/null and b/resources/portail/icon_23.png differ diff --git a/resources/portail/icon_24.png b/resources/portail/icon_24.png new file mode 100644 index 000000000..c11fb6da3 Binary files /dev/null and b/resources/portail/icon_24.png differ diff --git a/resources/portail/icon_3.png b/resources/portail/icon_3.png new file mode 100644 index 000000000..75c60f2c5 Binary files /dev/null and b/resources/portail/icon_3.png differ diff --git a/resources/portail/icon_4.png b/resources/portail/icon_4.png new file mode 100644 index 000000000..ef9f7e8ff Binary files /dev/null and b/resources/portail/icon_4.png differ diff --git a/resources/portail/icon_5.png b/resources/portail/icon_5.png new file mode 100644 index 000000000..9da7dc1c0 Binary files /dev/null and b/resources/portail/icon_5.png differ diff --git a/resources/portail/icon_6.png b/resources/portail/icon_6.png new file mode 100644 index 000000000..2ee63ca82 Binary files /dev/null and b/resources/portail/icon_6.png differ diff --git a/resources/portail/icon_7.png b/resources/portail/icon_7.png new file mode 100644 index 000000000..cadf03183 Binary files /dev/null and b/resources/portail/icon_7.png differ diff --git a/resources/portail/icon_8.png b/resources/portail/icon_8.png new file mode 100644 index 000000000..6d235a440 Binary files /dev/null and b/resources/portail/icon_8.png differ diff --git a/resources/portail/icon_9.png b/resources/portail/icon_9.png new file mode 100644 index 000000000..111b1e41f Binary files /dev/null and b/resources/portail/icon_9.png differ diff --git a/resources/portail/png32/.gitkeep b/resources/portail/png32/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/resources/portail/script.sh b/resources/portail/script.sh new file mode 100755 index 000000000..f03dec33e --- /dev/null +++ b/resources/portail/script.sh @@ -0,0 +1,9 @@ +for file in $(ls -v *.png) +do + convert "$file" -resize 32x41! png32/"$file" + echo "{" >> base64.txt + echo -n " src : \"data:image/png;base64,$(cat png32/"$file" | base64 | tr -d '\r\n')\"," >> base64.txt + echo "" >> base64.txt + echo " anchor : [0.5, 1]" >> base64.txt + echo "}," >> base64.txt +done diff --git a/samples-src/pages/openlayers/Drawing/pages-ol-drawing-bundle-addlayer-geojson.html b/samples-src/pages/openlayers/Drawing/pages-ol-drawing-bundle-addlayer-geojson.html new file mode 100644 index 000000000..364695bb1 --- /dev/null +++ b/samples-src/pages/openlayers/Drawing/pages-ol-drawing-bundle-addlayer-geojson.html @@ -0,0 +1,177 @@ +{{#extend "ol-sample-bundle-layout"}} + +{{#content "head"}} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >4,_=15&e[t+1],b=e[t+2];h.componentsOrder.push(m),h.components[m]={h:y,v:_,quantizationIdx:b},t+=3}n(h),this.frames.push(h);break;case 65476:for(var v=r(),w=2;w 3)throw"Invalid block encoding ("+v.encoding+")";if(2!==v.encoding){if(0!==w&&2!==w){if(w>>=6,v.offsetType=w,2===w)v.offset=i.getInt8(1),_++;else if(1===w)v.offset=i.getInt16(1,!0),_+=2;else{if(0!==w)throw"Invalid block offset type";v.offset=i.getFloat32(1,!0),_+=4}if(1===v.encoding)if(w=i.getUint8(_),_++,v.bitsPerPixel=63&w,w>>=6,v.numValidPixelsType=w,2===w)v.numValidPixels=i.getUint8(_),_++;else if(1===w)v.numValidPixels=i.getUint16(_,!0),_+=2;else{if(0!==w)throw"Invalid valid pixel count type";v.numValidPixels=i.getUint32(_,!0),_+=4}}var k;if(t+=_,3!==v.encoding)if(0===v.encoding){var T=(n.pixels.numBytes-1)/4;if(T!==Math.floor(T))throw"uncompressed block has invalid length";k=new ArrayBuffer(4*T),new Uint8Array(k).set(new Uint8Array(e,t,4*T));var E=new Float32Array(k);v.rawData=E,t+=4*T}else if(1===v.encoding){var x=Math.ceil(v.numValidPixels*v.bitsPerPixel/8),S=Math.ceil(x/4);k=new ArrayBuffer(4*S),new Uint8Array(k).set(new Uint8Array(e,t,x)),v.stuffedData=new Uint32Array(k),t+=x}}else t++}return n.eofOffset=t,n},i=function(e,t,r,n,a,i,o){var s,l,f,c=(1< 1&&(C=new r(O.buffer,y*M,y),A=0),t.headerInfo.numValidPixel===g*m)for(u=0,f=0;f>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=TYPE;break;case DICTID:for(;c<32;){if(0===s)break e;s--,f+=n[i++]<=359?359:a;a-=o;do{t+=e[i++]<<8,r+=t+=e[i++]}while(--o);t=(65535&t)+(t>>>16),r=(65535&r)+(r>>>16)}return 1&n&&(r+=t+=e[i]<<8),((r=(65535&r)+(r>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var r=t.ptr,n=new Uint8Array(e,r,6),a={};if(a.fileIdentifierString=String.fromCharCode.apply(null,n),0!==a.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+a.fileIdentifierString;r+=6;var i,o=new DataView(e,r,8),s=o.getInt32(0,!0);if(a.fileVersion=s,r+=4,s>=3&&(a.checksum=o.getUint32(4,!0),r+=4),o=new DataView(e,r,12),a.height=o.getUint32(0,!0),a.width=o.getUint32(4,!0),r+=8,s>=4?(a.numDims=o.getUint32(8,!0),r+=4):a.numDims=1,o=new DataView(e,r,40),a.numValidPixel=o.getUint32(0,!0),a.microBlockSize=o.getInt32(4,!0),a.blobSize=o.getInt32(8,!0),a.imageType=o.getInt32(12,!0),a.maxZError=o.getFloat64(16,!0),a.zMin=o.getFloat64(24,!0),a.zMax=o.getFloat64(32,!0),r+=40,t.headerInfo=a,t.ptr=r,s>=3&&(i=s>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,r-i,a.blobSize-14))!==a.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var r=t.headerInfo,n=this.getDataTypeArray(r.imageType),a=r.numDims*this.getDataTypeSize(r.imageType),i=this.readSubArray(e,t.ptr,n,a),o=this.readSubArray(e,t.ptr+a,n,a);t.ptr+=2*a;var s,l=!0;for(s=0;s