GM_SelectAreaStyle function

Dilys
Dilys Global Mapper UserTrusted User
edited August 2009 in SDK
Hi Mike,

I have problem with the GM_SelectAreaStyle function. The final result of the label format is different from what it shows in the ‘Select Area Style’ window. The label did not rotate and the label background did not filled. And an error message displayed when I changed the fixed height of the label.

I have attached the screen shots for your reference.

Thanks for your help in advance.

Cheers
Dilys

Comments

  • global_mapper
    global_mapper Administrator
    edited August 2009
    Dilys,

    Can you try getting the latest SDK beta build from http://www.globalmapper.com/GlobalMapperSDK_v131_beta.zip and see if that works better. In the past label rotation was only for points, but in the latest code should work for area labels as well.

    For your declarations, make sure that your enumerations of types are defined to the proper size (I can't see your declarations of things like GM_PenStyle_t16 to see if they are correct). Also, I would make the GM_FontDef_t a separate structure rather than embedding the members directly in your GM_AreaStyle_t structure as that may cause problems with the alignment if it is different.

    There are also a couple of problems in the font part of your declaration. The mFixedHgt value should be a single precision floating point (is that 'Single'?), not a 'Double'. Also, the latest SDK adds a new member to the GM_FontDef_t structure, so you'll want to add the following to the bottom of your definition:

    Public mLabelPlacement As Byte

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Dilys
    Dilys Global Mapper User Trusted User
    edited August 2009
    Hi Mike,

    Could you kindly let me know which part in the GM_FontDef_t or GM_AreaStyle_t structures is for font angle please?

    // This type is used to describe a font used for rendering text
    typedef struct
    {
    const char* mFaceName; // name of font face used
    COLORREF mColor; // RGB color of font
    uint16 mWeight; // weight of font (use Win32 constants, like FW_BOLD, FW_THIN, FW_NORMAL, etc.)
    uint8 mPointSize; // font point size (set mFixedHgt value to non-zero to use fixed height)
    boolean mItalicize; // draw text with italics?
    boolean mUnderline; // underline text?
    boolean mStrikeout; // strikeout text?
    uint8 mCharset; // character set (use OEM_CHARSET for default behavior)
    GM_FontBackground_t8 mBgMode; // background fill mode (i.e. opaque or transparent)
    float mFixedHgt; // fixed height of font in meters (use 0.0 for normal point-size font)
    GM_LabelPlacement_t8 mPlacement; // label placement relative to point features (only applies for point features)
    } GM_FontDef_t;

    // This type is used to describe a style used for drawing an area feature
    // and its label (if any)
    typedef struct
    {
    GM_PenStyle_t16 mBorderPenStyle; // border pen style (i.e. solid, dash, etc.)
    uint16 mBorderPenWidth; // width to draw border pen in
    COLORREF mBorderPenColor; // color to use for border pen
    COLORREF mBrushColor; // color of brush to fill area with (when applicable to brush style). The color is defined as ARGB where the upper 8 bits are alpha. The exception is a value of 0 in the A is treated as no alpha.
    GM_BrushStyle_t16 mBrushStyle; // style of brush to fill area with
    boolean mDrawLabel; // render the label for this area if there is one
    boolean mDrawLabelAlways; // render the label for this area even if it collides with another display label
    GM_FontDef_t mFont; // font to use to render label
    } GM_AreaStyle_t;

    Thanks
    Dilys
  • global_mapper
    global_mapper Administrator
    edited August 2009
    Dilys,

    Now that I look at this it appears that the GM_FontDef_t structure doesn't store the rotation, which is likely why it is being lost! I'll add that and get you a new build of the SDK.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited August 2009
    Dilys,

    I have completed adding a new mAngle floating point member to the GM_FontDef_t structure to represent the rotation angle. I have placed a new build of the SDK with this change at http://www.globalmapper.com/GlobalMapperSDK_v131_beta.zip for you to try.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Dilys
    Dilys Global Mapper User Trusted User
    edited August 2009
    Hi Mike,

    It works now.

    Thanks
    Dilys