Maptitude GISDK Help |
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 |
Copies the settings for a layer from one map to another |
|
Determines whether a layer is hidden in the current map due to autoscaling |
|
Gets the position (drawing order) of a layer in a map |
|
Gets the range of scales at which the layer displays (autoscale) |
|
Gets the autoscale flag for a layer |
|
Determines whether a layer is visible (displayed) in a map |
|
Saves current display settings for a layer to a geographic file |
|
Sets the position (drawing order) of a layer in a map |
|
Sets the scale at which a layer displays (autoscale) |
|
Sets the autoscale flag for a layer |
|
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:
a style for the precinct layer
a style for the each of the two selection sets
a style for the Republicans
a style for the Democrats
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 |
||
Area |
Border width |
||
Area |
Border color |
||
Area |
Fill color |
||
Area |
Fill style |
||
Area |
Transparency |
||
Line |
Style |
||
Line |
Width |
||
Line |
Color |
||
Line |
Arrowheads |
||
Point |
Icon |
||
Point |
Icon Color |
||
Point |
Icon Size |
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 |
Creates a color based on its (x, y, Y) coordinates in the CIE chromaticity space |
|
Creates a color based on hue, lightness, and saturation |
|
Creates a color based on hue, saturation, and value (brightness) |
|
Creates a color based on the amounts of red, green, and blue |
|
Creates a new fill style |
|
Generates an array of gradually changing colors |
|
Creates a new line style |
You can use these functions for getting the definition of a fill style or a line style:
Function |
Summary |
Returns an array defining the fill style |
|
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 |
Gets the color and fill style of the map background |
|
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:
©2025 Caliper Corporation | www.caliper.com |