forked from varoudis/depthmapX
-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathaxialparser.cpp
More file actions
104 lines (90 loc) · 3.34 KB
/
axialparser.cpp
File metadata and controls
104 lines (90 loc) · 3.34 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
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
// Copyright (C) 2017 Christian Sailer
// This program 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.
// This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#include "axialparser.h"
#include "parsingutils.h"
#include "exceptions.h"
#include "salalib/entityparsing.h"
#include "runmethods.h"
#include <cstring>
using namespace depthmapX;
AxialParser::AxialParser() : m_runFewestLines(false), m_runAnalysis(false), m_choice(false), m_local(false), m_rra(false)
{
}
std::string AxialParser::getModeName() const
{
return "AXIAL";
}
std::string AxialParser::getHelp() const
{
return "Mode options for Axial Analysis:\n"\
" -xl <x>,<y> Calculate all lines map from this seed point (can be used more than once)\n"
" -xf Calculate fewest lines map from all lines map\n"\
" -xa <radius/list of radii> run axial anlysis with specified radii\n"\
" All modes expect to find the required input in the in graph\n"\
" Any combination of flags above can be specified, they will always be run in the order -aa -af -au -ax\n"\
" Further flags for axial analysis are:\n"\
" -xac Include choice (betweenness)\n"\
" -xal Include local measures\n"\
" -xar Include RA, RRA and total depth\n"\
" -xaw <map attribute name> perform weighted analysis using this attribute\n"\
"\n";
}
void AxialParser::parse(int argc, char **argv)
{
for (int i = 1; i < argc; ++i)
{
if (std::strcmp(argv[i], "-xl") == 0)
{
ENFORCE_ARGUMENT("-xl", i)
m_allAxesRoots.push_back(EntityParsing::parsePoint(argv[i]));
}
else if(std::strcmp(argv[i], "-xf") == 0)
{
m_runFewestLines = true;
}
else if (std::strcmp(argv[i], "-xa") == 0)
{
ENFORCE_ARGUMENT("-xa", i)
if (m_runAnalysis)
{
throw CommandLineException("-xa can only be used once");
}
m_radii = depthmapX::parseRadiusList(argv[i]);
m_runAnalysis = true;
}
else if (std::strcmp(argv[i], "-xal") == 0)
{
m_local = true;
}
else if (std::strcmp(argv[i], "-xac") == 0)
{
m_choice = true;
}
else if(std::strcmp(argv[i], "-xar") == 0)
{
m_rra = true;
}
else if (std::strcmp(argv[i], "-xaw") == 0)
{
ENFORCE_ARGUMENT("-xaw", i)
m_attribute = argv[i];
}
}
if (!runAllLines() && !runFewestLines() && !runUnlink() && !runAnalysis())
{
throw CommandLineException("No axial analysis mode present");
}
}
void AxialParser::run(const CommandLineParser &clp, IPerformanceSink &perfWriter) const
{
dm_runmethods::runAxialAnalysis(clp, *this, perfWriter);
}