def bbox(self): return bbox.bbox_pt( min([ node.coords_pt[0] for element in self.elements for node in element.nodes ]), min([ node.coords_pt[1] for element in self.elements for node in element.nodes ]), max([ node.coords_pt[0] for element in self.elements for node in element.nodes ]), max([ node.coords_pt[1] for element in self.elements for node in element.nodes ]))
def createbbox(self): return bboxmodule.bbox_pt(*_arcbboxdata(self.x_pt, self.y_pt, self.r_pt, self.angle2, self.angle1))
def createbbox(self): return bboxmodule.bbox_pt(self.x_pt, self.y_pt, self.x_pt, self.y_pt)
def bbox(self): return bbox.bbox_pt(min([node.coords_pt[0] for element in self.elements for node in element.nodes]), min([node.coords_pt[1] for element in self.elements for node in element.nodes]), max([node.coords_pt[0] for element in self.elements for node in element.nodes]), max([node.coords_pt[1] for element in self.elements for node in element.nodes]))
def _readbbox(file): """returns bounding box of EPS file filename""" file = linefilereader(file) # check the %! header comment if not file.readline().startswith("%!"): raise IOError("file doesn't start with a '%!' header comment") bboxatend = 0 # parse the header (use the first BoundingBox) while 1: line = file.readline() if not line: break if line.startswith("%%BoundingBox:") and not bboxatend: values = line.split(":", 1)[1].split() if values == ["(atend)"]: bboxatend = 1 else: if len(values) != 4: raise IOError("invalid number of bounding box values") return bbox.bbox_pt(*map(int, values)) elif (line.rstrip() == "%%EndComments" or (len(line) >= 2 and line[0] != "%" and line[1] not in string.whitespace)): # implicit end of comments section break if not bboxatend: raise IOError("no bounding box information found") # parse the body nesting = 0 # allow for nested documents while 1: line = file.readline() if line.startswith("%%BeginData:"): values = line.split(":", 1)[1].split() if len(values) > 3: raise IOError("invalid number of arguments") if len(values) == 3: if values[2] == "Lines": for i in xrange(int(values[0])): file.readline() elif values[2] != "Bytes": raise IOError("invalid bytesorlines-value") else: file.read(int(values[0])) else: file.read(int(values[0])) line = file.readline() # ignore tailing whitespace/newline for binary data if (len(values) < 3 or values[2] != "Lines") and not len(line.strip()): line = file.readline() if line.rstrip() != "%%EndData": raise IOError("missing EndData") elif line.startswith("%%BeginBinary:"): file.read(int(line.split(":", 1)[1])) line = file.readline() # ignore tailing whitespace/newline if not len(line.strip()): line = file.readline() if line.rstrip() != "%%EndBinary": raise IOError("missing EndBinary") elif line.startswith("%%BeginDocument:"): nesting += 1 elif line.rstrip() == "%%EndDocument": if nesting < 1: raise IOError("unmatched EndDocument") nesting -= 1 elif not nesting and line.rstrip() == "%%Trailer": break usebbox = None # parse the trailer (use the last BoundingBox) line = True while line: line = file.readline(EOFmsg=None) if line.startswith("%%BoundingBox:"): values = line.split(":", 1)[1].split() if len(values) != 4: raise IOError("invalid number of bounding box values") usebbox = bbox.bbox_pt(*map(int, values)) if not usebbox: raise IOError("missing bounding box information in document trailer") return usebbox
def bbox(self): return bbox.bbox_pt(min([x[0] for x in self.corners]), min([x[1] for x in self.corners]), max([x[0] for x in self.corners]), max([x[1] for x in self.corners]))
def bbox(self): return bbox.bbox_pt(self.xpos_pt, self.ypos_pt, self.xpos_pt + self.width_pt, self.ypos_pt + self.height_pt)
def bbox(self): return bbox.bbox_pt(self.x_pt, self.y_pt - self.depth_pt, self.x_pt + self.width_pt, self.y_pt + self.height_pt)
def bbox(self): return bbox.bbox_pt(self.xpos_pt, self.ypos_pt, self.xpos_pt+self.width_pt, self.ypos_pt+self.height_pt)
def bbox(self): llx = min([x[0] for x in self.positions_pt]) lly = min([x[1] for x in self.positions_pt]) urx = max([x[0] for x in self.positions_pt]) + self.size_pt ury = max([x[1] for x in self.positions_pt]) + self.size_pt return bbox.bbox_pt(llx, lly, urx, ury)
def bbox(self): return bbox.bbox_pt(self.llx_pt, self.lly_pt, self.urx_pt, self.ury_pt)