示例#1
0
文件: ecef.py 项目: mzy2240/PyGeodesy
    def __init__(self, a_ellipsoid, f, name):
        '''(INTERNAL) New C{Ecef...}.
        '''
        try:
            E = a_ellipsoid
            if f is None:
                if isinstance(E, Datum):
                    self._datum = E
                    E = E.ellipsoid
                elif not isinstance(E, Ellipsoid):
                    raise TypeError
                self.name = E.name

            elif isscalar(E) and isscalar(f):
                a  = float(E)
                f_ = (1.0 / f) if f else 0  # sphere
                b  = None if f_ else a
                E = Ellipsoid(a, b, f_, name='_' + name)
            else:
                raise ValueError

            if not (E.a > 0 and E.f < 1):
                raise ValueError
        except (TypeError, ValueError):
            t = unStr(self.classname, a=E, f=f)
            raise EcefError('%s invalid: %s' % ('ellipsoid', t))

        self._E = E
        if name:
            self.name = name
示例#2
0
文件: named.py 项目: mhuyha/PyGeodesy
def inStr(inst, *args, **kwds):
    '''Return the string representation of an instance.

       @param inst: The instance (any C{type}).
       @param args: Optional positional arguments.
       @keyword kwds: Optional keyword arguments.

       @return: The B{C{inst}}'s representation (C{str}).
    '''
    return unStr(classname(inst), *args, **kwds)
示例#3
0
文件: named.py 项目: mhuyha/PyGeodesy
    def toStr(self, **kwds):
        '''(INTERNAL) Must be overloaded.

           @param kwds: Optional, keyword arguments.
        '''
        raise AssertionError(unStr(self.classname + '.toStr', **kwds))
示例#4
0
文件: named.py 项目: mhuyha/PyGeodesy
 def _xcopy(self, *attrs):
     '''(INTERNAL) Must be overloaded.
     '''
     raise AssertionError(unStr(self.classname + '._xcopy', *attrs))
示例#5
0
 def toCartesian(self):
     '''Convert this (geodetic) point to (geocentric) x/y/z
        Cartesian coordinates.  Must be overloaded.
     '''
     raise AssertionError(unStr(self.classname + '.toCartesian'))
示例#6
0
 def falsed2(self):
     '''(INTERNAL) Must be overloaded.
     '''
     raise AssertionError(unStr(self.classname + '.falsed2'))
 def _notOverloaded(self, name, *args, **kwds):  # PYCHOK no cover
     '''Raise an error for a method or property not overloaded.
     '''
     n = '%s %s.%s' % (self._notOverloaded.__name__, self.classname, name)
     raise AssertionError(unStr(n, *args, **kwds))