RequestCompletedEventArgs CreateEventArgs()
        {
            MapItem[] items = new MapItem[3];
            items[1] = new MapPushpin()
            {
                Location = route[0], Text = "A", Information = route[0].ToString()
            };
            items[2] = new MapPushpin()
            {
                Location = route[route.Count - 1], Text = "B", Information = route[route.Count - 1].ToString()
            };
            MapPolyline polyline = new MapPolyline()
            {
                IsGeodesic = true,
                Stroke     = new SolidColorBrush()
                {
                    Color = Colors.Red
                },
                StrokeStyle = new StrokeStyle()
                {
                    Thickness = 4
                }
            };

            for (int i = 0; i < route.Count; i++)
            {
                polyline.Points.Add(route[i]);
            }
            items[0] = polyline;
            return(new RequestCompletedEventArgs(items, null, false, null));
        }
コード例 #2
0
        public DriveModel(RouteModel parentModel)
        {
            this.parentModel = parentModel;
            routePath        = parentModel.RoutePath;
            itineraryItems   = new List <BingItineraryItem>();
            itineraryItems.AddRange(parentModel.ItineraryItems);
            routePushpins = new List <MapPushpin>();
            routePushpins.AddRange(parentModel.RoutePushpins);

            drivePushpin                = new MapPushpin();
            drivePushpin.Location       = routePath[0];
            drivePushpin.MarkerTemplate = parentModel.Navigator.DriveMarkerTemplate;
            drivePath             = new MapPolyline();
            drivePath.Stroke      = parentModel.Navigator.DriveBrush;
            drivePath.StrokeStyle = new StrokeStyle()
            {
                Thickness = 4, StartLineCap = PenLineCap.Round, EndLineCap = PenLineCap.Round
            };
            drivePath.Points.Add(targetLocation);
            targetLocation = routePath[0];

            DriveItems = new ObservableCollection <MapItem>();
            DriveItems.Add(drivePath);
            DriveItems.Add(drivePushpin);

            this.animationTimer          = new DispatcherTimer();
            this.animationTimer.Interval = TimeSpan.FromSeconds(driveTimeQuant);
            this.animationTimer.Tick    += new EventHandler(AnimationTimer);

            Advance();
        }
コード例 #3
0
        private static void ShowLocation()
        {
            Window.Navigator.Geolocation.GetCurrentPosition(delegate(Geolocation location) {
                MapViewOptions viewOptions = new MapViewOptions();
                viewOptions.Center         = new MapLocation(location.Coordinates.Latitude,
                                                             location.Coordinates.Longitude);
                viewOptions.Zoom    = 10;
                viewOptions.Animate = true;

                _map.SetView(viewOptions);
                UpdatePhotos(/* newPhotos */ false);

                if (_currentPushpin == null)
                {
                    MapPushpinOptions pushpinOptions = new MapPushpinOptions();
                    pushpinOptions.Icon     = "Pushpin.png";
                    pushpinOptions.Anchor   = new MapPoint(12, 14);
                    pushpinOptions.Width    = 25;
                    pushpinOptions.Height   = 28;
                    pushpinOptions.TypeName = "currentPushpin";

                    _currentPushpin = new MapPushpin(viewOptions.Center, pushpinOptions);
                    _map.Entities.Push(_currentPushpin);
                }
                else
                {
                    _currentPushpin.SetLocation(viewOptions.Center);
                }
            });
        }
        private void AddPushpin(GeoPoint geoPoint)
        {
            MapPushpin pin = new MapPushpin();

            pin.Location = geoPoint;
            pushpins.Items.Add(pin);
        }
