AnsweredAssumed Answered

graphic.getShape() always return null

Question asked by xuejinruan on Oct 6, 2014
Latest reply on Oct 13, 2014 by riyasdeen_b

According to the ArcGIS Javascript API documentation for Graphic object, Graphic has a getShape() or getDojoShape() method, which:

Returns the Dojo gfx shape of the ESRI graphic.

graphic-amd | API Reference | ArcGIS API for JavaScript


It seems for older version of the Javascript API, it actuallly returns an object. However, in the newer version of Javascript API, it always return null for my point graphic object or polygon graphic object.


What I want to do is to implement a draggable marker, namely drag graphics point and drop at a new location using dojox.gfx.Moveable tool, something like:


var dojoShape = graphic.getDojoShape();   //or graphic.getShape();

var moveable = new dojox.gfx.Moveable(dojoShape);


//Update the geometry at the end of move 

var moveStopToken = dojo.connect(moveable, "onMoveStop", function(mover) { 

   // Get the transformation that was applied to  

  // the shape since the last move 

       var tx = dojoShape.getTransform(); 

      var startPoint = graphic.geometry; 

      var endPoint = map.toMap(map.toScreen(startPoint).offset(tx.dx, tx.dy)); 

     // clear out the transformation 


      // update the graphic geometry