yeah I am trying to figure out how I would post a list(of Note) back to the UI and add them, any ideas here is what I havePublic Class FlghtPthBtn
Inherits ESRI.ArcGISExplorer.Application.Button
'declarations
Private disp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
Private CurrentMap As Map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map
Private Pline As Geometry
Private RepString As StringBuilder
Private PtList As List(Of String)
Private WithEvents _bgWorker_FlightPath As ESRI.ArcGISExplorer.Threading.BackgroundWorker
Public Overrides Sub OnClick()
_bgWorker_FlightPath = New ESRI.ArcGISExplorer.Threading.BackgroundWorker
AddHandler _bgWorker_FlightPath.DoWork, AddressOf _bgWorker_FlightPath_DoWork
AddHandler _bgWorker_FlightPath.RunWorkerCompleted, AddressOf _bgWorker_FlightPath_RunWorkCompleted
Pline = disp.TrackPolyline(Color.Lime, 4)
If (Not _bgWorker_FlightPath.IsBusy) Then
_bgWorker_FlightPath.RunWorkerAsync(Pline.ToXmlString())
End If
End Sub
Private Sub _bgWorker_FlightPath_DoWork(ByVal sender As System.Object, ByVal e As ESRI.ArcGISExplorer.Threading.DoWorkEventArgs)
Dim PL As ESRI.ArcGISExplorer.Geometry.Polyline = ESRI.ArcGISExplorer.Geometry.Polyline.CreateFromXmlString(CStr(e.Argument))
Dim PLLat As String
Dim PLLong As String
Dim Brng As String
Dim PrWindow As New PrgrssFrm
Dim PtNote As String
PtList = New List(Of String)()
PrWindow.Show()
RepString = New StringBuilder()
For I = 0 To PL.PointCount - 1
PrWindow.PrgrssBrLbl.Text = "Doing " + (I + 1).ToString + " of " + PL.PointCount.ToString
PrWindow.FlghtPthPrgrssBr.Value = (I / PL.PointCount) * 100
PLLat = PL.GetPoint(I).GetLatitude.ToString("###.0000")
PLLong = PL.GetPoint(I).GetLongitude.ToString("###.0000")
If I + 1 <= PL.PointCount - 1 Then
Brng = BearingDetail(PL.GetPoint(I), PL.GetPoint(I + 1))
Else
Brng = "NA"
End If
RepString.Append((I + 1).ToString + " Lat: " + PLLat + " Long:" + PLLong + " Heading: " + Brng + " ")
'' PtNote = New Geometry(ESRI.ArcGISExplorer.Geometry.Point(PL.GetPoint(I))).ToXmlString
PtList.Add(PtNote)
e.Result = PtList
Next I
PrWindow.Close()
End Sub
Private Sub _bgWorker_FlightPath_RunWorkCompleted(ByVal sender As System.Object, ByVal e As ESRI.ArcGISExplorer.Threading.RunWorkerCompletedEventArgs)
'' Dim results As Graphic = New Geometry(ESRI.ArcGISExplorer.Geometry.Point.CreateFromXmlString(CStr(e.Result)))
MsgBox(RepString.ToString)
disp.Map.ChildItems.Add(Results)
End Sub
Public Function BearingDetail(ByVal Pt As ESRI.ArcGISExplorer.Geometry.Point, ByVal HeadPt As ESRI.ArcGISExplorer.Geometry.Point)
'Ported Over from SpotFires BearingdistanceDetail- Created by Mike Shuft and Steve O'Brien ported By Brian Locke
'Dim brg As String
Dim changex As Double
Dim changey As Double
'Dim length As Double
' Dim angle As Double
Dim quadrant As String = Nothing
changex = Pt.X - HeadPt.GetLongitude
changey = Pt.Y - HeadPt.GetLatitude
'Determine the Direction
If changex = 0 And changey = 0 Then quadrant = "You must pick two different points!"
If changex = 0 Then
If changey < 0 Then
quadrant = "S"
ElseIf changey > 0 Then
quadrant = "N"
End If
End If
If changey = 0 Then
If changex < 0 Then
quadrant = "W"
ElseIf changex > 0 Then
quadrant = "E"
End If
End If
If changey > 0 Then
If changex < 0 Then
quadrant = "NW"
ElseIf changex > 0 Then
quadrant = "NE"
End If
End If
If changey < 0 Then
If changex < 0 Then
quadrant = "SW"
ElseIf changex > 0 Then
quadrant = "SE"
End If
End If
Dim Dlon As Double = ESRI.ArcGISExplorer.Geometry.Unit.Angular.Degrees.Convert((HeadPt.GetLongitude - Pt.X), Unit.Angular.Radians)
Dim PtY As Double
Dim HeadPty As Double
PtY = ESRI.ArcGISExplorer.Geometry.Unit.Angular.Degrees.Convert(Pt.Y, Unit.Angular.Radians)
HeadPty = ESRI.ArcGISExplorer.Geometry.Unit.Angular.Degrees.Convert(HeadPt.GetLatitude, Unit.Angular.Radians)
Dim y As Double = Sin(Dlon) * Cos(HeadPty)
Dim x As Double = Cos(PtY) * Sin(HeadPty) - Sin(PtY) * Cos(HeadPty) * Cos(Dlon)
Dim brg As Double = Atan2(y, x)
Dim bearing As String = quadrant + " " + ((ESRI.ArcGISExplorer.Geometry.Unit.Angular.Radians.Convert(brg, Unit.Angular.Degrees) + 180) Mod 360).ToString("###.00°")
Return bearing 'Returns the bearing
End Function