开心人生

用今天的努力----实现我所向往的明天

导航

2006年9月12第四版程序修改 历史轨迹回放

                  

Case 2  '------------------------------------------------------------------------点轨迹
                    '//*-   第一点的情况   -*//'
                    '///////////////////////////  绘制出该车的形状
                    If g_ReBackPointIndex = True Then '////////////推动'历驶回放时拖动回放的点的下标
                        If g_TrkBackValue < g_WhenPaintCounti Then    '//////////////////////回退的情况
                            '/////'g_TrkBackValue    ---时间进度表拖动的值
                            '/////'g_WhenPaintCounti'---记录画点的位置,比如第一点,第二点,第N点
                            '///////////////////////////////////////////////////  把前面画的点和线删掉
                            Dim Tempi As Integer
                            
Dim IntCnt As Integer : Dim j As Integer : Dim kk As Integer : Dim ll As Integer
                            
Dim DeLyr As MapXLib.Layer
                            
Dim DeTempFtr As MapXLib.Feature
                            
'////////////////////////////  找到g_whenPaintcounti对应的那个图元号
                            DeLyr = FrmNHistory.MapCtr.Layers.Item("HistoryLayer")
                            
'''Debug.Write((g_TrkBackValue) & "value")
                            '''Debug.Write(vbLf)
                            '''Debug.Write(g_WhenPaintCounti)
                            '''Debug.Write(vbLf)
                            For j = g_TrkBackValue To g_WhenPaintCounti
                                
'//////////////////////////   删除图元
                                Try
                                    
If g_TempPointFtr(j) = -1 Then
                                    
Else
                                        DeTempFtr 
= DeLyr.GetFeatureByID(g_TempPointFtr(j))
                                        DeLyr.DeleteFeature(DeTempFtr)
                                        g_TempPointFtr(j) 
= -1   '---删除之后重新把值至为-1
                                    End If
                                    
If g_TempLineFtrId(j) = -1 Then
                                    
Else
                                        DeTempFtr 
= DeLyr.GetFeatureByID(g_TempLineFtrId(j))
                                        DeLyr.DeleteFeature(DeTempFtr)
                                        g_TempLineFtrId(j) 
= -1   '---删除之后重新把值至为-1
                                    End If
                                
Catch ex As Exception
                                    WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                                
End Try
                            
Next
                            
'DeLyr.Refresh()
                            '////////////////////////////////////////////////  重新给g_whenpaintcounti赋值
                            g_WhenPaintCounti = g_TrkBackValue
                            
'////////////////////////////////////////////////把图标移到到些点
                            '////////////////////////////////////// 移动图标到此处
                            '(0)跟g_trkbackvalue的前一点比较,判断是否是停车,报警,正常
                            If g_WhenPaintCounti > 0 Then
                                IntStopTimer 
= Microsoft.VisualBasic.DateDiff(DateInterval.Minute, CDate(g_fVehicleInfo(g_WhenPaintCounti - 1).Time), CDate(g_fVehicleInfo(g_WhenPaintCounti).Time))
                            
End If
                            
With NewStyle
                                
If g_fVehicleInfo(g_WhenPaintCounti).Volicity = 0 And IntStopTimer - g_stopTimer >= 0 Then  '停车
                                    .SymbolFontColor = .SymbolFontColor.Parse(CStr(g_StopPointColor))
                                    .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                
Else
                                    
If g_fVehicleInfo(g_WhenPaintCounti).Alarm <> 0 Then '报警
                                        .SymbolFontColor = .SymbolFontColor.Parse(CStr(gisYellow))
                                        .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                    
Else  '正常
                                        .SymbolFontColor = .SymbolFontColor.Parse(CStr(gisBlue))
                                        .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                    
End If
                                
End If
                            
End With
                            
Try
                                
'(1)得到当前图元的centerX,centerY
                                ftr = FrmNHistory.MapCtr.Layers.Item("HistoryLayer").GetFeatureByID(g_FtrId)
                                rvs 
= FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_FtrId)
                                DlbTempLongitude 
= ftr.CenterX
                                DlbTempLatitude 
= ftr.CenterY
                                
