Changeset 594

Show
Ignore:
Timestamp:
01/29/12 19:55:10 (4 months ago)
Author:
sbs
Message:

Remove dead code

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • sbsRouteur/trunk/Routeur/Classes/TravelCalculator.vb

    r592 r594  
    44Public Class TravelCalculator 
    55 
    6     'Inherits FrameworkElement 
    7  
    8     'Implements INotifyPropertyChanged 
    96 
    107    Public Const Earth_Radius As Double = 3443.84 
     
    1411    Private _DistanceAngle As Double 
    1512 
    16  
    17  
    18     'Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged 
    19  
    2013    Dim ownertype As Control 
    2114 
     
    2518    Private Const PRECISION As Integer = 100000 
    2619 
    27     'Private _CapCached As Boolean = False 
    28     'Private _DistanceCached As Boolean = False 
    2920 
    3021    Public ReadOnly Property LoxoCourse_Deg As Double 
     
    4233            Dim Lat1 As Double = StartPoint.N_Lat 
    4334            Dim Lat2 As Double = EndPoint.N_Lat 
    44  
    45             'If Abs(Lon2 - Lon1) > PI Then 
    46             '    If Lon2 < Lon1 Then 
    47             '        Lon2 += 2 * PI 
    48             '    Else 
    49             '        Lon2 -= 2 * PI 
    50             '    End If 
    51  
    52             'End If 
    5335 
    5436            Dim tc As Double = Atan2(Lon1 - Lon2, Log(Tan(Lat2 / 2 + PI / 4) / Tan(Lat1 / 2 + PI / 4))) Mod (2 * PI) 
     
    11496    Private ReadOnly Property LoxoCourse_Deg_VLM() As Double 
    11597        Get 
    116             'If _CapCached AndAlso Not Double.IsNaN(_Cap) Then 
    117             '    Return _Cap 
    118             'End If 
     98 
    11999            If StartPoint Is Nothing Or EndPoint Is Nothing Then 
    120100                _Cap = 0 
     
    133113                    _Cap = (2 * Math.PI - A) / Math.PI * 180 
    134114                End If 
    135                  
     115 
    136116            End If 
    137117            Return _Cap 
     
    142122 
    143123 
    144     'd=2*asin(sqrt((sin((lat1-lat2)/2))^2 +  
    145     '            cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2)) 
    146  
    147124    Public ReadOnly Property DistanceAngle() As Double 
    148125        Get 
    149             'If _DistanceCached AndAlso Not Double.IsNaN(_DistanceAngle) Then 
    150             '    Return _DistanceAngle 
    151             'End If 
     126             
    152127            If StartPoint Is Nothing Or EndPoint Is Nothing Then 
    153128                _DistanceAngle = 0 
     
    156131            Else 
    157132 
    158                 'If StartPoint.Lat - EndPoint.Lat < EPSILON And StartPoint.Lon - EndPoint.Lon < EPSILON Then 
    159                 '    Return 0 
    160                 'End If 
    161                 'Dim v1 As Double = sin((StartPoint.Lat - EndPoint.Lat) / 2) 
    162                 'Dim v2 As Double = (sin((StartPoint.Lon - EndPoint.Lon) / 2)) 
    163  
    164  
    165                 '_DistanceAngle = 2 * Asin(Sqrt((v1 * v1) + Cos(StartPoint.Lat) * Cos(EndPoint.Lat) * v2 * v2)) 
     133             
    166134 
    167135                Dim dValue As Double = Math.Sin(StartPoint.Lat) * Math.Sin(EndPoint.Lat) + _ 
     
    175143                End If 
    176144                _DistanceAngle = Math.Acos(dValue) 
    177                 '_DistanceCached = True 
     145 
    178146            End If 
    179147 
     
    229197        Dim RetCoords As New Coords 
    230198 
    231         '        /* vac_duration in seconds */ 
    232         '48     void move_boat_loxo(boat *aboat) { 
    233         '49       double speed; 
    234         '50       double latitude, t_lat; 
    235         '51       double vac_l, d; 
    236         '52       double longitude; 
    237         '53       int vac_duration; 
    238         '54       wind_info *wind; 
    239         '55: 
    240         '56       vac_duration = aboat->in_race->vac_duration; 
    241         '57       /* compute the heading based on the function used */ 
    242         '58       aboat->set_heading_func(aboat); 
    243         '59       wind = &aboat->wind; 
    244         '60: 
    245         '61       speed = find_speed(aboat, wind->speed, wind->angle - aboat->heading); 
    246         '62: 
    247         '63       vac_l = speed*(vac_duration/3600.0); 
    248         '64: 
    249         '65       d = degToRad(vac_l/60.0); 
     199         
    250200        Dim d As Double = Dist / Earth_Radius 
    251201        Dim tc_rad As Double = tc_deg / 180 * PI 
     
    262212    End Function 
    263213 
    264     'Public Function ReachDistanceGC(ByVal Dist As Double) As Coords 
    265  
    266     '    Dim A As Double 
    267     '    Dim B As Double 
    268     '    Dim f As Double 
    269     '    Dim x As Double 
    270     '    Dim y As Double 
    271     '    Dim z As Double 
    272     '    Dim RetVal As New Coords 
    273  
    274  
    275     '    Dist /= Earth_Radius 
    276     '    f = Dist / DistanceAngle 
    277  
    278  
    279     '    A = Sin((1 - f) * DistanceAngle) / Sin(DistanceAngle) 
    280     '    B = Sin(f * DistanceAngle) / Sin(DistanceAngle) 
    281     '    x = A * Cos(StartPoint.Lat) * Cos(StartPoint.Lon) + B * Cos(EndPoint.Lat) * Cos(EndPoint.Lon) 
    282     '    y = A * Cos(StartPoint.Lat) * Sin(StartPoint.Lon) + B * Cos(EndPoint.Lat) * Sin(EndPoint.Lon) 
    283     '    z = A * Sin(StartPoint.Lat) + B * Sin(EndPoint.Lat) 
    284     '    RetVal.Lat = Atan2(z, Sqrt(x ^ 2 + y ^ 2)) 
    285     '    RetVal.Lon = Atan2(y, x) 
    286  
    287     '    Return RetVal 
    288  
    289     'End Function 
    290  
    291     'Public Function ReachLat(ByVal Lat As Double, ByVal Course As Double) As Boolean 
    292  
    293     '    Dim d As Double 
    294     '    Dim CourseCorrection As Double = Course 
    295  
    296     '    SyncLock Me 
    297     '        If EndPoint Is Nothing Then 
    298     '            EndPoint = New Coords 
    299     '        End If 
    300  
    301     '        If Abs(Cos(Course)) < EPSILON Then 
    302     '            EndPoint.Lat = Lat 
    303     '            EndPoint.Lon = StartPoint.Lon + Math.PI 
    304     '            Return True 
    305     '        End If 
    306  
    307  
    308     '        EndPoint.Lat = StartPoint.Lat 
    309     '        EndPoint.Lon = StartPoint.Lon 
    310  
    311     '        Do 
    312     '            'CourseCorrection = Course 
    313     '            d = Abs(EndPoint.Lat - Lat) 
    314     '            If Double.IsNaN(d) Then 
    315     '                Return False 
    316     '            End If 
    317     '            EndPoint.Lat += d * Cos(CourseCorrection) 
    318     '            EndPoint.Lon -= d * Sin(CourseCorrection) 
    319  
    320     '            'Correct coefficient for course error 
    321     '            CourseCorrection += (TrueCourse() - Course) 
    322     '            'Debug.WriteLine("Course " & CourseCorrection / PI * 180 & " D : " & d & " endpoint " & EndPoint.Lat_Deg & " " & EndPoint.Lon_Deg) 
    323  
    324     '        Loop Until Abs(EndPoint.Lat - Lat) < EPSILON 'Or Double.IsNaN(CourseCorrection) 
    325     '        Return True 
    326     '    End SyncLock 
    327     'End Function 
    328  
    329     '    Public Function ReachLon(ByVal Lon As Double, ByVal Course As Double) As Boolean 
    330  
    331     '        Dim d As Double 
    332     '        Dim factor As Integer = 1 
    333     'start: 
    334     '        Dim CourseCorrection As Double = Course 
    335     '        SyncLock Me 
    336     '            If EndPoint Is Nothing Then 
    337     '                EndPoint = New Coords 
    338     '            End If 
    339  
    340     '            If Abs(Sin(Course)) <= EPSILON Then 
    341     '                EndPoint.Lat = StartPoint.Lat + Math.PI 
    342     '                EndPoint.Lon = Lon 
    343     '                Return True 
    344     '            End If 
    345  
    346  
    347     '            EndPoint.Lat = StartPoint.Lat 
    348     '            EndPoint.Lon = StartPoint.Lon 
    349  
    350     '            Do 
    351     '                'CourseCorrection = Course 
    352     '                d = Abs(EndPoint.Lon - Lon) 
    353     '                If Double.IsNaN(d) Then 
    354     '                    Dim i As Integer = 0 
    355     '                    Return False 
    356     '                End If 
    357     '                If Abs(EndPoint.Lat + factor * d * Cos(CourseCorrection)) > PI / 2 Then 
    358     '                    factor = -factor 
    359  
    360     '                End If 
    361     '                EndPoint.Lat += factor * d * Cos(CourseCorrection) 
    362     '                EndPoint.Lon -= d * Sin(CourseCorrection) 
    363  
    364  
    365     '                'Correct coefficient for course error 
    366     '                CourseCorrection -= (TrueCourse() - Course) 
    367     '                'Debug.WriteLine("Course " & CourseCorrection / PI * 180 & " D : " & d & " endpoint " & EndPoint.Lat_Deg & " " & EndPoint.Lon_Deg) 
    368  
    369     '            Loop Until Abs(EndPoint.Lon - Lon) < EPSILON OrElse Double.IsNaN(d) 'Or Double.IsNaN(CourseCorrection) 
    370     '            Return True 
    371     '        End SyncLock 
    372     '    End Function 
    373  
    374214 
    375215    Public Property EndPoint() As Coords 
     
    380220        Set(ByVal value As Coords) 
    381221            _EndPoint = value 
    382             'RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("EndPoint")) 
    383             'RefreshCalculatorProps(Me, Nothing) 
    384             '_CapCached = False 
    385             '_DistanceCached = False 
    386222        End Set 
    387223    End Property 
    388  
    389     'Public Sub FindNextWindChangePoint(ByVal Cap As Double, ByVal Speed As Double) 
    390  
    391     '    Dim DistLat As Double 
    392     '    Dim DistLon As Double 
    393     '    Dim NegLon As Boolean = StartPoint.Lon_Deg < 0 
    394     '    Static C As New Coords 
    395     '    Static CachedLatPoint As New Coords 
    396     '    Dim CapRad As Double 
    397  
    398     '    CapRad = Math.PI * Cap / 180 
    399  
    400     '    Dim P1 As PrevDateInfo 
    401     '    P1 = PrevDateInfo.GetKey(StartPoint) 
    402     '    C.Lat_Deg = P1.Lat 
    403     '    C.Lon_Deg = P1.lon 
    404  
    405  
    406     '    Dim GridStepOffset As Double = 0.001 
    407     '    Dim MeteoGridStep As Double = 1 / RouteurModel.METEO_GRID_STEP / 2 + GridStepOffset 
    408     '    If Math.Cos(CapRad) >= 0 Then 
    409     '        C.Lat_Deg += MeteoGridStep 
    410     '    Else 
    411     '        C.Lat_Deg -= MeteoGridStep 
    412     '    End If 
    413  
    414     '    If Math.Sin(CapRad) * -C.Lon_Deg >= 0 Then 
    415     '        C.Lon_Deg += MeteoGridStep 
    416     '    Else 
    417     '        C.Lon_Deg -= MeteoGridStep 
    418     '    End If 
    419  
    420     '    If NegLon Then 
    421     '        C.Lon_Deg = -C.Lon_Deg 
    422     '    End If 
    423  
    424     '    'Point 1 same lat 
    425     '    If ReachLat(C.Lat, CapRad) Then 
    426     '        CachedLatPoint.Lat = EndPoint.Lat 
    427     '        CachedLatPoint.Lon = EndPoint.Lon 
    428     '        DistLat = SurfaceDistance 
    429     '    Else 
    430     '        DistLat = 10000000 
    431     '    End If 
    432  
    433     '    'Point 1 same lon 
    434     '    If ReachLon(C.Lon, CapRad) Then 
    435     '        DistLon = SurfaceDistance 
    436     '    Else 
    437     '        DistLon = 1000000 
    438     '    End If 
    439  
    440     '    If DistLat < DistLon Then 
    441     '        EndPoint.Lat = CachedLatPoint.Lat 
    442     '        EndPoint.Lon = CachedLatPoint.Lon 
    443     '    End If 
    444  
    445     '    Return 
    446  
    447     'End Sub 
    448224 
    449225 
     
    455231        Set(ByVal value As Coords) 
    456232            _StartPoint = value 
    457             'RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("StartPoint")) 
    458             'RefreshCalculatorProps(Nothing, Nothing) 
    459             '_CapCached = False 
    460             '_DistanceCached = False 
    461233        End Set 
    462234    End Property 
    463235 
    464  
    465     'Private Sub RefreshCalculatorProps(ByVal sender As Object, ByVal E As PropertyChangedEventArgs) 
    466  
    467     '    Static DAProp As New PropertyChangedEventArgs("DistanceAngle") 
    468     '    Static SDProp As New PropertyChangedEventArgs("SurfaceDistance") 
    469     '    RaiseEvent PropertyChanged(Me, DAProp) 
    470     '    RaiseEvent PropertyChanged(Me, SDProp) 
    471  
    472     'End Sub 
    473236 
    474237    Public ReadOnly Property SurfaceDistance() As Double 
     
    500263            Return 0 
    501264        End If 
    502         'Dim RetVal As Double = Math.Atan2(-StartPoint.Lon + EndPoint.Lon, Math.Log(Tan(EndPoint.Lat / 2 + Math.PI / 4) / Math.Tan(StartPoint.Lat / 2 + Math.PI / 4))) Mod 2 * PI 
    503  
    504         'tc1=mod(atan2(sin(lon1-lon2)*cos(lat2), 
    505         '   cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon1-lon2)), 2*pi) 
    506265        Dim retval As Double = Atan2(Sin(-StartPoint.Lon + EndPoint.Lon) * Cos(EndPoint.Lat), _ 
    507266                     Cos(StartPoint.Lat) * Sin(EndPoint.Lat) - Sin(StartPoint.Lat) * Cos(EndPoint.Lat) * Cos(-StartPoint.Lon + EndPoint.Lon)) 
    508267 
    509         'If Abs(EndPoint.Lon - StartPoint.Lon) > PI Then 
    510         '    retval += PI 
    511         'End If 
    512268        retval = retval Mod (2 * PI) 
    513269        Return retval 
     
    516272 
    517273 
    518     'Private Sub _EndPoint_PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Handles _EndPoint.PropertyChanged, _StartPoint.PropertyChanged 
    519  
    520     '    _CapCached = False 
    521     '    _DistanceCached = False 
    522  
    523     'End Sub 
    524  
    525  
    526274    Function ReachDistanceOrtho(f As Double) As Coords 
    527         'A = Sin((1 - f) * d) / Sin(d) 
    528         'B = Sin(f * d) / Sin(d) 
    529         'x = A * Cos(lat1) * Cos(lon1) + B * Cos(lat2) * Cos(lon2) 
    530         'y = A * Cos(lat1) * Sin(lon1) + B * Cos(lat2) * Sin(lon2) 
    531         'z = A * Sin(lat1) + B * Sin(lat2) 
    532         'lat = Atan2(z, Sqrt(x ^ 2 + y ^ 2)) 
    533         'lon = Atan2(y, x) 
    534275 
    535276        Dim RetP As New Coords