MapWinGIS:SampleCode-VB Net:MultipleImage

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

Multiple Image Types for a Point Shapefile

     ' sf is a global shapefile variable
     ' layer is a global integer variable
      <summary>
      This function will plot different images on the map for the same shapefile by
      establishing an image list using AxMap1.set_UDPointImageListAdd and then
      setting the shapes to use the list using a point type called 
      MapWinGIS.tkPointType.ptImageList and then specifying which image to use with
      AxMap1.set_ShapePointImageList
      </summary>
     Private Sub cmdAddPoints_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddPoints.Click
         Dim result As Boolean
         Dim shp, type, I As Integer
         Dim Images(3) As MapWinGIS.Image
         Dim PointShapeFile As String
 
         'Load a point shapefile into memory 
         PointShapefile = "C:\Documents and Settings\Ted\My Documents\Fundamentals\Week 3\Lab3\DataVisualization\LIGHTS.SHP"
         sf = New MapWinGIS.Shapefile
         result = sf.Open(PointShapeFile)
         If result = False Then
             MessageBox.Show(sf.ErrorMsg(sf.LastErrorCode))
         End If
         layer = AxMap1.AddLayer(sf, True)
         AxMap1.ZoomToLayer(layer)
 
 
         ' Create an array of MapWinGIS Image objects to load the images from files
         For I = 0 To 3
             Images(I) = New MapWinGIS.Image
         Next
         Images(0).Open("C:\Dev\Unpublished\taudem\Tester\Graphics\North.bmp", MapWinGIS.ImageType.USE_FILE_EXTENSION)
         Images(1).Open("C:\Dev\Unpublished\taudem\Tester\Graphics\East.bmp", MapWinGIS.ImageType.USE_FILE_EXTENSION)
         Images(2).Open("C:\Dev\Unpublished\taudem\Tester\Graphics\South.bmp", MapWinGIS.ImageType.USE_FILE_EXTENSION)
         Images(3).Open("C:\Dev\Unpublished\taudem\Tester\Graphics\West.bmp", MapWinGIS.ImageType.USE_FILE_EXTENSION)
         For I = 0 To 3
             AxMap1.set_UDPointImageListAdd(layer, Images(I))
         Next
 
         ' Assign images from image list to points
         For shp = 0 To sf.NumShapes - 1
             AxMap1.set_ShapePointType(layer, shp, MapWinGIS.tkPointType.ptImageList)
             type = shp Mod 4 'simply assign each of the four images over and over again
             AxMap1.set_ShapePointImageListID(layer, shp, type)
         Next
 
         '  Later, if you needed to determine which images were in the list:
         For I = 0 To AxMap1.get_UDPointImageListCount(layer) - 1
             Images(I) = AxMap1.get_UDPointImageListItem(layer, I)
         Next
     End Sub

Code posted by Shade1974 on Sept. 24, 2006

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:SampleCode-VB_Net:MultipleImage"

This page has been accessed 2,864 times. This page was last modified on 24 September 2006, at 18:12.