Class: QgsServerParameterDefinition¶
- class qgis.server.QgsServerParameterDefinition¶
Bases:
sip.wrapper
Definition of a parameter with basic conversion methods
New in version 3.4.
QgsServerParameterDefinition(type: QVariant.Type = QVariant.String, defaultValue: Any = None) Constructor for QgsServerParameterDefinition.
- Parameters
type – The type of the parameter
defaultValue – The default value of the parameter
QgsServerParameterDefinition(
QgsServerParameterDefinition
)Methods
Returns
True
if the parameter is valid,False
otherwise.Loads the data associated to the parameter converted into an url.
Raises an exception in case of an invalid parameters.
Converts the parameter into a boolean.
Converts the parameter into a color.
Converts the parameter into a list of colors.
Converts the parameter into a double.
Converts the parameter into a list of doubles.
Converts the parameter into a list of QGIS expressions.
Converts the parameter into a list of geometries.
Converts the parameter into an integer.
Converts the parameter into a list of integers.
Converts the parameter into a list of OGC filters.
Converts the parameter into a rectangle.
Converts the parameter into a string.
Converts the parameter into a list of strings
Converts the parameter into an url.
Returns the type of the parameter as a string.
Attributes
- isValid(self) bool ¶
Returns
True
if the parameter is valid,False
otherwise.- Return type
bool
- loadUrl(self) Tuple[str, bool] ¶
Loads the data associated to the parameter converted into an url.
- Parameters
ok –
True
if there’s no error during the load,False
otherwise- Return type
Tuple[str, bool]
- Returns
The content loaded
New in version 3.4.
- mDefaultValue¶
- mType¶
- mValue¶
- raiseError(msg: str)¶
Raises an exception in case of an invalid parameters.
- Parameters
msg (str) – The message describing the exception
- Raises
QgsBadRequestException – Invalid parameter exception
- toBool(self) bool ¶
Converts the parameter into a boolean.
- Return type
bool
- Returns
A boolean
- toColor(self) Tuple[QColor, bool] ¶
Converts the parameter into a color.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwise- Return type
Tuple[QColor, bool]
- Returns
A color
- toColorList(self, delimiter: str = ',') Tuple[List[QColor], bool] ¶
Converts the parameter into a list of colors.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwisedelimiter (str = ',') – The character used for delimiting
- Return type
Tuple[List[QColor], bool]
- Returns
A list of colors
- toDouble(self) Tuple[float, bool] ¶
Converts the parameter into a double.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwise- Return type
Tuple[float, bool]
- Returns
A double
- toDoubleList(self, delimiter: str = ',') Tuple[List[float], bool] ¶
Converts the parameter into a list of doubles.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwisedelimiter (str = ',') – The character used for delimiting
- Return type
Tuple[List[float], bool]
- Returns
A list of doubles
- toExpressionList(self) List[str] ¶
Converts the parameter into a list of QGIS expressions.
- Return type
List[str]
- Returns
A list of strings
New in version 3.24.
- toGeomList(self, delimiter: str = ',') Tuple[List[QgsGeometry], bool] ¶
Converts the parameter into a list of geometries.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwisedelimiter (str = ',') – The character used for delimiting
- Return type
Tuple[List[QgsGeometry], bool]
- Returns
A list of geometries
- toInt(self) Tuple[int, bool] ¶
Converts the parameter into an integer.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwise- Return type
Tuple[int, bool]
- Returns
An integer
- toIntList(self, delimiter: str = ',') Tuple[List[int], bool] ¶
Converts the parameter into a list of integers.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwisedelimiter (str = ',') – The character used for delimiting
- Return type
Tuple[List[int], bool]
- Returns
A list of integers
- toOgcFilterList(self) List[str] ¶
Converts the parameter into a list of OGC filters.
- Return type
List[str]
- Returns
A list of strings
New in version 3.24.
- toRectangle(self) Tuple[QgsRectangle, bool] ¶
Converts the parameter into a rectangle.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwise- Return type
Tuple[
QgsRectangle
, bool]- Returns
A rectangle
- toString(self, defaultValue: bool = False) str ¶
Converts the parameter into a string. If
defaultValue
is true and current value is empty, then the default value is returned.- Parameters
defaultValue (bool = False) –
- Return type
str
- toStringList(self, delimiter: str = ',', skipEmptyParts: bool = True) List[str] ¶
Converts the parameter into a list of strings
- Parameters
delimiter (str = ',') – The character used for delimiting
skipEmptyParts (bool = True) – To use QString.SkipEmptyParts for splitting
- Return type
List[str]
- Returns
A list of strings
- toUrl(self) Tuple[QUrl, bool] ¶
Converts the parameter into an url.
- Parameters
ok –
True
if there’s no error during the conversion,False
otherwise- Return type
Tuple[QUrl, bool]
- Returns
An url
New in version 3.4.
- typeName(self) str ¶
Returns the type of the parameter as a string.
- Return type
str