1

2# -*- coding: utf-8 -*-

3

4 u'''DEPRECATED classes for export and backward compatibility.

5'''

6

7 from pygeodesy.clipy import ClipCS4Tuple as _ClipCS4Tuple

8 from pygeodesy.constants import NAN, _float

9 from pygeodesy.interns import NN, _a12_, _area_, _band_, _convergence_, \

10 _distance_, _gamma_, _i_, _lat_, _lon_, _ltp_

11 from pygeodesy.deprecated.consterns import _Deprecated_Str

12 from pygeodesy.karney import Rhumb8Tuple as _Rhumb8Tuple

13 from pygeodesy.lazily import _ALL_MODS as _MODS, _ALL_OTHER

14 from pygeodesy.ltpTuples import Ned4Tuple as _Ned4Tuple

15# from pygeodesy.named import _NamedTuple # from .namedTuples

16 from pygeodesy.namedTuples import Forward4Tuple as _Forward4Tuple, \

17 Reverse4Tuple as _Reverse4Tuple, \

18 UtmUps5Tuple as _UtmUps5Tuple, _NamedTuple

19 from pygeodesy.props import deprecated_class, deprecated_method

20 from pygeodesy.resections import TriAngle5Tuple as _TriAngle5Tuple

21 from pygeodesy.trf import Helmert7Tuple as _Helmert7Tuple

22 from pygeodesy.units import Bearing, Lat, Lon, Meter

23

24__all__ = ()

25__version__ = '23.10.15'

26

27

28 class _Deprecated_NamedTuple(_NamedTuple):

29 '''DEPRECATED, C{_NamedTuple} base.

30 '''

31 def __new__(cls, *args, **kwds):

32 deprecated_class(cls)

33 return _NamedTuple.__new__(cls, *args, **kwds)

34

35

36 def _reNames(names, old, *new):

37 # replace item C{old} with C{new} name

38 i = names.index(old)

39 return names[:i] + new + names[i + 1:]

40

41

42 class ClipCS3Tuple(_Deprecated_NamedTuple): # PYCHOK no cover

43 '''DEPRECATED, see I{DEPRECATED} function L{pygeodesy.clipCS3}.'''

44 assert _ClipCS4Tuple._Names_.index(_i_) == 2

45 _Names_ = _reNames(_ClipCS4Tuple._Names_[:3], _i_, 'index')

46 _Units_ = _ClipCS4Tuple._Units_[:3]

47

48

49 class EasNorExact4Tuple(_Deprecated_NamedTuple):

50 '''DEPRECATED, use class L{Forward4Tuple}, item C{gamma} for C{convergence}.'''

51 _Names_ = _reNames(_Forward4Tuple._Names_, _gamma_, _convergence_)

52 _Units_ = _Forward4Tuple._Units_

53

54

55 def EcefCartesian(*args, **kwds):

56 '''DEPRECATED, use class L{LocalCartesian}.'''

57 Ltp = _MODS.ltp.Ltp

58

59 class EcefCartesian_(Ltp):

60 '''DEPRECATED, use class L{LocalCartesian} or L{Ltp}.

61

62 @note: This class is named I{incorrectly}, since it provides conversion to

63 and from I{local} cartesian coordinates in a I{local tangent plane}

64 and I{not geocentric} (ECEF) ones, as the name would suggest.

65 '''

66 def __init__(self, latlonh0=0, lon0=0, height0=0, ecef=None, name=NN):

67 deprecated_class(self.__class__)

68 Ltp.__init__(self, latlonh0=latlonh0, lon0=lon0, height0=height0, ecef=ecef, name=name)

69

70 @deprecated_method

71 def forward(self, latlonh, lon=None, height=0, M=False, name=NN):

72 '''DEPRECATED, use method L{LocalCartesian.forward} or L{Ltp.forward}.

73

74 @return: I{Incorrectly}, an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C,

75 M, datum)} with I{local} C{(x, y, z)} coordinates for the given

76 I{geodetic} ones C{(lat, lon, height)}, case C{C=0} always,

77 optionally I{concatenated} L{EcefMatrix} C{M} and C{datum}.

78 '''

79 t = Ltp.forward(self, latlonh, lon=lon, height=height, M=M, name=name)

80 return _MODS.ecef.Ecef9Tuple(t.x, t.y, t.z, t.lat, t.lon, t.height,

81 0, t.M, t.ecef.datum,

82 name=t.name or self.name)

83

84 @deprecated_method

