Exemple #1
0
        private async void Initialize()
        {
            // Create a new map to display in the map view with a streets basemap
            Map streetMap = new Map(Basemap.CreateStreets());

            // Get the path to the downloaded shapefile
            string filepath = GetShapefilePath();

            // Open the shapefile
            ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(filepath);

            // Read metadata about the shapefile and display it in the UI
            _shapefileMetadata = myShapefile.Info;

            // Create a feature layer to display the shapefile
            FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile);
            await newFeatureLayer.LoadAsync();

            // Zoom the map to the extent of the shapefile
            _myMapView.SpatialReferenceChanged += async(s, e) =>
            {
                await _myMapView.SetViewpointGeometryAsync(newFeatureLayer.FullExtent);
            };

            // Add the feature layer to the map
            streetMap.OperationalLayers.Add(newFeatureLayer);

            // Show the map in the MapView
            _myMapView.Map = streetMap;
        }
        private void initAsync()
        {
            FeatureLayer shapeFile = this.layer as FeatureLayer;

            if (shapeFile != null)
            {
                ShapefileFeatureTable myShapefile = shapeFile.FeatureTable as ShapefileFeatureTable;
                if (myShapefile != null)
                {
                    ShapefileInfo fileInfo = myShapefile.Info;
                    string        x        = "";

                    foreach (Field field in myShapefile.Fields)
                    {
                        x += field.Name;

                        x += "\n";
                    }
                    info.Text             = x;
                    InfoPanel.DataContext = fileInfo;
                    //ShapefileThumbnailImage.Source =
                    //    await Esri.ArcGISRuntime.UI.RuntimeImageExtensions.ToImageSourceAsync(fileInfo.Thumbnail);
                }
            }
        }
        private async void Initialize()
        {
            // Create a new map to display in the map view with a streets basemap
            Map streetMap = new Map(Basemap.CreateStreetsVector());

            // Get the path to the downloaded shapefile
            string filepath = GetShapefilePath();

            // Open the shapefile
            ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(filepath);

            // Read metadata about the shapefile and display it in the UI
            ShapefileInfo fileInfo = myShapefile.Info;

            InfoPanel.DataContext = fileInfo;

            // Display the shapefile thumbnail in an image control
            ShapefileThumbnailImage.Source = await Esri.ArcGISRuntime.UI.RuntimeImageExtensions.ToImageSourceAsync(fileInfo.Thumbnail);

            // Create a feature layer to display the shapefile
            FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile);
            await newFeatureLayer.LoadAsync();

            // Zoom the map to the extent of the shapefile
            MyMapView.SpatialReferenceChanged += async(s, e) =>
            {
                await MyMapView.SetViewpointGeometryAsync(newFeatureLayer.FullExtent);
            };

            // Add the feature layer to the map
            streetMap.OperationalLayers.Add(newFeatureLayer);

            // Show the map in the MapView
            MyMapView.Map = streetMap;
        }
Exemple #4
0
        private async void Initialize()
        {
            // Create a new map to display in the map view with a streets basemap.
            Map streetMap = new Map(Basemap.CreateStreetsVector());

            // Get the path to the downloaded shapefile.
            string filepath = DataManager.GetDataFolder("d98b3e5293834c5f852f13c569930caa", "TrailBikeNetwork.shp");

            try
            {
                // Open the shapefile.
                ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(filepath);

                // Read metadata about the shapefile and display it in the UI.
                _shapefileMetadata = myShapefile.Info;

                // Create a feature layer to display the shapefile.
                _featureLayer = new FeatureLayer(myShapefile);

                // Zoom the map to the extent of the shapefile.
                _myMapView.SpatialReferenceChanged += MapView_SpatialReferenceChanged;

                // Add the feature layer to the map.
                streetMap.OperationalLayers.Add(_featureLayer);

                // Show the map in the MapView.
                _myMapView.Map = streetMap;
            }
            catch (Exception e)
            {
                new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show();
            }
        }
Exemple #5
0
        private async void Initialize()
        {
            // Create a new map to display in the map view with a streets basemap.
            Map streetMap = new Map(Basemap.CreateStreetsVector());

            // Get the path to the downloaded shapefile.
            string filepath = DataManager.GetDataFolder("d98b3e5293834c5f852f13c569930caa", "TrailBikeNetwork.shp");

            // Open the shapefile.
            ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(filepath);

            // Read metadata about the shapefile and display it in the UI.
            _shapefileMetadata = myShapefile.Info;

            // Create a feature layer to display the shapefile.
            FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile);

            // Zoom the map to the extent of the shapefile.
            _myMapView.SpatialReferenceChanged += async(s, e) => { await _myMapView.SetViewpointGeometryAsync(newFeatureLayer.FullExtent); };

            // Add the feature layer to the map.
            streetMap.OperationalLayers.Add(newFeatureLayer);

            // Show the map in the MapView.
            _myMapView.Map = streetMap;
        }
