Skip to content

Commit 7bc72d4

Browse files
committedOct 1, 2013
Merge branch 'master' of github.com:qgis/QGIS
2 parents dd914b8 + 96bd7e7 commit 7bc72d4

30 files changed

+1389
-1139
lines changed
 

‎i18n/qgis_lt.ts

Lines changed: 1095 additions & 1109 deletions
Large diffs are not rendered by default.

‎python/core/qgspallabeling.sip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,9 @@ class QgsPalLabeling : QgsLabelingEngineInterface
617617

618618
bool isShowingAllLabels() const;
619619
void setShowingAllLabels( bool showing );
620+
621+
bool isShowingPartialsLabels() const;
622+
void setShowingPartialsLabels( bool showing );
620623

621624
// implemented methods from labeling engine interface
622625

‎python/plugins/processing/admintools/ImportIntoPostGIS.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def defineCharacteristics(self):
9696
self.group = "PostGIS management tools"
9797
self.addParameter(ParameterVector(self.INPUT, "Layer to import"))
9898
self.addParameter(ParameterString(self.DATABASE, "Database (connection name)"))
99+
self.addParameter(ParameterString(self.SCHEMA, "Schema (schema name)"))
99100
self.addParameter(ParameterString(self.TABLENAME, "Table to import to"))
100101
self.addParameter(ParameterBoolean(self.OVERWRITE, "Overwrite", True))
101102
self.addParameter(ParameterBoolean(self.CREATEINDEX, "Create spatial index", True))

‎python/plugins/processing/gdal/GdalOgrAlgorithmProvider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from processing.gdal.sieve import sieve
5252
from processing.gdal.fillnodata import fillnodata
5353
from processing.gdal.extractprojection import ExtractProjection
54+
from processing.gdal.gdal2xyz import gdal2xyz
5455

5556
from processing.gdal.ogr2ogr import Ogr2Ogr
5657
from processing.gdal.ogrinfo import OgrInfo
@@ -101,7 +102,7 @@ def createAlgsList(self):
101102
rgb2pct(), pct2rgb(), merge(), polygonize(),
102103
gdaladdo(), ClipByExtent(), ClipByMask(),
103104
contour(), rasterize(), proximity(), sieve(),
104-
fillnodata(), ExtractProjection(),
105+
fillnodata(), ExtractProjection(), gdal2xyz(),
105106
OgrInfo(), Ogr2Ogr(), OgrSql()]
106107

107108
#And then we add those that are created as python scripts
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
gdal2xyz.py
6+
---------------------
7+
Date : September 2013
8+
Copyright : (C) 2013 by Alexander Bruy
9+
Email : alexander dot bruy at gmail dot com
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Alexander Bruy'
21+
__date__ = 'September 2013'
22+
__copyright__ = '(C) 2013, Alexander Bruy'
23+
# This will get replaced with a git SHA1 when you do a git archive
24+
__revision__ = '$Format:%H$'
25+
26+
import os
27+
from PyQt4.QtGui import *
28+
from PyQt4.QtCore import *
29+
30+
from processing.core.GeoAlgorithm import GeoAlgorithm
31+
32+
from processing.parameters.ParameterRaster import ParameterRaster
33+
from processing.parameters.ParameterNumber import ParameterNumber
34+
from processing.outputs.OutputTable import OutputTable
35+
36+
from processing.tools.system import *
37+
38+
from processing.gdal.GdalUtils import GdalUtils
39+
40+
class gdal2xyz(GeoAlgorithm):
41+
42+
INPUT = "INPUT"
43+
BAND = "BAND"
44+
OUTPUT = "OUTPUT"
45+
46+
#def getIcon(self):
47+
# return QIcon(os.path.dirname(__file__) + "/icons/gdal2xyz.png")
48+
49+
def defineCharacteristics(self):
50+
self.name = "gdal2xyz"
51+
self.group = "[GDAL] Conversion"
52+
self.addParameter(ParameterRaster(self.INPUT, "Input layer", False))
53+
self.addParameter(ParameterNumber(self.BAND, "Band number", 1, 9999, 1))
54+
55+
self.addOutput(OutputTable(self.OUTPUT, "Output file"))
56+
57+
def processAlgorithm(self, progress):
58+
arguments = []
59+
arguments.append("-band")
60+
arguments.append(str(self.getParameterValue(self.BAND)))
61+
62+
arguments.append("-csv")
63+
arguments.append(self.getParameterValue(self.INPUT))
64+
arguments.append(self.getOutputValue(self.OUTPUT))
65+
66+
commands = []
67+
if isWindows():
68+
commands = ["cmd.exe", "/C ", "gdal2xyz.bat", GdalUtils.escapeAndJoin(arguments)]
69+
else:
70+
commands = ["gdal2xyz.py", GdalUtils.escapeAndJoin(arguments)]
71+
72+
GdalUtils.runGdal(commands, progress)

