Skip to content

Commit 69308d3

Browse files
committed
Merge branch 'master' into qgsexpression_DA
2 parents a448f6a + a4484b2 commit 69308d3

33 files changed

+633
-121
lines changed

python/console/console.py

-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ def openHelp(self):
360360
self.helpDlg.activateWindow()
361361

362362
def openSettings(self):
363-
#options = optionsDialog()
364363
self.options.exec_()
365364

366365
def prefChanged(self):

python/console/console_sci.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ def __init__(self, parent=None):
7272
self.setCaretWidth(2)
7373

7474
# Set Python lexer
75-
# Set style for Python comments (style number 1) to a fixed-width
76-
# courier.
7775
self.setLexers()
7876

7977
# Indentation
@@ -130,19 +128,16 @@ def commandConsole(self, command):
130128
self.setSelection(line, 4, line, selCmdLenght)
131129
self.removeSelectedText()
132130
if command == "iface":
133-
"""Import QgisInterface class"""
131+
# import QgisInterface class
134132
self.append('from qgis.utils import iface')
135133
elif command == "sextante":
136-
"""Import Sextante class"""
137-
self.append('from sextante.core.Sextante import Sextante')
138-
elif command == "cLayer":
139-
"""Retrieve current Layer from map camvas"""
140-
self.append('cLayer = iface.mapCanvas().currentLayer()')
134+
# import Sextante class
135+
self.append('import sextante')
141136
elif command == "qtCore":
142-
"""Import QtCore class"""
137+
# import QtCore class
143138
self.append('from PyQt4.QtCore import *')
144139
elif command == "qtGui":
145-
"""Import QtGui class"""
140+
# import QtGui class
146141
self.append('from PyQt4.QtGui import *')
147142
self.entered()
148143
self.move_cursor_to_end()

python/core/qgspallabeling.sip

+2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class QgsPalLayerSettings
135135
bool reverseDirectionSymbol;
136136
DirectionSymbols placeDirectionSymbol; // whether to place left/right, above or below label
137137
unsigned int upsidedownLabels; // whether, or how, to show upsidedown labels
138+
double maxCurvedCharAngleIn; // maximum angle between inside curved label characters (defaults to 20.0, range 20.0 to 60.0)
139+
double maxCurvedCharAngleOut; // maximum angle between outside curved label characters (defaults to -20.0, range -20.0 to -95.0)
138140
bool fontSizeInMapUnits; //true if font size is in map units (otherwise in points)
139141
bool fontLimitPixelSize; // true is label should be limited by fontMinPixelSize/fontMaxPixelSize
140142
int fontMinPixelSize; // minimum pixel size for showing rendered map unit labels (1 - 1000)

python/core/symbology-ng/qgssvgcache.sip

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class QgsSvgCacheEntry
3434
/**A cache for images / pictures derived from svg files. This class supports parameter replacement in svg files
3535
according to the svg params specification (http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/). Supported are
3636
the parameters 'fill-color', 'pen-color', 'outline-width', 'stroke-width'. E.g. <circle fill="param(fill-color red)" stroke="param(pen-color black)" stroke-width="param(outline-width 1)"*/
37-
class QgsSvgCache
37+
class QgsSvgCache : QObject
3838
{
3939
%TypeHeaderCode
4040
#include <qgssvgcache.h>
@@ -56,7 +56,8 @@ class QgsSvgCache
5656
double& defaultOutlineWidth ) const;
5757

5858
protected:
59-
QgsSvgCache();
59+
//! protected constructor
60+
QgsSvgCache( QObject* parent = 0 );
6061

