MapSuiteGisEditor/GisEditorPluginCore/Shares/Extensions/GisEditorWpfMapExtension.cs
/// <summary>
/// This method returns a bitmap of all the layers on the map.
/// </summary>
/// <param name="newScreenWidth">A float value indicates the screen width for the bitmap.</param>
/// <param name="newScreenHeight">A float value indicates the screen height for the bitmap.</param>
/// <param name="mapResizeMode">A mode that to define how to calculate the new next by the passed screen width/height.</param>
/// <returns>A bitmap that is rendered by current layers on the map.</returns>
This method returns a bitmap of all the layers on the map.
This method returns a bitmap of all the layers on the map .
public static System.Drawing.Bitmap GetBitmap(this GisEditorWpfMap map, int newScreenWidth, int newScreenHeight, MapResizeMode mapResizeMode)
        {
            double currentResovl = map.CurrentResolution;
            double newWorldWidth = currentResovl * (double)newScreenWidth;
            double newWorldHeight = currentResovl * (double)newScreenHeight;
            RectangleShape outputExtent = map.CurrentExtent;
            if (mapResizeMode == MapResizeMode.PreserveScale)
            {
                PointShape newUpperLeftPoint = (PointShape)map.CurrentExtent.UpperLeftPoint.CloneDeep();
                PointShape newLowerRightPoint = new PointShape(newUpperLeftPoint.X + newWorldWidth, newUpperLeftPoint.Y - newWorldHeight);
                outputExtent = new RectangleShape(newUpperLeftPoint, newLowerRightPoint);
            }
            else if (mapResizeMode == MapResizeMode.PreserveScaleAndCenter)
            {
                PointShape newCenter = map.CurrentExtent.GetCenterPoint();
                PointShape newUpperLeftPoint = new PointShape(newCenter.X - newWorldWidth * .5, newCenter.Y + newWorldHeight * .5);
                PointShape newLowerRightPoint = new PointShape(newCenter.X + newWorldWidth * .5, newCenter.Y - newWorldHeight * .5);
                outputExtent = new RectangleShape(newUpperLeftPoint, newLowerRightPoint);
            }
            return GetBitmap(map, newScreenWidth, newScreenHeight, outputExtent);
        }
public static System . Drawing . Bitmap GetBitmap ( this GisEditorWpfMap map , int newScreenWidth , int newScreenHeight , MapResizeMode mapResizeMode ) { double currentResovl = map . CurrentResolution ; double newWorldWidth = currentResovl * ( double ) newScreenWidth ; double newWorldHeight = currentResovl * ( double ) newScreenHeight ; RectangleShape outputExtent = map . CurrentExtent ; if ( mapResizeMode == MapResizeMode . PreserveScale ) { PointShape newUpperLeftPoint = ( PointShape ) map . CurrentExtent . UpperLeftPoint . CloneDeep ( ) ; PointShape newLowerRightPoint = new PointShape ( newUpperLeftPoint . X + newWorldWidth , newUpperLeftPoint . Y - newWorldHeight ) ; outputExtent = new RectangleShape ( newUpperLeftPoint , newLowerRightPoint ) ; } else if ( mapResizeMode == MapResizeMode . PreserveScaleAndCenter ) { PointShape newCenter = map . CurrentExtent . GetCenterPoint ( ) ; PointShape newUpperLeftPoint = new PointShape ( newCenter . X - newWorldWidth * .5 , newCenter . Y + newWorldHeight * .5 ) ; PointShape newLowerRightPoint = new PointShape ( newCenter . X + newWorldWidth * .5 , newCenter . Y - newWorldHeight * .5 ) ; outputExtent = new RectangleShape ( newUpperLeftPoint , newLowerRightPoint ) ; } return GetBitmap ( map , newScreenWidth , newScreenHeight , outputExtent ) ; }
This method returns a bitmap of all the layers on the map.
This method returns a bitmap of all the layers on the map .
A bitmap that is rendered by current layers on the map.
A bitmap that is rendered by current layers on the map .
GisEditorWpfMap
this
newScreenWidth
int
A float value indicates the screen width for the bitmap.
A float value indicates the screen width for the bitmap .
newScreenHeight
int
A float value indicates the screen height for the bitmap.
A float value indicates the screen height for the bitmap .
mapResizeMode
MapResizeMode
A mode that to define how to calculate the new next by the passed screen width/height.
A mode that to define how to calculate the new next by the passed screen width / height .