Custom Brush Styles using Bitmap Textures

OseiOsei Global Mapper UserPosts: 119Trusted User
edited July 2010 in SDK
I have some Area Features that I would have liked to draw with custom Bitmap Textures. In the GM_BrushStyle_t16 enum, I find that some Pattern brushes have been defined and there is a GM_BRUSH_FIRST_CUSTOM enumeration. I wanted to find out if it is possible now (GM SDK1.34) to define custom brush styles using custom bitmaps.

And if so, how do I add a custom brush style to GM. Thanks in advance.

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    There isn't currently a way to programmatically define a new brush style with the SDK, but I can add a function for that.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited May 2010
    Thanks in advance then.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2010
    I have added a new (untested) GM_AddCustomAreaStyle function to the SDK that should allow you to add a custom fill style based on a file. Note the function also has functionality where if you pass in an already used area style name, you will get back the style ID used for that style name and an error code (GM_Error_BrushAlreadyCreated), so you can use that to find the ID for existing area style names.

    I have placed a new build of the SDK with this function at http://www.globalmapper.com/GlobalMapperSDK_v134_beta.zip for you to try.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited July 2010
    I have downloaded the updated SDK from the link. I have tried to look up the function in both the docs and the header file and I can't find it.

    Also, can you give an estimate when the 1.34 SDK will be finally released? Thanks in advance
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited July 2010
    Osei,

    Here is the declaration from the GlobalMapperInterface.h file (sorry I had the name wrong in my earlier message):


    // Adds a new custom brush style that can be used when drawing area features
    // (see the GM_SetAreaFeatureDrawStyle function)
    GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomBrushStyle
    (
    const char* aImageFilename, // IN: Full path to image filename to use for custom fill pattern
    const char* aStyleName, // IN: Text name to use when referring to the fill style
    GM_BrushStyle_t16* aStyleVal // OUT: Value of created custom fill style
    );


    We expect to release v1.34 of the SDK shortly after the v12.00 release of Global Mapper, so likely in late August/early September.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited July 2010
    The GM_AddCustomBrushStyle works so far. Unfortunately, trying to set an Area's style to the custom brush style using GM_SetAreaFeatureDrawStyle fails as it returns InvalidDrawStyle. However, setting to one of the in-built brush styles works perfectly.

    I have attached the water.bmp file as well as a zip of the shapefile I was trying it on.

    The code is as below;

    ////////////////////////////////////////////////////////////////////////////////////////////////
    GM_BrushStyle_t16 style;

    GM_Error_t32 err = GM_AddCustomBrushStyle("Path to bitmap", "water", &style);

    if(err == 0)
    {
    // Get the layer info
    GM_LayerHandle_t32 theLayer = (GM_LayerHandle_t32)mLayerList.GetItemData( 0 );

    GM_AreaFeature_t* areaFeat = GM_GetAreaFeature(theLayer, 0);

    GM_AreaStyle_t areaStyle = areaFeat->mAreaStyle;
    areaStyle.mBrushStyle = style; // Using 3 for eg works perfectly

    err = GM_SetAreaFeatureDrawStyle(theLayer, 0, &areaStyle); // Returns GM_Error_InvalidDrawStyle = 25,

    if(err != 0)
    {
    AfxMessageBox("Failed");
    }
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////


    Thanks in advance.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited July 2010
    I took a look and was able to fix the issue. There is a new build of the SDK at http://www.globalmapper.com/GlobalMapperSDK_v134_beta.zip that should work properly for the custom area styles.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
Sign In or Register to comment.