MapSuiteGisEditor/WpfDesktopExtension/Shares/MapEngine.cs
/// <summary>
/// This method returns an adjusted extent based on the ratio of the screen width and
/// height.
/// </summary>
/// <returns>
/// This method returns an adjusted extent based on the ratio of the screen width and
/// height.
/// </returns>
/// <remarks>
/// This function is used because the extent to draw must be the rame ratio as the screen
/// width and height. If they are not, then the image drawn will be stretched or compressed.
/// We always adjust the extent upwards to ensure that no matter how we adjust it,
/// the original extent will fit within the new extent. This ensures that everything
/// you wanted to see in the first extent is visible and maybe a bit more.
///
/// This function takes a height and width in screen coordinates, then
/// looks at a world extent passed, and returns an adjusted world rectangle
/// so that the ratio to height and width in screen and world coordinates match.
/// </remarks>
/// <param name="worldExtent">This parameter is the world extent you want to adjust for drawing.</param>
/// <param name="screenWidth">This parameter is the width of the screen.</param>
/// <param name="screenHeight">This parameter is the height of the screen.</param>
This method returns an adjusted extent based on the ratio of the screen width and
height.
This method returns an adjusted extent based on the ratio of the screen width and height .
public static RectangleShape GetDrawingExtent(RectangleShape worldExtent, float screenWidth, float screenHeight)
        {
            ValidatorHelper.CheckObjectIsNotNull(worldExtent, "worldExtent");
            ValidatorHelper.CheckShapeIsValidForOperation(worldExtent);
            ValidatorHelper.CheckInputValueIsLargerThan(screenWidth, "screenWidth", 0, RangeCheckingInclusion.ExcludeValue);
            ValidatorHelper.CheckInputValueIsLargerThan(screenHeight, "screenHeight", 0, RangeCheckingInclusion.ExcludeValue);
            return ExtentHelper.GetDrawingExtent(worldExtent, screenWidth, screenHeight);
        }
public static RectangleShape GetDrawingExtent ( RectangleShape worldExtent , float screenWidth , float screenHeight ) { ValidatorHelper . CheckObjectIsNotNull ( worldExtent , " " ) ; ValidatorHelper . CheckShapeIsValidForOperation ( worldExtent ) ; ValidatorHelper . CheckInputValueIsLargerThan ( screenWidth , " " , 0 , RangeCheckingInclusion . ExcludeValue ) ; ValidatorHelper . CheckInputValueIsLargerThan ( screenHeight , " " , 0 , RangeCheckingInclusion . ExcludeValue ) ; return ExtentHelper . GetDrawingExtent ( worldExtent , screenWidth , screenHeight ) ; }
This method returns an adjusted extent based on the ratio of the screen width and
height.
This method returns an adjusted extent based on the ratio of the screen width and height .
This method returns an adjusted extent based on the ratio of the screen width and
height.
This method returns an adjusted extent based on the ratio of the screen width and height .
worldExtent
RectangleShape
This parameter is the world extent you want to adjust for drawing.
This parameter is the world extent you want to adjust for drawing .
screenWidth
float
This parameter is the width of the screen.
This parameter is the width of the screen .
screenHeight
float
This parameter is the height of the screen.
This parameter is the height of the screen .
remarks
This function is used because the extent to draw must be the rame ratio as the screen
width and height. If they are not, then the image drawn will be stretched or compressed.
We always adjust the extent upwards to ensure that no matter how we adjust it,
the original extent will fit within the new extent. This ensures that everything
you wanted to see in the first extent is visible and maybe a bit more.

This function takes a height and width in screen coordinates, then
looks at a world extent passed, and returns an adjusted world rectangle
so that the ratio to height and width in screen and world coordinates match.
This function is used because the extent to draw must be the rame ratio as the screen width and height . If they are not then the image drawn will be stretched or compressed . We always adjust the extent upwards to ensure that no matter how we adjust it the original extent will fit within the new extent . This ensures that everything you wanted to see in the first extent is visible and maybe a bit more . This function takes a height and width in screen coordinates then looks at a world extent passed and returns an adjusted world rectangle so that the ratio to height and width in screen and world coordinates match .