Skip to content

Commit

Permalink
Merge pull request #60180 from mhugent/server_empty_values_highlight_…
Browse files Browse the repository at this point in the history
…labels

Server empty values in highlight labels parameters
  • Loading branch information
mhugent authored Jan 27, 2025
2 parents 55c975c + 15e7b51 commit 3f5f900
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 63 deletions.
12 changes: 8 additions & 4 deletions python/PyQt6/server/auto_generated/qgsserverparameters.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,46 @@ Converts the parameter into a list of strings
:return: A list of strings
%End

QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
QList<int> toIntList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of integers.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of integers
%End

QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;
QList<double> toDoubleList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of doubles.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of doubles
%End

QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
QList<QColor> toColorList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of colors.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of colors
%End

QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of geometries.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of geometries
%End
Expand Down
12 changes: 8 additions & 4 deletions python/server/auto_generated/qgsserverparameters.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,46 @@ Converts the parameter into a list of strings
:return: A list of strings
%End

QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
QList<int> toIntList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of integers.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of integers
%End

QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;
QList<double> toDoubleList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of doubles.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of doubles
%End

QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
QList<QColor> toColorList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of colors.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of colors
%End

QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
%Docstring
Converts the parameter into a list of geometries.

:param ok: ``True`` if there's no error during the conversion, ``False`` otherwise
:param delimiter: The character used for delimiting
:param skipEmptyParts: for splitting

:return: A list of geometries
%End
Expand Down
16 changes: 8 additions & 8 deletions src/server/qgsserverparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ QStringList QgsServerParameterDefinition::toStringList( const char delimiter, co
}
}

QList<QgsGeometry> QgsServerParameterDefinition::toGeomList( bool &ok, const char delimiter ) const
QList<QgsGeometry> QgsServerParameterDefinition::toGeomList( bool &ok, const char delimiter, const bool skipEmptyParts ) const
{
ok = true;
QList<QgsGeometry> geoms;

const auto constStringList( toStringList( delimiter ) );
const auto constStringList( toStringList( delimiter, skipEmptyParts ) );
for ( const auto &wkt : constStringList )
{
const QgsGeometry g( QgsGeometry::fromWkt( wkt ) );
Expand Down Expand Up @@ -202,12 +202,12 @@ QStringList QgsServerParameterDefinition::toExpressionList() const
return filters;
}

QList<QColor> QgsServerParameterDefinition::toColorList( bool &ok, const char delimiter ) const
QList<QColor> QgsServerParameterDefinition::toColorList( bool &ok, const char delimiter, bool skipEmptyParts ) const
{
ok = true;
QList<QColor> colors;

const auto constStringList( toStringList( delimiter ) );
const auto constStringList( toStringList( delimiter, skipEmptyParts ) );
for ( const auto &part : constStringList )
{
QString cStr( part );
Expand All @@ -234,12 +234,12 @@ QList<QColor> QgsServerParameterDefinition::toColorList( bool &ok, const char de
return colors;
}

QList<int> QgsServerParameterDefinition::toIntList( bool &ok, const char delimiter ) const
QList<int> QgsServerParameterDefinition::toIntList( bool &ok, const char delimiter, bool skipEmptyParts ) const
{
ok = true;
QList<int> ints;

const auto constStringList( toStringList( delimiter ) );
const auto constStringList( toStringList( delimiter, skipEmptyParts ) );
for ( const auto &part : constStringList )
{
const int val = part.toInt( &ok );
Expand All @@ -255,12 +255,12 @@ QList<int> QgsServerParameterDefinition::toIntList( bool &ok, const char delimit
return ints;
}

QList<double> QgsServerParameterDefinition::toDoubleList( bool &ok, const char delimiter ) const
QList<double> QgsServerParameterDefinition::toDoubleList( bool &ok, const char delimiter, bool skipEmptyParts ) const
{
ok = true;
QList<double> vals;

const auto constStringList( toStringList( delimiter ) );
const auto constStringList( toStringList( delimiter, skipEmptyParts ) );
for ( const auto &part : constStringList )
{
const double val = part.toDouble( &ok );
Expand Down
12 changes: 8 additions & 4 deletions src/server/qgsserverparameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,37 @@ class SERVER_EXPORT QgsServerParameterDefinition
* Converts the parameter into a list of integers.
* \param ok TRUE if there's no error during the conversion, FALSE otherwise
* \param delimiter The character used for delimiting
* \param skipEmptyParts for splitting
* \returns A list of integers
*/
QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
QList<int> toIntList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;

/**
* Converts the parameter into a list of doubles.
* \param ok TRUE if there's no error during the conversion, FALSE otherwise
* \param delimiter The character used for delimiting
* \param skipEmptyParts for splitting
* \returns A list of doubles
*/
QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;
QList<double> toDoubleList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;

/**
* Converts the parameter into a list of colors.
* \param ok TRUE if there's no error during the conversion, FALSE otherwise
* \param delimiter The character used for delimiting
* \param skipEmptyParts for splitting
* \returns A list of colors
*/
QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
QList<QColor> toColorList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;

/**
* Converts the parameter into a list of geometries.
* \param ok TRUE if there's no error during the conversion, FALSE otherwise
* \param delimiter The character used for delimiting
* \param skipEmptyParts for splitting
* \returns A list of geometries
*/
QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;

/**
* Converts the parameter into a list of OGC filters.
Expand Down
Loading

0 comments on commit 3f5f900

Please sign in to comment.