sap.ui.define()
.jQuery.sap.registerModulePath('arcgis_server', 'https://js.arcgis.com');
sap.ui.define([
'arcgis_server/4.6/init',
], function() {
return {
require: require
};
});
https://js/arcgis.com
as a module path with the prefix arcgis_server
. This allows us to request the init.js file of the API as a dependency of our util/ArcGis.js wrapper module. All functions of the API are then available within the scope of the module. The return value of the module simply consists of the require
method, which handles all interactions with the ArcGIS API.sap.ui.define([
'sap/ui/core/mvc/Controller',
'myapp/util/ArcGis'
], function(Controller, ArcGis) {
Controller.extend('myapp.controller.App', {
initializeMap(baseMapName, mapDivId, centerPoint, zoomLevel) {
ArcGis.require([
'esri/Map',
'esri/views/MapView',
'dojo/domReady!'
], function(Map, MapView) {
MapView({
map: Map({
basemap: baseMapName,
}),
container: mapDivId,
center: centerPoint,
zoom: zoomLevel
});
});
},
onInit() {
this.initializeMap('streets', 'mapContainer', [8.641874, 49.293589], 8);
}
});
});
require
function in the initializeMap
method.<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<title>JavaScript Map Application</title>
<style>
#mapContainer {
position: absolute;
height: 100%;
width: 100%;
}
</style>
<script
src="https://sapui5.hana.ondemand.com/1.44.31/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-bindingSyntax="complex"
data-sap-ui-compatVersion="edge"
data-sap-ui-preload="async"
data-sap-ui-resourceroots='{
"myapp": "./"
}'>
</script>
<script>
sap.ui.getCore().attachInit(function () {
sap.ui.xmlview({
viewName: "myapp.view.App"
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
div
element which contains the map to the full extend of the browser window.#mapContainer
div
element:<mvc:View
controllerName="myapp.controller.App"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
height="100%">
<core:HTML content="<div id="mapContainer"> </div>"></core:HTML>
</mvc:View>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |