All this class does, apart from constructing itself, is know how to save itself to a Record and how to convert itself to an LCRegion. The conversion allows you to apply a WCPolygon constructed with one CoordinateSystem to another CoordinateSystem. That is, you can apply a WCPolygon from this image to that image.
At construction, it is assumed that the units of the world coordinates are the same as those encapsulated in the construction CoordinateSystem. You must tell the constructor, which world axes the x and vectors are associated with. Make sure you account for reordering. For example, if you reordered [ra,dec] to be [dec,ra] with the CoordinateSystem::transpose(,) fuction and wished the x vector to be ra, and the y vector to be dec, then worldAxes=[1,0].
The CoordinateSystem supplied to the toLCRegion (which returns a pointer to an LCPolygongon object) function does not have to be identical in structure to that with which the WCPolygon was constructed. However, each world axis given in the worldAxes vector at construction must be present somewhere (order is unimportant) in the supplied CoordinateSystem.
The supplied lattice shape must be 2-D and corresponds to the pixel axes of the two world axes of the supplied CoordinateSystem which match those of the construction CoordinateSystem.
cSys = [ra, dec, freq]; cSys2 = [ra, dec]; axes=[0,1]; shape = [,]; WCPolygon poly(x, y, axes, cSys); LCRegion* pR = poly.toLCRegion(cSys2, shape);The resultant LCPolygon will have vertices converted with the [ra, dec] axes from cSys2
cSys = [ra, dec, freq]; cSys2 = [ra, dec]; axes=[0,2]; shape = [,]; WCPolygon poly(x, y, axes, cSys); LCRegion* pR = poly.toLCRegion(cSys2, shape);This will throw an exception because the [freq] axis is missing in cSys2
cSys = [ra, dec, freq]; cSys2 = [stokes, freq, ra, dec], [3,2,1,0]; axes=[1,2]; shape = [,]; WCPolygon poly(x, y, axes, cSys); LCRegion* pR = poly.toLCRegion(cSys2, shape);The resultant LCPolygon will have vertices converted with the [ra, dec] axes from cSys2. The fact that the pixel axes of cSys2 were reordered is accounted for internally, but does not extrude further.
cSys = [ra, dec, freq]; cSys2 = [stokes, freq, ra, dec]; cSys2.removePixelAxis(1, cSys2.referencePixel()(1)); axes=[1,2]; shape = [,]; WCPolygon poly(x, y, axes, cSys); LCRegion* pR = poly.toLCRegion(cSys2, shape);This will throw an exception because the removed pixel axis, pixel axis number 1, corresponds to the [freq] world axis in cSys2, and the [freq] axis is one of those specified at construction. Although the world axis is still present, it is not possible to convert to a pixel coordinate if the pixel axis is not there.
Construct from two vectors of world coordinates defining the polygon vertices.
Construct from an LCPolygon.
Copy constructor (reference semantics).
Destructor
Assignment (copy semantics)
Comparison
Clone a WCPolygon object.
WCPolygon cannot extend a region.
Convert to an LCRegion using the given coordinate system.
Convert the WCPolygon object to a record. The record can be used to make the object persistent. The tableName argument can be used by derived classes (e.g. LCPagedMask) to put very large objects.
Convert to a WCPolygon from a record.
Returns "WCPolygon"
Return region type. Returns the class name