Skip to content

Commit 78cb4e0

Browse files
committed
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 117e6f9 + 9c6ebdd commit 78cb4e0

29 files changed

+549
-85
lines changed

debian/changelog

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ qgis (1.9.0) UNRELEASED; urgency=low
66
* symbology-ng-style now in sqlite3
77
* include cpt-city files
88
* support DEB_BUILD_OPTIONS' parallel=n
9-
* add python-unittest2 build dependency for lucid, maverick and squeeze
9+
* add python-unittest2 build dependency for maverick and squeeze
1010
* add python-qscintilla2 dependency to python-qgis
1111

12-
-- Jürgen E. Fischer <jef@norbit.de> Sat, 15 Sep 2012 22:51:38 +0200
12+
-- Jürgen E. Fischer <jef@norbit.de> Mon, 17 Sep 2012 18:08:47 +0200
1313

1414
qgis (1.8.0) UNRELEASED; urgency=low
1515

debian/control.lucid

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Build-Depends:
2929
python-qt4-dev (>=4.1.0),
3030
python-sip (>= 4.5.0),
3131
python-sip-dev (>= 4.5.0),
32-
python-unittest2,
3332
git-core,
3433
doxygen,
3534
graphviz,

python/core/qgsrasterinterface.sip

+12-3
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,31 @@ class QgsRasterInterface
8484

8585
virtual double noDataValue() const;
8686

87-
//void * block( int bandNo, QgsRectangle const & extent, int width, int height );
87+
virtual void * block( int bandNo, const QgsRectangle & extent, int width, int height );
8888

89-
//virtual void * readBlock( int bandNo, QgsRectangle const & extent, int width, int height );
89+
virtual void * readBlock( int bandNo, const QgsRectangle & extent, int width, int height );
9090

9191
virtual bool setInput( QgsRasterInterface* input );
9292

93+
virtual QgsRasterInterface * input () const;
94+
9395
virtual bool on( );
9496

9597
virtual void setOn( bool on );
9698

97-
virtual QgsRasterInterface * srcInput();
99+
QgsRasterInterface * srcInput();
98100

99101
QImage * createImage( int width, int height, QImage::Format format );
100102

101103
void setStatsOn( bool on );
102104

103105
double time( bool cumulative = false );
106+
107+
static QString printValue( double value );
108+
109+
protected:
110+
static double readValue( void *data, QgsRasterInterface::DataType type, int index );
111+
112+
static void writeValue( void *data, QgsRasterInterface::DataType type, int index, double value );
104113
};
105114

src/app/qgisapp.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -5671,6 +5671,10 @@ void QgisApp::options()
56715671
{
56725672
mScaleEdit->updateScales();
56735673
}
5674+
5675+
qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureDist )->updateSettings();
5676+
qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureArea )->updateSettings();
5677+
qobject_cast<QgsMapToolMeasureAngle*>( mMapTools.mMeasureAngle )->updateSettings();
56745678
}
56755679

56765680
delete optionsDialog;
@@ -6824,6 +6828,10 @@ void QgisApp::projectProperties()
68246828
QColor myColor = QColor( myRedInt, myGreenInt, myBlueInt );
68256829
mMapCanvas->setCanvasColor( myColor ); // this is fill color before rendering onto canvas
68266830

6831+
qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureDist )->updateSettings();
6832+
qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureArea )->updateSettings();
6833+
qobject_cast<QgsMapToolMeasureAngle*>( mMapTools.mMeasureAngle )->updateSettings();
6834+
68276835
// Set the window title.
68286836
setTitleBarText_( *this );
68296837

src/app/qgsdisplayangle.cpp

-16
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,20 @@ QgsDisplayAngle::QgsDisplayAngle( QgsMapToolMeasureAngle * tool, Qt::WFlags f )
2424
: QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool )
2525
{
2626
setupUi( this );
27-
QSettings settings;
28-
29-
// Update whenever the canvas has refreshed. Maybe more often than needed,
30-
// but at least every time any canvas related settings changes
31-
connect( mTool->canvas(), SIGNAL( mapCanvasRefreshed() ),
32-
this, SLOT( updateSettings() ) );
33-
34-
updateSettings();
3527
}
3628

3729
QgsDisplayAngle::~QgsDisplayAngle()
3830
{
39-
4031
}
4132

