Skip to content

Commit

Permalink
fixed the merge with json-output
Browse files Browse the repository at this point in the history
ouf, that wasn’t nice
  • Loading branch information
hugoledoux committed Feb 2, 2018
1 parent 384bbf9 commit 828074c
Showing 17 changed files with 23 additions and 155 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -55,17 +55,13 @@ include( ${CGAL_USE_FILE} )

include_directories( ${CMAKE_SOURCE_DIR}/thirdparty )

FILE(GLOB_RECURSE THIRDPARTY thirdparty/*.cpp)
add_library(thirdparty STATIC ${THIRDPARTY})


include_directories( ${CGAL_INCLUDE_DIR} ${CGAL_3RD_PARTY_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${LIBLAS_INCLUDE_DIR} ${LASZIP_INCLUDE_DIR} ${YAMLCPP_INCLUDE_DIR} ${GDAL_INCLUDE_DIR})
link_directories(${YamlCpp_LIBRARY_DIRS})

# Creating entries for target: 3dfier
FILE(GLOB SRC_FILES src/*.cpp)
add_executable(3dfier ${SRC_FILES})

target_link_libraries( 3dfier ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${BOOST_LIBRARIES} ${GDAL_LIBRARY} ${LIBLAS_LIBRARY} ${LASZIP_LIBRARY} ${YAMLCPP_LIBRARY} ${Boost_LIBRARIES} thirdparty)
target_link_libraries( 3dfier ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${BOOST_LIBRARIES} ${GDAL_LIBRARY} ${LIBLAS_LIBRARY} ${LASZIP_LIBRARY} ${YAMLCPP_LIBRARY} ${Boost_LIBRARIES} )

install(TARGETS 3dfier DESTINATION bin)
13 changes: 3 additions & 10 deletions src/Bridge.cpp
Original file line number Diff line number Diff line change
@@ -66,12 +66,6 @@ bool Bridge::lift() {
return true;
}

<<<<<<< HEAD:src/Bridge.cpp
void Bridge::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<brg:Bridge gml:id=\"" << this->get_id() << "\">";
=======

void Bridge::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts) {
// TODO: implement Bridges in CityJSON
// nlohmann::json f;
@@ -84,10 +78,9 @@ void Bridge::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsi
}


void Bridge::get_citygml(std::ofstream& of) {
of << "<cityObjectMember>\n";
of << "<brg:Bridge gml:id=\"" << this->get_id() << "\">\n";
>>>>>>> origin/cityjson-output:Bridge.cpp
void Bridge::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<brg:Bridge gml:id=\"" << this->get_id() << "\">";
get_citygml_attributes(of, _attributes);
of << "<brg:lod1MultiSurface>";
of << "<gml:MultiSurface>";
5 changes: 0 additions & 5 deletions src/Bridge.h
Original file line number Diff line number Diff line change
@@ -37,14 +37,9 @@ class Bridge: public Flat {

bool lift();
bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn);
<<<<<<< HEAD:src/Bridge.h
void get_citygml(std::ostream& of);
void get_citygml_imgeo(std::ostream& of);
=======
void get_citygml(std::ofstream& of);
void get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts);
void get_citygml_imgeo(std::ofstream& of);
>>>>>>> origin/cityjson-output:Bridge.h
std::string get_mtl();
bool get_shape(OGRLayer* layer, bool writeAttributes, AttributeMap extraAttributes = AttributeMap());
TopoClass get_class();
10 changes: 1 addition & 9 deletions src/Building.cpp
Original file line number Diff line number Diff line change
@@ -169,10 +169,6 @@ void Building::get_obj(std::unordered_map< std::string, unsigned long > &dPts, i
}
}

<<<<<<< HEAD:src/Building.cpp
void Building::get_citygml(std::ostream& of) {
=======

void Building::get_cityjson(nlohmann::json& j, std::unordered_map<std::string, unsigned long> &dPts) {
nlohmann::json b;
b["type"] = "Building";
@@ -188,11 +184,7 @@ void Building::get_cityjson(nlohmann::json& j, std::unordered_map<std::string, u
j["CityObjects"][this->get_id()] = b;
}




void Building::get_citygml(std::ofstream& of) {
>>>>>>> origin/cityjson-output:Building.cpp
void Building::get_citygml(std::ostream& of) {
float h = z_to_float(this->get_height());
float hbase = z_to_float(this->get_height_base());
of << "<cityObjectMember>";
7 changes: 0 additions & 7 deletions src/Building.h
Original file line number Diff line number Diff line change
@@ -37,18 +37,11 @@ class Building: public Flat {
bool lift();
bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn);
void get_obj(std::unordered_map< std::string, unsigned long > &dPts, int lod, std::string mtl, std::string &fs);
<<<<<<< HEAD:src/Building.h
void get_citygml(std::ostream& of);
void get_citygml_imgeo(std::ostream& of);
void get_imgeo_nummeraanduiding(std::ostream& of);
void get_csv(std::ostream& of);
=======
void get_citygml(std::ofstream& of);
void get_cityjson(nlohmann::json& j, std::unordered_map<std::string, unsigned long> &dPts);
void get_citygml_imgeo(std::ofstream& of);
void get_imgeo_nummeraanduiding(std::ofstream& of);
void get_csv(std::ofstream& of);
>>>>>>> origin/cityjson-output:Building.h
std::string get_all_z_values();
std::string get_mtl();
bool get_shape(OGRLayer* layer, bool writeAttributes, AttributeMap extraAttributes = AttributeMap());
13 changes: 4 additions & 9 deletions src/Forest.cpp
Original file line number Diff line number Diff line change
@@ -63,11 +63,7 @@ bool Forest::lift() {
return true;
}

<<<<<<< HEAD:src/Forest.cpp
void Forest::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<veg:PlantCover gml:id=\"" << this->get_id() << "\">";
=======

void Forest::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts) {
nlohmann::json f;
f["type"] = "PlantCover";
@@ -80,10 +76,9 @@ void Forest::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsi
}


void Forest::get_citygml(std::ofstream& of) {
of << "<cityObjectMember>\n";
of << "<veg:PlantCover gml:id=\"" << this->get_id() << "\">\n";
>>>>>>> origin/cityjson-output:Forest.cpp
void Forest::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<veg:PlantCover gml:id=\"" << this->get_id() << "\">";
get_citygml_attributes(of, _attributes);
of << "<veg:lod1MultiSurface>";
of << "<gml:MultiSurface>";
5 changes: 0 additions & 5 deletions src/Forest.h
Original file line number Diff line number Diff line change
@@ -36,14 +36,9 @@ class Forest: public TIN {
Forest(char *wkt, std::string layername, AttributeMap attributes, std::string pid, int simplification, float innerbuffer, bool only_ground_points);
bool lift();
bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn);
<<<<<<< HEAD:src/Forest.h
void get_citygml(std::ostream& of);
void get_citygml_imgeo(std::ostream& of);
=======
void get_citygml(std::ofstream& of);
void get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts);
void get_citygml_imgeo(std::ofstream& of);
>>>>>>> origin/cityjson-output:Forest.h
std::string get_mtl();
bool get_shape(OGRLayer* layer, bool writeAttributes, AttributeMap extraAttributes = AttributeMap());
TopoClass get_class();
9 changes: 3 additions & 6 deletions src/Map3d.cpp
Original file line number Diff line number Diff line change
@@ -31,7 +31,8 @@
#include "boost/locale.hpp"
#include "boost/tokenizer.hpp"
#include "boost/algorithm/string.hpp"
#include "json.hpp"
#include "nlohmann-json/json.hpp"



Map3d::Map3d() {
@@ -147,9 +148,6 @@ liblas::Bounds<double> Map3d::get_bounds() {
return bounds;
}

<<<<<<< HEAD:src/Map3d.cpp
void Map3d::get_citygml(std::ostream& of) {
=======

bool Map3d::get_cityjson(std::string filename) {
std::cout << "CityJSON" << std::endl;
@@ -189,8 +187,7 @@ bool Map3d::get_cityjson(std::string filename) {
}


void Map3d::get_citygml(std::ofstream& of) {
>>>>>>> origin/cityjson-output:Map3d.cpp
void Map3d::get_citygml(std::ostream& of) {
create_citygml_header(of);
for (auto& f : _lsFeatures) {
f->get_citygml(of);
5 changes: 0 additions & 5 deletions src/Map3d.h
Original file line number Diff line number Diff line change
@@ -63,14 +63,9 @@ class Map3d {

void get_citygml(std::ostream& of);
void get_citygml_multifile(std::string);
<<<<<<< HEAD:src/Map3d.h
void create_citygml_header(std::ostream& of);
void get_citygml_imgeo(std::ostream& of);
=======
void create_citygml_header(std::ofstream& of);
bool get_cityjson(std::string filename);
void get_citygml_imgeo(std::ofstream& of);
>>>>>>> origin/cityjson-output:Map3d.h
void get_citygml_imgeo_multifile(std::string ofname);
void create_citygml_imgeo_header(std::ostream& of);
bool get_pdok_output(std::string filename);
12 changes: 3 additions & 9 deletions src/Road.cpp
Original file line number Diff line number Diff line change
@@ -61,11 +61,6 @@ bool Road::lift() {
return true;
}

<<<<<<< HEAD:src/Road.cpp
void Road::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<tran:Road gml:id=\"" << this->get_id() << "\">";
=======
void Road::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts) {
nlohmann::json f;
// f["type"] = "Road"; // TODO : change back to Road when implemented
@@ -79,10 +74,9 @@ void Road::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsign
}


void Road::get_citygml(std::ofstream& of) {
of << "<cityObjectMember>\n";
of << "<tran:Road gml:id=\"" << this->get_id() << "\">\n";
>>>>>>> origin/cityjson-output:Road.cpp
void Road::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<tran:Road gml:id=\"" << this->get_id() << "\">";
get_citygml_attributes(of, _attributes);
of << "<tran:lod1MultiSurface>";
of << "<gml:MultiSurface>";
5 changes: 0 additions & 5 deletions src/Road.h
Original file line number Diff line number Diff line change
@@ -36,14 +36,9 @@ class Road: public Boundary3D {
Road(char *wkt, std::string layername, AttributeMap attributes, std::string pid, float heightref);
bool lift();
bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn);
<<<<<<< HEAD:src/Road.h
void get_citygml(std::ostream& of);
void get_citygml_imgeo(std::ostream& of);
=======
void get_citygml(std::ofstream& of);
void get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts);
void get_citygml_imgeo(std::ofstream& of);
>>>>>>> origin/cityjson-output:Road.h
std::string get_mtl();
bool get_shape(OGRLayer* layer, bool writeAttributes, AttributeMap extraAttributes = AttributeMap());
static float _heightref;
13 changes: 3 additions & 10 deletions src/Separation.cpp
Original file line number Diff line number Diff line change
@@ -63,12 +63,6 @@ bool Separation::lift() {
return true;
}

<<<<<<< HEAD:src/Separation.cpp
void Separation::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<gen:GenericCityObject gml:id=\"" << this->get_id() << "\">";
=======

void Separation::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts) {
nlohmann::json f;
f["type"] = "GenericCityObject";
@@ -81,10 +75,9 @@ void Separation::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,
}


void Separation::get_citygml(std::ofstream& of) {
of << "<cityObjectMember>\n";
of << "<gen:GenericCityObject gml:id=\"" << this->get_id() << "\">\n";
>>>>>>> origin/cityjson-output:Separation.cpp
void Separation::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<gen:GenericCityObject gml:id=\"" << this->get_id() << "\">";
get_citygml_attributes(of, _attributes);
of << "<gen:lod1Geometry>";
of << "<gml:MultiSurface>";
5 changes: 0 additions & 5 deletions src/Separation.h
Original file line number Diff line number Diff line change
@@ -36,14 +36,9 @@ class Separation: public Boundary3D {
Separation(char *wkt, std::string layername, AttributeMap attributes, std::string pid, float heightref);
bool lift();
bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn);
<<<<<<< HEAD:src/Separation.h
void get_citygml(std::ostream& of);
void get_citygml_imgeo(std::ostream& of);
=======
void get_citygml(std::ofstream& of);
void get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts);
void get_citygml_imgeo(std::ofstream& of);
>>>>>>> origin/cityjson-output:Separation.h
std::string get_mtl();
bool get_shape(OGRLayer* layer, bool writeAttributes, AttributeMap extraAttributes = AttributeMap());
TopoClass get_class();
12 changes: 3 additions & 9 deletions src/Terrain.cpp
Original file line number Diff line number Diff line change
@@ -59,11 +59,6 @@ bool Terrain::lift() {
return true;
}

<<<<<<< HEAD:src/Terrain.cpp
void Terrain::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<luse:LandUse gml:id=\"" << this->get_id() << "\">";
=======
void Terrain::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts) {
nlohmann::json f;
f["type"] = "LandUse";
@@ -76,10 +71,9 @@ void Terrain::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,uns
}


void Terrain::get_citygml(std::ofstream& of) {
of << "<cityObjectMember>\n";
of << "<luse:LandUse gml:id=\"" << this->get_id() << "\">\n";
>>>>>>> origin/cityjson-output:Terrain.cpp
void Terrain::get_citygml(std::ostream& of) {
of << "<cityObjectMember>";
of << "<luse:LandUse gml:id=\"" << this->get_id() << "\">";
get_citygml_attributes(of, _attributes);
of << "<luse:lod1MultiSurface>";
of << "<gml:MultiSurface>";
2 changes: 1 addition & 1 deletion src/TopoFeature.h
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@

#include "definitions.h"
#include "geomtools.h"
#include "json.hpp"
#include "nlohmann-json/json.hpp"
#include <random>

class TopoFeature {
52 changes: 1 addition & 51 deletions src/io.cpp
Original file line number Diff line number Diff line change
@@ -91,58 +91,8 @@ void get_citygml_imgeo_namespaces(std::ostream& of) {
of << "xsi:schemaLocation=\"http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.geostandaarden.nl/imgeo/2.1 http://schemas.geonovum.nl/imgeo/2.1/imgeo-2.1.1.xsd\">\n";
}

<<<<<<< HEAD:src/io.cpp

void get_polygon_lifted_gml(std::ostream& of, Polygon2* p2, double height, bool reverse) {
=======

// void get_polygon_lifted_cityjson(Polygon2* p2, double height, bool reverse, std::vector<std::vector<int>>& outp, std::vector<std::vector<double>>& vertices, int offset) {
// if (reverse)
// bg::reverse(*p2);
// std::vector<int> ringi;
// auto r = bg::exterior_ring(*p2);
// for (int i = 0; i < r.size(); i++) {
// vertices.push_back({bg::get<0>(r[i]), bg::get<1>(r[i]), height});
// ringi.push_back(i+offset);
// }
// outp.push_back(ringi);
// auto irings = bg::interior_rings(*p2);
// for (Ring2& r : irings) {
// ringi.clear();
// offset = vertices.size();
// for (int i = 0; i < r.size(); i++) {
// vertices.push_back({bg::get<0>(r[i]), bg::get<1>(r[i]), height});
// ringi.push_back(i+offset);
// }
// outp.push_back(ringi);
// }
// if (reverse)
// bg::reverse(*p2);
// }

// void get_extruded_line_cityjson(Point2* a, Point2* b, double high, double low, std::vector<std::vector<int>>& outp, std::vector<std::vector<double>>& vertices, int offset) {

// []
// std::vector<int> ringi;
// auto r = bg::exterior_ring(*p2);
// for (int i = 0; i < r.size(); i++) {
// vertices.push_back({bg::get<0>(r[i]), bg::get<1>(r[i]), height});
// ringi.push_back(i+offset);
// }
// outp.push_back(ringi);
// auto irings = bg::interior_rings(*p2);
// for (Ring2& r : irings) {
// ringi.clear();
// offset = vertices.size();
// for (int i = 0; i < r.size(); i++) {
// vertices.push_back({bg::get<0>(r[i]), bg::get<1>(r[i]), height});
// ringi.push_back(i+offset);
// }
// outp.push_back(ringi);
// }
// }

void get_polygon_lifted_gml(std::ofstream& of, Polygon2* p2, double height, bool reverse) {
>>>>>>> origin/cityjson-output:io.cpp
if (reverse)
bg::reverse(*p2);
of << "<gml:surfaceMember>";
4 changes: 0 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -379,11 +379,7 @@ int main(int argc, const char * argv[]) {

bool fileWritten = true;
std::ofstream of;
<<<<<<< HEAD:src/main.cpp
if (format != "Shapefile" && format != "CityGML-Multifile" && format != "CityGML-IMGeo-Multifile" && format != "PostGIS" && format != "PostGIS-Multi" && format != "PostGIS-PDOK")
=======
if (format != "CityJSON" && format != "Shapefile" && format != "CityGML-Multifile" && format != "CityGML-IMGeo-Multifile" && format != "PostGIS")
>>>>>>> origin/cityjson-output:main.cpp
of.open(ofname);

if (format == "CityGML") {

0 comments on commit 828074c

Please sign in to comment.