85 def reverse(self, xyz, y=None, z=None, M=False, name=NN):

86 '''DEPRECATED, use method L{LocalCartesian.reverse} or L{Ltp.reverse}.

87

88 @return: I{Incorrectly}, an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C,

89 M, datum)} with I{geodetic} coordinates C{(lat, lon, height)} for

90 the given I{local} ones C{(x, y, z)}, case C{C}, optionally

91 I{concatenated} L{EcefMatrix} C{M} and C{datum}.

92 '''

93 t = Ltp.reverse(self, xyz, y=y, z=z, M=M, name=name)

94 return _MODS.ecef.Ecef9Tuple(t.x, t.y, t.z, t.lat, t.lon, t.height,

95 t.ecef.C, t.M, t.ecef.datum,

96 name=t.name or self.name)

97

98 _MODS.deprecated.EcefCartesian = Ltp

99 return EcefCartesian_(*args, **kwds)

100

101

102 def HeightIDW(knots, **kwds): # PYCHOK no cover

103 '''DEPRECATED, use class L{HeightIDWeuclidean}.'''

104 HeightIDWeuclidean = _MODS.heights.HeightIDWeuclidean

105

106 class HeightIDW(HeightIDWeuclidean):

107 '''DEPRECATED, use class L{HeightIDWeuclidean}.'''

108 def __init__(self, knots, adjust=True, beta=2, name=NN):

109 deprecated_class(self.__class__)

110 HeightIDWeuclidean.__init__(self, knots, adjust=adjust, beta=beta, name=name)

111

112 _MODS.deprecated.HeightIDW = HeightIDW

113 return HeightIDW(knots, **kwds)

114

115

116 def HeightIDW2(knots, **kwds): # PYCHOK no cover

117 '''DEPRECATED, use class L{HeightIDWequirectangular}.'''

118 HeightIDWequirectangular = _MODS.heights.HeightIDWequirectangular

119

120 class HeightIDW2(HeightIDWequirectangular):

121 '''DEPRECATED, use class L{HeightIDWequirectangular}.'''

122 def __init__(self, knots, adjust=True, wrap=False, name=NN):

123 deprecated_class(self.__class__)

124 HeightIDWequirectangular.__init__(self, knots, adjust=adjust, wrap=wrap, name=name)

125

126 _MODS.deprecated.HeightIDW2 = HeightIDW2

127 return HeightIDW2(knots, **kwds)

128

129

130 def HeightIDW3(knots, **kwds): # PYCHOK no cover

131 '''DEPRECATED, use class L{HeightIDWhaversine}.'''

132 HeightIDWhaversine = _MODS.heights.HeightIDWhaversine

133

134 class HeightIDW3(HeightIDWhaversine):

135 '''DEPRECATED, use class L{HeightIDWhaversine}.

136 '''

137 def __init__(self, knots, beta=2, wrap=False, name=NN):

138 deprecated_class(self.__class__)

139 HeightIDWhaversine.__init__(self, knots, beta=beta, wrap=wrap, name=name)

140

141 _MODS.deprecated.HeightIDW3 = HeightIDW3

142 return HeightIDW3(knots, **kwds)

143

144

145 class LatLonExact4Tuple(_Deprecated_NamedTuple):

146 '''DEPRECATED, use class L{Reverse4Tuple}, item C{gamma} for C{convergence}.'''

147 _Names_ = _reNames(_Reverse4Tuple._Names_, _gamma_, _convergence_)

148 _Units_ = _Reverse4Tuple._Units_

149

150

151 class NearestOn4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover

152 '''DEPRECATED on 23.10.10, see methods L{RhumbLine.nearestOn4} and L{RhumbLineAux.nearestOn4}.'''

153 _Names_ = (_lat_, _lon_, _distance_, 'normal') # s12, azi02

154 _Units_ = ( Lat, Lon, Meter, Bearing)

155

156

157 class Ned3Tuple(_Deprecated_NamedTuple): # was in .ellipsoidalNvector

158 '''DEPRECATED, use class L{Ned4Tuple}, ignoring item C{ltp}.'''

159 assert _Ned4Tuple._Names_.index(_ltp_) == 3

160 _Names_ = _Ned4Tuple._Names_[:3]

161 _Units_ = _Ned4Tuple._Units_[:3]

162

163

164 def RefFrameError(*args, **kwds): # PYCHOK no cover

165 '''DEPRECATED, use class L{TRFError}.'''

