Skip to content

Latest commit

 

History

History
124 lines (85 loc) · 4 KB

README.md

File metadata and controls

124 lines (85 loc) · 4 KB

topocity Status Badge - Travis CI

Towards topological representation of smart cities environment: a Putback BX approach towards Bigraphs from CityGML. Powered by BiGUL.

Installation

Currently it is recommended to execute topocity via Stack platform, since it is cross-platform, virtualizable, and takes care of all dependencies automatically.

⚠️ Note: Git is required by Stack to pull needed pacakges. In addition, drawing commands require GraphViz installed system-wide.

After cloning/downloading this repository go to its directory and launch it via command line:

stack ghci src/Lib.hs

Usage Guidelines

To experiment with topocity, you can execute the following commands in the REPL. Note that input files are taken from the in directory while output files are generated into the out directory. To change this, change the paths in Settings.hs variables.

The following commands use some demo files provided with this repository, however other input can be used, despite currently there is a very limited support of CityGML features related to the current state of development of the citygml4hs library.

Loading the CityGML Source

source = load "in.gml" "topo.gml"

Showing the result of Get

view = get source -- performs the forward BX: CityGML -> Bigraph
display view -- prints in stdout the internal representation of the graph

Changing the View

Wrappers to simulate changes in the bigraph

view'  = addBuilding "demo1" view
view'' = removeBuilding "bc8a0f2b5-031b-11e6-b420-2bdcc4ab5d7f" view'
display view'' -- prints in stdout the internal representation of the graph

Reflecting the changes back to source with Put

source' = put source view''  -- performs the putback BX: CityGML <- Bigraph

Storing back the new Source

store source' "out.gml" "tout.gml" -- Stores the new CityGML and ADE files

Development

Testing & Code Analysis

⚠️ Note: Unless otherwise specified, all commands are meant to be executed at the root of the project and require the Stack platform.


To run the code coverage of the testing platform run in your OS's CLI:

stack test --ghc-options "-fforce-recomp" --coverage

and of course to just run the tests you can skip the --coverage flag.

Profiling

It requires to build the tool with profiling flag enabled, therefore:

stack build --profile

After the build completes, the program can be run in the following way to collect profiling data:

stack exec --profile topocity-exe -- +RTS -h -p

The h flag is used to generate a heap profile, while the p flag is used to generate the classical cpu profile.

To visualize them (provided they have been installed them before), one can use:

stack exec hp2pretty topocity-exe.EXE.hp

for memory graph (svg image) and

stack exec profiteur topocity-exe.EXE.prof

for CPU interactive graph (html).

⚠️ Note: the actual report filename subextension may vary depending on the OS and other settings of the environment.

Generate package dependency graph

In order to generate the dependency graph (in this case the trivial dependency on the base package has been excluded):

stack dot --no-include-base --external | dot -Tpng -o out/wreq.png

Generate documentation

To generate the updated documentation, you can write in the same way:

stack haddock

While to generate the report of the Lines of Code (Windows-only), open a terminal at the tools directory and execute:

cloc.exe ../src ../test --report-file=reports/cloc_%DATE%.txt