CPolygon:CopyPts


The CopyPts method copies the points from an existing CPolygon into the current one. The other properties of the current CPolygon are left intact, with the exception of the point count and value limits. All points in the current CPolygon are deleted before copying starts.

Syntax

bSuccess = CPolygon:CopyPts( arrayX, arrayY )

bSuccess = CPolygon:CopyPts( CPolygon2 )

where

    arrayX, arrayY are lua tables containing the x data and y points dayta, respectively.

    CPolygon2 is an existing CPolygon that is copies into the current CPolygon object. In place of CPolygons, use the name of the actual object to be copied.

    bSuccess is the returned success code. On success it is true, otherwise false.

Example

The following script creates a CPolygon A. Later in the script, after the CPolygon has been configured and used, the script copies 2 data arrays,x, and y, into A to replace its prior point collection:

A = CPolygon:new()

-- create CPolygon A

-- do something with CPolygon A

 

 

 

x = {4,5,6,7} ; y = {1,2,-3,5}

-- create some x and y data

bSuccess = A:CopyPts( x, y )

-- replace the points of A with x and y

Printf("N = %d", A:Count() )

-- result: N = 4

Related Topics

Add

Copy

CPolygon class