Skip to content
Permalink
Browse files

Set correct frame style in composermap widget, update python bindings

  • Loading branch information
mhugent committed Jul 4, 2012
1 parent 4b3e817 commit 9d3b505271107438bef36fcd77d5dccf049690c9
Showing with 32 additions and 0 deletions.
  1. +16 −0 python/core/qgscomposermap.sip
  2. +12 −0 src/app/composer/qgscomposermapwidget.cpp
  3. +4 −0 src/core/composer/qgscomposermap.cpp
@@ -57,6 +57,12 @@ class QgsComposerMap : QgsComposerItem
Top
};

enum GridFrameStyle
{
NoGridFrame = 0,
Zebra //black / white pattern
};

/**@deprecated*/
void draw( QPainter *painter, const QgsRectangle& extent, const QSize& size, int dpi );

@@ -222,6 +228,16 @@ class QgsComposerMap : QgsComposerItem
/**@note: this function was added in version 1.9*/
GridAnnotationDirection gridAnnotationDirection( QgsComposerMap::Border border ) const;

/**Set grid frame style (NoGridFrame or Zebra)
@note: this function was added in version 1.9*/
void setGridFrameStyle( GridFrameStyle style );
GridFrameStyle gridFrameStyle() const;

/**Set grid frame width
@note: this function was added in version 1.9*/
void setGridFrameWidth( double w );
double gridFrameWidth() const;

/**In case of annotations, the bounding rectangle can be larger than the map item rectangle
@note this function was added in version 1.4*/
QRectF boundingRect() const;
@@ -349,6 +349,18 @@ void QgsComposerMapWidget::updateGuiElements()

mCrossWidthSpinBox->setValue( mComposerMap->crossLength() );

//grid frame
mFrameWidthSpinBox->setValue( mComposerMap->gridFrameWidth() );
QgsComposerMap::GridFrameStyle gridFrameStyle = mComposerMap->gridFrameStyle();
if ( gridFrameStyle == QgsComposerMap::Zebra )
{
mFrameStyleComboBox->setCurrentIndex( mFrameStyleComboBox->findText( tr( "Zebra" ) ) );
}
else //NoGridFrame
{
mFrameStyleComboBox->setCurrentIndex( mFrameStyleComboBox->findText( tr( "No frame" ) ) );
}

//grid annotation position
initAnnotationPositionBox( mAnnotationPositionLeftComboBox, mComposerMap->gridAnnotationPosition( QgsComposerMap::Left ) );
initAnnotationPositionBox( mAnnotationPositionRightComboBox, mComposerMap->gridAnnotationPosition( QgsComposerMap::Right ) );
@@ -692,6 +692,8 @@ bool QgsComposerMap::writeXML( QDomElement& elem, QDomDocument & doc ) const
gridElem.setAttribute( "penColorGreen", mGridPen.color().green() );
gridElem.setAttribute( "penColorBlue", mGridPen.color().blue() );
gridElem.setAttribute( "crossLength", QString::number( mCrossLength ) );
gridElem.setAttribute( "gridFrameStyle", mGridFrameStyle );
gridElem.setAttribute( "gridFrameWidth", QString::number( mGridFrameWidth ) );

//grid annotation
QDomElement annotationElem = doc.createElement( "Annotation" );
@@ -813,6 +815,8 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
gridElem.attribute( "penColorGreen", "0" ).toInt(),
gridElem.attribute( "penColorBlue", "0" ).toInt() ) );
mCrossLength = gridElem.attribute( "crossLength", "3" ).toDouble();
mGridFrameStyle = ( QgsComposerMap::GridFrameStyle )gridElem.attribute( "gridFrameStyle", "0" ).toInt();
mGridFrameWidth = gridElem.attribute( "gridFrameWidth", "2.0" ).toDouble();

QDomNodeList annotationNodeList = gridElem.elementsByTagName( "Annotation" );
if ( annotationNodeList.size() > 0 )

0 comments on commit 9d3b505

Please sign in to comment.
You can’t perform that action at this time.