Skip to content

Instantly share code, notes, and snippets.

@riccardoklinger
Last active January 8, 2021 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riccardoklinger/124e2d27cddcd18938b71cc4789f574c to your computer and use it in GitHub Desktop.
Save riccardoklinger/124e2d27cddcd18938b71cc4789f574c to your computer and use it in GitHub Desktop.
/*
first Author:
Ed Gonzalez
adjusted by
riccardo.klinger@gmail.com/
Free for personal and commercial use under the CCA 3.0 license
I just ask for you give me credit for the code and tell your friends about it.
Note this is a very simple implementation, and is only meant to get you started using Custom Controls, and the MapBox API
*/
define(["https://js.arcgis.com/4.18/init.js", "jquery"], function(esrijs, jQuery) {
"use strict";
var map = '',
bounds = '',
geojsonFeature = {};
function BasicControl() {};
//Step 2 Add Initialize Code
BasicControl.prototype.initialize = function(oControlHost, fnDoneInitializing, oDataStore) {
// Add Link to MapBox Stylesheet
jQuery("head link[rel='stylesheet']").last().after("<link href='https://js.arcgis.com/4.18/esri/themes/light/main.css' rel='stylesheet' />");
// Get Id of Control container
var mapContainer = oControlHost.container.id;
//Add Default map Definition
map = new esrijs.Map({
basemap: "topo-vector"
});
view = new esrijs.MapView({
container: mapContainer,
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
//Tell Cognos that we are done initializing
fnDoneInitializing();
};
BasicControl.prototype.draw = function(oControlHost) {
console.log('Draw ******************')
};
BasicControl.prototype.setData = function(oControlHost, oDataStore) {
console.log('SetData *****************')
};
return BasicControl;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment