I am using the jimu drawbox dijit to draw points, lines or polygons on custom widget that I am developing. Is there a way of setting the symbol properties of the graphics drawn. When I select to draw a point for instance the point is blue the transparency set to 50% size is 24.
I would like to change some of the properties but I can't figure out how, I have tried the following
this.drawBox.setPointSymbol(this.config.point_symbol);
where point_symbol is define as
{
"color":{"r":0,"g":0,"b":128,"a":0.5},
"size":12,
"type":"simplemarkersymbol",
"style":"circle",
"outline":{
"color":{"r":0,"g":0,"b":128,"a":1},
"width":1,
"type":"simplelinesymbol",
"style":"solid"
}
"xoffset":0,
"yoffset":0
}
When I set the point symbol as shown above the point is not drawn on the map. Removing the line above the point is drawn with default properties that I would like to change.
Regards,
Solved! Go to Solution.
Wadson,
That method is expecting a symbol class and not just a json string.
Try:
this.drawBox.setPointSymbol(new SimpleMarkerSymbol(this.config.point_symbol));
Wadson,
That method is expecting a symbol class and not just a json string.
Try:
this.drawBox.setPointSymbol(new SimpleMarkerSymbol(this.config.point_symbol));
Thanks Robert and Andrew that has worked.
Robert,
I am trying to do something very similar to what is being discussed here. I feel like I am very close to accomplishing it, but what I am unsure of is where point_symbol should be defined? In a config file? Within the widget.js file?
My apologies for such an utterly basic question.
Thanks!
In the config file
Thanks, Robert. This is what I have been trying, but when I open the widget it does not show the point symbol chooser, and defaults to the normal 1st option in the chooser. It does not show account for any of the changed parameters in the config file. Any Ideas? Below is what I have added to the config.json file.
"point_symbol":[{
"color":{"r":0,"g":250,"b":0,"a":1},
"size":58,
"type":"simplemarkersymbol",
"style":"circle",
"outline":{
"color":{"r":0,"g":128,"b":0,"a":1},
"width":1,
"type":"simplelinesymbol",
"style":"solid"
}
"xoffset":0,
"yoffset":0
}]
Thanks again.
Brant,
The point symbol should not be in any array. You have your symbol inside square brackets (an array).
I am really appreciating the suggestions. Unfortunately, removing the square brackets did not change anything. The code above(minus the array) is pasted before the final curly bracket in the /widgets/Draw/config.json file. The line in the /widgets/Draw/Widget.js file matches what you have included above.
Brant,
OK this is the problem
The code above(minus the array) is pasted before the final curly bracket in the /widgets/Draw/config.json file
The config file that the widget uses after it is added to the app is not that file it is the json file that is in the apps configs/Draw/config_X.json
Hey Robert,
Unfortunately, it's still no-go. I placed the point_symbol information in the correct config file, and it still is ignoring my parameters. I hate to keep taking up your time... Is there some resource I can go to to learn more about how the line in Widget.js knows to go looking in the config.json file, or a resource for how the point symbol should be properly formatted?
Thanks again!
-Brant