<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">Oi preciso mesmo de uma ajudinha (Grande)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">eu não sou programador! dou uns pontapés em VB e python, no entanto nada de especial, dado que muitas vezes perco mto tempo a tentar arranjar soluções.</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">e é isso que venho pedir</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial,
helvetica, sans-serif" size="2">estou com um problema!! estou a tentar uma aplicação simples que seja possivel adicionar ao mapa e à legenda uma layer, que consiga ver a sua tabela de atributos,que consiga alterar a sua visiblidade\invisibilidade e finalmente que possa fazer uma query e/ou calculation +-*/etc com duas ou mais layers.</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">na realidade consigo adicionar uma layer ao mapa e à legenda (mas não tenho bem a certeza que estejam interligados). assim que tento utilizar a visibilidade/invisibilidade faz as coisas ao contrário (quando a check box está "check" o layer não se vê no mapa, quando está uncheck o layer ve-ze no mapa)grrrrr.</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">e finalmente qnd tiver isto resolvido gostaria de poder criar o tal calculation.</font></div><div><font
class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">Este é o meu codigo: </font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">alguem me diga onde está errado e como corrigi-lo (será pelo amarelo...?)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">Public Class Form1</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private shapefile As New MapWinGIS.Shapefile</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Grid As New MapWinGIS.Grid</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"
size="2"> Private GridHeader As New MapWinGIS.GridHeader</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub AxMap1_MouseDownEvent(ByVal sender As System.Object, ByVal e As AxMapWinGIS._DMapEvents_MouseDownEvent) Handles AxMap1.MouseDownEvent</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><span
class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; font-size: 13px; "> </span><br></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub btnZoomout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomout.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Zoom out</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmZoomOut</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"
size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub pan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Pan.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Pan</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmPan</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub btnZoomin_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnZoomin.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Zoom in</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmZoomIn</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub btnZoomextent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomextent.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Zoom to full extent</font></div><div><font class="Apple-style-span" face="arial,
helvetica, sans-serif" size="2"> AxMap1.ZoomToMaxExtents()</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub OpenfileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenVectorToolStripMenuItem.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim openFD As New OpenFileDialog</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim hndl As Integer</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">
'initialize dialog</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> If OpenFileDialogSHP.ShowDialog(Me) = DialogResult.OK Then</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> If openFD.CheckFileExists Then</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'open the shapefile</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> shapefile.Open(OpenFileDialogSHP.FileName)</font></div><div><font
class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'add the layer to the map</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> AxMap1.AddLayer(shapefile, True)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End If</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> If (Not CheckedListBox1.Items.Contains(OpenFileDialogSHP.FileName)) Then</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"
size="2"> CheckedListBox1.Items.Add(OpenFileDialogSHP.FileName)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> <span class="Apple-style-span" style="background-color: rgb(255, 255, 0);">CheckedListBox1.SetItemChecked(hndl, True)</span></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End If</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End If</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"
size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub ZoomToLayer()</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub btnZoomtolayer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomtolayer.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim hndl As Integer</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Get handle for
layer at position 0 in map</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> hndl = AxMap1.get_LayerHandle(0)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Zoom to the layer at position 0 in the map</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> AxMap1.ZoomToLayer(hndl)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub OpenRasterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
OpenRasterToolStripMenuItem.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim grid As New MapWinGIS.Grid()</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim openFD As New OpenFileDialog</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim dresult As Windows.Forms.DialogResult</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Filters allow only shapefiles and raster files to show when Open window appears</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> openFD.Filter = grid.CdlgFilter</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">
dresult = openFD.ShowDialog()</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'open the dialog</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> If OpenFileDialogGRID.ShowDialog(Me) = DialogResult.OK Then</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'open the grid</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> grid.Open("")</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'Close the grid</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">
grid.Close()</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End If</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub btnselect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnselect.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> 'select tool</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> AxMap1.CursorMode =
MapWinGIS.tkCursorMode.cmSelection</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub btnShowDataGrid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowDataGrid.Click</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim sfWorld As New MapWinGIS.Shapefile</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim hndsfWorld As Integer = AxMap1.NumLayers - 1 ' this is the handle of the layer you want to work
with</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> ' get the shapefile object from the layer handle,</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> ' it would be better to pass the handle instead of the shapefile</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> sfWorld = AxMap1.get_GetObject(hndsfWorld)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim myTableForm As New Formtable(sfWorld)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> myTableForm.ShowDialog()</font></div><div><font
class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> <span class="Apple-style-span" style="background-color: rgb(255, 255, 0);"> Private Sub CheckedListBox1_ItemCheck(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck</span></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2" style="background-color: rgb(255, 255, 0);"> Dim hndl As Integer </font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2" style="background-color: rgb(255, 255, 0);">
'Get the layer handle for the layer at position 0 </font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2" style="background-color: rgb(255, 255, 0);"> hndl = AxMap1.get_LayerHandle(0)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2" style="background-color: rgb(255, 255, 0);"> 'Set the specified layer is visible or not based on the state of the Check Box Item </font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2" style="background-color: rgb(255, 255, 0);"> AxMap1.set_LayerVisible(hndl, CheckedListBox1.GetItemChecked(0))</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2" style="background-color: rgb(255, 255, 0);"> End Sub</font></div><div><font class="Apple-style-span"
face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">End Class</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2" style="background-color: rgb(0, 255, 255);">para a janela de atributos é o seguinte:</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">Public Class Formtable</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim pMyShapeFile As
New MapWinGIS.Shapefile()</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Public Sub New(ByVal myShapeFile As MapWinGIS.Shapefile)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> InitializeComponent()</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> pMyShapeFile = myShapeFile</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Private Sub FormTable_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim myDataTable As New
DataTable</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Dim myDataRow As DataRow</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> For i As Integer = 0 To pMyShapeFile.NumFields - 1</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> myDataTable.Columns.Add(pMyShapeFile.Field(i).Name)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Next i</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> For j As Integer = 0 To pMyShapeFile.NumShapes - 1</font></div><div><font class="Apple-style-span"
face="arial, helvetica, sans-serif" size="2"> myDataRow = myDataTable.NewRow</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> For k As Integer = 0 To pMyShapeFile.NumFields - 1</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> myDataRow(k) = pMyShapeFile.CellValue(k, j)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Next k</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> myDataTable.Rows.Add(myDataRow)</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> Next j</font></div><div><font
class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> DataGridView1.DataSource = myDataTable</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"> End Sub</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">End Class</font></div></div></div></body></html>