‎python/plugins/processing/grass/GrassAlgorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def processAlgorithm(self, progress):
336336

337337
if isinstance(out, OutputVector):
338338
filename = out.value
339-
command = "v.out.ogr -e input=" + out.name + uniqueSufix
339+
command = "v.out.ogr -c -e input=" + out.name + uniqueSufix
340340
command += " dsn=\"" + os.path.dirname(out.value) + "\""
341341
command += " format=ESRI_Shapefile"
342342
command += " olayer=" + os.path.basename(out.value)[:-4]

‎python/plugins/processing/saga/ext/supervisedclassification.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@
2424
__revision__ = '$Format:%H$'
2525

2626
from processing.tests.TestData import table
27+
from processing.core.ProcessingConfig import ProcessingConfig
28+
from processing.saga.SagaUtils import SagaUtils
2729

2830
def editCommands(commands):
29-
commands[-3] = commands[-3] + " -STATS " + table()
30-
return commands
31-
32-
31+
saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
32+
if not saga208:
33+
commands[-3] = commands[-3] + " -STATS " + table()
34+
return commands
35+
else:
36+
return commands

‎python/plugins/processing/tools/dataobjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def exportVectorLayer(layer):
241241
if idx != -1:
242242
filename = filename[:idx]
243243

244-
filename = str(layer.name())
244+
filename = unicode(layer.name())
245245
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
246246
filename = ''.join(c for c in filename if c in validChars)
247247
if len(filename) == 0:

‎src/app/composer/qgscompositionwidget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ void QgsCompositionWidget::displayCompositionWidthHeight()
369369
setSize( mPaperHeightDoubleSpinBox, paperHeight );
370370

