public void UpdateCarLocation(GPSTrackingMonitor.Communications.MessagePool trackingMessagePool) { MapObjects2.Point oCarLocation = new MapObjects2.PointClass(); MapObjects2.GeoEvent oGeoevent = null; GPSTrackingMonitor.Communications.MessagePool.ValueCollection oTrackingMessages = trackingMessagePool.Values; foreach (CommnicationMessage.GPSTrackingMessage oTrackingMessage in oTrackingMessages) { oCarLocation.X = oTrackingMessage.X; oCarLocation.Y = oTrackingMessage.Y; oGeoevent = this._trackingLayer.FindEvent(oTrackingMessage.CarNumber); if (oGeoevent == null) { // this.AddCustomSymbol(oTrackingMessage.CarNumber); oGeoevent = this._trackingLayer.AddEvent(oCarLocation, this._carSymbolIndex); oGeoevent.Tag = oTrackingMessage.CarNumber; } else { if (oGeoevent.X == oTrackingMessage.X && oGeoevent.Y == oTrackingMessage.Y) continue; oGeoevent.MoveTo(oTrackingMessage.X, oTrackingMessage.Y); } } this._trackingLayer.Refresh(true, this._mapControl.Extent); }
public void UpdateLabelLocation(GPSTrackingMonitor.Communications.MessagePool trackingMessagePool) { if (trackingMessagePool == null || trackingMessagePool.Count == 0) return; MapObjects2.Point oCarLocation = new MapObjects2.PointClass(); MapObjects2.TextSymbol oLabelSymbol = new MapObjects2.TextSymbolClass(); oLabelSymbol.Font.Name = "Arial"; oLabelSymbol.Font.Size = 8; oLabelSymbol.Color = (uint)MapObjects2.ColorConstants.moYellow; oLabelSymbol.HorizontalAlignment = MapObjects2.AlignmentConstants.moAlignCenter; oLabelSymbol.VerticalAlignment = MapObjects2.AlignmentConstants.moAlignCenter; int iGeoEventCount = this._trackingLayer.EventCount; MapObjects2.GeoEvent oGeoEvent = null; double dVerticalOffset = this._mapControl.ToMapDistance(10f); for (int i = 0; i < iGeoEventCount; i++) { oGeoEvent = this._trackingLayer.get_Event(i); oCarLocation.X = oGeoEvent.X; oCarLocation.Y = oGeoEvent.Y + dVerticalOffset; this._mapControl.DrawText(oGeoEvent.Tag, oCarLocation, oLabelSymbol); } }
protected void symbolSelector_SymboSelectedEvent(object sender, GPSTrackingMonitor.CustomControl.SymbolSelectedEventArgs e) { this._currentFont = e.CurrentFont; this._selectedSymbolIndex = e.SymbolIndex; txtSymbolIndex.Text = e.SymbolIndex.ToString(); pnlSymbolColor.BackColor = Color.Red; numSymbolSize.Value = (decimal)e.CurrentFont.Size; numSymbolRotation.Value = 0; Utilities.GDIPlus.DrawSymbolOnControl(this.picPreviewSymbol, e.CurrentFont, e.SymbolIndex, e.CurrentFont.Size, 0, this.pnlSymbolColor.BackColor); }
private void CarInfosReceiver_ProcessMessageEvent(object sender, GPSTrackingMonitor.Communications.MessageArguments e) { try { this.Invoke((MethodInvoker)delegate { GPSTrackingMonitor.Communications.MessagePool.ValueCollection oTrackingMessages = e.MessageCollection.Values; foreach (CommnicationMessage.GPSTrackingMessage oTrackingMessage in oTrackingMessages) { DataRow dr = GlobeVariables.RealtimeCarInfosTable.NewRow(); RealtimeMonite.DataStructConverter.CommInfosToDataRow(oTrackingMessage, ref dr); RealtimeMonite.TrackingDataTableStruct.UpdateRow(dr, ref GlobeVariables.RealtimeCarInfosTable); } }); } catch { } }
private void CarInfosReceiver_ProcessMessageEvent(object sender, GPSTrackingMonitor.Communications.MessageArguments e) { this._currentMessageCollection = e.MessageCollection; Invoke((MethodInvoker)delegate { this._geoeventUpdate.UpdateCarLocation(e.MessageCollection); }); }