ShapeAPI.createPolygon

 

long createPolygon(string ck, string fc, string xList, string yList)

This method creates a new polygon feature with CARIS Key and Feature Code given by ck and fc, respectively, and with boundary given by xList and yList.  The arguments xList and yList must be comma-separated lists of corresponding x and y locations, respectively, in the current Exchange Coordinate System, unless the map type is NRMR (See Map Types).

If the given coordinate arrays do not close, i.e. if  (x0, y0) does not equal (xn-1, yn-1), an extra vertex, identical to the 0th vertex, is added to close the polygon.  However, other necessary attributes of the given coordinate arrays must be set properly, i.e.

This method can also be used in conjunction with the helper method presetPolygonHole to create a complex polygon, i.e. a polygon with any number of holes. Call the helper method once for each hole, prior to calling createPolygon.  Any holes so defined at the time createPolygon is called are incorporated into the new polygon.  A hole must lie entirely within the parent polygon.

The polygon feature is created with the current defaults for line weight, line style, fill style, and color, as well as the current default restriction.  These defaults can be modified by the ShapeAPI methods:

respectively, by calling one or more of them prior to createPolygon.

The method returns 0 upon success, and returns error codes for the following conditions: