This is a migrated thread and some comments may be shown as answers.

MapPolyLine and Ellipse with same location don't match

2 Answers 83 Views
Map
This is a migrated thread and some comments may be shown as answers.
figueiredorj
Top achievements
Rank 1
figueiredorj asked on 17 Jun 2011, 11:37 AM
Hi. 

I am trying with RadMap to trace a route on map.

When drawing the MapPolyline all seems ok. However I am trying to draw shapes on start and on end of route and when doing so this shapes don't seem to be same location that points in line (althought I know they are).

var lastGeo = geos.Last();
var endEllipse = new MapEllipse()
{
    Location = lastGeo.Location,
    Width = 3,
    Height = 3,
    Fill = GetBrushFromHexString("#33FF33"),
    StrokeThickness = 2,
   Opacity = .5
};
 
MapLayer.SetHotSpot(endEllipse, GetHotspot());
SpeedLayer.Items.Add(endEllipse);
box = new TextBlock();
box.Text = temp.Location.ToString();
MapLayer.SetHotSpot(box, GetHotspot());
SpeedLayer.Items.Add(box);


I also have changed HotSpot of ellipses to center it:
private HotSpot GetHotspot()
{
    var hotspot = new HotSpot();
    hotspot.X = .5;
    hotspot.Y = .5;
    hotspot.XUnits = HotSpotUnit.Fraction;
    hotspot.YUnits = HotSpotUnit.Fraction;
    return hotspot;
}

Also have seen someone complaining that using hotspot could be bugged and that latest night builds would have it fixed. Im my case this didn't happen.

Is there some kind of procedure needed to set it right or am I doing something wrong?
Please help.

Thanks

2 Answers, 1 is accepted

Sort by
0
figueiredorj
Top achievements
Rank 1
answered on 20 Jun 2011, 07:13 PM
someone?
0
Accepted
Andrey
Telerik team
answered on 21 Jun 2011, 04:44 PM
Hello,

It works as designed and problems with HotSpot have been fixed already. But HotSpot doesn't work for map shapes (MapEllipse is a map shape). Any map shape is strongly positioned by its coordinates. The MapEllipse.Location property set coordinates of the top-left corner of the ellipse (similar to the standard Ellipse shape). You can use MapPath with MapEllipseGeometry instead of MapEllipse. MapEllipseGeometry uses its center as object location. For example:

private void AddEllipse(Location location)
{
    MapEllipseGeometry geometry = new MapEllipseGeometry()
    {
        Center = location,
        RadiusY = 100,    // Miles or kilometers
        RadiusX = 100      // Miles or kilometers
    };
   
    MapPath path = new MapPath()
    {
        Fill = new SolidColorBrush(Colors.Blue),
        Data = geometry
    };
   
    this.informationLayer.Items.Add(path);
}


Regards,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Map
Asked by
figueiredorj
Top achievements
Rank 1
Answers by
figueiredorj
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or