|
21 | 21 | #include "qgslogger.h" |
22 | 22 | #include "qgsmaplayer.h" |
23 | 23 | #include "qgsmapserviceexception.h" |
| 24 | +#include "qgspallabeling.h" |
24 | 25 | #include "qgsvectorlayer.h" |
25 | 26 |
|
26 | 27 | #include "qgscomposition.h" |
@@ -1751,6 +1752,77 @@ void QgsWMSProjectParser::drawOverlays( QPainter* p, int dpi, int width, int hei |
1751 | 1752 | } |
1752 | 1753 | } |
1753 | 1754 |
|
| 1755 | +void QgsWMSProjectParser::loadLabelSettings( QgsLabelingEngineInterface* lbl ) const |
| 1756 | +{ |
| 1757 | + QgsPalLabeling* pal = dynamic_cast<QgsPalLabeling*>( lbl ); |
| 1758 | + if ( pal ) |
| 1759 | + { |
| 1760 | + QDomElement propertiesElem = mProjectParser.propertiesElem(); |
| 1761 | + if ( propertiesElem.isNull() ) |
| 1762 | + { |
| 1763 | + return; |
| 1764 | + } |
| 1765 | + |
| 1766 | + QDomElement palElem = propertiesElem.firstChildElement( "PAL" ); |
| 1767 | + if ( palElem.isNull() ) |
| 1768 | + { |
| 1769 | + return; |
| 1770 | + } |
| 1771 | + |
| 1772 | + //pal::Pal default positions for candidates; |
| 1773 | + int candPoint, candLine, candPoly; |
| 1774 | + pal->numCandidatePositions( candPoint, candLine, candPoly ); |
| 1775 | + |
| 1776 | + //mCandPoint |
| 1777 | + QDomElement candPointElem = palElem.firstChildElement( "CandidatesPoint" ); |
| 1778 | + if ( !candPointElem.isNull() ) |
| 1779 | + { |
| 1780 | + candPoint = candPointElem.text().toInt(); |
| 1781 | + } |
| 1782 | + |
| 1783 | + //mCandLine |
| 1784 | + QDomElement candLineElem = palElem.firstChildElement( "CandidatesLine" ); |
| 1785 | + if ( !candLineElem.isNull() ) |
| 1786 | + { |
| 1787 | + candLine = candLineElem.text().toInt(); |
| 1788 | + } |
| 1789 | + |
| 1790 | + //mCandPolygon |
| 1791 | + QDomElement candPolyElem = palElem.firstChildElement( "CandidatesPolygon" ); |
| 1792 | + if ( !candPolyElem.isNull() ) |
| 1793 | + { |
| 1794 | + candPoly = candPolyElem.text().toInt(); |
| 1795 | + } |
| 1796 | + |
| 1797 | + pal->setNumCandidatePositions( candPoint, candLine, candPoly ); |
| 1798 | + |
| 1799 | + //mShowingCandidates |
| 1800 | + QDomElement showCandElem = palElem.firstChildElement( "ShowingCandidates" ); |
| 1801 | + if ( !showCandElem.isNull() ) |
| 1802 | + { |
| 1803 | + pal->setShowingCandidates( showCandElem.text().compare( "true", Qt::CaseInsensitive ) == 0 ); |
| 1804 | + } |
| 1805 | + |
| 1806 | + //mShowingAllLabels |
| 1807 | + QDomElement showAllLabelsElem = palElem.firstChildElement( "ShowingAllLabels" ); |
| 1808 | + if ( !showAllLabelsElem.isNull() ) |
| 1809 | + { |
| 1810 | + pal->setShowingAllLabels( showAllLabelsElem.text().compare( "true", Qt::CaseInsensitive ) == 0 ); |
| 1811 | + } |
| 1812 | + |
| 1813 | + //mShowingPartialsLabels |
| 1814 | + QDomElement showPartialsLabelsElem = palElem.firstChildElement( "ShowingPartialsLabels" ); |
| 1815 | + if ( !showPartialsLabelsElem.isNull() ) |
| 1816 | + { |
| 1817 | + pal->setShowingPartialsLabels( showPartialsLabelsElem.text().compare( "true", Qt::CaseInsensitive ) == 0 ); |
| 1818 | + } |
| 1819 | + |
| 1820 | + //mDrawOutlineLabels |
| 1821 | + // TODO: This should probably always be true (already default) for WMS, regardless of any project setting. |
| 1822 | + // Not much sense to output text-as-text, when text-as-outlines gives better results. |
| 1823 | + } |
| 1824 | +} |
| 1825 | + |
1754 | 1826 | int QgsWMSProjectParser::nLayers() const |
1755 | 1827 | { |
1756 | 1828 | return mProjectParser.numberOfLayers(); |
|
0 commit comments