371371
//set orientation
372+
mPaperOrientationComboBox->blockSignals( true );
372373
if ( paperWidth > paperHeight )
373374
{
374375
mPaperOrientationComboBox->setCurrentIndex( mPaperOrientationComboBox->findText( tr( "Landscape" ) ) );
@@ -377,6 +378,7 @@ void QgsCompositionWidget::displayCompositionWidthHeight()
377378
{
378379
mPaperOrientationComboBox->setCurrentIndex( mPaperOrientationComboBox->findText( tr( "Portrait" ) ) );
379380
}
381+
mPaperOrientationComboBox->blockSignals( false );
380382

381383
//set paper name
382384
bool found = false;

‎src/app/qgsidentifyresultsdialog.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,13 @@ void QgsIdentifyResultsDialog::attributeValueChanged( QgsFeatureId fid, int idx,
11431143

11441144
void QgsIdentifyResultsDialog::highlightFeature( QTreeWidgetItem *item )
11451145
{
1146-
QgsVectorLayer *layer = vectorLayer( item );
1146+
QgsMapLayer *layer;
1147+
QgsVectorLayer *vlayer = vectorLayer( item );
11471148
QgsRasterLayer *rlayer = rasterLayer( item );
1148-
if ( !layer && !rlayer )
1149-
return;
1149+
1150+
layer = vlayer ? static_cast<QgsMapLayer *>( vlayer ) : static_cast<QgsMapLayer *>( rlayer );
1151+
1152+
if ( !layer ) return;
11501153

11511154
QgsIdentifyResultsFeatureItem *featItem = dynamic_cast<QgsIdentifyResultsFeatureItem *>( featureItem( item ) );
11521155
if ( !featItem )

‎src/app/qgslabelengineconfigdialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWi
4343
mShadowDebugRectChkBox->setChecked( mLBL->isShowingShadowRectangles() );
4444

4545
mSaveWithProjectChkBox->setChecked( mLBL->isStoredWithProject() );
46+
47+
chkShowPartialsLabels->setChecked( mLBL-> isShowingPartialsLabels() );
4648
}
4749

4850

@@ -58,6 +60,7 @@ void QgsLabelEngineConfigDialog::onOK()
5860
mLBL->setShowingCandidates( chkShowCandidates->isChecked() );
5961
mLBL->setShowingShadowRectangles( mShadowDebugRectChkBox->isChecked() );
6062
mLBL->setShowingAllLabels( chkShowAllLabels->isChecked() );
63+
mLBL->setShowingPartialsLabels( chkShowPartialsLabels->isChecked() );
6164

6265
if ( mSaveWithProjectChkBox->isChecked() )
6366
{
@@ -80,4 +83,5 @@ void QgsLabelEngineConfigDialog::setDefaults()
8083
chkShowCandidates->setChecked( false );
8184
chkShowAllLabels->setChecked( false );
8285
mShadowDebugRectChkBox->setChecked( false );
86+
chkShowPartialsLabels->setChecked( p.getShowPartial() );
8387
}

‎src/core/pal/feature.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,12 @@ namespace pal
13611361
// purge candidates that are outside the bbox
13621362
for ( i = 0; i < nbp; i++ )
13631363
{
1364-
if ( !( *lPos )[i]->isIn( bbox ) )
1364+
bool outside = false;
1365+
if ( f->layer->pal->getShowPartial() )
1366+
outside = !( *lPos )[i]->isIntersect( bbox );
1367+
else
1368+
outside = !( *lPos )[i]->isInside( bbox );
1369+
if ( outside )
13651370
{
13661371
rnbp--;
13671372
( *lPos )[i]->setCost( DBL_MAX ); // infinite cost => do not use

‎src/core/pal/labelposition.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,39 @@ namespace pal
184184
return false;
185185

186186
}
187+
188+
bool LabelPosition::isIntersect( double *bbox )
189+
{
190+
int i;
191+
192+
for ( i = 0; i < 4; i++ )
193+
{
194+
if ( x[i] >= bbox[0] && x[i] <= bbox[2] &&
195+
y[i] >= bbox[1] && y[i] <= bbox[3] )
196+
return true;
197+
}
198+
199+
if ( nextPart )
200+
return nextPart->isIntersect( bbox );
201+
else
202+
return false;
203+
}
204+
205+
bool LabelPosition::isInside( double *bbox )
206+
{
207+
for (int i = 0; i < 4; i++ )
208+
{
209+
if ( !( x[i] >= bbox[0] && x[i] <= bbox[2] &&
210+
y[i] >= bbox[1] && y[i] <= bbox[3] ) )
211+
return false;
212+
}
213+
214+
if ( nextPart )
215+
return nextPart->isInside( bbox );
216+
else
217+
return true;
218+
219+
}
187220

188221
void LabelPosition::print()
189222
{

‎src/core/pal/labelposition.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,26 @@ namespace pal
109109

110110

111111
/**
112-
* \brief is the labelposition in the bounding-box ?
112+
* \brief Is the labelposition in the bounding-box ? (intersect or inside????)
113113
*
114114
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax}
115115
*/
116116
bool isIn( double *bbox );
117117

118+
/**
119+
* \brief Is the labelposition intersect the bounding-box ?
120+
*
121+
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax}
122+
*/
123+
bool isIntersect( double *bbox );
124+
125+
/**
126+
* \brief Is the labelposition inside the bounding-box ?
127+
*
128+
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax}
129+
*/
130+
bool isInside( double *bbox );
131+
118132
/**
119133
* \brief Check whether or not this overlap with another labelPosition
120134
*

‎src/core/pal/pal.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ namespace pal
106106
point_p = 8;
107107
line_p = 8;
108108
poly_p = 8;
109-
109+
110+
showPartial = true;
111+
110112
this->map_unit = pal::METER;
111113

112114
std::cout.precision( 12 );
@@ -899,6 +901,11 @@ namespace pal
899901
if ( dpi > 0 )
900902
this->dpi = dpi;
901903
}
904+
905+
void Pal::setShowPartial(bool show)
906+
{
907+
this->showPartial = show;
908+
}
902909

903910
int Pal::getPointP()
904911
{
@@ -929,6 +936,11 @@ namespace pal
929936
{
930937
return dpi;
931938
}
939+
940+
bool Pal::getShowPartial()
941+
{
942+
return showPartial;
943+
}
932944

933945
SearchMethod Pal::getSearch()
934946
{

‎src/core/pal/pal.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ namespace pal
166166
int ejChainDeg;
167167
int tenure;
168168
double candListSize;
169+
170+
/**
171+
* \brief show partial labels (cut-off by the map canvas) or not
172+
*/
173+
bool showPartial;
169174

170175
/**
171176
* \brief Problem factory
@@ -352,8 +357,20 @@ namespace pal
352357
* @return map resolution (dot per inch)
353358
*/
354359
int getDpi();
355-
356-
360+
361+
/**
362+
*\brief Set flag show partial label
363+
*
364+
* @param show flag value
365+
*/
366+
void setShowPartial(bool show);
367+
368+
/**
369+
* \brief Get flag show partial label
370+
*
371+
* @return value of flag
372+
*/
373+
bool getShowPartial();
357374

358375
/**
359376
* \brief set # candidates to generate for points features

‎src/core/qgspallabeling.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,6 +3049,7 @@ QgsPalLabeling::QgsPalLabeling()
30493049
mShowingCandidates = false;
30503050
mShowingShadowRects = false;
30513051
mShowingAllLabels = false;
3052+
mShowingPartialsLabels = p.getShowPartial();
30523053

30533054
mLabelSearchTree = new QgsLabelSearchTree();
30543055
}
@@ -3444,6 +3445,8 @@ void QgsPalLabeling::init( QgsMapRenderer* mr )
34443445
mPal->setLineP( mCandLine );
34453446
mPal->setPolyP( mCandPolygon );
34463447

3448+
mPal->setShowPartial( mShowingPartialsLabels );
3449+
34473450
clearActiveLayers(); // free any previous QgsDataDefined objects
34483451
mActiveDiagramLayers.clear();
34493452
}
@@ -4812,6 +4815,8 @@ void QgsPalLabeling::loadEngineSettings()
48124815
"PAL", "/ShowingShadowRects", false, &saved );
48134816
mShowingAllLabels = QgsProject::instance()->readBoolEntry(
48144817
"PAL", "/ShowingAllLabels", false, &saved );
4818+
mShowingPartialsLabels = QgsProject::instance()->readBoolEntry(
4819+
"PAL", "/ShowingPartialsLabels", p.getShowPartial(), &saved );
48154820
mSavedWithProject = saved;
48164821
}
48174822

@@ -4824,6 +4829,7 @@ void QgsPalLabeling::saveEngineSettings()
48244829
QgsProject::instance()->writeEntry( "PAL", "/ShowingCandidates", mShowingCandidates );
48254830
QgsProject::instance()->writeEntry( "PAL", "/ShowingShadowRects", mShowingShadowRects );
48264831
QgsProject::instance()->writeEntry( "PAL", "/ShowingAllLabels", mShowingAllLabels );
4832+
QgsProject::instance()->writeEntry( "PAL", "/ShowingPartialsLabels", mShowingPartialsLabels );
48274833
mSavedWithProject = true;
48284834
}
48294835

@@ -4836,6 +4842,7 @@ void QgsPalLabeling::clearEngineSettings()
48364842
QgsProject::instance()->removeEntry( "PAL", "/ShowingCandidates" );
48374843
QgsProject::instance()->removeEntry( "PAL", "/ShowingShadowRects" );
48384844
QgsProject::instance()->removeEntry( "PAL", "/ShowingAllLabels" );
4845+
QgsProject::instance()->removeEntry( "PAL", "/ShowingPartialsLabels" );
48394846
mSavedWithProject = false;
48404847
}
48414848

@@ -4845,5 +4852,6 @@ QgsLabelingEngineInterface* QgsPalLabeling::clone()
48454852
lbl->mShowingAllLabels = mShowingAllLabels;
48464853
lbl->mShowingCandidates = mShowingCandidates;
48474854
lbl->mShowingShadowRects = mShowingShadowRects;
4855+
lbl->mShowingPartialsLabels = mShowingPartialsLabels;
48484856
return lbl;
48494857
}

‎src/core/qgspallabeling.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
685685
bool isShowingAllLabels() const { return mShowingAllLabels; }
686686
void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing; }
687687

688+
bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
689+
void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }
690+
688691
// implemented methods from labeling engine interface
689692

690693
//! called when we're going to start with rendering
@@ -781,6 +784,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
781784
bool mShowingAllLabels; // whether to avoid collisions or not
782785
bool mSavedWithProject; // whether engine settings have been read from project file
783786
bool mShowingShadowRects; // whether to show debugging rectangles for drop shadows
787+
bool mShowingPartialsLabels; // whether to avoid partials labels or not
784788

785789
QgsLabelSearchTree* mLabelSearchTree;
786790
};

‎src/gui/attributetable/qgsattributetablemodel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,4 +646,6 @@ void QgsAttributeTableModel::prefetchColumnData( int column )
646646
void QgsAttributeTableModel::setRequest( const QgsFeatureRequest& request )
647647
{
648648
mFeatureRequest = request;
649+
if( layer() && !layer()->hasGeometryType() )
650+
mFeatureRequest.setFlags( mFeatureRequest.flags() | QgsFeatureRequest::NoGeometry );
649651
}

‎src/gui/qgshighlight.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "qgshighlight.h"
1717
#include "qgsgeometry.h"
1818
#include "qgsmapcanvas.h"
19+
#include "qgsmaplayer.h"
1920
#include "qgsmaprenderer.h"
2021
#include "qgscoordinatetransform.h"
2122
#include "qgsvectorlayer.h"
@@ -25,14 +26,27 @@
2526
\brief The QgsHighlight class provides a transparent overlay widget
2627
for highlightng features on the map.
2728
*/
28-
QgsHighlight::QgsHighlight( QgsMapCanvas* mapCanvas, QgsGeometry *geom, QgsVectorLayer *layer )
29+
QgsHighlight::QgsHighlight( QgsMapCanvas* mapCanvas, QgsGeometry *geom, QgsMapLayer *layer )
2930
: QgsMapCanvasItem( mapCanvas )
3031
, mLayer( layer )
3132
{
3233
mGeometry = geom ? new QgsGeometry( *geom ) : 0;
33-
if ( mapCanvas->mapRenderer()->hasCrsTransformEnabled() )
34+
init();
35+
}
36+
37+
QgsHighlight::QgsHighlight( QgsMapCanvas* mapCanvas, QgsGeometry *geom, QgsVectorLayer *layer )
38+
: QgsMapCanvasItem( mapCanvas )
39+
, mLayer( static_cast<QgsMapLayer *>( layer ) )
40+
{
41+
mGeometry = geom ? new QgsGeometry( *geom ) : 0;
42+
init();
43+
}
44+
45+
void QgsHighlight::init()
46+
{
47+
if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
3448
{
35-
QgsCoordinateTransform transform( mLayer->crs(), mapCanvas->mapRenderer()->destinationCrs() );
49+
QgsCoordinateTransform transform( mLayer->crs(), mMapCanvas->mapRenderer()->destinationCrs() );
3650
mGeometry->transform( transform );
3751
}
3852
updateRect();

‎src/gui/qgshighlight.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@
2323
#include <QPainter>
2424
#include <QPainterPath>
2525

26+
class QgsMapLayer;
2627
class QgsVectorLayer;
2728

2829
/** A class for highlight features on the map.
2930
*/
3031
class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
3132
{
3233
public:
34+
QgsHighlight( QgsMapCanvas *mapCanvas, QgsGeometry *geom, QgsMapLayer *layer );
3335
QgsHighlight( QgsMapCanvas *mapCanvas, QgsGeometry *geom, QgsVectorLayer *layer );
3436
~QgsHighlight();
3537

@@ -43,6 +45,7 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
4345
void updateRect();
4446

4547
private:
48+
void init();
4649
void paintPoint( QPainter *p, QgsPoint point );
4750
void paintLine( QPainter *p, QgsPolyline line );
4851
void paintPolygon( QPainter *p, QgsPolygon polygon );
@@ -52,7 +55,7 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
5255
QBrush mBrush;
5356
QPen mPen;
5457
QgsGeometry *mGeometry;
55-
QgsVectorLayer *mLayer;
58+
QgsMapLayer *mLayer;
5659
};
5760

5861
#endif

‎src/mapserver/qgsprojectparser.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3661,5 +3661,12 @@ void QgsProjectParser::loadLabelSettings( QgsLabelingEngineInterface* lbl )
36613661
{
36623662
pal->setShowingAllLabels( showAllLabelsElem.text().compare( "true", Qt::CaseInsensitive ) == 0 );
36633663
}
3664+
3665+
//mShowingPartialsLabels
3666+
QDomElement showPartialsLabelsElem = palElem.firstChildElement( "ShowingPartialsLabels" );
3667+
if ( !showPartialsLabelsElem.isNull() )
3668+
{
3669+
pal->setShowingPartialsLabels( showPartialsLabelsElem.text().compare( "true", Qt::CaseInsensitive ) == 0 );
3670+
}
36643671
}
36653672
}

‎src/providers/spatialite/qgsspatialitefeatureiterator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ bool QgsSpatiaLiteFeatureIterator::close()
145145
bool QgsSpatiaLiteFeatureIterator::prepareStatement( QString whereClause )
146146
{
147147
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && P->mGeometryColumn.isNull() )
148+
{
149+
QgsMessageLog::logMessage( QObject::tr( "Trying to fetch geometry on a layer without geometry." ), QObject::tr( "SpatiaLite" ) );
148150
return false;
151+
}
149152

150153
try
151154
{

‎src/ui/qgsengineconfigdialog.ui

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</size>
1818
</property>
1919
<property name="windowTitle">
20-
<string>Dialog</string>
20+
<string>Automated Placement Engine</string>
2121
</property>
2222
<layout class="QVBoxLayout" name="verticalLayout">
2323
<item>
@@ -215,7 +215,7 @@
215215
<property name="verticalSpacing">
216216
<number>6</number>
217217
</property>
218-
<item row="1" column="0">
218+
<item row="2" column="0">
219219
<spacer name="horizontalSpacer_3">
220220
<property name="orientation">
221221
<enum>Qt::Horizontal</enum>
@@ -231,7 +231,7 @@
231231
</property>
232232
</spacer>
233233
</item>
234-
<item row="0" column="0" colspan="3">
234+
<item row="1" column="0" colspan="3">
235235
<widget class="QCheckBox" name="chkShowAllLabels">
236236
<property name="sizePolicy">
237237
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -244,7 +244,7 @@
244244
</property>
245245
</widget>
246246
</item>
247-
<item row="4" column="0" colspan="3">
247+
<item row="5" column="0" colspan="3">
248248
<widget class="QCheckBox" name="mSaveWithProjectChkBox">
249249
<property name="layoutDirection">
250250
<enum>Qt::LeftToRight</enum>
@@ -257,14 +257,14 @@
257257
</property>
258258
</widget>
259259
</item>
260-
<item row="2" column="0" colspan="3">
260+
<item row="3" column="0" colspan="3">
261261
<widget class="QCheckBox" name="chkShowCandidates">
262262
<property name="text">
263263
<string>Show candidates (for debugging)</string>
264264
</property>
265265
</widget>
266266
</item>
267-
<item row="1" column="1">
267+
<item row="2" column="1">
268268
<widget class="QLabel" name="label_6">
269269
<property name="sizePolicy">
270270
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -277,7 +277,7 @@
277277
</property>
278278
</widget>
279279
</item>
280-
<item row="1" column="2">
280+
<item row="2" column="2">
281281
<spacer name="horizontalSpacer_4">
282282
<property name="orientation">
283283
<enum>Qt::Horizontal</enum>
@@ -290,13 +290,20 @@
290290
</property>
291291
</spacer>
292292
</item>
293-
<item row="3" column="0" colspan="3">
293+
<item row="4" column="0" colspan="3">
294294
<widget class="QCheckBox" name="mShadowDebugRectChkBox">
295295
<property name="text">
296296
<string>Show shadow rectangles (for debugging)</string>
297297
</property>
298298
</widget>
299299
</item>
300+
<item row="0" column="0" colspan="3">
301+
<widget class="QCheckBox" name="chkShowPartialsLabels">
302+
<property name="text">
303+
<string>Show partials labels</string>
304+
</property>
305+
</widget>
306+
</item>
300307
</layout>
301308
</item>
302309
<item>

‎tests/src/python/test_qgspallabeling_base.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,18 @@ def setUpClass(cls):
106106
cls._MapRenderer.setDestinationCrs(cls._CRS)
107107
# use platform's native logical output dpi for QgsMapRenderer on launch
108108

109-
cls._Pal = QgsPalLabeling()
110-
cls._MapRenderer.setLabelingEngine(cls._Pal)
111-
cls._PalEngine = cls._MapRenderer.labelingEngine()
109+
cls.setDefaultEngineSettings()
112110
msg = ('\nCould not initialize PAL labeling engine, '
113111
'SKIPPING TEST SUITE')
114112
assert cls._PalEngine, msg
115113

114+
@classmethod
115+
def setDefaultEngineSettings(cls):
116+
"""Restore default settings for pal labelling"""
117+
cls._Pal = QgsPalLabeling()
118+
cls._MapRenderer.setLabelingEngine(cls._Pal)
119+
cls._PalEngine = cls._MapRenderer.labelingEngine()
120+
116121
@classmethod
117122
def tearDownClass(cls):
118123
"""Run after all tests"""
@@ -294,6 +299,24 @@ def test_write_read_settings(self):
294299

295300
msg = '\nLayer settings read not same as settings written'
296301
self.assertDictEqual(lyr1dict, lyr2dict, msg)
302+
303+
def test_default_partials_labels_enabled(self):
304+
# Verify ShowingPartialsLabels is enabled for PAL by default
305+
pal = QgsPalLabeling()
306+
self.assertTrue(pal.isShowingPartialsLabels())
307+
308+
def test_partials_labels_activate(self):
309+
pal = QgsPalLabeling()
310+
# Enable partials labels
311+
pal.setShowingPartialsLabels(True)
312+
self.assertTrue(pal.isShowingPartialsLabels())
313+
314+
def test_partials_labels_deactivate(self):
315+
pal = QgsPalLabeling()
316+
# Disable partials labels
317+
pal.setShowingPartialsLabels(False)
318+
self.assertFalse(pal.isShowingPartialsLabels())
319+
297320

298321

299322
def runSuite(module, tests):

‎tests/src/python/test_qgspallabeling_canvas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def setUpClass(cls):
4646
def setUp(self):
4747
"""Run before each test."""
4848
self.configTest('pal_canvas', 'sp')
49+
TestQgsPalLabeling.setDefaultEngineSettings()
4950
self.lyr = self.defaultSettings()
5051

5152
def tearDown(self):

‎tests/src/python/test_qgspallabeling_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def setUpClass(cls):
151151
def setUp(self):
152152
"""Run before each test."""
153153
self.configTest('pal_server', 'sp')
154+
TestQgsPalLabeling.setDefaultEngineSettings()
154155
self.lyr = self.defaultSettings()
155156
self.params = self.defaultWmsParams('point')
156157
self._TestImage = ''

‎tests/src/python/test_qgspallabeling_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,26 @@ def test_text_color(self):
5151
# Label color change
5252
self.lyr.textColor = Qt.blue
5353
self.checkTest()
54+
55+
def test_partials_labels_enabled(self):
56+
# Set Big font size
57+
font = QFont(self._TestFont)
58+
font.setPointSizeF(90)
59+
self.lyr.textFont = font
60+
# Enable partials labels
61+
self._PalEngine.setShowingPartialsLabels(True)
62+
# Check
63+
self.checkTest()
64+
65+
def test_partials_labels_disabled(self):
66+
# Set Big font size
67+
font = QFont(self._TestFont)
68+
font.setPointSizeF(90)
69+
self.lyr.textFont = font
70+
# Disable partials labels
71+
self._PalEngine.setShowingPartialsLabels(False)
72+
# Check
73+
self.checkTest()
5474

5575

5676
if __name__ == '__main__':

0 commit comments

Comments
 (0)
Please sign in to comment.