Skip to content

Layer position #8

@jirigcs

Description

@jirigcs

I've posted this issue on codeplex which might be abandoned... My apologies for creating redundant posts.

I'm experiencing strange positioning of shapefiles when adding them into MapWinGIS (AxMap) component: When adding the point shapefile, the new one is added below the previous one but the position number (get_LayerPosition) of the newly added layer is higher then position number of the previous one. When adding polyline or polygon shapefile, everything seems to work properly (new layers overlay the older ones, position number increases). Am I doing something wrong or is there some reason for such behavior?

Thank you,
Jiri

Here is my code snippet for adding new layer:

Private Sub tsmiAddLyr_Click(sender As Object, e As EventArgs) Handles tsmiAddLyr.Click
    OpenFileDialog1.Filter = "Shapefiles (*.shp)|*.shp"
    OpenFileDialog1.FileName = ""
    If OpenFileDialog1.ShowDialog = DialogResult.OK Then
        Dim sf = New Shapefile()
        If Not sf.Open(OpenFileDialog1.FileName) Then
            MessageBox.Show("Failed to open shapefile: " + sf.ErrorMsg(sf.LastErrorCode))
        Else
            Dim layerHandle As Integer = AxMap1.AddLayer(sf, True)
            Dim it As New ListViewItem(AxMap1.get_LayerPosition(layerHandle))
            it.SubItems.Add(AxMap1.get_LayerName(layerHandle))
            it.SubItems.Add(layerHandle)
            it.SubItems.Add(0)
            it.Checked = True
            lvLegend.Items.Add(it)

        End If
    End If
End Sub

Visual Studio 2015, MapWinGIS 4.9.4.2 Win32

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions