1

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

3

4 u'''DEPRECATED classes kept for 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 _GTuple, Rhumb8Tuple as _Rhumb8Tuple, ADict

13 from pygeodesy.lazily import _ALL_DEPRECATED, _ALL_DOCS, _ALL_MODS as _MODS

14 from pygeodesy.ltpTuples import Ned4Tuple as _Ned4Tuple

15# from pygeodesy.named import ADict, _NamedTuple # from .karney, .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 TRFXform7Tuple as _TRFXform7Tuple

22 from pygeodesy.units import Bearing, Int, Lamd, Lat, Lon, Meter, Phid

23

24__all__ = _ALL_DEPRECATED.deprecated_classes

25__version__ = '24.07.02'

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.deprecated.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 return EcefCartesian_(*args, **kwds)

99

100

101 def Fn_rt(root, *xs, **name_RESIDUAL_raiser): # PYCHOK no cover

102 '''DEPRECATED on 2024.04.17, use class L{Froot}.

103 '''

104 Froot = _MODS.fmath.Froot

105

106 class Fn_rt(Froot): # PYCHOK no cover

107 '''DEPRECATED on 2024.04.17, use class L{Froot}.

108 '''

109 def __init__(self, root, *xs, **name_RESIDUAL_raiser):

110 deprecated_class(self.__class__)

111 Froot.__init__(self, root, *xs, **name_RESIDUAL_raiser)

112

113

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

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

116 HeightIDWeuclidean = _MODS.heights.HeightIDWeuclidean

117

118 class HeightIDW(HeightIDWeuclidean):

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

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

121 deprecated_class(self.__class__)

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

123

124 return HeightIDW(knots, **kwds)

125

126

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

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

129 HeightIDWequirectangular = _MODS.heights.HeightIDWequirectangular

130

131 class HeightIDW2(HeightIDWequirectangular):

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

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

134 deprecated_class(self.__class__)

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

136

137 return HeightIDW2(knots, **kwds)

138

139

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

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

142 HeightIDWhaversine = _MODS.heights.HeightIDWhaversine

143

144 class HeightIDW3(HeightIDWhaversine):

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

146 '''

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

148 deprecated_class(self.__class__)

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

150

151 return HeightIDW3(knots, **kwds)

152

153

154 class Lam_(Lamd):

155 '''DEPRECATED on 2024.06.15, use class L{Lamd}.'''

156 def __init__(self, *args, **kwds): # PYCHOK signature

157 deprecated_class(self.__class__)

158 Lamd.__init__(self, *args, **kwds)

159

160

161 class LatLonExact4Tuple(_Deprecated_NamedTuple):

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

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

164 _Units_ = _Reverse4Tuple._Units_

165

166

167 class NearestOn4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover

168 '''DEPRECATED on 2023.10.10, see methods L{RhumbLine.nearestOn4} and L{RhumbLineAux.nearestOn4}.'''

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

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

171

172

173 class Phi_(Phid):

174 '''DEPRECATED on 2024.06.15, use class L{Phid}.'''

175 def __init__(self, *args, **kwds): # PYCHOK signature

176 deprecated_class(self.__class__)

177 Phid.__init__(self, *args, **kwds)

178

179

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

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

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

183 _Names_ = _Ned4Tuple._Names_[:3]

184 _Units_ = _Ned4Tuple._Units_[:3]

185

186

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

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

189 TRFError = _MODS.errors.TRFError

190

191 class RefFrameError(TRFError):

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

193 '''

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

195 deprecated_class(self.__class__)

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

197

198 return RefFrameError(*args, **kwds)

199

200

201 class Rhumb7Tuple(_Deprecated_NamedTuple):

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

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

204 _Names_ = _Rhumb8Tuple._Names_[:7]

205 _Units_ = _Rhumb8Tuple._Units_[:7]

206

207 @deprecated_method

208 def toDirect9Tuple(self, **kwds):

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

210

211 @deprecated_method

212 def toGDict(self, **kwds):

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

214

215 @deprecated_method

216 def toInverse10Tuple(self, **kwds):

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

218

219 @deprecated_method

220 def toRhumb8Tuple(self, dflt=NAN):

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

222

223 def _to7Tuple(self):

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

225 '''

226 return self

227

228

229 class RhumbOrder2Tuple(_Deprecated_NamedTuple, _GTuple):

230 '''DEPRECATED, see deprecated method L{Rhumb.orders}.'''

231 # 2-Tuple C{(RAorder, TMorder)} with a I{Rhumb Area} and

232 # I{Transverse Mercator} order, both C{int}.

233 _Names_ = ('RAorder', 'TMorder')

234 _Units_ = ( Int, Int)

235

236

237 class Transform7Tuple(_Deprecated_NamedTuple): # PYCHOK no cover

238 '''DEPRECATED on 2024.02.02, use class L{TRFXform7Tuple}, I{without} keyword arguments.'''

239 _Names_ = _TRFXform7Tuple._Names_

240 _Units_ = _TRFXform7Tuple._Units_

241

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

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

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

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

246

247 Helmert7Tuple = Transform7Tuple # PYCHOK likewise

248

249

250 class TriAngle4Tuple(_Deprecated_NamedTuple):

251 '''DEPRECATED on 2023.09.14, use class L{TriAngle5Tuple}, ignoring item C{area}.'''

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

253 _Names_ = _TriAngle5Tuple._Names_[:4]

254 _Units_ = _TriAngle5Tuple._Units_[:4]

255

256

257 class UtmUps4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover

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

259

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

261 '''

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

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

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

265

266

267 class XDist(ADict):

268 '''DEPRECATED on 2024.07.02, use class L{XDict}.'''

269 def __init__(self, *args, **kwds): # PYCHOK signature

270 deprecated_class(self.__class__)

271 ADict.__init__(self, *args, **kwds)

272

273

274__all__ += _ALL_DOCS(_Deprecated_NamedTuple)

275

276# **) MIT License

277#

278# Copyright (C) 2018-2024 -- mrJean1 at Gmail -- All Rights Reserved.

279#

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

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

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

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

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

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

286#

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

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

289#

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

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

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

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

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

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

296# OTHER DEALINGS IN THE SOFTWARE.