Skip to content

Commit 5c4f2ed

Browse files
author
Hugo Mercier
committedJun 19, 2013
Fix overview autocentering: always center, not only when the overview is not visible.
Work funded by Tuscany Region - SITA. Contract "Support to the use of GFOSS (Geographic Free and Open Source Software) Desktop tools" (CIG Z3B06FA6D7).
1 parent f0f72ca commit 5c4f2ed

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed
 

‎python/core/composer/qgscomposermap.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class QgsComposerMap : QgsComposerItem
302302
void setOverviewInverted( bool inverted );
303303
bool overviewInverted() const;
304304

305-
/** Returns true if the extent is forced to center on the overview when the overview is outside the extent */
305+
/** Returns true if the extent is forced to center on the overview */
306306
bool overviewCentered() const;
307307
/** Set the overview's centering mode */
308308
void setOverviewCentered( bool centered );

‎src/core/composer/qgscomposermap.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,12 @@ void QgsComposerMap::extentCenteredOnOverview( QgsRectangle& extent ) const
129129
const QgsComposerMap* overviewFrameMap = mComposition->getComposerMapById( mOverviewFrameMapId );
130130
QgsRectangle otherExtent = overviewFrameMap->extent();
131131

132-
if ( ! mExtent.contains( otherExtent ) ) {
133-
QgsPoint center = otherExtent.center();
134-
QgsRectangle movedExtent( center.x() - mExtent.width() / 2,
135-
center.y() - mExtent.height() / 2,
136-
center.x() - mExtent.width() / 2 + mExtent.width(),
137-
center.y() - mExtent.height() / 2 + mExtent.height() );
138-
extent = movedExtent;
139-
}
132+
QgsPoint center = otherExtent.center();
133+
QgsRectangle movedExtent( center.x() - mExtent.width() / 2,
134+
center.y() - mExtent.height() / 2,
135+
center.x() - mExtent.width() / 2 + mExtent.width(),
136+
center.y() - mExtent.height() / 2 + mExtent.height() );
137+
extent = movedExtent;
140138
}
141139
}
142140

‎src/core/composer/qgscomposermap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
332332
/** Sets the overview's inversion mode*/
333333
void setOverviewInverted( bool inverted );
334334

335-
/** Returns true if the extent is forced to center on the overview when the overview is outside the extent */
335+
/** Returns true if the extent is forced to center on the overview */
336336
bool overviewCentered() const { return mOverviewCentered; }
337337
/** Set the overview's centering mode */
338338
void setOverviewCentered( bool centered );
@@ -537,7 +537,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
537537
void initGridAnnotationFormatFromProject();
538538

539539
/**
540-
* Returns the extent, centered on the overview frame, if needed (when the overview frame is not visible)
540+
* Returns the extent, centered on the overview frame
541541
*/
542542
void extentCenteredOnOverview( QgsRectangle& extent ) const;
543543
};

‎src/ui/qgscomposermapwidgetbase.ui

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
<property name="geometry">
5555
<rect>
5656
<x>0</x>
57-
<y>0</y>
58-
<width>438</width>
59-
<height>1454</height>
57+
<y>-376</y>
58+
<width>439</width>
59+
<height>1439</height>
6060
</rect>
6161
</property>
6262
<property name="sizePolicy">
@@ -700,7 +700,7 @@
700700
<item row="4" column="0">
701701
<widget class="QCheckBox" name="mOverviewCenterCheckbox">
702702
<property name="text">
703-
<string>Center on overview when needed</string>
703+
<string>Center on overview</string>
704704
</property>
705705
</widget>
706706
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.