CreateCircle() function - 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

Returns an Object value representing a circle. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

CreateCircle( x, y, radius )

x is a float value, indicating the x-position (for example, Longitude) of the circle's center.

y is a float value, indicating the y-position (for example, Latitude) of the circle's center.

radius is a float value, indicating the circle radius.

Return Value

Object

Description

The CreateCircle() function returns an Object value representing a circle.

The x and y parameters use whatever coordinate system MapBasic is currently using. By default, MapBasic uses a Longitude/Latitude coordinate system, although the Set CoordSys statement can re-configure MapBasic to use a different coordinate system.

Note: MapBasic's coordinate system is independent of the coordinate system of any Map window.

The radius parameter specifies the circle radius, in whatever distance unit MapBasic is currently using. By default, MapBasic uses miles as the distance unit, although the Set Distance Units statement can re-configure MapBasic to use a different distance unit.

The circle uses whatever Brush style is currently selected. To create a circle object with a specific Brush, you can issue a Set Style statement before calling CreateCircle(). Alternately, instead of calling CreateCircle(), you can issue a Create Ellipse statement, which has optional Pen clause and Brush clause.

The circle object created through the CreateCircle() function could be assigned to an Object variable, stored in an existing row of a table (through the Update statement), or inserted into a new row of a table (using an Insert statement).

Note: Before creating objects on a Layout window, you must issue a Set CoordSys Layout statement.

Error Conditions

ERR_FCN_ARG_RANGE (644) is generated if an argument is outside of the valid range.

Examples

The following example uses the Insert statement to insert a new row into the table Sites. The CreateCircle() function is used within the body of the Insert statement to specify the graphic object that is attached to the new row.

Open Table "sites"
Insert Into sites (obj)
	Values ( CreateCircle(-72.5, 42.4, 20) ) 

The following example assumes that the table Towers has three columns: Xcoord, Ycoord, and Radius. The Xcoord column contains longitude values, the Ycoord column contains latitude values, and the Radius column contains radius values. Each row in the table describes a radio broadcast tower, and the Radius column indicates each tower's broadcast area.

The Update statement uses the CreateCircle() function to build a circle object for each row in the table. Following this Update statement, each row in the Towers table will have a circle object attached. Each circle object will have a radius derived from the Radius column, and each circle will be centered at the position indicated by the Xcoord and Ycoord columns.

Open Table "towers"
Update towers
	Set obj = CreateCircle(xcoord, ycoord, radius)

See Also:

Create Ellipse statement, Insert statement, Update statement