Hi all,
I'm migrating an app from 10.2.6 runtime version to 100.1.
Core question, I'm having some troubles using PictureMarkerSymbol as Graphic selection symbol in a GraphicsLayer
In 10.2.6 to select a Graphic object, in onFindGraphicsComplete, I used
merchantLayer.selectGraphic(graphicIDs[0]);
and to assign it a new selection symbol I set
GraphicsLayer {
id: merchantLayer
selectionSymbol: defaultSelectionSymbol //this is a PictureMarkerSymbol!!!
It works fine.
Now, with 100.1, there's no more GraphicsOverlay.selectionSymbol. There's only selectionColor.
I'm trying this way, select the Graphics like this
onIdentifyGraphicsOverlayStatusChanged: {
identifyGraphicsOverlayResult.graphics[0].selected=true; and set onSelectedChanged() in each Graphics object to intercept the selection status change and perform the substitution of Graphic renderer.Before moving on, do you think this is the right solution? If it is so, my Graphics object is dinamically built like this for (var i = 0; i<features.length; i++){
var merchantGeometry = ArcGISRuntimeEnvironment.createObject("Point", {"json": features[i].geometry});
var attributes = features[i].attributes;
var merchantGraphic = ArcGISRuntimeEnvironment.createObject("Graphic", { geometry: merchantGeometry })
merchantGraphic.attributes.attributesJson = attributes;
//HELP! Here I'm not able to set onSelectedChanged
...
How can I do somethig like this qml:
merchantGraphic.onSelectedChanged: {
console.log ("selected status changed. Change graphic's renderer")
};
Minor question, the AppStudio 2.1.19 downloaded doesn't have the latest runtime 100.2, do I have to install something else?
THANK YOU for your attention.
Massimiliano
Hi Massimiliano:
I hope I'm understanding what you are trying to do.
> Before moving on, do you think this is the right solution?
Answer: Yes.
If you're trying to find out what is currently selected on the GraphicsOverlay and then act on it, you can get a list of the selected graphics through the selectedGraphics property. Then you can get the graphic and change its symbol. Do I understand correctly?https://developers.arcgis.com/qt/latest/qml/api-reference/qml-esri-arcgisruntime-graphicsoverlay.htm...
Regarding AppStudio, it hasn't released on top of 100.2 just yet. It will.
Hi Eric,
thank you. The issue is not how to get selected Graphics but how to manage the change of selection status.
I'm trying this way but something goes wrong emitting or catching the signal selectedChanged.
I defined my Graphics as
var merchantGraphic = ArcGISRuntimeEnvironment.crateObject("Graphic", { geometry: merchantGeometry, symbol: merchantSymbol, onSelectedChanged:myChangeSymbol() });merchantLayer.graphics.append(merchantGraphic);
and I selected it inside
onIdentifyGraphicsOverlayStatusChanged: {if (identifyGraphicsOverlayStatus === Enums.TaskStatusCompleted) {if (identifyGraphicsOverlayResult.graphics.length > 0) {var identifiedGraphic = identifyGraphicsOverlayResult.graphics[0];identifiedGraphic.selected=true;
Why the onSelectedChanged: myChangeSymbol() is not called when I set identifiedGraphic.selected=true; ?
Even force it identifiedGraphic.selectedChanged();
Thanks
Massimiliano