45 changes: 37 additions & 8 deletions src/app/qgsdecorationgriddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "qgssymbolv2.h"
#include "qgssymbolv2selectordialog.h"
#include "qgssymbolv2propertiesdialog.h"
#include "qgisapp.h"

#include <QFontDialog>
#include <QColorDialog>
Expand Down Expand Up @@ -54,7 +55,7 @@ QgsDecorationGridDialog::QgsDecorationGridDialog( QgsDecorationGrid& deco, QWidg
mAnnotationDirectionComboBox->insertItem( QgsDecorationGrid::Vertical,
tr( "Vertical" ) );
mAnnotationDirectionComboBox->insertItem( QgsDecorationGrid::HorizontalAndVertical,
tr( "Horizontal and Vertical" ) );
tr( "Horizontal and vertical" ) );
mAnnotationDirectionComboBox->insertItem( QgsDecorationGrid::BoundaryDirection,
tr( "Boundary direction" ) );

Expand All @@ -76,15 +77,10 @@ void QgsDecorationGridDialog::updateGuiElements()
mOffsetYSpinBox->setValue( mDeco.gridOffsetY() );

mGridTypeComboBox->setCurrentIndex(( int ) mDeco.gridStyle() );

mCrossWidthSpinBox->setValue( mDeco.crossLength() );

mAnnotationPositionComboBox->setCurrentIndex(( int ) mDeco.gridAnnotationPosition() );

mDrawAnnotationCheckBox->setChecked( mDeco.showGridAnnotation() );

mAnnotationDirectionComboBox->setCurrentIndex(( int ) mDeco.gridAnnotationDirection() );

mCoordinatePrecisionSpinBox->setValue( mDeco.gridAnnotationPrecision() );

// QPen gridPen = mDeco.gridPen();
Expand All @@ -99,7 +95,6 @@ void QgsDecorationGridDialog::updateGuiElements()
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( mLineSymbol, mLineSymbolButton->iconSize() );
mLineSymbolButton->setIcon( icon );
}

if ( mMarkerSymbol )
delete mMarkerSymbol;
if ( mDeco.markerSymbol() )
Expand All @@ -109,13 +104,15 @@ void QgsDecorationGridDialog::updateGuiElements()
mMarkerSymbolButton->setIcon( icon );
}

updateInterval( false );

// blockAllSignals( false );
}

void QgsDecorationGridDialog::updateDecoFromGui()
{
mDeco.setDirty( false );
mDeco.setEnabled( chkEnable->isChecked() );

mDeco.setGridIntervalX( mIntervalXSpinBox->value() );
mDeco.setGridIntervalY( mIntervalYSpinBox->value() );
mDeco.setGridOffsetX( mOffsetXSpinBox->value() );
Expand Down Expand Up @@ -273,6 +270,23 @@ void QgsDecorationGridDialog::on_mMarkerSymbolButton_clicked()
}
}

void QgsDecorationGridDialog::on_mPbtnUpdateFromExtents_clicked()
{
updateInterval( true );
}

void QgsDecorationGridDialog::on_mPbtnUpdateFromLayer_clicked()
{
double values[4];
if ( mDeco.getIntervalFromCurrentLayer( values ) )
{
mIntervalXSpinBox->setValue( values[0] );
mIntervalYSpinBox->setValue( values[1] );
mOffsetXSpinBox->setValue( values[2] );
mOffsetYSpinBox->setValue( values[3] );
}
}

void QgsDecorationGridDialog::on_mAnnotationFontButton_clicked()
{
bool ok;
Expand All @@ -287,3 +301,18 @@ void QgsDecorationGridDialog::on_mAnnotationFontButton_clicked()
mDeco.setGridAnnotationFont( newFont );
}
}

void QgsDecorationGridDialog::updateInterval( bool force )
{
if ( force || mDeco.isDirty() )
{
double values[4];
if ( mDeco.getIntervalFromExtent( values, true ) )
{
mIntervalXSpinBox->setValue( values[0] );
mIntervalYSpinBox->setValue( values[1] );
mOffsetXSpinBox->setValue( values[2] );
mOffsetYSpinBox->setValue( values[3] );
}
}
}
3 changes: 3 additions & 0 deletions src/app/qgsdecorationgriddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class QgsDecorationGridDialog : public QDialog, private Ui::QgsDecorationGridDia
void on_mGridTypeComboBox_currentIndexChanged( int index );
void on_mLineSymbolButton_clicked();
void on_mMarkerSymbolButton_clicked();
void on_mPbtnUpdateFromExtents_clicked();
void on_mPbtnUpdateFromLayer_clicked();

