Create Styles statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Builds a set of Pen, Brush or Symbol styles, and stores the styles in an array. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Create Styles
	From { Pen ... | Brush ... | Symbol ... } 
	To { Pen ... | Brush ... | Symbol ... }
	Vary { Color By { "RGB" | "HSV" } | Background By { "RGB" | "HSV" } |
		Size By { "Log" | "Sqrt" | "Constant" }}
	[ Number num_styles ]
	[ Inflect At range_number With { Pen ... | Brush ... | Symbol ...} ]
	Into Variable array_variable 

num_styles is the number of drawing styles (for example, the number of fill styles) to create. The default number is four.

range_number is a SmallInt range number; the inflection attribute is placed after this range.

array_variable is an array variable that will store the range of pens, brushes, or symbols.

Pen is a valid Pen clause to specify a line style.

Brush is a valid Brush clause to specify fill style.

Symbol is a valid Symbol clause to specify a point style.

Description

The Create Styles statement defines a set of Pen, Brush, or Symbol styles, and stores the styles in an array variable. The array can then be used in a Shade statement (which creates a thematic map layer). For an introduction to thematic mapping, see the MapInfo Pro documentation.

The From clause specifies a Pen, Brush, or Symbol style. If the array of styles is later used in a thematic map, the From style is the style assigned to the "low" range. The To clause specifies a style that corresponds to the "high" range of a thematic map.

The Create Styles statement builds a set of styles which are interpolated between the From style and the To style. For example, the From style could be a Brush clause representing a deep, saturated shade of blue, and the To style could be a Brush clause representing a pale, faint shade of blue. In this case, MapInfo Pro builds a set of Brush styles that vary from pale blue to saturated blue.

The optional Number clause specifies the total number of drawing styles needed; this number includes the two styles specified in the To and From clauses. Usually, this corresponds to the number of ranges specified in a subsequent Shade statement.

The Vary clause specifies how to spread an attribute among the styles. To spread the foreground color, use the Color sub-clause. To spread the background color, use the Background sub-clause. In either case, color can be spread by interpolating the RGB or HSV components of the From and To colors. If you are creating an array of Symbol styles, you can use the Size sub-clause to vary the symbols' point sizes. Similarly, if you are creating an array of Pen styles, you can use the Size sub-clause to vary line width.

The optional Inflect At clause specifies an inflection attribute that goes between the From and To styles. If you specify an Inflect At clause, MapInfo Pro creates two sets of styles: one set of styles interpolated between the From style and the Inflect style, and another set of styles interpolated between the Inflect style and the To style. For example, using an inflection style, you could create a thematic map of profits and losses, where map regions that have shown a profit appear in various shades of green, while regions that have shown a loss appear in various shades of red. Inflection only works when varying the color attribute.

The Into Variable clause specifies the name of the array variable that will hold the styles. You do not need to pre-size the array; MapInfo Pro automatically enlarges the array, if necessary, to make room for the set of styles. The array_variable (Pen, Brush, or Symbol) must match the style type specified in the From and To clauses.

Example

The following example demonstrates the syntax of the Create Styles statement.

Dim brush_styles() As Brush 

Create Styles 
	From Brush(2, CYAN, 0) 'style for LOW range 
	To Brush (2, BLUE, 0) 'style for HIGH range 
	Vary Color By "RGB" 
	Number 5 
	Into Variable brush_styles 

This Create Styles statement defines a set of five Brush styles, and stores the styles in the b_ranges array. A subsequent Shade statement could create a thematic map which reads the Brush styles from the b_ranges array. For an example, see Create Ranges statement.

See Also:

Create Ranges statement, Set Shade statement, Shade statement