Select to view content in your preferred language

Curves between map points in a graphics layer

728
5
08-19-2010 06:25 AM
JayRaja
Emerging Contributor
I would like to create a custom Graphic which appears as a curve between two Map Points.

I have been trying to achieve this by creating a custom symbol whose control template defines a curve using a QuadraticBezierSegment. I would like to bind the start point and end points to the two map points I am connecting (determining a control point separately). The question is, how can I bind the two map points as screen points to define the shape of the curve and ensure that they are updated when the user zooms and pans?

As an alternative I have considered using a SimpleLineSymbol with a complicated PolyLine geometry but the number of points needed to describe a curve causes a performance problem when zooming and panning when there are a large number of curves on screen.
0 Kudos
5 Replies
dotMorten_esri
Esri Notable Contributor
GraphicsLayer does not support curves. The only way I can see how to do it would be to densify the line as you describe. If you are having performance issues, my guess is that you are over-densifying it beyond what's necessary.

As an alternative you could also use the ElementLayer.
0 Kudos
JayRaja
Emerging Contributor
Thanks for your response. Densifying the line isn't really appropriate as it takes a large number of points to make the curve sufficiently smooth, and even then when zooming in the points on the curve as so far apart visually it begins to look less and less curvy.

I've managed to get something working using the ElementLayer but it took some effort. The curve is defined by a QuadraticBezierSegment within a Path, so I need to specify 3 screen points (start point, end point and control point) getting the right interplay between the map points and screen points has been tricky.

In order to fix the curve between two map points, I determine the envelope covering those points and pass it to the UIElement to be drawn in the ElementLayer. The UIElement consists of a curve in a Viewbox so it can be scaled appropriately as the extent changes. However, the results aren't great and I need to change the stroke thickness each time the extent changes.

I'm surprised that simply specifying a control template for a symbol does not work. Is there any intention to allow for complex paths to be used in control templates in future versions and if not, can I suggest this as a feature to be considered?

Drawing curves seems to be such a natural thing to want to do, but it's been made really hard!
0 Kudos
PhilippeSteinthal
Deactivated User
Hi,
Would you be kind enough to share your code of the UIElement with the ViewBox for the curve.
Thanks
Philippe
0 Kudos
PrateekBansal
Emerging Contributor
Will really appreciate if any of you can share the code as I am really struggling with it .
Thanks
Prateek
0 Kudos
DominiqueBroux
Esri Frequent Contributor
0 Kudos