summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7af463f)
raw | patch | inline | side by side (parent: 7af463f)
author | JazzyNico <nicoduf@yahoo.fr> | |
Thu, 3 Dec 2009 15:13:26 +0000 (16:13 +0100) | ||
committer | JazzyNico <nicoduf@yahoo.fr> | |
Thu, 3 Dec 2009 15:13:26 +0000 (16:13 +0100) |
Measure path extension now uses inkex.py conversion factors.
share/extensions/inkex.py | patch | blob | history | |
share/extensions/measure.py | patch | blob | history |
index b7e3e0e63f5bdb34f378d1c58a6e05735cba7424..d36820692f19de89526d859a615d156d01840b8a 100755 (executable)
}
#a dictionary of unit to user unit conversion factors
-uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'pc':15.0}
+uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
+ 'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080}
def unittouu(string):
'''Returns userunits given a string representation of units in another system'''
unit = re.compile('(%s)$' % '|'.join(uuconv.keys()))
index 8eacd40c602f245105e085502c9858437a6f099b..68586530be826887cfe7b656130ba10375838a6f 100644 (file)
p = cubicsuperpath.parsePath(node.get('d'))
num = 1
slengths, stotal = csplength(p)
- ''' Wio: Umrechnung in unit '''
- if self.options.unit=="mm":
- factor=25.4/90.0 # px->mm
- elif self.options.unit=="pt":
- factor=0.80 # px->pt
- elif self.options.unit=="cm":
- factor=25.4/900.0 # px->cm
- elif self.options.unit=="m":
- factor=25.4/90000.0 # px->m
- elif self.options.unit=="km":
- factor=25.4/90000000.0 # px->km
- elif self.options.unit=="in":
- factor=1.0/90.0 # px->in
- elif self.options.unit=="ft":
- factor=1.0/90.0/12.0 # px->ft
- elif self.options.unit=="yd":
- factor=1.0/90.0/36.0 # px->yd
- else :
- ''' Default unit is px'''
- factor=1
- self.options.unit="px"
-
+ factor = 1.0/inkex.unittouu('1'+self.options.unit)
# Format the length as string
lenstr = locale.format("%(len)25."+str(prec)+"f",{'len':round(stotal*factor*self.options.scale,prec)}).strip()
self.addTextOnPath(self.group,0, 0,lenstr+' '+self.options.unit, id, self.options.offset)