An array which will return the pixels in the specified row of the image. ReturnValue A boolean value representing the success or failure of getting the row of pixels from the image. AddLayer image2, True End Sub. The type of image being opened. A boolean value representing whether the image is stored in RAM memory while open.
The default is True. The ICallback object which will receive progress and error events while the image is being opened. A boolean value representing the success or failure of opening the image. WriteWorldFile Optional. A boolean value representing whether a world file is also written. The default is false. The filetype to use to save the image. The ICallback object which will receive the progress and error messages while the image is being saved.
A boolean value representing the success or failure of saving the image. This function requires the image to be the same width and height as the bitmap selected in the device context. Parameters hDC ReturnValue The device context handle of the device context for which the selected bitmap is to be used to copy the bits into the image used to call the function.
A boolean value representing success or failure of setting the image's bits using the bitmap selected in the specified device context. Bitmap Dim newbitmap As System. Bitmap Dim color As System. Color, newcolor As System. Bitmap bitmap. Width, bitmap. Height, Drawing. FromArgb r, g, b newbitmap. CreateNew newbitmap. Width, newbitmap. Image Page 50 of Image Dim filename As String 'Open an image from disk img.
Filename End Sub. Height End Sub. ImageType End Sub. Image Dim p As stdole. ImageToPicture ImageList1. Images 0 Page 53 of Picture End Sub ' TransparencyColor End Sub. Image 'Check if the transparency color is being used when the image is displayed If image. UseTransparencyColor Then 'Set the image not to use the transparency color image. The column in the image for which the value is required.
The value of the specified pixel in the image. Value row, col End Sub. Width End Sub. XllCenter End Sub Page 55 of The map object represents a map which displays grids, images, and shapefiles. Sets whether the layer is visible after being added to the map. Returns the integer handle for the layer added to the map. Shapefile 'Open a shapefile sf.
Grid 'Open a grid grid. GridColorScheme scheme. GridToImage grid, scheme, Me 'add the image to the map Map1. Boolean value indicating the successful application when true, unsuccessful application when false. Shapefile sf. ShapefileColorBreak break.
Add break End With 'apply the coloring scheme for this layer Map1. GetColorScheme hnd End Sub. The final position of the layer being moved. MoveLayer Map1. Boolean value representing success when true, and failure when false. MoveLayerBottom Map1. Boolean value representing succes when true, and failure when false. MoveLayerDown Map1. Boolean value representing success when true, failure when false. MoveLayerTop Map1.
MoveLayerUp Map1. ScreenReferenced uses pixels in screen coordinates. SpatiallyReferenced uses projected map units. ReturnValue The handle for the new drawing layer in the map. The coloring scheme is for reference purposes only and has no effect the coloring or display of the image.
The coloring scheme to attatch to the specified image layer. GridColorBreak 'Create color break break. ReturnValue An image of the contents of the map displayed inside the bounds of the specified rectangle. SnapShot extents End Sub. ZoomToPrev End Sub. Text Color x y The text to be used for the label. The color of the added label. The x coordinate in projected map units which determines where the label will be added on the map.
The y coordinate in projected map units which determines where the label will be added on the map. NumShapes - 1 Page 61 of Shape i. The y coordinate in projected map units which determines where the label will be added on the map The number of degrees to rotate the label.
Positive angles rotate the text counter-clockwise, and negative angles rotate the text clockwise. Parameters DrawHandle Drawing handle of the drawing layer for which all drawings are to be cleared. DrawCircle , , 50, System. This method is slower than using ClearDrawing on a specific layer.
ClearDrawings End Sub. ClearLabels hndl End Sub. Center y coordinate for the circle to be drawn. Radius in pixels of the circle to be drawn. Color of the circle to be drawn. Boolean value which determines whether the circle will be drawn with a fill or not. UInt32 Parameters x1 y1 x2 y2 pixelWidth color X coordinate of the first point used to draw the line. Y coordinate of the first point used to draw the line. X coordinate of the second point used to draw the line. Y coordinate of the second point used to draw the line.
Width of the line in pixels. Color to draw the line with. DrawLine x1, y1, x2, y2, width, System. See also NewDrawing VB. UInt32 Parameters x y pixelSize color The x coordinate of the point to draw. The x coordinate of the point to draw. The size in pixels of the point to be drawn. The color of the point to be drawn.
DrawPoint x1, y1, size, System. An array containing y-coordiniates for each point in the polygon. The color to use when drawing the polygon. A boolean value representing whether the polygon is drawn with a fill or not. Name of the font to use for the labels. Ex: "Arial" Size of the font to use for the labels.
LayerFont hndl, "Arial", 18 End Sub. This is very useful if you are making a large number of changes at once and don't want the map to be redrawn between each change. The y pixel coordinate to be converted into the projected y map coordinate. The projected x map coordinate is returned through this reference parameter. The projected y map coordinate is returned through this reference parameter. MouseUpEvent 'This will draw a point where you click on the map if you have a 'spatially referenced shapefile or grid displayed on the map Dim x As Double, y As Double 'Convert pixel coordinates of mouse up event e.
PixelToProj e. DrawPoint x, y, 5, System. The projected y map coordinate to be converted into the y pixel coordinate. The pixel x coordinate is returned through this reference parameter. The pixel y coordinate is returned through this reference parameter.
IsLocked Then 'If the map is unlocked, then redraw all of the map's layers Map1. Redraw End If End Sub. RemoveAllLayers End Sub. RemoveLayer hndl End Sub. Size object. Width and height can be accessed by using mySize. Width or mySize. The length of time to display the tooltip message measured in milliseconds. UpdateImage hndl End Sub. ZoomIn 0. ZoomOut 0. ZoomToLayer hndl End Sub. Note: Layers which are not visible are still used to compute maximum extents.
Note: Layers which are not visible are not used to compute maximum extents. ZoomToShape hndl, 0 End Sub. When using VB. NET the color is represented as a System. Color object. BackColor 'Set the backcolor of the map Map1. Beige End Sub. The cursor mode determines how the map handles mouse click events on the map. The only mode not handled by the map is cmNone. Object, ByVal e As System.
Tag 'Select the right cursor mode to switch to Select Case tag Case "Arrow" 'Set cursor mode to cmNone where clicks on map have no effect on the map view Map1.
Double buffering uses a little more memory, but allows the view to be smoother with less flickering. DoubleBuffer Then 'Display message telling user that double buffering is being turned off MsgBox "Double buffering is on, turning it off. The drawing key string for the specified drawing layer. Padding makes it so that there is a small border around the layer when you zoom to it.
ExtentPad If Map1. If the given extents do not fit the aspect ratio of the map, the map will fit the given extents as well as possible. SnapShot extents 'Remove all layers in the map Map1. The standard view width for the specified layer is returned through this parameter. The object could be a Shapefile, Grid, or Image object. ToString obj. The grid filename to be associated with the specified layer.
The grid filename associated with the specified layer. The percentage of transparency for the specified image layer. Returns -1 if there is no layer at the specified position. Parameters LayerPosition ReturnValue The position of the layer for which the layer handle is required. The layer handle for the layer at the specified position. This string can be used to store any string data desired by the developer.
The layer key for the specified layer in string format. The offset is the distance in pixels from the label point to the text. The offset for the labels on the specified layer. A boolean value representing whether or not to scale the labels on the specified layer.
LayerHandle The handle of the layer for which the use of label shadows is to be set. ReturnValue A boolean value representing whether or not label shadows are being used for the specified layer. This is a System. UInt32 representation of an RGB color. Color LayerHandle The layer handle of the layer for which the shadow color is to be set.
ReturnValue The color to use as the shadow color of the specified layer. R, color. G, color. B End Sub. A boolean value which determines whether the specified layer's labels are visible or not. Gets or sets the name of the specified layer. The layer name for the specified layer.
The layer position of the specified layer in the map. A boolean value representing whether the layer is to be visible or not. MapCursor 'Set the current map cursor Map1. This includes layer information and coloring schemes. MapState 'Remove all layers from the map Map1. RemoveAllLayers 'Redraw the view of the map to show the layers have been removed Map1.
NumLayers End Sub. Parameters ReturnValue A boolean value representing whether the map sends mouse up events. This property may be left unset. Page 84 of The new standard view width for the specified layer.
Only works on polygon shapefiles. Handle of the shape for which the fill is to be set. Sets whether the shape is drawn with a fill or not. Handle of the shape to test if it is being drawn with a fill or not. Return Value Gets whether the shape is being drawn with a fill or not.
Handle of the shape for which the lines are to be set. Sets whether the shape is drawn with lines or not. Handle of the shape to test if it is being drawn with lines or not.
Gets whether the layer is being drawn with lines or not. Handle of the shape for which the points are to be set.
Sets whether the shape is drawn with points or not. Handle of the shape to test if it is being drawn with points or not. Gets whether the shape is being drawn with points or not. UInt32 Page 86 of Parameters LayerHandle Handle of the layer containing the shape for which the fill color is to be set. Shape param0 Handle for the shape for which the fill color is to be set.
Fill color for the shape in the polygon shapefile. Parameters Handle of the layer containing the shape for which the fill color is required. Handle for the shape for which the fill color is required. UInt32 Dim col2 As System. Handle of the shape for which the fill stipple is to be set. Sets fill stipple for the specified shape. Handle of the shape for which the fill stipple is required. Gets the fill stipple for the specified shape.
Gets or sets the percentage of fill trancparency for the specified layer. Handle of the shape for which the fill transparency is to be set. Sets the percentage of fill transparency for the specified shape.
Handle of the shape for which the fill transparency is required. Gets the percentage of fill transparency for the specified shape. Sets whether the layer is drawn with a fill or not. Gets whether the layer is being drawn with a fill or not. Gets or sets whether the lines for the shapefile in specified layer are drawn.
Sets whether the layer is drawn with lines or not. Sets whether the layer is drawn with points or not. Gets whether the layer is being drawn with points or not.
Parameters Handle of the layer for which the fill color is required. Fill color for the polygon shapefile. See also tkFillStipple VB. Sets fill stipple for the specified layer. Gets the fill stipple for the specified layer.
Sets the percentage of fill transparency for the specified layer. Gets the percentage of fill transparency for the specified layer. Only works on shapefiles. Line color for the polygon shapefile. Gets or sets the line stipple for the specified layer.
See also tkLineStipple VB. Line stipple for the shapefile. Suggested values for line width: 1 - 5 VB. Line width for the shapefile. Point color for the polygon shapefile.
Gets or sets the line point type for the specified layer. See also tkPointType VB. Point type for the shapefile. UInt32 Parameters LayerHandle Handle of the layer containing the shape for which the line color is to be set. Shape param0 Handle of the shape for which the line color is to be set. Line color for the shape in the polygon shapefile.
Handle of the shape for which the line color is required. Handle of the shape for which the line stipple is to be set. Line stipple for the shape in the shapefile.
Handle of the shape for which the line stipple is required. Handle of the shape for which the line width is to be set. Line width for the shape in the shapefile. Handle of the shape for which the line width is required.
Page 95 of UInt32 Parameters LayerHandle Handle of the layer containing the shape for which the point color is to be set. Shape param0 Handle of the shape for which the point color is to be set. Point color for the shape in the polygon shapefile. Handle of the shape for which the point color is required. The specific shape to be assigned a value in the layer. The index of the image in the imagelist that you want to assign to the specified shape.
The specific shape in the layer that you wish to determine the image index for The index in the image list of user defined images. EventArgs Handles cmdAddPoints. Click Page 96 of Show sf. ErrorMsg sf. AddLayer sf, True AxMap1. Image Next Images 0. NumShapes - 1 AxMap1. Handle of the shape for which the point type is to be set.
Point type for the shape in the shapefile. Handle of the shape for which the point type is required. Handle of the shape for which the visibility is to be set. Boolean value representing whether the shape is to be visible or not. Handle of the shape for which the visibility is required.
Boolean value representing whether the the shape is visible or not. The handle is a windows cursor handle. GetType, "Cursor. ToInt32 End Sub.
The user defined fill stipple contains 32 rows of 32 bits. The stipple is created by setting patterns in the bits contained in each row. StippleRow param0 The row in the custom stipple for which the pattern is to be set.
The custom fill stipple as an integer value where the stipple is defined by arranging the 32 bits in the desired pattern.
StippleRow ReturnValue The row in the custom stipple for which the pattern is to be returned. The user defined line stipple is represented by an Integer VB. The first digit represents the stipple multiplier. Each of the following digits alternate between representing pixels drawn and pixels skipped in the pattern.
The number of pixels to be drawn or skipped are determined by multiplying the digit representing that segment of the stipple by the stipple multiplier. The largest valid line stipple is Any value greater than this will result in overflow.
A line stipple value less than will result in a solid line. The user defined line stipple. The new image object to be added to the list being used for the specified layer. The Integer index for the image to retrieve The image object which is used as the point image for the specified layer. ReturnValue The Count of images currently stored in the image index of custom point types for that layer. Remember to subtract 1 from this count when indexing the 0 based image list.
The image object to be used as the point image for the specified layer. The image object which is used as the point image for the specified layer. ZoomIn Map1. ZoomPercent End Sub. EventArgs Parameters Sender e The sender of the event.
There are no event arguments accessible through this parameter for this event. EventArgs Handles Map1. Extents 'Get the minimum and maximum values of x and y that define the map extents extents. GetBounds xmin, ymin, zmin, xmax, ymax, zmax 'Display a message box that tells the user the size of the extents for the map view MsgBox "New extents. The filename of the file dropped on the map. FileDropped 'If a shapefile is dropped on the map then load it AddShapefile e.
The event will be called once per layer until all layers in the MapState string are loaded. Parameters LayerHandle Handle of the layer. The map property SendMouseDown must be set to True for this event to be fired. The button pressed on the mouse to create this event.
The x coordinate of this event in pixel coordinates. The y coordinate of this event in pixel coordinates. MouseDownEvent 'This will draw a point where you click on the map if you have a 'spatially referenced shapefile or grid displayed on the map Dim x As Double, y As Double 'Convert pixel coordinates of mouse up event e.
The map property SendMoveMouse must be set to True for this event to be fired. The map property SendMouseUp must be set to True for this event to be fired. The bottom boundary of the selection box in pixel coordinates. The left boundary of the selection box in pixel coordinates. The right boundary of the selection box in pixel coordinates. The top boundary of the selection box in pixel coordinates.
Color 'Check if the map is in selection mode If Map1. SetBounds pxMin, pyMin, 0, pxMax, pyMax, 0 'Check if there are any shapes with in the shapefile that intersect with the selection box If sf.
R, col. G, col. Shapes created by adding point objects to the shape. Parameters ReturnValue The integer error code for the last error generated in the object. Measures only apply to shapefiles with measure data. M End Sub. Z End Sub The z value of the point. A boolean value representing the success or failure of creating the new shape. The input string should be in the serialized string format as produced by the function SerializeToString. A boolean value representing the success or failure of loading the shape.
Show "No readable shapes could be found in the strings. ShapeType If System. StartEditingShapes sf. Field field. EditCellValue fld, indx, start Page of If ShowError s.
ErrorMsg s. StopEditingTable sf. StopEditingShapes 'This should effectively save the shapefile sf. YesNo, MessageBoxIcon. EventArgs Handles Button1. Click CopyShapes MessageBox. Show "Done. A boolean value representing the success or failure of deleting the part.
DeletePart 0 End Sub. A boolean value representing the success or failure of deleting the point in the shape. Parts are used to create polygons with holes. Parts with points ordered in a clockwise direction are filled.
Parts with points ordered in a counter-clockwise direction are cut out. Only clockwise parts should be used to define the outer-most regions of a shape. The part index desired.
This value may be modified if it is not possible to use the desired part index. ReturnValue A boolean value representing the success or failure of inserting the part into the shape. Refrence parameter. The index where the point will be placed if possible.
If the desired index cannot be used, the actual index will be returned. ReturnValue A boolean value representing the success or failure of inserting the point into the shape. InsertPoint point, pointindex End Sub.
The string will be in the serialized string format and can be reloaded with CreateFromString. Extents Parameters ReturnValue The extents of the shape. Extents End Sub. Region "ICallback Members" Page of A polygon shape may have several parts. An example of this would be a doughnut shape. The outermost perimeter would be one part, and the hole cut out of the center making up the innermost perimeter would be the second part.
The outermost perimeter would be specified by a series of points arranged in clockwise order, meaning that this part will be filled. The innermost perimeter would be specified by a series of points arranged in counter-clockwise order, meaning that this part will not be filled. NumParts End Sub. The index of the first point in the specified part. Part 0 End Sub.
The specified point in the shape. Point 'Set the point x and y values point. Point 1 End Sub. Gets or sets the type of the shape. See also ShpfileType VB. This shapefile type must match the type of any shapefile the shape is added to. ShpfileType 'Set the type of the shape shape. ShapeType End Sub. To create a shape network from a polyline shapefile, first choose an outlet shape from the shapes in the shapefile.
Next, choose an outlet point within the specified outlet shape. Finally, you need to select a tolerance value. The tolerance is used to determine whether to include a shape in the shape network if it is not connected to the network. Using this starting criteria, a shape network can be created from the polyline shapefile. This shapefile can be used to create a shape network because it is a polyline shapefile. Before the shape network can be created, we must choose the outlet shape and outlet point for the shape network.
Figure 2: The outlet shape and outlet point for the shape network:. In this shapefile, the outlet shape and outlet point have been selected as shown above in Figure 2.
Now we are ready to create a shape network. When a shape network is created from this shapefile, we may get different networks, depending on our chosen tolerance value. Given a tolerance value of Tolerance A Figure 3 , the upper branch of the shapefile would be included in the shape network.
Page of However, given a smaller tolerance value such as Tolerance B, shown in figure 5, the upper branch would be excluded from the shape network. Figure 5: Tolerance B The tolerance value is represented by the radius of the red circle. The shapefile to be used to create the shape network. The index of the shape in the specified shapefile to be used as the outlet shape for the shape network.
The point index of the point in the specified outlet shape to be used as the outlet point for the shape network. The tolerance used to find disconnected segments to merge into the network. The ambiguity resolution method used to resolve any ambiguity while building the shape network. Distance to outlet is the only ambiguity resolution method implemented at this time. The ICallback object which will receive progress and error messages during the creation of the shape network. The success or failure of building the shape network.
If a non-zero integer is returned, the shape network build was successful. If a zero is returned, the shape network build was not successful. ReturnValue A boolean value representing the success or failure of deleting the shape from the shape network. DeleteShape 0 End Sub. MoveDown End Sub. ReturnValue A boolean value representing the success or failure of moving the current shape pointer to the specified shape.
MoveTo shapeindex End Sub. NET Usage Page of Function MoveToOutlet As Boolean Parameters ReturnValue A boolean value representing the success or failure of moving the current shape pointer to the outlet shape in the shape network.
MoveToOutlet End Sub. This is necessary because a node may have more than one upstream path. A boolean value representing the success or failure of moving the current shape pointer up in the shape network. MoveUp 1 End Sub. See also Shapefile VB. The ICallback object which will receive progress and error messages while the shape network is opened. ReturnValue A boolean value representing the success or failure of opening the shape network. ShapeNetwork 'Open the shapefile sf. A grid header to use to create the new grid.
The cell size to use in creating the D8 grid. The ICallback object which will receive progress and error messages when the grid is being created. The rasterized Grid representing the shape network. Grid Dim result As Integer 'Open a line shapefile sf.
RasterizeD8 True End Sub. The first ambiguous shape is at index 0. If there are no ambiguous shapes, AmbigShapeIndex 0 will return If AmbigShapeIndex returns -1 and the index you specified isn't 0, it means there are no more ambiguous shapes in the shape network. The shape index of the ambiguous shape. Returns -1 if there isn't an ambiguous shape at the ReturnValue specified ambiguous shape index. AmbigShapeIndex i 'Output the shape index of the ambiguous shape in the shape network Page of Shape Parameters ReturnValue The current shape object in the shape network.
CurrentShape End Sub. CurrentShapeIndex End Sub. ReturnValue The distance from the specified point in the current shape to the outlet point in the shape network. DistanceToOutlet 0 End Sub. Retrieves the error message associated with the specified error code.
Key 'Check if the map's key is "Map1" Page of The key in string format. NetworkSize End Sub. NumDirectUps End Sub. Gets the index of the parent of the current shape. If the current shape is the outlet shape in the shape network, -1 will be returned. ParentIndex End Sub. Gets the shapefile used to create the network. Shapefile Parameters ReturnValue The shapefile used to create the shape network. Shapefile End Sub. If you are making extensive use of the PointInShapefile function you should notice improved performance in your application when you call BeginPointInShapefile before calling PointInShapefile.
Shapefile Dim shapeindex As Integer 'Load all points in all shapes in the shapefile into memory sf. PointInShapefile , End Sub. Shapefile 'Open the shapefile sf. After a shapefile is created, the attribute table and shapefile are automatically in editing mode. At least one field is required in the table to be a valid shapefile.
The type of shapefile to be created. A boolean value representing the success or failure of creating the shapefile. CreateNew "test. The index of the shape for which the attribute value is to be modified.
The new value to store in the table. A boolean value representing the success or failure of editing the cell value. StartEditingTable 'Change the value of the shapefile's attribute table for field 0, shape 0 to sf. EditCellValue 0, 0, data 'Halt editing of the Table in the. StopEditingTable true End Sub.
Note: Both the shapefile and attribute table must be in editing mode for this function to succeed.. Shapefile 'Switch the shapefile into editing mode sf. StartEditingShapes 'Switch the shapefile attribute table into editing mode sf. StartEditingTable 'Clear all shapes and attribute data in the shapefile sf. EditClear End Sub. Note: The attribute table must be in editing mode to delete fields.
The ICallback object which will receive the progress and error messages while the field is being deleted. ReturnValue A boolean value representing the success or failure of deleting the field in the attribute table.
Shapefile 'Switch the shapefile attribute table into editing mode sf. StartEditingTable 'Delete field 0 in the shapefile attribute table sf. EditDeleteField 0 End Sub.
Note: Both the shapefile and the attribute table must be in editing mode to delete a shape from the shapefile. ReturnValue A boolean value representing the success or failure of deleting the shape from the shapefile. StartEditingShapes 'Delete shape 0 from the shapefile sf. EditDeleteShape 0 End Sub. Note: The shapefile attribute table must be in editing mode to insert a new field..
See also Field VB. The desired index for the new field. If the desired index is not valid, the actual index the object is placed in will be returned. The ICallback object which will receive progress and error messages while the field is being inserted into the attribute table. ReturnValue A boolean value representing the success or failure of inserting the field into the attribute table. StartEditingTable 'Insert new field into the shapefile attribute table at index 0 if available sf.
EditInsertField field, fieldindex End Sub. Note: Both the shapefile and the attribute table must be in editing mode to insert a shape. See also Shape VB. The desired shape index to place the shape into the shapefile. If this ShapeIndex desired index is invalid or unavailable, the actual index will be returned.
ReturnValue A boolean value representing the success or failure of inserting the shape into the shapefile. Shape Dim shapeindex As Integer Page of StartEditingShapes 'Insert the shape into the shapefile at index 0 if available sf. EditInsertShape shape, shapeindex End Sub. The ICallback object which will recieve the progress and error messages while the shapefile is being opened. A boolean value representing the success or failure of opening the shapefile.
Checks to see if a point lies within the specified shape. This function only applies to polygon shapefiles. The x coordinate in projected map units of the point to be tested. The ycoordinate in projected map units of the point to be tested. A boolean value representing whether the point lies within the specified shape or not. Gets the index of the first shape the specified point lies within. If there are no shapes the point lies within, -1 is returned.
Note: If you are making extensive use of this function for a shapefile, you may be able to improve the performance of your Page of This loads all of the points for all of the shapefile's shapes into memory to speed up calculating whether a point lies within a shape or not. Opening of grid datasources with explicit creation of COM object is somewhat more involved topic. See details in overview of Grid class. It may also be needed to call:. Adding of layer to the map may fail because of projection mismatch testing GlobalSettings.
It's turned off by default i. If projection mismatch testing is on and reprojection option is chosen GlobalSettings. Any initialization logic in this case should be run after layer was added to the map. The previous point is relevant only if projection of datasource is different from projection of map.
In most cases there is no difference whether to do initialization before or after adding it to the map. To make sure that map uses the same projection as the one set for datasource use:.
To update your application to a new version of MapWinGIS the following steps will be needed: 1 Install the new version of MapWinGIS from installer or register it manually with regsvr32 utility all dependent libraries must be present in the latter case ; 2 Create a new WinForms project in Visual Studio, select necessary version of. Over a course of time there were a few small changes in API like Shape. NumPoints , so perhaps a couple of batch renamings will be needed.
This will reset control's properties set in the designer, as outdated state information often becomes a source of problems. Adding control control to. NET WinForms project. SetProxy " LastErrorCode ;.
0コメント