-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisegment.hpp
52 lines (43 loc) · 1.64 KB
/
isegment.hpp
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
// SPDX-FileCopyrightText: 2018-2024 Petros Koutsolampros
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
// Interface to handle different kinds of VGA analysis
#include "analysisresult.hpp"
#include "radiustype.hpp"
#include "shapegraph.hpp"
#include "genlib/comm.hpp"
#include "genlib/stringutils.hpp"
#include <string>
class ISegment {
public:
virtual std::string getAnalysisName() const = 0;
virtual AnalysisResult run(Communicator *comm, ShapeGraph &map, bool simpleVersion) = 0;
virtual ~ISegment() {}
// Axial map helper: convert a radius for angular analysis
static std::string makeFloatRadiusText(double radius) {
std::string radiusText;
if (radius > 100.0) {
radiusText = dXstring::formatString(radius, "%.f");
} else if (radius < 0.1) {
radiusText = dXstring::formatString(radius, "%.4f");
} else {
radiusText = dXstring::formatString(radius, "%.2f");
}
return radiusText;
}
static std::string makeRadiusText(RadiusType radiusType, double radius) {
std::string radiusText;
if (radius != -1) {
if (radiusType == RadiusType::TOPOLOGICAL) {
radiusText = std::string(" R") +
dXstring::formatString(static_cast<int>(radius), "%d") + " step";
} else if (radiusType == RadiusType::METRIC) {
radiusText = std::string(" R") + makeFloatRadiusText(radius) + " metric";
} else { // radius angular
radiusText = std::string(" R") + makeFloatRadiusText(radius);
}
}
return radiusText;
}
};