コード例 #5
0
        void INavigatorMapViewModel.NewPushpinCreated(MapPushpin newPushpin)
        {
            newPushpin.MouseLeftButtonDown += (s, e) => {
                MapPushpin pushpin = s as MapPushpin;
                if ((pushpin != null) && (pushpin.State == MapPushpinState.Normal))
                {
                    LocationInformation locationInformation = pushpin.Information as LocationInformation;
                    DestinationAddress  = locationInformation.Address.FormattedAddress;
                    DestinationLocation = (GeoPoint)pushpin.Location;
                    pushpin.Text        = "A";
                    Regex  rx         = new Regex("(.*?), (.*?), (.*?) (.*)");
                    var    match      = rx.Match(locationInformation.Address.FormattedAddress);
                    string streetLine = match.Groups[1].ToString().Trim();
                    string city       = match.Groups[2].ToString().Trim();
                    string state      = match.Groups[3].ToString().Trim();
                    string zipcode    = match.Groups[4].ToString().Trim();


                    Destination = new Address {
                        City      = city,
                        Line      = streetLine,
                        State     = state,
                        ZipCode   = zipcode,
                        Latitude  = DestinationLocation.Latitude,
                        Longitude = DestinationLocation.Longitude
                    };
                    MapPushpinsService.Clear();
                    CalculateRouteDriving();
                }
            };
        }
コード例 #6
0
ファイル: CityCodeForm.cs プロジェクト: mdgiles/TraceOffice
        private void SaveMapData()
        {
            MapItem item = MapItemStorage.Items.FirstOrDefault();

            if (item != null)
            {
                MapPushpin pin      = (MapPushpin)item;
                GeoPoint   location = (GeoPoint)pin.Location;
                //If lat and long are zero, then there was no geocode to begin with and the user didn't specify one
                //during the edit, so don't update the values
                if (location.Longitude != 0 || location.Latitude != 0)
                {
                    if (_selectedRecord.GeoCode == null)
                    {
                        _selectedRecord.GeoCode = new GeoCode();
                    }
                    GeoCode geoCode = _selectedRecord.GeoCode;
                    geoCode.PushLat       = location.Latitude;
                    geoCode.PushLong      = location.Longitude;
                    geoCode.ManualChecked = true;
                    CoordPoint p1  = MapControl.ScreenPointToCoordPoint(new MapPoint());
                    CoordPoint p2  = MapControl.ScreenPointToCoordPoint(new MapPoint(MapControl.Width, MapControl.Height));
                    GeoPoint   gp1 = (GeoPoint)p1;
                    GeoPoint   gp2 = (GeoPoint)p2;
                    geoCode.NorthLat = gp1.Latitude;
                    geoCode.WestLong = gp1.Longitude;
                    geoCode.SouthLat = gp2.Latitude;
                    geoCode.EastLong = gp2.Longitude;
                }
            }
        }
コード例 #7
0
ファイル: BingMapForm.cs プロジェクト: snrbs17/StorageERP
        // 리스트 생성
        List <MapItem> GetCapitals()
        {
            int            storageCount = Clients.Facilities.GetFacilitiesAsync().Result.Count;
            List <MapItem> mapItems     = new List <MapItem>();
            var            facilities   = Clients.Facilities.GetFacilitiesAsync().Result.ToList();

            for (int i = 0; i < storageCount; i++)
            {
                int facilityId = facilities[i].FacilityId;
                int employeeId = Clients.Facilities.GetFacilityAsync(facilityId).Result.EmployeeId;
                int regionId   = Clients.Facilities.GetFacilityAsync(facilityId).Result.RegionId;

                string storageName  = Clients.Regions.GetRegionAsync(regionId).Result.Town;
                string employeeName = Clients.Employees.GetEmployeeAsync(employeeId).Result.Name;

                double latitude  = Convert.ToDouble(Clients.Regions.GetRegionAsync(regionId).Result.Latitude);
                double longitude = Convert.ToDouble(Clients.Regions.GetRegionAsync(regionId).Result.Longitude);

                MapPushpin pushpin = new MapPushpin()
                {
                    Text = $"{storageName}", Location = new GeoPoint(latitude, longitude), ToolTipPattern = $"보관소 : {storageName}\n담당직원 : {employeeName}\n"
                };
                mapItems.Add(pushpin);
            }
            return(mapItems);
        }
 public void AddItem(MapPushpin pushpin)
 {
     pushpins.Add(pushpin);
     waypoints.Add(new RouteWaypoint(
                       ((LocationInformation)pushpin.Information).DisplayName,
                       (GeoPoint)pushpin.Location)
                   );
     pushpin.Text = (currentLatter++).ToString();
 }
