mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Add __repr__
This commit is contained in:
parent
394c4c0730
commit
98bd60e4ba
@ -172,6 +172,12 @@ A labeling engine rule which prevents labels being placed too close to features
|
||||
virtual QString id() const;
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMinimumDistanceLabelToFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
private:
|
||||
QgsLabelingEngineRuleMinimumDistanceLabelToFeature( const QgsLabelingEngineRuleMinimumDistanceLabelToFeature & );
|
||||
};
|
||||
@ -196,6 +202,12 @@ A labeling engine rule which prevents labels being placed too far from features
|
||||
virtual QString id() const;
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMaximumDistanceLabelToFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
private:
|
||||
QgsLabelingEngineRuleMaximumDistanceLabelToFeature( const QgsLabelingEngineRuleMaximumDistanceLabelToFeature & );
|
||||
};
|
||||
@ -228,6 +240,12 @@ A labeling engine rule which prevents labels being placed too close to labels fr
|
||||
virtual bool prepare( QgsRenderContext &context );
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMinimumDistanceLabelToLabel: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
QgsVectorLayer *labeledLayer();
|
||||
%Docstring
|
||||
Returns the layer providing the labels.
|
||||
@ -349,6 +367,12 @@ A labeling engine rule which prevents labels being placed overlapping features f
|
||||
virtual void resolveReferences( const QgsProject *project );
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleAvoidLabelOverlapWithFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
QgsVectorLayer *labeledLayer();
|
||||
%Docstring
|
||||
Returns the layer providing the labels.
|
||||
|
||||
@ -172,6 +172,12 @@ A labeling engine rule which prevents labels being placed too close to features
|
||||
virtual QString id() const;
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMinimumDistanceLabelToFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
private:
|
||||
QgsLabelingEngineRuleMinimumDistanceLabelToFeature( const QgsLabelingEngineRuleMinimumDistanceLabelToFeature & );
|
||||
};
|
||||
@ -196,6 +202,12 @@ A labeling engine rule which prevents labels being placed too far from features
|
||||
virtual QString id() const;
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMaximumDistanceLabelToFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
private:
|
||||
QgsLabelingEngineRuleMaximumDistanceLabelToFeature( const QgsLabelingEngineRuleMaximumDistanceLabelToFeature & );
|
||||
};
|
||||
@ -228,6 +240,12 @@ A labeling engine rule which prevents labels being placed too close to labels fr
|
||||
virtual bool prepare( QgsRenderContext &context );
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMinimumDistanceLabelToLabel: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
QgsVectorLayer *labeledLayer();
|
||||
%Docstring
|
||||
Returns the layer providing the labels.
|
||||
@ -349,6 +367,12 @@ A labeling engine rule which prevents labels being placed overlapping features f
|
||||
virtual void resolveReferences( const QgsProject *project );
|
||||
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleAvoidLabelOverlapWithFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
%End
|
||||
|
||||
QgsVectorLayer *labeledLayer();
|
||||
%Docstring
|
||||
Returns the layer providing the labels.
|
||||
|
||||
@ -199,6 +199,14 @@ class CORE_EXPORT QgsLabelingEngineRuleMinimumDistanceLabelToFeature : public Qg
|
||||
QgsLabelingEngineRuleMinimumDistanceLabelToFeature *clone() const override SIP_FACTORY;
|
||||
QString id() const override;
|
||||
|
||||
#ifdef SIP_RUN
|
||||
SIP_PYOBJECT __repr__();
|
||||
% MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMinimumDistanceLabelToFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
% End
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef SIP_RUN
|
||||
QgsLabelingEngineRuleMinimumDistanceLabelToFeature( const QgsLabelingEngineRuleMinimumDistanceLabelToFeature & );
|
||||
@ -220,6 +228,14 @@ class CORE_EXPORT QgsLabelingEngineRuleMaximumDistanceLabelToFeature : public Qg
|
||||
QgsLabelingEngineRuleMaximumDistanceLabelToFeature *clone() const override SIP_FACTORY;
|
||||
QString id() const override;
|
||||
|
||||
#ifdef SIP_RUN
|
||||
SIP_PYOBJECT __repr__();
|
||||
% MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMaximumDistanceLabelToFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
% End
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef SIP_RUN
|
||||
QgsLabelingEngineRuleMaximumDistanceLabelToFeature( const QgsLabelingEngineRuleMaximumDistanceLabelToFeature & );
|
||||
@ -248,6 +264,14 @@ class CORE_EXPORT QgsLabelingEngineRuleMinimumDistanceLabelToLabel : public QgsA
|
||||
QgsRectangle modifyCandidateConflictSearchBoundingBox( const QgsRectangle &candidateBounds ) const override SIP_SKIP;
|
||||
bool candidatesAreConflicting( const pal::LabelPosition *lp1, const pal::LabelPosition *lp2 ) const override SIP_SKIP;
|
||||
|
||||
#ifdef SIP_RUN
|
||||
SIP_PYOBJECT __repr__();
|
||||
% MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleMinimumDistanceLabelToLabel: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
% End
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the layer providing the labels.
|
||||
*
|
||||
@ -366,6 +390,14 @@ class CORE_EXPORT QgsLabelingEngineRuleAvoidLabelOverlapWithFeature : public Qgs
|
||||
void resolveReferences( const QgsProject *project ) override;
|
||||
bool candidateIsIllegal( const pal::LabelPosition *candidate, QgsLabelingEngineContext &context ) const override SIP_SKIP;
|
||||
|
||||
#ifdef SIP_RUN
|
||||
SIP_PYOBJECT __repr__();
|
||||
% MethodCode
|
||||
const QString str = QStringLiteral( "<QgsLabelingEngineRuleAvoidLabelOverlapWithFeature: %1>" ).arg( sipCpp->name() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
% End
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the layer providing the labels.
|
||||
*
|
||||
|
||||
@ -94,6 +94,7 @@ class TestQgsLabelingEngineRule(QgisTestCase):
|
||||
rule.setDistanceUnitScale(QgsMapUnitScale(15, 25))
|
||||
rule.setCost(6.6)
|
||||
rule.setName('my rule')
|
||||
self.assertEqual(rule.__repr__(), '<QgsLabelingEngineRuleMinimumDistanceLabelToFeature: my rule>')
|
||||
|
||||
self.assertEqual(rule.labeledLayer(), vl)
|
||||
self.assertEqual(rule.targetLayer(), vl2)
|
||||
@ -142,6 +143,7 @@ class TestQgsLabelingEngineRule(QgisTestCase):
|
||||
rule.setDistanceUnit(Qgis.RenderUnit.Inches)
|
||||
rule.setDistanceUnitScale(QgsMapUnitScale(15, 25))
|
||||
rule.setName('my rule')
|
||||
self.assertEqual(rule.__repr__(), '<QgsLabelingEngineRuleMinimumDistanceLabelToLabel: my rule>')
|
||||
|
||||
self.assertEqual(rule.labeledLayer(), vl)
|
||||
self.assertEqual(rule.targetLayer(), vl2)
|
||||
@ -188,6 +190,7 @@ class TestQgsLabelingEngineRule(QgisTestCase):
|
||||
rule.setDistanceUnitScale(QgsMapUnitScale(15, 25))
|
||||
rule.setCost(6.6)
|
||||
rule.setName('my rule')
|
||||
self.assertEqual(rule.__repr__(), '<QgsLabelingEngineRuleMaximumDistanceLabelToFeature: my rule>')
|
||||
|
||||
self.assertEqual(rule.labeledLayer(), vl)
|
||||
self.assertEqual(rule.targetLayer(), vl2)
|
||||
@ -233,6 +236,7 @@ class TestQgsLabelingEngineRule(QgisTestCase):
|
||||
rule.setLabeledLayer(vl)
|
||||
rule.setTargetLayer(vl2)
|
||||
rule.setName('my rule')
|
||||
self.assertEqual(rule.__repr__(), '<QgsLabelingEngineRuleAvoidLabelOverlapWithFeature: my rule>')
|
||||
|
||||
self.assertEqual(rule.labeledLayer(), vl)
|
||||
self.assertEqual(rule.targetLayer(), vl2)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user