MapWinGIS:Tin Select

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

Select

Checks if there is a triangle in the TIN at the specified x and y coordinate. The index of any triangle at that location is returned through TriangleHint, and the z coordinate for the triangle surface at the specified location is returned through Z.


VB.NET Usage

Function Select(ByRef TriangleHint As Integer, x As Double, y As Double, ByRef Z As Double) As Boolean

            Parameters

TriangleHint

Reference parameter. The index of the triangle to start the search with. If the triangle hint is a good guess, the search can be much faster.
x The x projected map coordinate of the point that is being used to test if it lies within a TIN triangle.
y The y projected map coordinate of the point that is being used to test if it lies within a TIN triangle.
Z Reference parameter. The z projected map coordinate of the selected triangle's surface will be returned through this parameter.
ReturnValue A boolean value representing whether a triangle in the TIN contained the specifed point.

Sample Code

    Private Sub SelectTIN()
        Dim tin As New MapWinGIS.Tin()
        Dim trianglehint As Integer
        Dim x As Double, y As Double, z As Double
        Dim success As Boolean
        'Set the index of the triangle hint
        trianglehint = 0
        'Set the projected map coordinates of x and y
        x = 1422051.92226415
        y = 2093405.51962264
        'Open a TIN file
        success = tin.Open("C:\test.tin", Me)
        'See if there is a triangle at the specified x and y
        success = tin.Select(trianglehint, x, y, z)
        'Check to see if a triangle contained the point (x,y)
        If success Then
            'If there was triangle selected, display the triangle's index and the z value of its surface
            MsgBox(" trianglehint:" + Str(trianglehint) + " z:" + Str(z))
        Else
            'Display a failure message if there was not a triangle selected by the point (x,y)
            MsgBox("No triangle contained the point (x,y)")
        End If
    End Sub
  

VB 6 Usage
Function Select(ByRef TriangleHint As Long, x As Double, y As Double, ByRef Z As Double) As Boolean
            Parameters

TriangleHint

Reference parameter. The index of the triangle to start the search with. If the triangle hint is a good guess, the search can be much faster.
x The x projected map coordinate of the point that is being used to test if it lies within a TIN triangle.
y The y projected map coordinate of the point that is being used to test if it lies within a TIN triangle.
Z Reference parameter. The z projected map coordinate of the selected triangle's surface will be returned through this parameter.
ReturnValue A boolean value representing whether a triangle in the TIN contained the specifed point.

Sample Code

    Private Sub SelectTIN()
        Dim tin As New MapWinGIS.tin
        Dim trianglehint As Long
        Dim x As Double, y As Double, z As Double
        Dim success As Boolean
        'Set the index of the triangle hint
        trianglehint = 0
        'Set the projected map coordinates of x and y
        x = 1422051.92226415
        y = 2093405.51962264
        'Open a TIN file
        success = tin.Open("C:\test.tin", Me)
        'See if there is a triangle at the specified x and y
        success = tin.Select(trianglehint, x, y, z)
        'Check to see if a triangle contained the point (x,y)
        If success Then
            'If there was triangle selected, display the triangle's index and the z value of its surface
            MsgBox (" trianglehint:" + Str(trianglehint) + " z:" + Str(z))
        Else
            'Display a failure message if there was not a triangle selected by the point (x,y)
            MsgBox ("No triangle contained the point (x,y)")
        End If
    End Sub

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

This page has been accessed 1,334 times. This page was last modified on 9 November 2005, at 17:23.