[QGIS Commit] r11847 - in trunk/qgis: python/core src/app/composer src/core/composer src/ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Oct 26 05:46:24 EDT 2009


Author: mhugent
Date: 2009-10-26 05:46:21 -0400 (Mon, 26 Oct 2009)
New Revision: 11847

Modified:
   trunk/qgis/python/core/qgscomposermap.sip
   trunk/qgis/src/app/composer/qgscomposermapwidget.cpp
   trunk/qgis/src/app/composer/qgscomposermapwidget.h
   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/qgscomposeritemwidgetbase.ui
   trunk/qgis/src/ui/qgscomposermapwidgetbase.ui
Log:
[FEATURE]: Possibility to rotate composer map

Modified: trunk/qgis/python/core/qgscomposermap.sip
===================================================================
--- trunk/qgis/python/core/qgscomposermap.sip	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/python/core/qgscomposermap.sip	2009-10-26 09:46:21 UTC (rev 11847)
@@ -24,6 +24,26 @@
       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,
+      BoundaryDirection
+    };
+
     /** \brief Draw to paint device
     @param extent map extent
     @param size size in scene coordinates
@@ -71,6 +91,22 @@
     PreviewMode previewMode();
     void setPreviewMode( PreviewMode m );
 
+    /**Getter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas
+    @note this function was added in version 1.2*/
+    bool keepLayerSet() const;
+    /**Setter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas
+    @note this function was added in version 1.2*/
+    void setKeepLayerSet( bool enabled );
+
+    /**Getter for stored layer set that is used if mKeepLayerSet is true
+    @note this function was added in version 1.2*/
+    QStringList layerSet() const;
+    /**Setter for stored layer set that is used if mKeepLayerSet is true
+    @note this function was added in version 1.2*/
+    void setLayerSet( const QStringList& layerSet );
+    /**Stores the current layer set of the qgis mapcanvas in mLayerSet*/
+    void storeCurrentLayerSet();
+
     // Set cache outdated
     void setCacheUpdated( bool u = false );
 
@@ -95,6 +131,55 @@
      */
     bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
 
+    void setGridEnabled( bool enabled );
+    bool gridEnabled() const;
+
+    void setGridStyle( GridStyle style );
+    GridStyle gridStyle() const;
+
+    void setGridIntervalX( double interval );
+    double gridIntervalX() const;
+
+    void setGridIntervalY( double interval );
+    double gridIntervalY() const;
+
+    void setGridOffsetX( double offset );
+    double gridOffsetX() const;
+
+    void setGridOffsetY( double offset );
+    double gridOffsetY() const;
+
+    void setGridPen( const QPen& p );
+    QPen gridPen() const;
+    void setGridPenWidth( double w );
+    void setGridPenColor( const QColor& c );
+
+    void setGridAnnotationFont( const QFont& f );
+    QFont gridAnnotationFont() const;
+
+    void setShowGridAnnotation( bool show );
+    bool showGridAnnotation() const;
+
+    void setGridAnnotationPosition( GridAnnotationPosition p );
+    GridAnnotationPosition gridAnnotationPosition() const;
+
+    void setAnnotationFrameDistance( double d ) {mAnnotationFrameDistance = d;}
+    double annotationFrameDistance() const {return mAnnotationFrameDistance;}
+
+    void setGridAnnotationDirection( GridAnnotationDirection d );
+    GridAnnotationDirection gridAnnotationDirection() const;
+
+    /**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();
+
+    void setRotation(double r);
+    double rotation() const;
+
+    void setCrossLength(double l);
+    double crossLength();
+
   public slots:
 
     /**Called if map canvas has changed*/

Modified: trunk/qgis/src/app/composer/qgscomposermapwidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposermapwidget.cpp	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/app/composer/qgscomposermapwidget.cpp	2009-10-26 09:46:21 UTC (rev 11847)
@@ -25,11 +25,13 @@
 QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidget(), mComposerMap( composerMap )
 {
   setupUi( this );
-  mGridDockWidget->setVisible( false );
+  mGridWidget->setVisible( false );
+  mGridWidget->setParent( 0 ); //in order to save space, separate the grid widget
+  mGridWidget->setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowTitleHint );
 
   //add widget for general composer item properties
   QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerMap );
-  gridLayout_3->addWidget( itemPropertiesWidget, 7, 0, 1, 1 );
+  gridLayout_3->addWidget( itemPropertiesWidget, 6, 0, 1, 1 );
   QDoubleValidator v( 0 );
 
   mWidthLineEdit->setValidator( &v );
@@ -55,9 +57,8 @@
   mAnnotationDirectionComboBox->insertItem( 0, tr( "Horizontal" ) );
   mAnnotationDirectionComboBox->insertItem( 1, tr( "Vertical" ) );
   mAnnotationDirectionComboBox->insertItem( 2, tr( "Horizontal and Vertical" ) );
+  mAnnotationDirectionComboBox->insertItem( 2, tr( "Boundary direction" ) );
 
-  mAnnotationTypeComboBox->insertItem( 0, tr( "Coordinate" ) );
-  mAnnotationTypeComboBox->insertItem( 1, tr( "Sector" ) );
   blockAllSignals( false );
 
   if ( composerMap )
@@ -70,7 +71,7 @@
 
 QgsComposerMapWidget::~QgsComposerMapWidget()
 {
-
+  delete mGridWidget;
 }
 
 void QgsComposerMapWidget::on_mWidthLineEdit_editingFinished()
@@ -160,6 +161,18 @@
   mComposerMap->setNewScale( scaleDenominator );
 }
 
+void QgsComposerMapWidget::on_mRotationSpinBox_valueChanged( int value )
+{
+  if ( !mComposerMap )
+  {
+    return;
+  }
+
+  mComposerMap->setRotation( value );
+  mComposerMap->cache();
+  mComposerMap->update();
+}
+
 void QgsComposerMapWidget::on_mSetToMapCanvasExtentButton_clicked()
 {
   if ( mComposerMap )
@@ -274,6 +287,8 @@
     mYMinLineEdit->setText( QString::number( composerMapExtent.yMinimum(), 'f', 3 ) );
     mYMaxLineEdit->setText( QString::number( composerMapExtent.yMaximum(), 'f', 3 ) );
 
+    mRotationSpinBox->setValue( mComposerMap->rotation() );
+
     //keep layer list check box
     if ( mComposerMap->keepLayerSet() )
     {
@@ -309,6 +324,8 @@
       mGridTypeComboBox->setCurrentIndex( mGridTypeComboBox->findText( tr( "Solid" ) ) );
     }
 
+    mCrossWidthSpinBox->setValue( mComposerMap->crossLength() );
+
     QgsComposerMap::GridAnnotationPosition annotationPos = mComposerMap->gridAnnotationPosition();
     if ( annotationPos == QgsComposerMap::InsideMapFrame )
     {
@@ -339,20 +356,14 @@
     {
       mAnnotationDirectionComboBox->setCurrentIndex( mAnnotationDirectionComboBox->findText( tr( "Vertical" ) ) );
     }
-    else
+    else if ( dir == QgsComposerMap::HorizontalAndVertical )
     {
       mAnnotationDirectionComboBox->setCurrentIndex( mAnnotationDirectionComboBox->findText( tr( "Horizontal and Vertical" ) ) );
     }
-
-    QgsComposerMap::GridAnnotationType type = mComposerMap->gridAnnotationType();
-    if ( type == QgsComposerMap::Sector )
+    else //BoundaryDirection
     {
-      mAnnotationTypeComboBox->setCurrentIndex( mAnnotationTypeComboBox->findText( tr( "Sector" ) ) );
+      mAnnotationDirectionComboBox->setCurrentIndex( mAnnotationDirectionComboBox->findText( tr( "Boundary direction" ) ) );
     }
-    else
-    {
-      mAnnotationTypeComboBox->setCurrentIndex( mAnnotationTypeComboBox->findText( tr( "Coordinate" ) ) );
-    }
 
 
     QPen gridPen = mComposerMap->gridPen();
@@ -400,6 +411,7 @@
   mOffsetXSpinBox->blockSignals( b );
   mOffsetYSpinBox->blockSignals( b );
   mGridTypeComboBox->blockSignals( b );
+  mCrossWidthSpinBox->blockSignals( b );
   mPreviewModeComboBox->blockSignals( b );
   mKeepLayerListCheckBox->blockSignals( b );
   mSetToMapCanvasExtentButton->blockSignals( b );
@@ -411,7 +423,6 @@
   mAnnotationPositionComboBox->blockSignals( b );
   mDistanceToMapFrameSpinBox->blockSignals( b );
   mAnnotationDirectionComboBox->blockSignals( b );
-  mAnnotationTypeComboBox->blockSignals( b );
 }
 
 void QgsComposerMapWidget::on_mUpdatePreviewButton_clicked()
@@ -561,6 +572,17 @@
   mComposerMap->update();
 }
 
+void QgsComposerMapWidget::on_mCrossWidthSpinBox_valueChanged( double d )
+{
+  if ( !mComposerMap )
+  {
+    return;
+  }
+
+  mComposerMap->setCrossLength( d );
+  mComposerMap->update();
+}
+
 void QgsComposerMapWidget::on_mAnnotationFontButton_clicked()
 {
   if ( !mComposerMap )
@@ -647,29 +669,15 @@
   {
     mComposerMap->setGridAnnotationDirection( QgsComposerMap::Vertical );
   }
-  else
+  else if ( text == tr( "Horizontal and Vertical" ) )
   {
     mComposerMap->setGridAnnotationDirection( QgsComposerMap::HorizontalAndVertical );
   }
-  mComposerMap->updateBoundingRect();
-  mComposerMap->update();
-}
-
-void QgsComposerMapWidget::on_mAnnotationTypeComboBox_currentIndexChanged( const QString& text )
-{
-  if ( !mComposerMap )
+  else //BoundaryDirection
   {
-    return;
+    mComposerMap->setGridAnnotationDirection( QgsComposerMap::BoundaryDirection );
   }
-
-  if ( text == tr( "Sector" ) )
-  {
-    mComposerMap->setGridAnnotationType( QgsComposerMap::Sector );
-  }
-  else
-  {
-    mComposerMap->setGridAnnotationType( QgsComposerMap::Coordinate );
-  }
+  mComposerMap->updateBoundingRect();
   mComposerMap->update();
 }
 
@@ -677,10 +685,10 @@
 {
   if ( state == Qt::Checked )
   {
-    mGridDockWidget->setVisible( true );
+    mGridWidget->setVisible( true );
   }
   else
   {
-    mGridDockWidget->setVisible( false );
+    mGridWidget->setVisible( false );
   }
 }

Modified: trunk/qgis/src/app/composer/qgscomposermapwidget.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposermapwidget.h	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/app/composer/qgscomposermapwidget.h	2009-10-26 09:46:21 UTC (rev 11847)
@@ -39,6 +39,7 @@
     void on_mHeightLineEdit_editingFinished();
     void on_mPreviewModeComboBox_activated( int i );
     void on_mScaleLineEdit_editingFinished();
+    void on_mRotationSpinBox_valueChanged( int value );
     void on_mSetToMapCanvasExtentButton_clicked();
     void on_mUpdatePreviewButton_clicked();
     void on_mKeepLayerListCheckBox_stateChanged( int state );
@@ -56,12 +57,12 @@
     void on_mLineWidthSpinBox_valueChanged( double d );
     void on_mLineColorButton_clicked();
     void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
+    void on_mCrossWidthSpinBox_valueChanged( double d );
     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 );
-    void on_mAnnotationTypeComboBox_currentIndexChanged( const QString& text );
     void on_mShowGridDialogCheckBox_stateChanged( int state );
 
     /**Updates width and height without notify the composer map (to avoid infinite recursion)*/

Modified: trunk/qgis/src/core/composer/qgscomposeritem.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposeritem.cpp	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/core/composer/qgscomposeritem.cpp	2009-10-26 09:46:21 UTC (rev 11847)
@@ -34,7 +34,7 @@
 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter
 
 QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue ): QGraphicsRectItem( 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), \
-    mFrame( true ), mItemPositionLocked( false )
+    mFrame( true ), mItemPositionLocked( false ), mLastValidViewScaleFactor( -1 )
 {
   setFlag( QGraphicsItem::ItemIsSelectable, true );
   setAcceptsHoverEvents( true );
@@ -53,7 +53,7 @@
 }
 
 QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition, bool manageZValue ): \
-    QGraphicsRectItem( 0, 0, width, height, 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), mFrame( true ), mItemPositionLocked( false )
+    QGraphicsRectItem( 0, 0, width, height, 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), mFrame( true ), mItemPositionLocked( false ), mLastValidViewScaleFactor( -1 )
 {
   setFlag( QGraphicsItem::ItemIsSelectable, true );
   setAcceptsHoverEvents( true );
@@ -135,7 +135,9 @@
     composerItemElem.setAttribute( "positionLock", "false" );
   }
 
+  composerItemElem.setAttribute( "lastValidViewScaleFactor", mLastValidViewScaleFactor );
 
+
   //frame color
   QDomElement frameColorElem = doc.createElement( "FrameColor" );
   QColor frameColor = pen().color();
@@ -205,6 +207,8 @@
   setSceneRect( QRectF( x, y, width, height ) );
   setZValue( itemElem.attribute( "zValue" ).toDouble() );
 
+  mLastValidViewScaleFactor = itemElem.attribute( "lastValidViewScaleFactor", "-1" ).toDouble();
+
   //pen
   QDomNodeList frameColorList = itemElem.elementsByTagName( "FrameColor" );
   if ( frameColorList.size() > 0 )
@@ -736,18 +740,19 @@
 
 double QgsComposerItem::horizontalViewScaleFactor() const
 {
-  double result = 1;
+  double result = -1;
   if ( scene() )
   {
     QList<QGraphicsView*> viewList = scene()->views();
-    if ( viewList.size() > 0 )
+    if ( viewList.size() > 0 ) //if not, probably this function was called from non-gui code
     {
-      result = viewList.at( 0 )->transform().m11();
+      QGraphicsView* currentView = viewList.at( 0 );
+      if ( currentView->isVisible() )
+      {
+        result = currentView->transform().m11();
+        mLastValidViewScaleFactor = result;
+      }
     }
-    else
-    {
-      return 1; //probably called from non-gui code
-    }
   }
   return result;
 }

Modified: trunk/qgis/src/core/composer/qgscomposeritem.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposeritem.h	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/core/composer/qgscomposeritem.h	2009-10-26 09:46:21 UTC (rev 11847)
@@ -188,6 +188,9 @@
     @note: this member was added in version 1.2*/
     bool mItemPositionLocked;
 
+    /**Backup to restore item appearance if no view scale factor is available*/
+    mutable double mLastValidViewScaleFactor;
+
     //event handlers
     virtual void mouseMoveEvent( QGraphicsSceneMouseEvent * event );
     virtual void mousePressEvent( QGraphicsSceneMouseEvent * event );
@@ -228,8 +231,8 @@
     @note: this function was introduced in version 1.2*/
     double lockSymbolSize() const;
 
-    /**Returns the zoom factor of the graphics view. If no
-     graphics view exists, the default 1 is returned
+    /**Returns the zoom factor of the graphics view.
+      @return the factor or -1 in case of error (e.g. graphic view does not exist)
     @note: this function was introduced in version 1.2*/
     double horizontalViewScaleFactor() const;
 };

Modified: trunk/qgis/src/core/composer/qgscomposermap.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.cpp	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/core/composer/qgscomposermap.cpp	2009-10-26 09:46:21 UTC (rev 11847)
@@ -44,7 +44,8 @@
 QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height )
     : 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 ), mGridAnnotationType( Coordinate )
+    mGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mGridAnnotationDirection( Horizontal ), \
+    mRotation( 0 ), mCrossLength( 3 )
 {
   mComposition = composition;
   mMapRenderer = mComposition->mapRenderer();
@@ -69,12 +70,14 @@
   }
   setSceneRect( QRectF( x, y, width, height ) );
   setToolTip( tr( "Map %1" ).arg( mId ) );
+  mGridPen.setCapStyle( Qt::FlatCap );
 }
 
 QgsComposerMap::QgsComposerMap( QgsComposition *composition )
     : 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 ), mGridAnnotationType( Coordinate )
+    mGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mGridAnnotationDirection( Horizontal ), \
+    mRotation( 0 ), mCrossLength( 3 )
 {
   //Offset
   mXOffset = 0.0;
@@ -89,6 +92,7 @@
   mCurrentRectangle = rect();
 
   setToolTip( tr( "Map %1" ).arg( mId ) );
+  mGridPen.setCapStyle( Qt::FlatCap );
 }
 
 QgsComposerMap::~QgsComposerMap()
@@ -160,9 +164,19 @@
 
   mDrawing = true;
 
-  int w = rect().width() * horizontalViewScaleFactor();
-  int h = rect().height() * horizontalViewScaleFactor();
+  //in case of rotation, we need to request a larger rectangle and create a larger cache image
+  QgsRectangle requestExtent;
+  requestedExtent( requestExtent );
 
+  double horizontalVScaleFactor = horizontalViewScaleFactor();
+  if ( horizontalVScaleFactor < 0 )
+  {
+    horizontalVScaleFactor = mLastValidViewScaleFactor;
+  }
+
+  int w = requestExtent.width() * mapUnitsToMM() * horizontalVScaleFactor;
+  int h = requestExtent.height() * mapUnitsToMM() * horizontalVScaleFactor;
+
   if ( w > 5000 ) //limit size of image for better performance
   {
     w = 5000;
@@ -178,11 +192,11 @@
   double mapUnitsPerPixel = mExtent.width() / w;
 
   // WARNING: ymax in QgsMapToPixel is device height!!!
-  QgsMapToPixel transform( mapUnitsPerPixel, h, mExtent.yMinimum(), mExtent.xMinimum() );
+  QgsMapToPixel transform( mapUnitsPerPixel, h, requestExtent.yMinimum(), requestExtent.xMinimum() );
 
   QPainter p( &mCacheImage );
 
-  draw( &p, mExtent, QSize( w, h ), mCacheImage.logicalDpiX() );
+  draw( &p, requestExtent, QSize( w, h ), mCacheImage.logicalDpiX() );
   p.end();
   mCacheUpdated = true;
 
@@ -216,12 +230,34 @@
     //QgsComposerMap::cache() and QgsComposerMap::update() need to be called by
     //client functions
 
-    // Scale so that the cache fills the map rectangle
-    double scale = 1.0 * QGraphicsRectItem::rect().width() / mCacheImage.width();
+    QgsRectangle requestRectangle;
+    requestedExtent( requestRectangle );
+    double horizontalVScaleFactor = horizontalViewScaleFactor();
+    if ( horizontalVScaleFactor < 0 )
+    {
+      horizontalVScaleFactor = mLastValidViewScaleFactor;
+    }
 
+    double imagePixelWidth = mExtent.width() / requestRectangle.width() * mCacheImage.width() ; //how many pixels of the image are for the map extent?
+    double scale = rect().width() / imagePixelWidth;
+    QgsPoint rotationPoint = QgsPoint(( mExtent.xMaximum() + mExtent.xMinimum() ) / 2.0, ( mExtent.yMaximum() + mExtent.yMinimum() ) / 2.0 );
+
+    //shift such that rotation point is at 0/0 point in the coordinate system
+    double yShiftMM = ( requestRectangle.yMaximum() - rotationPoint.y() ) * mapUnitsToMM();
+    double xShiftMM = ( requestRectangle.xMinimum() - rotationPoint.x() ) * mapUnitsToMM();
+
+    //shift such that top left point of the extent at point 0/0 in item coordinate system
+    double xTopLeftShift = ( rotationPoint.x() - mExtent.xMinimum() ) * mapUnitsToMM();
+    double yTopLeftShift = ( mExtent.yMaximum() - rotationPoint.y() ) * mapUnitsToMM();
+
     painter->save();
+    //painter->scale( scale, scale );
+    painter->translate( mXOffset, mYOffset );
+    painter->translate( xTopLeftShift, yTopLeftShift );
+    painter->rotate( mRotation );
+    painter->translate( xShiftMM, -yShiftMM );
     painter->scale( scale, scale );
-    painter->drawImage( mXOffset / scale, mYOffset / scale, mCacheImage );
+    painter->drawImage( 0, 0, mCacheImage );
     painter->restore();
   }
   else if ( mComposition->plotStyle() == QgsComposition::Print ||
@@ -239,20 +275,37 @@
       return;
     }
 
