Ehanced draw widget for WebApp Builder for Arcgis
UPDATE 2018/05/09 (new Release v2.8.1) :
(Direct zip link : https://github.com/magis-nc/esri-webappbuilder-widget-eDraw/releases/download/v2.8.1/eDraw.zip )
Demo : https://apps.magis.nc/demo/eDraw/
Github :
https://github.com/magis-nc/esri-webappbuilder-widget-eDraw
Wigdet's Features (improvments of standard Draw widget) :
This message was updated by Jeremie Cornet (New Release)
Solved! Go to Solution.
It was hard to find but I've pick your code up in http://gis.hamiltoncounty.in.gov/mapviewer/index.html
To include your text improvments, i think i will extend the jimu/dijit/SymbolChooser class in a widgets/eDraw/MySymbolChooser class and call this new class in eDraw widget instead of jimu/dijit/SymbolChooser.
And i will correct a bug i found in jimu/dijit/SymbolChooser in this extended class.
I'm in the process of implementing dynamic placement of points, triangles, circles and ellipses also, I think the user should never be surprised at what he is drawing. I'll keep you posted.
I'm also going to add a halo option for text.
Larry
This is great! Both custom draw widgets are an improvement over the out of the box widget, and combining your efforts is going to make this an awesome draw widget.
Someday we will even be able to edit the shapes once they have been drawn, I have no doubt.
Kudos! Jeremie Cornet and Larry Stout
Jeremie,
I'm having issues working with this tool in the IE environment. It appears to be working fine when using Chrome, but when trying to export the drawing file, it opens up a separate tab on the browser with the text that should be in the .json file. The specific version of IE I'm using is IE 11. Any thoughts on how to resolve?
Hi Daniel,
I will work on this problem this week.
At this time, the browser choose to open it as a file or in a tab. I will try to force it as a file.
It's now ok for IE >= 10 and could work on IE 9 (depending on IE security's settings).
(HTML5 browsers with support for data in href were allready OK)
New release (see first post)
Hi
I am kind of in struggling in simplifying the eDraw example widget for a simple use. What I plan to do is:
1) Draw polygon on the map
2)Turn the draw result (graphics) into feature set, I have seen some code like this:
var featureSet = new FeatureSet();
var features = [];
features.push(map.graphics.graphics[0]);
featureSet.features = features;
3) use derived featureset to clip with other layers(e.g. another polygon layer or point layer) for spatial analyses.
However I couldn't figure out how can I accommodate this code into the existing example.
Could you provide some hints?
Thanks,
Peter
Hi,
You may start "from scratch".
For the polygon drawing, use the draw toolbar directly :
Draw | API Reference | ArcGIS API for JavaScript
(The draw widget uses a wab dijit : drawBox which is too advanced for your simple needs).
PS : in a wab widget, you can access the map with this.map
Thanks for the suggestion.
I got something confused which is how to turn the ArcGIS API for JavaScript Sandbox into a widget code,
especially when I plan to have the two functions initToolbar and addGraphic:
function initToolbar() {
tb = new Draw(map);
tb.on("draw-end", addGraphic);
// event delegation so a click handler is not
// needed for each individual button
on(dom.byId("info"), "click", function(evt) {
if ( evt.target.id === "info" ) {
return;
}
var tool = evt.target.id.toLowerCase();
console.log(tool);
map.disableMapNavigation();
tb.activate(tool);
});
}
in this function, tb.on("draw-end", addGraphic); I don't know how to invoke the "draw-end" function by calling the addGraphic.
function addGraphic(evt) {
//deactivate the toolbar and clear existing graphics
tb.deactivate();
map.enableMapNavigation();
// figure out which symbol to use
var symbol;
if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
symbol = markerSymbol;
} else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") {
symbol = lineSymbol;
}
else {
symbol = fillSymbol;
}
map.graphics.add(new Graphic(evt.geometry, symbol));
}
I am trying to understand the enableMapNavigation() function, it seems that there is not such function anymore.
Any idea?
Thanks,