Add the building/city_objects hierarchy to the city

This commit is contained in:
Guille Gutierrez 2020-06-16 16:06:33 -04:00
parent 0722c5466e
commit 5bbfa23c48
17 changed files with 284 additions and 82 deletions

View File

@ -10,8 +10,8 @@ class BixiFeature(CityObject):
"""
BixiFeature(CityObject) class
"""
def __init__(self, lod, feature_type, length):
super().__init__(lod)
def __init__(self, lod, surfaces, feature_type, length):
super().__init__(lod, surfaces)
self._feature_type = feature_type
self._length = length

View File

@ -12,7 +12,6 @@ from matplotlib import pylab
from shapely import ops
from shapely.geometry import MultiPolygon
from city_model_structure.polyhedron import Polyhedron
from city_model_structure.surface import Surface
from city_model_structure.thermal_boundary import ThermalBoundary
from city_model_structure.thermal_zone import ThermalZone
@ -26,9 +25,8 @@ class Building(CityObject):
"""
def __init__(self, name, lod, surfaces, terrains, year_of_construction, function, lower_corner, attic_heated=0,
basement_heated=0):
super().__init__(lod)
super().__init__(lod, surfaces)
self._name = name
self._surfaces = surfaces
self._basement_heated = basement_heated
self._attic_heated = attic_heated
self._terrains = terrains
@ -125,25 +123,6 @@ class Building(CityObject):
"""
return self._name
@property
def surfaces(self) -> List[Surface]:
"""
City object surfaces
:return: [Surface]
"""
return self._surfaces
def surface(self, name) -> Union[Surface, None]:
"""
Get the city object surface with a given name
:param name: str
:return: None or Surface
"""
for s in self.surfaces:
if s.name == name:
return s
return None
@property
def thermal_zones(self) -> List[ThermalZone]:
"""
@ -152,16 +131,6 @@ class Building(CityObject):
"""
return self._thermal_zones
@property
def volume(self):
"""
City object volume in cubic meters
:return: float
"""
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
return self._polyhedron.volume
@property
def heated_volume(self):
"""

View File

@ -3,15 +3,19 @@ CityObject module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from typing import List, Union
from city_model_structure.surface import Surface
from helpers.geometry_helper import GeometryHelper
from city_model_structure.polyhedron import Polyhedron
class CityObject:
"""
class CityObject
"""
def __init__(self, lod):
def __init__(self, lod, surfaces):
self._lod = lod
self._surfaces = surfaces
self._polyhedron = None
self._geometry = GeometryHelper()
@ -22,3 +26,42 @@ class CityObject:
:return: int
"""
return self._lod
@property
def volume(self):
"""
City object volume in cubic meters
:return: float
"""
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
return self._polyhedron.volume
@property
def surfaces(self) -> List[Surface]:
"""
City object surfaces
:return: [Surface]
"""
return self._surfaces
def surface(self, name) -> Union[Surface, None]:
"""
Get the city object surface with a given name
:param name: str
:return: None or Surface
"""
for s in self.surfaces:
if s.name == name:
return s
return None
@property
def location(self):
"""
City object location
:return: [x,y,z]
"""
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
return self._polyhedron.centroid

View File

@ -10,8 +10,8 @@ class CompostingPlant(CityObject):
"""
CompostingPlant(CityObject) class
"""
def __init__(self, lod, waste_type, capacity):
super().__init__(lod)
def __init__(self, lod, surfaces, waste_type, capacity):
super().__init__(lod, surfaces)
self._waste_type = waste_type
self._capacity = capacity

View File

