Select to view content in your preferred language

edit user drawings

894
1
09-28-2010 03:58 AM
AlessioDi_Lorenzo
Emerging Contributor
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!
0 Kudos
1 Reply
AlessioDi_Lorenzo
Emerging Contributor
Ok... it was a stupid error -.-'

I wrote new esri.toolbars.Draw instead of new esri.toolbars.Edit... now it works.
I'm sorry I wasted your time!

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);
 });
}
0 Kudos