MapWinGIS:Utils ClipPolygon

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

ClipPolygon

Modifies a polygon using the specified method.
See also PolygonOperation and Shape


VB.NET Usage

Function ClipPolygon(op As MapWinGIS.PolygonOperation, SubjectPolygon As MapWinGIS.Shape, ClipPolygon As MapWinGIS.Shape) As MapWinGIS.Shape

            Parameters

op

The operation to use on the subject polygon.
SubjectPolygon The first polygon to perform the specifed polygon operation on.
ClipPolygon The second polygon to perform the specified polygon operation with.
ReturnValue The polygon shape created using the specified polygon operation.

Sample Code

    Private Sub ClipPolygon()
        Dim shape1 As New MapWinGIS.Shape(), shape2 As New MapWinGIS.Shape(), shape3 As New MapWinGIS.Shape()
        Dim utils As New MapWinGIS.Utils()
        'This assumes a function which creates the desired shape for shape1
        shape1 = CreateShape1(MapWinGIS.ShpfileType.SHP_POLYGON)
        'This assumes a function which creates the desired shape for shape1
        shape2 = CreateShape2(MapWinGIS.ShpfileType.SHP_POLYGON)
        'Create a new shape3 which will hold the result of the clip polygon operation
        shape3.Create(MapWinGIS.ShpfileType.SHP_POLYGON)
        'Create shape3 as the union of shape1 and shape2
        shape3 = utils.ClipPolygon(MapWinGIS.PolygonOperation.UNION_OPERATION, shape1, shape2)
    End Sub
  

VB 6 Usage
Function ClipPolygon(op As PolygonOperation, SubjectPolygon As Shape, ClipPolygon As Shape) As Shape
            Parameters

op

The operation to use on the subject polygon.
SubjectPolygon The first polygon to perform the specifed polygon operation on.
ClipPolygon The second polygon to perform the specified polygon operation with.
ReturnValue The polygon shape created using the specified polygon operation.

Sample Code

    Private Sub ClipPolygon()
        Dim shape1 As New MapWinGIS.shape, shape2 As New MapWinGIS.shape, shape3 As New MapWinGIS.shape
        Dim utils As New MapWinGIS.utils
        'This assumes a function which creates the desired shape for shape1
        Set shape1 = CreateShape1(MapWinGIS.ShpfileType.SHP_POLYGON)
        'This assumes a function which creates the desired shape for shape1
        Set shape2 = CreateShape2(MapWinGIS.ShpfileType.SHP_POLYGON)
        'Create a new shape3 which will hold the result of the clip polygon operation
        shape3.Create (MapWinGIS.ShpfileType.SHP_POLYGON)
        'Create shape3 as the union of shape1 and shape2
        Set shape3 = utils.ClipPolygon(MapWinGIS.PolygonOperation.UNION_OPERATION, shape1, shape2)
    End Sub

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:Utils_ClipPolygon"

This page has been accessed 2,159 times. This page was last modified on 9 November 2005, at 17:37.