Page 1 of 1
Clear IMapPolygonPtr
Posted: Fri May 28, 2010 5:46 pm
by 15055543
Hi,
I try to edit and make change an existing Polygon. After clearing existing XY info and add new XY point using AddXY() function.
But, I could not find a function from IMapPolygon like Series->Clear(). What I want to do is something like this:
void EditPolygon(IMapPolygonPtr tPolygon)
{
tPolygon->Clear();
tPolgyon->AddXY(1,2); tPolgyon->AddXY(2,4); tPolygon->AddXY(1,2);
}
Is there any other way to do this or is this impossible?
Dongsu
Re: Clear IMapPolygonPtr
Posted: Mon May 31, 2010 11:06 am
by yeray
Hi Dongsu,
In VCL the polygons are accessible but not yet in the ActiveX version. In VCL you can do this:
Code: Select all
var Series1: TMapSeries;
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1:=Chart1.AddSeries(TMapSeries.Create(self)) as TMapSeries;
Series1.FillSampleValues(1);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Series1.Polygon[0].AddXY(0,9);
end;
I've added this to the wish list to be implemented in a future release (TA05014921) so something like this would be possible: TChart1.Series(0).asMap.Polygon(0)...
Re: Clear IMapPolygonPtr
Posted: Tue Jun 01, 2010 3:23 pm
by 15055543
Hi Yeray,
Thank you for your answer. But in the ActiveX, I was able to access Polygons of a MapSeries and added points (X,Y).
The following is a sample code to create and access polygon. My question was "is it possible to clear a polygon to reuse it?".
In other words, "is it possible to delete (X,Y) points of existing polygon?"
BOOL DrawPolygon(IMapSeriesPtr PolygonSeries, const Array<PointD> &vBoundary, OLE_COLOR setColor)
{
if(vBoundary.Size()<3) return FALSE;
long nPolygon = PolygonSeries->Shapes->Add();
IMapPolygonPtr tPolygon = PolygonSeries->Shapes->Polygon[nPolygon];
tPolygon->Color = setColor;
tPolygon->Z=0;
tPolygon->Transparency = 90;
for(int i=0; i<vBoundary.Size(); i++)
tPolygon->AddXY(vBoundary.At(i).x, vBoundary.At(i).y);
tPolygon->AddXY(vBoundary.At(0).x, vBoundary.At(0).y);
return TRUE;
}
Dongsu
Re: Clear IMapPolygonPtr
Posted: Thu Jun 03, 2010 12:07 pm
by yeray
Hi Dongsu,
You are right. Excuse my mistake.
I've seen that in VCL it is possible to do it as follows:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues();
with Series1.Shapes.Add do
begin
Color:=clYellow;
Z:=0;
AddXY(0, 0);
AddXY(5, 2);
AddXY(4, 6);
AddXY(2, 8);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var PolygonIndex, PointIndex: Integer;
begin
PolygonIndex:=Series1.Shapes.Count-1;
PointIndex:=Series1.Shapes.Polygon[PolygonIndex].Points.Count-1;
Series1.Shapes.Polygon[PolygonIndex].Points.Delete(PointIndex);
end;
So I've changed the [TA05014921] ticket. Now it asks for the inclusion of something similar to the code above in the ActiveX version.
Re: Clear IMapPolygonPtr
Posted: Thu Jun 03, 2010 5:36 pm
by 15055543
Hi Yeray,
Thank you for your answer. Do you think it is possible to update this function in ActiveX and release the new version of it very soon?
Otherwise, I have to change code a lot due to this issue.
Dongsu
Re: Clear IMapPolygonPtr
Posted: Fri Jun 04, 2010 10:45 am
by narcis
Hi Dongsu,
I don't think it should be complicated but I can't provide any estimate date at the present moment. I recommend you to be aware at the forums, website or subscribe to our
RSS news feed for new release announcements and what's fixed/implemented on them.