6162
/**Creates new cache entry and returns pointer to it*/
6263
QgsSvgCacheEntry* insertSVG( const QString& file, int size, const QColor& fill, const QColor& outline, double outlineWidth,

python/gui/qgisinterface.sip

+5-1
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,16 @@ class QgisInterface : QObject
359359
virtual QAction *actionAddPgLayer() = 0;
360360
virtual QAction *actionAddWmsLayer() = 0;
361361
virtual QAction *actionLayerSeparator1() = 0 /Deprecated/;
362+
/** @note added in 1.9 */
363+
virtual QAction *actionCopyLayerStyle() = 0;
364+
/** @note added in 1.9 */
365+
virtual QAction *actionPasteLayerStyle() = 0;
362366
virtual QAction *actionOpenTable() = 0;
363367
virtual QAction *actionToggleEditing() = 0;
364368
virtual QAction *actionLayerSaveAs() = 0;
365369
virtual QAction *actionLayerSelectionSaveAs() = 0;
366370
virtual QAction *actionRemoveLayer() = 0;
367-
/** @note added in 2.0 */
371+
/** @note added in 1.9 */
368372
virtual QAction *actionDuplicateLayer() = 0;
369373
virtual QAction *actionLayerProperties() = 0;
370374
virtual QAction *actionLayerSeparator2() = 0 /Deprecated/;

python/plugins/db_manager/db_plugins/spatialite/connector.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def fieldTypes(self):
121121
return [
122122
"integer", "bigint", "smallint", # integers
123123
"real", "double", "float", "numeric", # floats
124-
"varchar(n)", "character(n)", "text", # strings
124+
"varchar", "varchar(n)", "character(n)", "text", # strings
125125
"date", "datetime" # date/time
126126
]
127127

src/app/qgisapp.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -280,17 +280,21 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
280280
QAction *actionAddOgrLayer() { return mActionAddOgrLayer; }
281281
QAction *actionAddRasterLayer() { return mActionAddRasterLayer; }
282282
QAction *actionAddPgLayer() { return mActionAddPgLayer; }
283-
QAction *actionAddSpatiaLiteLayer() { return mActionAddSpatiaLiteLayer; };
283+
QAction *actionAddSpatiaLiteLayer() { return mActionAddSpatiaLiteLayer; }
284284
QAction *actionAddWmsLayer() { return mActionAddWmsLayer; }
285285
QAction *actionAddWcsLayer() { return mActionAddWcsLayer; }
286286
QAction *actionAddWfsLayer() { return mActionAddWfsLayer; }
287+
/** @note added in 1.9 */
288+
QAction *actionCopyLayerStyle() { return mActionCopyStyle; }
289+
/** @note added in 1.9 */
290+
QAction *actionPasteLayerStyle() { return mActionPasteStyle; }
287291
QAction *actionOpenTable() { return mActionOpenTable; }
288292
QAction *actionToggleEditing() { return mActionToggleEditing; }
289293
QAction *actionSaveEdits() { return mActionSaveEdits; }
290294
QAction *actionLayerSaveAs() { return mActionLayerSaveAs; }
291295
QAction *actionLayerSelectionSaveAs() { return mActionLayerSelectionSaveAs; }
292296
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
293-
/** @note added in 2.0 */
297+
/** @note added in 1.9 */
294298
QAction *actionDuplicateLayer() { return mActionDuplicateLayer; }
295299
QAction *actionSetLayerCRS() { return mActionSetLayerCRS; }
296300
QAction *actionSetProjectCRSFromLayer() { return mActionSetProjectCRSFromLayer; }
@@ -437,13 +441,13 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
437441
(defaults to the active layer on the legend)
438442
*/
439443
void editPaste( QgsMapLayer * destinationLayer = 0 );
440-
444+
//! copies style of the active layer to the clipboard
441445
/**
442446
\param sourceLayer The layer where the style will be taken from
443447
(defaults to the active layer on the legend)
444448
*/
445449
void copyStyle( QgsMapLayer * sourceLayer = 0 );
446-
//! copies style on the clipboard to the active layer
450+
//! pastes style on the clipboard to the active layer
447451
/**
448452
\param destinatioLayer The layer that the clipboard will be pasted to
449453
(defaults to the active layer on the legend)

src/app/qgisappinterface.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,8 @@ QAction *QgisAppInterface::actionAddRasterLayer() { return qgis->actionAddRaster
460460
QAction *QgisAppInterface::actionAddPgLayer() { return qgis->actionAddPgLayer(); }
461461
QAction *QgisAppInterface::actionAddWmsLayer() { return qgis->actionAddWmsLayer(); }
462462
QAction *QgisAppInterface::actionLayerSeparator1() { return 0; }
463+
QAction *QgisAppInterface::actionCopyLayerStyle() { return qgis->actionCopyLayerStyle(); }
464+
QAction *QgisAppInterface::actionPasteLayerStyle() { return qgis->actionPasteLayerStyle(); }
463465
QAction *QgisAppInterface::actionOpenTable() { return qgis->actionOpenTable(); }
464466
QAction *QgisAppInterface::actionToggleEditing() { return qgis->actionToggleEditing(); }
465467
QAction *QgisAppInterface::actionLayerSaveAs() { return qgis->actionLayerSaveAs(); }

src/app/qgisappinterface.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,16 @@ class QgisAppInterface : public QgisInterface
308308
virtual QAction *actionAddPgLayer();
309309
virtual QAction *actionAddWmsLayer();
310310
virtual QAction *actionLayerSeparator1();
311+
/** @note added in 1.9 */
312+
virtual QAction *actionCopyLayerStyle();
313+
/** @note added in 1.9 */
314+
virtual QAction *actionPasteLayerStyle();
311315
virtual QAction *actionOpenTable();
312316
virtual QAction *actionToggleEditing();
313317
virtual QAction *actionLayerSaveAs();
314318
virtual QAction *actionLayerSelectionSaveAs();
315319
virtual QAction *actionRemoveLayer();
316-
/** @note added in 2.0 */
320+
/** @note added in 1.9 */
317321
virtual QAction *actionDuplicateLayer();
318322
virtual QAction *actionLayerProperties();
319323
virtual QAction *actionLayerSeparator2();

src/app/qgsattributeactiondialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void QgsAttributeActionDialog::addDefaultActions()
340340
insertRow( pos++, QgsAction::GenericPython, tr( "Selected field's value (Identify features tool)" ), "QtGui.QMessageBox.information(None, \"Current field's value\", \"[% $currentfield %]\")", false );
341341
insertRow( pos++, QgsAction::GenericPython, tr( "Clicked coordinates (Run feature actions tool)" ), "QtGui.QMessageBox.information(None, \"Clicked coords\", \"layer: [% $layerid %]\\ncoords: ([% $clickx %],[% $clickx %])\")", false );
342342
insertRow( pos++, QgsAction::OpenUrl, tr( "Open file" ), "[% \"PATH\" %]", false );
343-
insertRow( pos++, QgsAction::OpenUrl, tr( "Search on web based on attribute's value" ), "http://www.google.it/?q=[% \"ATTRIBUTE\" %]", false );
343+
insertRow( pos++, QgsAction::OpenUrl, tr( "Search on web based on attribute's value" ), "http://www.google.com/search?q=[% \"ATTRIBUTE\" %]", false );
344344
}
345345