42-
4333
void QgsDisplayAngle::setValueInRadians( double value )
4434
{
4535
mValue = value;
4636
updateUi();
4737
}
4838

49-
void QgsDisplayAngle::updateSettings()
50-
{
51-
emit changeProjectionEnabledState();
52-
}
53-
5439
void QgsDisplayAngle::updateUi()
5540
{
56-
5741
QSettings settings;
5842
QString unitString = settings.value( "/qgis/measure/angleunits", "degrees" ).toString();
5943
int decimals = settings.value( "/qgis/measure/decimalplaces", "3" ).toInt();

src/app/qgsdisplayangle.h

-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@ class QgsDisplayAngle: public QDialog, private Ui::QgsDisplayAngleBase
3131
be converted to degrees / gon automatically if necessary*/
3232
void setValueInRadians( double value );
3333

34-
signals:
35-
void changeProjectionEnabledState();
36-
37-
private slots:
38-
39-
//! When any external settings change
40-
void updateSettings();
41-
4234
private:
4335
//! pointer to tool which owns this dialog
4436
QgsMapToolMeasureAngle * mTool;

src/app/qgsmaptoolmeasureangle.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
QgsMapToolMeasureAngle::QgsMapToolMeasureAngle( QgsMapCanvas* canvas ): QgsMapTool( canvas ), mRubberBand( 0 ), mResultDisplay( 0 )
2828
{
2929
mSnapper.setMapCanvas( canvas );
30+
31+
connect( canvas->mapRenderer(), SIGNAL( destinationSrsChanged() ),
32+
this, SLOT( updateSettings() ) );
3033
}
3134

3235
QgsMapToolMeasureAngle::~QgsMapToolMeasureAngle()
@@ -87,8 +90,6 @@ void QgsMapToolMeasureAngle::canvasReleaseEvent( QMouseEvent * e )
8790
{
8891
mResultDisplay = new QgsDisplayAngle( this );
8992
QObject::connect( mResultDisplay, SIGNAL( rejected() ), this, SLOT( stopMeasuring() ) );
90-
QObject::connect( mResultDisplay, SIGNAL( changeProjectionEnabledState() ),
91-
this, SLOT( changeProjectionEnabledState() ) );
9293
}
9394
configureDistanceArea();
9495
createRubberBand();
@@ -147,10 +148,11 @@ QgsPoint QgsMapToolMeasureAngle::snapPoint( const QPoint& p )
147148
}
148149
}
149150

150-
void QgsMapToolMeasureAngle::changeProjectionEnabledState()
151+
void QgsMapToolMeasureAngle::updateSettings()
151152
{
152153
if ( mAnglePoints.size() != 3 )
153154
return;
155+
154156
if ( !mResultDisplay )
155157
return;
156158

@@ -173,8 +175,8 @@ void QgsMapToolMeasureAngle::changeProjectionEnabledState()
173175
resultAngle = -M_PI + ( resultAngle - M_PI );
174176
}
175177
}
176-
mResultDisplay->setValueInRadians( resultAngle );
177178

179+
mResultDisplay->setValueInRadians( resultAngle );
178180
}
179181

180182
void QgsMapToolMeasureAngle::configureDistanceArea()
@@ -193,6 +195,3 @@ void QgsMapToolMeasureAngle::configureDistanceArea()
193195
mDa.setEllipsoidalMode( false );
194196
}
195197
}
196-
197-
198-

src/app/qgsmaptoolmeasureangle.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ class QgsMapToolMeasureAngle: public QgsMapTool
5959
/** tool for measuring */
6060
QgsDistanceArea mDa;
6161

62+
public slots:
63+
/** recalculate angle if projection state changed*/
64+
void updateSettings();
65+
6266
private slots:
6367
/**Deletes the rubber band and the dialog*/
6468
void stopMeasuring();
6569

66-
/** recalculate angle if projection state changed*/
67-
void changeProjectionEnabledState();
68-
69-
//! Configures distance area objects with ellipsoid / output crs
70+
/** Configures distance area objects with ellipsoid / output crs*/
7071
void configureDistanceArea();
7172

7273
};

src/app/qgsmeasuredialog.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,11 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WFlags f )
4848
item->setTextAlignment( 0, Qt::AlignRight );
4949
mTable->addTopLevelItem( item );
5050

