AddCustomSymbol/RemoveCustomSymbol

Osei
Osei Global Mapper UserTrusted User
edited August 2009 in SDK
I just want to express my wish for the AddCustomSymbol method. The AddCustomShader method overwrites a custom shader if it already exists and creates a new one if it doesn't.

If the AddCustomSymbol method could behave like that, it would have been great compared to the current behaviour where it returns a "Symbol already added" error message. The reason why I'm asking this is that users like to change colors over and over again.

Example scenario
User changes layer style to display points in orange crosses.
1. I draw my object in orange
2. Save to file
3. Load using AddCustomSymbol(file name, symbol name)
4. Spin through all objects and tell them to draw using "symbol name")

User changes color again to green (they are never satisfied with just one color)
5. I draw my object in green
6. Save to file
7. Load using AddCustomSymbol(file name, symbol name)
The problem with step 7 is that since I already used up "symbol name", I will have to randomly generate a new symbol name and use it in AddCustomSymbol then spin through all my objects once again giving them this new "symbol name".
On the other hand, if AddCustomSymbol could just overwrite the old symbol but with the same symbol name, then it will be a whole lot easier and I wouldn't have to spin through all objects anytime there is a color change. This is similar to the AddCustomShader method.
I know in C/C++, this would be no problem as GM is already in C and the performance hit is therefore minimal.

But using C# or any .NET language for that matter, I have to be careful spinning through objects because Marshalling between managed data and unmanaged data is quite an intensive process which becomes significant if the number of objects is significant.

A RemoveCustomSymbol method would also be great. Then I can remove old symbol then add the new custom symbol with same "symbol name".

Comments

  • global_mapper
    global_mapper Administrator
    edited August 2009
    I have added a GM_RemoveCustomSymbol function which should allow you get to get the behavior that you are after (just call it if you get the "already used symbol error", or even just always call it before adding a new custom shader and ignore any error return). I have placed a new build of the SDK with this change at http://www.globalmapper.com/GlobalMapperSDK_v131_beta.zip that you can try.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com