Exemplo n.º 1
0
 private void cmbLayer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbLayer.SelectedItem != null)
     {
         string layerName  = cmbLayer.SelectedItem.ToString();
         bool   bSetHeader = false;
         dataGridView1.Rows.Clear();
         foreach (var feat in _set.GetFeaturesForLayer(layerName))
         {
             if (!bSetHeader)
             {
                 dataGridView1.Columns.Clear();
                 foreach (var name in feat.Properties.Keys)
                 {
                     dataGridView1.Columns.Add(name.ToString(), name.ToString());
                 }
                 bSetHeader = true;
             }
             object[] values = new object[feat.Properties.Keys.Count];
             int      i      = 0;
             foreach (var name in feat.Properties.Keys)
             {
                 values[i] = feat.Properties[name];
                 i++;
             }
             dataGridView1.Rows.Add(values);
         }
     }
 }
Exemplo n.º 2
0
 private void mgLayerSelectionHandler1_SelectionMade(MgSelectionSet selectedFeatures)
 {
     if (Array.IndexOf(selectedFeatures.LayerNames, "Parcels") >= 0)
     {
         MgFeature[] features = selectedFeatures.GetFeaturesForLayer("Parcels");
         MessageBox.Show(features.Length + " parcels selected");
     }
 }