QueryFeatures() public method

Adds features retrieved from the data source to the receiver.
public QueryFeatures ( IFeatureReceiver receiver ) : int
receiver IFeatureReceiver An object that receives features
return int
Beispiel #1
0
        private void btnOpenFeature_Click(object sender, EventArgs e)
        {

            using (var dialog = new OpenFileDialog())
            {
                dialog.Filter = "*.shp|*.shp";
                dialog.CheckFileExists = true;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    var layer = new FeatureLayer() { Alias = dialog.FileName, Visible = true };
                    var shape = new ShapeFileSpatialDataProvider {FileName = dialog.FileName};
                    shape.QueryFeatures(layer);
                    _map.AddLayer(layer);
                    SetViewBox();

                }
            }
        }
        private void Open_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog openFile = new OpenFileDialog()
                                                          {
                                                              Filter = "*.shp|*.shp",
                                                              CheckFileExists = true
                                                          };
            if (openFile.ShowDialog()==true)
            {
                MapAround.Mapping.FeatureLayer layer = new FeatureLayer() {Alias = openFile.FileName, Visible = true};

                
                MapAround.DataProviders.ShapeFileSpatialDataProvider shape = new ShapeFileSpatialDataProvider();
                shape.FileName = openFile.FileName;
                shape.QueryFeatures(layer);
                _map.AddLayer(layer);
                SetViewBox();
            }
            
        }