예제 #1
0
    def toRepr(self,
               prec=6,
               fmt=_SQUARE_,
               sep=_COMMA_SPACE_,
               m=_m_,
               C=False):  # PYCHOK expected
        '''Return a string representation of this L{Css} position.

           @kwarg prec: Optional number of decimals, unstripped (C{int}).
           @kwarg fmt: Optional, enclosing backets format (C{str}).
           @kwarg sep: Optional separator between name:values (C{str}).
           @kwarg m: Optional unit of the height, default meter (C{str}).
           @kwarg C: Optionally, include name of projection (C{bool}).

           @return: This position as C{"[E:meter, N:meter, H:m, name:'',
                    C:Conic.Datum]"} (C{str}).
        '''
        t = self.toStr(prec=prec, sep=None, m=m)
        k = (_E_, _N_, 'H')[:len(t)]
        if self.name:
            k += _name_,
            t += repr(self.name),
        if C:
            k += _C_,
            t += self.cs0.toRepr(prec=prec),
        return _xzipairs(k, t, sep=sep, fmt=fmt)
예제 #2
0
 def _toRepr(self,
             prec=0,
             fmt=_SQUARE_,
             sep=_COMMA_SPACE_,
             B=False,
             cs=False,
             **unused):  # PYCHOK expected
     '''(INTERNAL) Return a string representation of this UTM/UPS coordinate.
     '''
     t = self.toStr(prec=prec, sep=None, B=B, cs=cs)
     return _xzipairs('ZHENCS', t, sep=sep, fmt=fmt)  # 'ZHENCS'[:len(t)]
예제 #3
0
    def toStr(self, prec=3, fmt=_SQUARE_, sep=_COMMA_SPACE_):  # PYCHOK expected
        '''Return a string representation of this NED vector.

           @kwarg prec: Optional number of decimals, unstripped (C{int}).
           @kwarg fmt: Optional enclosing backets format (C{str}).
           @kwarg sep: Optional separator between NEDs (C{str}).

           @return: This Ned as "[N:f, E:f, D:f]" (C{str}).
        '''
        t = strs(self.ned, prec=prec)
        return _xzipairs('NED', t, sep=sep, fmt=fmt)
예제 #4
0
    def toRepr(self,
               prec=10,
               fmt=_SQUARE_,
               sep=_COMMA_SPACE_):  # PYCHOK expected
        '''Return a string representation of this MGRS grid reference.

           @kwarg prec: Optional number of digits (C{int}), 4:km, 10:m.
           @kwarg fmt: Optional enclosing backets format (C{str}).
           @kwarg sep: Optional separator between name:values (C{str}).

           @return: This Mgrs as "[Z:00B, G:EN, E:meter, N:meter]" (C{str}).
        '''
        t = self.toStr(prec=prec, sep=None)
        return _xzipairs('ZGEN', t, sep=sep, fmt=fmt)
예제 #5
0
    def toRepr(self, prec=None, fmt=_SQUARE_, sep=_COMMA_SPACE_, **unused):  # PYCHOK expected
        '''Return a string representation of this NED vector as
           length, bearing and elevation.

           @kwarg prec: Optional number of decimals, unstripped (C{int}).
           @kwarg fmt: Optional enclosing backets format (C{str}).
           @kwarg sep: Optional separator between NEDs (C{str}).

           @return: This Ned as "[L:f, B:degrees360, E:degrees90]" (C{str}).
        '''
        from pygeodesy.dms import F_D, toDMS
        t = (fstr(self.length, prec=3 if prec is None else prec),
             toDMS(self.bearing,   form=F_D, prec=prec, ddd=0),
             toDMS(self.elevation, form=F_D, prec=prec, ddd=0))
        return _xzipairs('LBE', t, sep=sep, fmt=fmt)
예제 #6
0
    def toRepr(self,
               prec=10,
               fmt=_SQUARE_,
               sep=_COMMA_SPACE_):  # PYCHOK expected
        '''Return a string representation of this OSGR coordinate.

           @kwarg prec: Optional number of digits (C{int}).
           @kwarg fmt: Optional enclosing backets format (C{str}).
           @kwarg sep: Optional separator to join (C{str}).

           @return: This OSGR (C{str}) "[G:00B, E:meter, N:meter]" or
                    "[OSGR:meter,meter]" if B{C{prec}} is non-positive.
        '''
        t = self.toStr(prec=prec, sep=None)
        return _xzipairs('GEN', t, sep=sep, fmt=fmt) if prec > 0 else \
               (fmt % (_COLON_.join((Osgr.__name__.upper(), t)),))
예제 #7
0
    def toRepr(self,
               prec=3,
               fmt=_SQUARE_,
               sep=_COMMA_SPACE_,
               radius=False,
               **unused):  # PYCHOK expected
        '''Return a string representation of this WM coordinate.

           @kwarg prec: Optional number of decimals, unstripped (C{int}).
           @kwarg fmt: Optional, enclosing backets format (C{str}).
           @kwarg sep: Optional separator between name:value pairs (C{str}).
           @kwarg radius: Optionally, include radius (C{bool} or C{scalar}).

           @return: This WM as "[x:meter, y:meter]" (C{str}) plus
                    ", radius:meter]" if B{C{radius}} is C{True} or
                    C{scalar}.

           @raise WebMercatorError: Invalid B{C{radius}}.
        '''
        t = self.toStr(prec=prec, sep=None, radius=radius)
        return _xzipairs((_x_, _y_, _radius_), t, sep=sep, fmt=fmt)
예제 #8
0
    def toRepr(self,
               prec=0,
               fmt=_SQUARE_,
               sep=_COMMA_SPACE_,
               m=_m_,
               C=False,
               **unused):  # PYCHOK expected
        '''Return a string representation of this L{Lcc} position.

           @kwarg prec: Optional number of decimals, unstripped (C{int}).
           @kwarg fmt: Optional, enclosing backets format (C{str}).
           @kwarg sep: Optional separator between name:values (C{str}).
           @kwarg m: Optional unit of the height, default meter (C{str}).
           @kwarg C: Optionally, include name of conic and datum (C{bool}).

           @return: This Lcc as "[E:meter, N:meter, H:m, C:Conic.Datum]"
                   (C{str}).
        '''
        t = self.toStr(prec=prec, sep=None, m=m)
        k = 'ENH'[:len(t)]
        if C:
            k += _C_
            t += [self.conic.name2]
        return _xzipairs(k, t, sep=sep, fmt=fmt)