Skip to content

Commit

Permalink
Merge branch 'gitflow'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Commandeur committed Aug 16, 2018
2 parents 7d1e167 + 13cc19f commit 0c76ebf
Show file tree
Hide file tree
Showing 27 changed files with 2,119 additions and 631 deletions.
23 changes: 14 additions & 9 deletions src/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
#include "io.h"

float Bridge::_heightref;
bool Bridge::_flatten;

Bridge::Bridge(char *wkt, std::string layername, AttributeMap attributes, std::string pid, float heightref)
Bridge::Bridge(char *wkt, std::string layername, AttributeMap attributes, std::string pid, float heightref, bool flatten)
: Boundary3D(wkt, layername, attributes, pid) {
_heightref = heightref;
_flatten = flatten;
}

TopoClass Bridge::get_class() {
Expand All @@ -48,19 +50,22 @@ std::string Bridge::get_mtl() {
return "usemtl Bridge";
}

bool Bridge::add_elevation_point(Point2 &p, double z, float radius, int lasclass) {
if (point_in_polygon(p, *(_p2))) {
Boundary3D::add_elevation_point(p, z, radius, lasclass);
bool Bridge::add_elevation_point(Point2 &p, double z, float radius, int lasclass, bool within) {
if (!within || (within && point_in_polygon(p, *(_p2)))) {
return Boundary3D::add_elevation_point(p, z, radius, lasclass, within);
}
return true;
}

bool Bridge::lift() {
lift_each_boundary_vertices(_heightref);
//smooth_boundary(5);
return true;
}

bool Bridge::get_flatten() {
return _flatten;
}

void Bridge::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts) {
nlohmann::json f;
f["type"] = "Bridge";
Expand All @@ -74,17 +79,17 @@ void Bridge::get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsi

void Bridge::get_citygml(std::wostream& of) {
of << "<cityObjectMember>";
of << "<brg:Bridge gml:id=\"" << this->get_id() << "\">";
of << "<bri:Bridge gml:id=\"" << this->get_id() << "\">";
get_citygml_attributes(of, _attributes);
of << "<brg:lod1MultiSurface>";
of << "<bri:lod1MultiSurface>";
of << "<gml:MultiSurface>";
for (auto& t : _triangles)
get_triangle_as_gml_surfacemember(of, t);
for (auto& t : _triangles_vw)
get_triangle_as_gml_surfacemember(of, t, true);
of << "</gml:MultiSurface>";
of << "</brg:lod1MultiSurface>";
of << "</brg:Bridge>";
of << "</bri:lod1MultiSurface>";
of << "</bri:Bridge>";
of << "</cityObjectMember>";
}

Expand Down
6 changes: 4 additions & 2 deletions src/Bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@

class Bridge: public Boundary3D {
public:
Bridge(char *wkt, std::string layername, AttributeMap attributes, std::string pid, float heightref);
Bridge(char *wkt, std::string layername, AttributeMap attributes, std::string pid, float heightref, bool flatten);

bool lift();
bool add_elevation_point(Point2 &p, double z, float radius, int lasclass);
bool add_elevation_point(Point2 &p, double z, float radius, int lasclass, bool within);
void get_citygml(std::wostream& of);
void get_citygml_imgeo(std::wostream& of);
void get_cityjson(nlohmann::json& j, std::unordered_map<std::string,unsigned long> &dPts);
std::string get_mtl();
bool get_shape(OGRLayer* layer, bool writeAttributes, AttributeMap extraAttributes = AttributeMap());
TopoClass get_class();
bool is_hard();
bool get_flatten();
private:
static float _heightref;
static bool _flatten;
};

#endif /* Bridge_h */
Loading

0 comments on commit 0c76ebf

Please sign in to comment.