-    QRectF bRect = boundingRect();
-    QSize theSize( bRect.width(), bRect.height() );
-    draw( painter, mExtent, theSize, 25.4 ); //scene coordinates seem to be in mm
+    QgsRectangle requestRectangle;
+    requestedExtent( requestRectangle );
+
+    QSize theSize( requestRectangle.width() * mapUnitsToMM(), requestRectangle.height() * mapUnitsToMM() );
+    QgsPoint rotationPoint = QgsPoint(( mExtent.xMaximum() + mExtent.xMinimum() ) / 2.0, ( mExtent.yMaximum() + mExtent.yMinimum() ) / 2.0 );
+
+    //shift such that rotation point is at 0/0 point in the coordinate system
+    double yShiftMM = ( requestRectangle.yMaximum() - rotationPoint.y() ) * mapUnitsToMM();
+    double xShiftMM = ( requestRectangle.xMinimum() - rotationPoint.x() ) * mapUnitsToMM();
+
+    //shift such that top left point of the extent at point 0/0 in item coordinate system
+    double xTopLeftShift = ( rotationPoint.x() - mExtent.xMinimum() ) * mapUnitsToMM();
+    double yTopLeftShift = ( mExtent.yMaximum() - rotationPoint.y() ) * mapUnitsToMM();
+    painter->save();
+    painter->translate( mXOffset, mYOffset );
+    painter->translate( xTopLeftShift, yTopLeftShift );
+    painter->rotate( mRotation );
+    painter->translate( xShiftMM, -yShiftMM );
+    draw( painter, requestRectangle, theSize, 25.4 ); //scene coordinates seem to be in mm
+    painter->restore();
+
     mDrawing = false;
   }
 
   painter->setClipRect( thisPaintRect , Qt::NoClip );
 
-  drawFrame( painter );
   if ( mGridEnabled )
   {
     drawGrid( painter );
   }
-
+  drawFrame( painter );
   if ( isSelected() )
   {
     drawSelectionBoxes( painter );
@@ -303,17 +356,11 @@
 {
   if ( !mDrawing )
   {
-    QRectF itemRect = rect();
-    double xRatio = dx / itemRect.width();
-    double yRatio = dy / itemRect.height();
-
-    double xMoveMapCoord = mExtent.width() * xRatio;
-    double yMoveMapCoord = -( mExtent.height() * yRatio );
-
-    mExtent.setXMinimum( mExtent.xMinimum() + xMoveMapCoord );
-    mExtent.setXMaximum( mExtent.xMaximum() + xMoveMapCoord );
-    mExtent.setYMinimum( mExtent.yMinimum() + yMoveMapCoord );
-    mExtent.setYMaximum( mExtent.yMaximum() + yMoveMapCoord );
+    transformShift( dx, dy );
+    mExtent.setXMinimum( mExtent.xMinimum() + dx );
+    mExtent.setXMaximum( mExtent.xMaximum() + dx );
+    mExtent.setYMinimum( mExtent.yMinimum() + dy );
+    mExtent.setYMaximum( mExtent.yMaximum() + dy );
     emit extentChanged();
     cache();
     update();
@@ -404,6 +451,7 @@
   {
     cache();
   }
+  updateBoundingRect();
   update();
 }
 
@@ -527,6 +575,8 @@
   {
     composerMapElem.setAttribute( "keepLayerSet", "false" );
   }
+  //rotation
+  composerMapElem.setAttribute( "rotation", mRotation );
 
   //extent
   QDomElement extentElem = doc.createElement( "Extent" );
@@ -560,6 +610,7 @@
   gridElem.setAttribute( "penColorRed", mGridPen.color().red() );
   gridElem.setAttribute( "penColorGreen", mGridPen.color().green() );
   gridElem.setAttribute( "penColorBlue", mGridPen.color().blue() );
+  gridElem.setAttribute( "crossLength", mCrossLength );
 
   //grid annotation
   QDomElement annotationElem = doc.createElement( "Annotation" );
@@ -568,7 +619,6 @@
   annotationElem.setAttribute( "frameDistance", mAnnotationFrameDistance );
   annotationElem.setAttribute( "direction", mGridAnnotationDirection );
   annotationElem.setAttribute( "font", mGridAnnotationFont.toString() );
-  annotationElem.setAttribute( "type", mGridAnnotationType );
 
   gridElem.appendChild( annotationElem );
   composerMapElem.appendChild( gridElem );
@@ -601,6 +651,9 @@
     mPreviewMode = Rectangle;
   }
 
+  //rotation
+  mRotation = itemElem.attribute( "rotation", "0" ).toDouble();
+
   //extent
   QDomNodeList extentNodeList = itemElem.elementsByTagName( "Extent" );
   if ( extentNodeList.size() > 0 )
@@ -659,6 +712,7 @@
     mGridPen.setColor( QColor( gridElem.attribute( "penColorRed", "0" ).toInt(), \
                                gridElem.attribute( "penColorGreen", "0" ).toInt(), \
                                gridElem.attribute( "penColorBlue", "0" ).toInt() ) );
+    mCrossLength = gridElem.attribute( "crossLength", "3" ).toDouble();
 
     QDomNodeList annotationNodeList = gridElem.elementsByTagName( "Annotation" );
     if ( annotationNodeList.size() > 0 )
@@ -669,7 +723,6 @@
       mAnnotationFrameDistance = annotationElem.attribute( "frameDistance", "0" ).toDouble();
       mGridAnnotationDirection = QgsComposerMap::GridAnnotationDirection( annotationElem.attribute( "direction", "0" ).toInt() );
       mGridAnnotationFont.fromString( annotationElem.attribute( "font", "" ) );
-      mGridAnnotationType = QgsComposerMap::GridAnnotationType( annotationElem.attribute( "type", "0" ).toInt() );
     }
   }
 
@@ -682,13 +735,6 @@
   }
 
   updateBoundingRect();
-
-  if ( mPreviewMode != Rectangle )
-  {
-    cache();
-    update();
-  }
-
   return true;
 }
 
@@ -722,12 +768,15 @@
   p->setPen( mGridPen );
 
   QList< QPair< double, QLineF > > verticalLines;
-  verticalGridLines( verticalLines );
+  yGridLines( verticalLines );
   QList< QPair< double, QLineF > >::const_iterator vIt = verticalLines.constBegin();
   QList< QPair< double, QLineF > > horizontalLines;
-  horizontalGridLines( horizontalLines );
+  xGridLines( horizontalLines );
   QList< QPair< double, QLineF > >::const_iterator hIt = horizontalLines.constBegin();
 
+  QRectF thisPaintRect = QRectF( 0, 0, QGraphicsRectItem::rect().width(), QGraphicsRectItem::rect().height() );
+  p->setClipRect( thisPaintRect );
+
   //simpler approach: draw vertical lines first, then horizontal ones
   if ( mGridStyle == QgsComposerMap::Solid )
   {
@@ -741,205 +790,227 @@
       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 )
+  else //cross
   {
+    QPointF intersectionPoint, crossEnd1, crossEnd2;
+    for ( ; vIt != verticalLines.constEnd(); ++vIt )
+    {
+      //start mark
+      crossEnd1 = pointOnLineWithDistance( vIt->second.p1(), vIt->second.p2(), mCrossLength );
+      p->drawLine( vIt->second.p1(), crossEnd1 );
 
-    double resolutionXSize = mGridIntervalX * ( rect().width() / mExtent.width() );
-    double resolutionYSize = mGridIntervalY * ( rect().height() / mExtent.height() );
+      //test for intersection with every horizontal line
+      hIt = horizontalLines.constBegin();
+      for ( ; hIt != horizontalLines.constEnd(); ++hIt )
+      {
+        if ( hIt->second.intersect( vIt->second, &intersectionPoint ) == QLineF::BoundedIntersection )
+        {
+          crossEnd1 = pointOnLineWithDistance( intersectionPoint, vIt->second.p1(), mCrossLength );
+          crossEnd2 = pointOnLineWithDistance( intersectionPoint, vIt->second.p2(), mCrossLength );
+          p->drawLine( crossEnd1, crossEnd2 );
+        }
+      }
+      //end mark
+      QPointF crossEnd2 = pointOnLineWithDistance( vIt->second.p2(), vIt->second.p1(), mCrossLength );
+      p->drawLine( vIt->second.p2(), crossEnd2 );
+    }
 
-    QLineF currHLine;
-    QLineF currVLine;
+    hIt = horizontalLines.constBegin();
     for ( ; hIt != horizontalLines.constEnd(); ++hIt )
     {
-      currHLine = hIt->second;
+      //start mark
+      crossEnd1 = pointOnLineWithDistance( hIt->second.p1(), hIt->second.p2(), mCrossLength );
+      p->drawLine( hIt->second.p1(), crossEnd1 );
+
       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 )
+        if ( vIt->second.intersect( hIt->second, &intersectionPoint ) == 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 );
+          crossEnd1 = pointOnLineWithDistance( intersectionPoint, hIt->second.p1(), mCrossLength );
+          crossEnd2 = pointOnLineWithDistance( intersectionPoint, hIt->second.p2(), mCrossLength );
+          p->drawLine( crossEnd1, crossEnd2 );
         }
       }
