Skip to content
Permalink
Browse files
added mask image
  • Loading branch information
domi4484 committed Jan 10, 2022
1 parent 2041f2d commit d583bc0c592f7134601217d3bc7cce2aafe3a8e9
@@ -921,37 +921,6 @@ bool QgsMapToolLabel::labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSe
return ( xCol != -1 && yCol != -1 );
}

bool QgsMapToolLabel::labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &xCol, int &yCol, int &pointCol ) const
{
xCol = -1;
yCol = -1;
pointCol = -1;

switch ( mCurrentLabel.settings.placementCoordinateType() )
{
case QgsLabeling::CoordinateType::XY:
{
QString xColName = dataDefinedColumnName( QgsPalLayerSettings::PositionX, settings, vlayer );
QString yColName = dataDefinedColumnName( QgsPalLayerSettings::PositionY, settings, vlayer );
xCol = vlayer->fields().lookupField( xColName );
yCol = vlayer->fields().lookupField( yColName );
if ( xCol <= 0 && yCol <= 0 )
return false;
}
break;
case QgsLabeling::CoordinateType::Point:
{
QString pointColName = dataDefinedColumnName( QgsPalLayerSettings::PositionPoint, settings, vlayer );
pointCol = vlayer->fields().lookupField( pointColName );
if ( pointCol <= 0 )
return false;
}
break;
}

return true;
}

bool QgsMapToolLabel::layerCanPin( QgsVectorLayer *vlayer, int &xCol, int &yCol ) const
{
// currently same as QgsMapToolLabel::labelMoveable, but may change
@@ -1002,6 +971,37 @@ bool QgsMapToolLabel::isPinned()
return rc;
}

bool QgsMapToolLabel::labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &xCol, int &yCol, int &pointCol ) const
{
xCol = -1;
yCol = -1;
pointCol = -1;

switch ( mCurrentLabel.settings.placementCoordinateType() )
{
case QgsLabeling::CoordinateType::XY:
{
QString xColName = dataDefinedColumnName( QgsPalLayerSettings::PositionX, settings, vlayer );
QString yColName = dataDefinedColumnName( QgsPalLayerSettings::PositionY, settings, vlayer );
xCol = vlayer->fields().lookupField( xColName );
yCol = vlayer->fields().lookupField( yColName );
if ( xCol <= 0 && yCol <= 0 )
return false;
}
break;
case QgsLabeling::CoordinateType::Point:
{
QString pointColName = dataDefinedColumnName( QgsPalLayerSettings::PositionPoint, settings, vlayer );
pointCol = vlayer->fields().lookupField( pointColName );
if ( pointCol <= 0 )
return false;
}
break;
}

return true;
}

bool QgsMapToolLabel::diagramCanShowHide( QgsVectorLayer *vlayer, int &showCol ) const
{
showCol = -1;
@@ -53,7 +53,6 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapToolAdvancedDigitizing
*/
bool labelMoveable( QgsVectorLayer *vlayer, int &xCol, int &yCol ) const;
bool labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &xCol, int &yCol ) const;
bool labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &xCol, int &yCol, int &pointCol ) const;

/**
* Returns true if diagram move can be applied to a layer
@@ -249,6 +248,8 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapToolAdvancedDigitizing
bool createAuxiliaryFields( QgsCalloutIndexes &calloutIndexes );
bool createAuxiliaryFields( QgsCalloutPosition &details, QgsCalloutIndexes &calloutIndexes );

bool labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &xCol, int &yCol, int &pointCol ) const;

void updateHoveredLabel( QgsMapMouseEvent *e );
void clearHoveredLabel();
virtual bool canModifyLabel( const LabelDetails &label );
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d583bc0

Please sign in to comment.