346346
void QgsAttributeActionDialog::itemSelectionChanged()

src/app/qgslabelinggui.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsM
213213
mUpsidedownRadioOff->setChecked( true );
214214
break;
215215
}
216+
mMaxCharAngleInDSpinBox->setValue( lyr.maxCurvedCharAngleIn );
217+
// lyr.maxCurvedCharAngleOut must be negative, but it is shown as positive spinbox in GUI
218+
mMaxCharAngleOutDSpinBox->setValue( qAbs( lyr.maxCurvedCharAngleOut ) );
216219

217220
wrapCharacterEdit->setText( lyr.wrapChar );
218221
mFontLineHeightSpinBox->setValue( lyr.multilineHeight );
@@ -502,6 +505,10 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
502505
{
503506
lyr.upsidedownLabels = QgsPalLayerSettings::ShowAll;
504507
}
508+
lyr.maxCurvedCharAngleIn = mMaxCharAngleInDSpinBox->value();
509+
// lyr.maxCurvedCharAngleOut must be negative, but it is shown as positive spinbox in GUI
510+
lyr.maxCurvedCharAngleOut = -mMaxCharAngleOutDSpinBox->value();
511+
505512
lyr.minFeatureSize = mMinSizeSpinBox->value();
506513
lyr.limitNumLabels = mLimitLabelChkBox->isChecked();
507514
lyr.maxNumLabels = mLimitLabelSpinBox->value();
@@ -966,6 +973,8 @@ void QgsLabelingGui::updateOptions()
966973
|| ( stackedPlacement->currentWidget() == pageLine && radLineCurved->isChecked() ) )
967974
{
968975
stackedOptions->setCurrentWidget( pageOptionsLine );
976+
mMaxCharAngleFrame->setVisible(( stackedPlacement->currentWidget() == pageLine
977+
&& radLineCurved->isChecked() ) );
969978
}
970979
else
971980
{

src/app/qgsmaptoolidentify.cpp

+15-10
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
205205
return false;
206206
}
207207

