Select to view content in your preferred language

"Editing session" for Graphics

1566
7
Jump to solution
01-26-2017 09:36 AM
FlorianCADOZ
Regular Contributor

Hello world !

I create some graphics in my map and it's really cool but after doing it I need to Select the graphic that I just created with all the node hightligted !

My goal is to have something like a really simple Editing session where you can drag'n'drop the nodes of the graphic !

I looked in the API's doc of the graphics but I didn't found anything for the selection/editing ... however I saw some event like graphic-node-add or graphic-node-remove but no method for selecting or editing !

An idea ?

Thank you by advance 😃

0 Kudos
1 Solution

Accepted Solutions
Drew
by
Frequent Contributor

You can use the Edit module to do this assuming you are using v3.XX API

Edit | API Reference | ArcGIS API for JavaScript 3.19 

Sample

require([
  "esri/toolbars/edit", ... 
], function(Edit, ... ) {
  var editToolbar = new Edit( ... );
  //Use the edit toolbar to edit vertices
  editToolbar.activate(Edit.EDIT_VERTICES , evt.graphic);
  ...
});‍‍‍‍‍‍‍‍

View solution in original post

7 Replies
Drew
by
Frequent Contributor

You can use the Edit module to do this assuming you are using v3.XX API

Edit | API Reference | ArcGIS API for JavaScript 3.19 

Sample

require([
  "esri/toolbars/edit", ... 
], function(Edit, ... ) {
  var editToolbar = new Edit( ... );
  //Use the edit toolbar to edit vertices
  editToolbar.activate(Edit.EDIT_VERTICES , evt.graphic);
  ...
});‍‍‍‍‍‍‍‍
FlorianCADOZ
Regular Contributor

erf, I need more something like an event "onDoubleClick" or "onCreated" that allow me to edit it just after fired ...

0 Kudos
Drew
by
Frequent Contributor

The Edit module will allow you to edit the graphics nodes.

You turn it on and off when you want.

When the user clicks the graphic just call the activate function

0 Kudos
Drew
by
Frequent Contributor

Or on 'graphic-add'  just call the activate function

0 Kudos
FlorianCADOZ
Regular Contributor

No there's no UI ? Juste to click on the graphic ?

If that's it, I have to pay you a beer !

0 Kudos
Drew
by
Frequent Contributor

Here is how I would do it..

 

Add the graphic

On graphic-add call the Edit activate function and pass in the newly created graphic.

Finally, buy me a beer

Drew

FlorianCADOZ
Regular Contributor

Alright ! It sounds great! Thanx a lot !

So, for the beer, I'm living in Toulouse, France and there, there is a cool pub called the De Danu !

1- Go to the De Danu 

2- Send me message

3- Come to me and remerber me the cool trick you gave me with the toolbar

4- Drink the cool beer I have paid you !