Clear IMapPolygonPtr

TeeChart for ActiveX, COM and ASP
Post Reply
Dongsu
Newbie
Newbie
Posts: 6
Joined: Wed Mar 31, 2010 12:00 am

Clear IMapPolygonPtr

Post by Dongsu » Fri May 28, 2010 5:46 pm

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

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Clear IMapPolygonPtr

Post by Yeray » Mon May 31, 2010 11:06 am

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)...
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dongsu
Newbie
Newbie
Posts: 6
Joined: Wed Mar 31, 2010 12:00 am

Re: Clear IMapPolygonPtr

Post by Dongsu » Tue Jun 01, 2010 3:23 pm

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

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Clear IMapPolygonPtr

Post by Yeray » Thu Jun 03, 2010 12:07 pm

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dongsu
Newbie
Newbie
Posts: 6
Joined: Wed Mar 31, 2010 12:00 am

Re: Clear IMapPolygonPtr

Post by Dongsu » Thu Jun 03, 2010 5:36 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Clear IMapPolygonPtr

Post by Narcís » Fri Jun 04, 2010 10:45 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply