SketchEditor move 2 points along circle to take a portion of the circle

1017
5
12-14-2018 09:13 AM
NathanRaley
New Contributor III

Is it possible to set up the sketch editor so that you have two points that you can drag along the perimeter of the circle so that you can take a portion of the circle?  We have scenarios where the users aren't wanting to have a full circle, but rather a portion of it, think of it as either taking a piece out of the pie or taking the pie with the piece cut out of it.

We'd like them to drag the two points around the perimeter of the circle to determine how much of the circle they want to take when they choose to take a partial pivot.

We were thinking of adding the circle as a feature on the map, setting it with no fill and an outline utilizing a dashed line.  Then putting 2 points on top of each out in the sketch editor.  As they move the points we'd add another circle feature that is filled with the area between the two points.  We'd need to snap the points along the perimeter of the 1st circle feature though, which we aren't quite sure how to accomplish that piece.

Any ideas on how to implement something like this?

0 Kudos
5 Replies
dotMorten_esri
Esri Notable Contributor

For something like that you'd have to build some custom logic using a GraphicsOverlay and use mouse events to track click/drag/move and move the features around. That's somewhat involved but definitely doable (this is essentially what the sketcheditor is also doing)

0 Kudos
NathanRaley
New Contributor III

We figured as much.  I have most of the interaction stuff working.  The GeometryChanged event isn't firing, but I believe that is a known bug in 100.4, so I just added a watcher for the property changed on the geometry property instead for the time being.

I'm not seeing any of the cursor/pointer moved events to register though to handle that in the runtime for Xamarin.Forms.  Any ideas on how to subscribe to that event so we can attempt to keep the point on the line?

0 Kudos
dotMorten_esri
Esri Notable Contributor

Aaah I wasn't aware you were using Forms. Interaction events in Forms are really poor - you can't really get the needed events there. You'd have to use a renderer and the native MapView control to perform something like that, and you'd have to repeat it for each platform. That's a lot more involved, since you basically won't be using our Forms control, but fallback to your custom renderer approach (or create a generic touch surface "on top" of the MapView that you enable when needed). Generic cross-platform touch events have long been missing in the Forms platform.

0 Kudos
NathanRaley
New Contributor III

You used to be able to use reflection to achieve this by retrieving the NativeGeoView property and subscribe to the corresponding events, is this no longer possible?

0 Kudos
dotMorten_esri
Esri Notable Contributor

We don't guarantee anything will work when calling into internals. It might work today, and break tomorrow. In addition, Xamarin sometimes will optimize away things in release builds, and that might break you as well. Also reaching into the internal properties and changing state could cause a cascading effects because we don't guard against changes like that.

0 Kudos