Skip to content

Commit 7bc72d4

Browse files
committed
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

+1,095-1,109
Large diffs are not rendered by default.

python/core/qgspallabeling.sip

+3
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

+1
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

+2-1
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
+72
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

+1-1
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

+8-4
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

+1-1
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

+2
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

+6-3
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

+4
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

+6-1
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

+33
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

+15-1
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

+13-1
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

+19-2
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

0 commit comments

Comments
 (0)