mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
Add SIP and Python unit test for overview autocentering.
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
9d20a69b94
commit
f0f72ca8a9
@ -302,6 +302,11 @@ class QgsComposerMap : QgsComposerItem
|
||||
void setOverviewInverted( bool inverted );
|
||||
bool overviewInverted() const;
|
||||
|
||||
/** Returns true if the extent is forced to center on the overview when the overview is outside the extent */
|
||||
bool overviewCentered() const;
|
||||
/** Set the overview's centering mode */
|
||||
void setOverviewCentered( bool centered );
|
||||
|
||||
/**Sets mId to a number not yet used in the composition. mId is kept if it is not in use.
|
||||
Usually, this function is called before adding the composer map to the composition*/
|
||||
void assignFreeId();
|
||||
|
@ -181,6 +181,32 @@ class TestQgsComposerMap(TestCase):
|
||||
self.mComposition.removeComposerItem(overviewMap)
|
||||
assert myTestResult == True, myMessage
|
||||
|
||||
def testOverviewMapCenter(self):
|
||||
overviewMap = QgsComposerMap(self.mComposition, 20, 130, 70, 70)
|
||||
overviewMap.setFrameEnabled(True)
|
||||
self.mComposition.addComposerMap(overviewMap)
|
||||
# zoom in
|
||||
myRectangle = QgsRectangle(785462.375+5000, 3341423.125,
|
||||
789262.375+5000, 3343323.125)
|
||||
self.mComposerMap.setNewExtent(myRectangle)
|
||||
myRectangle2 = QgsRectangle(781662.375, 3339523.125,
|
||||
793062.375, 3350923.125)
|
||||
overviewMap.setNewExtent(myRectangle2)
|
||||
overviewMap.setOverviewFrameMap(self.mComposerMap.id())
|
||||
overviewMap.setOverviewInverted(False)
|
||||
overviewMap.setOverviewCentered(True)
|
||||
checker = QgsCompositionChecker()
|
||||
myPngPath = os.path.join(TEST_DATA_DIR,
|
||||
'control_images',
|
||||
'expected_composermap',
|
||||
'composermap_landsat_overview_center.png')
|
||||
myTestResult, myMessage = checker.testComposition(
|
||||
'Composer map overview centered',
|
||||
self.mComposition,
|
||||
myPngPath)
|
||||
self.mComposition.removeComposerItem(overviewMap)
|
||||
assert myTestResult == True, myMessage
|
||||
|
||||
# Fails because addItemsFromXML has been commented out in sip
|
||||
@expectedFailure
|
||||
def testuniqueId(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user