Select to view content in your preferred language

Clone a Graphic Symbol?

1051
5
07-08-2011 06:39 AM
JasonKnisley
Deactivated User
I've been playing with the new MeasureAction, and I'm trying to use it to allow the display of multiple measurements at the same time.  This is easy for Polyline and Polygon as they both use the same graphics layer, and I can use the CollectionChanged event to temporary copy those graphics (by reference) to a list.  When the MeasureAction is complete for those two modes all of the graphics are removed from their original layer, allowing them to then be copied by reference from my temporary list to a new graphics layer.

The Radius mode uses it's own graphics layer, and that is where I run into problems.  Unlike the other two modes, the graphics used in this mode are persistent, and so the CollectionChanged event is useless.  Instead, I used the MouseLeftButtonDown event, which triggers once at the end of the measurement and I make a copy of the graphics at that time to add to my other graphics layer.
Graphic copiedGraphic = new Graphic() {
    Geometry = Geometry.Clone(graphic.Geometry),
    Symbol = graphic.Symbol,
};


The problem that I have is with the RotatingTextSymbol (see screenshot link below).  I can clone the geometry of the graphic, but the symbol is just a reference copy, and so each subsequent Radius MeasureAction updates the symbol for all of the copied graphics.  It would be straightforward if I could make a new RotatingTextSymbol for my copied graphics and then copy the attributes to it, but I don't see a way to do that because: 'ESRI.ArcGIS.Client.Behaviors.Utilities.RotatingTextSymbol' is inaccessible due to its protection level

Any ideas on how to accomplish this would be greatly appreciated.

0 Kudos
5 Replies
JenniferNery
Esri Regular Contributor
RotatingTextSymbol is internal but you can refer to this thread so you can create one for yourself: http://forums.arcgis.com/threads/18339-How-create-vertical-TextSymbol?highlight=RotatingTextSymbol
0 Kudos
JasonKnisley
Deactivated User
Thank you for your response.  I guess the root of the problem that I face isn't with creating my own RotatingTextSymbol, but in reading the properties of the internal one used by the graphics layer for the Radius mode of the MeasureAction.  I would need a way to read the value of the Text property in order to populate that property in the RotatingTextSymbol that I create.  Since it's internal I get an error that the attempt by my method to access method 'ESRI.ArcGIS.Client.Behaviors.Utilities.RotatingTextSymbol.get_Text()' failed.

Is there any way for me to read this value so that I can copy it to my own instance of RotatingTextSymbol?
0 Kudos
JasonKnisley
Deactivated User
I know that this thread has been dead for awhile, but I just wanted to follow up on this to see if someone from ESRI might know if, in a future API release, distances from MeasureAction will be accessible.  Thanks.
0 Kudos
JenniferNery
Esri Regular Contributor
As far as I know there's no plan for exposing distances in MeasureAction but our next release will include Geodesic and Euclidiean calculations for length and area, which maybe something you can use instead with Draw.
0 Kudos
JasonKnisley
Deactivated User
Jennifer,

Thanks for the reply!  Is there a calendar anywhere of anticipated API release dates or is it simply a matter of checking the download page every so often?
0 Kudos