23 changes: 23 additions & 0 deletions src/core/composer/qgscomposermap.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
BoundaryDirection
};

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

/**Enum for different frame borders*/
enum Border
{
Expand Down Expand Up @@ -248,6 +254,16 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
void setGridAnnotationDirection( GridAnnotationDirection d, QgsComposerMap::Border border );
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 ) { mGridFrameStyle = style; }
GridFrameStyle gridFrameStyle() const { return mGridFrameStyle; }

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

/**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;
Expand Down Expand Up @@ -371,6 +387,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
/**Annotation direction on bottom side ( horizontal or vertical )*/
GridAnnotationDirection mBottomGridAnnotationDirection;

GridFrameStyle mGridFrameStyle;
double mGridFrameWidth;

/**Current bounding rectangle. This is used to check if notification to the graphics scene is necessary*/
QRectF mCurrentRectangle;
/**The length of the cross sides for mGridStyle Cross*/
Expand All @@ -381,6 +400,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem

/**Draws the map grid*/
void drawGrid( QPainter* p );
void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines );
/**Draw coordinates for mGridAnnotationType Coordinate
@param p drawing painter
@param hLines horizontal coordinate lines in item coordinates
Expand Down Expand Up @@ -422,6 +442,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
void drawCanvasItems( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle );
void drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QStyleOptionGraphicsItem* itemStyle );
QPointF composerMapPosForItem( const QGraphicsItem* item ) const;
void sortGridLinesOnBorders( const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines, QMap< double, double >& leftFrameEntries,
QMap< double, double >& rightFrameEntries, QMap< double, double >& topFrameEntries, QMap< double, double >& bottomFrameEntries ) const;
void drawGridFrameBorder( QPainter* p, const QMap< double, double >& borderPos, Border border );
};

#endif
100 changes: 62 additions & 38 deletions src/ui/qgscomposermapwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>240</width>
<height>400</height>
<height>483</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -34,7 +34,7 @@
<x>0</x>
<y>0</y>
<width>230</width>
<height>312</height>
<height>395</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -227,8 +227,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>303</height>
<width>230</width>
<height>395</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -335,8 +335,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>217</width>
<height>662</height>
<width>218</width>
<height>712</height>
</rect>
</property>
<attribute name="label">
Expand All @@ -355,7 +355,7 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="2">
<item row="0" column="1">
<widget class="QLabel" name="mGridTypeLabel">
<property name="accessibleName">
<string extracomment="Hello translotor"/>
Expand Down Expand Up @@ -508,35 +508,59 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="mFrameStyleLabel">
<property name="text">
<string>Frame style</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="mFrameStyleComboBox"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="mFrameWidthLabel">
<property name="text">
<string>Frame width</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox"/>
</item>
</layout>
</item>
<item row="2" column="2">
<widget class="QLabel" name="mLineColorLabel">
<property name="text">
<string>Line color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mLineColorButton</cstring>
</property>
</widget>
</item>
<item row="2" column="3">
<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 row="2" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="mLineColorLabel">
<property name="text">
<string>Line color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mLineColorButton</cstring>
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
<item row="3" column="0" colspan="3">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="mDrawAnnotationCheckBox">
<property name="text">
<string>Draw annotation</string>
Expand Down Expand Up @@ -672,14 +696,14 @@
</item>
</layout>
</item>
<item row="5" column="0" colspan="2">
<item row="5" column="0">
<widget class="QPushButton" name="mAnnotationFontButton">
<property name="text">
<string>Font...</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="mDistanceToFrameLabel">
<property name="text">
<string>Distance to map frame</string>
Expand All @@ -692,10 +716,10 @@
</property>
</widget>
</item>
<item row="6" column="3">
<item row="6" column="2" colspan="2">
<widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox"/>
</item>
<item row="7" column="1" colspan="2">
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="mCoordinatePrecisionLabel">
<property name="text">
<string>Coordinate precision</string>
Expand All @@ -708,7 +732,7 @@
</property>
</widget>
</item>
<item row="7" column="3">
<item row="7" column="2" colspan="2">
<widget class="QSpinBox" name="mCoordinatePrecisionSpinBox"/>
</item>
<item row="8" column="0">
Expand Down