Hello,
I'm trying to show a path on a TdxMapControl with an OpenStreetMap layer. I use the following code:
C#procedure TForm2.Button1Click(Sender: TObject);
var AItemLayer : TdxMapItemLayer;
APath : TdxMapPath;
ASegment : TdxMapPathSegment;
APoint : TdxMapControlGeoPointItem;
begin
//dxMapControl1.Layers.BeginUpdate;
AItemLayer := dxMapControl1.AddItemLayer;
AItemLayer.ItemStyle.BorderColor := dxColorToAlphaColor(clBlue);
APath := TdxMapPath(AItemLayer.AddItem(TdxMapPath));
APath.Style.BorderColor := dxColorToAlphaColor(clBlue);
//APath.Segments.BeginUpdate;
ASegment := APath.Segments.Add;
//ASegment.GeoPoints.BeginUpdate;
APoint := ASegment.GeoPoints.Add;
APoint.Latitude := 52;
APoint.Longitude := 8;
APoint := ASegment.GeoPoints.Add;
APoint.Latitude := 51;
APoint.Longitude := 7;
//ASegment.GeoPoints.EndUpdate;
//APath.Segments.EndUpdate;
//dxMapControl1.Layers.EndUpdate;
end;
After pressing "Button1" nothing happens. If I try to scroll the map I get an error "Invalid operation in GDI+ (Code: 2)". It makes no difference if I uses BeginUpdate/EndUpdate. Unfortunately the documentation of the MapControl is not available, yet. So i'm not sure if the code is realy right.
If It try the same with the design time editor i get the GDI error immediately after starting the applictaion.
Best regards
Philipp
Hello,
I have converted this question to a bug report. As a temporary workaround, add one more point to the Segment geopoints collection or use the TdxMapPolyline element instead.