forked from tudelft3d/3dfier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map3d.h
137 lines (119 loc) · 5.35 KB
/
Map3d.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
3dfier: takes 2D GIS datasets and "3dfies" to create 3D city models.
Copyright (C) 2015-2016 3D geoinformation research group, TU Delft
This file is part of 3dfier.
3dfier is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
3dfier is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with 3difer. If not, see <http://www.gnu.org/licenses/>.
For any information or further details about the use of 3dfier, contact
Hugo Ledoux
Faculty of Architecture & the Built Environment
Delft University of Technology
Julianalaan 134, Delft 2628BL, the Netherlands
*/
#ifndef __3dfier__Map3d__
#define __3dfier__Map3d__
#include "definitions.h"
#include "geomtools.h"
#include "TopoFeature.h"
#include "Building.h"
#include "Terrain.h"
#include "Forest.h"
#include "Water.h"
#include "Road.h"
#include "Separation.h"
#include "Bridge.h"
typedef std::pair<Box2, TopoFeature*> PairIndexed;
class Map3d {
public:
Map3d();
~Map3d();
bool add_polygons_files(std::vector<PolygonFile> &files);
bool add_las_file(PointFile pointFile);
void stitch_lifted_features();
bool construct_rtree();
bool threeDfy(bool stitching = true);
bool construct_CDT();
void add_elevation_point(liblas::Point const& laspt);
unsigned long get_num_polygons();
const std::vector<TopoFeature*>& get_polygons3d();
Box2 get_bbox();
liblas::Bounds<double> get_bounds();
void get_citygml(std::ofstream& of);
void get_citygml_multifile(std::string);
void create_citygml_header(std::ofstream& of);
void get_citygml_imgeo(std::ofstream& of);
void get_citygml_imgeo_multifile(std::string ofname);
bool get_gdal_output(std::string filename, std::string drivername, bool multi);
void get_csv_buildings(std::ofstream &outputfile);
void get_csv_buildings_multiple_heights(std::ofstream &outputfile);
void get_csv_buildings_all_elevation_points(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);
bool get_shapefile(std::string filename);
bool get_shapefile2d(std::string filename);
void set_building_heightref_roof(float heightref);
void set_building_heightref_floor(float heightref);
void set_building_include_floor(bool include);
void set_building_triangulate(bool triangulate);
void set_building_lod(int lod);
void set_terrain_simplification(int simplification);
void set_forest_simplification(int simplification);
void set_terrain_innerbuffer(float innerbuffer);
void set_forest_innerbuffer(float innerbuffer);
void set_forest_ground_points_only(bool only_ground_points);
void set_water_heightref(float heightref);
void set_road_heightref(float heightref);
void set_separation_heightref(float heightref);
void set_bridge_heightref(float heightref);
void set_radius_vertex_elevation(float radius);
void set_building_radius_vertex_elevation(float radius);
void set_threshold_jump_edges(float threshold);
void set_use_vertical_walls(bool useverticalwalls);
void set_requested_extent(double xmin, double ymin, double xmax, double ymax);
private:
float _building_heightref_roof;
float _building_heightref_floor;
bool _building_triangulate;
int _building_lod;
bool _building_include_floor;
bool _use_vertical_walls;
int _terrain_simplification;
int _forest_simplification;
float _terrain_innerbuffer;
float _forest_innerbuffer;
bool _forest_ground_points_only;
float _water_heightref;
float _road_heightref;
float _separation_heightref;
float _bridge_heightref;
float _radius_vertex_elevation;
float _building_radius_vertex_elevation;
int _threshold_jump_edges; //-- in cm/integer
Box2 _bbox;
Box2 _requestedExtent;
NodeColumn _nc;
std::vector<TopoFeature*> _lsFeatures;
std::vector<std::string> _allowed_layers;
bgi::rtree< PairIndexed, bgi::rstar<16> > _rtree;
#if GDAL_VERSION_MAJOR < 2
bool extract_and_add_polygon(OGRDataSource* dataSource, PolygonFile* file);
#else
bool extract_and_add_polygon(GDALDataset* dataSource, PolygonFile* file);
OGRLayer* create_gdal_layer(GDALDriver *driver, std::string filename, std::string layername, AttributeMap attributes, bool addHeightAttributes);
#endif
void extract_feature(OGRFeature * f, std::string layerName, const char * idfield, const char * heightfield, std::string layertype, bool multiple_heights);
void stitch_one_vertex(TopoFeature* f, int ringi, int pi, std::vector< std::tuple<TopoFeature*, int, int> >& star);
void stitch_jumpedge(TopoFeature* f1, int ringi1, int pi1, TopoFeature* f2, int ringi2, int pi2);
void stitch_average(TopoFeature* f1, int ringi1, int pi1, TopoFeature* f2, int ringi2, int pi2);
void collect_adjacent_features(TopoFeature* f);
};
#endif