I would like to remove measures that I do not use in the Measurement widget.
Solved! Go to Solution.
Liorit,
In the Widget.js you can add this code:
Line 17 I am setting the default length unit to Kilometers.
Line 28 and 29 I am removing Miles as an option.
startup: function() {
if (this.measurement || this._pcDef) {
return;
}
this.inherited(arguments);
var json = this.config.measurement;
json.map = this.map;
if (json.lineSymbol) {
json.lineSymbol = jsonUtils.fromJson(json.lineSymbol);
}
if (json.pointSymbol) {
json.pointSymbol = jsonUtils.fromJson(json.pointSymbol);
}
this._processConfig(json).then(lang.hitch(this, function(measurementJson) {
measurementJson.defaultLengthUnit = esriUnits.KILOMETERS;
this.measurement = new Measurement(measurementJson, this.measurementDiv);
this.own(aspect.after(this.measurement, 'setTool', lang.hitch(this, function() {
if (this.measurement.activeTool) {
this.disableWebMapPopup();
} else {
this.enableWebMapPopup();
}
})));
this.measurement.startup();
this.measurement._distanceUnitStrings = ["Kilometers", "Meters"];
this.measurement._distanceUnitStringsLong = ["esriKilometers", "esriMeters"];
this._hideToolsByConfig();
}), lang.hitch(this, function(err) {
new Message({
message: err.message || err
});
}));
},
Liorit,
In the Widget.js you can add this code:
Line 17 I am setting the default length unit to Kilometers.
Line 28 and 29 I am removing Miles as an option.
startup: function() {
if (this.measurement || this._pcDef) {
return;
}
this.inherited(arguments);
var json = this.config.measurement;
json.map = this.map;
if (json.lineSymbol) {
json.lineSymbol = jsonUtils.fromJson(json.lineSymbol);
}
if (json.pointSymbol) {
json.pointSymbol = jsonUtils.fromJson(json.pointSymbol);
}
this._processConfig(json).then(lang.hitch(this, function(measurementJson) {
measurementJson.defaultLengthUnit = esriUnits.KILOMETERS;
this.measurement = new Measurement(measurementJson, this.measurementDiv);
this.own(aspect.after(this.measurement, 'setTool', lang.hitch(this, function() {
if (this.measurement.activeTool) {
this.disableWebMapPopup();
} else {
this.enableWebMapPopup();
}
})));
this.measurement.startup();
this.measurement._distanceUnitStrings = ["Kilometers", "Meters"];
this.measurement._distanceUnitStringsLong = ["esriKilometers", "esriMeters"];
this._hideToolsByConfig();
}), lang.hitch(this, function(err) {
new Message({
message: err.message || err
});
}));
},
I would answer for Clément whose traineeship is over :
"Thank you Robert, that was exactly what I was looking for"
I can't close directly this ticket for him but we can consider it as close.
Thanks