Edit Graphics Drawn with Draw Widget

3342
9
Jump to solution
11-22-2015 01:07 PM
DouglasLong
New Contributor III

anyone have this done already?

I modified the Draw Widget, so that is it completely custom, and I have made it add the output to table of contents (Feature Layer),

anyways, my question is, does anyone know how to make the graphics editable? (I am aware of a context menu, but just wondering if anyone has done it yet, I have seen it in the eDraw widget, but not the Draw widget)?

Thanks,

0 Kudos
1 Solution

Accepted Solutions
DouglasLong
New Contributor III

Hey All,

I solved it, I basically figured out an alternative to updating the operational layers

this was solved by creating an edit button and save button in the widget

  • operational layer can't be edited therefore
  • built edit button that calls function that removes operation layer, and clears graphics layer
  • left over with a graphic, that user can now edit (editing graphics is stupid easy)
  • when user hits save, it syncs the newly edited graphic to the operational layers of the map

View solution in original post

9 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Douglas,

   The eDraw is based off of the otb draw widget so should be able to borrow code from it.

0 Kudos
DouglasLong
New Contributor III

yup, I borrowed the code from it, but its doing something rather funny, perhaps you might know what it is,

I am able to edit the graphic (only able to edit vertices, the move, rotate, and scale options do not work),

I am using something along these lines (same as eDraw widget)

editorActivateGeometryEdit : function (graphic) {

  if (!graphic)

  this.editorActivateSnapping(false);

  if (!graphic && this._editorConfig["editToolbar"]) {

  this._editorConfig["editToolbar"].deactivate();

  return;

  }

  var tool = 0 | Edit.MOVE;

  if (graphic.geometry.type != "point")

  tool = tool | Edit.EDIT_VERTICES | Edit.SCALE | Edit.ROTATE;

  var options = {

  allowAddVertices : true,

  allowDeleteVertices : true,

  uniformScaling : true

  };

  this._editorConfig["editToolbar"].activate(tool, graphic, options);

  },

but I am not able to actually rotate, move or scale, only move vertices,

probably something stupidly simple.

thanks for the help, let me know

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Douglas,

   So you are not getting the extent box around the geometry with handles for re-sizing and rotating? Like in this image?

preview.jpg

0 Kudos
DouglasLong
New Contributor III

Exactly,I have been testing different things and I have only been able to edit vertices

0 Kudos
TimWitt2
MVP Regular Contributor

Douglas,

do you mean something like this ArcGIS Web Application  just right click the graphic you have created.

You can get the code here Enhanced Draw Widget

Tim

DouglasLong
New Contributor III

Hey Tim,

looks like your right, I originally had taken the code from the Draw Widget, and enhanced draw widget,

I am still somewhat puzzled why I can only use the Edit.MOVE_VERTICES handle in my code, but the move, rotate, and scale wont work,

perhaps its because you have the OnOpen method and you set

var map = this.map;

editToolbar = new Edit(map);

where I have my editToolbar initialization in the PostCreate Method.

I will keep posted with any updates, but I am assuming this will solve my issue based on the code.

0 Kudos
DouglasLong
New Contributor III

Tim Witt

or

Robert Scheitlin, GISP

have any if you guys had luck with enabling the edit toolbar for operational layers?? (created via draw widget)? I have modified AdvDraw widget and Draw Widget, but still no luck for editing operational layers (created from graphics), editing graphics are no issue, just operational layers

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Douglas,

   No I personally have not but I will do some testing when time permits and report back.

DouglasLong
New Contributor III

Hey All,

I solved it, I basically figured out an alternative to updating the operational layers

this was solved by creating an edit button and save button in the widget

  • operational layer can't be edited therefore
  • built edit button that calls function that removes operation layer, and clears graphics layer
  • left over with a graphic, that user can now edit (editing graphics is stupid easy)
  • when user hits save, it syncs the newly edited graphic to the operational layers of the map

View solution in original post