'(2)移动到此处
                                ftr.Offset(Historypnts.Item(g_WhenPaintCounti + 1).X - DlbTempLongitude, Historypnts.Item(g_WhenPaintCounti + 1).Y - DlbTempLatitude) '---移动
                                ftr.Style = NewStyle
                                ftr.Update()
                                
'(3)计算里程相减
                                ' ''Debug.Write(FrmNHistory.MapCtr.Distance(DlbTempLongitude, DlbTempLatitude, Historypnts.Item(g_WhenPaintCounti + 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y))
                                ' ''Debug.Write(vbLf)
                                ' ''Debug.Write(g_DlbDistance)
                                ' ''Debug.Write(vbLf)
                                g_DlbDistance = g_DlbDistance - FrmNHistory.MapCtr.Distance(DlbTempLongitude, DlbTempLatitude, Historypnts.Item(g_WhenPaintCounti + 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y)
                                
'  ''Debug.Write(g_DlbDistance)
                                '   ''Debug.Write(vbLf)
                                '(4)更改信息栏
                                DtpRecordtime.Value = g_fVehicleInfo(g_WhenPaintCounti).Time
                                FrmNHistory.StbFirst.Text 
= FrmNHistory.StbFirst.Text = "第[" & g_WhenPaintCounti + 1 & "]条记录 " & " 经度:[" & g_fVehicleInfo(g_WhenPaintCounti).Longitude & "" & " 纬度:[" & g_fVehicleInfo(g_WhenPaintCounti).Latitude & " ] " & " 速度:[" & g_fVehicleInfo(g_WhenPaintCounti).Volicity & "]公里/时" & "方向角[" & g_fVehicleInfo(g_WhenPaintCounti).Angle & "]度"
                                
If g_DlbDistance = 0 Then
                                    FrmNHistory.StbThird.Text 
= "总行程:[0 ]公里 "
                                
Else
                                    FrmNHistory.StbThird.Text 
= "总行程:[" & Round(g_DlbDistance / 10002& "] 公里 "
                                
End If
                            
Catch ex As Exception
                                WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                            
End Try
                            g_ReBackPointIndex 
= False
                            g_WhenPaintCounti 
= g_WhenPaintCounti + 1
                            g_ReBackPointIndex 
= False
                            
'''Debug.Write(g_WhenPaintCounti)
                            '''Debug.Write(vbLf)
                        End If
                        
If g_TrkBackValue > g_WhenPaintCounti Then
                            
'////////////////////////////////////// 移动图标到此处
                            '(0)跟g_trkbackvalue的前一点比较,判断是否是停车,报警,正常
                            If g_WhenPaintCounti > 0 Then
                                IntStopTimer 
= Microsoft.VisualBasic.DateDiff(DateInterval.Minute, CDate(g_fVehicleInfo(g_WhenPaintCounti - 1).Time), CDate(g_fVehicleInfo(g_WhenPaintCounti).Time))
                            
End If
                            
With NewStyle
                                
If g_fVehicleInfo(g_WhenPaintCounti).Volicity = 0 And IntStopTimer - g_stopTimer >= 0 Then  '停车
                                    .SymbolFontColor = .SymbolFontColor.Parse(CStr(g_StopPointColor))
                                    .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                
Else
                                    
If g_fVehicleInfo(g_WhenPaintCounti).Alarm <> 0 Then '报警
                                        .SymbolFontColor = .SymbolFontColor.Parse(CStr(gisYellow))
                                        .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                    
Else  '正常
                                        .SymbolFontColor = .SymbolFontColor.Parse(CStr(gisBlue))
                                        .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                    
End If
                                
End If
                            
End With
                            
Try
                                
'(1)得到当前图元的centerX,centerY
                                ftr = FrmNHistory.MapCtr.Layers.Item("HistoryLayer").GetFeatureByID(g_FtrId)
                                rvs 
= FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_FtrId)
                                DlbTempLongitude 
= ftr.CenterX
                                DlbTempLatitude 
= ftr.CenterY
                                
'(2)移动到此处
                                ftr.Offset(Historypnts.Item(g_WhenPaintCounti + 1).X - DlbTempLongitude, Historypnts.Item(g_WhenPaintCounti + 1).Y - DlbTempLatitude) '---移动
                                ftr.Style = NewStyle
                                ftr.Update()
                                
'(3)删除一条线
                                Dim TempF As MapXLib.Feature
                                
If g_TempLineFtrId(g_WhenPaintCounti - 1= -1 Then
                                
Else
                                    TempF 
= lyr.GetFeatureByID(g_TempLineFtrId(g_WhenPaintCounti - 1))
                                    lyr.DeleteFeature(TempF)
                                    g_TempLineFtrId(g_WhenPaintCounti 
- 1= -1
                                    
'lyr.Refresh()
                                End If
                                
'(3)计算里程相减
                                ' ''Debug.Write(FrmNHistory.MapCtr.Distance(DlbTempLongitude, DlbTempLatitude, Historypnts.Item(g_WhenPaintCounti + 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y))
                                ' ''Debug.Write(vbLf)
                                ' ''Debug.Write(g_DlbDistance)
                                ' ''Debug.Write(vbLf)
                                g_DlbDistance = g_DlbDistance - FrmNHistory.MapCtr.Distance(DlbTempLongitude, DlbTempLatitude, Historypnts.Item(g_WhenPaintCounti + 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y)
                                
'  ''Debug.Write(g_DlbDistance)
                                '   ''Debug.Write(vbLf)
                                '(5)把添加点,然后点与点之间联系


                                
'(4)更改信息栏
                                DtpRecordtime.Value = g_fVehicleInfo(g_WhenPaintCounti).Time
                                FrmNHistory.StbFirst.Text 
= FrmNHistory.StbFirst.Text = "第[" & g_WhenPaintCounti + 1 & "]条记录 " & " 经度:[" & g_fVehicleInfo(g_WhenPaintCounti).Longitude & "" & " 纬度:[" & g_fVehicleInfo(g_WhenPaintCounti).Latitude & " ] " & " 速度:[" & g_fVehicleInfo(g_WhenPaintCounti).Volicity & "]公里/时 " & "方向角[" & g_fVehicleInfo(g_WhenPaintCounti).Angle & "]度"
                                
If g_DlbDistance = 0 Then
                                    FrmNHistory.StbThird.Text 
= "总行程:[0 ]公里 "
                                
Else
                                    FrmNHistory.StbThird.Text 
= "总行程:[" & Round(g_DlbDistance / 10002& "] 公里 "
                                
End If
                            
Catch ex As Exception
                                WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                            
End Try
                            g_ReBackPointIndex 
= False
                            g_WhenPaintCounti 
= g_WhenPaintCounti + 1
                        
End If
                        
If g_TrkBackValue > g_WhenPaintCounti Then  '/////////////////////////////////(往前跳)
                            '////////////////////////////////////// 移动图标到此处
                            '(0)跟g_trkbackvalue的前一点比较,判断是否是停车,报警,正常
                            IntStopTimer = Microsoft.VisualBasic.DateDiff(DateInterval.Minute, CDate(g_fVehicleInfo(g_TrkBackValue - 1).Time), CDate(g_fVehicleInfo(g_TrkBackValue).Time))
                            
With NewStyle           '/////////////车型
                                If g_fVehicleInfo(g_TrkBackValue).Volicity = 0 And IntStopTimer - g_stopTimer >= 0 Then  '停车
                                    .SymbolFontColor = .SymbolFontColor.Parse(CStr(g_StopPointColor))
                                    .SymbolFontRotation 
= g_fVehicleInfo(g_TrkBackValue).Angle
                                
Else
                                    
If g_fVehicleInfo(g_TrkBackValue).Alarm <> 0 Then '报警
                                        .SymbolFontColor = .SymbolFontColor.Parse(CStr(gisYellow))
                                        .SymbolFontRotation 
= g_fVehicleInfo(g_TrkBackValue).Angle
                                    
Else  '正常
                                        .SymbolFontColor = .SymbolFontColor.Parse(CStr(gisBlue))
                                        .SymbolFontRotation 
= g_fVehicleInfo(g_TrkBackValue).Angle
                                    
End If
                                
End If
                            
End With
                            
'(1)得到当前图元的centerX,centerY
                            ftr = FrmNHistory.MapCtr.Layers.Item("HistoryLayer").GetFeatureByID(g_FtrId)
                            rvs 
= FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_FtrId)
                            DlbTempLongitude 
= ftr.CenterX
                            DlbTempLatitude 
= ftr.CenterY
                            
'(3)移动到此处
                            ftr.Offset(Historypnts.Item(g_TrkBackValue + 1).X - DlbTempLongitude, Historypnts.Item(g_TrkBackValue + 1).Y - DlbTempLatitude) '---移动
                            ftr.Style = NewStyle
                            ftr.Update()
                            
'///////////////////////////////////////////
                            Try

                                
'(3)计算里程相减
                                ' ''Debug.Write(FrmNHistory.MapCtr.Distance(DlbTempLongitude, DlbTempLatitude, Historypnts.Item(g_WhenPaintCounti + 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y))
                                ' ''Debug.Write(vbLf)
                                ' ''Debug.Write(g_DlbDistance)
                                ' ''Debug.Write(vbLf)
                                g_DlbDistance = g_DlbDistance - FrmNHistory.MapCtr.Distance(DlbTempLongitude, DlbTempLatitude, Historypnts.Item(g_WhenPaintCounti + 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y)
                                
'  ''Debug.Write(g_DlbDistance)
                                '   ''Debug.Write(vbLf)
                                '(4)更改信息栏
                                DtpRecordtime.Value = g_fVehicleInfo(g_WhenPaintCounti).Time
                                FrmNHistory.StbFirst.Text 
= FrmNHistory.StbFirst.Text = "第[" & g_WhenPaintCounti + 1 & "]条记录 " & " 经度:[" & g_fVehicleInfo(g_WhenPaintCounti).Longitude & "" & " 纬度:[" & g_fVehicleInfo(g_WhenPaintCounti).Latitude & " ] " & " 速度:[" & g_fVehicleInfo(g_WhenPaintCounti).Volicity & "]公里/时" & "方向角[" & g_fVehicleInfo(g_WhenPaintCounti).Angle & "]度"
                                
If g_DlbDistance = 0 Then
                                    FrmNHistory.StbThird.Text 
= "总行程:[0 ]公里 "
                                
Else
                                    FrmNHistory.StbThird.Text 
= "总行程:[" & Round(g_DlbDistance / 10002& "] 公里 "
                                
End If
                            
Catch ex As Exception
                                WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                            
End Try
                            g_WhenPaintCounti 
= g_TrkBackValue '重新复值
                            g_ReBackPointIndex = False
                            g_WhenPaintCounti 
= g_WhenPaintCounti + 1
                        
End If
                    
Else '//////////////////////////////////////////////////////////////////////没有拖动
                        If g_WhenPaintCounti = 0 Then
                            g_DlbDistance 
= 0  '---公里数为1
                            DtpRecordtime.Value = g_fVehicleInfo(g_WhenPaintCounti).Time '---当前记录的时间
                            FrmNHistory.StbFirst.Text = "第[" & g_WhenPaintCounti + 1 & "]条记录 " & "速度:[" & g_fVehicleInfo(g_WhenPaintCounti).Volicity & "]公里/时 " & "方向角[" & g_fVehicleInfo(g_WhenPaintCounti).Angle & "]度" & " 经度:[" & g_fVehicleInfo(g_WhenPaintCounti).Longitude & "" & "纬度:[" & g_fVehicleInfo(g_WhenPaintCounti).Latitude & " ] "
                            
'//*-  判断是否在屏幕以以内  -*//'
                            If Historypnts.Item(g_WhenPaintCounti + 1).X > FrmNHistory.MapCtr.CtlBounds.XMax Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If
                            
If Historypnts.Item(g_WhenPaintCounti + 1).X < FrmNHistory.MapCtr.CtlBounds.XMin Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If
                            
If Historypnts.Item(g_WhenPaintCounti + 1).Y > FrmNHistory.MapCtr.CtlBounds.YMax Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If
                            
If Historypnts.Item(g_WhenPaintCounti + 1).Y < FrmNHistory.MapCtr.CtlBounds.YMin Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If

                            
'//*-   设置风格   -*//'
                            With NewStyle
                                .SymbolType 
= MapXLib.SymbolTypeConstants.miSymbolTypeTrueTypeFont
                                .SymbolFont.Name 
= "GisDisplay"
                                .SymbolFont.Bold 
= False
                                .SymbolFontShadow 
= True
                                .SymbolCharacter 
= IntEmptyStyle
                                .SymbolFont.Size 
= 22
                                .SymbolFontColor 
= .SymbolFontColor.Parse(CStr(gisBlue))
                                .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                            
End With
                            
'//*-   画出车型   -*//'
                            Try
                                
Dim FtrTemp As MapXLib.Feature
                                rvs 
= FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_WhenPaintCounti)
                                rvs.Item(
"VehicleNo").Value = CmbVehicleNo.Text
                                addFtr 
= FrmNHistory.MapCtr.FeatureFactory.CreateSymbol(Historypnts.Item(g_WhenPaintCounti + 1), NewStyle)
                                FtrTemp 
= lyr.AddFeature(addFtr, rvs)
                                
'lyr.Refresh()
                                g_FtrId = FtrTemp.FeatureID
                                TrkBackSpeed.Value 
= g_WhenPaintCounti + 1 '时间进度条加1
                            Catch ex As Exception
                                WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                            
End Try
                        
Else
                            
'//*-   第二、三,N点的形状  -*//'
                            '//////把当前点汇制成汽车形状,把前一点汇制出来的图形变成点,然后用直线联接这两点
                            DtpRecordtime.Value = g_fVehicleInfo(g_WhenPaintCounti).Time '---当前记录的时间
                            '---状态栏信息
                            FrmNHistory.StbFirst.Text = "第[" & g_WhenPaintCounti + 1 & "]条记录 " & " 经度:[" & g_fVehicleInfo(g_WhenPaintCounti).Longitude & "" & " 纬度:[" & g_fVehicleInfo(g_WhenPaintCounti).Latitude & " ] " & " 速度:[" & g_fVehicleInfo(g_WhenPaintCounti).Volicity & "]公里/时" & "方向角[" & g_fVehicleInfo(g_WhenPaintCounti).Angle & "]度"
                            
'//*-   设置图元的属性   -*//'
                            '//*-  判断是否在屏幕以以内  -*//'
                            If Historypnts.Item(g_WhenPaintCounti + 1).X > FrmNHistory.MapCtr.CtlBounds.XMax Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If
                            
If Historypnts.Item(g_WhenPaintCounti + 1).X < FrmNHistory.MapCtr.CtlBounds.XMin Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If
                            
If Historypnts.Item(g_WhenPaintCounti + 1).Y > FrmNHistory.MapCtr.CtlBounds.YMax Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If
                            
If Historypnts.Item(g_WhenPaintCounti + 1).Y < FrmNHistory.MapCtr.CtlBounds.YMin Then
                                
'/-*    把屏幕切换到当前点    *-/'
                                FrmNHistory.MapCtr.CenterX = Historypnts.Item(g_WhenPaintCounti + 1).X
                                FrmNHistory.MapCtr.CenterY 
= Historypnts.Item(g_WhenPaintCounti + 1).Y
                            
End If
                            
'/////////// 点状  ///////////
                            With PointStyle
                                .SymbolType 
= MapXLib.SymbolTypeConstants.miSymbolTypeTrueTypeFont
                                .SymbolFont.Name 
= "GisDisplay"
                                .SymbolFont.Bold 
= False
                                .SymbolFontShadow 
= True
                                .SymbolCharacter 
= 167
                                .SymbolFont.Size 
= g_PointSize
                                .SymbolFontColor 
= .SymbolFontColor.Parse(CStr(g_PointColor))
                                .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                            
End With
                            
'/////////////////////////////
                            With NewStyle  '---车型
                                .SymbolType = MapXLib.SymbolTypeConstants.miSymbolTypeTrueTypeFont
                                .SymbolFont.Name 
= "GisDisplay"
                                .SymbolFont.Bold 
= False
                                .SymbolFontShadow 
= True
                                .SymbolCharacter 
= IntEmptyStyle
                                .SymbolFont.Size 
= 22
                                .SymbolFontColor 
= .SymbolFontColor.Parse(CStr(gisBlue))
                                .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                            
End With
                            
'/////////////////////////////
                            With LineStyle   '---线型
                                .LineColor = .LineColor.Parse(CStr(g_LineColor))
                                .LineStyle 
= 60
                                .LineWidth 
= g_LineSize
                            
End With
                            
'///////////////////////////////////////////////////////////////////图元属性设置完毕

                            
'//*-   判断是否停车   -*//'
                            IntStopTimer = Microsoft.VisualBasic.DateDiff(DateInterval.Minute, FirstStopDate, CDate(g_fVehicleInfo(g_WhenPaintCounti).Time))
                            
' If g_fVehicleInfo(g_WhenPaintCounti).Longitude = g_fVehicleInfo(g_WhenPaintCounti - 1).Longitude And g_fVehicleInfo(g_WhenPaintCounti).Latitude = g_fVehicleInfo(g_WhenPaintCounti - 1).Latitude And IntStopTimer >= g_stopTimer Then
                            If g_fVehicleInfo(g_WhenPaintCounti).Volicity = 0 And IntStopTimer >= g_stopTimer Then
                                g_BlnVehicleStoyFlag 
= True '//*-   表示该车在此处停留   -*//'
                                With NewStyle
                                    .SymbolType 
= MapXLib.SymbolTypeConstants.miSymbolTypeTrueTypeFont
                                    .SymbolFont.Name 
= "GisDisplay"
                                    .SymbolFont.Bold 
= False
                                    .SymbolFontShadow 
= True
                                    .SymbolCharacter 
= IntEmptyStyle
                                    .SymbolFont.Size 
= 22
                                    .SymbolFontColor 
= .SymbolFontColor.Parse(CStr(g_StopPointColor))
                                    .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                
End With
                                
Try
                                    ftr 
= FrmNHistory.MapCtr.Layers.Item("HistoryLayer").GetFeatureByID(g_FtrId)
                                    rvs 
= FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_FtrId)
                                    DlbTempLongitude 
= ftr.CenterX
                                    DlbTempLatitude 
= ftr.CenterY
                                    ftr.Offset(Historypnts.Item(g_WhenPaintCounti 
+ 1).X - DlbTempLongitude, Historypnts.Item(g_WhenPaintCounti + 1).Y - DlbTempLatitude)
                                    ftr.Style 
= NewStyle
                                    ftr.Update(, rvs)
                                
Catch ex As Exception
                                    WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                                
End Try
                                
'//////////////////////   把前一点画出来
                                Try
                                    
With PointStyle
                                        .SymbolType 
= MapXLib.SymbolTypeConstants.miSymbolTypeTrueTypeFont
                                        .SymbolFont.Name 
= "GisDisplay"
                                        .SymbolFont.Bold 
= False
                                        .SymbolFontShadow 
= True
                                        .SymbolCharacter 
= 167
                                        .SymbolFont.Size 
= g_PointSize
                                        .SymbolFontColor 
= .SymbolFontColor.Parse(CStr(g_PointColor))
                                        .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                    
End With
                                    lyr 
= FrmNHistory.MapCtr.Layers.Item("HistoryLayer")
                                    
If g_WhenPaintCounti Mod IIf(g_PointPartition = 01, g_PointPartition) = 0 Then
                                        rvs.Item(
"NodeInfo").Value = "记录时间:" & g_fVehicleInfo(g_WhenPaintCounti).Time & Chr(10& "速度:" & g_fVehicleInfo(g_WhenPaintCounti).Volicity
                                    
End If
                                    rvs.Item(
"VehicleNo").Value = ""
                                    addFtr 
= FrmNHistory.MapCtr.FeatureFactory.CreateSymbol(Historypnts.Item(g_WhenPaintCounti), PointStyle)
                                    PointFtr 
= lyr.AddFeature(addFtr, rvs)
                                    
'lyr.Refresh()
                                    g_TempPointFtr(g_WhenPaintCounti) = PointFtr.FeatureID  '---pointftrid存入数组
                                    FirstStopDate = g_fVehicleInfo(g_WhenPaintCounti).Time '////记录下认为开始停车的时间。20060911
                                Catch ex As Exception

                                
End Try

                                TrkBackSpeed.Value 
= g_WhenPaintCounti + 1 '时间进度条加1
                                If g_DlbDistance = 0 Then
                                    FrmNHistory.StbThird.Text 
= "总行程[" & 0 & "]公里"
                                
Else
                                    FrmNHistory.StbThird.Text 
= "总行程[" & Round(g_DlbDistance / 10002& "]公里"
                                
End If

                            
Else
                                
'//*-   如果没有停车的话   -*//'
                                '//*-   在前一点画出车型移至当前点  -*//'

                                
Try

                                    ftr 
= FrmNHistory.MapCtr.Layers.Item("HistoryLayer").GetFeatureByID(g_FtrId)
                                    rvs 
= FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_FtrId)
                                    DlbTempLongitude 
= ftr.CenterX
                                    DlbTempLatitude 
= ftr.CenterY
                                    ftr.Offset(Historypnts.Item(g_WhenPaintCounti 
+ 1).X - DlbTempLongitude, Historypnts.Item(g_WhenPaintCounti + 1).Y - DlbTempLatitude)
                                    ftr.Style 
= NewStyle
                                    ftr.Update()

                                
Catch ex As Exception
                                    WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                                
End Try
                                
'////////////////////////////////

                                
'//*-   把前一点换成点型  -*//'
                                Try
                                    
If g_BlnVehicleStoyFlag = True Then '前一点为停车
                                        With PointStyle
                                            .SymbolType 
= MapXLib.SymbolTypeConstants.miSymbolTypeTrueTypeFont
                                            .SymbolFont.Name 
= "GisDisplay"
                                            .SymbolFont.Bold 
= False
                                            .SymbolFontShadow 
= True
                                            .SymbolCharacter 
= 167
                                            .SymbolFont.Size 
= g_StopPointSize
                                            .SymbolFontColor 
= .SymbolFontColor.Parse(CStr(g_StopPointColor))
                                            .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                        
End With
                                        lyr 
= FrmNHistory.MapCtr.Layers.Item("HistoryLayer")
                                        
'  rvs = FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_WhenPaintCounti)
                                        If g_WhenPaintCounti Mod IIf(g_PointPartition = 01, g_PointPartition) = 0 Then
                                            rvs.Item(
"NodeInfo").Value = "记录时间:" & g_fVehicleInfo(g_WhenPaintCounti).Time & Chr(10& "速度:" & g_fVehicleInfo(g_WhenPaintCounti).Volicity & "停车:" & IntStopTimer & ""
                                        
End If
                                        rvs.Item(
"VehicleNo").Value = ""
                                        addFtr 
= FrmNHistory.MapCtr.FeatureFactory.CreateSymbol(Historypnts.Item(g_WhenPaintCounti), PointStyle)
                                        PointFtr 
= lyr.AddFeature(addFtr, rvs)
                                        
' lyr.Refresh()
                                        g_TempPointFtr(g_WhenPaintCounti) = PointFtr.FeatureID
                                        g_BlnVehicleStoyFlag 
= False
                                    
Else
                                        
'//*-     再判断是不是有报警(停车除外)   -*//'
                                        If g_fVehicleInfo(g_WhenPaintCounti).Alarm <> 0 Then
                                            
With PointStyle
                                                .SymbolType 
= MapXLib.SymbolTypeConstants.miSymbolTypeTrueTypeFont
                                                .SymbolFont.Name 
= "GisDisplay"
                                                .SymbolFont.Bold 
= False
                                                .SymbolFontShadow 
= True
                                                .SymbolCharacter 
= 167
                                                .SymbolFont.Size 
= g_PointSize
                                                .SymbolFontColor 
= .SymbolFontColor.Parse(CStr(g_AlarmPointColor))
                                                .SymbolFontRotation 
= g_fVehicleInfo(g_WhenPaintCounti).Angle
                                            
End With
                                        
End If
                                        lyr 
= FrmNHistory.MapCtr.Layers.Item("HistoryLayer")
                                        
'  rvs = FrmNHistory.MapCtr.Datasets.Item("HistoryLayer").RowValues(g_WhenPaintCounti)
                                        If g_WhenPaintCounti Mod IIf(g_PointPartition = 01, g_PointPartition) = 0 Then
                                            rvs.Item(
"NodeInfo").Value = "记录时间:" & g_fVehicleInfo(g_WhenPaintCounti).Time & Chr(10& "速度:" & g_fVehicleInfo(g_WhenPaintCounti).Volicity
                                        
End If
                                        rvs.Item(
"VehicleNo").Value = ""
                                        addFtr 
= FrmNHistory.MapCtr.FeatureFactory.CreateSymbol(Historypnts.Item(g_WhenPaintCounti), PointStyle)
                                        PointFtr 
= lyr.AddFeature(addFtr, rvs)
                                        
' lyr.Refresh()
                                        g_TempPointFtr(g_WhenPaintCounti) = PointFtr.FeatureID
                                    
End If
                                    FirstStopDate 
= g_fVehicleInfo(g_WhenPaintCounti).Time '////记录下认为开始停车的时间。20060911

                                
Catch ex As Exception
                                    WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                                
End Try
                            
End If
                            
'/////////////////////////////////////////////////////////////////
                            '//*-   把两点连接起来   -*//'
                            If g_PaintLineFlag = True Then
                                
Dim Temppnt As New MapXLib.Point
                                
Dim Temppnts As New MapXLib.Points
                                Temppnts.RemoveAll()
                                Temppnt.Set(Historypnts.Item(g_WhenPaintCounti 
+ 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y)
                                Temppnts.Add(Temppnt)
                                Temppnt.Set(Historypnts.Item(g_WhenPaintCounti).X, Historypnts.Item(g_WhenPaintCounti).Y)
                                Temppnts.Add(Temppnt)
                                
Try
                                    rvs.Item(
"VehicleNo").Value = ""
                                    rvs.Item(
"NodeInfo").Value = ""
                                    addFtr 
= FrmNHistory.MapCtr.FeatureFactory.CreateLine(Temppnts, LineStyle)
                                    LineFtr 
= lyr.AddFeature(addFtr, rvs)
                                    g_TempLineFtrId(g_WhenPaintCounti) 
= LineFtr.FeatureID  '---把线的FTR存入
                                    '----在这里加入点集
                                    ' lyr.Refresh()
                                Catch ex As Exception
                                    WriteErrToFile(Microsoft.VisualBasic.Format(Now, 
"HH:mm:ss"+ " " + ex.StackTrace + ex.Message)
                                
End Try
                            
End If
                            
'//*-   计算两点之间的距离   -*//'
                            g_DlbDistance = g_DlbDistance + FrmNHistory.MapCtr.Distance(Historypnts.Item(g_WhenPaintCounti + 1).X, Historypnts.Item(g_WhenPaintCounti + 1).Y, Historypnts.Item(g_WhenPaintCounti).X, Historypnts.Item(g_WhenPaintCounti).Y)
                            
If g_DlbDistance = 0 Then
                                FrmNHistory.StbThird.Text 
= "总行程[" & 0 & "]公里"
                            
Else
                                FrmNHistory.StbThird.Text 
= "总行程[" & Round(g_DlbDistance / 10002& "]公里"
                            
End If
                            FirstStopDate 
= g_fVehicleInfo(g_WhenPaintCounti).Time '////记录下认为开始停车的时间。20060911
                        End If
                        TrkBackSpeed.Value 
= g_WhenPaintCounti + 1 '时间进度条加1
                        g_WhenPaintCounti = g_WhenPaintCounti + 1
                        
'''Debug.Write("" & TrkBackSpeed.Value)
                        '''Debug.Write(vbLf)
                        '''Debug.Write(g_WhenPaintCounti)
                        '''Debug.Write(vbLf)
End If

posted on 2006-09-12 12:17  hai  阅读(481)  评论(0)    收藏  举报