mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
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).
This commit is contained in:
parent
f0f72ca8a9
commit
5c4f2ed984
@ -302,7 +302,7 @@ class QgsComposerMap : QgsComposerItem
|
|||||||
void setOverviewInverted( bool inverted );
|
void setOverviewInverted( bool inverted );
|
||||||
bool overviewInverted() const;
|
bool overviewInverted() const;
|
||||||
|
|
||||||
/** Returns true if the extent is forced to center on the overview when the overview is outside the extent */
|
/** Returns true if the extent is forced to center on the overview */
|
||||||
bool overviewCentered() const;
|
bool overviewCentered() const;
|
||||||
/** Set the overview's centering mode */
|
/** Set the overview's centering mode */
|
||||||
void setOverviewCentered( bool centered );
|
void setOverviewCentered( bool centered );
|
||||||
|
@ -129,14 +129,12 @@ void QgsComposerMap::extentCenteredOnOverview( QgsRectangle& extent ) const
|
|||||||
const QgsComposerMap* overviewFrameMap = mComposition->getComposerMapById( mOverviewFrameMapId );
|
const QgsComposerMap* overviewFrameMap = mComposition->getComposerMapById( mOverviewFrameMapId );
|
||||||
QgsRectangle otherExtent = overviewFrameMap->extent();
|
QgsRectangle otherExtent = overviewFrameMap->extent();
|
||||||
|
|
||||||
if ( ! mExtent.contains( otherExtent ) ) {
|
QgsPoint center = otherExtent.center();
|
||||||
QgsPoint center = otherExtent.center();
|
QgsRectangle movedExtent( center.x() - mExtent.width() / 2,
|
||||||
QgsRectangle movedExtent( center.x() - mExtent.width() / 2,
|
center.y() - mExtent.height() / 2,
|
||||||
center.y() - mExtent.height() / 2,
|
center.x() - mExtent.width() / 2 + mExtent.width(),
|
||||||
center.x() - mExtent.width() / 2 + mExtent.width(),
|
center.y() - mExtent.height() / 2 + mExtent.height() );
|
||||||
center.y() - mExtent.height() / 2 + mExtent.height() );
|
extent = movedExtent;
|
||||||
extent = movedExtent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
|
|||||||
/** Sets the overview's inversion mode*/
|
/** Sets the overview's inversion mode*/
|
||||||
void setOverviewInverted( bool inverted );
|
void setOverviewInverted( bool inverted );
|
||||||
|
|
||||||
/** Returns true if the extent is forced to center on the overview when the overview is outside the extent */
|
/** Returns true if the extent is forced to center on the overview */
|
||||||
bool overviewCentered() const { return mOverviewCentered; }
|
bool overviewCentered() const { return mOverviewCentered; }
|
||||||
/** Set the overview's centering mode */
|
/** Set the overview's centering mode */
|
||||||
void setOverviewCentered( bool centered );
|
void setOverviewCentered( bool centered );
|
||||||
@ -537,7 +537,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
|
|||||||
void initGridAnnotationFormatFromProject();
|
void initGridAnnotationFormatFromProject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the extent, centered on the overview frame, if needed (when the overview frame is not visible)
|
* Returns the extent, centered on the overview frame
|
||||||
*/
|
*/
|
||||||
void extentCenteredOnOverview( QgsRectangle& extent ) const;
|
void extentCenteredOnOverview( QgsRectangle& extent ) const;
|
||||||
};
|
};
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-376</y>
|
||||||
<width>438</width>
|
<width>439</width>
|
||||||
<height>1454</height>
|
<height>1439</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -700,7 +700,7 @@
|
|||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="mOverviewCenterCheckbox">
|
<widget class="QCheckBox" name="mOverviewCenterCheckbox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Center on overview when needed</string>
|
<string>Center on overview</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user