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

How to Bind Muiltiple latitude and longitude to single Radmap

3 Answers 102 Views
Map
This is a migrated thread and some comments may be shown as answers.
666
Top achievements
Rank 1
666 asked on 18 Dec 2010, 05:12 AM
Hi
 I am using radmap in my silverlight 4.0 application, i want to Bind Muiltiple latitude and longitude to radmap, if there is two location is there i want to draw line in between to locations With some color line like Rad and green , how to do this?

Thanks in Advance

3 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 22 Dec 2010, 01:12 PM
Hi srini,

You can bind items source of the information layer to the collection of the locations. You can find an example here:

http://demos.telerik.com/silverlight/#Map/DataBinding

To show line between 2 locations on the map you can use MapLine object:

Location loc1 = new Location(20, 20);
Location loc2 = new Location(40, 40);
MapLine line = new MapLine()
{
    Point1 = loc1,
    Point2 = loc2,
    Stroke = new SolidColorBrush(Colors.Red),
    StrokeThickness = 2
};
  
this.informationLayer.Items.Add(line);


Pay attention, if your information layer is bound to the collection of the locations then you should use second layer to show lines.

Kind regards,
Andrey Murzov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
666
Top achievements
Rank 1
answered on 30 Dec 2010, 07:46 AM
Hi

 I have binded the radmap with muiltiple lat & long value it is working fine,i am using  bellow code to draw line in between two location  on radmap  it is also working fine . i want to draw a dotted line between to locations, how to do this?

 

 

 

private LinearGradientBrush CreateLinearGradientBrush(Location location1, Location location2)

 

{

 

 

Point point1 = location1.GetPoint(this.radMap);

 

 

 

Point point2 = location2.GetPoint(this.radMap);

 

 

 

var fill = new LinearGradientBrush();

 

fill.StartPoint =

 

new Point(0, 0);

 

fill.EndPoint =

 

new Point(point2.X - point1.X, point2.Y - point1.Y);

 

 

 

double max = Math.Max(Math.Abs(fill.EndPoint.X), Math.Abs(fill.EndPoint.Y));

 

fill.EndPoint =

 

new Point(fill.EndPoint.X / max, fill.EndPoint.Y / max);

 

 

 

if (fill.EndPoint.X < 0)

 

{

fill.StartPoint =

 

new Point(-fill.EndPoint.X, fill.StartPoint.Y);

 

fill.EndPoint =

 

new Point(0, fill.EndPoint.Y);

 

}

 

 

if (fill.EndPoint.Y < 0)

 

{

fill.StartPoint =

 

new Point(fill.StartPoint.X, -fill.EndPoint.Y);

 

fill.EndPoint =

 

new Point(fill.EndPoint.X, 0);

 

}

 

 

return fill;

 

}

 

 

private void SetLinearGradientBrushStops(LinearGradientBrush fill, Color startColor, Color stopColor)

 

{

 

 

var stop = new GradientStop();

 

stop.Color = startColor;

stop.Offset = 0;

fill.GradientStops.Add(stop);

 

 

var stop1 = new GradientStop();

 

stop1.Color = stopColor;

stop1.Offset = 1;

fill.GradientStops.Add(stop1);

}

Thanks in Advance

0
Sia
Telerik team
answered on 31 Dec 2010, 03:36 PM
Hi,

You need to set the StrokeDashArray as follows:
StrokeDashArray = new DoubleCollection {2,2};

Regards,
Sia
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Map
Asked by
666
Top achievements
Rank 1
Answers by
Andrey
Telerik team
666
Top achievements
Rank 1
Sia
Telerik team
Share this question
or