def getMinHeight(self, element, app): tags = element.tags if "min_height" in tags: z0 = parseNumber(tags["min_height"], 0.) elif "building:min_level" in tags: numLevels = parseNumber(tags["building:min_level"]) z0 = 0. if numLevels is None else numLevels * app.levelHeight else: z0 = 0. return z0
def getHeight(self, app): tags = self.element.tags h = parseNumber(tags["roof:height"]) if "roof:height" in tags else None if h is None: # get the number of levels if "roof:levels" in tags: h = parseNumber(tags["roof:levels"]) h = self.defaultHeight if h is None else h * app.levelHeight self.h = h return h
def getMinHeight(self, element, op): tags = element.tags if "min_height" in tags: z0 = parseNumber(tags["min_height"], 0.0) elif "building:min_level" in tags: numLevels = parseNumber(tags["building:min_level"]) z0 = 0.0 if numLevels is None else numLevels * op.levelHeight else: z0 = 0.0 return z0
def getHeight(self, element, op): tags = element.tags if "height" in tags: h = parseNumber(tags["height"], op.defaultBuildingHeight) if "roof:height" in tags: h -= parseNumber(tags["roof:height"], 0.0) elif "building:levels" in tags: numLevels = parseNumber(tags["building:levels"]) h = op.defaultBuildingHeight if numLevels is None else numLevels * op.levelHeight else: h = op.defaultBuildingHeight return h
def getRoofHeight(self, app): tags = self.element.tags h = parseNumber(tags["roof:height"]) if "roof:height" in tags else None if h is None: if not self.angleToHeight is None and "roof:angle" in tags: angle = parseNumber(tags["roof:angle"]) if not angle is None: self.processDirection() h = self.angleToHeight * self.polygonWidth * math.tan( math.radians(angle)) if h is None: # get the number of levels if "roof:levels" in tags: h = parseNumber(tags["roof:levels"]) h = self.defaultHeight if h is None else h * app.levelHeight return h
def getRoofMinHeight(self, element, app): # getting the number of levels h = element.tags.get("building:levels") if not h is None: h = parseNumber(h) if h is None: h = app.defaultNumLevels h *= app.levelHeight return h
def processDirection(self): polygon = self.polygon tags = self.element.tags # <d> stands for direction d = tags.get("roof:direction") if d is None: d = tags.get("roof:slope:direction") # getting a direction vector with the unit length if d is None: if self.hasRidge and tags.get("roof:orientation") == "across": # The roof ridge is across the longest side of the building outline, # i.e. the profile direction is along the longest side d = max(self.polygon.edges).normalized() else: d = self.getDefaultDirection() elif d in Roof.directions: d = Roof.directions[d] else: # trying to get a direction angle in degrees d = parseNumber(d) if d is None: d = self.getDefaultDirection() else: d = math.radians(d) d = Vector((math.sin(d), math.cos(d), 0.)) # the direction vector is used by <profile.RoofProfile> self.direction = d # For each vertex from <polygon.verts> calculate projection of the vertex # on the vector <d> that defines the roof direction projections = self.projections projections.extend(d[0] * v[0] + d[1] * v[1] for v in polygon.verts) minProjIndex = min(range(polygon.n), key=lambda i: projections[i]) self.minProjIndex = minProjIndex maxProjIndex = max(range(polygon.n), key=lambda i: projections[i]) self.maxProjIndex = maxProjIndex # <polygon> width along the vector <d> self.polygonWidth = projections[maxProjIndex] - projections[ minProjIndex]
def getHeight(self, element): return parseNumber( element.tags["height"]) if "height" in element.tags else None