digy79

edit user drawings

Discussion created by digy79 on Sep 28, 2010
Latest reply on Sep 28, 2010 by digy79
Hi,

I created an app that lets users to draw a freehand polygon to use it as a geometry parameter in a query.
Now I'd like to add the possibility to edit this polygon but I'm having problems.

When I create the polygon with the draw toolbar I add the geometry to a GraphicsLayer to be able to manage it (add, clear, remove from map):

var drawing_tb, handPolygon,handPolygonLayer;

function polySelection() {
 
    drawing_tb = new esri.toolbars.Draw(map,{
          showTooltips: false,
      setRespectDrawingVertexOrder: true
    });
    
    drawing_tb.activate(esri.toolbars.Draw.FREEHAND_POLYGON);
 
    dojo.connect(drawing_tb, "onDrawEnd", polygonAction);
 
    if (handPolygonLayer){
        handPolygonLayer.clear();
    }
}


function polygonAction(handPolygonGeometry){
 
    var handPolygonSym = new ....
    handPolygon = new esri.Graphic(handPolygonGeometry,handPolygonSym);
 
    handPolygonLayer = new esri.layers.GraphicsLayer();
    handPolygonLayer.add(handPolygon);
    map.addLayer(handPolygonLayer);
 
    drawing_tb.deactivate();

    //Editing
    dojo.connect(handPolygonLayer, "onDblClick", function(evt) {
     dojo.stopEvent(evt);
        editing_tb = new esri.toolbars.Draw(map);
 editing_tb.activate(esri.toolbars.Edit.EDIT_VERTICES,handPolygon);
 });
}


When I double click on the polygon Firebug returns "Unsupported geometry type: 2"

Thanks for help!

Outcomes