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[])
assert(!appli.IsNull());
const std::string group = appli->GetDocTags().size() > 0 ? appli->GetDocTags()[0] : "";
assert(!group.empty());
std::map<ParameterType, std::string> parameterTypeToString;
parameterTypeToString[ParameterType_Empty] = "QgsProcessingParameterBoolean";
parameterTypeToString[ParameterType_Bool] = "QgsProcessingParameterBoolean";
......@@ -106,12 +109,11 @@ int main(int argc, char* argv[])
Parameter::Pointer param = appli->GetParameterByKey(appKeyList[i]);
if (param->GetMandatory())
{
ParameterType type = appli->GetParameterType(appKeyList[i]);
if (type == ParameterType_OutputImage )
{
output_parameter_name = appKeyList[i];
hasRasterOutput = true;
}
if (appli->GetParameterType(appKeyList[i]) == ParameterType_OutputImage)
{
output_parameter_name = appKeyList[i];
hasRasterOutput = true;
}
}
}
}
......@@ -122,15 +124,13 @@ int main(int argc, char* argv[])
dFile << module << "|" << output_parameter_name << std::endl;
dFile << appli->GetDescription() << std::endl;
const std::string group = appli->GetDocTags().size() > 0 ? appli->GetDocTags()[0] : "UNCLASSIFIED";
dFile << group << std::endl;
for (unsigned int i = 0; i < nbOfParam; i++)
{
const std::string name = appKeyList[i];
Parameter::Pointer param = appli->GetParameterByKey(name);
ParameterType type = appli->GetParameterType(name);
const Parameter::Pointer param = appli->GetParameterByKey(name);
const ParameterType type = appli->GetParameterType(name);
const std::string description = param->GetName();
if ( type == ParameterType_Group ||
type == ParameterType_OutputProcessXML ||
......@@ -239,7 +239,7 @@ int main(int argc, char* argv[])
{
dFile << "|4"; //QgsProcessing.TypeFile"
}
else if(type ==ParameterType_String)
else if(type == ParameterType_String)
{
// Below line is interpreted in qgis processing as
// 1. default_value = None
......@@ -248,7 +248,7 @@ int main(int argc, char* argv[])
// please refer to documetation of QgsProcessingParameterString.
default_value = "None|False";
}
else if(type ==ParameterType_StringList)
else if(type == ParameterType_StringList)
{
// Below line is interpreted in qgis processing as
// 1. default_value = None
......@@ -262,13 +262,13 @@ int main(int argc, char* argv[])
{
// 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
}
else if(type == ParameterType_Bool)
{
default_value = appli->GetParameterAsString(name);
default_value = appli->GetParameterAsString(name);
}
else if(type == ParameterType_Choice)
{
......@@ -328,7 +328,7 @@ int main(int argc, char* argv[])
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();
......
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