From 4406fffd6f50de27d558076b10c620d81b21e0ff Mon Sep 17 00:00:00 2001 From: flori Date: Fri, 18 Oct 2024 13:55:18 +0200 Subject: [PATCH] Changed: Replace CreateMesaurementModal with CreateObjectModal --- js/visualisation/worldmap2d_example10.js | 99 ++++-------- js/visualisation/worldmap2d_example11.js | 39 +++-- sites/visualisation/worldmap2d.html | 146 +++++++----------- sites/visualisation/worldmap2d_example10.html | 4 +- 4 files changed, 107 insertions(+), 181 deletions(-) diff --git a/js/visualisation/worldmap2d_example10.js b/js/visualisation/worldmap2d_example10.js index 374ef4c..7d0049d 100644 --- a/js/visualisation/worldmap2d_example10.js +++ b/js/visualisation/worldmap2d_example10.js @@ -5,86 +5,45 @@ var worldmap2d_example10_options = { datasources: new Map([ ['../../data/visualisation/worldmap2d/tbl_observedobject.json', { - datacapsule: { - fromName: '../../data/visualisation/worldmap2d/tbl_observedobject.json', - }, - latitudeAttr: 'tbl_location.coordinates[0]', - longitudeAttr: 'tbl_location.coordinates[1]', - }], + datacapsule: { + fromName: '../../data/visualisation/worldmap2d/tbl_observedobject.json' + }, + latitudeAttr: 'latitude', + longitudeAttr: 'longitude' + }] ]), zoom: 18, showTimedDataAtOnce: true, clusterMarkers: true, - maxZoom: 18, + maxZoom: 18 }; //add plugin to the worldmap2d component worldmap2d_example10_options.plugins = new Map(); -worldmap2d_example10_options.plugins.set('ToggleClickInteractionButton', { - id: 'toggleclickinteractionbutton', +worldmap2d_example10_options.plugins.set('CreateObjectModal', { + id: 'createobjectmodal', active: true }); -worldmap2d_example10_options.plugins.set('CreateMeasurementModal', { - id: 'createmeasurementmodal', - active: true -}); - -var createmeasurementmodal_worldmap2d_example10_options = { - typeDatasource: '../../data/visualisation/worldmap2d/tbl_observedobject_type.json', - datacapsuleLoad: worldmap2d_example10_options.datasources.get('../../data/visualisation/worldmap2d/tbl_observedobject.json').datacapsule, - // createOoWithLocation: { - // fromName: 'observedobject/createWithLocation', - // responseIdAttr: 'ooId', - // ooName: 'ooName', - // ooDescription: 'ooDescription', - // ooType: 'ooType', - // ooCompleted: 'ooCompleted', - // ooCollection: 'ooCollection', - // locLatitude: 'locLatitude', - // locLongitude: 'locLongitude', - // locName: 'locName', - // locDescription: 'locDescription', - // } -} - -worldmap2d_example10_options.plugins.set('MapPinModal', { - id: 'mappinmodal', - active: true -}); - -var mappinmodal_worldmap2d_example10_options = { - table_names : { - locations_table: { - table_name: 'tbl_location', - idAttr: 'id', - geojsonattr: 'coordinates', - }, - oo_table: { - table_name: 'tbl_observedobject', - idAttr: 'id', - completed: 'completed', - }, - file_table: { - table_name: 'tbl_file', - idAttr: 'id' - }, - file_join_oo_table: { - table_name: 'tbl_file_join_oo', - idAttr: 'id', - file_id: 'file_id', - oo_id: 'oo_id' - }, - uploadfile_options : { - uploadTargetURL: '/SmartFile/smartfile/file/map_pictures_Gewaesser', - docroot: '../../../' - } +var createobjectmodal_worldmap2d_example10_options = { + saveMapping: { + ooNameAttr: 'name', + ooDescriptionAttr: 'description', + ooTypeAttr: 'ootype_id', + ooParentAttr: 'parent_id', + ooCompletedAttr: 'complete', + ooDataCollectionAttr: 'data_collection', + ooMetaCollectionAttr: 'meta_collection', + locLatAttr: 'lat', + locLonAttr: 'lon', + locLatLonAttr: 'coordinates', + locNameAttr: 'name', + locDescriptionAttr: 'description', + joinOoIdAttr: 'oo_id', + joinLocIdAttr: 'loc_id' }, -} - -worldmap2d_example10_options.plugins.set('Help', { - id: 'help', - active: true -}); - + objectRequestor: { + fromName: 'tbl_observedobject' + } +}; \ No newline at end of file diff --git a/js/visualisation/worldmap2d_example11.js b/js/visualisation/worldmap2d_example11.js index 89be093..9d0292b 100644 --- a/js/visualisation/worldmap2d_example11.js +++ b/js/visualisation/worldmap2d_example11.js @@ -30,27 +30,32 @@ worldmap2d_example11_options.plugins.set('ToggleClickInteractionButton', { id: 'toggleclickinteractionbutton', active: true }); -worldmap2d_example11_options.plugins.set('CreateMeasurementModal', { - id: 'createmeasurementmodal', +worldmap2d_example10_options.plugins.set('CreateObjectModal', { + id: 'createobjectmodal', active: true }); -var createmeasurementmodal_worldmap2d_example11_options = { - datacapsuleLoad: worldmap2d_example11_options.datasources.get('tbl_observedobject').datacapsule, - createOoWithLocation: { - fromName: 'observedobject/createWithLocation', - responseIdAttr: 'ooId', - ooName: 'ooName', - ooDescription: 'ooDescription', - ooType: 'ooType', - ooCompleted: 'ooCompleted', - ooCollection: 'ooCollection', - locLatitude: 'locLatitude', - locLongitude: 'locLongitude', - locName: 'locName', - locDescription: 'locDescription', +var createobjectmodal_worldmap2d_example11_options = { + saveMapping: { + ooNameAttr: 'name', + ooDescriptionAttr: 'description', + ooTypeAttr: 'ootype_id', + ooParentAttr: 'parent_id', + ooCompletedAttr: 'complete', + ooDataCollectionAttr: 'data_collection', + ooMetaCollectionAttr: 'meta_collection', + locLatAttr: 'lat', + locLonAttr: 'lon', + locLatLonAttr: 'coordinates', + locNameAttr: 'name', + locDescriptionAttr: 'description', + joinOoIdAttr: 'oo_id', + joinLocIdAttr: 'loc_id' + }, + objectRequestor: { + fromName: 'tbl_observedobject' } -} +}; worldmap2d_example11_options.plugins.set('MapPinModal', { id: 'mappinmodal', diff --git a/sites/visualisation/worldmap2d.html b/sites/visualisation/worldmap2d.html index fff9fb4..54dfad5 100644 --- a/sites/visualisation/worldmap2d.html +++ b/sites/visualisation/worldmap2d.html @@ -203,100 +203,57 @@