コード例 #9
0
        RequestCompletedEventArgs CreateEventArgs()
        {
            MapItem item = new MapPushpin()
            {
                Location = address.Location, Information = address.Address.FormattedAddress
            };

            return(new RequestCompletedEventArgs(new MapItem[] { item }, null, false, null));
        }
コード例 #10
0
        public SCMap AddPushpin(double[] location, string text, PushpinOptions options = null)
        {
            options ??= new PushpinOptions();
            var mapItem = new MapPushpin();

            options.ConfigurePointerItem(this, mapItem, location, text);

            return(this);
        }
コード例 #11
0
 private void mapControl1_MouseUp(object sender, MouseEventArgs e)
 {
     if (pin != null)
     {
         CoordPoint point = this.mapControl1.ScreenPointToCoordPoint(new MapPoint(e.X, e.Y));
         pin.Location = point;
         this.mapControl1.EnableScrolling = true;
         pin = null;
     }
 }
コード例 #12
0
        private void AddPushpin(GeoPoint geoPoint)
        {
            MapPushpin pin = new MapPushpin();

            pin.Location = geoPoint;

            VectorItemsLayer layer = (VectorItemsLayer)this.map.Layers[2];

            ((MapItemStorage)layer.Data).Items.Add(pin);
        }
コード例 #13
0
 void BingGeocodeDataProvider_LayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs args)
 {
     foreach (var pushpinItem in args.Items)
     {
         MapPushpin pushpin = pushpinItem as MapPushpin;
         if (pushpin != null)
         {
             ((INavigatorMapViewModel)DataContext).NewPushpinCreated(pushpin);
         }
     }
 }
 private void GeocodeLayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs args)
 {
     foreach (MapItem item in args.Items)
     {
         MapPushpin pushpin = item as MapPushpin;
         if (pushpin != null)
         {
             pushpin.MouseLeftButtonDown += new MouseButtonEventHandler(PushpinMouseLeftButtonDown);
         }
     }
 }
コード例 #15
0
 void GenerateItems(IEnumerable <LocationInformation> locations)
 {
     UpdateStorage();
     foreach (var location in locations)
     {
         MapPushpin pushpin = new MapPushpin()
         {
             Location = location.Location, Information = location
         };
         Storage.Items.Add(pushpin);
     }
 }
        private void PushpinMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MapPushpin pushpin = sender as MapPushpin;

            if ((pushpin != null) && (pushpin.State == MapPushpinState.Normal))
            {
                LocationInformation locationInformation = pushpin.Information as LocationInformation;
                AddWaypoint(locationInformation == null ? string.Empty : locationInformation.DisplayName, pushpin.Location);
                geocodeInformationLayer.ClearResults();
            }
            e.Handled = true;
        }
コード例 #17
0
ファイル: CityCodeForm.cs プロジェクト: mdgiles/TraceOffice
 private void MapControl_MouseUp(object sender, MouseEventArgs e)
 {
     if (_pin != null)
     {
         CoordPoint point = MapControl.ScreenPointToCoordPoint(new MapPoint(e.X, e.Y));
         _pin.Location = point;
         MapControl.EnableScrolling = true;
         DisplayPointCoordinates((GeoPoint)point);
         SaveMapData();
         _pin = null;
     }
 }
        private void routeProvider_LayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs args)
        {
            char letter = 'A';

            foreach (MapItem item in args.Items)
            {
                MapPushpin pushpin = item as MapPushpin;
                if (pushpin != null)
                {
                    pushpin.Text = letter++.ToString();
                }
            }
        }
 RequestCompletedEventArgs CreateEventArgs()
 {
     MapItem[] items = new MapItem[addresses.Count];
     for (int i = 0; i < items.Length; i++)
     {
         items[i] = new MapPushpin()
         {
             Location = addresses[i].Location, Information = addresses[i].Address.FormattedAddress, Text = (i + 1).ToString()
         }
     }
     ;
     return(new RequestCompletedEventArgs(items, null, false, null));
 }
        void pushpin_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MapPushpin pushpin = sender as MapPushpin;

            if (pushpin == null)
            {
                return;
            }
            e.Handled = true;
            helper.AddItem(pushpin);
            routeProvider.CalculateRoute(helper.Waypoints);
            pushpin.MouseLeftButtonDown -= pushpin_MouseLeftButtonDown;
        }
 void GenerateItems(IEnumerable <LocationInformation> locations)
 {
     UpdateStorage();
     foreach (var location in locations)
     {
         MapPushpin pushpin = new MapPushpin()
         {
             Location    = location.Location,
             Information = location
         };
         pushpin.MouseLeftButtonDown += pushpin_MouseLeftButtonDown;
         storage.Items.Add(pushpin);
     }
 }
