Select to view content in your preferred language

Use the Symbol Gallery in an Add-in

670
2
08-30-2010 06:55 PM
BrandonSchaeffer
Emerging Contributor
I am working on an add-in that would add notes to the map, the user will be able to select the symbol that is used for the points that are added I would like to make use of the symbol gallery that shows up on the appearance tab and the context menu in the contents window.  Is it possible to programmatically access the symbol gallery so that I can provide the users a way to select the symbol that the add-in will use which is consistent with the look and feel of AGX and that will contain all of the default symbols plus the custom symbols that the user may have already added.
If not I think this is a good candidate to be exposed in the next api update.

Thanks,

Brandon
0 Kudos
2 Replies
ShellyGill2
Regular Contributor
Hi,

I'm afraid there's nothing in the API at the recent 1500 release to do this in one shot.

However, I have attached an add-in with some code which gets pretty close - however, some of this is not using the API but doing things kind of behind the scenes - although I know this works for 1200 and 1500, I cant vouch that the internals of Explorer won't change in future, which could cause this to stop working in a future release, so it should definately be tested with each release if you need to use it.


As you can see in the source code in the attachment:
- Getting the marker symbols in My Symbols is done by accessing the SymbolCache folder where Explorer keeps all locally referenced symbols - the folder includes symbols used in KML files, and possibly other places, so the code reads the files in the cache and checks for an attribute indicating if the symbol is part of 'My Symbols'.
- There are two approaches demonstrated for getting the standard out of the box symbols. The first approach shows using reflection to access the static members of the Symbol class, and has the advantage that we do not plan to change the API, so may be more reliable moving forwards. The only slightly inconsistent behavour is that there is only one nested class of static methods for lines, not a separate class for the different thicknesses as actually shown in the app. The second approach, commented out in the code, uses the symbols listed in a local cache file. This approach could be affected by possible internal changes in any future release of Explorer, but I know works with 1200 and 1500. This also has a slight anomoly with the line symbols, as all thicknesses are shown in the same gallery group, not differentiated by thickness.

Hope this helps some,
0 Kudos
BrandonSchaeffer
Emerging Contributor
I have attached an add-in with some code which gets pretty close


Shelly,
Thanks for the quick response, I downloaded your zip file but I am having trouble opening it.  Winzip says that it is not a valid archive.  Any suggestions?

Thanks,

Brandon
0 Kudos