Route colors

Apr 20, 2010 at 6:12 PM

Hey, in my application I am building walking paths and I would like to be able to color code the routes to differentiate between handicapped accessible routes and non accessible routes. I don't think there's a way currently to have two different route colors. Is there?

Coordinator
Apr 20, 2010 at 7:16 PM

each route has it's own color, what exactly do you want to do?

Apr 22, 2010 at 11:38 PM

I'm making a collection of nodes and edges to form a campus map. The edges are represented by routes and all end up being blue. I want to be able to change the color to something else, like red, if it isn't handicapped accessible. Here's my code:

            for (int i = 0; i < mapedges.Rows.Count; i++) //show edges
            {
                DataRow firstdata;
                DataRow seconddata;
                GMapMarker edges;
                if ((mapedges.Rows[i]["firstnode"].ToString() != null) && (mapedges.Rows[i]["secondnode"].ToString() != null))
                {

                    firstdata = mapnodes.Select("id = " + (mapedges.Rows[i]["firstnode"].ToString()))[0];
                    seconddata = mapnodes.Select("id = " + (mapedges.Rows[i]["secondnode"].ToString()))[0];
                    List<PointLatLng> route = new List<PointLatLng>();
                    route.Add(new PointLatLng((double)firstdata["latitude"], (double)firstdata["Longitude"]));
                    route.Add(new PointLatLng((double)seconddata["Latitude"],(double)seconddata["Longitude"]));
                    edges = new GMapMarker(new PointLatLng((double)firstdata["latitude"], (double)firstdata["Longitude"]));
                    edges.Route.AddRange(route);
                    edges.RegenerateRouteShape(gmap);
                    edges.ZIndex = -(int)mapedges.Rows[i]["id"];
                    gmap.Markers.Add(edges);

                }
            }

How can I make it so some routes are blue and some are a different color, like red?

Apr 22, 2010 at 11:44 PM
if I'm correct, you'll need to use it like this:

edges.RegenerateRouteShape(gmap);

(route.Shape as System.Windows.Shapes.Path).Stroke = Brushes.Green;

edges.ZIndex = -(int)mapedges.Rows[i]["id"];

 

Apr 23, 2010 at 12:22 AM

Thank you so much! That works perfectly for what I need!

Apr 23, 2010 at 4:41 AM

:)