// from composer map
/* void on_mLineColorButton_clicked(); */
Expand All @@ -56,6 +58,7 @@ class QgsDecorationGridDialog : public QDialog, private Ui::QgsDecorationGridDia

void updateGuiElements();
void updateDecoFromGui();
void updateInterval( bool force = false );

};

Expand Down
3 changes: 1 addition & 2 deletions src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,7 @@ bool QgsRasterLayer::hasStatistics( int theBandNo )
bool QgsRasterLayer::identify( const QgsPoint& thePoint, QMap<QString, QString>& theResults )
{
theResults.clear();

QgsDebugMsg( "identify provider : " + mProviderKey ) ;
// QgsDebugMsg( "identify provider : " + mProviderKey ) ;
return ( mDataProvider->identify( thePoint, theResults ) );
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ int QgsGdalProvider::ySize() const { return mHeight; }

bool QgsGdalProvider::identify( const QgsPoint& thePoint, QMap<QString, QString>& theResults )
{
QgsDebugMsg( "Entered" );
// QgsDebugMsg( "Entered" );
if ( !mExtent.contains( thePoint ) )
{
// Outside the raster
Expand Down
234 changes: 132 additions & 102 deletions src/ui/qgsdecorationgriddialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>484</width>
<width>613</width>
<height>367</height>
</rect>
</property>
Expand All @@ -18,7 +18,7 @@
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0,0,0" columnminimumwidth="125,100,0,0">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0,0,0,0" columnminimumwidth="125,100,0,0,0">
<item row="0" column="0">
<widget class="QCheckBox" name="chkEnable">
<property name="sizePolicy">
Expand All @@ -38,105 +38,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" rowspan="11">
<widget class="QGroupBox" name="mDrawAnnotationCheckBox">
<property name="title">
<string>Draw annotation</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="mAnnotationPositionLabel">
<property name="text">
<string>Annotation position</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mAnnotationPositionComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mAnnotationDirectionLabel">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>Annotation direction</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mAnnotationDirectionComboBox"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="mAnnotationFontButton">
<property name="text">
<string>Font...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mDistanceToFrameLabel">
<property name="text">
<string>Distance to map frame</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="mCoordinatePrecisionLabel">
<property name="text">
<string>Coordinate precision</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="mCoordinatePrecisionSpinBox"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mIntervalXLabel">
<property name="text">
Expand Down Expand Up @@ -349,7 +250,7 @@
</property>
<property name="minimumSize">
<size>
<width>100</width>
<width>125</width>
<height>0</height>
</size>
</property>
Expand Down Expand Up @@ -383,6 +284,135 @@
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" rowspan="8" colspan="2">
<widget class="QGroupBox" name="mDrawAnnotationCheckBox">
<property name="title">
<string>Draw annotation</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="mAnnotationPositionLabel">
<property name="text">
<string>Annotation position</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mAnnotationPositionComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mAnnotationDirectionLabel">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>Annotation direction</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mAnnotationDirectionComboBox"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="mAnnotationFontButton">
<property name="text">
<string>Font...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mDistanceToFrameLabel">
<property name="text">
<string>Distance to map frame</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="mCoordinatePrecisionLabel">
<property name="text">
<string>Coordinate precision</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="mCoordinatePrecisionSpinBox"/>
</item>
</layout>
</widget>
</item>
<item row="9" column="3" colspan="2">
<widget class="QLabel" name="label">
<property name="midLineWidth">
<number>0</number>
</property>
<property name="text">
<string>Update Interval:</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="10" column="4">
<widget class="QPushButton" name="mPbtnUpdateFromLayer">
<property name="text">
<string>From Layer</string>
</property>
</widget>
</item>
<item row="10" column="3">
<widget class="QPushButton" name="mPbtnUpdateFromExtents">
<property name="text">
<string>From Extents</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down