예제 #1
0
        public bool ReplayTrackings(TrackingReplay.TrackPoint curCarInfos, bool isMoveToMapView)
        {
            MapObjects2.Point oCarLocation = new MapObjects2.PointClass();
            bool bResult = true;

            try
            {
                oCarLocation.X = curCarInfos.X;
                oCarLocation.Y = curCarInfos.Y;

                if (this._index == 0)
                {
                    this._trackingPointEvent = this._trackingLayer.AddEvent(oCarLocation, this._trackingPointSymbolIndex);

                    this._index++;
                    return(bResult);
                }

                this._trackingPointEvent.MoveTo(oCarLocation.X, oCarLocation.Y);

                this._index++;
            }
            catch
            {
                bResult = false;
            }
            finally
            {
                oCarLocation = null;
            }

            return(bResult);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        public void ClearTrackings(bool isRemoveSymbols)
        {
            this._index = 0;

            if (this._isAddedSymbols && isRemoveSymbols)
                this._trackingLayer.SymbolCount -= 2;

            if (this._trackingLineEvent != null && this._trackingLayer.get_Event(this._trackingLineEvent.index) != null)
                this._trackingLayer.RemoveEvent(this._trackingLineEvent.index);

            if (this._trackingPointEvent != null && this._trackingLayer.get_Event(this._trackingPointEvent.index) != null)
                this._trackingLayer.RemoveEvent(this._trackingPointEvent.index);

            this._trackingLineEvent = null;
            this._trackingPointEvent = null;
        }
예제 #5
0
        private void mnuCarLocate_Click(object sender, EventArgs e)
        {
            string sCarNumber = this.GetSelectedCarNumber();

            MapObjects2.GeoEvent oGeoEvent    = GlobeVariables.MainMapControl.TrackingLayer.FindEvent(sCarNumber);
            MapObjects2.Point    oCarLocation = new MapObjects2.PointClass();

            oCarLocation.X = oGeoEvent.X;
            oCarLocation.Y = oGeoEvent.Y;

            MapUtil.MapOperation oMapOper = new GPSTrackingMonitor.MapUtil.MapOperation();
            oMapOper.ZoomAndCenterMap(0.02, oCarLocation, ref GlobeVariables.MainMapControl);
            GlobeVariables.MainMapControl.Refresh();

            GlobeVariables.MainMapControl.FlashShape(oCarLocation, 5);
        }
예제 #6
0
        private void dgvSearchResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (this.dgvSearchResult.DataSource != null &&
                this.dgvSearchResult.RowCount > 0 &&
                this.dgvSearchResult.SelectedRows.Count > 0)
            {
                string sCarNumber = this.dgvSearchResult.SelectedRows[0].Cells["CarNumber"].Value.ToString();

                MapObjects2.GeoEvent oGeoEvent    = GlobeVariables.MainMapControl.TrackingLayer.FindEvent(sCarNumber);
                MapObjects2.Point    oCarLocation = new MapObjects2.PointClass();

                oCarLocation.X = oGeoEvent.X;
                oCarLocation.Y = oGeoEvent.Y;

                MapUtil.MapOperation oMapOper = new GPSTrackingMonitor.MapUtil.MapOperation();
                oMapOper.ZoomAndCenterMap(0.02, oCarLocation, ref GlobeVariables.MainMapControl);
                GlobeVariables.MainMapControl.Refresh();

                GlobeVariables.MainMapControl.FlashShape(oCarLocation, 5);
            }
        }
예제 #7
0
        public void ClearTrackings(bool isRemoveSymbols)
        {
            this._index = 0;

            if (this._isAddedSymbols && isRemoveSymbols)
            {
                this._trackingLayer.SymbolCount -= 2;
            }

            if (this._trackingLineEvent != null && this._trackingLayer.get_Event(this._trackingLineEvent.index) != null)
            {
                this._trackingLayer.RemoveEvent(this._trackingLineEvent.index);
            }

            if (this._trackingPointEvent != null && this._trackingLayer.get_Event(this._trackingPointEvent.index) != null)
            {
                this._trackingLayer.RemoveEvent(this._trackingPointEvent.index);
            }

            this._trackingLineEvent  = null;
            this._trackingPointEvent = null;
        }
예제 #8
0
 public void AddTrackingPath(MapObjects2.Line trackingPath)
 {
     this._trackingLineEvent = this._trackingLayer.AddEvent(trackingPath, this._trackingLineSymbolIndex);
 }
예제 #9
0
        public bool ReplayTrackings(TrackingReplay.TrackPoint curCarInfos,bool isMoveToMapView)
        {
            MapObjects2.Point oCarLocation = new MapObjects2.PointClass();
            bool bResult = true;

            try
            {
                oCarLocation.X = curCarInfos.X;
                oCarLocation.Y = curCarInfos.Y;

                if (this._index == 0)
                {
                    this._trackingPointEvent = this._trackingLayer.AddEvent(oCarLocation, this._trackingPointSymbolIndex);

                    this._index++;
                    return bResult;
                }

                this._trackingPointEvent.MoveTo(oCarLocation.X, oCarLocation.Y);

                this._index++;
            }
            catch
            {
                bResult = false;
            }
            finally
            {
                oCarLocation = null;
            }

            return bResult;
        }
예제 #10
0
 public void AddTrackingPath(MapObjects2.Line trackingPath)
 {
     this._trackingLineEvent = this._trackingLayer.AddEvent(trackingPath, this._trackingLineSymbolIndex);
 }