コード例 #22
0
        void GeoCodeAndSearchLayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs args)
        {
            int pushpinsCount = 0;

            foreach (MapItem item in args.Items)
            {
                MapPushpin pushpin = item as MapPushpin;
                if (pushpin != null)
                {
                    pushpin.MouseLeftButtonDown += new MouseButtonEventHandler(PushpinMouseLeftButtonDown);
                    pushpinsCount++;
                }
            }
            this.RouteModel.RaiseSearchPushpinsChanged(pushpinsCount);
        }
コード例 #23
0
        private void CreatePushPin()
        {
            ClearPushPins();

            var p = GetGeoPointOfCursor();

            var pushPin = new MapPushpin()
            {
                Location = p, Text = "Здесь", ToolTipPattern = "Месторасположение магазина"
            };

            mapItemStorage1.Items.Add(pushPin);

            ShopLocation = p;
        }
 private void RouteLayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs args)
 {
     if ((args.Error == null) && !args.Cancelled)
     {
         waypointIndex = 0;
         foreach (MapItem item in args.Items)
         {
             MapPushpin pushpin = item as MapPushpin;
             if (pushpin != null)
             {
                 pushpin.Text = NextWaypointLetter();
             }
         }
         Helpers.Clear();
     }
 }
コード例 #25
0
ファイル: CityCodeForm.cs プロジェクト: mdgiles/TraceOffice
        private void MapControl_MouseDown(object sender, MouseEventArgs e)
        {
            MapHitInfo info = this.MapControl.CalcHitInfo(e.Location);

            if (info.InMapPushpin)
            {
                MapControl.EnableScrolling = false;
                foreach (object obj in info.HitObjects)
                {
                    if (obj.GetType() == typeof(MapPushpin))
                    {
                        _pin = (MapPushpin)obj;
                    }
                }
            }
        }
コード例 #26
0
        private void OnPinHoverd(object sender, EventArgs e)
        {
            ToolTip    toolTip = new ToolTip();
            MapPushpin pin     = sender as MapPushpin;

            if (pin == null)
            {
                return;
            }
            if (pin.Text == null)
            {
                return;
            }

            toolTip.SetToolTip(mapControl, "h");
        }
コード例 #27
0
        private void mapControl1_MapItemClick(object sender, MapItemClickEventArgs e)
        {
            MapPushpin pushpin = e.Item as MapPushpin;

            if (pushpin == null)
            {
                return;
            }
            if (helper.Pushpins.Contains(pushpin))
            {
                return;
            }

            helper.AddItem(pushpin);
            CalculateRoute();
            e.Handled = true;
        }
コード例 #28
0
        public void AddWaypoint(string description, GeoPoint location)
        {
            RouteWaypoint waypoint = new RouteWaypoint(description, location);

            if (!waypoints.Contains(waypoint))
            {
                MapPushpin pushpin = new MapPushpin();
                pushpin.Location    = location;
                pushpin.Information = description;
                pushpin.Text        = NextWaypointLetter();
                pushpin.TraceDepth  = 0;
                pushpin.State       = MapPushpinState.Busy;
                Helpers.Add(pushpin);
                waypoints.Add(waypoint);
                SendRouteRequest();
            }
            RaisePropertyChanged("ActionText");
            RaisePropertyChanged("Waypoints");
        }
