MapWindow Home
Search MapWindow.org


  • Home
    • Download
    • Why MW
    • FAQ
    • Contact
  • Products
    • MapWindow
    • ActiveX
    • Plug-ins
  • Software Dev
    • Sample Code
    • Scripts
    • Source
    • Bugs
    • Support
    • Languages
  • Site Tools
    • Forums
    • Tutorials
    • Mailing Lists
    • Team
    • Site Stats
    • Links
  • Get Stuff
    • Buy a CD
    • Buy a T-Shirt
    • MW Book
    • ActiveX Book
    • Donate
    • Buy Support
  • Documentation
    • MWGIS App. User Guide
    • GISTools User Guide
    • MW Plug-ins Dev. Guide
    • MWGIS ActiveX Dev. Guide
    • MWGeoProc Dev. Guide

MapWinGIS:AxMap SnapShot

From MapWindow GIS

Jump to: navigation, search

SnapShot

Takes snap shot of the contents of the map within the bounds of the specified rectangle, returning an image of the results.


VB.NET Usage

Function SnapShot(BoundBox As Object) As Object

            Parameters

BoundBox

The bounds (rectangle) to get the snapshot from.
ReturnValue An image of the contents of the map displayed inside the bounds of the specified rectangle.

Sample Code

    Private Sub SnapShot()
        Dim image As New MapWinGIS.Image()
        Dim extents As MapWinGIS.Extents
        'Set extents to be the extents of the map
        extents = CType(Map1.Extents, MapWinGIS.Extents)
        'Take a picture of what is being displayed in map1 and store it in image
        image = Map1.SnapShot(extents)
    End Sub
  

VB 6 Usage
Function SnapShot(BoundBox As Object) As Object
            Parameters

BoundBox

The bounds (rectangle) to get the snapshot from.
ReturnValue An image of the contents of the map displayed inside the bounds of the specified rectangle.

Sample Code

    Private Sub take_SnapShot()
        Dim myImage As New MapWinGIS.image
        Dim myExtents As MapWinGIS.extents
        'Set extents to be the extents of the map
        Set myExtents = Map1.extents
        'Take a picture of what is being displayed in map1 and store it in image
        Set myImage = Map1.SnapShot(myExtents)
    End Sub


C# usage
Example of getting and saving map as displayed
            Parameters

none

ReturnValue true or false as received from actual image file save method

Sample Code

   /// <summary>
   /// method to get and save current image on screen
   /// </summary> 
   private bool bGetMapImage()
   {
     bool success = false;
     MapWinGIS.Image SSimage = new MapWinGIS.Image();
     // an interface (or virtual function) class must be declared and set up for call to Save() method
     MapWinGIS.ICallback cBack = new cCallBackForImageSave();
     // file name to save (will be overwritten)
     string sSSFname = "c:\\tmp\\test.bmp";
     SSimage = (MapWinGIS.Image)m_map.View.Snapshot(m_map.View.Extents);
     success = SSimage.Save(sSSFname, false, MapWinGIS.ImageType.USE_FILE_EXTENSION, cBack);
     // return value of Save() method
     return (success);
   }
Retrieved from "http://www.mapwindow.org/wiki/index.php/MapWinGIS:AxMap_SnapShot"
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in / create account
  • What links here
  • Related changes
  • Upload file
  • Special pages
  • Printable version
  • Permanent link

Geospatial Software Lab

Copyright © 2008 - MapWindow Open Source Team
( last updated: December 03 2008.)
Home | Donate | Download | MapWindow GIS Desktop | MapWinGIS.ocx | Plug-ins | Contact | Lists | Bugs | Sample Code | Documentation
Code Repository | Open Source License | Discussion Forum | Wiki | Join the Team | Site Statistics | Links