Wednesday, 23 October 2019

Moving multiple polygon features simultaneously in arcgis js


Is there a way of moving two or more polygons simultaneously?


The following code enables the movement of a singular graphic:


           moveToolbar.activate(esri.toolbars.Edit.MOVE, tempMoveLayer.graphics[graphicNum]);

However I cannot seem to find a method that allows the movement of multiple selected graphics simultaneously.


EDIT



With the following code I manage to activate multiple toolbars for multiple graphics at the same time, however they still move separately rather than being moves as a whole when one of them is clicked and dragged.


//Loop to get all the layers on the map
for (var gCount = 0; gCount < app.map.graphicsLayerIds.length; gCount++) {
//This will obtain the layer that the selected graphic is on
var tempMoveLayer = app.map.getLayer(app.map.graphicsLayerIds[gCount]);

//Looping through all the graphics in the selected layer
for (var graphicNum = 0; graphicNum < tempMoveLayer.graphics.length; graphicNum++) {

//Comparing the selected graphic to the layer graphic currently in the loop

if (tempMoveLayer.graphics[graphicNum].attributes.OBJECTID == results.features[j].attributes.OBJECTID) {

//Activating the toolbar for the graphic. This is activated for every graphic in the loop
moveToolbar.activate(esri.toolbars.Edit.MOVE | esri.toolbars.Edit.SCALE | esri.toolbars.Edit.ROTATE, tempMoveLayer.graphics[graphicNum]);

}
}
}


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...