Created
July 4, 2017 17:24
-
-
Save carlosrusso/31007ec7bc2d20fdd4391869d299d6fe to your computer and use it in GitHub Desktop.
customMarker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
"require", | |
"cdf/AddIn", | |
"cdf/Dashboard.Clean" | |
], function(require, AddIn, Dashboard) { | |
"use strict"; | |
var custom = { | |
name: "customMarker", | |
label: "A custom Marker addIn", | |
defaults: { | |
getUrl: function(tgt, st, opt) { | |
var isUpOrDown = st.data[3]; | |
var baseUrl = "/pentaho/plugin/pentaho-cdf-dd/api/resources/system/workwisePentaho/static/custom/img/" | |
switch(isUpOrDown){ | |
case "up": return baseUrl + "up.svg", | |
case "down": return baseUrl + "down.svg", | |
default: return baseUrl + "error.svg", | |
} | |
} | |
}, | |
implementation: function(tgt, st, opt) { | |
var style = { | |
"icon-url": opt.getUrl(tgt, st, opt) | |
}; | |
if(st.width != null) style.width = st.width; | |
if(st.height != null) style.height = st.height; | |
return style; | |
} | |
}; | |
Dashboard.registerGlobalAddIn("NewMapComponent", "MarkerImage", new AddIn(custom)); | |
return custom; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(){ | |
this.markerImageGetter = "customMarker"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment