Cadcorp SIS API Methods

CreateItem Method

Description

Creates an Item from a Blob string. If a Group is open, then graphics are added to the Group, otherwise a new Item is created.

Syntax

Visual Basic
Public Function CreateItem( _
   ByVal blob As String, _
   ByVal prj As String, _
   ByVal fmt As Integer _
) As Integer

Parameters

blob
The stored Item Blob string.
 
prj
 
The named Coordinate Reference System of the stored Item Blob.
 
fmt

The format of the stored Item Blob.

SIS_BLOB_SIS_V6_ASCII 0 = Cadcorp SIS format
SIS_BLOB_OGIS_WKT 2 = OGC Well-Known-Text format
SIS_BLOB_OGIS_GML 3 = OGC Geographic Markup Language
SIS_BLOB_GEOJSON 6 = Geographic Objects for JSON format

Remarks

When modifying an item which is stored as a blob in a database, it is good practice to create a temporary version of the item on an editable overlay, and only commit the changes to the database, having got the new Blob string using GetBlob, when the user is satisfied with the changes. This allows any changes to other columns in the database table to be done in the same transaction.

Open Geospatial Consortium WKT format enables the creation of items directly as an alternative to the MoveTo/LineTo and StoreAsLine/StoreAsArea methods. Below are examples of the WKT syntax for creating various geometry items. The StoreAsArea method is unnecessary after creating an area using this method.

To create a polygon item, an L shape 30 metres by 30 metres:
sBlobText = "POLYGON ((0 0,30 0,30 10,10 10,10 30,0 30,0 0))"
GisCreateItem (sBlobText, "*APrjNatGrid", SIS_BLOB_OGIS_WKT)

To create a polygon item 30 metre square with 10 metre square hole:
sBlobText = "POLYGON ((0 0,30 0,30 30,0 30,0 0),(20 20,20 10,10 10,10 20,20 20))"
GisCreateItem (sBlobText, "*APrjNatGrid", SIS_BLOB_OGIS_WKT)

X and Y coordinates are separated by a space, and each pair of coordinates is separated by a comma. Use the GetBlob method to analyse the syntax of other geometry types.

Available: GEO MM ME MD OM OD OV SISpy

Group:

Example

sis.CreateItem (blob, "*APrjNatGrid", SIS_BLOB_SIS)

Creates an item on the current overlay using the value of blob.


Send comments on this topic.

Click to return to www.cadcorp.com

© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).