From 3929ae2c7d9ec228d649b432c4dfd25fe8cbdc0e Mon Sep 17 00:00:00 2001 From: Tom Commandeur Date: Fri, 12 May 2017 15:13:47 +0200 Subject: [PATCH] ranamed outputfile to of --- Bridge.cpp | 54 ++++++++-------- Bridge.h | 4 +- Building.cpp | 160 ++++++++++++++++++++++++------------------------ Building.h | 8 +-- Forest.cpp | 54 ++++++++-------- Forest.h | 4 +- Map3d.cpp | 112 ++++++++++++++++----------------- Map3d.h | 14 ++--- Road.cpp | 80 ++++++++++++------------ Road.h | 4 +- Separation.cpp | 68 ++++++++++---------- Separation.h | 4 +- Terrain.cpp | 54 ++++++++-------- Terrain.h | 4 +- TopoFeature.cpp | 108 ++++++++++++++++---------------- TopoFeature.h | 18 +++--- Water.cpp | 60 +++++++++--------- Water.h | 4 +- io.cpp | 148 ++++++++++++++++++++++---------------------- io.h | 12 ++-- main.cpp | 26 ++++---- 21 files changed, 500 insertions(+), 500 deletions(-) diff --git a/Bridge.cpp b/Bridge.cpp index 7e162f6c..0d553591 100644 --- a/Bridge.cpp +++ b/Bridge.cpp @@ -62,46 +62,46 @@ bool Bridge::lift() { return true; } -void Bridge::get_citygml(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_citygml_attributes(outputfile, _attributes); - outputfile << "\n"; - outputfile << "\n"; +void Bridge::get_citygml(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_citygml_attributes(of, _attributes); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Bridge::get_citygml_imgeo(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_imgeo_object_info(outputfile, this->get_id()); - outputfile << "\n"; - outputfile << "\n"; +void Bridge::get_citygml_imgeo(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_imgeo_object_info(of, this->get_id()); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; std::string attribute; if (get_attribute("bgt-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("hoortbijtypeoverbrugging", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("overbruggingisbeweegbaar", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; } bool Bridge::get_shape(OGRLayer* layer) { diff --git a/Bridge.h b/Bridge.h index 8d8a78a7..8666766c 100644 --- a/Bridge.h +++ b/Bridge.h @@ -37,8 +37,8 @@ class Bridge: public Flat { bool lift(); bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn); - void get_citygml(std::ofstream &outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); std::string get_mtl(); bool get_shape(OGRLayer * layer); TopoClass get_class(); diff --git a/Building.cpp b/Building.cpp index 26fec16b..f2427c68 100644 --- a/Building.cpp +++ b/Building.cpp @@ -87,8 +87,8 @@ bool Building::is_hard() { return true; } -void Building::get_csv(std::ofstream &outputfile) { - outputfile << this->get_id() << ";" << std::setprecision(2) << std::fixed << this->get_height() << ";" << this->get_height_base() << "\n"; +void Building::get_csv(std::ofstream& of) { + of << this->get_id() << ";" << std::setprecision(2) << std::fixed << this->get_height() << ";" << this->get_height_base() << "\n"; } std::string Building::get_mtl() { @@ -138,105 +138,105 @@ void Building::get_obj(std::unordered_map< std::string, unsigned long > &dPts, i } } -void Building::get_citygml(std::ofstream &outputfile) { +void Building::get_citygml(std::ofstream& of) { float h = z_to_float(this->get_height()); float hbase = z_to_float(this->get_height_base()); - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_citygml_attributes(outputfile, _attributes); - outputfile << "\n"; - outputfile << "" << hbase << "\n"; - outputfile << "\n"; - outputfile << "" << h << "\n"; + of << "\n"; + of << "get_id() << "\">\n"; + get_citygml_attributes(of, _attributes); + of << "\n"; + of << "" << hbase << "\n"; + of << "\n"; + of << "" << h << "\n"; //-- LOD0 footprint - outputfile << "\n"; - outputfile << "\n"; - get_polygon_lifted_gml(outputfile, this->_p2, hbase, true); - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + get_polygon_lifted_gml(of, this->_p2, hbase, true); + of << "\n"; + of << "\n"; //-- LOD0 roofedge - outputfile << "\n"; - outputfile << "\n"; - get_polygon_lifted_gml(outputfile, this->_p2, h, true); - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + get_polygon_lifted_gml(of, this->_p2, h, true); + of << "\n"; + of << "\n"; //-- LOD1 Solid - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; //-- get floor - get_polygon_lifted_gml(outputfile, this->_p2, hbase, false); + get_polygon_lifted_gml(of, this->_p2, hbase, false); //-- get roof - get_polygon_lifted_gml(outputfile, this->_p2, h, true); + get_polygon_lifted_gml(of, this->_p2, h, true); //-- get the walls auto r = bg::exterior_ring(*(this->_p2)); int i; for (i = 0; i < (r.size() - 1); i++) - get_extruded_line_gml(outputfile, &r[i], &r[i + 1], h, hbase, false); - get_extruded_line_gml(outputfile, &r[i], &r[0], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[i + 1], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[0], h, hbase, false); //-- irings auto irings = bg::interior_rings(*(this->_p2)); for (Ring2& r : irings) { for (i = 0; i < (r.size() - 1); i++) - get_extruded_line_gml(outputfile, &r[i], &r[i + 1], h, hbase, false); - get_extruded_line_gml(outputfile, &r[i], &r[0], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[i + 1], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[0], h, hbase, false); } - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Building::get_citygml_imgeo(std::ofstream &outputfile) { +void Building::get_citygml_imgeo(std::ofstream& of) { float h = z_to_float(this->get_height()); float hbase = z_to_float(this->get_height_base()); - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; + of << "\n"; + of << "get_id() << "\">\n"; //-- store building information - get_imgeo_object_info(outputfile, this->get_id()); - outputfile << "\n"; - outputfile << "\n"; + get_imgeo_object_info(of, this->get_id()); + of << "\n"; + of << "\n"; //-- LOD1 Solid - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; //-- get floor - get_polygon_lifted_gml(outputfile, this->_p2, hbase, false); + get_polygon_lifted_gml(of, this->_p2, hbase, false); //-- get roof - get_polygon_lifted_gml(outputfile, this->_p2, h, true); + get_polygon_lifted_gml(of, this->_p2, h, true); //-- get the walls auto r = bg::exterior_ring(*(this->_p2)); int i; for (i = 0; i < (r.size() - 1); i++) - get_extruded_line_gml(outputfile, &r[i], &r[i + 1], h, hbase, false); - get_extruded_line_gml(outputfile, &r[i], &r[0], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[i + 1], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[0], h, hbase, false); //-- irings auto irings = bg::interior_rings(*(this->_p2)); for (Ring2& r : irings) { for (i = 0; i < (r.size() - 1); i++) - get_extruded_line_gml(outputfile, &r[i], &r[i + 1], h, hbase, false); - get_extruded_line_gml(outputfile, &r[i], &r[0], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[i + 1], h, hbase, false); + get_extruded_line_gml(of, &r[i], &r[0], h, hbase, false); } - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; std::string attribute; if (get_attribute("identificatiebagpnd", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - get_imgeo_nummeraanduiding(outputfile); - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + get_imgeo_nummeraanduiding(of); + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Building::get_imgeo_nummeraanduiding(std::ofstream &outputfile) { +void Building::get_imgeo_nummeraanduiding(std::ofstream& of) { std::string attribute; bool btekst, bplaatsingspunt, bhoek, blaagnr, bhoognr; std::string tekst, plaatsingspunt, hoek, laagnr, hoognr; @@ -267,27 +267,27 @@ void Building::get_imgeo_nummeraanduiding(std::ofstream &outputfile) { int count = boost::lexical_cast(tekst[1]); for (int i = 0; i < count; i++) { if (i < tekst_split.size() && i < plaatsingspunt_split.size() && i < hoek_split.size()) { - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "" << tekst_split.at(i) << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "" << plaatsingspunt_split.at(i) << "\n"; - outputfile << "" << hoek_split.at(i) << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "" << tekst_split.at(i) << "\n"; + of << "\n"; + of << "\n"; + of << "" << plaatsingspunt_split.at(i) << "\n"; + of << "" << hoek_split.at(i) << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; if (i < laagnr_split.size()) { - outputfile << "" << laagnr_split.at(i) << "\n"; + of << "" << laagnr_split.at(i) << "\n"; } if (i < hoognr_split.size()) { - outputfile << "" << hoognr_split.at(i) << "\n"; + of << "" << hoognr_split.at(i) << "\n"; } - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; } } } diff --git a/Building.h b/Building.h index f26d4216..c5a4c672 100644 --- a/Building.h +++ b/Building.h @@ -37,10 +37,10 @@ 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); - void get_citygml(std::ofstream &outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); - void get_imgeo_nummeraanduiding(std::ofstream &outputfile); - void get_csv(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); + void get_imgeo_nummeraanduiding(std::ofstream& of); + void get_csv(std::ofstream& of); std::string get_mtl(); bool get_shape(OGRLayer * layer); TopoClass get_class(); diff --git a/Forest.cpp b/Forest.cpp index e7b58da8..91baf55e 100644 --- a/Forest.cpp +++ b/Forest.cpp @@ -63,46 +63,46 @@ bool Forest::lift() { return true; } -void Forest::get_citygml(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_citygml_attributes(outputfile, _attributes); - outputfile << "\n"; - outputfile << "\n"; +void Forest::get_citygml(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_citygml_attributes(of, _attributes); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Forest::get_citygml_imgeo(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_imgeo_object_info(outputfile, this->get_id()); - outputfile << "\n"; - outputfile << "\n"; +void Forest::get_citygml_imgeo(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_imgeo_object_info(of, this->get_id()); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; std::string attribute; if (get_attribute("bgt-fysiekvoorkomen", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("begroeidterreindeeloptalud", attribute, "false")) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-fysiekvoorkomen", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; } bool Forest::get_shape(OGRLayer* layer) { diff --git a/Forest.h b/Forest.h index 76d8843c..986879ea 100644 --- a/Forest.h +++ b/Forest.h @@ -36,8 +36,8 @@ class Forest: public TIN { Forest(char *wkt, std::string layername, std::unordered_map> 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); - void get_citygml(std::ofstream &outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); std::string get_mtl(); bool get_shape(OGRLayer * layer); TopoClass get_class(); diff --git a/Map3d.cpp b/Map3d.cpp index 00d632cd..6a7f31a1 100644 --- a/Map3d.cpp +++ b/Map3d.cpp @@ -143,87 +143,87 @@ liblas::Bounds Map3d::get_bounds() { return bounds; } -void Map3d::get_citygml(std::ofstream &outputfile) { - create_citygml_header(outputfile); +void Map3d::get_citygml(std::ofstream& of) { + create_citygml_header(of); for (auto& f : _lsFeatures) { - f->get_citygml(outputfile); + f->get_citygml(of); } - outputfile << "\n"; + of << "\n"; } -void Map3d::get_citygml_multifile(std::string outputfilename) { - std::unordered_map outputfiles; +void Map3d::get_citygml_multifile(std::string ofname) { + std::unordered_map ofs; for (auto& f : _lsFeatures) { - std::string filename = outputfilename + f->get_layername() + ".gml"; - if (outputfiles.find(filename) == outputfiles.end()) { - outputfiles.emplace(filename, std::ofstream(filename)); - create_citygml_header(outputfiles[filename]); + std::string filename = ofname + f->get_layername() + ".gml"; + if (ofs.find(filename) == ofs.end()) { + ofs.emplace(filename, std::ofstream(filename)); + create_citygml_header(ofs[filename]); } - f->get_citygml(outputfiles[filename]); + f->get_citygml(ofs[filename]); } - for (auto i = outputfiles.begin(); i != outputfiles.end(); i++) { - std::ofstream& outputfile = outputfiles[(*i).first]; - outputfile << "\n"; - outputfile.close(); + for (auto i = ofs.begin(); i != ofs.end(); i++) { + std::ofstream& of = ofs[(*i).first]; + of << "\n"; + of.close(); } } -void Map3d::get_citygml_imgeo(std::ofstream &outputfile) { - create_citygml_header(outputfile); +void Map3d::get_citygml_imgeo(std::ofstream& of) { + create_citygml_header(of); for (auto& f : _lsFeatures) { - f->get_citygml_imgeo(outputfile); + f->get_citygml_imgeo(of); } - outputfile << "\n"; + of << "\n"; } -void Map3d::get_citygml_imgeo_multifile(std::string outputfilename) { - std::unordered_map outputfiles; +void Map3d::get_citygml_imgeo_multifile(std::string ofname) { + std::unordered_map ofs; for (auto& f : _lsFeatures) { - std::string filename = outputfilename + f->get_layername() + ".gml"; - if (outputfiles.find(filename) == outputfiles.end()) { - outputfiles.emplace(filename, std::ofstream(filename)); - create_citygml_header(outputfiles[filename]); + std::string filename = ofname + f->get_layername() + ".gml"; + if (ofs.find(filename) == ofs.end()) { + ofs.emplace(filename, std::ofstream(filename)); + create_citygml_header(ofs[filename]); } - f->get_citygml_imgeo(outputfiles[filename]); + f->get_citygml_imgeo(ofs[filename]); } - for (auto it = outputfiles.begin(); it != outputfiles.end(); it++) { - std::ofstream& outputfile = outputfiles[(*it).first]; - outputfile << "\n"; - outputfile.close(); + for (auto it = ofs.begin(); it != ofs.end(); it++) { + std::ofstream& of = ofs[(*it).first]; + of << "\n"; + of.close(); } } -void Map3d::create_citygml_header(std::ofstream& outputfile) { - outputfile << std::setprecision(3) << std::fixed; - get_xml_header(outputfile); - get_citygml_namespaces(outputfile); - outputfile << "\n"; - outputfile << "my 3dfied map\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << ""; - outputfile << bg::get(_bbox) << " " << bg::get(_bbox) << " 0"; - outputfile << "\n"; - outputfile << ""; - outputfile << bg::get(_bbox) << " " << bg::get(_bbox) << " 100"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; +void Map3d::create_citygml_header(std::ofstream& of) { + of << std::setprecision(3) << std::fixed; + get_xml_header(of); + get_citygml_namespaces(of); + of << "\n"; + of << "my 3dfied map\n"; + of << "\n"; + of << "\n"; + of << ""; + of << bg::get(_bbox) << " " << bg::get(_bbox) << " 0"; + of << "\n"; + of << ""; + of << bg::get(_bbox) << " " << bg::get(_bbox) << " 100"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Map3d::get_csv_buildings(std::ofstream &outputfile) { - outputfile << "id;roof;floor\n"; +void Map3d::get_csv_buildings(std::ofstream& of) { + of << "id;roof;floor\n"; for (auto& p : _lsFeatures) { if (p->get_class() == BUILDING) { Building* b = dynamic_cast(p); - b->get_csv(outputfile); + b->get_csv(of); } } } -void Map3d::get_obj_per_feature(std::ofstream &outputfile, int z_exaggeration) { +void Map3d::get_obj_per_feature(std::ofstream& of, int z_exaggeration) { std::unordered_map< std::string, unsigned long > dPts; std::string fs; @@ -245,13 +245,13 @@ void Map3d::get_obj_per_feature(std::ofstream &outputfile, int z_exaggeration) { thepts[p.second - 1] = p.first; dPts.clear(); - outputfile << "mtllib ./3dfier.mtl" << "\n"; + of << "mtllib ./3dfier.mtl" << "\n"; for (auto& p : thepts) { - outputfile << "v " << p << "\n"; + of << "v " << p << "\n"; } } -void Map3d::get_obj_per_class(std::ofstream &outputfile, int z_exaggeration) { +void Map3d::get_obj_per_class(std::ofstream& of, int z_exaggeration) { std::unordered_map< std::string, unsigned long > dPts; std::string fs; for (int c = 0; c < 6; c++) { @@ -275,11 +275,11 @@ void Map3d::get_obj_per_class(std::ofstream &outputfile, int z_exaggeration) { thepts[p.second - 1] = p.first; dPts.clear(); - outputfile << "mtllib ./3dfier.mtl\n"; + of << "mtllib ./3dfier.mtl\n"; for (auto& p : thepts) { - outputfile << "v " << p << std::endl; + of << "v " << p << std::endl; } - outputfile << fs << std::endl; + of << fs << std::endl; } bool Map3d::get_shapefile(std::string filename) { diff --git a/Map3d.h b/Map3d.h index 47cc89a4..6723e8a1 100644 --- a/Map3d.h +++ b/Map3d.h @@ -61,14 +61,14 @@ class Map3d { Box2 get_bbox(); liblas::Bounds get_bounds(); - void get_citygml(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); void get_citygml_multifile(std::string); - void create_citygml_header(std::ofstream& outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); - void get_citygml_imgeo_multifile(std::string outputfilename); - void get_csv_buildings(std::ofstream &outputfile); - void get_obj_per_feature(std::ofstream &outputfile, int z_exaggeration = 0); - void get_obj_per_class(std::ofstream &outputfile, int z_exaggeration = 0); + void create_citygml_header(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); + void get_citygml_imgeo_multifile(std::string ofname); + void get_csv_buildings(std::ofstream& of); + void get_obj_per_feature(std::ofstream& of, int z_exaggeration = 0); + void get_obj_per_class(std::ofstream& of, int z_exaggeration = 0); bool get_shapefile(std::string filename); bool get_shapefile2d(std::string filename); diff --git a/Road.cpp b/Road.cpp index 5be0f560..3557a0d5 100644 --- a/Road.cpp +++ b/Road.cpp @@ -61,93 +61,93 @@ bool Road::lift() { return true; } -void Road::get_citygml(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_citygml_attributes(outputfile, _attributes); - outputfile << "\n"; - outputfile << "\n"; +void Road::get_citygml(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_citygml_attributes(of, _attributes); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Road::get_citygml_imgeo(std::ofstream &outputfile) { +void Road::get_citygml_imgeo(std::ofstream& of) { bool auxiliary = _layername == "auxiliarytrafficarea"; bool spoor = _layername == "spoor"; - outputfile << "\n"; + of << "\n"; if (spoor) { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } else if (auxiliary) { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } else { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } - get_imgeo_object_info(outputfile, this->get_id()); - outputfile << "\n"; - outputfile << "\n"; + get_imgeo_object_info(of, this->get_id()); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; std::string attribute; if (spoor) { if (get_attribute("bgt-functie", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-functiespoor", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } else if (auxiliary) { if (get_attribute("bgt-functie", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("bgt-fysiekvoorkomen", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("ondersteunendwegdeeloptalud", attribute, "false")) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-functieondersteunendwegdeel", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-fysiekvoorkomenondersteunendwegdeel", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } else { if (get_attribute("bgt-functie", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("bgt-fysiekvoorkomen", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (!get_attribute("wegdeeloptalud", attribute, "false")) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-functiewegdeel", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-fysiekvoorkomenwegdeel", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } - outputfile << "\n"; + of << "\n"; } bool Road::get_shape(OGRLayer* layer) { diff --git a/Road.h b/Road.h index 63671549..624c6ca9 100644 --- a/Road.h +++ b/Road.h @@ -36,8 +36,8 @@ class Road: public Boundary3D { Road(char *wkt, std::string layername, std::unordered_map> attributes, std::string pid, float heightref); bool lift(); bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn); - void get_citygml(std::ofstream &outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); std::string get_mtl(); bool get_shape(OGRLayer * layer); static float _heightref; diff --git a/Separation.cpp b/Separation.cpp index d84bd4df..a8f45cba 100644 --- a/Separation.cpp +++ b/Separation.cpp @@ -63,73 +63,73 @@ bool Separation::lift() { return true; } -void Separation::get_citygml(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_citygml_attributes(outputfile, _attributes); - outputfile << "\n"; - outputfile << "\n"; +void Separation::get_citygml(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_citygml_attributes(of, _attributes); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Separation::get_citygml_imgeo(std::ofstream &outputfile) { +void Separation::get_citygml_imgeo(std::ofstream& of) { bool kunstwerkdeel = _layername == "kunstwerkdeel"; bool overigbouwwerk = _layername == "overigbouwwerk"; - outputfile << "\n"; + of << "\n"; if (kunstwerkdeel) { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } else if (overigbouwwerk) { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } else { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } - get_imgeo_object_info(outputfile, this->get_id()); - outputfile << "\n"; - outputfile << "\n"; + get_imgeo_object_info(of, this->get_id()); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; std::string attribute; if (kunstwerkdeel) { if (get_attribute("bgt-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } else if (overigbouwwerk) { if (get_attribute("bgt-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } else { if (get_attribute("bgt-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } - outputfile << "\n"; + of << "\n"; } bool Separation::get_shape(OGRLayer* layer) { diff --git a/Separation.h b/Separation.h index fb79b4b5..ffc9a1df 100644 --- a/Separation.h +++ b/Separation.h @@ -36,8 +36,8 @@ class Separation: public Boundary3D { Separation(char *wkt, std::string layername, std::unordered_map> attributes, std::string pid, float heightref); bool lift(); bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn); - void get_citygml(std::ofstream &outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); std::string get_mtl(); bool get_shape(OGRLayer * layer); TopoClass get_class(); diff --git a/Terrain.cpp b/Terrain.cpp index cfe6f9b7..448b6a71 100644 --- a/Terrain.cpp +++ b/Terrain.cpp @@ -59,46 +59,46 @@ bool Terrain::lift() { return true; } -void Terrain::get_citygml(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_citygml_attributes(outputfile, _attributes); - outputfile << "\n"; - outputfile << "\n"; +void Terrain::get_citygml(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_citygml_attributes(of, _attributes); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Terrain::get_citygml_imgeo(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_imgeo_object_info(outputfile, this->get_id()); - outputfile << "\n"; - outputfile << "\n"; +void Terrain::get_citygml_imgeo(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_imgeo_object_info(of, this->get_id()); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; std::string attribute; if (get_attribute("bgt-fysiekvoorkomen", attribute)) { - outputfile << "" << attribute /*"erf"*/ << "\n"; + of << "" << attribute /*"erf"*/ << "\n"; } if (get_attribute("onbegroeidterreindeeloptalud", attribute, "false")) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-fysiekvoorkomen", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; } bool Terrain::get_shape(OGRLayer* layer) { diff --git a/Terrain.h b/Terrain.h index 6cc29296..0024a972 100644 --- a/Terrain.h +++ b/Terrain.h @@ -36,8 +36,8 @@ class Terrain: public TIN { Terrain(char *wkt, std::string layername, std::unordered_map> attributes, std::string pid, int simplification, float innerbuffer); bool lift(); bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn); - void get_citygml(std::ofstream &outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); std::string get_mtl(); bool get_shape(OGRLayer * layer); TopoClass get_class(); diff --git a/TopoFeature.cpp b/TopoFeature.cpp index afd59ad7..d9d05054 100644 --- a/TopoFeature.cpp +++ b/TopoFeature.cpp @@ -165,49 +165,49 @@ void TopoFeature::get_obj(std::unordered_map< std::string, unsigned long > &dPts } } -void TopoFeature::get_imgeo_object_info(std::ofstream &outputfile, std::string id) { +void TopoFeature::get_imgeo_object_info(std::ofstream& of, std::string id) { std::string attribute; if (get_attribute("creationDate", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("terminationDate", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("lokaalid", attribute)) { - outputfile << "\n"; - outputfile << "\n"; - outputfile << "NL.IMGeo\n"; - outputfile << "" << attribute << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + of << "NL.IMGeo\n"; + of << "" << attribute << "\n"; + of << "\n"; + of << "\n"; } if (get_attribute("tijdstipregistratie", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("eindregistratie", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("lv-publicatiedatum", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("bronhouder", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("inonderzoek", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("relatievehoogteligging", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("bgt-status", attribute, "bestaand")) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-status", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } } -void TopoFeature::get_citygml_attributes(std::ofstream &outputfile, std::unordered_map> attributes) { +void TopoFeature::get_citygml_attributes(std::ofstream& of, std::unordered_map> attributes) { for (auto& attribute : attributes) { // add attributes except gml_id if (attribute.first.compare("gml_id") != 0) { @@ -222,9 +222,9 @@ void TopoFeature::get_citygml_attributes(std::ofstream &outputfile, std::unorder default: type = "string"; } - outputfile << "(attribute) + "\">\n"; - outputfile << "" + attribute.second.second + "\n"; - outputfile << "\n"; + of << "(attribute) + "\">\n"; + of << "" + attribute.second.second + "\n"; + of << "\n"; } } } @@ -735,48 +735,48 @@ bool TopoFeature::point_in_polygon(const Point2 &p, const Polygon2 &poly) { return insideOuter; } -void TopoFeature::get_triangle_as_gml_surfacemember(std::ofstream &outputfile, Triangle& t, bool verticalwall) { - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; +void TopoFeature::get_triangle_as_gml_surfacemember(std::ofstream& of, Triangle& t, bool verticalwall) { + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; if (verticalwall == false) { - outputfile << "" << _vertices[t.v0].second << "\n"; - outputfile << "" << _vertices[t.v1].second << "\n"; - outputfile << "" << _vertices[t.v2].second << "\n"; - outputfile << "" << _vertices[t.v0].second << "\n"; + of << "" << _vertices[t.v0].second << "\n"; + of << "" << _vertices[t.v1].second << "\n"; + of << "" << _vertices[t.v2].second << "\n"; + of << "" << _vertices[t.v0].second << "\n"; } else { - outputfile << "" << _vertices_vw[t.v0].second << "\n"; - outputfile << "" << _vertices_vw[t.v1].second << "\n"; - outputfile << "" << _vertices_vw[t.v2].second << "\n"; - outputfile << "" << _vertices_vw[t.v0].second << "\n"; + of << "" << _vertices_vw[t.v0].second << "\n"; + of << "" << _vertices_vw[t.v1].second << "\n"; + of << "" << _vertices_vw[t.v2].second << "\n"; + of << "" << _vertices_vw[t.v0].second << "\n"; } - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void TopoFeature::get_triangle_as_gml_triangle(std::ofstream &outputfile, Triangle& t, bool verticalwall) { - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; +void TopoFeature::get_triangle_as_gml_triangle(std::ofstream& of, Triangle& t, bool verticalwall) { + of << "\n"; + of << "\n"; + of << "\n"; if (verticalwall == false) { - outputfile << "" << _vertices[t.v0].second << "\n"; - outputfile << "" << _vertices[t.v1].second << "\n"; - outputfile << "" << _vertices[t.v2].second << "\n"; - outputfile << "" << _vertices[t.v0].second << "\n"; + of << "" << _vertices[t.v0].second << "\n"; + of << "" << _vertices[t.v1].second << "\n"; + of << "" << _vertices[t.v2].second << "\n"; + of << "" << _vertices[t.v0].second << "\n"; } else { - outputfile << "" << _vertices_vw[t.v0].second << "\n"; - outputfile << "" << _vertices_vw[t.v1].second << "\n"; - outputfile << "" << _vertices_vw[t.v2].second << "\n"; - outputfile << "" << _vertices_vw[t.v0].second << "\n"; - } - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "" << _vertices_vw[t.v0].second << "\n"; + of << "" << _vertices_vw[t.v1].second << "\n"; + of << "" << _vertices_vw[t.v2].second << "\n"; + of << "" << _vertices_vw[t.v0].second << "\n"; + } + of << "\n"; + of << "\n"; + of << "\n"; } bool TopoFeature::get_attribute(std::string attributeName, std::string &attribute, std::string defaultValue) diff --git a/TopoFeature.h b/TopoFeature.h index ea905fce..1990e20d 100644 --- a/TopoFeature.h +++ b/TopoFeature.h @@ -45,8 +45,8 @@ class TopoFeature { virtual TopoClass get_class() = 0; virtual bool is_hard() = 0; virtual std::string get_mtl() = 0; - virtual void get_citygml(std::ofstream &outputfile) = 0; - virtual void get_citygml_imgeo(std::ofstream &outputfile) = 0; + virtual void get_citygml(std::ofstream& of) = 0; + virtual void get_citygml_imgeo(std::ofstream& of) = 0; virtual bool get_shape(OGRLayer*) = 0; std::string get_id(); @@ -71,8 +71,8 @@ class TopoFeature { bool get_top_level(); bool get_shape_features(OGRLayer* layer, std::string className); void get_obj(std::unordered_map< std::string, unsigned long > &dPts, std::string mtl, std::string &fs); - void get_imgeo_object_info(std::ofstream &outputfile, std::string id); - void get_citygml_attributes(std::ofstream &outputfile, std::unordered_map> attributes); + void get_imgeo_object_info(std::ofstream& of, std::string id); + void get_citygml_attributes(std::ofstream& of, std::unordered_map> attributes); protected: Polygon2* _p2; std::vector< std::vector > _p2z; @@ -100,8 +100,8 @@ class TopoFeature { void lift_each_boundary_vertices(float percentile); void lift_all_boundary_vertices_same_height(int height); - void get_triangle_as_gml_surfacemember(std::ofstream &outputfile, Triangle& t, bool verticalwall = false); - void get_triangle_as_gml_triangle(std::ofstream &outputfile, Triangle& t, bool verticalwall = false); + void get_triangle_as_gml_surfacemember(std::ofstream& of, Triangle& t, bool verticalwall = false); + void get_triangle_as_gml_triangle(std::ofstream& of, Triangle& t, bool verticalwall = false); bool get_attribute(std::string attributeName, std::string &attribute, std::string defaultValue = ""); }; @@ -116,7 +116,7 @@ class Flat: public TopoFeature { virtual TopoClass get_class() = 0; virtual bool is_hard() = 0; virtual bool lift() = 0; - virtual void get_citygml(std::ofstream &outputfile) = 0; + virtual void get_citygml(std::ofstream& of) = 0; protected: std::vector _zvaluesinside; bool lift_percentile(float percentile); @@ -132,7 +132,7 @@ class Boundary3D: public TopoFeature { virtual TopoClass get_class() = 0; virtual bool is_hard() = 0; virtual bool lift() = 0; - virtual void get_citygml(std::ofstream &outputfile) = 0; + virtual void get_citygml(std::ofstream& of) = 0; protected: int _simplification; void smooth_boundary(int passes = 1); @@ -148,7 +148,7 @@ class TIN: public TopoFeature { virtual TopoClass get_class() = 0; virtual bool is_hard() = 0; virtual bool lift() = 0; - virtual void get_citygml(std::ofstream &outputfile) = 0; + virtual void get_citygml(std::ofstream& of) = 0; bool buildCDT(); protected: int _simplification; diff --git a/Water.cpp b/Water.cpp index c4d73b2e..6b8de102 100644 --- a/Water.cpp +++ b/Water.cpp @@ -63,60 +63,60 @@ bool Water::lift() { return true; } -void Water::get_citygml(std::ofstream &outputfile) { - outputfile << "\n"; - outputfile << "get_id() << "\">\n"; - get_citygml_attributes(outputfile, _attributes); - outputfile << "\n"; - outputfile << "\n"; +void Water::get_citygml(std::ofstream& of) { + of << "\n"; + of << "get_id() << "\">\n"; + get_citygml_attributes(of, _attributes); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void Water::get_citygml_imgeo(std::ofstream &outputfile) { +void Water::get_citygml_imgeo(std::ofstream& of) { bool ondersteunend = _layername == "ondersteunendwaterdeel"; - outputfile << "\n"; + of << "\n"; if (ondersteunend) { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } else { - outputfile << "get_id() << "\">\n"; + of << "get_id() << "\">\n"; } - get_imgeo_object_info(outputfile, this->get_id()); - outputfile << "\n"; - outputfile << "\n"; + get_imgeo_object_info(of, this->get_id()); + of << "\n"; + of << "\n"; for (auto& t : _triangles) - get_triangle_as_gml_surfacemember(outputfile, t); + get_triangle_as_gml_surfacemember(of, t); for (auto& t : _triangles_vw) - get_triangle_as_gml_surfacemember(outputfile, t, true); - outputfile << "\n"; - outputfile << "\n"; + get_triangle_as_gml_surfacemember(of, t, true); + of << "\n"; + of << "\n"; std::string attribute; if (ondersteunend) { if (get_attribute("bgt-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } else { if (get_attribute("bgt-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } if (get_attribute("plus-type", attribute)) { - outputfile << "" << attribute << "\n"; + of << "" << attribute << "\n"; } - outputfile << "\n"; + of << "\n"; } - outputfile << "\n"; + of << "\n"; } bool Water::get_shape(OGRLayer* layer) { diff --git a/Water.h b/Water.h index c998bb03..3698077b 100644 --- a/Water.h +++ b/Water.h @@ -36,8 +36,8 @@ class Water: public Flat { Water(char *wkt, std::string layername, std::unordered_map> attributes, std::string pid, float heightref); bool lift(); bool add_elevation_point(Point2 &p, double z, float radius, LAS14Class lasclass, bool lastreturn); - void get_citygml(std::ofstream &outputfile); - void get_citygml_imgeo(std::ofstream &outputfile); + void get_citygml(std::ofstream& of); + void get_citygml_imgeo(std::ofstream& of); std::string get_mtl(); bool get_shape(OGRLayer * layer); TopoClass get_class(); diff --git a/io.cpp b/io.cpp index 808eabda..a8e2154f 100644 --- a/io.cpp +++ b/io.cpp @@ -46,107 +46,107 @@ void printProgressBar(int percent) { std::clog << percent << "% " << std::flush; } -void get_xml_header(std::ofstream &outputfile) { - outputfile << "\n"; +void get_xml_header(std::ofstream& of) { + of << "\n"; } -void get_citygml_namespaces(std::ofstream &outputfile) { - outputfile << "\n"; +void get_citygml_namespaces(std::ofstream& of) { + of << "\n"; } -void get_citygml_imgeo_namespaces(std::ofstream &outputfile) { - outputfile << "\n"; +void get_citygml_imgeo_namespaces(std::ofstream& of) { + of << "\n"; } -void get_polygon_lifted_gml(std::ofstream &outputfile, Polygon2* p2, double height, bool reverse) { +void get_polygon_lifted_gml(std::ofstream& of, Polygon2* p2, double height, bool reverse) { if (reverse) bg::reverse(*p2); - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; //-- oring auto r = bg::exterior_ring(*p2); - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; for (int i = 0; i < r.size(); i++) - outputfile << "" << bg::get<0>(r[i]) << " " << bg::get<1>(r[i]) << " " << height << "\n"; - outputfile << "" << bg::get<0>(r[0]) << " " << bg::get<1>(r[0]) << " " << height << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "" << bg::get<0>(r[i]) << " " << bg::get<1>(r[i]) << " " << height << "\n"; + of << "" << bg::get<0>(r[0]) << " " << bg::get<1>(r[0]) << " " << height << "\n"; + of << "\n"; + of << "\n"; //-- irings auto irings = bg::interior_rings(*p2); for (Ring2& r : irings) { - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; for (int i = 0; i < r.size(); i++) - outputfile << "" << bg::get<0>(r[i]) << " " << bg::get<1>(r[i]) << " " << height << "\n"; - outputfile << "" << bg::get<0>(r[0]) << " " << bg::get<1>(r[0]) << " " << height << "\n"; - outputfile << "\n"; - outputfile << "\n"; + of << "" << bg::get<0>(r[i]) << " " << bg::get<1>(r[i]) << " " << height << "\n"; + of << "" << bg::get<0>(r[0]) << " " << bg::get<1>(r[0]) << " " << height << "\n"; + of << "\n"; + of << "\n"; } - outputfile << "\n"; - outputfile << "\n"; + of << "\n"; + of << "\n"; if (reverse) bg::reverse(*p2); } -void get_extruded_line_gml(std::ofstream &outputfile, Point2* a, Point2* b, double high, double low, bool reverse) { - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "" << bg::get<0>(b) << " " << bg::get<1>(b) << " " << low << "\n"; - outputfile << "" << bg::get<0>(a) << " " << bg::get<1>(a) << " " << low << "\n"; - outputfile << "" << bg::get<0>(a) << " " << bg::get<1>(a) << " " << high << "\n"; - outputfile << "" << bg::get<0>(b) << " " << bg::get<1>(b) << " " << high << "\n"; - outputfile << "" << bg::get<0>(b) << " " << bg::get<1>(b) << " " << low << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; - outputfile << "\n"; +void get_extruded_line_gml(std::ofstream& of, Point2* a, Point2* b, double high, double low, bool reverse) { + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "" << bg::get<0>(b) << " " << bg::get<1>(b) << " " << low << "\n"; + of << "" << bg::get<0>(a) << " " << bg::get<1>(a) << " " << low << "\n"; + of << "" << bg::get<0>(a) << " " << bg::get<1>(a) << " " << high << "\n"; + of << "" << bg::get<0>(b) << " " << bg::get<1>(b) << " " << high << "\n"; + of << "" << bg::get<0>(b) << " " << bg::get<1>(b) << " " << low << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; + of << "\n"; } -void get_extruded_lod1_block_gml(std::ofstream &outputfile, Polygon2* p2, double high, double low) { +void get_extruded_lod1_block_gml(std::ofstream& of, Polygon2* p2, double high, double low) { //-- get floor - get_polygon_lifted_gml(outputfile, p2, low, false); + get_polygon_lifted_gml(of, p2, low, false); //-- get roof - get_polygon_lifted_gml(outputfile, p2, high, true); + get_polygon_lifted_gml(of, p2, high, true); //-- get the walls auto r = bg::exterior_ring(*p2); for (int i = 0; i < (r.size() - 1); i++) - get_extruded_line_gml(outputfile, &r[i], &r[i + 1], high, low, false); + get_extruded_line_gml(of, &r[i], &r[i + 1], high, low, false); } bool is_string_integer(std::string s, int min, int max) { diff --git a/io.h b/io.h index ca7e30d9..f6d39849 100644 --- a/io.h +++ b/io.h @@ -33,13 +33,13 @@ #include "TopoFeature.h" void printProgressBar(int percent); -void get_xml_header(std::ofstream &outputfile); -void get_citygml_namespaces(std::ofstream &outputfile); -void get_citygml_imgeo_namespaces(std::ofstream &outputfile); +void get_xml_header(std::ofstream& of); +void get_citygml_namespaces(std::ofstream& of); +void get_citygml_imgeo_namespaces(std::ofstream& of); -void get_polygon_lifted_gml(std::ofstream &outputfile, Polygon2* p2, double height, bool reverse = false); -void get_extruded_line_gml(std::ofstream &outputfile, Point2* a, Point2* b, double high, double low, bool reverse = false); -void get_extruded_lod1_block_gml(std::ofstream &outputfile, Polygon2* p2, double high, double low = 0.0); +void get_polygon_lifted_gml(std::ofstream& of, Polygon2* p2, double height, bool reverse = false); +void get_extruded_line_gml(std::ofstream& of, Point2* a, Point2* b, double high, double low, bool reverse = false); +void get_extruded_lod1_block_gml(std::ofstream& of, Polygon2* p2, double high, double low = 0.0); bool is_string_integer(std::string s, int min = 0, int max = 1e6); float z_to_float(int z); diff --git a/main.cpp b/main.cpp index e7a18199..2d4de6b2 100644 --- a/main.cpp +++ b/main.cpp @@ -58,7 +58,7 @@ int main(int argc, const char * argv[]) { "This is free software, and you are welcome to redistribute it\n" "under certain conditions; for details run 3dfier with the '--license' option.\n"; - std::string outputFilename; + std::string ofname; //-- reading the config file if (argc == 2) { @@ -78,7 +78,7 @@ int main(int argc, const char * argv[]) { } } else if (argc == 4 && (std::string)argv[2] == "-o" && boost::filesystem::path(argv[1]).extension() == ".yml") { - outputFilename = argv[3]; + ofname = argv[3]; } else { std::clog << licensewarning << std::endl; @@ -366,41 +366,41 @@ int main(int argc, const char * argv[]) { if (n["vertical_exaggeration"]) z_exaggeration = n["vertical_exaggeration"].as(); - std::ofstream outputfile; + std::ofstream of; if (format != "Shapefile" && format != "CityGML-Multifile" && format != "CityGML-IMGeo-Multifile") - outputfile.open(outputFilename); + of.open(ofname); if (format == "CityGML") { std::clog << "CityGML output\n"; - map3d.get_citygml(outputfile); + map3d.get_citygml(of); } else if (format == "CityGML-Multifile") { std::clog << "CityGML-Multifile output\n"; - map3d.get_citygml_multifile(outputFilename); + map3d.get_citygml_multifile(ofname); } else if (format == "CityGML-IMGeo") { std::clog << "CityGML-IMGeo output\n"; - map3d.get_citygml_imgeo(outputfile); + map3d.get_citygml_imgeo(of); } else if (format == "CityGML-IMGeo-Multifile") { std::clog << "CityGML-IMGeo-Multifile output\n"; - map3d.get_citygml_imgeo_multifile(outputFilename); + map3d.get_citygml_imgeo_multifile(ofname); } else if (format == "OBJ") { std::clog << "OBJ output\n"; - map3d.get_obj_per_feature(outputfile, z_exaggeration); + map3d.get_obj_per_feature(of, z_exaggeration); } else if (format == "OBJ-NoID") { std::clog << "OBJ (without IDs) output\n"; - map3d.get_obj_per_class(outputfile, z_exaggeration); + map3d.get_obj_per_class(of, z_exaggeration); } else if (format == "CSV-BUILDINGS") { std::clog << "CSV output (only of the buildings)\n"; - map3d.get_csv_buildings(outputfile); + map3d.get_csv_buildings(of); } else if (format == "Shapefile") { std::clog << "Shapefile output\n"; - if (map3d.get_shapefile(outputFilename)) { + if (map3d.get_shapefile(ofname)) { std::clog << "Shapefile written\n"; } else @@ -409,7 +409,7 @@ int main(int argc, const char * argv[]) { return 0; } } - outputfile.close(); + of.close(); printf("File written in %d ms\n", std::clock() - startFileWriting);