Invalidate cached layer rendering

John LeeJohn Lee Global Mapper UserPosts: 12
edited March 2010 in SDK
Hello,

I have been updating the memory heap on a custom raster layer. I find that I have to re-size the layer or significantly move the layer in order for it to re-render. This has not been a big issue.

However, I believe I am now also having a related issue. Rather than just showing the layer on screen, I have been outputting the layer to file. However, it seems that any changes between file outputs do not show up? Is this also a similar problem?

What is the easiest way to invalidate the internal rendering of a given custom raster layer? I have tried the first (rendering to screen) problem by calling GM_MapWindow::Invalidate (as I have been using the GM_MapWindow class for my application.)

As a possible side-issue, the output images are distorted from what I expect them to be. I recently had to change my custom raster layer from ARGB ( uint32 ) to GM_ColorFormat_16Bit_565 ( uint16 ) due to memory restrictions. Would this affect the saving of the layer in GM_ExportRaster( )?
The GM_ExportRaster function returns success.

Comments

  • John LeeJohn Lee Global Mapper User Posts: 12
    edited March 2010
    My apologies,

    I was able to locate an internal problem with the skewing of the output file (after changing ARGB uint32 to GM_ColorFormat_16Bit_565 ( uint16 ). So that should no longer be an issue. However, the each call to GM_ExportRaster( ) still seems to use cached data and neglects any changes to the memory heap of the custom raster layer.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2010
    The function that you want to use if dynamically updating a custom layer is GM_FlushLayerCache, although even that wasn't working until I just made a change. I have placed a new SDK build at http://www.globalmapper.com/GlobalMapperSDK_v134_beta.zip with this function updated to work properly so that you can use it to dynamically update a custom layer.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • John LeeJohn Lee Global Mapper User Posts: 12
    edited March 2010
    Mike,

    I am still having some difficulty with caching problems. GM_FlushLayerCache in SDK v134 seems to work great with my GUI build. However, if I call GM_ExportRaster using a command line build, then change the data in the memory buffer, then re-call GM_ExportRaster (without calling any draw / render functions) GM_ExportRaster will export the old data.

    Thanks,
    John
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2010
    John,

    Are you calling GM_FlushLayerCache before the second GM_ExportRaster call? You'll need to call GM_FlushLayerCache anytime that you change the in-memory representation that you own, otherwise there may still be cached data for that layer that doesn't know about the in-memory change.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • John LeeJohn Lee Global Mapper User Posts: 12
    edited March 2010
    I have a single function which changes the memory in question. I place a call to GM_FlushLayer_Cache at the end of that function.

    Through debug stepping, I have verified that a call to GM_FlushLayer_Cache has taken place. I will move the call and place it inside the save function before the call to GM_ExportRaster, but I do not expect any change.

    John
  • John LeeJohn Lee Global Mapper User Posts: 12
    edited March 2010
    Please disregard issue.

    I am having no problems with GM_FlushLayerCache, it works just like it should.

    My Apologies,
    John
Sign In or Register to comment.