mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Address review
This commit is contained in:
parent
b68a9c3b81
commit
0ffd1174db
@ -247,7 +247,7 @@ Returns the feature's anchor point position.
|
||||
%Docstring
|
||||
Sets the feature's ``anchor`` point position.
|
||||
|
||||
.. seealso:: :py:func:`drawCalloutToAllParts`
|
||||
.. seealso:: :py:func:`anchorPoint`
|
||||
%End
|
||||
|
||||
static QString encodeAnchorPoint( AnchorPoint anchor );
|
||||
@ -261,11 +261,11 @@ Encodes an ``anchor`` point to its string representation.
|
||||
|
||||
static QgsCallout::AnchorPoint decodeAnchorPoint( const QString &name, bool *ok = 0 );
|
||||
%Docstring
|
||||
Attempts to decode a string representation of an anchoir point name to the corresponding
|
||||
Attempts to decode a string representation of an anchor point name to the corresponding
|
||||
anchor point.
|
||||
|
||||
:param name: encoded anchoir point name
|
||||
:param ok: if specified, will be set to ``True`` if the anchoir point was successfully decoded
|
||||
:param name: encoded anchor point name
|
||||
:param ok: if specified, will be set to ``True`` if the anchor point was successfully decoded
|
||||
|
||||
:return: decoded name
|
||||
|
||||
|
@ -51,8 +51,6 @@ Sets the context in which the symbol widget is shown, e.g., the associated map c
|
||||
:param context: symbol widget context
|
||||
|
||||
.. seealso:: :py:func:`context`
|
||||
|
||||
.. versionadded:: 3.0
|
||||
%End
|
||||
|
||||
QgsSymbolWidgetContext context() const;
|
||||
@ -60,18 +58,17 @@ Sets the context in which the symbol widget is shown, e.g., the associated map c
|
||||
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
|
||||
|
||||
.. seealso:: :py:func:`setContext`
|
||||
|
||||
.. versionadded:: 3.0
|
||||
%End
|
||||
|
||||
const QgsVectorLayer *vectorLayer() const;
|
||||
%Docstring
|
||||
Returns the vector layer associated with the widget.
|
||||
|
||||
.. versionadded:: 2.12
|
||||
%End
|
||||
|
||||
virtual void setGeometryType( QgsWkbTypes::GeometryType type ) = 0;
|
||||
%Docstring
|
||||
Sets the geometry ``type`` of the features to customize the widget accordingly.
|
||||
%End
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -38,7 +38,7 @@ void QgsCallout::initPropertyDefinitions()
|
||||
{ QgsCallout::OffsetFromAnchor, QgsPropertyDefinition( "OffsetFromAnchor", QObject::tr( "Offset from feature" ), QgsPropertyDefinition::DoublePositive, origin ) },
|
||||
{ QgsCallout::OffsetFromLabel, QgsPropertyDefinition( "OffsetFromLabel", QObject::tr( "Offset from label" ), QgsPropertyDefinition::DoublePositive, origin ) },
|
||||
{ QgsCallout::DrawCalloutToAllParts, QgsPropertyDefinition( "DrawCalloutToAllParts", QObject::tr( "Draw lines to all feature parts" ), QgsPropertyDefinition::Boolean, origin ) },
|
||||
{ QgsCallout::AnchorPointPosition, QgsPropertyDefinition( "AnchorPointPosition", QObject::tr( "Feature's anchor point position" ), QgsPropertyDefinition::String, origin ) },
|
||||
{ QgsCallout::AnchorPointPosition, QgsPropertyDefinition( "AnchorPointPosition", QgsPropertyDefinition::DataTypeString, QObject::tr( "Feature's anchor point position" ), QObject::tr( "string " ) + "[<b>pole_of_inaccessibility</b>|<b>point_on_exterior</b>|<b>point_on_surface</b>|<b>centroid</b>]", origin ) },
|
||||
};
|
||||
}
|
||||
|
||||
@ -74,7 +74,6 @@ bool QgsCallout::saveProperties( QDomDocument &doc, QDomElement &element, const
|
||||
|
||||
QDomElement calloutElement = doc.createElement( QStringLiteral( "callout" ) );
|
||||
calloutElement.setAttribute( QStringLiteral( "type" ), type() );
|
||||
calloutElement.setAttribute( QStringLiteral( "anchorPoint" ), encodeAnchorPoint( mAnchorPoint ) );
|
||||
calloutElement.appendChild( calloutPropsElement );
|
||||
|
||||
element.appendChild( calloutElement );
|
||||
@ -352,7 +351,6 @@ void QgsSimpleLineCallout::draw( QgsRenderContext &context, QRectF rect, const d
|
||||
line = label.shortestLine( partAnchor );
|
||||
break;
|
||||
case QgsCallout::Centroid:
|
||||
default:
|
||||
line = label.shortestLine( partAnchor.centroid() );
|
||||
break;
|
||||
}
|
||||
@ -492,7 +490,6 @@ void QgsManhattanLineCallout::draw( QgsRenderContext &context, QRectF rect, cons
|
||||
line = label.shortestLine( partAnchor );
|
||||
break;
|
||||
case QgsCallout::Centroid:
|
||||
default:
|
||||
line = label.shortestLine( partAnchor.centroid() );
|
||||
break;
|
||||
}
|
||||
|
@ -85,10 +85,10 @@ class CORE_EXPORT QgsCallout
|
||||
//! Feature's anchor point position
|
||||
enum AnchorPoint
|
||||
{
|
||||
PoleOfInaccessibility = 0, //!< The surface's pole of inaccessibility used as anchor
|
||||
PointOnExterior, //!< A point on the surface's outline closest to the label is used as anchor
|
||||
PointOnSurface, //!< A point guaranteed to be on the surface is used as anchor
|
||||
Centroid, //!< The surface's centroid is used as anchor
|
||||
PoleOfInaccessibility = 0, //!< The surface's pole of inaccessibility used as anchor for polygon geometries
|
||||
PointOnExterior, //!< A point on the surface's outline closest to the label is used as anchor for polygon geometries
|
||||
PointOnSurface, //!< A point guaranteed to be on the surface is used as anchor for polygon geometries
|
||||
Centroid, //!< The surface's centroid is used as anchor for polygon geometries
|
||||
};
|
||||
|
||||
/**
|
||||
@ -272,7 +272,7 @@ class CORE_EXPORT QgsCallout
|
||||
/**
|
||||
* Sets the feature's \a anchor point position.
|
||||
*
|
||||
* \see drawCalloutToAllParts()
|
||||
* \see anchorPoint()
|
||||
*/
|
||||
void setAnchorPoint( AnchorPoint anchor ) { mAnchorPoint = anchor; }
|
||||
|
||||
@ -284,10 +284,10 @@ class CORE_EXPORT QgsCallout
|
||||
static QString encodeAnchorPoint( AnchorPoint anchor );
|
||||
|
||||
/**
|
||||
* Attempts to decode a string representation of an anchoir point name to the corresponding
|
||||
* Attempts to decode a string representation of an anchor point name to the corresponding
|
||||
* anchor point.
|
||||
* \param name encoded anchoir point name
|
||||
* \param ok if specified, will be set to TRUE if the anchoir point was successfully decoded
|
||||
* \param name encoded anchor point name
|
||||
* \param ok if specified, will be set to TRUE if the anchor point was successfully decoded
|
||||
* \returns decoded name
|
||||
* \see encodeAnchorPoint()
|
||||
*/
|
||||
|
@ -212,8 +212,13 @@ void QgsSimpleLineCalloutWidget::setCallout( QgsCallout *callout )
|
||||
|
||||
void QgsSimpleLineCalloutWidget::setGeometryType( QgsWkbTypes::GeometryType type )
|
||||
{
|
||||
mAnchorPointComboBox->setEnabled( type == QgsWkbTypes::PolygonGeometry );
|
||||
mAnchorPointDDBtn->setEnabled( type == QgsWkbTypes::PolygonGeometry );
|
||||
bool isPolygon = type == QgsWkbTypes::PolygonGeometry;
|
||||
mAnchorPointLbl->setEnabled( isPolygon );
|
||||
mAnchorPointLbl->setVisible( isPolygon );
|
||||
mAnchorPointComboBox->setEnabled( isPolygon );
|
||||
mAnchorPointComboBox->setVisible( isPolygon );
|
||||
mAnchorPointDDBtn->setEnabled( isPolygon );
|
||||
mAnchorPointDDBtn->setVisible( isPolygon );
|
||||
}
|
||||
|
||||
QgsCallout *QgsSimpleLineCalloutWidget::callout()
|
||||
|
@ -64,23 +64,23 @@ class GUI_EXPORT QgsCalloutWidget : public QWidget, protected QgsExpressionConte
|
||||
* Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
|
||||
* \param context symbol widget context
|
||||
* \see context()
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
virtual void setContext( const QgsSymbolWidgetContext &context );
|
||||
|
||||
/**
|
||||
* Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
|
||||
* \see setContext()
|
||||
* \since QGIS 3.0
|
||||
*/
|
||||
QgsSymbolWidgetContext context() const;
|
||||
|
||||
/**
|
||||
* Returns the vector layer associated with the widget.
|
||||
* \since QGIS 2.12
|
||||
*/
|
||||
const QgsVectorLayer *vectorLayer() const { return mVectorLayer; }
|
||||
|
||||
/**
|
||||
* Sets the geometry \a type of the features to customize the widget accordingly.
|
||||
*/
|
||||
virtual void setGeometryType( QgsWkbTypes::GeometryType type ) = 0;
|
||||
|
||||
protected:
|
||||
|
@ -225,7 +225,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_48">
|
||||
<widget class="QLabel" name="mAnchorPointLbl">
|
||||
<property name="text">
|
||||
<string>Anchor point</string>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user