@ -97,6 +97,14 @@ class Polyhedron:
z_max = max(bounds[:, 2])
return z_max
@property
def centroid(self):
"""
Polyhedron centroid
:return: [x,y,z]
"""
return self._polyhedron_mesh.centroid
def export(self, full_path):
"""
Export the polyhedron to stl given file

View File

@ -10,8 +10,8 @@ class Tree(CityObject):
"""
Tree(CityObject) class
"""
def __init__(self, lod, height, canopy):
super().__init__(lod)
def __init__(self, lod, surfaces, height, canopy):
super().__init__(lod, surfaces)
self._height = height
self._canopy = canopy

Binary file not shown.

Binary file not shown.

View File

@ -96,8 +96,11 @@
<div class="content" role="main">
<h1>All modules for which code is available</h1>
<ul><li><a href="city_model_structure/building.html">city_model_structure.building</a></li>
<ul><li><a href="city_model_structure/bixi_feature.html">city_model_structure.bixi_feature</a></li>
<li><a href="city_model_structure/building.html">city_model_structure.building</a></li>
<li><a href="city_model_structure/city.html">city_model_structure.city</a></li>
<li><a href="city_model_structure/city_object.html">city_model_structure.city_object</a></li>
<li><a href="city_model_structure/composting_plant.html">city_model_structure.composting_plant</a></li>
<li><a href="city_model_structure/internal_gains.html">city_model_structure.internal_gains</a></li>
<li><a href="city_model_structure/layer.html">city_model_structure.layer</a></li>
<li><a href="city_model_structure/material.html">city_model_structure.material</a></li>
@ -106,6 +109,7 @@
<li><a href="city_model_structure/thermal_boundary.html">city_model_structure.thermal_boundary</a></li>
<li><a href="city_model_structure/thermal_opening.html">city_model_structure.thermal_opening</a></li>
<li><a href="city_model_structure/thermal_zone.html">city_model_structure.thermal_zone</a></li>
<li><a href="city_model_structure/tree.html">city_model_structure.tree</a></li>
<li><a href="city_model_structure/usage_zone.html">city_model_structure.usage_zone</a></li>
<li><a href="geometry/geometry_factory.html">geometry.geometry_factory</a></li>
<li><a href="physics/physics_factory.html">physics.physics_factory</a></li>

View File

@ -30,11 +30,25 @@ City Object
.. automodule:: city_model_structure.city_object
:members:
Bixi Feature
********************
.. automodule:: city_model_structure.bixi_feature
:members:
Building
********************
.. automodule:: city_model_structure.building
:members:
Composting Plant
********************
.. automodule:: city_model_structure.composting_plant
:members:
Tree
********************
.. automodule:: city_model_structure.tree
:members:
Internal Gains
********************

View File

@ -178,6 +178,8 @@
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.bixi_feature.BixiFeature">BixiFeature (class in city_model_structure.bixi_feature)</a>
</li>
<li><a href="index.html#city_model_structure.thermal_zone.ThermalZone.bounded">bounded() (city_model_structure.thermal_zone.ThermalZone property)</a>
</li>
<li><a href="index.html#city_model_structure.building.Building">Building (class in city_model_structure.building)</a>
@ -190,11 +192,22 @@
<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.tree.Tree.canopy">canopy() (city_model_structure.tree.Tree property)</a>
</li>
<li><a href="index.html#city_model_structure.composting_plant.CompostingPlant.capacity">capacity() (city_model_structure.composting_plant.CompostingPlant property)</a>
</li>
<li><a href="index.html#city_model_structure.city.City">City (class in city_model_structure.city)</a>
</li>
<li><a href="index.html#geometry.geometry_factory.GeometryFactory.city">city() (geometry.geometry_factory.GeometryFactory property)</a>
</li>
<li>
city_model_structure.bixi_feature
<ul>
<li><a href="index.html#module-city_model_structure.bixi_feature">module</a>
</li>
</ul></li>
<li>
city_model_structure.building
<ul>
@ -213,6 +226,13 @@
<ul>
<li><a href="index.html#module-city_model_structure.city_object">module</a>
</li>
</ul></li>
<li>
city_model_structure.composting_plant
<ul>
<li><a href="index.html#module-city_model_structure.composting_plant">module</a>
</li>
</ul></li>
<li>
@ -243,6 +263,8 @@
<li><a href="index.html#module-city_model_structure.polyhedron">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
city_model_structure.surface
@ -250,8 +272,6 @@
<li><a href="index.html#module-city_model_structure.surface">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
city_model_structure.thermal_boundary
@ -271,6 +291,13 @@
<ul>
<li><a href="index.html#module-city_model_structure.thermal_zone">module</a>
</li>
</ul></li>
<li>
city_model_structure.tree
<ul>
<li><a href="index.html#module-city_model_structure.tree">module</a>
</li>
</ul></li>
<li>
@ -283,8 +310,12 @@
<li><a href="index.html#city_model_structure.city.City.city_object">city_object() (city_model_structure.city.City method)</a>
</li>
<li><a href="index.html#city_model_structure.city.City.city_objects">city_objects() (city_model_structure.city.City property)</a>
</li>
<li><a href="index.html#city_model_structure.city_object.CityObject">CityObject (class in city_model_structure.city_object)</a>
</li>
<li><a href="index.html#city_model_structure.city.City.composting_plants">composting_plants() (city_model_structure.city.City property)</a>
</li>
<li><a href="index.html#city_model_structure.composting_plant.CompostingPlant">CompostingPlant (class in city_model_structure.composting_plant)</a>
</li>
<li><a href="index.html#city_model_structure.material.Material.conductivity">conductivity() (city_model_structure.material.Material property)</a>
@ -340,10 +371,12 @@
<li><a href="index.html#usage.usage_factory.UsageFactory.factory">(usage.usage_factory.UsageFactory method)</a>
</li>
</ul></li>
<li><a href="index.html#city_model_structure.thermal_zone.ThermalZone.floor_area">floor_area() (city_model_structure.thermal_zone.ThermalZone property)</a>
<li><a href="index.html#city_model_structure.bixi_feature.BixiFeature.feature_type">feature_type() (city_model_structure.bixi_feature.BixiFeature property)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.thermal_zone.ThermalZone.floor_area">floor_area() (city_model_structure.thermal_zone.ThermalZone property)</a>
</li>
<li><a href="index.html#city_model_structure.building.Building.foot_print">foot_print() (city_model_structure.building.Building property)</a>
</li>
<li><a href="index.html#city_model_structure.thermal_opening.ThermalOpening.frame_ratio">frame_ratio() (city_model_structure.thermal_opening.ThermalOpening property)</a>
@ -389,11 +422,13 @@
</li>
<li><a href="index.html#city_model_structure.building.Building.heated_volume">heated_volume() (city_model_structure.building.Building property)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.usage_zone.UsageZone.heating_setback">heating_setback() (city_model_structure.usage_zone.UsageZone property)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.usage_zone.UsageZone.heating_setpoint">heating_setpoint() (city_model_structure.usage_zone.UsageZone property)</a>
</li>
<li><a href="index.html#city_model_structure.tree.Tree.height">height() (city_model_structure.tree.Tree property)</a>
</li>
<li><a href="index.html#city_model_structure.usage_zone.UsageZone.hours_day">hours_day() (city_model_structure.usage_zone.UsageZone property)</a>
</li>
@ -433,11 +468,13 @@
</li>
<li><a href="index.html#city_model_structure.layer.Layer">Layer (class in city_model_structure.layer)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.thermal_boundary.ThermalBoundary.layers">layers() (city_model_structure.thermal_boundary.ThermalBoundary property)</a>
</li>
<li><a href="index.html#city_model_structure.building.Building.lod">lod() (city_model_structure.building.Building property)</a>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.bixi_feature.BixiFeature.length">length() (city_model_structure.bixi_feature.BixiFeature property)</a>
</li>
<li><a href="index.html#city_model_structure.city_object.CityObject.lod">lod() (city_model_structure.city_object.CityObject property)</a>
</li>
<li><a href="index.html#city_model_structure.city.City.lower_corner">lower_corner() (city_model_structure.city.City property)</a>
</li>
@ -467,11 +504,15 @@
module
<ul>
<li><a href="index.html#module-city_model_structure.bixi_feature">city_model_structure.bixi_feature</a>
</li>
<li><a href="index.html#module-city_model_structure.building">city_model_structure.building</a>
</li>
<li><a href="index.html#module-city_model_structure.city">city_model_structure.city</a>
</li>
<li><a href="index.html#module-city_model_structure.city_object">city_model_structure.city_object</a>
</li>
<li><a href="index.html#module-city_model_structure.composting_plant">city_model_structure.composting_plant</a>
</li>
<li><a href="index.html#module-city_model_structure.internal_gains">city_model_structure.internal_gains</a>
</li>
@ -488,6 +529,8 @@
<li><a href="index.html#module-city_model_structure.thermal_opening">city_model_structure.thermal_opening</a>
</li>
<li><a href="index.html#module-city_model_structure.thermal_zone">city_model_structure.thermal_zone</a>
</li>
<li><a href="index.html#module-city_model_structure.tree">city_model_structure.tree</a>
</li>
<li><a href="index.html#module-city_model_structure.usage_zone">city_model_structure.usage_zone</a>
</li>
@ -639,6 +682,8 @@
<li><a href="index.html#city_model_structure.thermal_opening.ThermalOpening.thickness">(city_model_structure.thermal_opening.ThermalOpening property)</a>
</li>
</ul></li>
<li><a href="index.html#city_model_structure.tree.Tree">Tree (class in city_model_structure.tree)</a>
</li>
<li><a href="index.html#city_model_structure.city.City.trees">trees() (city_model_structure.city.City property)</a>
</li>
<li><a href="index.html#city_model_structure.building.Building.type">type() (city_model_structure.building.Building property)</a>
@ -704,10 +749,12 @@
<h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.thermal_boundary.ThermalBoundary.window_area">window_area() (city_model_structure.thermal_boundary.ThermalBoundary property)</a>
<li><a href="index.html#city_model_structure.composting_plant.CompostingPlant.waste_type">waste_type() (city_model_structure.composting_plant.CompostingPlant property)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#city_model_structure.thermal_boundary.ThermalBoundary.window_area">window_area() (city_model_structure.thermal_boundary.ThermalBoundary property)</a>
</li>
<li><a href="index.html#city_model_structure.thermal_boundary.ThermalBoundary.window_ratio">window_ratio() (city_model_structure.thermal_boundary.ThermalBoundary property)</a>
</li>
</ul></td>

View File

@ -143,7 +143,7 @@ Copyright © 2020 Project Author Guille Gutierrez <a class="reference external"
<dl class="py method">
<dt id="city_model_structure.city.City.city_object">
<code class="sig-name descname">city_object</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em><span class="sig-paren">)</span> &#x2192; Optional<span class="p">[</span>city_model_structure.city_object.CityObject<span class="p">]</span><a class="reference internal" href="_modules/city_model_structure/city.html#City.city_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#city_model_structure.city.City.city_object" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">city_object</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em><span class="sig-paren">)</span> &#x2192; Optional<span class="p">[</span><a class="reference internal" href="#city_model_structure.city_object.CityObject" title="city_model_structure.city_object.CityObject">city_model_structure.city_object.CityObject</a><span class="p">]</span><a class="reference internal" href="_modules/city_model_structure/city.html#City.city_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#city_model_structure.city.City.city_object" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve the city CityObject with the given name
:param name:str
:return: None or CityObject</p>
@ -210,16 +210,58 @@ Copyright © 2020 Project Author Guille Gutierrez <a class="reference external"
</div>
<div class="section" id="module-city_model_structure.city_object">
<span id="city-object"></span><h2>City Object<a class="headerlink" href="#module-city_model_structure.city_object" title="Permalink to this headline"></a></h2>
<p>CityObject module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez <a class="reference external" href="mailto:guillermo&#46;gutierrezmorote&#37;&#52;&#48;concordia&#46;ca">guillermo<span>&#46;</span>gutierrezmorote<span>&#64;</span>concordia<span>&#46;</span>ca</a></p>
<dl class="py class">
<dt id="city_model_structure.city_object.CityObject">
<em class="property">class </em><code class="sig-prename descclassname">city_model_structure.city_object.</code><code class="sig-name descname">CityObject</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">lod</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/city_model_structure/city_object.html#CityObject"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#city_model_structure.city_object.CityObject" title="Permalink to this definition"></a></dt>
<dd><p>class CityObject</p>
<dl class="py method">
<dt id="city_model_structure.city_object.CityObject.lod">
<em class="property">property </em><code class="sig-name descname">lod</code><a class="headerlink" href="#city_model_structure.city_object.CityObject.lod" title="Permalink to this definition"></a></dt>
<dd><p>City object level of detail 1, 2, 3 or 4
:return: int</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-city_model_structure.bixi_feature">
<span id="bixi-feature"></span><h2>Bixi Feature<a class="headerlink" href="#module-city_model_structure.bixi_feature" title="Permalink to this headline"></a></h2>
<p>bixi_feature module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez <a class="reference external" href="mailto:guillermo&#46;gutierrezmorote&#37;&#52;&#48;concordia&#46;ca">guillermo<span>&#46;</span>gutierrezmorote<span>&#64;</span>concordia<span>&#46;</span>ca</a></p>
<dl class="py class">
<dt id="city_model_structure.bixi_feature.BixiFeature">
<em class="property">class </em><code class="sig-prename descclassname">city_model_structure.bixi_feature.</code><code class="sig-name descname">BixiFeature</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">lod</span></em>, <em class="sig-param"><span class="n">feature_type</span></em>, <em class="sig-param"><span class="n">length</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/city_model_structure/bixi_feature.html#BixiFeature"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#city_model_structure.bixi_feature.BixiFeature" title="Permalink to this definition"></a></dt>
<dd><p>BixiFeature(CityObject) class</p>
<dl class="py method">
<dt id="city_model_structure.bixi_feature.BixiFeature.feature_type">
<em class="property">property </em><code class="sig-name descname">feature_type</code><a class="headerlink" href="#city_model_structure.bixi_feature.BixiFeature.feature_type" title="Permalink to this definition"></a></dt>
<dd><p>Get type of bixi feature
:return: feature_type</p>
</dd></dl>
<dl class="py method">
<dt id="city_model_structure.bixi_feature.BixiFeature.length">
<em class="property">property </em><code class="sig-name descname">length</code><a class="headerlink" href="#city_model_structure.bixi_feature.BixiFeature.length" title="Permalink to this definition"></a></dt>
<dd><p>Get length of bixi feature in meters
:return: length</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-city_model_structure.building">
<span id="building"></span><h2>Building<a class="headerlink" href="#module-city_model_structure.building" title="Permalink to this headline"></a></h2>
<p>CityObject module
<p>Building module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez <a class="reference external" href="mailto:guillermo&#46;gutierrezmorote&#37;&#52;&#48;concordia&#46;ca">guillermo<span>&#46;</span>gutierrezmorote<span>&#64;</span>concordia<span>&#46;</span>ca</a></p>
<dl class="py class">
<dt id="city_model_structure.building.Building">
<em class="property">class </em><code class="sig-prename descclassname">city_model_structure.building.</code><code class="sig-name descname">Building</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">lod</span></em>, <em class="sig-param"><span class="n">surfaces</span></em>, <em class="sig-param"><span class="n">terrains</span></em>, <em class="sig-param"><span class="n">year_of_construction</span></em>, <em class="sig-param"><span class="n">function</span></em>, <em class="sig-param"><span class="n">lower_corner</span></em>, <em class="sig-param"><span class="n">attic_heated</span><span class="o">=</span><span class="default_value">0</span></em>, <em class="sig-param"><span class="n">basement_heated</span><span class="o">=</span><span class="default_value">0</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/city_model_structure/building.html#Building"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#city_model_structure.building.Building" title="Permalink to this definition"></a></dt>
<dd><p>CityObject class</p>
<dd><p>Building(CityObject) class</p>
<dl class="py method">
<dt id="city_model_structure.building.Building.attic_heated">
<em class="property">property </em><code class="sig-name descname">attic_heated</code><a class="headerlink" href="#city_model_structure.building.Building.attic_heated" title="Permalink to this definition"></a></dt>
@ -262,13 +304,6 @@ Copyright © 2020 Project Author Guille Gutierrez <a class="reference external"
:return: float</p>
</dd></dl>
<dl class="py method">
<dt id="city_model_structure.building.Building.lod">
<em class="property">property </em><code class="sig-name descname">lod</code><a class="headerlink" href="#city_model_structure.building.Building.lod" title="Permalink to this definition"></a></dt>
<dd><p>City object level of detail 1, 2, 3 or 4
:return: int</p>
</dd></dl>
<dl class="py method">
<dt id="city_model_structure.building.Building.max_height">
<em class="property">property </em><code class="sig-name descname">max_height</code><a class="headerlink" href="#city_model_structure.building.Building.max_height" title="Permalink to this definition"></a></dt>
@ -357,6 +392,58 @@ Copyright © 2020 Project Author Guille Gutierrez <a class="reference external"
</dd></dl>
</div>
<div class="section" id="module-city_model_structure.composting_plant">
<span id="composting-plant"></span><h2>Composting Plant<a class="headerlink" href="#module-city_model_structure.composting_plant" title="Permalink to this headline"></a></h2>
<p>Composting plant module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez <a class="reference external" href="mailto:guillermo&#46;gutierrezmorote&#37;&#52;&#48;concordia&#46;ca">guillermo<span>&#46;</span>gutierrezmorote<span>&#64;</span>concordia<span>&#46;</span>ca</a></p>
<dl class="py class">
<dt id="city_model_structure.composting_plant.CompostingPlant">
<em class="property">class </em><code class="sig-prename descclassname">city_model_structure.composting_plant.</code><code class="sig-name descname">CompostingPlant</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">lod</span></em>, <em class="sig-param"><span class="n">waste_type</span></em>, <em class="sig-param"><span class="n">capacity</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/city_model_structure/composting_plant.html#CompostingPlant"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#city_model_structure.composting_plant.CompostingPlant" title="Permalink to this definition"></a></dt>
<dd><p>CompostingPlant(CityObject) class</p>
<dl class="py method">
<dt id="city_model_structure.composting_plant.CompostingPlant.capacity">
<em class="property">property </em><code class="sig-name descname">capacity</code><a class="headerlink" href="#city_model_structure.composting_plant.CompostingPlant.capacity" title="Permalink to this definition"></a></dt>
<dd><p>Get capacity of composting plant in kg
:return: capacity</p>
</dd></dl>
<dl class="py method">
<dt id="city_model_structure.composting_plant.CompostingPlant.waste_type">
<em class="property">property </em><code class="sig-name descname">waste_type</code><a class="headerlink" href="#city_model_structure.composting_plant.CompostingPlant.waste_type" title="Permalink to this definition"></a></dt>
<dd><p>Get waste_type treated in composting plant
:return: waste_type</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-city_model_structure.tree">
<span id="tree"></span><h2>Tree<a class="headerlink" href="#module-city_model_structure.tree" title="Permalink to this headline"></a></h2>
<p>Tree module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez <a class="reference external" href="mailto:guillermo&#46;gutierrezmorote&#37;&#52;&#48;concordia&#46;ca">guillermo<span>&#46;</span>gutierrezmorote<span>&#64;</span>concordia<span>&#46;</span>ca</a></p>
<dl class="py class">
<dt id="city_model_structure.tree.Tree">
<em class="property">class </em><code class="sig-prename descclassname">city_model_structure.tree.</code><code class="sig-name descname">Tree</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">lod</span></em>, <em class="sig-param"><span class="n">height</span></em>, <em class="sig-param"><span class="n">canopy</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/city_model_structure/tree.html#Tree"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#city_model_structure.tree.Tree" title="Permalink to this definition"></a></dt>
<dd><p>Tree(CityObject) class</p>
<dl class="py method">
<dt id="city_model_structure.tree.Tree.canopy">
<em class="property">property </em><code class="sig-name descname">canopy</code><a class="headerlink" href="#city_model_structure.tree.Tree.canopy" title="Permalink to this definition"></a></dt>
<dd><p>Get canopy of tree
:return: canopy</p>
</dd></dl>
<dl class="py method">
<dt id="city_model_structure.tree.Tree.height">
<em class="property">property </em><code class="sig-name descname">height</code><a class="headerlink" href="#city_model_structure.tree.Tree.height" title="Permalink to this definition"></a></dt>
<dd><p>Get height of tree in meters
:return: height</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-city_model_structure.internal_gains">
<span id="internal-gains"></span><h2>Internal Gains<a class="headerlink" href="#module-city_model_structure.internal_gains" title="Permalink to this headline"></a></h2>

Binary file not shown.

View File

@ -118,6 +118,11 @@
<td>
<code class="xref">city_model_structure</code></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-city_model_structure.bixi_feature"><code class="xref">city_model_structure.bixi_feature</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
@ -133,6 +138,11 @@
<td>&#160;&#160;&#160;
<a href="index.html#module-city_model_structure.city_object"><code class="xref">city_model_structure.city_object</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-city_model_structure.composting_plant"><code class="xref">city_model_structure.composting_plant</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
@ -173,6 +183,11 @@
<td>&#160;&#160;&#160;
<a href="index.html#module-city_model_structure.thermal_zone"><code class="xref">city_model_structure.thermal_zone</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-city_model_structure.tree"><code class="xref">city_model_structure.tree</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;

File diff suppressed because one or more lines are too long

View File

@ -30,11 +30,25 @@ City Object
.. automodule:: city_model_structure.city_object
:members:
Bixi Feature
********************
.. automodule:: city_model_structure.bixi_feature
:members:
Building
********************
.. automodule:: city_model_structure.building
:members:
Composting Plant
********************
.. automodule:: city_model_structure.composting_plant
:members:
Tree
********************
.. automodule:: city_model_structure.tree
:members:
Internal Gains
********************

View File

@ -44,33 +44,34 @@ class TestGeometryFactory(TestCase):
self.assertIsNotNone(city.name, 'name is none')
self.assertIsNotNone(city.country_code, 'country code is none')
def test_citygml_city_objects(self):
def test_citygml_buildings(self):
"""
Test city objects in the city
:return: None
"""
city = self._get_citygml()
for city_object in city.buildings:
self.assertIsNotNone(city_object.name, 'city_object name is none')
self.assertIsNotNone(city_object.lod, 'city_object lod is none')
self.assertIsNotNone(city_object.year_of_construction, 'city_object year_of_construction is none')
self.assertIsNotNone(city_object.function, 'city_object function is none')
self.assertIsNotNone(city_object.volume, 'city_object volume is none')
self.assertIsNotNone(city_object.surfaces, 'city_object surfaces is none')
self.assertIsNotNone(city_object.surfaces[0].name, 'surface not found')
self.assertIsNotNone(city_object.basement_heated, 'city_object basement_heated is none')
self.assertIsNotNone(city_object.attic_heated, 'city_object attic_heated is none')
self.assertIsNotNone(city_object.terrains, 'city_object terrains is none')
self.assertIsNotNone(city_object.foot_print, 'city_object foot_print is none')
self.assertIsNotNone(city_object.usage_zones, 'city_object usage_zones is none')
self.assertIsNone(city_object.average_storey_height, 'city_object average_storey_height is not none')
self.assertIsNone(city_object.storeys_above_ground, 'city_object storeys_above_ground is not none')
self.assertIsNotNone(city_object.heated_volume, 'city_object heated_volume is none')
self.assertIsNotNone(city_object.thermal_zones, 'city_object thermal_zones is none')
self.assertIsNotNone(city_object.type, 'city_object type is none')
self.assertIsNotNone(city_object.max_height, 'city_object max_height is none')
city_object.stl_export(self._example_path)
os.remove(Path(self._example_path, city_object.name + '.stl').resolve())
for building in city.buildings:
self.assertIsNotNone(building.name, 'building name is none')
self.assertIsNotNone(building.lod, 'building lod is none')
self.assertIsNotNone(building.location, 'building location is none')
self.assertIsNotNone(building.year_of_construction, 'building year_of_construction is none')
self.assertIsNotNone(building.function, 'building function is none')
self.assertIsNotNone(building.volume, 'building volume is none')
self.assertIsNotNone(building.surfaces, 'building surfaces is none')
self.assertIsNotNone(building.surfaces[0].name, 'surface not found')
self.assertIsNotNone(building.basement_heated, 'building basement_heated is none')
self.assertIsNotNone(building.attic_heated, 'building attic_heated is none')
self.assertIsNotNone(building.terrains, 'building terrains is none')
self.assertIsNotNone(building.foot_print, 'building foot_print is none')
self.assertIsNotNone(building.usage_zones, 'building usage_zones is none')
self.assertIsNone(building.average_storey_height, 'building average_storey_height is not none')
self.assertIsNone(building.storeys_above_ground, 'building storeys_above_ground is not none')
self.assertIsNotNone(building.heated_volume, 'building heated_volume is none')
self.assertIsNotNone(building.thermal_zones, 'building thermal_zones is none')
self.assertIsNotNone(building.type, 'building type is none')
self.assertIsNotNone(building.max_height, 'building max_height is none')
building.stl_export(self._example_path)
os.remove(Path(self._example_path, building.name + '.stl').resolve())
def test_citygml_surfaces(self):
"""