Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Sep 18, 2012
2 parents 117e6f9 + 9c6ebdd commit 78cb4e0
Show file tree
Hide file tree
Showing 29 changed files with 549 additions and 85 deletions.
4 changes: 2 additions & 2 deletions debian/changelog
Expand Up @@ -6,10 +6,10 @@ qgis (1.9.0) UNRELEASED; urgency=low
* symbology-ng-style now in sqlite3
* include cpt-city files
* support DEB_BUILD_OPTIONS' parallel=n
* add python-unittest2 build dependency for lucid, maverick and squeeze
* add python-unittest2 build dependency for maverick and squeeze
* add python-qscintilla2 dependency to python-qgis

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

qgis (1.8.0) UNRELEASED; urgency=low

Expand Down
1 change: 0 additions & 1 deletion debian/control.lucid
Expand Up @@ -29,7 +29,6 @@ Build-Depends:
python-qt4-dev (>=4.1.0),
python-sip (>= 4.5.0),
python-sip-dev (>= 4.5.0),
python-unittest2,
git-core,
doxygen,
graphviz,
Expand Down
15 changes: 12 additions & 3 deletions python/core/qgsrasterinterface.sip
Expand Up @@ -84,22 +84,31 @@ class QgsRasterInterface

virtual double noDataValue() const;

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

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

virtual bool setInput( QgsRasterInterface* input );

virtual QgsRasterInterface * input () const;

virtual bool on( );

virtual void setOn( bool on );

virtual QgsRasterInterface * srcInput();
QgsRasterInterface * srcInput();

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

void setStatsOn( bool on );

double time( bool cumulative = false );

static QString printValue( double value );

protected:
static double readValue( void *data, QgsRasterInterface::DataType type, int index );

static void writeValue( void *data, QgsRasterInterface::DataType type, int index, double value );
};

8 changes: 8 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -5671,6 +5671,10 @@ void QgisApp::options()
{
mScaleEdit->updateScales();
}

qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureDist )->updateSettings();
qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureArea )->updateSettings();
qobject_cast<QgsMapToolMeasureAngle*>( mMapTools.mMeasureAngle )->updateSettings();
}

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

qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureDist )->updateSettings();
qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureArea )->updateSettings();
qobject_cast<QgsMapToolMeasureAngle*>( mMapTools.mMeasureAngle )->updateSettings();

// Set the window title.
setTitleBarText_( *this );

Expand Down
16 changes: 0 additions & 16 deletions src/app/qgsdisplayangle.cpp
Expand Up @@ -24,36 +24,20 @@ QgsDisplayAngle::QgsDisplayAngle( QgsMapToolMeasureAngle * tool, Qt::WFlags f )
: QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool )
{
setupUi( this );
QSettings settings;

// Update whenever the canvas has refreshed. Maybe more often than needed,
// but at least every time any canvas related settings changes
connect( mTool->canvas(), SIGNAL( mapCanvasRefreshed() ),
this, SLOT( updateSettings() ) );

updateSettings();
}

QgsDisplayAngle::~QgsDisplayAngle()
{

}


void QgsDisplayAngle::setValueInRadians( double value )
{
mValue = value;
updateUi();
}

void QgsDisplayAngle::updateSettings()
{
emit changeProjectionEnabledState();
}

void QgsDisplayAngle::updateUi()
{

QSettings settings;
QString unitString = settings.value( "/qgis/measure/angleunits", "degrees" ).toString();
int decimals = settings.value( "/qgis/measure/decimalplaces", "3" ).toInt();
Expand Down
8 changes: 0 additions & 8 deletions src/app/qgsdisplayangle.h
Expand Up @@ -31,14 +31,6 @@ class QgsDisplayAngle: public QDialog, private Ui::QgsDisplayAngleBase
be converted to degrees / gon automatically if necessary*/
void setValueInRadians( double value );

signals:
void changeProjectionEnabledState();

private slots:

//! When any external settings change
void updateSettings();

private:
//! pointer to tool which owns this dialog
QgsMapToolMeasureAngle * mTool;
Expand Down
13 changes: 6 additions & 7 deletions src/app/qgsmaptoolmeasureangle.cpp
Expand Up @@ -27,6 +27,9 @@
QgsMapToolMeasureAngle::QgsMapToolMeasureAngle( QgsMapCanvas* canvas ): QgsMapTool( canvas ), mRubberBand( 0 ), mResultDisplay( 0 )
{
mSnapper.setMapCanvas( canvas );

connect( canvas->mapRenderer(), SIGNAL( destinationSrsChanged() ),
this, SLOT( updateSettings() ) );
}

QgsMapToolMeasureAngle::~QgsMapToolMeasureAngle()
Expand Down Expand Up @@ -87,8 +90,6 @@ void QgsMapToolMeasureAngle::canvasReleaseEvent( QMouseEvent * e )
{
mResultDisplay = new QgsDisplayAngle( this );
QObject::connect( mResultDisplay, SIGNAL( rejected() ), this, SLOT( stopMeasuring() ) );
QObject::connect( mResultDisplay, SIGNAL( changeProjectionEnabledState() ),
this, SLOT( changeProjectionEnabledState() ) );
}
configureDistanceArea();
createRubberBand();
Expand Down Expand Up @@ -147,10 +148,11 @@ QgsPoint QgsMapToolMeasureAngle::snapPoint( const QPoint& p )
}
}

