Maptitude GISDK Help

Theme Styles

When you create a theme, any map that contains the layer on which the theme is based can show the theme. GISDK gives you complete control over the styles that are used to display features in a theme. The following table shows the display elements that you can control. As indicated, they vary slightly based on the layer type.

 

Theme type

Layer type

You control

Color or pattern

Point

Icon and color

Color or pattern

Line

Line style, width, and color

Color or pattern

Area

Border style, width and color; fill style and color

Chart

All types

Pie or bar fill style and color

Dot-density

Area

Icon and color

Dot-density

Point, line

(not applicable)

Scaled-symbol

Area

Icon and color

Scaled-symbol

Point, line

None

 

To set the styles for a theme, you call the same layer style GISDK functions described in Layer Styles and Settings, but with a different first argument that contains the layer name, the theme name, and the theme class number separated by vertical bars.

 

For a color or pattern theme, each class number corresponds to one of the classes in the theme, with the number 1 indicating the Other class if it exists. Here is an example:

 

     // This theme contains the Other class and 3 additional classes

     t1 = CreateTheme("Zip-5 Population", "[5-Digit ZIP Code].Population", "Quantiles", 3,

          {{"Other", "True"}})

 

     // Define some fill styles and colors

     fill_colors = {null, ColorRGB(60000,60000,60000),

                    ColorRGB(40000,40000,40000),

                    ColorRGB(20000,20000,20000)}

     fill_styles = {null, solid, solid, solid}

 

     // Apply the fill_colors and fill_styles to the theme

     for i = 1 to 4 do

          class_id = "5-Digit ZIP Code|" + t1 + "|" + String(i)

          SetFillColor(class_id, fill_colors[i])

          SetFillStyle(class_id, fill_styles[i])

          end

 

     //Show the theme

     SetLayer("5-Digit ZIP Code")

     ShowTheme(, t1)

     RedrawMap()

 

Note that style elements for themes, like those for selection sets, can be set to null. For example, States that fall into the Other class in the theme shown above are drawn using the default fill style and fill color for the layer.

 

For dot-density or chart themes, there is one class for each field you use in the theme. If the theme uses only a single field, then there is only a single class (numbered 1). If the theme uses five fields, then the theme has five classes. While dot-density maps can be used only on area layers, SetIcon() and SetIconColor() are used to control the display of the dot symbols. While chart themes can be shown on any type of layer, only SetFillStyle() and SetFillColor() are used to control the color and fill used in the chart elements themselves. Here is another example:

 

t2 = CreateDotTheme("Population by Gender",

// The name of the theme

     {"Male", "Female"},

// The fields on which the theme is based

     25000,

// One dot represents 25,000 persons

     null)

// No options for this example

 

 

// Define the icons to use

 

icn = {"Font Character", "Caliper Cartographic|16", 45}

 

 

 

// Apply the fill_colors and fill_styles to the theme

 

SetIcon("City|" + t2 + "|1", icn[1], icn[2], icn[3])

// Use the same icon for males and females

SetIcon("City|" + t2 + "|2", icn[1], icn[2], icn[3])

 

SetIconColor("City|" + t2 + "|1", ColorRGB(65535,0,0)

// Use Red for Males

SetIconColor("City|" + t2 + "|2", ColorRGB(0,0,65535)

// Use Blue for Females

 

For scaled-symbol themes (where only a single field is involved), you cannot adjust the styles for point or line layers (the underlying point symbol or line style is used as is, but scaled in size as necessary). For area layers, use SetIcon() and SetIconColor() on the layer itself (without specifying a particular theme name or class). The icon settings that are set with these GISDK functions are automatically used in the theme.

 

Themes are shared across all maps, like layers. If a layer appears in two maps and shows the same theme in both, the thematic display of features is identical in each map. Consequently, you don't specify a map when you set the display characteristics of a theme class. However, the layer name can be omitted in the above example if the theme that is being modified is associated with the current layer.

 

Before a map feature is drawn, the style for the layer is applied first, followed by the style for any active themes, followed by the style for any selection sets. You can see this effect in standard Maptitude if you create a thematic map on a layer, and then select some features. The selected features are displayed in the style you choose for the selection set, which has higher priority than the style you choose for the theme.

 

In addition to the style GISDK functions listed earlier, there are additional GISDK functions that can be used to set the styles for theme classes. The GISDK functions listed below accept or return an array of colors, styles, sizes, or symbols rather than the value for a particular theme class:

 

Layer type

Style element

To set the styles

To get the styles

Area

Fill color

SetThemeFillColors()

GetThemeFillColors()

Area

Fill style

SetThemeFillStyles()

GetThemeFillStyles()

Line

Style

SetThemeLineStyles()

GetThemeLineStyles()

Line

Width

SetThemeLineWidths()

GetThemeLineWidths()

Line

Color

SetThemeLineColors()

GetThemeLineColors()

Point

Icon

SetThemeIcons()

GetThemeIcons()

Point

Icon Color

SetThemeIconColors()

GetThemeIconColors()

 

 

©2025 Caliper Corporation www.caliper.com