[QGIS Commit] r11774 - in trunk/qgis/src: app/composer
core/composer ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Oct 8 12:59:08 EDT 2009
Author: mhugent
Date: 2009-10-08 12:59:08 -0400 (Thu, 08 Oct 2009)
New Revision: 11774
Modified:
trunk/qgis/src/app/composer/qgscomposermapwidget.cpp
trunk/qgis/src/app/composer/qgscomposermapwidget.h
trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp
trunk/qgis/src/core/composer/qgscomposeritem.cpp
trunk/qgis/src/core/composer/qgscomposeritem.h
trunk/qgis/src/core/composer/qgscomposermap.cpp
trunk/qgis/src/core/composer/qgscomposermap.h
trunk/qgis/src/ui/qgscomposermapwidgetbase.ui
Log:
[FEATURE] Possibility to add a grid to composer maps
Modified: trunk/qgis/src/app/composer/qgscomposermapwidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposermapwidget.cpp 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/app/composer/qgscomposermapwidget.cpp 2009-10-08 16:59:08 UTC (rev 11774)
@@ -19,14 +19,17 @@
#include "qgscomposeritemwidget.h"
#include "qgscomposermap.h"
#include "qgsmaprenderer.h"
+#include <QColorDialog>
+#include <QFontDialog>
QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidget(), mComposerMap( composerMap )
{
setupUi( this );
+ mAnnotationDirectionComboBox->setEnabled( false ); //not yet supported
//add widget for general composer item properties
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerMap );
- gridLayout->addWidget( itemPropertiesWidget, 9, 0, 1, 5 );
+ gridLayout_3->addWidget( itemPropertiesWidget, 8, 0, 1, 1 );
QDoubleValidator v( 0 );
mWidthLineEdit->setValidator( &v );
@@ -38,10 +41,22 @@
mYMinLineEdit->setValidator( &v );
mYMaxLineEdit->setValidator( &v );
+ blockAllSignals( true );
mPreviewModeComboBox->insertItem( 0, tr( "Cache" ) );
mPreviewModeComboBox->insertItem( 1, tr( "Render" ) );
mPreviewModeComboBox->insertItem( 2, tr( "Rectangle" ) );
+ mGridTypeComboBox->insertItem( 0, tr( "Solid" ) );
+ mGridTypeComboBox->insertItem( 1, tr( "Cross" ) );
+
+ mAnnotationPositionComboBox->insertItem( 0, tr( "Inside frame" ) );
+ mAnnotationPositionComboBox->insertItem( 1, tr( "Outside frame" ) );
+
+ mAnnotationDirectionComboBox->insertItem( 0, tr( "Horizontal" ) );
+ mAnnotationDirectionComboBox->insertItem( 1, tr( "Vertical" ) );
+ mAnnotationDirectionComboBox->insertItem( 2, tr( "Horizontal and Vertical" ) );
+ blockAllSignals( false );
+
if ( composerMap )
{
connect( composerMap, SIGNAL( extentChanged() ), this, SLOT( updateSettingsNoSignals() ) );
@@ -220,6 +235,8 @@
{
if ( mComposerMap )
{
+ blockAllSignals( true );
+
//width, height, scale
QRectF composerMapRect = mComposerMap->rect();
mWidthLineEdit->setText( QString::number( composerMapRect.width() ) );
@@ -255,7 +272,6 @@
mYMaxLineEdit->setText( QString::number( composerMapExtent.yMaximum(), 'f', 3 ) );
//keep layer list check box
- mKeepLayerListCheckBox->blockSignals( true );
if ( mComposerMap->keepLayerSet() )
{
mKeepLayerListCheckBox->setCheckState( Qt::Checked );
@@ -264,7 +280,73 @@
{
mKeepLayerListCheckBox->setCheckState( Qt::Unchecked );
}
- mKeepLayerListCheckBox->blockSignals( false );
+
+ //grid
+ if ( mComposerMap->gridEnabled() )
+ {
+ mGridCheckBox->setCheckState( Qt::Checked );
+ }
+ else
+ {
+ mGridCheckBox->setCheckState( Qt::Unchecked );
+ }
+
+ mIntervalXSpinBox->setValue( mComposerMap->gridIntervalX() );
+ mIntervalYSpinBox->setValue( mComposerMap->gridIntervalY() );
+ mOffsetXSpinBox->setValue( mComposerMap->gridOffsetX() );
+ mOffsetYSpinBox->setValue( mComposerMap->gridOffsetY() );
+
+ QgsComposerMap::GridStyle gridStyle = mComposerMap->gridStyle();
+ if ( gridStyle == QgsComposerMap::Cross )
+ {
+ mGridTypeComboBox->setCurrentIndex( mGridTypeComboBox->findText( tr( "Cross" ) ) );
+ }
+ else
+ {
+ mGridTypeComboBox->setCurrentIndex( mGridTypeComboBox->findText( tr( "Solid" ) ) );
+ }
+
+ QgsComposerMap::GridAnnotationPosition annotationPos = mComposerMap->gridAnnotationPosition();
+ if ( annotationPos == QgsComposerMap::InsideMapFrame )
+ {
+ mAnnotationPositionComboBox->setCurrentIndex( mAnnotationPositionComboBox->findText( tr( "Inside frame" ) ) );
+ }
+ else
+ {
+ mAnnotationPositionComboBox->setCurrentIndex( mAnnotationPositionComboBox->findText( tr( "Outside frame" ) ) );
+ }
+
+ mDistanceToMapFrameSpinBox->setValue( mComposerMap->annotationFrameDistance() );
+
+ if ( mComposerMap->showGridAnnotation() )
+ {
+ mDrawAnnotationCheckBox->setCheckState( Qt::Checked );
+ }
+ else
+ {
+ mDrawAnnotationCheckBox->setCheckState( Qt::Unchecked );
+ }
+
+ QgsComposerMap::GridAnnotationDirection dir = mComposerMap->gridAnnotationDirection();
+ if ( dir == QgsComposerMap::Horizontal )
+ {
+ mAnnotationDirectionComboBox->setCurrentIndex( mAnnotationDirectionComboBox->findText( tr( "Horizontal" ) ) );
+ }
+ else if ( dir == QgsComposerMap::Vertical )
+ {
+ mAnnotationDirectionComboBox->setCurrentIndex( mAnnotationDirectionComboBox->findText( tr( "Vertical" ) ) );
+ }
+ else
+ {
+ mAnnotationDirectionComboBox->setCurrentIndex( mAnnotationDirectionComboBox->findText( tr( "Horizontal and Vertical" ) ) );
+ }
+
+
+ QPen gridPen = mComposerMap->gridPen();
+ mLineWidthSpinBox->setValue( gridPen.widthF() );
+ mLineColorButton->setColor( gridPen.color() );
+
+ blockAllSignals( false );
}
}
@@ -291,6 +373,33 @@
mComposerMap->setNewExtent( newExtent );
}
+void QgsComposerMapWidget::blockAllSignals( bool b )
+{
+ mWidthLineEdit->blockSignals( b );
+ mHeightLineEdit->blockSignals( b );
+ mScaleLineEdit->blockSignals( b );
+ mXMinLineEdit->blockSignals( b );
+ mXMaxLineEdit->blockSignals( b );
+ mYMinLineEdit->blockSignals( b );
+ mYMaxLineEdit->blockSignals( b );
+ mIntervalXSpinBox->blockSignals( b );
+ mIntervalYSpinBox->blockSignals( b );
+ mOffsetXSpinBox->blockSignals( b );
+ mOffsetYSpinBox->blockSignals( b );
+ mGridTypeComboBox->blockSignals( b );
+ mPreviewModeComboBox->blockSignals( b );
+ mKeepLayerListCheckBox->blockSignals( b );
+ mSetToMapCanvasExtentButton->blockSignals( b );
+ mUpdatePreviewButton->blockSignals( b );
+ mLineWidthSpinBox->blockSignals( b );
+ mLineColorButton->blockSignals( b );
+ mDrawAnnotationCheckBox->blockSignals( b );
+ mAnnotationFontButton->blockSignals( b );
+ mAnnotationPositionComboBox->blockSignals( b );
+ mDistanceToMapFrameSpinBox->blockSignals( b );
+ mAnnotationDirectionComboBox->blockSignals( b );
+}
+
void QgsComposerMapWidget::on_mUpdatePreviewButton_clicked()
{
if ( !mComposerMap )
@@ -331,3 +440,203 @@
mComposerMap->setKeepLayerSet( false );
}
}
+
+void QgsComposerMapWidget::on_mGridCheckBox_stateChanged( int state )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+
+ if ( state == Qt::Checked )
+ {
+ mComposerMap->setGridEnabled( true );
+ }
+ else
+ {
+ mComposerMap->setGridEnabled( false );
+ }
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mIntervalXSpinBox_valueChanged( double d )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+ mComposerMap->setGridIntervalX( d );
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mIntervalYSpinBox_valueChanged( double d )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+ mComposerMap->setGridIntervalY( d );
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mOffsetXSpinBox_valueChanged( double d )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+ mComposerMap->setGridOffsetX( d );
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mOffsetYSpinBox_valueChanged( double d )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+ mComposerMap->setGridOffsetY( d );
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mLineWidthSpinBox_valueChanged( double d )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+ mComposerMap->setGridPenWidth( d );
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mLineColorButton_clicked()
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+ QColor newColor = QColorDialog::getColor( mLineColorButton->color() );
+ if ( newColor.isValid() )
+ {
+ mLineColorButton->setColor( newColor );
+ mComposerMap->setGridPenColor( newColor );
+ }
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mGridTypeComboBox_currentIndexChanged( const QString& text )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+
+ if ( text == tr( "Cross" ) )
+ {
+ mComposerMap->setGridStyle( QgsComposerMap::Cross );
+ }
+ else
+ {
+ mComposerMap->setGridStyle( QgsComposerMap::Solid );
+ }
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mAnnotationFontButton_clicked()
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+
+ bool ok;
+#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
+ // Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
+ QFont newFont = QFontDialog::getFont( &ok, mComposerMap->gridAnnotationFont(), this, QString(), QFontDialog::DontUseNativeDialog );
+#else
+ QFont newFont = QFontDialog::getFont( &ok, mComposerMap->gridAnnotationFont(), this );
+#endif
+ if ( ok )
+ {
+ mComposerMap->setGridAnnotationFont( newFont );
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+ }
+}
+
+void QgsComposerMapWidget::on_mDistanceToMapFrameSpinBox_valueChanged( double d )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+ mComposerMap->setAnnotationFrameDistance( d );
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mAnnotationPositionComboBox_currentIndexChanged( const QString& text )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+
+ if ( text == tr( "Inside frame" ) )
+ {
+ mComposerMap->setGridAnnotationPosition( QgsComposerMap::InsideMapFrame );
+ }
+ else
+ {
+ mComposerMap->setGridAnnotationPosition( QgsComposerMap::OutsideMapFrame );
+ }
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mDrawAnnotationCheckBox_stateChanged( int state )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+
+ if ( state == Qt::Checked )
+ {
+ mComposerMap->setShowGridAnnotation( true );
+ }
+ else
+ {
+ mComposerMap->setShowGridAnnotation( false );
+ }
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
+
+void QgsComposerMapWidget::on_mAnnotationDirectionComboBox_currentIndexChanged( const QString& text )
+{
+ if ( !mComposerMap )
+ {
+ return;
+ }
+
+ if ( text == tr( "Horizontal" ) )
+ {
+ mComposerMap->setGridAnnotationDirection( QgsComposerMap::Horizontal );
+ }
+ else if ( text == tr( "Vertical" ) )
+ {
+ mComposerMap->setGridAnnotationDirection( QgsComposerMap::Vertical );
+ }
+ else
+ {
+ mComposerMap->setGridAnnotationDirection( QgsComposerMap::HorizontalAndVertical );
+ }
+ mComposerMap->updateBoundingRect();
+ mComposerMap->update();
+}
Modified: trunk/qgis/src/app/composer/qgscomposermapwidget.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposermapwidget.h 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/app/composer/qgscomposermapwidget.h 2009-10-08 16:59:08 UTC (rev 11774)
@@ -48,6 +48,20 @@
void on_mYMinLineEdit_editingFinished();
void on_mYMaxLineEdit_editingFinished();
+ void on_mGridCheckBox_stateChanged( int state );
+ void on_mIntervalXSpinBox_valueChanged( double d );
+ void on_mIntervalYSpinBox_valueChanged( double d );
+ void on_mOffsetXSpinBox_valueChanged( double d );
+ void on_mOffsetYSpinBox_valueChanged( double d );
+ void on_mLineWidthSpinBox_valueChanged( double d );
+ void on_mLineColorButton_clicked();
+ void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
+ void on_mAnnotationFontButton_clicked();
+ void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
+ void on_mAnnotationPositionComboBox_currentIndexChanged( const QString& text );
+ void on_mDrawAnnotationCheckBox_stateChanged( int state );
+ void on_mAnnotationDirectionComboBox_currentIndexChanged( const QString& text );
+
/**Updates width and height without notify the composer map (to avoid infinite recursion)*/
void updateSettingsNoSignals();
@@ -59,6 +73,9 @@
/**Sets extent of composer map from line edits*/
void updateComposerExtentFromGui();
+
+ /**Blocks / unblocks the signals of all GUI elements*/
+ void blockAllSignals( bool b );
};
#endif
Modified: trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp 2009-10-08 16:59:08 UTC (rev 11774)
@@ -34,7 +34,7 @@
//add widget for general composer item properties
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, picture );
- gridLayout->addWidget( itemPropertiesWidget, 4, 0, 1, 1 );
+ gridLayout->addWidget( itemPropertiesWidget, 6, 0, 1, 4 );
mWidthLineEdit->setValidator( new QDoubleValidator( this ) );
mHeightLineEdit->setValidator( new QDoubleValidator( this ) );
Modified: trunk/qgis/src/core/composer/qgscomposeritem.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposeritem.cpp 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/core/composer/qgscomposeritem.cpp 2009-10-08 16:59:08 UTC (rev 11774)
@@ -678,7 +678,7 @@
}
}
-void QgsComposerItem::drawText( QPainter* p, int x, int y, const QString& text, const QFont& font ) const
+void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize( font );
@@ -687,7 +687,7 @@
p->setPen( QColor( 0, 0, 0 ) ); //draw text always in black
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale( scaleFactor, scaleFactor );
- p->drawText( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE, text );
+ p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );
p->restore();
}
Modified: trunk/qgis/src/core/composer/qgscomposeritem.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposeritem.h 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/core/composer/qgscomposeritem.h 2009-10-08 16:59:08 UTC (rev 11774)
@@ -139,7 +139,7 @@
/**Draws Text. Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter
to work arount the Qt font bug)*/
- void drawText( QPainter* p, int x, int y, const QString& text, const QFont& font ) const;
+ void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const;
/**Like the above, but with a rectangle for multiline text*/
void drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font ) const;
Modified: trunk/qgis/src/core/composer/qgscomposermap.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.cpp 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/core/composer/qgscomposermap.cpp 2009-10-08 16:59:08 UTC (rev 11774)
@@ -42,12 +42,15 @@
int QgsComposerMap::mCurrentComposerId = 0;
QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height )
- : QgsComposerItem( x, y, width, height, composition ), mKeepLayerSet( false )
+ : QgsComposerItem( x, y, width, height, composition ), mKeepLayerSet( false ), mGridEnabled( false ), mGridStyle( Solid ), \
+ mGridIntervalX( 0.0 ), mGridIntervalY( 0.0 ), mGridOffsetX( 0.0 ), mGridOffsetY( 0.0 ), mShowGridAnnotation( false ), \
+ mGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mGridAnnotationDirection( Horizontal )
{
mComposition = composition;
mMapRenderer = mComposition->mapRenderer();
mId = mCurrentComposerId++;
mPreviewMode = QgsComposerMap::Rectangle;
+ mCurrentRectangle = rect();
// Cache
mCacheUpdated = false;
@@ -69,7 +72,9 @@
}
QgsComposerMap::QgsComposerMap( QgsComposition *composition )
- : QgsComposerItem( 0, 0, 10, 10, composition ), mKeepLayerSet( false )
+ : QgsComposerItem( 0, 0, 10, 10, composition ), mKeepLayerSet( false ), mGridEnabled( false ), mGridStyle( Solid ), \
+ mGridIntervalX( 0.0 ), mGridIntervalY( 0.0 ), mGridOffsetX( 0.0 ), mGridOffsetY( 0.0 ), mShowGridAnnotation( false ), \
+ mGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mGridAnnotationDirection( Horizontal )
{
//Offset
mXOffset = 0.0;
@@ -81,8 +86,9 @@
mMapRenderer = mComposition->mapRenderer();
mId = mCurrentComposerId++;
mPreviewMode = QgsComposerMap::Rectangle;
+ mCurrentRectangle = rect();
+
setToolTip( tr( "Map %1" ).arg( mId ) );
- QGraphicsRectItem::show();
}
QgsComposerMap::~QgsComposerMap()
@@ -242,6 +248,11 @@
painter->setClipRect( thisPaintRect , Qt::NoClip );
drawFrame( painter );
+ if ( mGridEnabled )
+ {
+ drawGrid( painter );
+ }
+
if ( isSelected() )
{
drawSelectionBoxes( painter );
@@ -537,6 +548,30 @@
}
composerMapElem.appendChild( layerSetElem );
+ //grid
+ QDomElement gridElem = doc.createElement( "Grid" );
+ gridElem.setAttribute( "show", mGridEnabled );
+ gridElem.setAttribute( "gridStyle", mGridStyle );
+ gridElem.setAttribute( "intervalX", mGridIntervalX );
+ gridElem.setAttribute( "intervalY", mGridIntervalY );
+ gridElem.setAttribute( "offsetX", mGridOffsetX );
+ gridElem.setAttribute( "offsetY", mGridOffsetY );
+ gridElem.setAttribute( "penWidth", mGridPen.widthF() );
+ gridElem.setAttribute( "penColorRed", mGridPen.color().red() );
+ gridElem.setAttribute( "penColorGreen", mGridPen.color().green() );
+ gridElem.setAttribute( "penColorBlue", mGridPen.color().blue() );
+
+ //grid annotation
+ QDomElement annotationElem = doc.createElement( "Annotation" );
+ annotationElem.setAttribute( "show", mShowGridAnnotation );
+ annotationElem.setAttribute( "position", mGridAnnotationPosition );
+ annotationElem.setAttribute( "frameDistance", mAnnotationFrameDistance );
+ annotationElem.setAttribute( "direction", mGridAnnotationDirection );
+ annotationElem.setAttribute( "font", mGridAnnotationFont.toString() );
+
+ gridElem.appendChild( annotationElem );
+ composerMapElem.appendChild( gridElem );
+
elem.appendChild( composerMapElem );
return _writeXML( composerMapElem, doc );
}
@@ -608,6 +643,34 @@
mNumCachedLayers = 0;
mCacheUpdated = false;
+ //grid
+ QDomNodeList gridNodeList = itemElem.elementsByTagName( "Grid" );
+ if ( gridNodeList.size() > 0 )
+ {
+ QDomElement gridElem = gridNodeList.at( 0 ).toElement();
+ mGridEnabled = ( gridElem.attribute( "show", "0" ) != "0" );
+ mGridStyle = QgsComposerMap::GridStyle( gridElem.attribute( "gridStyle", "0" ).toInt() );
+ mGridIntervalX = gridElem.attribute( "intervalX", "0" ).toDouble();
+ mGridIntervalY = gridElem.attribute( "intervalY", "0" ).toDouble();
+ mGridOffsetX = gridElem.attribute( "offsetX", "0" ).toDouble();
+ mGridOffsetY = gridElem.attribute( "offsetY", "0" ).toDouble();
+ mGridPen.setWidthF( gridElem.attribute( "penWidth", "0" ).toDouble() );
+ mGridPen.setColor( QColor( gridElem.attribute( "penColorRed", "0" ).toInt(), \
+ gridElem.attribute( "penColorGreen", "0" ).toInt(), \
+ gridElem.attribute( "penColorBlue", "0" ).toInt() ) );
+
+ QDomNodeList annotationNodeList = gridElem.elementsByTagName( "Annotation" );
+ if ( annotationNodeList.size() > 0 )
+ {
+ QDomElement annotationElem = annotationNodeList.at( 0 ).toElement();
+ mShowGridAnnotation = ( annotationElem.attribute( "show", "0" ) != "0" );
+ mGridAnnotationPosition = QgsComposerMap::GridAnnotationPosition( annotationElem.attribute( "position", "0" ).toInt() );
+ mAnnotationFrameDistance = annotationElem.attribute( "frameDistance", "0" ).toDouble();
+ mGridAnnotationDirection = QgsComposerMap::GridAnnotationDirection( annotationElem.attribute( "direction", "0" ).toInt() );
+ mGridAnnotationFont.fromString( annotationElem.attribute( "font", "" ) );
+ }
+ }
+
//restore general composer item properties
QDomNodeList composerItemList = itemElem.elementsByTagName( "ComposerItem" );
if ( composerItemList.size() > 0 )
@@ -616,6 +679,8 @@
_readXML( composerItemElem, doc );
}
+ updateBoundingRect();
+
if ( mPreviewMode != Rectangle )
{
cache();
@@ -649,3 +714,284 @@
}
}
}
+
+void QgsComposerMap::drawGrid( QPainter* p )
+{
+ p->setPen( mGridPen );
+
+ QList< QPair< double, QLineF > > verticalLines;
+ verticalGridLines( verticalLines );
+ QList< QPair< double, QLineF > >::const_iterator vIt = verticalLines.constBegin();
+ QList< QPair< double, QLineF > > horizontalLines;
+ horizontalGridLines( horizontalLines );
+ QList< QPair< double, QLineF > >::const_iterator hIt = horizontalLines.constBegin();
+
+ //simpler approach: draw vertical lines first, then horizontal ones
+ if ( mGridStyle == QgsComposerMap::Solid )
+ {
+ for ( ; vIt != verticalLines.constEnd(); ++vIt )
+ {
+ p->drawLine( vIt->second );
+ }
+
+ for ( ; hIt != horizontalLines.constEnd(); ++hIt )
+ {
+ p->drawLine( hIt->second );
+ }
+ }
+ //more complicated approach. Find out all the crossings between the lines
+ //needs to be adapted once rotation is possible
+ else if ( mGridStyle == QgsComposerMap::Cross )
+ {
+
+ double resolutionXSize = mGridIntervalX * ( rect().width() / mExtent.width() );
+ double resolutionYSize = mGridIntervalY * ( rect().height() / mExtent.height() );
+
+ QLineF currHLine;
+ QLineF currVLine;
+ for ( ; hIt != horizontalLines.constEnd(); ++hIt )
+ {
+ currHLine = hIt->second;
+ vIt = verticalLines.constBegin();
+ for ( ; vIt != verticalLines.constEnd(); ++vIt )
+ {
+ currVLine = vIt->second;
+
+ //intersection
+ //find out intersection point
+ QPointF intersectionPoint;
+ QLineF::IntersectType t = currHLine.intersect( currVLine, &intersectionPoint );
+ if ( t == QLineF::BoundedIntersection )
+ {
+ p->drawLine( intersectionPoint.x() - resolutionXSize / 6.0, intersectionPoint.y(), intersectionPoint.x() + resolutionXSize / 6.0, intersectionPoint.y() );
+ p->drawLine( intersectionPoint.x(), intersectionPoint.y() - resolutionYSize / 6.0, intersectionPoint.x(), intersectionPoint.y() + resolutionYSize / 6.0 );
+ }
+ }
+ }
+ }
+
+ if ( mShowGridAnnotation )
+ {
+ drawGridAnnotations( p, horizontalLines, verticalLines );
+ }
+}
+
+void QgsComposerMap::drawGridAnnotations( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines )
+{
+ //annotations. todo: make left / right, within / outside and distances configurable
+ //current annotation, width and height
+ QString currentAnnotationString;
+ double currentFontWidth = 0;
+ double currentFontHeight = fontAscentMillimeters( mGridAnnotationFont );
+
+ QList< QPair< double, QLineF > >::const_iterator vIt = vLines.constBegin();
+ for ( ; vIt != vLines.constEnd(); ++vIt )
+ {
+ currentAnnotationString = QString::number( vIt->first );
+ currentFontWidth = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString );
+
+ if ( mGridAnnotationPosition == OutsideMapFrame )
+ {
+ drawText( p, vIt->second.x1() - currentFontWidth / 2.0, vIt->second.y1() - mAnnotationFrameDistance, currentAnnotationString, mGridAnnotationFont );
+ drawText( p, vIt->second.x2() - currentFontWidth / 2.0, vIt->second.y2() + mAnnotationFrameDistance + currentFontHeight, currentAnnotationString, mGridAnnotationFont );
+ }
+ else
+ {
+ drawText( p, vIt->second.x1() - currentFontWidth / 2.0, vIt->second.y1() + mAnnotationFrameDistance + currentFontHeight, currentAnnotationString, mGridAnnotationFont );
+ drawText( p, vIt->second.x2() - currentFontWidth / 2.0, vIt->second.y2() - mAnnotationFrameDistance, currentAnnotationString, mGridAnnotationFont );
+ }
+ }
+
+ QList< QPair< double, QLineF > >::const_iterator hIt = hLines.constBegin();
+ for ( ; hIt != hLines.constEnd(); ++hIt )
+ {
+ currentAnnotationString = QString::number( hIt->first );
+ currentFontWidth = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString );
+
+ if ( mGridAnnotationPosition == OutsideMapFrame )
+ {
+ drawText( p, hIt->second.x1() - ( mAnnotationFrameDistance + currentFontWidth ), hIt->second.y1() + currentFontHeight / 2.0, currentAnnotationString, mGridAnnotationFont );
+ drawText( p, hIt->second.x2() + mAnnotationFrameDistance, hIt->second.y2() + currentFontHeight / 2.0, currentAnnotationString, mGridAnnotationFont );
+ }
+ else
+ {
+ drawText( p, hIt->second.x1() + mAnnotationFrameDistance, hIt->second.y1() + currentFontHeight / 2.0, currentAnnotationString, mGridAnnotationFont );
+ drawText( p, hIt->second.x2() - ( mAnnotationFrameDistance + currentFontWidth ), hIt->second.y2() + currentFontHeight / 2.0, currentAnnotationString, mGridAnnotationFont );
+ }
+ }
+}
+
+int QgsComposerMap::verticalGridLines( QList< QPair< double, QLineF > >& lines ) const
+{
+ lines.clear();
+ if ( !mGridIntervalX > 0.0 )
+ {
+ return 1;
+ }
+
+ //consider the possible shift in case of content move
+ QgsRectangle mapExtent = transformedExtent();
+
+ double currentLevel = ( int )(( mapExtent.xMinimum() - mGridOffsetX ) / mGridIntervalX + 1.0 ) * mGridIntervalX + mGridOffsetX;
+
+ double xCanvasCoord;
+
+ double border = 0.0;
+ if ( frame() )
+ {
+ border = pen().widthF();
+ }
+
+ while ( currentLevel <= mapExtent.xMaximum() )
+ {
+ xCanvasCoord = rect().width() * ( currentLevel - mapExtent.xMinimum() ) / mapExtent.width();
+ lines.push_back( qMakePair( currentLevel, QLineF( xCanvasCoord, border, xCanvasCoord, rect().height() - border ) ) );
+ currentLevel += mGridIntervalX;
+ }
+ return 0;
+}
+
+int QgsComposerMap::horizontalGridLines( QList< QPair< double, QLineF > >& lines ) const
+{
+ lines.clear();
+ if ( !mGridIntervalY > 0.0 )
+ {
+ return 1;
+ }
+
+ //consider the possible shift in case of content move
+ QgsRectangle mapExtent = transformedExtent();
+
+ double currentLevel = ( int )(( mapExtent.yMinimum() - mGridOffsetY ) / mGridIntervalY + 1.0 ) * mGridIntervalY + mGridOffsetY;
+ double yCanvasCoord;
+
+ double border = 0.0;
+ if ( frame() )
+ {
+ border = pen().widthF();
+ }
+
+ while ( currentLevel <= mapExtent.yMaximum() )
+ {
+ yCanvasCoord = rect().height() * ( 1 - ( currentLevel - mapExtent.yMinimum() ) / mapExtent.height() );
+ lines.push_back( qMakePair( currentLevel, QLineF( border, yCanvasCoord, rect().width() - border, yCanvasCoord ) ) );
+ currentLevel += mGridIntervalY;
+ }
+ return 0;
+}
+
+void QgsComposerMap::setGridPenWidth( double w )
+{
+ mGridPen.setWidthF( w );
+}
+
+void QgsComposerMap::setGridPenColor( const QColor& c )
+{
+ mGridPen.setColor( c );
+}
+
+QRectF QgsComposerMap::boundingRect() const
+{
+ return mCurrentRectangle;
+}
+
+void QgsComposerMap::updateBoundingRect()
+{
+ QRectF rectangle = rect();
+ double xExtension = maxExtensionXDirection();
+ double yExtension = maxExtensionYDirection();
+ rectangle.setLeft( rectangle.left() - xExtension );
+ rectangle.setRight( rectangle.right() + xExtension );
+ rectangle.setTop( rectangle.top() - yExtension );
+ rectangle.setBottom( rectangle.bottom() + yExtension );
+ if ( rectangle != mCurrentRectangle )
+ {
+ prepareGeometryChange();
+ mCurrentRectangle = rectangle;
+ }
+}
+
+QgsRectangle QgsComposerMap::transformedExtent() const
+{
+ double paperToMapFactor = mExtent.width() / rect().width();
+ double xMapOffset = -mXOffset * paperToMapFactor;
+ double yMapOffset = mYOffset * paperToMapFactor;
+ return QgsRectangle( mExtent.xMinimum() + xMapOffset, mExtent.yMinimum() + yMapOffset, mExtent.xMaximum() + xMapOffset, mExtent.yMaximum() + yMapOffset );
+}
+
+double QgsComposerMap::maxExtensionXDirection() const
+{
+ if ( mGridAnnotationPosition != OutsideMapFrame )
+ {
+ return 0;
+ }
+
+ QList< QPair< double, QLineF > > horizontalLines;
+ if ( horizontalGridLines( horizontalLines ) != 0 )
+ {
+ return 0;
+ }
+
+ double currentExtension = 0;
+ double maxExtension = 0;
+ QString currentAnnotationString;
+
+ QList< QPair< double, QLineF > >::const_iterator hIt = horizontalLines.constBegin();
+ for ( ; hIt != horizontalLines.constEnd(); ++hIt )
+ {
+ currentAnnotationString = QString::number( hIt->first );
+ if ( mGridAnnotationDirection == Vertical )
+ {
+ currentExtension = fontAscentMillimeters( mGridAnnotationFont ) + mAnnotationFrameDistance;
+ }
+ else
+ {
+ currentExtension = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString ) + mAnnotationFrameDistance;
+ }
+
+ if ( currentExtension > maxExtension )
+ {
+ maxExtension = currentExtension;
+ }
+ }
+
+ return maxExtension;
+}
+
+double QgsComposerMap::maxExtensionYDirection() const
+{
+ if ( mGridAnnotationPosition != OutsideMapFrame )
+ {
+ return 0;
+ }
+
+ QList< QPair< double, QLineF > > verticalLines;
+ if ( verticalGridLines( verticalLines ) != 0 )
+ {
+ return 0;
+ }
+
+ double currentExtension = 0;
+ double maxExtension = 0;
+ QString currentAnnotationString;
+
+ QList< QPair< double, QLineF > >::const_iterator vIt = verticalLines.constBegin();
+ for ( ; vIt != verticalLines.constEnd(); ++vIt )
+ {
+ currentAnnotationString = QString::number( vIt->first );
+ if ( mGridAnnotationDirection == Horizontal )
+ {
+ currentExtension = fontAscentMillimeters( mGridAnnotationFont ) + mAnnotationFrameDistance;
+ }
+ else
+ {
+ currentExtension = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString ) + mAnnotationFrameDistance;
+ }
+
+ if ( currentExtension > maxExtension )
+ {
+ maxExtension = currentExtension;
+ }
+ }
+ return maxExtension;
+}
Modified: trunk/qgis/src/core/composer/qgscomposermap.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.h 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/core/composer/qgscomposermap.h 2009-10-08 16:59:08 UTC (rev 11774)
@@ -54,6 +54,25 @@
Rectangle // Display only rectangle
};
+ enum GridStyle
+ {
+ Solid = 0, //solid lines
+ Cross //only draw line crossings
+ };
+
+ enum GridAnnotationPosition
+ {
+ InsideMapFrame = 0,
+ OutsideMapFrame
+ };
+
+ enum GridAnnotationDirection
+ {
+ Horizontal = 0,
+ Vertical,
+ HorizontalAndVertical
+ };
+
/** \brief Draw to paint device
@param extent map extent
@param size size in scene coordinates
@@ -141,6 +160,49 @@
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
+ void setGridEnabled( bool enabled ) {mGridEnabled = enabled;}
+ bool gridEnabled() const { return mGridEnabled; }
+
+ void setGridStyle( GridStyle style ) {mGridStyle = style;}
+ GridStyle gridStyle() const { return mGridStyle; }
+
+ void setGridIntervalX( double interval ) { mGridIntervalX = interval;}
+ double gridIntervalX() const { return mGridIntervalX; }
+
+ void setGridIntervalY( double interval ) { mGridIntervalY = interval;}
+ double gridIntervalY() const { return mGridIntervalY; }
+
+ void setGridOffsetX( double offset ) { mGridOffsetX = offset; }
+ double gridOffsetX() const { return mGridOffsetX; }
+
+ void setGridOffsetY( double offset ) { mGridOffsetY = offset; }
+ double gridOffsetY() const { return mGridOffsetY; }
+
+ void setGridPen( const QPen& p ) { mGridPen = p; }
+ QPen gridPen() const { return mGridPen; }
+ void setGridPenWidth( double w );
+ void setGridPenColor( const QColor& c );
+
+ void setGridAnnotationFont( const QFont& f ) { mGridAnnotationFont = f; }
+ QFont gridAnnotationFont() const { return mGridAnnotationFont; }
+
+ void setShowGridAnnotation( bool show ) {mShowGridAnnotation = show;}
+ bool showGridAnnotation() const {return mShowGridAnnotation;}
+
+ void setGridAnnotationPosition( GridAnnotationPosition p ) {mGridAnnotationPosition = p;}
+ GridAnnotationPosition gridAnnotationPosition() const {return mGridAnnotationPosition;}
+
+ void setAnnotationFrameDistance( double d ) {mAnnotationFrameDistance = d;}
+ double annotationFrameDistance() const {return mAnnotationFrameDistance;}
+
+ void setGridAnnotationDirection( GridAnnotationDirection d ) {mGridAnnotationDirection = d;}
+ GridAnnotationDirection gridAnnotationDirection() const {return mGridAnnotationDirection;}
+
+ /**In case of annotations, the bounding rectangle can be larger than the map item rectangle*/
+ QRectF boundingRect() const;
+ /**Updates the bounding rect of this item. Call this function before doing any changes related to annotation out of the map rectangle*/
+ void updateBoundingRect();
+
public slots:
/**Called if map canvas has changed*/
@@ -200,6 +262,50 @@
/**Removes layer ids from mLayerSet that are no longer present in the qgis main map*/
void syncLayerSet();
+
+ /**True if coordinate grid has to be displayed*/
+ bool mGridEnabled;
+ /**Solid or crosses*/
+ GridStyle mGridStyle;
+ /**Grid line interval in x-direction (map units)*/
+ double mGridIntervalX;
+ /**Grid line interval in y-direction (map units)*/
+ double mGridIntervalY;
+ /**Grid line offset in x-direction*/
+ double mGridOffsetX;
+ /**Grid line offset in y-direction*/
+ double mGridOffsetY;
+ /**Grid line pen*/
+ QPen mGridPen;
+ /**Font for grid line annotation*/
+ QFont mGridAnnotationFont;
+ /**True if coordinate values should be drawn*/
+ bool mShowGridAnnotation;
+ /**Annotation position inside or outside of map frame*/
+ GridAnnotationPosition mGridAnnotationPosition;
+ /**Distance between map frame and annotation*/
+ double mAnnotationFrameDistance;
+ /**Annotation can be horizontal / vertical or different for axes*/
+ GridAnnotationDirection mGridAnnotationDirection;
+ /**Current bounding rectangle. This is used to check if notification to the graphics scene is necessary*/
+ QRectF mCurrentRectangle;
+
+ /**Draws the map grid*/
+ void drawGrid( QPainter* p );
+ /**Annotations for composer grid*/
+ void drawGridAnnotations( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines );
+ /**Calculates the horizontal grid lines
+ @lines list containing the map coordinates and the lines in item coordinates
+ @return 0 in case of success*/
+ int horizontalGridLines( QList< QPair< double, QLineF > >& lines ) const;
+ /**Calculates the vertical grid lines
+ @lines list containing the map coordinates and the lines in item coordinates
+ @return 0 in case of success*/
+ int verticalGridLines( QList< QPair< double, QLineF > >& lines ) const;
+ /**Returns extent that considers mOffsetX / mOffsetY (during content move)*/
+ QgsRectangle transformedExtent() const;
+ double maxExtensionXDirection() const;
+ double maxExtensionYDirection() const;
};
#endif
Modified: trunk/qgis/src/ui/qgscomposermapwidgetbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscomposermapwidgetbase.ui 2009-10-08 16:10:36 UTC (rev 11773)
+++ trunk/qgis/src/ui/qgscomposermapwidgetbase.ui 2009-10-08 16:59:08 UTC (rev 11774)
@@ -1,91 +1,113 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>QgsComposerMapWidgetBase</class>
- <widget class="QWidget" name="QgsComposerMapWidgetBase" >
- <property name="geometry" >
+ <widget class="QWidget" name="QgsComposerMapWidgetBase">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>546</width>
- <height>374</height>
+ <width>466</width>
+ <height>649</height>
</rect>
</property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Map options</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" colspan="3" >
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="textLabel1">
+ <property name="text">
+ <string>Width</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="buddy">
+ <cstring>mWidthLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="Line" name="line1">
+ <property name="frameShape">
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="mMapGroupBox">
+ <property name="title">
<string>Map</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="textLabel1" >
- <property name="text" >
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="textLabel1">
+ <property name="text">
<string>Width</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>true</bool>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>mWidthLineEdit</cstring>
</property>
</widget>
</item>
- <item row="0" column="2" >
- <widget class="QLineEdit" name="mWidthLineEdit" />
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="mWidthLineEdit"/>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="textLabel2" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
<string>Height</string>
</property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mHeightLineEdit</cstring>
- </property>
</widget>
</item>
- <item row="1" column="2" >
- <widget class="QLineEdit" name="mHeightLineEdit" />
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="mHeightLineEdit"/>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Scale</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- </widget>
+ <item row="2" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Scale</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>1:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="2" column="1" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>1:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="2" >
- <widget class="QLineEdit" name="mScaleLineEdit" >
- <property name="inputMask" >
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="mScaleLineEdit">
+ <property name="inputMask">
<string/>
</property>
</widget>
@@ -93,73 +115,73 @@
</layout>
</widget>
</item>
- <item row="1" column="0" colspan="3" >
- <widget class="QGroupBox" name="mMapExtentGroupBox" >
- <property name="title" >
+ <item row="3" column="0">
+ <widget class="QGroupBox" name="mMapExtentGroupBox">
+ <property name="title">
<string>Map extent</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="mXMinLabel" >
- <property name="enabled" >
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="mXMinLabel">
+ <property name="enabled">
<bool>true</bool>
</property>
- <property name="text" >
+ <property name="text">
<string>X min</string>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>mXMinLineEdit</cstring>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="mXMinLineEdit" />
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="mXMinLineEdit"/>
</item>
- <item row="0" column="2" >
- <widget class="QLabel" name="mXMaxLabel" >
- <property name="text" >
+ <item row="0" column="2">
+ <widget class="QLabel" name="mXMaxLabel">
+ <property name="text">
<string>X max</string>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>mXMaxLineEdit</cstring>
</property>
</widget>
</item>
- <item row="0" column="3" colspan="2" >
- <widget class="QLineEdit" name="mXMaxLineEdit" />
+ <item row="0" column="3" colspan="2">
+ <widget class="QLineEdit" name="mXMaxLineEdit"/>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="mYMinLabel" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QLabel" name="mYMinLabel">
+ <property name="text">
<string>Y min</string>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>mYMinLineEdit</cstring>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="mYMinLineEdit" />
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="mYMinLineEdit"/>
</item>
- <item row="1" column="2" >
- <widget class="QLabel" name="mYMaxLabel" >
- <property name="text" >
+ <item row="1" column="2">
+ <widget class="QLabel" name="mYMaxLabel">
+ <property name="text">
<string>Y max</string>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>mYMaxLineEdit</cstring>
</property>
</widget>
</item>
- <item row="1" column="3" colspan="2" >
- <widget class="QLineEdit" name="mYMaxLineEdit" />
+ <item row="1" column="3" colspan="2">
+ <widget class="QLineEdit" name="mYMaxLineEdit"/>
</item>
- <item row="2" column="0" colspan="4" >
+ <item row="2" column="0" colspan="4">
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
@@ -167,9 +189,9 @@
</property>
</spacer>
</item>
- <item row="2" column="4" >
- <widget class="QPushButton" name="mSetToMapCanvasExtentButton" >
- <property name="text" >
+ <item row="2" column="4">
+ <widget class="QPushButton" name="mSetToMapCanvasExtentButton">
+ <property name="text">
<string>Set to map canvas extent</string>
</property>
</widget>
@@ -177,49 +199,212 @@
</layout>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="mPreviewModeLabel" >
- <property name="text" >
- <string>Preview</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mPreviewModeComboBox</cstring>
- </property>
- </widget>
+ <item row="4" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="mPreviewModeLabel">
+ <property name="text">
+ <string>Preview</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="buddy">
+ <cstring>mPreviewModeComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="mPreviewModeComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="mUpdatePreviewButton">
+ <property name="text">
+ <string>Update preview</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="2" column="1" >
- <widget class="QComboBox" name="mPreviewModeComboBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="mKeepLayerListCheckBox">
+ <property name="text">
+ <string>Keep layer list</string>
</property>
</widget>
</item>
- <item row="2" column="2" >
- <widget class="QPushButton" name="mUpdatePreviewButton" >
- <property name="text" >
- <string>Update preview</string>
+ <item row="6" column="0">
+ <widget class="QGroupBox" name="mGridGroupBox">
+ <property name="title">
+ <string>Grid</string>
</property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="mGridCheckBox">
+ <property name="text">
+ <string>Show grid</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="mGridTypeLabel">
+ <property name="text">
+ <string>Grid type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QComboBox" name="mGridTypeComboBox"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="mIntervalXLabel">
+ <property name="text">
+ <string>Interval X:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <widget class="QDoubleSpinBox" name="mIntervalXSpinBox">
+ <property name="maximum">
+ <double>999999.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QLabel" name="mIntervalYLabel">
+ <property name="text">
+ <string>Interval Y:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4">
+ <widget class="QDoubleSpinBox" name="mIntervalYSpinBox">
+ <property name="maximum">
+ <double>9999999.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="mOffsetXLabel">
+ <property name="text">
+ <string>Offset X:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="2">
+ <widget class="QDoubleSpinBox" name="mOffsetXSpinBox">
+ <property name="maximum">
+ <double>9999999.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <widget class="QLabel" name="mOffsetYLabel">
+ <property name="text">
+ <string>Offset Y:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="4">
+ <widget class="QDoubleSpinBox" name="mOffsetYSpinBox">
+ <property name="maximum">
+ <double>9999999.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="mLineWidthLabel">
+ <property name="text">
+ <string>Line width:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="2">
+ <widget class="QDoubleSpinBox" name="mLineWidthSpinBox"/>
+ </item>
+ <item row="4" column="3">
+ <widget class="QLabel" name="mLineColorLabel">
+ <property name="text">
+ <string>Line color:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="4">
+ <widget class="QgsColorButton" name="mLineColorButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2">
+ <widget class="QCheckBox" name="mDrawAnnotationCheckBox">
+ <property name="text">
+ <string>Draw annotation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="2">
+ <widget class="QLabel" name="mAnnotationPositionLabel">
+ <property name="text">
+ <string>Annotation position:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QComboBox" name="mAnnotationPositionComboBox"/>
+ </item>
+ <item row="6" column="3">
+ <widget class="QLabel" name="mAnnotationDirectionLabel">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>Annotation direction:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="4">
+ <widget class="QComboBox" name="mAnnotationDirectionComboBox"/>
+ </item>
+ <item row="7" column="0" colspan="2">
+ <widget class="QLabel" name="mDistanceToFrameLabel">
+ <property name="text">
+ <string>Distance to map frame:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox"/>
+ </item>
+ <item row="7" column="4">
+ <widget class="QPushButton" name="mAnnotationFontButton">
+ <property name="text">
+ <string>Font...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
- <item row="3" column="0" colspan="2" >
- <widget class="QCheckBox" name="mKeepLayerListCheckBox" >
- <property name="text" >
- <string>Keep layer list</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
+ <item row="7" column="0">
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>458</width>
<height>31</height>
@@ -229,18 +414,20 @@
</item>
</layout>
</widget>
- <layoutdefault spacing="6" margin="11" />
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>QgsColorButton</class>
+ <extends>QToolButton</extends>
+ <header>qgscolorbutton.h</header>
+ </customwidget>
+ </customwidgets>
<tabstops>
- <tabstop>mWidthLineEdit</tabstop>
- <tabstop>mHeightLineEdit</tabstop>
- <tabstop>mScaleLineEdit</tabstop>
<tabstop>mXMinLineEdit</tabstop>
<tabstop>mXMaxLineEdit</tabstop>
<tabstop>mYMinLineEdit</tabstop>
<tabstop>mYMaxLineEdit</tabstop>
<tabstop>mSetToMapCanvasExtentButton</tabstop>
- <tabstop>mPreviewModeComboBox</tabstop>
- <tabstop>mUpdatePreviewButton</tabstop>
<tabstop>mKeepLayerListCheckBox</tabstop>
</tabstops>
<resources/>
More information about the QGIS-commit
mailing list