CApphot:delete CApphot:GetImageParams

CApphot:Copy


The Copy method duplicates the current CApphot and returns the new object. All properties are copied.

Syntax

A = CApphot:Copy()

Remarks

This method copies an existing CApphot and returns a reference to the new CApphot. You cannot copy a CApphot or any other class object using the trivial statement B = A, as this simply makes the value of B a reference to the object A. In other words, B becomes an alias to A. To get around this, two copy methods are provided by the CApphot class:

1. To create a CApphot that is a copy of the current object, use the Copy method. This creates a new CApphot B before duplicating the values of the current object A. For example,

 

  B = A:Copy()

-- Object A already exists, B is automatically created.

2. To create a new CApphot that is a copy of an existing object (including all properties), use the copy constructor, as in

 

  B = CApphot:new(A)

-- Object A already exists, B is automatically created.

You can choose the copying syntax that fits best with your script.

Example

The following script fragment copies the members of CApphot A into a new CApphot A2:

 

 

A = CApphot:new()

-- construct a new CApphot object

A.nRadius1 = 4.5

-- Set the value of nRadius1

A.nRadius2 = 12

-- Set the value of nRadius2

A.nRadius3 = 16

-- Set the value of nRadius3

bSuccess = A:Measure(I,x,y)

-- Measure object at (x,y) in CImage I

Printf("A Mag = %lg", A.nMag )

-- result: A Mag = 15.256

B = A:Copy()

-- create a copy of A, including measurements

Printf("B Mag = %lg", B.nMag )

-- result: B Mag = 15.256

Related Topics

CApphot, new, Measure