Maptitude GISDK Help

Layer Styles and Settings

GISDK provides extensive controls over the appearance of layers in maps. Using these controls you determine whether or not a layer is visible and the style in which it is displayed. You can also use GISDK functions to apply autoscaling to any layer in a map. If a layer appears in several different maps, the settings for the layer in one map are independent of the settings in the other maps.

 

The basic GISDK functions for determining and controlling the style of a map layer are as follows:

 

GISDK Function Summary
CopyLayerSettings() Copies the settings for a layer from one map to another
GetLayerAutoscale() Determines whether a layer is hidden in the current map due to autoscaling
GetLayerPosition() Gets the position (drawing order) of a layer in a map
GetLayerScale() Gets the range of scales at which the layer displays (autoscale)
GetLayerScaleFlag() Gets the autoscale flag for a layer
GetLayerVisibility() Determines whether a layer is visible (displayed) in a map
SetDefaultDisplay() Saves current display settings for a layer to a geographic file
SetLayerPosition() Sets the position (drawing order) of a layer in a map
SetLayerScale() Sets the scale at which a layer displays (autoscale)
SetLayerScaleFlag() Sets the autoscale flag for a layer
SetLayerVisibility() Sets whether a layer is visible (displayed) in a map

 

GISDK lets you assign styles to layers, to selection sets in a layer, and to individual classes in a theme. For example, suppose you have a map with two different selection sets, and a dot-density theme that shows registered Democrats and Republicans.

 

You can set up to five different styles for the map:

The table below shows the style elements you can control for each type of layer, and the GISDK functions you use to control them:

 

Layer type Style element To set the style To get the style
Area Border style SetBorderStyle() GetBorderStyle()
Area Border width SetBorderWidth() GetBorderWidth()
Area Border color SetBorderColor() GetBorderColor()
Area Fill color SetFillColor() GetFillColor()
Area Fill style SetFillStyle() GetFillStyle()
Area Transparency SetFillStyleTransparency() GetFillStyleTransparency()
Line Style SetLineStyle() GetLineStyle()
Line Width SetLineWidth() GetLineWidth()
Line Color SetLineColor() GetLineColor()
Line Arrowheads SetArrowheads() GetArrowheads()
Point Icon SetIcon() GetIcon()
Point Icon Color SetIconColor() GetIconColor()
Point Icon Size SetIconSize() GetIconSize()

 

The style GISDK functions work on the current layer and the current map by default. However, you can also specify the map and/or layer on which each GISDK function operates. For example:

 

blue = ColorRGB(0, 0, 65535)

SetLineColor( , blue)               // Sets the color of the current layer in the current map

SetLineColor("Roads|", blue)        // Sets the color of the Roads layer in the current map

SetLineColor("Map1|Roads|", blue)   // Sets the color of the Roads layer in map Map1

 

Line styles and fill styles are compound GISDK variables. You can define your own line styles, fill styles, and colors using the following GISDK functions:

 

GISDK Function Summary
ColorCIE() Creates a color based on its (x, y, Y) coordinates in the CIE chromaticity space
ColorHLS() Creates a color based on hue, lightness, and saturation
ColorHSV() Creates a color based on hue, saturation, and value (brightness)
ColorRGB() Creates a color based on the amounts of red, green, and blue
FillStyle() Creates a new fill style
GeneratePalette() Generates an array of gradually changing colors
LineStyle() Creates a new line style

 

You can use these functions for getting the definition of a fill style or a line style:

 

Function Summary
GetFillStyleDefinition() Returns an array defining the fill style
GetLineStyleDefinition() Returns an array defining the line style

 

You can also control the color and style of the background of a map using the following GISDK functions:

 

GISDK Function Summary
GetMapBackground() Gets the color and fill style of the map background
SetMapBackground() Changes the background color and fill style of a map

 

Line and border widths are actual widths measured in points, where each point equals 1/72 of an inch. You can specify a line or border value of zero, which results in the narrowest possible line that can be drawn on the screen, printer, or other output device.

 

Icons used for point layers are characters from TrueType fonts. Therefore, you can define your own symbols by creating or editing a TrueType font using software designed for this purpose.

Here is a simple macro that creates a map with three layers, and sets the appearance and style for each:

 

Macro "create map and set styles"

     // First, define some compound variables...

     black = ColorRGB(0, 0, 0)

     blue = ColorRGB(0, 0, 65535)

     red = ColorRGB(65535, 0, 0)

     solid_line = LineStyle({{{1, -1, 0}}})

     dashed_line = LineStyle({{{1, -1, 0, 1, 2}}})

     striped_fill = FillPattern("* * "," * * "," * * "," * *",

          "* * "," * * "," * * "," * *")

     checkerboard_fill = FillPattern("**** ","**** ","**** ","**** ",

          " ****"," ****"," ****"," ****",)

 

     // Now create a map and add some layers...

     folder = RunMacro("G30 Tutorial Folder")

     db = folder + "ctsales.cdf"

     db_info = GetDBInfo(db)

     db_scope = db_info[1]

     

     map1 = CreateMap("My First Map", {{"Scope", db_scope}, {"Menu", default_menus}})

     sto = AddCDFLayer(map1, "Stores", "stores.cdf", "Stores")

     rds = AddCDFLayer(map1, "Roads", "roads.cdf", "Roads")

     rgn = AddCDFLayer(map1, "Regions", db, "Regions")

 

     // Set style for the stores...

     SetIcon(sto + "|", "Font character", "Caliper Cartographic|20|Bold", 57)

     SetIconColor(sto + "|", blue)

 

     // Set style for the roads...

     SetLineStyle(rds + "|", solid_line)

     SetLineWidth(rds + "|", 2.5)

     SetLineColor(rds + "|", black)

 

     // Set style for the regions

     SetBorderStyle(rgn + "|", dashed_line)

     SetBorderColor(rgn + "|", red)

     SetBorderWidth(rgn + "|", 0)     // A width of 0 indicates the narrowest possible line...

     SetFillStyle(rgn + "|", striped_fill)

     SetFillColor(rgn + "|", blue)

 

     // Set up the sequence in which layers should draw...

     SetLayerPosition(map1, rgn, 1)

     SetLayerPosition(map1, rds, 2)

     SetLayerPosition(map1, sto, 3)

 

     // Make the stores invisible for now, and autoscale the roads...

     SetLayerVisibility(sto, "Off")

     SetLayerScale(rds, 1000, 100000)     // Show between 1:1000 and 1:100,000

endMacro

 

For more information, see:

Styles for Selection Sets

Labels

 

 

©2025 Caliper Corporation www.caliper.com