If I understood your problem, you have an array with the coordinates. In this case you need a third kind of constructor that’s the same as the one with paramarray without the paramarray keyword.
Public Sub Constructor(points() as integer) //Constructor from an array of x and y coordinates
for i as integer=0 to points.Ubound Step 2
if (i+1)<=points.Ubound then
pts.Append new Xojo.Core.Point(points(i), points(i+1))
end if
next
End Sub
you can rewrite the original one as:
Public Sub Constructor(paramarray points() as integer) //Constructor from an undetermined sequence of x and y coordinates
self.constructor(points)
End Sub
In this way you can create from a list o coord object, a list of integer or an array of integer (create the same for coord objects is trivial)
Your class can be used to create your curve array:
dim curves() as List_Pts
curves.append new List_Pts(0, 0, 1, 0, 2, 5)
curves.append new List_Pts(new coords(0, 0), new coords(1, 0), new coords(2, 5))
dim sample() as integer
sample.append 0
sample.append 0
sample.append 1
sample.append 0
sample.append 2
sample.append 5
curves.append new List_Pts(sample)
If you need to subclass your point list to give, for example a color or other information you can:(so we have a prop localColor as color)
class coloredCurve subclass of ListPts
Public Sub constructor(c as Color, coordinates() as integer)
localColor=c
super.constructor(coordinates)
end sub
… and the same for the other constructor variant
if you need a class to contain all the curves
class Curves
property theCurves() as List_Pts
public sub add(c as List_Pts)
theCurves.append c
end sub
end class
So you can use:
dim c as new Curves
c.add new List_Pts(0, 0, 1, 0, 2, 5)
c.add new coloredCurve(color.red, 0, 0, 1, 0, 2, 5)