Exemple #6
0
        private async void LoadThumbnail(ShapefileInfo metadata)
        {
            // Asynchronously get the thumbnail image from the metadata
            UIImage thumbnailImage = await Esri.ArcGISRuntime.UI.RuntimeImageExtensions.ToImageSourceAsync(metadata.Thumbnail);

            // Show the image in the UI
            _shapefileThumbnailImage.Image = thumbnailImage;
        }
        private async void Initialize()
        {
            // Create a new map to display in the map view with a streets basemap
            Map streetMap = new Map(Basemap.CreateStreets());

            // Get the path to the downloaded shapefile
            string filepath = GetShapefilePath();

            try
            {
                // Open the shapefile
                ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(filepath);

                // Read metadata about the shapefile and display it in the UI
                ShapefileInfo fileInfo = myShapefile.Info;
                InfoPanel.BindingContext = fileInfo;

                // Read the thumbnail image data into a byte array
                Stream imageStream = await fileInfo.Thumbnail.GetEncodedBufferAsync();

                byte[] imageData = new byte[imageStream.Length];
                imageStream.Read(imageData, 0, imageData.Length);

                // Create a new image source from the thumbnail data
                ImageSource streamImageSource = ImageSource.FromStream(() => new MemoryStream(imageData));

                // Create a new image to display the thumbnail
                Image image = new Image()
                {
                    Source = streamImageSource,
                    Margin = new Thickness(10)
                };

                // Show the thumbnail image in a UI control
                ShapefileThumbnailImage.Source = image.Source;

                // Create a feature layer to display the shapefile
                FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile);
                await newFeatureLayer.LoadAsync();

                // Zoom the map to the extent of the shapefile
                MyMapView.SpatialReferenceChanged += async(s, e) =>
                {
                    await MyMapView.SetViewpointGeometryAsync(newFeatureLayer.FullExtent);
                };

                // Add the feature layer to the map
                streetMap.OperationalLayers.Add(newFeatureLayer);

                // Show the map in the MapView
                MyMapView.Map = streetMap;
            }
            catch (Exception e)
            {
                await((Page)Parent).DisplayAlert("Error", e.ToString(), "OK");
            }
        }
 public bool TryGetShapefile(string value, out ShapefileInfo shapefileInfo)
 {
     if (this.m_cachedShapefiles != null)
     {
         return(this.m_cachedShapefiles.TryGetValue(value, out shapefileInfo));
     }
     shapefileInfo = null;
     return(false);
 }
 public void AddShapefile(string value, ShapefileInfo shapefileInfo)
 {
     this.m_metaDataChanged = true;
     if (this.m_cachedShapefiles == null)
     {
         this.m_cachedShapefiles = new Dictionary <string, ShapefileInfo>(EqualityComparers.StringComparerInstance);
     }
     this.m_cachedShapefiles.Add(value, shapefileInfo);
 }
Exemple #10
0
        private async void Initialize()
        {
            // Create a new map to display in the map view with a streets basemap
            Map streetMap = new Map(BasemapStyle.ArcGISStreets);

            // Get the path to the downloaded shapefile
            string filepath = GetShapefilePath();

            try
            {
                // Open the shapefile
                ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(filepath);

                // Read metadata about the shapefile and display it in the UI
                _shapefileMetadata = myShapefile.Info;

                // Create a feature layer to display the shapefile
                FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile);
                await newFeatureLayer.LoadAsync();

                // Zoom the map to the extent of the shapefile
                _myMapView.SpatialReferenceChanged += async(s, e) =>
                {
                    await _myMapView.SetViewpointGeometryAsync(newFeatureLayer.FullExtent);
                };

                // Add the feature layer to the map
                streetMap.OperationalLayers.Add(newFeatureLayer);

                // Show the map in the MapView
                _myMapView.Map = streetMap;
            }
            catch (Exception e)
            {
                new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show();
            }
        }
Exemple #11
0
 public MetadataDialogFragment(ShapefileInfo metadata)
 {
     _metadata = metadata;
 }
Exemple #12
0
 public MetadataDisplayViewController(ShapefileInfo metadata) : base("MetadataDisplayViewController", null)
 {
     _metadata = metadata;
 }
