PlateStars Object

PlateStars Collection

Remarks

A PlateStars collection represents a collection of PlateStar objects. You cannot directly create PlateStars objects. Instead, they are returned from reading properties of the Plate object. The Plate object has three properties which return PlateStars collections: These collections allow you to access the individual stars retrieved from the catalog, stars detected in the image, and/or stars in the image that matched reference catalog stars after Solve() or for images which already have WCS info. Collections are not arrays, though you can access them in a way similar to an array (this is the klunky way, required by some languages, keep reading!)
Set stars = p.ImageStars  ' Create the collection once!
For i = 1 To stars.Count     ' Index starts at 1 not 0
    Print stars(i).X
Next
In the above example, p is a Plate object, and stars(i) returns a PlateStar object representing the i-th star in the ImageStars list. This may sound complex now, but once you use it it will seem very natural. One thisng to note in the above example: the collection is first explicitly created, then used in the loop. If you don't do this, you'll be recreating the collection for each iteration of the loop -- very inefficient.

Some languages (e.g., Visual Basic) support intrinsic enumeration. In Visual Basic, you can write:

For Each star In p.ImageStars
    Print star.X
Next

This should seem really natural to you. JScript (aka JavaScript or ECMAScript) has its own way of enumerating using an Enumerator object created from the collection:

stars = new Enumerator(p.ImageStars);
for (; !stars.atEnd(); stars.moveNext())
{
   Console.PrintLine(stars.item().x);
}
In the above examples, the collection is used directoy in the For-Each statement or in the Enumerator constructor. If you want to sort the collection, you must first create it explicitly, assigning it to a variable, then sort it, then do the For-Each statemtne, etc. For example, in JScript:
col = p.ImageStars;
col.Sort(3, 0, refRA, refDec);
stars = new Enumerator(col);
for (; !stars.atEnd(); stars.moveNext())
{
   Console.PrintLine(stars.item().RightAscension);
}