void QgsMapToolMeasureAngle::changeProjectionEnabledState()
void QgsMapToolMeasureAngle::updateSettings()
{
if ( mAnglePoints.size() != 3 )
return;

if ( !mResultDisplay )
return;

Expand All @@ -173,8 +175,8 @@ void QgsMapToolMeasureAngle::changeProjectionEnabledState()
resultAngle = -M_PI + ( resultAngle - M_PI );
}
}
mResultDisplay->setValueInRadians( resultAngle );

mResultDisplay->setValueInRadians( resultAngle );
}

void QgsMapToolMeasureAngle::configureDistanceArea()
Expand All @@ -193,6 +195,3 @@ void QgsMapToolMeasureAngle::configureDistanceArea()
mDa.setEllipsoidalMode( false );
}
}



9 changes: 5 additions & 4 deletions src/app/qgsmaptoolmeasureangle.h
Expand Up @@ -59,14 +59,15 @@ class QgsMapToolMeasureAngle: public QgsMapTool
/** tool for measuring */
QgsDistanceArea mDa;

public slots:
/** recalculate angle if projection state changed*/
void updateSettings();

private slots:
/**Deletes the rubber band and the dialog*/
void stopMeasuring();

/** recalculate angle if projection state changed*/
void changeProjectionEnabledState();

//! Configures distance area objects with ellipsoid / output crs
/** Configures distance area objects with ellipsoid / output crs*/
void configureDistanceArea();

};
Expand Down
10 changes: 0 additions & 10 deletions src/app/qgsmeasuredialog.cpp
Expand Up @@ -48,19 +48,11 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WFlags f )
item->setTextAlignment( 0, Qt::AlignRight );
mTable->addTopLevelItem( item );

// Update whenever the canvas has refreshed. Maybe more often than needed,
// but at least every time any canvas related settings changes
connect( mTool->canvas(), SIGNAL( mapCanvasRefreshed() ),
this, SLOT( updateSettings() ) );

updateSettings();
}

void QgsMeasureDialog::updateSettings()
{
if ( !isVisible() )
return;

QSettings settings;

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

void QgsMeasureDialog::mousePress( QgsPoint &point )
{

show();
raise();
if ( ! mTool->done() )
Expand Down Expand Up @@ -152,7 +143,6 @@ void QgsMeasureDialog::addPoint( QgsPoint &p )
{
Q_UNUSED( p );

QgsDebugMsg( "Entering" );
int numPoints = mTool->points().size();
if ( mMeasureArea && numPoints > 2 )
{
Expand Down
16 changes: 10 additions & 6 deletions src/app/qgsmeasuretool.cpp
Expand Up @@ -40,12 +40,15 @@ QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea )
QPixmap myCrossHairQPixmap = QPixmap(( const char ** ) cross_hair_cursor );
mCursor = QCursor( myCrossHairQPixmap, 8, 8 );

mDone = false;
mDone = true;
// Append point we will move
mPoints.append( QgsPoint( 0, 0 ) );

mDialog = new QgsMeasureDialog( this );
mSnapper.setMapCanvas( canvas );

connect( canvas->mapRenderer(), SIGNAL( destinationSrsChanged() ),
this, SLOT( updateSettings() ) );
}

QgsMeasureTool::~QgsMeasureTool()
Expand Down Expand Up @@ -100,14 +103,14 @@ void QgsMeasureTool::restart()
{
mPoints.clear();
// Append point we will move
mPoints.append( QgsPoint( 0, 0 ) );
// mPoints.append( QgsPoint( 0, 0 ) );

mRubberBand->reset( mMeasureArea );

// re-read settings
updateSettings();

mDone = false;
mDone = true;
mWrongProjectProjection = false;

}
Expand All @@ -120,7 +123,7 @@ void QgsMeasureTool::updateSettings()
int myGreen = settings.value( "/qgis/default_measure_color_green", 180 ).toInt();
int myBlue = settings.value( "/qgis/default_measure_color_blue", 180 ).toInt();
mRubberBand->setColor( QColor( myRed, myGreen, myBlue ) );

mDialog->updateSettings();
}

//////////////////////////
Expand All @@ -132,9 +135,10 @@ void QgsMeasureTool::canvasPressEvent( QMouseEvent * e )
if ( mDone )
{
mDialog->restart();
QgsPoint point = snapPoint( e->pos() );
addPoint( point );
mDone = false;
}
QgsPoint idPoint = snapPoint( e->pos() );
// mDialog->mousePress( idPoint );
}
}

