Instances of MapAround.DataProviders.ShapeFileSpatialDataProvider provides access to the data stored in ESRI shape-file format.
Inheritance: SpatialDataProviderBase
Ejemplo n.º 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();

                }
            }
        }
Ejemplo n.º 2
0
        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();
            }
            
        }
Ejemplo n.º 3
0
        private ISpatialDataProvider createProviderInstance()
        {
            ShapeFileSpatialDataProvider provider = new ShapeFileSpatialDataProvider();

            if (_parameters == null)
            {
                throw new InvalidOperationException("Parameter values not set.");
            }

            provider.FileName = _parameters["file_name"];
            if (_parameters.ContainsKey("process_attributes"))
            {
                provider.ProcessAttributes = _parameters["process_attributes"] == "1";
            }
            if (_parameters.ContainsKey("attributes_encoding"))
            {
                provider.AttributesEncoding = System.Text.Encoding.GetEncoding(_parameters["attributes_encoding"]);
            }

            return(provider);
        }
Ejemplo n.º 4
0
        private void LayerDataSourceNeeded(object sender, MapAround.Mapping.FeatureDataSourceEventArgs e)
        {
            FeatureLayer l = sender as FeatureLayer;
            string featuresFilePath = string.Empty;
            switch (l.DataProviderRegName)
            {
              

                case "MapAround.DataProviders.ShapeFileSpatialDataProvider":
                    l.AreFeaturesAutoLoadable = true;
                    ShapeFileSpatialDataProvider shapeP = new ShapeFileSpatialDataProvider();
                    shapeP.AttributesEncoding = Encoding.UTF8;
                    shapeP.FileName = GetFeaturesFilePath(l.DataProviderParameters["file_name"]);
                    shapeP.ProcessAttributes = true;                    
                    e.Provider = shapeP;
                    break;
                default:
                    throw new Exception("Map data provider not found: \"" + l.DataProviderRegName + "\"");
            }
        }
Ejemplo n.º 5
0
        private ISpatialDataProvider createProviderInstance()
        {
            ShapeFileSpatialDataProvider provider = new ShapeFileSpatialDataProvider();
            if (_parameters == null)
                throw new InvalidOperationException("Parameter values not set.");

            provider.FileName = _parameters["file_name"];
            if (_parameters.ContainsKey("process_attributes"))
                provider.ProcessAttributes = _parameters["process_attributes"] == "1";
            if (_parameters.ContainsKey("attributes_encoding"))
                provider.AttributesEncoding = System.Text.Encoding.GetEncoding(_parameters["attributes_encoding"]);

            return provider;
        }