208-
QMap< QString, QString > attributes, derivedAttributes;
208+
QMap< QString, QString > derivedAttributes;
209209

210210
QgsPoint point = mCanvas->getCoordinateTransform()->toMapCoordinates( x, y );
211211

@@ -260,6 +260,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
260260
calc.setEllipsoid( ellipsoid );
261261
calc.setSourceCrs( layer->crs().srsid() );
262262
}
263+
263264
QgsFeatureList::iterator f_it = featureList.begin();
264265

265266
bool filter = false;
@@ -281,8 +282,6 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
281282

282283
featureCount++;
283284

284-
QMap<QString, QString> derivedAttributes;
285-
286285
// Calculate derived attributes and insert:
287286
// measure distance or area depending on geometry type
288287
if ( layer->geometryType() == QGis::Line )
@@ -296,33 +295,39 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
296295
f_it->geometry()->wkbType() == QGis::WKBLineString25D )
297296
{
298297
// Add the start and end points in as derived attributes
299-
str = QLocale::system().toString( f_it->geometry()->asPolyline().first().x(), 'g', 10 );
298+
QgsPoint pnt = mCanvas->mapRenderer()->layerToMapCoordinates( layer, f_it->geometry()->asPolyline().first() );
299+
str = QLocale::system().toString( pnt.x(), 'g', 10 );
300300
derivedAttributes.insert( tr( "firstX", "attributes get sorted; translation for lastX should be lexically larger than this one" ), str );
301-
str = QLocale::system().toString( f_it->geometry()->asPolyline().first().y(), 'g', 10 );
301+
str = QLocale::system().toString( pnt.y(), 'g', 10 );
302302
derivedAttributes.insert( tr( "firstY" ), str );
303-
str = QLocale::system().toString( f_it->geometry()->asPolyline().last().x(), 'g', 10 );
303+
pnt = mCanvas->mapRenderer()->layerToMapCoordinates( layer, f_it->geometry()->asPolyline().last() );
304+
str = QLocale::system().toString( pnt.x(), 'g', 10 );
304305
derivedAttributes.insert( tr( "lastX", "attributes get sorted; translation for firstX should be lexically smaller than this one" ), str );
305-
str = QLocale::system().toString( f_it->geometry()->asPolyline().last().y(), 'g', 10 );
306+
str = QLocale::system().toString( pnt.y(), 'g', 10 );
306307
derivedAttributes.insert( tr( "lastY" ), str );
307308
}
308309
}
309310
else if ( layer->geometryType() == QGis::Polygon )
310311
{
311312
double area = calc.measure( f_it->geometry() );
313+
double perimeter = calc.measurePerimeter( f_it->geometry() );
312314
QGis::UnitType myDisplayUnits;
313315
convertMeasurement( calc, area, myDisplayUnits, true ); // area and myDisplayUnits are out params
314316
QString str = calc.textUnit( area, 3, myDisplayUnits, true );
315317
derivedAttributes.insert( tr( "Area" ), str );
318+
convertMeasurement( calc, perimeter, myDisplayUnits, false ); // area and myDisplayUnits are out params
319+
str = calc.textUnit( perimeter, 3, myDisplayUnits, false );
320+
derivedAttributes.insert( tr( "Perimeter" ), str );
316321
}
317322
else if ( layer->geometryType() == QGis::Point &&
318323
( f_it->geometry()->wkbType() == QGis::WKBPoint ||
319324
f_it->geometry()->wkbType() == QGis::WKBPoint25D ) )
320325
{
321326
// Include the x and y coordinates of the point as a derived attribute
322-
QString str;
323-
str = QLocale::system().toString( f_it->geometry()->asPoint().x(), 'g', 10 );
327+
QgsPoint pnt = mCanvas->mapRenderer()->layerToMapCoordinates( layer, f_it->geometry()->asPoint() );
328+
QString str = QLocale::system().toString( pnt.x(), 'g', 10 );
324329
derivedAttributes.insert( "X", str );
325-
str = QLocale::system().toString( f_it->geometry()->asPoint().y(), 'g', 10 );
330+
str = QLocale::system().toString( pnt.y(), 'g', 10 );
326331
derivedAttributes.insert( "Y", str );
327332
}
328333

