MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / process

Method process

qCC/ccCommandCrossSection.cpp:19–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17{}
18
19bool CommandCrossSection::process(ccCommandLineInterface &cmd)
20{
21 cmd.print("[CROSS SECTION]");
22
23 static QString s_xmlCloudCompare = "CloudCompare";
24 static QString s_xmlBoxThickness = "BoxThickness";
25 static QString s_xmlBoxCenter = "BoxCenter";
26 static QString s_xmlRepeatDim = "RepeatDim";
27 static QString s_xmlRepeatGap = "RepeatGap";
28 static QString s_xmlFilePath = "FilePath";
29 static QString s_outputXmlFilePath = "OutputFilePath";
30
31 //expected argument: XML file
32 if (cmd.arguments().empty())
33 return cmd.error(QString("Missing parameter: XML parameters file after \"-%1\"").arg(COMMAND_CROSS_SECTION));
34 QString xmlFilename = cmd.arguments().takeFirst();
35
36 //read the XML file
37 CCVector3 boxCenter(0, 0, 0);
38 CCVector3 boxThickness(0, 0, 0);
39 bool repeatDim[3] = { false, false, false };
40 double repeatGap = 0.0;
41 bool inside = true;
42 bool autoCenter = true;
43 QString inputFilePath;
44 QString outputFilePath;
45 {
46 QFile file(xmlFilename);
47 if (!file.open(QFile::ReadOnly | QFile::Text))
48 {
49 return cmd.error(QString("Couldn't open XML file '%1'").arg(xmlFilename));
50 }
51
52 //read file content
53 QXmlStreamReader stream(&file);
54
55 //expected: CloudCompare
56 if (!stream.readNextStartElement()
57 || stream.name() != s_xmlCloudCompare)
58 {
59 return cmd.error(QString("Invalid XML file (should start by '<%1>')").arg(s_xmlCloudCompare));
60 }
61
62 unsigned mandatoryCount = 0;
63 while (stream.readNextStartElement()) //loop over the elements
64 {
65 if (stream.name() == s_xmlBoxThickness)
66 {
67 QXmlStreamAttributes attributes = stream.attributes();
68 if (!readVector(attributes, boxThickness, s_xmlBoxThickness, cmd))
69 return false;
70 stream.skipCurrentElement();
71 ++mandatoryCount;
72 }
73 else if (stream.name() == s_xmlBoxCenter)
74 {
75 QXmlStreamAttributes attributes = stream.attributes();
76 if (!readVector(attributes, boxCenter, s_xmlBoxCenter, cmd))

Callers

nothing calls this directly

Calls 15

QDirClass · 0.85
CommandLoadClass · 0.85
printMethod · 0.80
errorMethod · 0.80
existsMethod · 0.80
warningMethod · 0.80
entryListMethod · 0.80
removeCloudsMethod · 0.80
removeMeshesMethod · 0.80
cdMethod · 0.80
exportEntityMethod · 0.80
QStringClass · 0.70

Tested by

no test coverage detected