Add reference length to allow checking the scaling

This commit is contained in:
Florian Festi 2016-07-31 18:28:57 +02:00
parent 419cccc7dd
commit ea0b088356
1 changed files with 13 additions and 0 deletions

View File

@ -203,6 +203,9 @@ class Boxes:
self.argparser.add_argument( self.argparser.add_argument(
"--debug", action="store", type=bool, default=False, "--debug", action="store", type=bool, default=False,
help="print surrounding boxes for some structures") help="print surrounding boxes for some structures")
self.argparser.add_argument(
"--reference", action="store", type=float, default=100,
help="print reference rectangle with given length")
self.argparser.add_argument( self.argparser.add_argument(
"--burn", action="store", type=float, default=0.05, "--burn", action="store", type=float, default=0.05,
help="burn correction in mm") help="burn correction in mm")
@ -220,6 +223,16 @@ class Boxes:
self.surface, self.ctx = self.formats.getSurface(self.format, self.output) self.surface, self.ctx = self.formats.getSurface(self.format, self.output)
self.ctx.set_line_width(2*self.burn) self.ctx.set_line_width(2*self.burn)
self._buildObjects() self._buildObjects()
if self.reference:
self.move(10, 10, "up", before=True)
self.ctx.rectangle(0, 0, self.reference, 10)
if self.reference < 40:
self.text("%.fmm" % self.reference, self.reference+5, 5,
align="middle left")
else:
self.text("%.fmm" % self.reference, self.reference/2.0, 5,
align="middle center")
self.move(10, 10, "up")
def buildArgParser(self, *l): def buildArgParser(self, *l):
""" """