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.
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).
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