- globalmapper.AddCustomBrushStyle(string aImageFilename, string aStyleName) GM_Error_t32, GM_BrushStyle_t16
Adds a new custom brush style that can be used when drawing area features. The returned brush style value can be used as part of a AreaStyle_t definition to specify to fill an area with a pattern based on the provided image file.
If a custom brush style exists with the provided aStyleName the aStyleVal will be set to the enumeration for that style and GM_Error_BrushAlreadyCreated will be returned.
- Parameters:
aImageFilename (str) – Full path to image filename to use for custom fill pattern
aStyleName (str) – Text name to use when referring to the fill style
- Returns:
Error Code
- Return type:
GM_Error_t32
- Returns:
Value of created custom fill style
- Return type:
GM_BrushStyle_t16
Example
The following is an example of AddCustomBrushStyle.
import os
import globalmapper as gm
import_dir = "Z:/GM-20069/single_function_sample_data/"
### START SAMPLE
err_AddCustomBrushStyle, brush_style = gm.AddCustomBrushStyle(
import_dir + "checkered_fill.jpg", "Checkered Fill"
)
### END SAMPLE
err_RemoveCustomBrushStyle = gm.RemoveCustomBrushStyle("Checkered Fill")
assert (
gm.GM_Error_None == err_AddCustomBrushStyle
), f"AddCustomBrushStyle: Expected {gm.GM_Error_None}, got {err_AddCustomBrushStyle}"
assert (
gm.GM_Error_None == err_RemoveCustomBrushStyle
), f"RemoveCustomBrushStyle: Expected {gm.GM_Error_None}, got {err_RemoveCustomBrushStyle}"
assert os.path.isdir(import_dir), f"Import directory doesn't exist: {import_dir}"
assert os.path.exists(
os.path.join(import_dir, "checkered_fill.jpg")
), "Sample data doesn't exist"