示例#1
0
    def _snippet(self):
        featureTypes = self.context.getFeatureType() or ['unknown']
        s = ', '.join(x.capitalize() for x in featureTypes)

        trange = self.context.temporalRange()
        if trange:
            start = to_ad(int(trange[0]))
            end = to_ad(int(trange[1]))
            s += '; {} - {}'.format(start, end)

        return s
示例#2
0
def fmt_time_range(start, stop):
    start = int(start.replace(",", ""))
    stop = int(stop.replace(",", ""))
    a = to_ad(start)
    b = to_ad(stop)
    start = abs(start)
    stop = abs(stop)
    if "BC" in a and "BC" in b:
        return u"%s\u2013%s BC" % (max(start, stop), min(start, stop))
    elif "AD" in a and "AD" in b:
        return u"AD %s\u2013%s" % (min(start, stop), max(start, stop))
    else:
        return u"%s \u2013 %s" % (a, b)
示例#3
0
 def timeSpanAD(self):
     span = self.timeSpan
     if span:
         return dict([(k, to_ad(v)) for k, v in span.items()])
     else:
         return None