Select to view content in your preferred language

Strange behavior of DirectlyOver method in manipulation scenarios

3027
3
10-27-2010 08:52 AM
IdoFlatow
Emerging Contributor
I'm trying to use the manipulation "hold" event on a map point to allow moving it, and some of the code behaves strangely. Note: since the editor can't use EditVertices with map points,all my graphic objects have a geometry that uses MultiPoint with one map point.

The scenario is as follows:
1. capturing "hold" manipulation event
2. calling DirectlyOver on event arg to get the touched graphics (using a graphics layer)
']

For some reason the DirectlyOver method returns a graphic object different from the graphic that is in the layer - the attributes are the same, but the geometry contains a MapPoint instead of a MultiPoint. If my layer contains graphics with MapPoint geometry (intead of MultiPoint), then the DirectlyOver returns the exact graphic object (same reference).

What causes this behavior? how can I use the editor to move map points over a map, while my map control uses manipulation events?
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
Are you using the Map's MapGesture Hold?

Moving a MapPoint is supported by EditVertices. You can either move the point using your mouse or using touch. They should behave the same way - for mouse: you press on MouseLeftButtonDown, move the mouse and release to let go; for touch: you touch down on graphic, move your touch to drag the item and touch up to let go.

Are you saying the graphic you choose to move does not move, instead another graphic is moved? Or are you simply looking for an event to know which graphic was moved?
0 Kudos
IdoFlatow
Emerging Contributor
Are you using the Map's MapGesture Hold?

Moving a MapPoint is supported by EditVertices. You can either move the point using your mouse or using touch. They should behave the same way - for mouse: you press on MouseLeftButtonDown, move the mouse and release to let go; for touch: you touch down on graphic, move your touch to drag the item and touch up to let go.

Are you saying the graphic you choose to move does not move, instead another graphic is moved? Or are you simply looking for an event to know which graphic was moved?


Hi,

I'm using the MapGesture event to catch the hold (I also use WPF manipulation events because the ESRI control manipulation for gestures doesn't support rotation so I had to add my own manipulation).
In the MapGesture event I use the e.DirectlyOver to get the graphic objects the cursor/finger is over and the graphic objects I get look like the graphic objects from the graphic layer (same attribute collection), but they are duplicates - they are not of the same reference, they do not have the PropertyChanged event registration I did for my graphic objects, and their geometry is MapPoint while my geometries are MultiplePoint.

Somehow the DirectOver method created new graphic objects instead of the objects that are in the layer. BTW, this only happens when I use MultiplePoint. If I change my graphic object creation code to use MapPoint the DirectOver method works, but the editor's EditVertice cannot be executed (calling CanExecute on the command with the graphic object that has a geometry of MapPoint returns false).

I'm using v2.1 beta (latest release)
0 Kudos
JenniferNery
Esri Regular Contributor
Correct me if I'm wrong. You are using the MapGesture.Hold to trigger an EditVertices where you pass the graphic as the CommandParameter?

If you want to use EditVertices for MapPoint, you set the CommandParameter to null (not the graphic). While EditVertices is active, any graphic you touch provided it comes from a layer that is included in the Editor, will respond to move or edit geometry.

If you are to use DirectlyOver from Map.GestureEventArgs, do you provide a tap_tolerance (double) and specify the layer of interest? (Like the one below)

IEnumerable<Graphic> graphics = e.DirectlyOver(TAP_TOLERANCE, new List<GraphicsLayer>() { vertexLayer });

And you say the graphics returned here are incorrect?
0 Kudos