Page 1 of 1

isinside is always false

Posted: Wed May 28, 2008 4:40 pm
by devprog_nc
Hi,

Here is my code :

=====================

public frm_load...

Code: Select all

zone_parc_forestier = New GpsShapeNET.ShapeFile
zone_parc_forestier.Open("C:\Documents and Settings\Utilisateur\Mes documents\shapes\test_ozi.shp", GpsShapeNET.FileMode.FILE_READ)

        If zone_parc_forestier.DatumGridTemplate Is Nothing Then

            Dim Xmin, Xmax, Ymin, Ymax, Zmin, Zmax, Mmin, Mmax As Double
            zone_parc_forestier.GetBoundingBox(Xmin, Xmax, Ymin, Ymax, Zmin, Zmax, Mmin, Mmax)
            Dim nodePosition As GpsToolsNET.Position = New GpsToolsNET.Position
            If (Ymax <= 90 And Ymin >= -90 And Xmax <= 180 And Xmin >= -180) Then
                nodePosition.Datum = GpsToolsNET.Datum.WGS_84
            Else
                nodePosition.Grid = GpsToolsNET.Grid.UTM_SOUTH
                nodePosition.Zone = "58"
            End If
            zone_parc_forestier.DatumGridTemplate = nodePosition
        End If

        Dim mf As GpsViewNET.MapShapeFile
        mf = Map1.NewMapShapeFile(zone_parc_forestier)

        mf.Resolution = 2.0
        mf.Background.Transparent = True
        mf.Border.Red = 255

        
        Dim brush As GpsViewNET.Brush = New GpsViewNET.Brush
        brush.Green = 128
        brush.Transparent = False
        mf.Background = brush
        Map1.Update()
end sub

==================

Private Sub map1_OnMouseDown(ByVal Button As System.Windows.Forms.MouseButtons, ByVal Shift As Short, ByVal objPosition As GpsToolsNET.Position, ByVal objPoint As GpsViewNET.Point) Handles Map1.OnMouseDown

        If objPosition Is Nothing Then
            lClickedPosition.Text = "Invalid position"
            Exit Sub
        End If

        Dim dedans2 As Boolean = False
        Dim objet As GpsShapeNET.Shape
        objet = New GpsShapeNET.Shape

        Dim nodeDatumGrid As GpsToolsNET.Position = New GpsToolsNET.Position()
        nodeDatumGrid.Datum = GpsToolsNET.Datum.WGS_84
        objet.DatumGridTemplate = nodeDatumGrid
        
        dedans2 = objet.IsInside(objPosition)
        Label5.Text = dedans2.ToString

END SUB
=========================

When I click on my shape, I always have dedans2=False

I think I make a mistake or forget something.
I do not understand.

Thank you for help me.

Pascal
New Caledonia

RE: isinside is always false

Posted: Wed May 28, 2008 4:49 pm
by johan
You can read about the Shape class here:
http://franson.com/gpstools/reference_manual.asp?comp=shape&class=Shape&platform=net

You have not added any nodes to your shape.

Regards,
Johan

Franson Support

RE: isinside is always false

Posted: Thu May 29, 2008 4:15 pm
by devprog_nc
Thank you.

I read this link but I do not how to begin with nodes ?

I'm looking for a little example how to use node.

Thank you

RE: isinside is always false

Posted: Thu May 29, 2008 4:20 pm
by Jonas
Look at Shape.NewNode.
It's pretty basic.

Regards,
Jonas

RE: isinside is always false

Posted: Fri May 30, 2008 4:21 pm
by devprog_nc
Maybe, I do not correctly understand shape, node and parts.

With a triangle, do I consider each summit as a node ?

SOrry for these questions, but I need to use it in order to understand how to use it.

Thank You