Skip to content
Snippets Groups Projects
Commit 61dfdffe authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

ENH: address comments from code review

parent dfdf6f9c
No related branches found
No related tags found
1 merge request!74Review: "add Wrapper/QGIS to generate qgis descriptors for processing plugin"
...@@ -50,6 +50,9 @@ int main(int argc, char* argv[]) ...@@ -50,6 +50,9 @@ int main(int argc, char* argv[])
assert(!appli.IsNull()); assert(!appli.IsNull());
const std::string group = appli->GetDocTags().size() > 0 ? appli->GetDocTags()[0] : "";
assert(!group.empty());
std::map<ParameterType, std::string> parameterTypeToString; std::map<ParameterType, std::string> parameterTypeToString;
parameterTypeToString[ParameterType_Empty] = "QgsProcessingParameterBoolean"; parameterTypeToString[ParameterType_Empty] = "QgsProcessingParameterBoolean";
parameterTypeToString[ParameterType_Bool] = "QgsProcessingParameterBoolean"; parameterTypeToString[ParameterType_Bool] = "QgsProcessingParameterBoolean";
...@@ -106,12 +109,11 @@ int main(int argc, char* argv[]) ...@@ -106,12 +109,11 @@ int main(int argc, char* argv[])
Parameter::Pointer param = appli->GetParameterByKey(appKeyList[i]); Parameter::Pointer param = appli->GetParameterByKey(appKeyList[i]);
if (param->GetMandatory()) if (param->GetMandatory())
{ {
ParameterType type = appli->GetParameterType(appKeyList[i]); if (appli->GetParameterType(appKeyList[i]) == ParameterType_OutputImage)
if (type == ParameterType_OutputImage ) {
{ output_parameter_name = appKeyList[i];
output_parameter_name = appKeyList[i]; hasRasterOutput = true;
hasRasterOutput = true; }
}
} }
} }
} }
...@@ -122,15 +124,13 @@ int main(int argc, char* argv[]) ...@@ -122,15 +124,13 @@ int main(int argc, char* argv[])
dFile << module << "|" << output_parameter_name << std::endl; dFile << module << "|" << output_parameter_name << std::endl;
dFile << appli->GetDescription() << std::endl; dFile << appli->GetDescription() << std::endl;
const std::string group = appli->GetDocTags().size() > 0 ? appli->GetDocTags()[0] : "UNCLASSIFIED";
dFile << group << std::endl; dFile << group << std::endl;
for (unsigned int i = 0; i < nbOfParam; i++) for (unsigned int i = 0; i < nbOfParam; i++)
{ {
const std::string name = appKeyList[i]; const std::string name = appKeyList[i];
const Parameter::Pointer param = appli->GetParameterByKey(name);
Parameter::Pointer param = appli->GetParameterByKey(name); const ParameterType type = appli->GetParameterType(name);
ParameterType type = appli->GetParameterType(name);
const std::string description = param->GetName(); const std::string description = param->GetName();
if ( type == ParameterType_Group || if ( type == ParameterType_Group ||
type == ParameterType_OutputProcessXML || type == ParameterType_OutputProcessXML ||
...@@ -239,7 +239,7 @@ int main(int argc, char* argv[]) ...@@ -239,7 +239,7 @@ int main(int argc, char* argv[])
{ {
dFile << "|4"; //QgsProcessing.TypeFile" dFile << "|4"; //QgsProcessing.TypeFile"
} }
else if(type ==ParameterType_String) else if(type == ParameterType_String)
{ {
// Below line is interpreted in qgis processing as // Below line is interpreted in qgis processing as
// 1. default_value = None // 1. default_value = None
...@@ -248,7 +248,7 @@ int main(int argc, char* argv[]) ...@@ -248,7 +248,7 @@ int main(int argc, char* argv[])
// please refer to documetation of QgsProcessingParameterString. // please refer to documetation of QgsProcessingParameterString.
default_value = "None|False"; default_value = "None|False";
} }
else if(type ==ParameterType_StringList) else if(type == ParameterType_StringList)
{ {
// Below line is interpreted in qgis processing as // Below line is interpreted in qgis processing as
// 1. default_value = None // 1. default_value = None
...@@ -262,13 +262,13 @@ int main(int argc, char* argv[]) ...@@ -262,13 +262,13 @@ int main(int argc, char* argv[])
{ {
// default is None and nothing to add to dFile // default is None and nothing to add to dFile
} }
else if(type ==ParameterType_ListView) else if(type == ParameterType_ListView)
{ {
// default is None and nothing to add to dFile // default is None and nothing to add to dFile
} }
else if(type == ParameterType_Bool) else if(type == ParameterType_Bool)
{ {
default_value = appli->GetParameterAsString(name); default_value = appli->GetParameterAsString(name);
} }
else if(type == ParameterType_Choice) else if(type == ParameterType_Choice)
{ {
...@@ -328,7 +328,7 @@ int main(int argc, char* argv[]) ...@@ -328,7 +328,7 @@ int main(int argc, char* argv[])
if(hasRasterOutput) if(hasRasterOutput)
{ {
dFile << "*QgsProcessingParameterEnum|outputpixeltype|Output pixel type|unit8;int;float;double|False|2|True" << std::endl; dFile << "*QgsProcessingParameterEnum|outputpixeltype|Output pixel type|uint8;int;float;double|False|2|True" << std::endl;
} }
dFile.close(); dFile.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment