-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexportutils.cpp
More file actions
26 lines (24 loc) · 1.13 KB
/
exportutils.cpp
File metadata and controls
26 lines (24 loc) · 1.13 KB
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
// SPDX-FileCopyrightText: 2000-2010 University College London, Alasdair Turner
// SPDX-FileCopyrightText: 2011-2012 Tasos Varoudis
// SPDX-FileCopyrightText: 2024 Petros Koutsolampros
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "exportutils.hpp"
void exportUtils::writeMapShapesAsCat(ShapeMap &map, std::ostream &stream) {
stream << "CAT" << std::endl;
for (auto &refShape : map.getAllShapes()) {
SalaShape &shape = refShape.second;
if (shape.isPolyLine() || shape.isPolygon()) {
stream << "Begin " << (shape.isPolyLine() ? "Polyline" : "Polygon") << std::endl;
for (Point2f p : shape.points) {
stream << p.x << " " << p.y << std::endl;
}
stream << "End " << (shape.isPolyLine() ? "Polyline" : "Polygon") << std::endl;
} else if (shape.isLine()) {
stream << "Begin Polyline" << std::endl;
stream << shape.getLine().ax() << " " << shape.getLine().ay() << std::endl;
stream << shape.getLine().bx() << " " << shape.getLine().by() << std::endl;
stream << "End Polyline" << std::endl;
}
}
}