示例#1
0
        private void PutStopCircle(IMapControl page, Route route, Stop stop, TimeSpan time, int stopCount, PlanItemPopupType type, double walkBeforeMeters = 0.0)
        {
            var content = base.CreateColoredCircle(
                route.RouteGroup.GetColors().PrimaryColorBrush,
                route.RouteGroup.GetColors().MainColorBrush,
                route.RouteGroup.GetColors().SecondaryColorBrush
                );

            AddControlToMap(content, stop.Coordinate);

            var model = new PlanItemPopupModel
            {
                Time      = time,
                Stop      = stop,
                Route     = route,
                StopCount = stopCount,
                Type      = type
            };

            mapItems.Add(model);

            tapActions[content] = delegate
            {
                closePopups(page);
                int index = mapItems.IndexOf(model);
                if (index == 0 || index == mapItems.Count - 1)
                {
                    openPopup(page, model);
                }
                else
                {
                    int  pairIndex  = index % 2 == 0 ? index - 1 : index + 1;
                    var  pairModel  = mapItems[pairIndex];
                    bool isDownside = model.Stop.Latitude < pairModel.Stop.Latitude;
                    openPopup(page, model, isDownside);
                    openPopup(page, pairModel, !isDownside);
                }
            };
        }
示例#2
0
        private void PutStopCircle(MapPage page, Route route, Stop stop, TimeSpan time, int stopCount, PlanItemPopupType type, double walkBeforeMeters = 0.0)
        {
            MapLayer mapLayer = new MapLayer();
            var      content  = new Ellipse
            {
                Fill            = route.RouteGroup.GetColors().PrimaryColorBrush,
                Stroke          = route.RouteGroup.GetColors().MainColorBrush,
                StrokeThickness = 3,
                Width           = 26,
                Height          = 26
            };

            mapLayer.Add(new MapOverlay()
            {
                GeoCoordinate  = Convert(stop.Coordinate),
                PositionOrigin = new Point(0.5, 0.5),
                Content        = content
            });
            page.Map.Layers.Add(mapLayer);

            var model = new PlanItemPopupModel
            {
                Time      = time,
                Stop      = stop,
                Route     = route,
                StopCount = stopCount,
                Type      = type
            };

            mapItems.Add(model);

            tapActions[content] = delegate
            {
                closePopups(page);
                int index = mapItems.IndexOf(model);
                if (index == 0 || index == mapItems.Count - 1)
                {
                    openPopup(page, model);
                }
                else
                {
                    int  pairIndex  = index % 2 == 0 ? index - 1 : index + 1;
                    var  pairModel  = mapItems[pairIndex];
                    bool isDownside = model.Stop.Latitude < pairModel.Stop.Latitude;
                    openPopup(page, model, isDownside);
                    openPopup(page, pairModel, !isDownside);
                }
            };
        }