Exemple #13
0
        public ShapefileMetadataDialog(CoreGraphics.CGRect frame, nfloat opacity, UIColor color, ShapefileInfo metadata) : base(frame)
        {
            // Create a semi-transparent overlay with the specified background color
            BackgroundColor = color;
            Alpha           = opacity;

            // Variables for space between controls and for control width (height will vary)
            nfloat rowSpace     = 5;
            nfloat controlWidth = Frame.Width - 20;

            // Find the center x and y of the view
            nfloat centerX = Frame.Width / 2;
            nfloat centerY = Frame.Height / 2;

            // Find the start x and y for the control layout
            nfloat controlX = centerX - (controlWidth / 2);
            nfloat controlY = 20;

            // Label for credits metadata
            UILabel creditsLabel = new UILabel(new CoreGraphics.CGRect(controlX, controlY, controlWidth, 20));

            creditsLabel.Text      = metadata.Credits;
            creditsLabel.TextColor = UIColor.Blue;

            // Adjust the Y position for the next control
            controlY = controlY + 20 + rowSpace;

            // Label for the summary metadata
            UILabel summaryLabel = new UILabel(new CoreGraphics.CGRect(controlX, controlY, controlWidth, 120));

            summaryLabel.LineBreakMode = UILineBreakMode.WordWrap;
            summaryLabel.Lines         = 0;
            summaryLabel.Text          = metadata.Summary;

            // Adjust the Y position for the next control
            controlY = controlY + 120 + rowSpace;

            // ImageView for metadata thumbnail
            _shapefileThumbnailImage = new UIImageView(new CoreGraphics.CGRect(centerX - 80, controlY, 160, 160));
            LoadThumbnail(metadata);

            // Adjust the Y position for the next control
            controlY = controlY + 160 + rowSpace;

            // Metadata tags
            UILabel tagsLabel = new UILabel(new CoreGraphics.CGRect(controlX, controlY, controlWidth, 100));

            tagsLabel.LineBreakMode = UILineBreakMode.WordWrap;
            tagsLabel.Lines         = 0;
            tagsLabel.Text          = string.Join(",", metadata.Tags);

            // Adjust the Y position for the next control
            controlY = controlY + 100 + rowSpace;

            // Button to hide the dialog
            UIButton hideButton = new UIButton(new CoreGraphics.CGRect(controlX, controlY, controlWidth, 20));

            hideButton.SetTitle("OK", UIControlState.Normal);
            hideButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            hideButton.TouchUpInside += (s, e) => { Hide(); };

            // Add the controls
            AddSubviews(creditsLabel, summaryLabel, _shapefileThumbnailImage, tagsLabel, hideButton);
        }
        public bool TryCreateObject(ObjectType objectType, out IPersistable persistObj)
        {
            switch (objectType)
            {
            case ObjectType.DataCellInstance:
                persistObj = new DataCellInstance();
                break;

            case ObjectType.DataAggregateObjResult:
                persistObj = new DataAggregateObjResult();
                break;

            case ObjectType.DataRegionMemberInstance:
                persistObj = new DataRegionMemberInstance();
                break;

            case ObjectType.DataRegionInstance:
                persistObj = new DataRegionInstance();
                break;

            case ObjectType.DataSetInstance:
                persistObj = new DataSetInstance();
                break;

            case ObjectType.ReportInstance:
                persistObj = new ReportInstance();
                break;

            case ObjectType.OnDemandMetadata:
                persistObj = new OnDemandMetadata();
                break;

            case ObjectType.GroupTreePartition:
                persistObj = new GroupTreePartition();
                break;

            case ObjectType.IntermediateFormatVersion:
                persistObj = new IntermediateFormatVersion();
                break;

            case ObjectType.ReportSnapshot:
                persistObj = new ReportSnapshot();
                break;

            case ObjectType.SubReportInstance:
                persistObj = new SubReportInstance();
                break;

            case ObjectType.Parameters:
                persistObj = new ParametersImplWrapper();
                break;

            case ObjectType.Parameter:
                persistObj = new ParameterImplWrapper();
                break;

            case ObjectType.SubReportInfo:
                persistObj = new SubReportInfo();
                break;

            case ObjectType.CommonSubReportInfo:
                persistObj = new CommonSubReportInfo();
                break;

            case ObjectType.ParameterInfo:
                persistObj = new ParameterInfo();
                break;

            case ObjectType.ParameterInfoCollection:
                persistObj = new ParameterInfoCollection();
                break;

            case ObjectType.ParametersLayout:
                persistObj = new ParametersGridLayout();
                break;

            case ObjectType.ParameterGridLayoutCellDefinition:
                persistObj = new ParameterGridLayoutCellDefinition();
                break;

            case ObjectType.ValidValue:
                persistObj = new ValidValue();
                break;

            case ObjectType.FieldInfo:
                persistObj = new FieldInfo();
                break;

            case ObjectType.ImageInfo:
                persistObj = new ImageInfo();
                break;

            case ObjectType.TreePartitionManager:
                persistObj = new TreePartitionManager();
                break;

            case ObjectType.LookupObjResult:
                persistObj = new LookupObjResult();
                break;

            case ObjectType.ShapefileInfo:
                persistObj = new ShapefileInfo();
                break;

            case ObjectType.UpdatedVariableValues:
                persistObj = new UpdatedVariableValues();
                break;

            case ObjectType.DataCellInstanceList:
                persistObj = new DataCellInstanceList();
                break;

            default:
                persistObj = null;
                return(false);
            }
            return(true);
        }
Exemple #15
0
 private async void LoadThumbnail(ShapefileInfo metadata)
 {
     // Show the image in the UI.
     _shapefileThumbnailImage.Image = await metadata.Thumbnail.ToImageSourceAsync();
 }