コード例 #29
0
        public MapItem CreateMapItem(MapItemType type, object obj)
        {
            DataRowView     rowView         = (DataRowView)obj;
            Color           newColor        = (Color)rowView["Color"];
            Image           image           = (Image)baseImage.Clone();
            ImageAttributes imageAttributes = GetImageAttributes(newColor);

            Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
            Graphics  g    = Graphics.FromImage(image);

            g.DrawImage(image, rect, 0, 0, rect.Width, rect.Height, GraphicsUnit.Pixel, imageAttributes);


            MapPushpin pushpin = new MapPushpin();

            pushpin.Image        = image;
            pushpin.RenderOrigin = new MapPoint(0.5, 0.8);
            pushpin.TextOrigin   = new Point(22, 14);
            return(pushpin);
        }
コード例 #30
0
ファイル: CityCodeForm.cs プロジェクト: mdgiles/TraceOffice
        private MapPushpin AddOrMovePushpin(GeoPoint geoPoint)
        {
            MapItem    item = MapItemStorage.Items.FirstOrDefault();
            MapPushpin pin;

            if (item == null)
            {
                pin = new MapPushpin();
                MapItemStorage.Items.Add(pin);
            }
            else
            {
                pin = (MapPushpin)item;
            }
            pin.Location           = geoPoint;
            MapControl.CenterPoint = geoPoint;
            DisplayPointCoordinates(geoPoint);

            return(pin);
        }
コード例 #31
0
ファイル: AdvMapUC.cs プロジェクト: EgyFalseX/SbotControl
        private void AddBotVisual(SBot bot)
        {
            lock (this)
            {
                //Program.BM.Bots
                stc_Cord found = new stc_Cord();
                if (OnlineList.TryGetValue(bot.CharName, out found))
                    return;
                this.Invoke(new MethodInvoker(() =>
                {
                    DevExpress.XtraMap.MapPushpin mp = new MapPushpin()
                    {
                        //Image = global::SbotControl.Properties.Resources.Info,
                        Location = ConvertToGeoPoint(Convert.ToInt32(bot.PosX), Convert.ToInt32(bot.PosY)),
                        Text = bot.CharName,
                        TextColor = System.Drawing.Color.Lime,
                        TextGlowColor = System.Drawing.Color.Gray,
                        ToolTipPattern = string.Format("Lv. {0}\n\r{1}\n\r{2}\n\rKills: {3}\n\rXP Gained: {4}\n\rSP Gained: {5}\n\rGold: {6}\n\rDied: {7}\n\rDrops: {8}",
                        bot.Level, bot.SilkroadServerStatus, bot.BotStatus, bot.Kills, bot.XPGained, bot.SPGained, bot.Gold, bot.Died, bot.ItemDrops),
                        UseAnimation = true,
                    };
                    ((DevExpress.XtraMap.InformationLayer)MCMain.Layers[0]).Data.Items.Add(mp);
                    stc_Cord stc = new stc_Cord() { bot = bot, mp = mp };
                    //Create Context menu item
                    DevExpress.XtraBars.BarButtonItem bbiNew = new DevExpress.XtraBars.BarButtonItem();
                    barManagerMain.Items.Add(bbiNew);
                    bsiSetFocus.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {new DevExpress.XtraBars.LinkPersistInfo(bbiNew)});
                    bbiNew.Caption = bot.CharName;
                    bbiNew.Glyph = global::SbotControl.Properties.Resources.geopoint_16x16;
                    //bbiNew.Id = 1;
                    bbiNew.Tag = stc;
                    bbiNew.ItemClick += BbiSetFocus_ItemClick;
                    bbiNew.Name = "bbiNew" + bot.CharName;

                    stc.menu = bbiNew;
                OnlineList.Add(bot.CharName, stc);
                }));
            }
        }