src/core/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ SET(QGIS_CORE_MOC_HDRS
320320
gps/qgsgpsdconnection.h
321321

322322
symbology-ng/qgscptcityarchive.h
323+
symbology-ng/qgssvgcache.h
323324
)
324325

325326
IF (WITH_INTERNAL_QEXTSERIALPORT)

src/core/composer/qgscomposerlegend.h

-7
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,6 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem
232232
/**Draws a layer item and all subitems*/
233233
QSizeF drawLayerItemTitle( QgsComposerLayerItem* layerItem, QPainter* painter = 0, QPointF point = QPointF() );
234234

235-
/**Draws child items of a layer item
236-
@param p painter
237-
@param layerItem parent model item (layer)
238-
@param currentPosition in/out: current y position of legend item
239-
@param layerOpacity opacity of the corresponding map layer
240-
*/
241-
242235
Nucleon drawSymbolItem( QgsComposerLegendItem* symbolItem, QPainter* painter = 0, QPointF point = QPointF(), double labelXOffset = 0. );
243236

244237
/**Draws a symbol at the current y position and returns the new x position. Returns real symbol height, because for points,

src/core/pal/feature.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,10 @@ namespace pal
837837
// normalise between -180 and 180
838838
while ( angle_delta > M_PI ) angle_delta -= 2 * M_PI;
839839
while ( angle_delta < -M_PI ) angle_delta += 2 * M_PI;
840-
if ( f->labelInfo->max_char_angle_delta > 0 && fabs( angle_delta ) > f->labelInfo->max_char_angle_delta*( M_PI / 180 ) )
840+
if (( f->labelInfo->max_char_angle_inside > 0 && angle_delta > 0
841+
&& angle_delta > f->labelInfo->max_char_angle_inside*( M_PI / 180 ) )
842+
|| ( f->labelInfo->max_char_angle_outside < 0 && angle_delta < 0
843+
&& angle_delta < f->labelInfo->max_char_angle_outside*( M_PI / 180 ) ) )
841844
{
842845
delete slp;
843846
return NULL;

src/core/pal/feature.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,19 @@ namespace pal
5858
double width;
5959
} CharacterInfo;
6060

61-
LabelInfo( int num, double height )
61+
LabelInfo( int num, double height, double maxinangle = 20.0, double maxoutangle = -20.0 )
6262
{
63-
max_char_angle_delta = 20;
63+
max_char_angle_inside = maxinangle;
64+
// outside angle should be negative
65+
max_char_angle_outside = maxoutangle > 0 ? -maxoutangle : maxoutangle;
6466
label_height = height;
6567
char_num = num;
6668
char_info = new CharacterInfo[num];
6769
}
6870
~LabelInfo() { delete [] char_info; }
6971

70-
double max_char_angle_delta;
72+
double max_char_angle_inside;
73+
double max_char_angle_outside;
7174
double label_height;
7275
int char_num;
7376
CharacterInfo* char_info;

0 commit comments

Comments
 (0)