Example 9: Map with Filter

}); -

Example 10: View and edit Measurement Point Data

-

This customised map allows you to view and edit data.

-

Note: This example requires a compatible database to display the data correctly.

+

Example 10: Create locations and objects

+

This plugin allows you to add locations and objects on the map.

Open example

+
 var worldmap2d_example10_options = {
     datasources: new Map([
-        ['tbl_observedobject', {
-            datacapsule: {
-                fromName: 'tbl_1',
-                fromWheres: {
-                    join: 'tbl_2',
+        ['../../data/visualisation/worldmap2d/tbl_observedobject.json', {
+                datacapsule: {
+                    fromName: '../../data/visualisation/worldmap2d/tbl_observedobject.json'
                 },
-            },
-            latitudeAttr: 'tbl_2.coodinates.coordinates[0]',
-            longitudeAttr: 'tbl_2.coodinates.coordinates[1]',
-        }],
+                latitudeAttr: 'latitude',
+                longitudeAttr: 'longitude'
+            }]
     ]),
     zoom: 18,
     showTimedDataAtOnce: true,
     clusterMarkers: true,
-    maxZoom: 18,
+    maxZoom: 18
 };
 
 
 //add plugin to the worldmap2d component
 worldmap2d_example10_options.plugins = new Map();
-worldmap2d_example10_options.plugins.set('ToggleClickInteractionButton', {
-    id: 'toggleclickinteractionbutton',
+worldmap2d_example10_options.plugins.set('CreateObjectModal', {
+    id: 'createobjectmodal',
     active: true
 });
-worldmap2d_example10_options.plugins.set('CreateMeasurementModal', {
-    id: 'createmeasurementmodal',
-    active: true
-});
-
-var createmeasurementmodal_worldmap2d_example10_options = {
-    datacapsuleLoad: worldmap2d_example10_options.datasources.get('tbl_observedobject').datacapsule,
-    createOoWithLocation: {
-        fromName: '',
-        responseIdAttr: '',
-        ooName: '',
-        ooDescription: '',
-        ooType: '',
-        ooCompleted: '',
-        ooCollection: '',
-        locLatitude: '',
-        locLongitude: '',
-        locName: '',
-        locDescription: '',
-    }
-}
-
 
-worldmap2d_example10_options.plugins.set('MapPinModal', {
-    id: 'mappinmodal',
-    active: true
-});
-
-var mappinmodal_worldmap2d_example10_options = {
-    table_names : {
-        locations_table: {
-            table_name: '',
-            idAttr: '',
-            geojsonattr: '',
-        },
-        oo_table: {
-            table_name: '',
-            idAttr: '',
-            completed: '',
-        },
-        file_table: {
-            table_name: '',
-            idAttr: ''
-        },
-        file_join_oo_table: {
-            table_name: '',
-            idAttr: '',
-            file_id: '',
-            oo_id: ''
-        },
-        uploadfile_options : {
-            uploadTargetURL: '',
-            docroot: ''
-        }
+var createobjectmodal_worldmap2d_example10_options = {
+    saveMapping: {
+        ooNameAttr: 'name',
+        ooDescriptionAttr: 'description',
+        ooTypeAttr: 'ootype_id',
+        ooParentAttr: 'parent_id',
+        ooCompletedAttr: 'complete',
+        ooDataCollectionAttr: 'data_collection',
+        ooMetaCollectionAttr: 'meta_collection',
+        locLatAttr: 'lat',
+        locLonAttr: 'lon',
+        locLatLonAttr: 'coordinates',
+        locNameAttr: 'name',
+        locDescriptionAttr: 'description',
+        joinOoIdAttr: 'oo_id',
+        joinLocIdAttr: 'loc_id'
     },
-}
-
-worldmap2d_example10_options.plugins.set('Help', {
-    id: 'help',
-    active: true
-});
-                
+    objectRequestor: {
+        fromName: 'tbl_observedobject'
+    }
+};      
             

Example 11: View and edit Measurement Point Data and Magic Mapper

@@ -333,27 +290,32 @@

Example 11: View and edit Measurement Point Data and Magic Mapper

id: 'toggleclickinteractionbutton', active: true }); -worldmap2d_example11_options.plugins.set('CreateMeasurementModal', { - id: 'createmeasurementmodal', +worldmap2d_example11_options.plugins.set('CreateObjectModal', { + id: 'createobjectmodal', active: true }); -var createmeasurementmodal_worldmap2d_example11_options = { - datacapsuleLoad: worldmap2d_example11_options.datasources.get('tbl_observedobject').datacapsule, - createOoWithLocation: { - fromName: '', - responseIdAttr: '', - ooName: '', - ooDescription: '', - ooType: '', - ooCompleted: '', - ooCollection: '', - locLatitude: '', - locLongitude: '', - locName: '', - locDescription: '', +var createobjectmodal_worldmap2d_example10_options = { + saveMapping: { + ooNameAttr: 'name', + ooDescriptionAttr: 'description', + ooTypeAttr: 'ootype_id', + ooParentAttr: 'parent_id', + ooCompletedAttr: 'complete', + ooDataCollectionAttr: 'data_collection', + ooMetaCollectionAttr: 'meta_collection', + locLatAttr: 'lat', + locLonAttr: 'lon', + locLatLonAttr: 'coordinates', + locNameAttr: 'name', + locDescriptionAttr: 'description', + joinOoIdAttr: 'oo_id', + joinLocIdAttr: 'loc_id' + }, + objectRequestor: { + fromName: 'tbl_observedobject' } -} +}; worldmap2d_example11_options.plugins.set('MapPinModal', { id: 'mappinmodal', diff --git a/sites/visualisation/worldmap2d_example10.html b/sites/visualisation/worldmap2d_example10.html index 8abe8f0..6ded9bd 100644 --- a/sites/visualisation/worldmap2d_example10.html +++ b/sites/visualisation/worldmap2d_example10.html @@ -1,7 +1,7 @@ - SWAC - Worldmap2d component - Example 10: Work with Measurement Point Data + SWAC - Worldmap2d component - Example 10: Create locations and objects @@ -26,7 +26,7 @@ -

Example 10: Work with Measurement Point Data

+

Example 10: Create locations and objects