Hello,
We have created a publishing tool using the LargeScalePrinting example from the Wiki.
One of the functionalities is letting the user zoom in/out through the buttons. Jump in steps that are too large, how can we decrease the zoom steps?
This is the code which we are using to perform the zoom in/out:
private
void
btnZoomIn_Click(
object
sender, RoutedEventArgs e)
{
// Grab the MapPrinterLayer and adjust the extent
PrinterInteractiveOverlay printerOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays[
"PrintPreviewOverlay"
];
MapPrinterLayer mapPrinterLayer = ((MapPrinterLayer)(printerOverlay.PrinterLayers[
"MapLayer"
]));
// Here we snap the current scale to the default zoomLevelSet when we zoom in
ZoomLevelSet zoomLevelSet =
new
ZoomLevelSet();
double
newScale = ZoomLevelSet.GetLowerZoomLevelScale(ExtentHelper.GetScale(mapPrinterLayer.MapExtent, (
float
)mapPrinterLayer.GetBoundingBox().Width, mapPrinterLayer.MapUnit), zoomLevelSet);
mapPrinterLayer.MapExtent = ExtentHelper.ZoomToScale(newScale, mapPrinterLayer.MapExtent, mapPrinterLayer.MapUnit, (
float
)mapPrinterLayer.GetBoundingBox().Width, (
float
)mapPrinterLayer.GetBoundingBox().Height);
Map1.Refresh();
}
private
void
btnZoomOut_Click(
object
sender, RoutedEventArgs e)
{
// Grab the MapPrinterLayer and adjust the extent
PrinterInteractiveOverlay printerOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays[
"PrintPreviewOverlay"
];
MapPrinterLayer mapPrinterLayer = ((MapPrinterLayer)(printerOverlay.PrinterLayers[
"MapLayer"
]));
// Here we snap the current scale to the default zoomLevelSet when we zoom in
ZoomLevelSet zoomLevelSet =
new
ZoomLevelSet();
double
newScale = ZoomLevelSet.GetHigherZoomLevelScale(ExtentHelper.GetScale(mapPrinterLayer.MapExtent, (
float
)mapPrinterLayer.GetBoundingBox().Width, mapPrinterLayer.MapUnit), zoomLevelSet);
mapPrinterLayer.MapExtent = ExtentHelper.ZoomToScale(newScale, mapPrinterLayer.MapExtent, mapPrinterLayer.MapUnit, (
float
)mapPrinterLayer.GetBoundingBox().Width, (
float
)mapPrinterLayer.GetBoundingBox().Height);
Map1.Refresh();
}
Regards,
Shahin