Global Mapper v25.0

Feature Request to add data to workspace storage

dcoggin
dcoggin Global Mapper UserTrusted User
edited February 2012 in SDK
Mike,

I have a suggestion/request for a feature to add to the SDK. I would like the capability to store user data with a workspace. Maybe this could just be a void pointer and size for a buffer when saving and the SDK could return a pointer to the buffer when opening. Along with this would be a need for the user to be able to identify layers between the saving and opening of the workspace. I suppose the layer handles are just pointers and would not remain the same through a saving and opening.

Thanks,
David

Comments

  • global_mapper
    global_mapper Administrator
    edited February 2012
    David,

    There is a GM_SetLayerUserData function in the SDK for setting a void* to associate with a layer in the SDK. You can get it back using GM_GetLayerInfo as the mUserData value in GM_LayerInfo_t. Would this work, or do you need something that actually gets saved to the workspace and then loaded back in when you reload the workspace, so it can be persistent across calls? If so, I could add something like a GM_SetLayerUserString that saves a string that you provide (you can encode it however you want so you could stuff binary data in there with UUencoding or something), then save that in the workspace and load it back in on import and provide via GM_LayerInfo_t.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • dcoggin
    dcoggin Global Mapper User Trusted User
    edited February 2012
    Mike,

    I make a lot of use of the mUserData value and some of the items I store there are what I would like to reload with the workspace. I also have other file types (TINs) that I would like to save and read with the workspace as well as enabled and order of display information. Some of this is particular to a layer and some to the workspace as a whole. So I guess I'm really looking for both -- persistent layer and workspace info. I'm not familiar with binary to text protocols, but I expect I can figure out something to use.

    Thanks,
    David
  • global_mapper
    global_mapper Administrator
    edited February 2012
    David,

    For the non-layer stuff you might consider adding a plugin for those types (if raster and elevation format since that is what is supported) and then they would automatically get saved to the workspace as they would then be a normal layer. Or if you load them into a custom layer in the SDK, the data from that layer would then be embedded in the workspace itself. Actually now that I think about it what you could do for the custom non-layer stuff even if it isn't a layer is just create a custom layer with a point feature or something that has a display label or attribute with the actual data embedded, then when you load the workspace you can find that layer and do whatever you want with that data stuffed in the attribute/label, then just close that layer when you are done with it.

    For the layer-specific stuff, would adding a custom string to associated with the layer work?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • dcoggin
    dcoggin Global Mapper User Trusted User
    edited February 2012
    Mike,

    I had just started thinking about adding a dummy layer for the workspace general stuff. Yes, a string associated with the layer should work for the layer specific. Now I have to get smart on the binary to text methods.

    Thanks a lot, Mike.

    David
  • dcoggin
    dcoggin Global Mapper User Trusted User
    edited February 2012
    Also, I've got plug-ins for raster formats, but I have other formats (constrained TINs) that are vector. I suppose it's possible to store those as a custom layer, but every edge in the TIN would have to be a separate feature (polygon wouldn't work since there are edge specific attributes). Right now I just save and re-open from file in my application, but having them come and go with the workspace would be nice.

    David
  • global_mapper
    global_mapper Administrator
    edited February 2012
    David,

    I have added a GM_SetLayerUserText function to allow setting a text string to associate with a layer that will be saved to and loaded from workspace files and made available in GM_LayerInfo_t. The new SDK build is at http://www.globalmapper.com/GlobalMapperSDK_latest_beta.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike