Skip to content

Commit

Permalink
Changed: Replace CreateMesaurementModal with CreateObjectModal
Browse files Browse the repository at this point in the history
  • Loading branch information
flori authored and flori committed Oct 18, 2024
1 parent af62ed6 commit 4406fff
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 181 deletions.
99 changes: 29 additions & 70 deletions js/visualisation/worldmap2d_example10.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
};
39 changes: 22 additions & 17 deletions js/visualisation/worldmap2d_example11.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
146 changes: 54 additions & 92 deletions sites/visualisation/worldmap2d.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,100 +203,57 @@ <h3>Example 9: Map with Filter</h3>
});
</code></pre>

<h3>Example 10: View and edit Measurement Point Data</h3>
<p>This customised map allows you to view and edit data.</p>
<p>Note: This example requires a compatible database to display the data correctly.</p>
<h3>Example 10: Create locations and objects</h3>
<p>This plugin allows you to add locations and objects on the map.</p>
<a href="worldmap2d_example10.html" target="_blank">Open example</a>

<pre><code class="lang-javascript">

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'
}
};
</code></pre>

<h3>Example 11: View and edit Measurement Point Data and Magic Mapper</h3>
Expand Down Expand Up @@ -333,27 +290,32 @@ <h3>Example 11: View and edit Measurement Point Data and Magic Mapper</h3>
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',
Expand Down
4 changes: 2 additions & 2 deletions sites/visualisation/worldmap2d_example10.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SWAC - Worldmap2d component - Example 10: Work with Measurement Point Data</title>
<title>SWAC - Worldmap2d component - Example 10: Create locations and objects</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" type="image/png" sizes="32x32" href="../../files/icons/32x32.png">
Expand All @@ -26,7 +26,7 @@
</div>
</noscript>

<h3>Example 10: Work with Measurement Point Data</h3>
<h3>Example 10: Create locations and objects</h3>
<div id="worldmap2d_example10" swa="Worldmap2d"></div>

<footer>
Expand Down

0 comments on commit 4406fff

Please sign in to comment.