+      //end mark
+      crossEnd1 = pointOnLineWithDistance( hIt->second.p2(), hIt->second.p1(), mCrossLength );
+      p->drawLine( hIt->second.p2(), crossEnd1 );
     }
+
+
   }
 
+  p->setClipRect( thisPaintRect , Qt::NoClip );
+
   if ( mShowGridAnnotation )
   {
-    drawGridAnnotations( p, horizontalLines, verticalLines );
+    drawCoordinateAnnotations( p, horizontalLines, verticalLines );
   }
 }
 
-void QgsComposerMap::drawGridAnnotations( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines )
+void QgsComposerMap::drawCoordinateAnnotations( 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
+  if ( !p )
+  {
+    return;
+  }
+
+
   QString currentAnnotationString;
-  double currentFontWidth = 0;
-  double currentFontHeight = fontAscentMillimeters( mGridAnnotationFont );
-  QPointF currentAnnotationPos1, currentAnnotationPos2;
-  double rotation = 0;
-  double xpos1, xpos2, ypos1, ypos2;
+  QList< QPair< double, QLineF > >::const_iterator it = hLines.constBegin();
+  for ( ; it != hLines.constEnd(); ++it )
+  {
+    currentAnnotationString = QString::number( it->first );
+    drawCoordinateAnnotation( p, it->second.p1(), currentAnnotationString );
+    drawCoordinateAnnotation( p, it->second.p2(), currentAnnotationString );
+  }
 
-  //first draw annotations for vertical grid lines
-  if ( mGridAnnotationDirection != Horizontal )
+  it = vLines.constBegin();
+  for ( ; it != vLines.constEnd(); ++it )
   {
-    rotation = 270;
+    currentAnnotationString = QString::number( it->first );
+    drawCoordinateAnnotation( p, it->second.p1(), currentAnnotationString );
+    drawCoordinateAnnotation( p, it->second.p2(), currentAnnotationString );
   }
+}
 
+void QgsComposerMap::drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString annotationString )
+{
+  Border frameBorder = borderForLineCoord( pos );
+  double textWidth = textWidthMillimeters( mGridAnnotationFont, annotationString );
+  double textHeight = fontAscentMillimeters( mGridAnnotationFont );
+  double xpos = pos.x();
+  double ypos = pos.y();
+  int rotation = 0;
 
-  QList< QPair< double, QLineF > >::const_iterator vIt = vLines.constBegin();
-  int loopCounter = 0;
-  for ( ; vIt != vLines.constEnd(); ++vIt )
+  if ( frameBorder == Left )
   {
-    if ( mGridAnnotationType == Sector )
-    {
-      int letterNumber = loopCounter % 26 + 66;
-      currentAnnotationString = QString( QChar( letterNumber ) );
-    }
-    else
-    {
-      currentAnnotationString = QString::number( vIt->first );
-    }
 
-    currentFontWidth = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString );
-    if ( mGridAnnotationDirection == Horizontal )
+    if ( mGridAnnotationPosition == InsideMapFrame )
     {
-      xpos1 = vIt->second.x1() - currentFontWidth / 2.0;
-      xpos2 = vIt->second.x2() - currentFontWidth / 2.0;
-      if ( mGridAnnotationPosition == OutsideMapFrame )
+      if ( mGridAnnotationDirection == Vertical || mGridAnnotationDirection == BoundaryDirection )
       {
-        ypos1 = vIt->second.y1() - mAnnotationFrameDistance;
-        ypos2 = vIt->second.y2() + mAnnotationFrameDistance + currentFontHeight;
+        xpos -= textHeight + mAnnotationFrameDistance;
+        ypos += textWidth / 2.0;
+        rotation = 270;
       }
       else
       {
-        ypos1 = vIt->second.y1() + mAnnotationFrameDistance + currentFontHeight;
-        ypos2 = vIt->second.y2() - mAnnotationFrameDistance;
+        xpos += mAnnotationFrameDistance;
+        ypos += textHeight / 2.0;
       }
     }
-    else //vertical annotation
+    else //Outside map frame
     {
-      xpos1 = vIt->second.x1() + currentFontHeight / 2.0;
-      xpos2 = vIt->second.x2() + currentFontHeight / 2.0;
-      if ( mGridAnnotationPosition == OutsideMapFrame )
+      if ( mGridAnnotationDirection == Vertical || mGridAnnotationDirection == BoundaryDirection )
       {
-        ypos1 = vIt->second.y1() - mAnnotationFrameDistance;
-        ypos2 = vIt->second.y2() + mAnnotationFrameDistance + currentFontWidth;
+        xpos -= mAnnotationFrameDistance;
+        ypos += textWidth / 2.0;
+        rotation = 270;
       }
       else
       {
-        ypos1 = vIt->second.y1() + currentFontWidth + mAnnotationFrameDistance;
-        ypos2 = vIt->second.y2() - mAnnotationFrameDistance;
+        xpos -= textWidth + mAnnotationFrameDistance;
+        ypos += textHeight / 2.0;
       }
     }
 
-    //shift positions in case of sector annotation
-    if ( mGridAnnotationType == Sector && loopCounter < ( vLines.size() - 1 ) )
+  }
+  else if ( frameBorder == Right )
+  {
+    if ( mGridAnnotationPosition == InsideMapFrame )
     {
-      xpos1 += ( vLines.at( loopCounter + 1 ).second.x1() - vLines.at( loopCounter ).second.x1() ) / 2.0;
-      xpos2 += ( vLines.at( loopCounter + 1 ).second.x2() - vLines.at( loopCounter ).second.x2() ) / 2.0;
+      if ( mGridAnnotationDirection == Vertical || mGridAnnotationDirection == BoundaryDirection )
+      {
+        xpos -= mAnnotationFrameDistance;
+        ypos += textWidth / 2.0;
+        rotation = 270;
+      }
+      else //Horizontal
+      {
+        xpos -= textWidth + mAnnotationFrameDistance;
+        ypos += textHeight / 2.0;
+      }
     }
-    else if ( mGridAnnotationType == Sector && loopCounter == ( vLines.size() - 1 ) )
+    else //OutsideMapFrame
     {
-      xpos1 += ( rect().width() - vLines.at( loopCounter ).second.x1() ) / 2.0;
-      xpos2 += ( rect().width() - vLines.at( loopCounter ).second.x2() ) / 2.0;
+      if ( mGridAnnotationDirection == Vertical || mGridAnnotationDirection == BoundaryDirection )
+      {
+        xpos += textHeight + mAnnotationFrameDistance;
+        ypos += textWidth / 2.0;
+        rotation = 270;
+      }
+      else //Horizontal
+      {
+        xpos += mAnnotationFrameDistance;
+        ypos += textHeight / 2.0;
+      }
     }
-    drawAnnotation( p, QPointF( xpos1, ypos1 ), rotation, currentAnnotationString );
-    drawAnnotation( p, QPointF( xpos1, ypos2 ), rotation, currentAnnotationString );
-
-    if ( mGridAnnotationType == Sector && loopCounter == 0 )
-    {
-      drawAnnotation( p, QPointF( vLines.at( loopCounter ).second.x1() / 2.0, ypos1 ), rotation, "A" );
-      drawAnnotation( p, QPointF( vLines.at( loopCounter ).second.x2() / 2.0, ypos2 ), rotation, "A" );
-    }
-    ++loopCounter;
   }
-
-  //then annotations for horizontal grid lines
-  if ( mGridAnnotationDirection != Vertical )
+  else if ( frameBorder == Bottom )
   {
-    rotation = 0;
-  }
-  else
-  {
-    rotation = 270;
-  }
-
-  loopCounter = 0;
-  QList< QPair< double, QLineF > >::const_iterator hIt = hLines.constBegin();
-  for ( ; hIt != hLines.constEnd(); ++hIt )
-  {
-    if ( mGridAnnotationType == Sector )
+    if ( mGridAnnotationPosition == InsideMapFrame )
     {
-      currentAnnotationString = QString::number( hLines.size() - loopCounter - 1 );
+      if ( mGridAnnotationDirection == Horizontal || mGridAnnotationDirection == BoundaryDirection )
+      {
+        ypos -= mAnnotationFrameDistance;
+        xpos -= textWidth / 2.0;
+      }
+      else //Vertical
+      {
+        xpos += textHeight / 2.0;
+        ypos -= mAnnotationFrameDistance;
+        rotation = 270;
+      }
     }
-    else
+    else //OutsideMapFrame
     {
-      currentAnnotationString = QString::number( hIt->first );
+      if ( mGridAnnotationDirection == Horizontal || mGridAnnotationDirection == BoundaryDirection )
+      {
+        ypos += mAnnotationFrameDistance + textHeight;
+        xpos -= textWidth / 2.0;
+      }
+      else //Vertical
+      {
+        xpos += textHeight / 2.0;
+        ypos += textWidth + mAnnotationFrameDistance;
+        rotation = 270;
+      }
     }
-
-    currentFontWidth = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString );
-    if ( mGridAnnotationDirection == Vertical )
+  }
+  else //Top
+  {
+    if ( mGridAnnotationPosition == InsideMapFrame )
     {
-      ypos1 = hIt->second.y1() + currentFontWidth / 2.0;
-      ypos2 = hIt->second.y2() + currentFontWidth / 2.0;
-      if ( mGridAnnotationPosition == OutsideMapFrame )
+      if ( mGridAnnotationDirection == Horizontal || mGridAnnotationDirection == BoundaryDirection )
       {
-        xpos1 = hIt->second.x1() - mAnnotationFrameDistance;
-        xpos2 = hIt->second.x2() + mAnnotationFrameDistance + currentFontHeight;
+        xpos -= textWidth / 2.0;
+        ypos += textHeight + mAnnotationFrameDistance;
       }
-      else
+      else //Vertical
       {
-        xpos1 = hIt->second.x1() + mAnnotationFrameDistance + currentFontHeight;
-        xpos2 = hIt->second.x2() - mAnnotationFrameDistance;
+        xpos += textHeight / 2.0;
+        ypos += textWidth + mAnnotationFrameDistance;
+        rotation = 270;
       }
     }
-    else
+    else //OutsideMapFrame
     {
-      ypos1 = hIt->second.y1() + currentFontHeight / 2.0;
-      ypos2 = hIt->second.y2() + currentFontHeight / 2.0;
-      if ( mGridAnnotationPosition == OutsideMapFrame )
+      if ( mGridAnnotationDirection == Horizontal || mGridAnnotationDirection == BoundaryDirection )
       {
-        xpos1 = hIt->second.x1() - ( mAnnotationFrameDistance + currentFontWidth );
-        xpos2 = hIt->second.x2() + mAnnotationFrameDistance;
+        xpos -= textWidth / 2.0;
+        ypos -= mAnnotationFrameDistance;
       }
-      else
+      else //Vertical
       {
-        xpos1 = hIt->second.x1() + mAnnotationFrameDistance;
-        xpos2 = hIt->second.x2() - ( mAnnotationFrameDistance + currentFontWidth );
+        xpos += textHeight / 2.0;
+        ypos -= mAnnotationFrameDistance;
+        rotation = 270;
       }
     }
+  }
 
-    //shift y-Positions in case of sectoral annotations
-    if ( mGridAnnotationType == Sector && loopCounter < ( hLines.size() - 1 ) )
-    {
-      ypos1 += ( hLines.at( loopCounter + 1 ).second.y1() - hLines.at( loopCounter ).second.y1() ) / 2.0;
-      ypos2 += ( hLines.at( loopCounter + 1 ).second.y2() - hLines.at( loopCounter ).second.y2() ) / 2.0;
-    }
-    else if ( mGridAnnotationType == Sector && loopCounter == ( hLines.size() - 1 ) )
-    {
-      ypos1 -= hLines.at( loopCounter ).second.y1() / 2.0;
-      ypos2 -= hLines.at( loopCounter ).second.y2() / 2.0;
-    }
-
-    drawAnnotation( p, QPointF( xpos1, ypos1 ), rotation, currentAnnotationString );
-    drawAnnotation( p, QPointF( xpos2, ypos2 ), rotation, currentAnnotationString );
-    if ( mGridAnnotationType == Sector && loopCounter == 0 )
-    {
-      drawAnnotation( p, QPointF( xpos1, ( rect().height() + hLines.at( loopCounter ).second.y1() ) / 2.0 ), rotation, QString::number( hLines.size() ) );
-      drawAnnotation( p, QPointF( xpos2, ( rect().height() + hLines.at( loopCounter ).second.y2() ) / 2.0 ), rotation, QString::number( hLines.size() ) );
-    }
-    ++loopCounter;
-  }
+  drawAnnotation( p, QPointF( xpos, ypos ), rotation, annotationString );
 }
 
 void QgsComposerMap::drawAnnotation( QPainter* p, const QPointF& pos, int rotation, const QString& annotationText )
@@ -951,62 +1022,131 @@
   p->restore();
 }
 
-int QgsComposerMap::verticalGridLines( QList< QPair< double, QLineF > >& lines ) const
+int QgsComposerMap::xGridLines( QList< QPair< double, QLineF > >& lines ) const
 {
   lines.clear();
-  if ( mGridIntervalX <= 0.0 )
+  if ( mGridIntervalY <= 0.0 )
   {
     return 1;
   }
 
-  //consider the possible shift in case of content move
-  QgsRectangle mapExtent = transformedExtent();
+  QPolygonF mapPolygon = transformedMapPolygon();
+  QRectF mapBoundingRect = mapPolygon.boundingRect();
+  double currentLevel = ( int )(( mapBoundingRect.top() - mGridOffsetY ) / mGridIntervalY + 1.0 ) * mGridIntervalY + mGridOffsetY;
 
-  double currentLevel = ( int )(( mapExtent.xMinimum() - mGridOffsetX ) / mGridIntervalX + 1.0 ) * mGridIntervalX + mGridOffsetX;
+  if ( !mRotation > 0.0 )
+  {
+    //no rotation. Do it 'the easy way'
 
-  double xCanvasCoord;
+    double yCanvasCoord;
 
-  double border = 0.0;
-  if ( frame() )
-  {
-    border = pen().widthF();
+    while ( currentLevel <= mapBoundingRect.bottom() )
+    {
+      yCanvasCoord = rect().height() * ( 1 - ( currentLevel - mapBoundingRect.top() ) / mapBoundingRect.height() );
+      lines.push_back( qMakePair( currentLevel, QLineF( 0, yCanvasCoord, rect().width(), yCanvasCoord ) ) );
+      currentLevel += mGridIntervalY;
+    }
   }
 
-  while ( currentLevel <= mapExtent.xMaximum() )
+  //the four border lines
+  QVector<QLineF> borderLines;
+  borderLines << QLineF( mapPolygon.at( 0 ), mapPolygon.at( 1 ) );
+  borderLines << QLineF( mapPolygon.at( 1 ), mapPolygon.at( 2 ) );
+  borderLines << QLineF( mapPolygon.at( 2 ), mapPolygon.at( 3 ) );
+  borderLines << QLineF( mapPolygon.at( 3 ), mapPolygon.at( 0 ) );
+
+  QList<QPointF> intersectionList; //intersects between border lines and grid lines
+
+  while ( currentLevel <= mapBoundingRect.bottom() )
   {
-    xCanvasCoord = rect().width() * ( currentLevel - mapExtent.xMinimum() ) / mapExtent.width();
-    lines.push_back( qMakePair( currentLevel, QLineF( xCanvasCoord, border, xCanvasCoord, rect().height() - border ) ) );
-    currentLevel += mGridIntervalX;
+    intersectionList.clear();
+    QLineF gridLine( mapBoundingRect.left(), currentLevel, mapBoundingRect.right(), currentLevel );
+
+    QVector<QLineF>::const_iterator it = borderLines.constBegin();
+    for ( ; it != borderLines.constEnd(); ++it )
+    {
+      QPointF intersectionPoint;
+      if ( it->intersect( gridLine, &intersectionPoint ) == QLineF::BoundedIntersection )
+      {
+        intersectionList.push_back( intersectionPoint );
+        if ( intersectionList.size() >= 2 )
+        {
+          break; //we already have two intersections, skip further tests
+        }
+      }
+    }
+
+    if ( intersectionList.size() >= 2 )
+    {
+      lines.push_back( qMakePair( currentLevel, QLineF( mapToItemCoords( intersectionList.at( 0 ) ), mapToItemCoords( intersectionList.at( 1 ) ) ) ) );
+    }
+    currentLevel += mGridIntervalY;
   }
+
+
   return 0;
 }
 
-int QgsComposerMap::horizontalGridLines( QList< QPair< double, QLineF > >& lines ) const
+int QgsComposerMap::yGridLines( QList< QPair< double, QLineF > >& lines ) const
 {
   lines.clear();
-  if ( mGridIntervalY <= 0.0 )
+  if ( mGridIntervalX <= 0.0 )
   {
     return 1;
   }
 
-  //consider the possible shift in case of content move
-  QgsRectangle mapExtent = transformedExtent();
+  QPolygonF mapPolygon = transformedMapPolygon();
+  QRectF mapBoundingRect = mapPolygon.boundingRect();
+  double currentLevel = ( int )(( mapBoundingRect.left() - mGridOffsetX ) / mGridIntervalX + 1.0 ) * mGridIntervalX + mGridOffsetX;
 
-  double currentLevel = ( int )(( mapExtent.yMinimum() - mGridOffsetY ) / mGridIntervalY + 1.0 ) * mGridIntervalY + mGridOffsetY;
-  double yCanvasCoord;
+  if ( !mRotation > 0.0 )
+  {
+    //no rotation. Do it 'the easy way'
+    double xCanvasCoord;
 
-  double border = 0.0;
-  if ( frame() )
-  {
-    border = pen().widthF();
+    while ( currentLevel <= mapBoundingRect.right() )
+    {
+      xCanvasCoord = rect().width() * ( currentLevel - mapBoundingRect.left() ) / mapBoundingRect.width();
+      lines.push_back( qMakePair( currentLevel, QLineF( xCanvasCoord, 0, xCanvasCoord, rect().height() ) ) );
+      currentLevel += mGridIntervalX;
+    }
   }
 
-  while ( currentLevel <= mapExtent.yMaximum() )
+  //the four border lines
+  QVector<QLineF> borderLines;
+  borderLines << QLineF( mapPolygon.at( 0 ), mapPolygon.at( 1 ) );
+  borderLines << QLineF( mapPolygon.at( 1 ), mapPolygon.at( 2 ) );
+  borderLines << QLineF( mapPolygon.at( 2 ), mapPolygon.at( 3 ) );
+  borderLines << QLineF( mapPolygon.at( 3 ), mapPolygon.at( 0 ) );
+
+  QList<QPointF> intersectionList; //intersects between border lines and grid lines
+
+  while ( currentLevel <= mapBoundingRect.right() )
   {
-    yCanvasCoord = rect().height() * ( 1 - ( currentLevel - mapExtent.yMinimum() ) / mapExtent.height() );
-    lines.push_back( qMakePair( currentLevel, QLineF( border, yCanvasCoord, rect().width() - border, yCanvasCoord ) ) );
-    currentLevel += mGridIntervalY;
+    intersectionList.clear();
+    QLineF gridLine( currentLevel, mapBoundingRect.bottom(), currentLevel, mapBoundingRect.top() );
+
+    QVector<QLineF>::const_iterator it = borderLines.constBegin();
+    for ( ; it != borderLines.constEnd(); ++it )
+    {
+      QPointF intersectionPoint;
+      if ( it->intersect( gridLine, &intersectionPoint ) == QLineF::BoundedIntersection )
+      {
+        intersectionList.push_back( intersectionPoint );
+        if ( intersectionList.size() >= 2 )
+        {
+          break; //we already have two intersections, skip further tests
+        }
+      }
+    }
+
+    if ( intersectionList.size() >= 2 )
+    {
+      lines.push_back( qMakePair( currentLevel, QLineF( mapToItemCoords( intersectionList.at( 0 ) ), mapToItemCoords( intersectionList.at( 1 ) ) ) ) );
+    }
+    currentLevel += mGridIntervalX;
   }
+
   return 0;
 }
 
@@ -1028,12 +1168,11 @@
 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 );
+  double extension = maxExtension();
+  rectangle.setLeft( rectangle.left() - extension );
+  rectangle.setRight( rectangle.right() + extension );
+  rectangle.setTop( rectangle.top() - extension );
+  rectangle.setBottom( rectangle.bottom() + extension );
   if ( rectangle != mCurrentRectangle )
   {
     prepareGeometryChange();
@@ -1043,85 +1182,209 @@
 
 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 dx = mXOffset;
+  double dy = mYOffset;
+  transformShift( dx, dy );
+  return QgsRectangle( mExtent.xMinimum() - dx, mExtent.yMinimum() - dy, mExtent.xMaximum() - dx, mExtent.yMaximum() - dy );
 }
 
-double QgsComposerMap::maxExtensionXDirection() const
+QPolygonF QgsComposerMap::transformedMapPolygon() const
 {
+  double dx = mXOffset;
+  double dy = mYOffset;
+  //qWarning("offset");
+  //qWarning(QString::number(dx).toLocal8Bit().data());
+  //qWarning(QString::number(dy).toLocal8Bit().data());
+  transformShift( dx, dy );
+  //qWarning("transformed:");
+  //qWarning(QString::number(dx).toLocal8Bit().data());
+  //qWarning(QString::number(dy).toLocal8Bit().data());
+  QPolygonF poly;
+  mapPolygon( poly );
+  poly.translate( -dx, -dy );
+  return poly;
+}
+
+double QgsComposerMap::maxExtension() const
+{
   if ( !mGridEnabled || !mShowGridAnnotation || mGridAnnotationPosition != OutsideMapFrame )
   {
     return 0;
   }
 
-  QList< QPair< double, QLineF > > horizontalLines;
-  if ( horizontalGridLines( horizontalLines ) != 0 )
+  QList< QPair< double, QLineF > > xLines;
+  QList< QPair< double, QLineF > > yLines;
+
+  if ( xGridLines( xLines ) != 0 )
   {
     return 0;
   }
 
+  if ( yGridLines( yLines ) != 0 )
+  {
+    return 0;
+  }
+
+  double maxExtension = 0;
   double currentExtension = 0;
-  double maxExtension = 0;
   QString currentAnnotationString;
 
-  QList< QPair< double, QLineF > >::const_iterator hIt = horizontalLines.constBegin();
-  for ( ; hIt != horizontalLines.constEnd(); ++hIt )
+  QList< QPair< double, QLineF > >::const_iterator it = xLines.constBegin();
+  for ( ; it != xLines.constEnd(); ++it )
   {
-    currentAnnotationString = QString::number( hIt->first );
-    if ( mGridAnnotationDirection == Vertical )
-    {
-      currentExtension =  fontAscentMillimeters( mGridAnnotationFont ) + mAnnotationFrameDistance;
-    }
-    else
-    {
-      currentExtension = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString ) + mAnnotationFrameDistance;
-    }
+    currentAnnotationString = QString::number( it->first );
+    currentExtension = std::max( textWidthMillimeters( mGridAnnotationFont, currentAnnotationString ), fontAscentMillimeters( mGridAnnotationFont ) );
+    maxExtension = std::max( maxExtension, currentExtension );
+  }
 
-    if ( currentExtension > maxExtension )
-    {
-      maxExtension = currentExtension;
-    }
+  it = yLines.constBegin();
+  for ( ; it != yLines.constEnd(); ++it )
+  {
+    currentAnnotationString = QString::number( it->first );
+    currentExtension = std::max( textWidthMillimeters( mGridAnnotationFont, currentAnnotationString ), fontAscentMillimeters( mGridAnnotationFont ) );
+    maxExtension = std::max( maxExtension, currentExtension );
   }
 
-  return maxExtension;
+  return maxExtension + mAnnotationFrameDistance;
 }
 
-double QgsComposerMap::maxExtensionYDirection() const
+void QgsComposerMap::mapPolygon( QPolygonF& poly ) const
 {
-  if ( !mGridEnabled || !mShowGridAnnotation || mGridAnnotationPosition != OutsideMapFrame )
+  poly.clear();
+  if ( mRotation == 0 )
   {
-    return 0;
+    poly << QPointF( mExtent.xMinimum(), mExtent.yMaximum() );
+    poly << QPointF( mExtent.xMaximum(), mExtent.yMaximum() );
+    poly << QPointF( mExtent.xMaximum(), mExtent.yMinimum() );
+    poly << QPointF( mExtent.xMinimum(), mExtent.yMinimum() );
+    return;
   }
 
-  QList< QPair< double, QLineF > > verticalLines;
-  if ( verticalGridLines( verticalLines ) != 0 )
+  //there is rotation
+  QgsPoint rotationPoint(( mExtent.xMaximum() + mExtent.xMinimum() ) / 2.0, ( mExtent.yMaximum() + mExtent.yMinimum() ) / 2.0 );
+  double dx, dy; //x-, y- shift from rotation point to corner point
+
+  //top left point
+  dx = rotationPoint.x() - mExtent.xMinimum();
+  dy = rotationPoint.y() - mExtent.yMaximum();
+  rotate( mRotation, dx, dy );
+  poly << QPointF( rotationPoint.x() + dx, rotationPoint.y() + dy );
+
+  //top right point
+  dx = rotationPoint.x() - mExtent.xMaximum();
+  dy = rotationPoint.y() - mExtent.yMaximum();
+  rotate( mRotation, dx, dy );
+  poly << QPointF( rotationPoint.x() + dx, rotationPoint.y() + dy );
+
+  //bottom right point
+  dx = rotationPoint.x() - mExtent.xMaximum();
+  dy = rotationPoint.y() - mExtent.yMinimum();
+  rotate( mRotation, dx, dy );
+  poly << QPointF( rotationPoint.x() + dx, rotationPoint.y() + dy );
+
+  //bottom left point
+  dx = rotationPoint.x() - mExtent.xMinimum();
+  dy = rotationPoint.y() - mExtent.yMinimum();
+  rotate( mRotation, dx, dy );
+  poly << QPointF( rotationPoint.x() + dx, rotationPoint.y() + dy );
+}
+
+void QgsComposerMap::requestedExtent( QgsRectangle& extent ) const
+{
+  if ( mRotation == 0 )
   {
-    return 0;
+    extent = mExtent;
+    return;
   }
 
-  double currentExtension = 0;
-  double maxExtension = 0;
-  QString currentAnnotationString;
+  QPolygonF poly;
+  mapPolygon( poly );
+  QRectF bRect = poly.boundingRect();
+  extent.setXMinimum( bRect.left() );
+  extent.setXMaximum( bRect.right() );
+  extent.setYMinimum( bRect.top() );
+  extent.setYMaximum( bRect.bottom() );
+  return;
+}
 
-  QList< QPair< double, QLineF > >::const_iterator vIt = verticalLines.constBegin();
-  for ( ; vIt != verticalLines.constEnd(); ++vIt )
+double QgsComposerMap::mapUnitsToMM() const
+{
+  double extentWidth = mExtent.width();
+  if ( !extentWidth > 0 )
   {
-    currentAnnotationString = QString::number( vIt->first );
-    if ( mGridAnnotationDirection == Horizontal )
-    {
-      currentExtension = fontAscentMillimeters( mGridAnnotationFont ) + mAnnotationFrameDistance;
-    }
-    else
-    {
-      currentExtension = textWidthMillimeters( mGridAnnotationFont, currentAnnotationString ) + mAnnotationFrameDistance;
-    }
+    return 1;
+  }
+  return rect().width() / extentWidth;
+}
 
-    if ( currentExtension > maxExtension )
-    {
-      maxExtension = currentExtension;
-    }
+void QgsComposerMap::transformShift( double& xShift, double& yShift ) const
+{
+  double mmToMapUnits = 1.0 / mapUnitsToMM();
+  double dxScaled = xShift * mmToMapUnits;
+  double dyScaled = - yShift * mmToMapUnits;
+
+  rotate( mRotation, dxScaled, dyScaled );
+
+  xShift = dxScaled;
+  yShift = dyScaled;
+}
+
+QPointF QgsComposerMap::mapToItemCoords( const QPointF& mapCoords ) const
+{
+  QPolygonF mapPoly = transformedMapPolygon();
+  if ( mapPoly.size() < 1 )
+  {
+    return QPointF( 0, 0 );
   }
-  return maxExtension;
+
+  QgsRectangle tExtent = transformedExtent();
+  QgsPoint rotationPoint(( tExtent.xMaximum() + tExtent.xMinimum() ) / 2.0, ( tExtent.yMaximum() + tExtent.yMinimum() ) / 2.0 );
+  double dx = mapCoords.x() - rotationPoint.x();
+  double dy = mapCoords.y() - rotationPoint.y();
+  rotate( -mRotation, dx, dy );
+  QgsPoint backRotatedCoords( rotationPoint.x() + dx, rotationPoint.y() + dy );
+
+  QgsRectangle unrotatedExtent = transformedExtent();
+  double xItem = rect().width() * ( backRotatedCoords.x() - unrotatedExtent.xMinimum() ) / unrotatedExtent.width();
+  double yItem = rect().height() * ( 1 - ( backRotatedCoords.y() - unrotatedExtent.yMinimum() ) / unrotatedExtent.height() );
+  return QPointF( xItem, yItem );
 }
+
+QgsComposerMap::Border QgsComposerMap::borderForLineCoord( const QPointF& p ) const
+{
+  if ( p.x() <= pen().widthF() )
+  {
+    return Left;
+  }
+  else if ( p.x() >= ( rect().width() - pen().widthF() ) )
+  {
+    return Right;
+  }
+  else if ( p.y() <= pen().widthF() )
+  {
+    return Top;
+  }
+  else
+  {
+    return Bottom;
+  }
+}
+
+void QgsComposerMap::rotate( double angle, double& x, double& y ) const
+{
+  double rotToRad = angle * M_PI / 180.0;
+  double xRot, yRot;
+  xRot = x * cos( rotToRad ) - y * sin( rotToRad );
+  yRot = x * sin( rotToRad ) + y * cos( rotToRad );
+  x = xRot;
+  y = yRot;
+}
+
+QPointF QgsComposerMap::pointOnLineWithDistance( const QPointF& startPoint, const QPointF& directionPoint, double distance ) const
+{
+  double dx = directionPoint.x() - startPoint.x();
+  double dy = directionPoint.y() - startPoint.y();
+  double length = sqrt( dx * dx + dy * dy );
+  double scaleFactor = distance / length;
+  return QPointF( startPoint.x() + dx * scaleFactor, startPoint.y() + dy * scaleFactor );
+}

Modified: trunk/qgis/src/core/composer/qgscomposermap.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.h	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/core/composer/qgscomposermap.h	2009-10-26 09:46:21 UTC (rev 11847)
@@ -70,15 +70,10 @@
     {
       Horizontal = 0,
       Vertical,
-      HorizontalAndVertical
+      HorizontalAndVertical,
+      BoundaryDirection
     };
 
-    enum GridAnnotationType
-    {
-      Coordinate = 0, //annotation at line, displays coordinates
-      Sector //annotation at sector: 1, 2, 3 for horizontal lines and A, B, C for vertical ones
-    };
-
     /** \brief Draw to paint device
     @param extent map extent
     @param size size in scene coordinates
@@ -204,14 +199,17 @@
     void setGridAnnotationDirection( GridAnnotationDirection d ) {mGridAnnotationDirection = d;}
     GridAnnotationDirection gridAnnotationDirection() const {return mGridAnnotationDirection;}
 
-    void setGridAnnotationType( GridAnnotationType t ) {mGridAnnotationType = t;}
-    GridAnnotationType gridAnnotationType() const {return mGridAnnotationType; }
-
     /**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();
 
+    void setRotation( double r ) { mRotation = r; }
+    double rotation() const { return mRotation; }
+
+    void setCrossLength( double l ) {mCrossLength = l;}
+    double crossLength() {return mCrossLength;}
+
   public slots:
 
     /**Called if map canvas has changed*/
@@ -225,6 +223,15 @@
 
   private:
 
+    /**Enum for different frame borders*/
+    enum Border
+    {
+      Left,
+      Right,
+      Bottom,
+      Top
+    };
+
     // Pointer to map renderer of the QGIS main map. Note that QgsComposerMap uses a different map renderer,
     //it just copies some properties from the main map renderer.
     QgsMapRenderer *mMapRenderer;
@@ -296,33 +303,60 @@
     double mAnnotationFrameDistance;
     /**Annotation can be horizontal / vertical or different for axes*/
     GridAnnotationDirection mGridAnnotationDirection;
-    /**Coordinate values (default) or sector (1A, 1B, ...)*/
-    GridAnnotationType mGridAnnotationType;
     /**Current bounding rectangle. This is used to check if notification to the graphics scene is necessary*/
     QRectF mCurrentRectangle;
 
+    /**Rotation of the map. Clockwise in degrees, north direction is 0*/
+    double mRotation;
+    /**The length of the cross sides for mGridStyle Cross*/
+    double mCrossLength;
+
     /**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 );
+    /**Draw coordinates for mGridAnnotationType Coordinate
+        @param lines the coordinate lines in item coordinates*/
+    void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines );
+    void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString annotationString );
     /**Draws a single annotation
         @param p drawing painter
         @param pos item coordinates where to draw
         @param rotation text rotation
         @param the text to draw*/
     void drawAnnotation( QPainter* p, const QPointF& pos, int rotation, const QString& annotationText );
-    /**Calculates the horizontal grid lines
-        @lines list containing the map coordinates and the lines in item coordinates
+    /**Returns the grid lines with associated coordinate value
         @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
+    int xGridLines( QList< QPair< double, QLineF > >& lines ) const;
+    /**Returns the grid lines for the y-coordinates. Not vertical in case of rotation
         @return 0 in case of success*/
-    int verticalGridLines( QList< QPair< double, QLineF > >& lines ) const;
+    int yGridLines( QList< QPair< double, QLineF > >& lines ) const;
     /**Returns extent that considers mOffsetX / mOffsetY (during content move)*/
     QgsRectangle transformedExtent() const;
-    double maxExtensionXDirection() const;
-    double maxExtensionYDirection() const;
+    /**Returns extent that considers rotation and shift with mOffsetX / mOffsetY*/
+    QPolygonF transformedMapPolygon() const;
+    double maxExtension() const;
+    /**Returns the polygon of the map extent. If rotation == 0, the result is the same as mExtent
+    @param poly out: the result polygon with the four corner points. The points are clockwise, starting at the top-left point
+    @return true in case of success*/
+    void mapPolygon( QPolygonF& poly ) const;
+    /**Calculates the extent to request and the yShift of the top-left point in case of rotation.*/
+    void requestedExtent( QgsRectangle& extent ) const;
+    /**Returns the conversion factor map units -> mm*/
+    double mapUnitsToMM() const;
+    /**Scales a composer map shift (in MM) and rotates it by mRotation
+        @param xShift in: shift in x direction (in item units), out: xShift in map units
+        @param yShift in: shift in y direction (in item units), out: yShift in map units*/
+    void transformShift( double& xShift, double& yShift ) const;
+    /**Transforms map coordinates to item coordinates (considering rotation and move offset)*/
+    QPointF mapToItemCoords( const QPointF& mapCoords ) const;
+    /**Returns the item border of a point (in item coordinates)*/
+    Border borderForLineCoord( const QPointF& p ) const;
+    /**Rotates a point / vector
+        @param angle rotation angle in degrees, counterclockwise
+        @param x in/out: x coordinate before / after the rotation
+        @param y in/out: y cooreinate before / after the rotation*/
+    void rotate( double angle, double& x, double& y ) const;
+    /**Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point*/
+    QPointF pointOnLineWithDistance( const QPointF& startPoint, const QPointF& directionPoint, double distance ) const;
 };
 
 #endif

Modified: trunk/qgis/src/ui/qgscomposeritemwidgetbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscomposeritemwidgetbase.ui	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/ui/qgscomposeritemwidgetbase.ui	2009-10-26 09:46:21 UTC (rev 11847)
@@ -1,91 +1,92 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>QgsComposerItemWidgetBase</class>
- <widget class="QWidget" name="QgsComposerItemWidgetBase" >
-  <property name="geometry" >
+ <widget class="QWidget" name="QgsComposerItemWidgetBase">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>347</width>
-    <height>207</height>
+    <height>157</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QGridLayout" >
-   <item row="0" column="0" >
-    <widget class="QGroupBox" name="mComposerItemPropertiesGroupBox" >
-     <property name="title" >
+  <layout class="QGridLayout">
+   <item row="0" column="0">
+    <widget class="QGroupBox" name="mComposerItemPropertiesGroupBox">
+     <property name="title">
       <string>Composer item properties</string>
      </property>
-     <layout class="QGridLayout" >
-      <item row="0" column="0" >
-       <widget class="QLabel" name="mColorLabel" >
-        <property name="text" >
+     <layout class="QGridLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="mColorLabel">
+        <property name="text">
          <string>Color</string>
         </property>
-        <property name="buddy" >
+        <property name="buddy">
          <cstring>mFrameColorButton</cstring>
         </property>
        </widget>
       </item>
-      <item row="0" column="1" colspan="2" >
-       <widget class="QPushButton" name="mFrameColorButton" >
-        <property name="text" >
+      <item row="0" column="1" colspan="2">
+       <widget class="QPushButton" name="mFrameColorButton">
+        <property name="text">
          <string>Frame...</string>
         </property>
        </widget>
       </item>
-      <item row="0" column="3" >
-       <widget class="QPushButton" name="mBackgroundColorButton" >
-        <property name="text" >
+      <item row="0" column="3">
+       <widget class="QPushButton" name="mBackgroundColorButton">
+        <property name="text">
          <string>Background...</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="0" colspan="2" >
-       <widget class="QLabel" name="mOpacityLabel" >
-        <property name="text" >
+      <item row="1" column="0" colspan="2">
+       <widget class="QLabel" name="mOpacityLabel">
+        <property name="text">
          <string>Opacity</string>
         </property>
-        <property name="buddy" >
+        <property name="buddy">
          <cstring>mOpacitySlider</cstring>
         </property>
        </widget>
       </item>
-      <item row="1" column="2" colspan="2" >
-       <widget class="QSlider" name="mOpacitySlider" >
-        <property name="maximum" >
+      <item row="1" column="2" colspan="2">
+       <widget class="QSlider" name="mOpacitySlider">
+        <property name="maximum">
          <number>255</number>
         </property>
