Hi
I'm using the MapWinGis ActiveX without problem behalve for the fonction DrawPolygon(xPoints, yPoints, numPoints, Color, fill).
All the examples given on
http://www.mapwindow.org/ are in Visual Basic.
Dim myArrayX, myArrayY as Double
myArrayX(0) = 10
myArrayX(1) = 20
myArrayX(2) = 30
myArrayY(0) = 40
myArrayY(1) = 50
myArrayY(2) = 60
Dim conArrayX, conarrayY as Object
conArrayX = CObj(myArrayX)
conArrayY = CObj(myArrayY)
DrawPolygon(conArrayX, conArrayY, 3, myColor, True)
Translated in Delphi, then compilation is completed without error but execution fails at the delivery of the points parameters that must be «Arrays of double» for x and y.
Those parameters must be declared as TOleVariant in the calling procedure.
My Code:
procedure TGisForm.Button5Click(Send
er: TObject);
Var
x, y : OleVariant;
xCenter, yCenter : Double;
TmpDraw, i : Integer;
begin
x := VarArrayCreate([0,36], varDouble);
y := VarArrayCreate([0,36], varDouble);
xCenter := StrToFloat(LabelX1.Caption
);
yCenter := StrToFloat(LabelY1.Caption
);
For i := 0 To 36 do
begin
x[i] := xCenter + 100 * Sin(pi/180*i * 10);
y[i] := yCenter + 100 * Cos(pi/180*i * 10);
end;
TmpDraw := Map1.NewDrawing(dlSpatiall
yReference
dList);
Map1.DrawPolygon(x,y,37,cl
Green,Fals
e);
end;
genarates "An acces violation error at adress 1002C860 in the module MapWin~1.OCX".
if I remove the statements "VarArrayCreate", the error becomes "The variant is not an array".
Any idea ?
The VB example above only showed 3 elements for each array where as you are using 37.