51-
// Update whenever the canvas has refreshed. Maybe more often than needed,
52-
// but at least every time any canvas related settings changes
53-
connect( mTool->canvas(), SIGNAL( mapCanvasRefreshed() ),
54-
this, SLOT( updateSettings() ) );
55-
5651
updateSettings();
5752
}
5853

5954
void QgsMeasureDialog::updateSettings()
6055
{
61-
if ( !isVisible() )
62-
return;
63-
6456
QSettings settings;
6557

6658
mDecimalPlaces = settings.value( "/qgis/measure/decimalplaces", "3" ).toInt();
@@ -106,7 +98,6 @@ void QgsMeasureDialog::restart()
10698

10799
void QgsMeasureDialog::mousePress( QgsPoint &point )
108100
{
109-
110101
show();
111102
raise();
112103
if ( ! mTool->done() )
@@ -152,7 +143,6 @@ void QgsMeasureDialog::addPoint( QgsPoint &p )
152143
{
153144
Q_UNUSED( p );
154145

155-
QgsDebugMsg( "Entering" );
156146
int numPoints = mTool->points().size();
157147
if ( mMeasureArea && numPoints > 2 )
158148
{

src/app/qgsmeasuretool.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea )
4040
QPixmap myCrossHairQPixmap = QPixmap(( const char ** ) cross_hair_cursor );
4141
mCursor = QCursor( myCrossHairQPixmap, 8, 8 );
4242

43-
mDone = false;
43+
mDone = true;
4444
// Append point we will move
4545
mPoints.append( QgsPoint( 0, 0 ) );
4646

4747
mDialog = new QgsMeasureDialog( this );
4848
mSnapper.setMapCanvas( canvas );
49+
50+
connect( canvas->mapRenderer(), SIGNAL( destinationSrsChanged() ),
51+
this, SLOT( updateSettings() ) );
4952
}
5053

5154
QgsMeasureTool::~QgsMeasureTool()
@@ -100,14 +103,14 @@ void QgsMeasureTool::restart()
100103
{
101104
mPoints.clear();
102105
// Append point we will move
103-
mPoints.append( QgsPoint( 0, 0 ) );
106+
// mPoints.append( QgsPoint( 0, 0 ) );
104107

105108
mRubberBand->reset( mMeasureArea );
106109

107110
// re-read settings
108111
updateSettings();
109112

110-
mDone = false;
113+
mDone = true;
111114
mWrongProjectProjection = false;
112115

113116
}
@@ -120,7 +123,7 @@ void QgsMeasureTool::updateSettings()
120123
int myGreen = settings.value( "/qgis/default_measure_color_green", 180 ).toInt();
121124
int myBlue = settings.value( "/qgis/default_measure_color_blue", 180 ).toInt();
122125
mRubberBand->setColor( QColor( myRed, myGreen, myBlue ) );
123-
126+
mDialog->updateSettings();
124127
}
125128

126129
//////////////////////////
@@ -132,9 +135,10 @@ void QgsMeasureTool::canvasPressEvent( QMouseEvent * e )
132135
if ( mDone )
133136
{
134137
mDialog->restart();
138+
QgsPoint point = snapPoint( e->pos() );
139+
addPoint( point );
140+
mDone = false;
135141
}
136-
QgsPoint idPoint = snapPoint( e->pos() );
137-
// mDialog->mousePress( idPoint );
138142
}
139143
}
140144

src/app/qgsrasterlayerproperties.cpp

+24-2
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,22 @@ void QgsRasterLayerProperties::sync()
542542
}
543543

