Quantcast
Viewing all articles
Browse latest Browse all 2341

New Post: Identity Tool using mapwingis and C#

Search for Axmap.CursorMode = MapWinGIS.tkCursorMode.cmSelection

This VB code use mousedownevent to point to a feature and set attributes in a textbox

If AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmSelection Then
buffer = 5 'For points and lines give a 5 pixel buffer for selecting the shapes
            With AxMap1
            .PixelToProj(e.x - buffer, e.y + buffer, TL.x, TL.y)
            .PixelToProj(e.x + buffer, e.y - buffer, BR.x, BR.y)
            ext.SetBounds(TL.x, BR.y, 0, BR.x, TL.y, 0)
                '---------------------------
                ' search shapefile
                '---------------------------
                If .get_Shapefile(hchapt).SelectShapes(ext, 0.0, MapWinGIS.SelectMode.INTERSECTION, shapes) Then ' select object
                    shpf = .get_Shapefile(hchapt)
                    shpf.SelectNone() ' suppression des shapes précédemment saisies
                    shap = shpf.Shape(0)
                    shpf.ShapeSelected(shapes(0)) = True
                    Tb.Text = shpf.CellValue(fcode_ch1, shapes(0))
                    TbX.Text = shap.Point(0).x.ToString
                    TbY.Text = shap.Point(0).y.ToString
                    AxMap1.Redraw()

Viewing all articles
Browse latest Browse all 2341

Trending Articles