-        <property name="orientation" >
+        <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
        </widget>
       </item>
-      <item row="2" column="0" colspan="2" >
-       <widget class="QLabel" name="mOutlineWidthLabel" >
-        <property name="text" >
+      <item row="2" column="0" colspan="2">
+       <widget class="QLabel" name="mOutlineWidthLabel">
+        <property name="text">
          <string>Outline width</string>
         </property>
-        <property name="buddy" >
+        <property name="buddy">
          <cstring>mOutlineWidthSpinBox</cstring>
         </property>
        </widget>
       </item>
-      <item row="2" column="2" colspan="2" >
-       <widget class="QDoubleSpinBox" name="mOutlineWidthSpinBox" />
+      <item row="2" column="2" colspan="2">
+       <widget class="QDoubleSpinBox" name="mOutlineWidthSpinBox"/>
       </item>
-      <item row="3" column="0" colspan="2" >
-       <widget class="QPushButton" name="mPositionButton" >
-        <property name="text" >
+      <item row="3" column="0" colspan="2">
+       <widget class="QPushButton" name="mPositionButton">
+        <property name="text">
          <string>Position...</string>
         </property>
        </widget>
       </item>
-      <item row="3" column="3" >
-       <widget class="QCheckBox" name="mFrameCheckBox" >
-        <property name="text" >
+      <item row="3" column="3">
+       <widget class="QCheckBox" name="mFrameCheckBox">
+        <property name="text">
          <string>Frame</string>
         </property>
        </widget>

Modified: trunk/qgis/src/ui/qgscomposermapwidgetbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscomposermapwidgetbase.ui	2009-10-26 05:47:34 UTC (rev 11846)
+++ trunk/qgis/src/ui/qgscomposermapwidgetbase.ui	2009-10-26 09:46:21 UTC (rev 11847)
@@ -1,152 +1,167 @@
-<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>506</width>
-    <height>708</height>
+    <width>482</width>
+    <height>641</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" name="gridLayout_3" >
-   <item row="0" column="0" >
-    <widget class="QGroupBox" name="mMapGroupBox" >
-     <property name="title" >
+  <layout class="QGridLayout" name="gridLayout_3">
+   <item row="0" column="0">
+    <widget class="QGroupBox" name="mMapGroupBox">
+     <property name="title">
       <string>Map</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout_2" >
-      <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="1" >
-       <widget class="QLineEdit" name="mWidthLineEdit" />
+      <item row="0" column="1" colspan="2">
+       <widget class="QLineEdit" name="mWidthLineEdit"/>
       </item>
-      <item row="1" column="0" >
-       <widget class="QLabel" name="label_3" >
-        <property name="text" >
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="text">
          <string>Height</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1" >
-       <widget class="QLineEdit" name="mHeightLineEdit" />
+      <item row="1" column="1" colspan="2">
+       <widget class="QLineEdit" name="mHeightLineEdit"/>
       </item>
-      <item row="2" column="0" >
-       <layout class="QHBoxLayout" name="horizontalLayout" >
+      <item row="2" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout">
         <item>
-         <widget class="QLabel" name="label_2" >
-          <property name="sizePolicy" >
-           <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+         <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" >
+          <property name="text">
            <string>Scale</string>
           </property>
-          <property name="wordWrap" >
+          <property name="wordWrap">
            <bool>true</bool>
           </property>
          </widget>
         </item>
         <item>
-         <widget class="QLabel" name="label" >
-          <property name="text" >
+         <widget class="QLabel" name="label">
+          <property name="text">
            <string>1:</string>
           </property>
          </widget>
         </item>
        </layout>
       </item>
-      <item row="2" column="1" >
-       <widget class="QLineEdit" name="mScaleLineEdit" >
-        <property name="inputMask" >
+      <item row="2" column="2">
+       <widget class="QLineEdit" name="mScaleLineEdit">
+        <property name="inputMask">
          <string/>
         </property>
        </widget>
       </item>
+      <item row="3" column="0" colspan="2">
+       <widget class="QLabel" name="mRotationLabel">
+        <property name="text">
+         <string>Rotation:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="2">
+       <widget class="QSpinBox" name="mRotationSpinBox">
+        <property name="maximum">
+         <number>359</number>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
-   <item row="1" column="0" >
-    <widget class="QGroupBox" name="mMapExtentGroupBox" >
-     <property name="title" >
+   <item row="1" column="0">
+    <widget class="QGroupBox" name="mMapExtentGroupBox">
+     <property name="title">
       <string>Map extent</string>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout" >
+     <layout class="QVBoxLayout" name="verticalLayout">
       <item>
-       <layout class="QGridLayout" name="gridLayout_4" >
-        <item row="0" column="1" >
-         <widget class="QLineEdit" name="mXMinLineEdit" />
+       <layout class="QGridLayout" name="gridLayout_4">
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="mXMinLineEdit"/>
         </item>
-        <item row="0" column="0" >
-         <widget class="QLabel" name="mXMinLabel" >
-          <property name="enabled" >
+        <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="1" column="1" >
-         <widget class="QLineEdit" name="mYMinLineEdit" />
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="mYMinLineEdit"/>
         </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="0" column="3" >
-         <widget class="QLineEdit" name="mXMaxLineEdit" />
+        <item row="0" column="3">
+         <widget class="QLineEdit" name="mXMaxLineEdit"/>
         </item>
-        <item row="1" column="3" >
-         <widget class="QLineEdit" name="mYMaxLineEdit" />
+        <item row="1" column="3">
+         <widget class="QLineEdit" name="mYMaxLineEdit"/>
         </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="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>
@@ -154,13 +169,13 @@
        </layout>
       </item>
       <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_5" >
+       <layout class="QHBoxLayout" name="horizontalLayout_5">
         <item>
          <spacer>
-          <property name="orientation" >
+          <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
-          <property name="sizeHint" stdset="0" >
+          <property name="sizeHint" stdset="0">
            <size>
             <width>311</width>
             <height>20</height>
@@ -169,14 +184,14 @@
          </spacer>
         </item>
         <item>
-         <widget class="QPushButton" name="mSetToMapCanvasExtentButton" >
-          <property name="sizePolicy" >
-           <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+         <widget class="QPushButton" name="mSetToMapCanvasExtentButton">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
-          <property name="text" >
+          <property name="text">
            <string>Set to map canvas extent</string>
           </property>
          </widget>
@@ -186,25 +201,25 @@
      </layout>
     </widget>
    </item>
-   <item row="2" column="0" >
-    <layout class="QHBoxLayout" name="horizontalLayout_2" >
+   <item row="2" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
      <item>
-      <widget class="QLabel" name="mPreviewModeLabel" >
-       <property name="text" >
+      <widget class="QLabel" name="mPreviewModeLabel">
+       <property name="text">
         <string>Preview</string>
        </property>
-       <property name="wordWrap" >
+       <property name="wordWrap">
         <bool>true</bool>
        </property>
-       <property name="buddy" >
+       <property name="buddy">
         <cstring>mPreviewModeComboBox</cstring>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QComboBox" name="mPreviewModeComboBox" >
-       <property name="sizePolicy" >
-        <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+      <widget class="QComboBox" name="mPreviewModeComboBox">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -212,221 +227,197 @@
       </widget>
      </item>
      <item>
-      <widget class="QPushButton" name="mUpdatePreviewButton" >
-       <property name="text" >
+      <widget class="QPushButton" name="mUpdatePreviewButton">
+       <property name="text">
         <string>Update preview</string>
        </property>
       </widget>
      </item>
     </layout>
    </item>
-   <item row="3" column="0" >
-    <widget class="QCheckBox" name="mKeepLayerListCheckBox" >
-     <property name="text" >
+   <item row="3" column="0">
+    <widget class="QCheckBox" name="mKeepLayerListCheckBox">
+     <property name="text">
       <string>Keep layer list</string>
      </property>
     </widget>
    </item>
-   <item row="4" column="0" >
-    <widget class="QCheckBox" name="mShowGridDialogCheckBox" >
-     <property name="text" >
+   <item row="4" column="0">
+    <widget class="QCheckBox" name="mShowGridDialogCheckBox">
+     <property name="text">
       <string>Show composer grid widget</string>
      </property>
     </widget>
    </item>
-   <item row="5" column="0" >
-    <widget class="QDockWidget" name="mGridDockWidget" >
-     <property name="floating" >
-      <bool>true</bool>
-     </property>
-     <property name="features" >
-      <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
-     </property>
-     <property name="windowTitle" >
-      <string>Grid</string>
-     </property>
-     <widget class="QWidget" name="dockWidgetContents" >
-      <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>99999999.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>99999999.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 vsizetype="Preferred" hsizetype="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="3" >
-        <widget class="QLabel" name="mAnnotationTypeLabel" >
-         <property name="text" >
-          <string>Annotation type:</string>
-         </property>
-        </widget>
-       </item>
-       <item row="7" column="4" >
-        <widget class="QComboBox" name="mAnnotationTypeComboBox" />
-       </item>
-       <item row="8" column="0" >
-        <widget class="QPushButton" name="mAnnotationFontButton" >
-         <property name="text" >
-          <string>Font...</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
+   <item row="5" column="0">
+    <widget class="QWidget" name="mGridWidget" native="true">
+     <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="1" column="3">
+       <widget class="QLabel" name="mCrossWidthLabel">
+        <property name="text">
+         <string>Cross width:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="4">
+       <widget class="QDoubleSpinBox" name="mCrossWidthSpinBox"/>
+      </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="6" column="0" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0" >
-      <size>
-       <width>458</width>
-       <height>31</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
- <layoutdefault spacing="6" margin="11" />
+ <layoutdefault spacing="6" margin="11"/>
  <customwidgets>
   <customwidget>
    <class>QgsColorButton</class>



More information about the QGIS-commit mailing list