This project is read-only.

How to add layers to a group in the most simple way

Jan 11, 2014 at 4:36 PM
I have some layers and want to group them and i have done it before but that code looks very complex to me....

this is what i have
 'new map group added to map
            Dim grp As New MapGroup(Form1.myVenster, "GROUP geluidbelastingen")
            'layer met geluidbelastingen GPP
            'Dim layer As IMapLayer = Form1.myVenster.Layers.Add(fsAdresLden)
            Dim player As IMapLayer = grp.Layers.Add(fsAdresLden)
            Dim slayer As IMapLayer = grp.Layers.Add(fsAdresLden)
            Dim zlayer As IMapLayer = grp.Layers.Add(fsAdresLden)
            Dim elayer As IMapLayer = grp.Layers.Add(fsAdresLden)
            Dim pPointMapLayer As IMapFeatureLayer
            Dim sPointMapLayer As IMapFeatureLayer
            Dim zPointMapLayer As IMapFeatureLayer
            Dim ePointMapLayer As IMapFeatureLayer
            If player IsNot Nothing Then
                If player.ProjectionString Is Nothing Then
                    player.Projection = DefineProjection()
                End If
                fsAdresLden = TryCast(player.DataSet, IFeatureSet)
                pPointMapLayer = TryCast(player, IMapFeatureLayer)
                Dim Ldenveld As String = "[GPP]"
                pPointMapLayer.Symbology = SetWegGeluidbelastingSwungLegend(fsAdresLden, Ldenveld)
                pPointMapLayer.LegendText = "Lden GPP"
                sPointMapLayer = TryCast(slayer, IMapFeatureLayer)
                Ldenveld = "[TkSAK]"
                sPointMapLayer.Symbology = SetWegGeluidbelastingSwungLegend(fsAdresLden, Ldenveld)
                sPointMapLayer.LegendText = "Lden standaard akoestische kwaliteit"
                zPointMapLayer = TryCast(zlayer, IMapFeatureLayer)
                Ldenveld = "[TkZm]"
                zPointMapLayer.Symbology = SetWegGeluidbelastingSwungLegend(fsAdresLden, Ldenveld)
                zPointMapLayer.LegendText = "Lden plan zonder maatregelen"
                ePointMapLayer = TryCast(elayer, IMapFeatureLayer)
                Ldenveld = "[TkEin]"
                ePointMapLayer.Symbology = SetWegGeluidbelastingSwungLegend(fsAdresLden, Ldenveld)
                ePointMapLayer.LegendText = "Lden plan met maatregelen"
                Form1.myVenster.ZoomToMaxExtent()
                Return
                fsAdresLden = Nothing
but when i have such code like below how do i add that new layer yto to a certain group? like

'new map group added to map
        Dim Clustergrp As New MapGroup(Form1.myVenster, "GROUP clustervlakken")
Dim fBuffer As New Feature()
                        Dim fs As New FeatureSet(fBuffer.FeatureType)
                        Dim g As IGeometry = GeometryFactory.Default.CreateLineString(coord)
                        g = g.Buffer(70)
                        g = g.Buffer(-50)
                        fs.Features.Add(g)