-
Notifications
You must be signed in to change notification settings - Fork 4
Structure of the Code
The general structure of the project is displayed in the following dependency diagram:
The following diagram gives a more detailed overview on the dependencies in the project. Only the files that are important to the conversion are contained, here. The files that support the experimental solar irradiation functionality are not included in the diagram.
CityGML2OBJs.py
polygon3dmodule.py
markup3dmodule.py
CityGMLTranslation.py
generateMTL.py
plotcolorbar.py
This is the main file of the functionality. It contains the main function and the following functionalities:
-
Evaluation of the Command Line Arguments / Environment Parameters (input- / output-directory, optional parameters)
-
Iterarting over and reading all the files in the input directory. The following file extensions are supported:
*.gml
,*.GML
,*.xml
,*.XML
-
Definition of the Namespaces. There are different definitions for
CityGML 1.0
andCityGML 2.0
. The version of the CityGML file is identified by the analysis of the root tag. -
Iteration within the CityGML file. Detailed information about the iteration can be found here.
-
Writing of the OBJ file
This file contains the following functions that are necessary for the polygon validity check:
-
isPolyValid(...)
This function checks for the following properties:- The last point equals first point
- The total number of points is larger then, or equal to 3
- The polygon is planar. (The auxiliary function
isPolyPlanar
is used here ) - No repetition of points
-
getAreaOfGML(...)
-
isPolySimple(...)
-
intersection(...)
The following functions are used in order to analyze lists of points:
-
GMLstring2points(...)
a function that converts the points that arre contained in a string to a list of points (float numbers) -
smallestPoint(...)
a function that is used in order to find the smallest point in a list of points (not the index, but the point itself) -
highestPoint(...)
a function that is used in order to find the highest point in a list of points (not the index, but the point itself) -
centroid(...)
a function that is used in order to find the centroid of a collection of points, given in form of a list -
point_inside(...)
a function that returns a point inside a poygon that is described by a list of points (assusmes validity). this function makes use of the shapely library. (This function is currently not used in the default settings, as it has lead to problems with polygons that contain holes) -
plane(...)
a function that returns the plane equation of three given points -
get_height(...)
a function to calculate the missing coordinate from the plane equation and the partial coordinates -
get_y(...)
a function to calculate the missing coordinate from the plane equation and the partial coordinates -
compare_normals(...)
a function that estimates, if two normals are equal with respect to certain, given tolerance (set to 10e-2) -
reverse_vertices(...)
a function that reverses a set of goven vertices -
has_duplicates(...)
a function that checks, if there are duplicates in a given sequence -
triangulation(...)
this function is used in order to perform the triangulation. More infromation can be found here ---> insert link to the wiki page
Some auxiliary mathematical functions are found here, too:
-
collinear(...)
a check for collinearity -
det(...)
determinant of a 3 x 3 matrix -
unit_normal
calculation of the unit noremal vector of a plane defined by three points -
dot(...)
dot product -
cross(...)
calculation of the cross product of two 3 x 3 matrices -
get3DArea(...)
function which reads the list of coordinates and returns its area -
get2DArea(...)
reads the list of coordinates and returns its projected area (disregards z coords) -
getNormal(..)
get the normal of the first three points of a polygon (Assumes planarity) -
getAngles(...)
get the azimuth and altitude from the normal vector`
This file contains the following functionalities:
-
polygonFinder(...)
This function returns all the polygons that are oart of an object. The idetification is done by analyzing the namespace. -
polydecomposer(...)
The outer and inner ring of a polygon are identified and saved as such. -
GMLpoints(...)
This function is used in order to extract the opints from a given liear ring and returns them as a list of points. In this function, the conversion from text (XML) to float takes place.
this file contains a functionality that can be used to perform a horizontal translation of a whole CityGML dataset. This file contains the following functionalities:
-
getEnvelopes(...)
This function is used to extract the coordinates of the envelopes from a given CityGML dataset. -
getTranslationParameters(...)
This function is used in order to calculate translation parameters from the envelopes. -
appyTranslationToCityGML(...)
This function is used in order to apply the previously calculated translation parameters to the CityGML file. -
splitAndApplyTrafo(...)
This is an auxiliary function that is called inside ofappyTranslationToCityGML(...)
-
performStableAddition(...)
An experimental function that can be used in order to calculate the sum ot two given numbers more accurately: ATTENTION! This is an experimental function that might include mistakes and incompleteness. Only use with care and double checking!