544544
//add current NoDataValue to NoDataValue line edit
545-
if ( mRasterLayer->isNoDataValueValid() )
545+
// TODO: should be per band
546+
// TODO: no data ranges
547+
if ( mRasterLayer->dataProvider()->srcHasNoDataValue( 1 ) )
548+
{
549+
lblSrcNoDataValue->setText( QgsRasterInterface::printValue( mRasterLayer->dataProvider()->noDataValue( 1 ) ) );
550+
}
551+
else
552+
{
553+
lblSrcNoDataValue->setText( tr( "not defined" ) );
554+
}
555+
556+
QList<QgsRasterInterface::Range> noDataRangeList = mRasterLayer->dataProvider()->userNoDataValue( 1 );
557+
QgsDebugMsg( QString( "noDataRangeList.size = %1" ).arg( noDataRangeList.size() ) );
558+
if ( noDataRangeList.size() > 0 )
546559
{
547-
leNoDataValue->insert( QString::number( mRasterLayer->noDataValue(), 'g' ) );
560+
leNoDataValue->insert( QgsRasterInterface::printValue( noDataRangeList.value( 0 ).min ) );
548561
}
549562
else
550563
{
@@ -650,11 +663,18 @@ void QgsRasterLayerProperties::apply()
650663
bool myDoubleOk = false;
651664
if ( "" != leNoDataValue->text() )
652665
{
666+
QList<QgsRasterInterface::Range> myNoDataRangeList;
653667
double myNoDataValue = leNoDataValue->text().toDouble( &myDoubleOk );
654668
if ( myDoubleOk )
655669
{
656670
mRasterLayer->setNoDataValue( myNoDataValue );
671+
QgsRasterInterface::Range myNoDataRange;
672+
myNoDataRange.min = myNoDataValue;
673+
myNoDataRange.max = myNoDataValue;
674+
675+
myNoDataRangeList << myNoDataRange;
657676
}
677+
mRasterLayer->dataProvider()->setUserNoDataValue( 1, myNoDataRangeList );
658678
}
659679

660680
//set renderer from widget
@@ -1551,6 +1571,7 @@ void QgsRasterLayerProperties::on_pbnSaveStyleAs_clicked()
15511571
settings.setValue( "style/lastStyleDir", QFileInfo( outputFileName ).absolutePath() );
15521572
}
15531573

1574+
#if 0
15541575
void QgsRasterLayerProperties::on_btnResetNull_clicked( )
15551576
{
15561577
//If reset NoDataValue is checked do this first, will ignore what ever is in the LineEdit
@@ -1564,6 +1585,7 @@ void QgsRasterLayerProperties::on_btnResetNull_clicked( )
15641585
leNoDataValue->clear();
15651586
}
15661587
}
1588+
#endif
15671589

15681590
void QgsRasterLayerProperties::toggleBuildPyramidsButton()
15691591
{

src/app/qgsrasterlayerproperties.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
7676
void on_pbnRemoveSelectedRow_clicked();
7777
/** \brief slot executed when the single band radio button is pressed. */
7878
/** \brief slot executed when the reset null value to file default icon is selected */
79-
void on_btnResetNull_clicked( );
79+
//void on_btnResetNull_clicked( );
8080

8181
void pixelSelected( const QgsPoint& );
8282
/** \brief slot executed when the transparency level changes. */

src/core/qgsprojectfiletransform.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,28 @@ void QgsProjectFileTransform::transform1800to1900()
537537
void QgsProjectFileTransform::convertRasterProperties( QDomDocument& doc, QDomNode& parentNode,
538538
QDomElement& rasterPropertiesElem, QgsRasterLayer* rlayer )
539539
{
540+
//no data
541+
//TODO: We would need to set no data on all bands, but we dont know number of bands here
542+
QDomNode noDataNode = rasterPropertiesElem.namedItem( "mNoDataValue" );
543+
QDomElement noDataElement = noDataNode.toElement();
544+
if ( !noDataElement.text().isEmpty() )
545+
{
546+
QgsDebugMsg( "mNoDataValue = " + noDataElement.text() );
547+
QDomElement noDataElem = doc.createElement( "noData" );
548+
549+
QDomElement noDataRangeList = doc.createElement( "noDataRangeList" );
550+
noDataRangeList.setAttribute( "bandNo", 1 );
551+
552+
QDomElement noDataRange = doc.createElement( "noDataRange" );
553+
noDataRange.setAttribute( "min", noDataElement.text() );
554+
noDataRange.setAttribute( "max", noDataElement.text() );
555+
noDataRangeList.appendChild( noDataRange );
556+
557+
noDataElem.appendChild( noDataRangeList );
558+
559+
parentNode.appendChild( noDataElem );
560+
}
561+
540562
QDomElement rasterRendererElem = doc.createElement( "rasterrenderer" );
541563
//convert general properties
542564

0 commit comments

Comments
 (0)