166 TRFError = _MODS.errors.TRFError

167

168 class RefFrameError(TRFError):

169 '''DEPRECATED, use class L{TRFError}.

170 '''

171 def __init__(self, *name_value, **txt_name_values):

172 deprecated_class(self.__class__)

173 TRFError.__init__(self, *name_value, **txt_name_values)

174

175 _MODS.deprecated.RefFrameError = RefFrameError

176 return RefFrameError(*args, **kwds)

177

178

179 class Rhumb7Tuple(_Deprecated_NamedTuple):

180 '''DEPRECATED, use class L{Rhumb8Tuple}, ignoring item C{a12}.'''

181 assert _Rhumb8Tuple._Names_.index(_a12_) == 7

182 _Names_ = _Rhumb8Tuple._Names_[:7]

183 _Units_ = _Rhumb8Tuple._Units_[:7]

184

185 @deprecated_method

186 def toDirect9Tuple(self, **kwds):

187 return self.toRhumb8Tuple().toDirect9Tuple(self, **kwds)

188

189 @deprecated_method

190 def toGDict(self, **kwds):

191 return self.toRhumb8Tuple().toGDict(**kwds)

192

193 @deprecated_method

194 def toInverse10Tuple(self, **kwds):

195 return self.toRhumb8Tuple().toInverse10Tuple(self, **kwds)

196

197 @deprecated_method

198 def toRhumb8Tuple(self, dflt=NAN):

199 return _Rhumb8Tuple(self + (dflt,), name=self.name)

200

201 def _to7Tuple(self):

202 '''(INTERNAL) see L{Rhumb8Tuple._to7Tuple}.

203 '''

204 return self

205

206

207 class Transform7Tuple(_Deprecated_NamedTuple): # PYCHOK no cover

208 '''DEPRECATED, use class L{Helmert7Tuple}, I{without} keyword arguments.'''

209 _Names_ = _Helmert7Tuple._Names_

210 _Units_ = _Helmert7Tuple._Units_

211

212 def __new__(cls, tx=0, ty=0, tz=0, s=0,

213 sx=0, sy=0, sz=0, name=NN):

214 t = map(_float, (tx, ty, tz, s, sx, sy, sz))

215 return _Deprecated_NamedTuple.__new__(cls, *t, name=name)

216

217

218 class TriAngle4Tuple(_Deprecated_NamedTuple):

219 '''DEPRECATED on 23.09.14, use class L{TriAngle5Tuple}, ignoring item C{area}.'''

220 assert _TriAngle5Tuple._Names_.index(_area_) == 4

221 _Names_ = _TriAngle5Tuple._Names_[:4]

222 _Units_ = _TriAngle5Tuple._Units_[:4]

223

224

225 class UtmUps4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover

226 '''DEPRECATED and OBSOLETE, expect a L{UtmUps5Tuple} from method C{pygeodesy.Mgrs.toUtm(utm=None)}.

227

228 4-Tuple C{(zone, hemipole, easting, northing)} with as C{zone} B{C{str}} and no C{band}.

229 '''

230 assert _UtmUps5Tuple._Names_.index(_band_) == 4

231 _Names_ = _UtmUps5Tuple._Names_[ :4] # band

232 _Units_ = (_Deprecated_Str,) + _UtmUps5Tuple._Units_[1:4]

233

234

235__all__ += _ALL_OTHER(ClipCS3Tuple, EasNorExact4Tuple, EcefCartesian,

236 HeightIDW, HeightIDW2, HeightIDW3, LatLonExact4Tuple,

237 NearestOn4Tuple, Ned3Tuple, RefFrameError, Rhumb7Tuple,

238 Transform7Tuple, TriAngle4Tuple, UtmUps4Tuple)

239

240# **) MIT License

241#

242# Copyright (C) 2018-2023 -- mrJean1 at Gmail -- All Rights Reserved.

243#

244# Permission is hereby granted, free of charge, to any person obtaining a

245# copy of this software and associated documentation files (the "Software"),

246# to deal in the Software without restriction, including without limitation

247# the rights to use, copy, modify, merge, publish, distribute, sublicense,

248# and/or sell copies of the Software, and to permit persons to whom the

249# Software is furnished to do so, subject to the following conditions:

250#

251# The above copyright notice and this permission notice shall be included

252# in all copies or substantial portions of the Software.

253#

254# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS

255# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

256# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

257# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR

258# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,

259# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

260# OTHER DEALINGS IN THE SOFTWARE.