Expand Down
26 changes: 24 additions & 2 deletions src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -542,9 +542,22 @@ void QgsRasterLayerProperties::sync()
}

//add current NoDataValue to NoDataValue line edit
if ( mRasterLayer->isNoDataValueValid() )
// TODO: should be per band
// TODO: no data ranges
if ( mRasterLayer->dataProvider()->srcHasNoDataValue( 1 ) )
{
lblSrcNoDataValue->setText( QgsRasterInterface::printValue( mRasterLayer->dataProvider()->noDataValue( 1 ) ) );
}
else
{
lblSrcNoDataValue->setText( tr( "not defined" ) );
}

QList<QgsRasterInterface::Range> noDataRangeList = mRasterLayer->dataProvider()->userNoDataValue( 1 );
QgsDebugMsg( QString( "noDataRangeList.size = %1" ).arg( noDataRangeList.size() ) );
if ( noDataRangeList.size() > 0 )
{
leNoDataValue->insert( QString::number( mRasterLayer->noDataValue(), 'g' ) );
leNoDataValue->insert( QgsRasterInterface::printValue( noDataRangeList.value( 0 ).min ) );
}
else
{
Expand Down Expand Up @@ -650,11 +663,18 @@ void QgsRasterLayerProperties::apply()
bool myDoubleOk = false;
if ( "" != leNoDataValue->text() )
{
QList<QgsRasterInterface::Range> myNoDataRangeList;
double myNoDataValue = leNoDataValue->text().toDouble( &myDoubleOk );
if ( myDoubleOk )
{
mRasterLayer->setNoDataValue( myNoDataValue );
QgsRasterInterface::Range myNoDataRange;
myNoDataRange.min = myNoDataValue;
myNoDataRange.max = myNoDataValue;

myNoDataRangeList << myNoDataRange;
}
mRasterLayer->dataProvider()->setUserNoDataValue( 1, myNoDataRangeList );
}

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

#if 0
void QgsRasterLayerProperties::on_btnResetNull_clicked( )
{
//If reset NoDataValue is checked do this first, will ignore what ever is in the LineEdit
Expand All @@ -1564,6 +1585,7 @@ void QgsRasterLayerProperties::on_btnResetNull_clicked( )
leNoDataValue->clear();
}
}
#endif

void QgsRasterLayerProperties::toggleBuildPyramidsButton()
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsrasterlayerproperties.h
Expand Up @@ -76,7 +76,7 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
void on_pbnRemoveSelectedRow_clicked();
/** \brief slot executed when the single band radio button is pressed. */
/** \brief slot executed when the reset null value to file default icon is selected */
void on_btnResetNull_clicked( );
//void on_btnResetNull_clicked( );

void pixelSelected( const QgsPoint& );
/** \brief slot executed when the transparency level changes. */
Expand Down
22 changes: 22 additions & 0 deletions src/core/qgsprojectfiletransform.cpp
Expand Up @@ -537,6 +537,28 @@ void QgsProjectFileTransform::transform1800to1900()
void QgsProjectFileTransform::convertRasterProperties( QDomDocument& doc, QDomNode& parentNode,
QDomElement& rasterPropertiesElem, QgsRasterLayer* rlayer )
{
//no data
//TODO: We would need to set no data on all bands, but we dont know number of bands here
QDomNode noDataNode = rasterPropertiesElem.namedItem( "mNoDataValue" );
QDomElement noDataElement = noDataNode.toElement();
if ( !noDataElement.text().isEmpty() )
{
QgsDebugMsg( "mNoDataValue = " + noDataElement.text() );
QDomElement noDataElem = doc.createElement( "noData" );

QDomElement noDataRangeList = doc.createElement( "noDataRangeList" );
noDataRangeList.setAttribute( "bandNo", 1 );

QDomElement noDataRange = doc.createElement( "noDataRange" );
noDataRange.setAttribute( "min", noDataElement.text() );
noDataRange.setAttribute( "max", noDataElement.text() );
noDataRangeList.appendChild( noDataRange );

noDataElem.appendChild( noDataRangeList );

parentNode.appendChild( noDataElem );
}

QDomElement rasterRendererElem = doc.createElement( "rasterrenderer" );
//convert general properties

Expand Down

0 comments on commit 78cb4e0

Please sign in to comment.