Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FunctionType"/> class.
 /// This constructor is required for deserialization.
 /// </summary>
 public FunctionType()
 {
     FeatureTable.Seal();
     DiscreteTable.Seal();
     ConformanceTable.Seal();
     ExportTable.Seal();
 }
Ejemplo n.º 2
0
        public static FeatureList CreateFrom(BinaryReader reader, long beginAt)
        {
            //https://www.microsoft.com/typography/otspec/chapter2.htm
            //FeatureList table
            //Type  Name    Description
            //USHORT    FeatureCount    Number of FeatureRecords in this table
            //struct    FeatureRecord[FeatureCount]     Array of FeatureRecords-zero-based (first feature has FeatureIndex = 0)-listed alphabetically by FeatureTag
            //FeatureRecord
            //Type  Name    Description
            //Tag   FeatureTag  4-byte feature identification tag
            //Offset    Feature     Offset to Feature table-from beginning of FeatureList
            reader.BaseStream.Seek(beginAt, SeekOrigin.Begin);
            //
            FeatureList featureList  = new FeatureList();
            ushort      featureCount = reader.ReadUInt16();

            FeatureRecord[] featureRecords = new FeatureRecord[featureCount];
            for (int i = 0; i < featureCount; ++i)
            {
                //read script record
                featureRecords[i] = new FeatureRecord(
                    reader.ReadUInt32(), //feature tag
                    reader.ReadInt16()); //offset
            }
            //read each feature table
            FeatureTable[] featureTables = featureList.featureTables = new FeatureTable[featureCount];
            for (int i = 0; i < featureCount; ++i)
            {
                FeatureRecord frecord = featureRecords[i];
                (featureTables[i] = FeatureTable.CreateFrom(reader, beginAt + frecord.offset)).FeatureTag = frecord.featureTag;
            }
            return(featureList);
        }
        private async void Initialize()
        {
            // Create a new map centered on Aurora Colorado
            MyMapView.Map = new Map(BasemapType.LightGrayCanvasVector, 39.7294, -104.8319, 9);

            // Get the full path
            string geoPackagePath = GetGeoPackagePath();

            try
            {
                // Open the GeoPackage
                GeoPackage myGeoPackage = await GeoPackage.OpenAsync(geoPackagePath);

                // Read the feature tables and get the first one
                FeatureTable geoPackageTable = myGeoPackage.GeoPackageFeatureTables.FirstOrDefault();

                // Make sure a feature table was found in the package
                if (geoPackageTable == null)
                {
                    return;
                }

                // Create a layer to show the feature table
                FeatureLayer newLayer = new FeatureLayer(geoPackageTable);
                await newLayer.LoadAsync();

                // Add the feature table as a layer to the map (with default symbology)
                MyMapView.Map.OperationalLayers.Add(newLayer);
            }
            catch (Exception e)
            {
                await new MessageDialog(e.ToString(), "Error").ShowAsync();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get the neighborhood name for the new tree by running a spatial intersect
        /// </summary>
        internal static async Task <string> GetNeighborhoodForAddedFeature(FeatureTable neighborhoodsTable, MapPoint newTreePoint)
        {
            // if the webmap used in the app is not the tree dataset map, this method will not work
            if (WebmapURL != TreeDatasetWebmapUrl)
            {
                return(null);
            }

            // set the parameters for the query
            // we want only one neighborhood that intersects the geometry of the newly added tree
            var queryParams = new QueryParameters()
            {
                ReturnGeometry      = false,
                Geometry            = newTreePoint,
                SpatialRelationship = SpatialRelationship.Intersects,
            };

            try
            {
                await neighborhoodsTable.LoadAsync();

                var featureQueryResult = await neighborhoodsTable.QueryFeaturesAsync(queryParams);

                // get the first result and return it's name
                if (featureQueryResult.Count() > 0)
                {
                    return(featureQueryResult.First().Attributes[NeighborhoodNameField].ToString());
                }
            }
            catch { } // if unable to get the neighborhood, just don't populate it

            return(null);
        }
        private FeatureTable GetTable(Assembly featureTestAssembly)
        {
            var libraries          = LibraryProvider.GetAdapters(featureTestAssembly).ToArray();
            var allVersionsGrouped = libraries.Where(l => l.PackageId != null)
                                     .Select(l => this.packageCache.GetPackage(l.PackageId))
                                     .SelectMany(p => p.GetSupportedFrameworks())
                                     .SelectMany(NetFxVersionHelper.Split)
                                     .Where(NetFxVersionHelper.ShouldDisplay)
                                     .GroupBy(NetFxVersionHelper.GetDisplayName)
                                     .OrderBy(g => NetFxVersionHelper.GetDisplayOrder(g.First()))
                                     .ToList();

            var versionFeatures = allVersionsGrouped.Select(g => new Feature(g, g.Key));
            var table           = new FeatureTable(MetadataKeys.NetFxSupportTable, "Supported .NET versions", libraries, versionFeatures)
            {
                Description = "This information is based on versions included in NuGet package.",
                Scoring     = FeatureScoring.NotScored
            };

            foreach (var library in libraries)
            {
                this.FillNetVersionSupport(table, library, allVersionsGrouped);
            }

            return(table);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get all of the values in the related table to display when editing feature
        /// </summary>
        private async Task GetAvailableValues()
        {
            var queryParams = new QueryParameters()
            {
                ReturnGeometry = false,
                WhereClause    = "1=1",
            };

            try
            {
                // Query and load all related records
                var featureQueryResult = await FeatureTable.QueryFeatures(queryParams);

                var availableValues = new ObservableCollection <PopupManager>();

                foreach (ArcGISFeature result in featureQueryResult)
                {
                    if (result.LoadStatus != LoadStatus.Loaded)
                    {
                        await result.LoadAsync();
                    }
                    availableValues.Add(new PopupManager(new Popup(result, result.FeatureTable.PopupDefinition)));
                }

                // sort the list of related records based on the first display field from the popup manager
                if (availableValues.Count > 0 && availableValues.First().DisplayedFields.Count() > 0)
                {
                    OrderedAvailableValues = availableValues.OrderBy(PopupManager => PopupManager?.DisplayedFields?.First().Value);
                }
            }
            catch (Exception ex)
            {
                UserPromptMessenger.Instance.RaiseMessageValueChanged(null, ex.Message, true, ex.StackTrace);
            }
        }
Ejemplo n.º 7
0
 private string[] GetNetFxVersions(ILibrary library, FeatureTable table)
 {
     return(table.Features.Where(f => table[library, f].State == FeatureState.Success)
            .Select(f => (IGrouping <string, FrameworkName>)f.Key)
            .Select(g => VersionUtility.GetShortFrameworkName(g.First()))
            .ToArray());
 }
Ejemplo n.º 8
0
        private async void Initialize()
        {
            try
            {
                // Open the custom style file.
                _restaurantStyle = await DictionarySymbolStyle.CreateFromFileAsync(_stylxPath);

                // Create a new map with a streets basemap.
                Map map = new Map(Basemap.CreateStreets());

                // Create the restaurants layer and add it to the map.
                FeatureLayer restaurantLayer = new FeatureLayer(_restaurantUri);
                map.OperationalLayers.Add(restaurantLayer);

                // Load the feature table for the restaurants layer.
                FeatureTable restaurantTable = restaurantLayer.FeatureTable;
                await restaurantTable.LoadAsync();

                // Set the map's initial extent to that of the restaurants.
                map.InitialViewpoint = new Viewpoint(restaurantLayer.FullExtent);

                // Set the map to the map view.
                MyMapView.Map = map;

                // Apply the custom dictionary to the restaurant feature layer.
                ApplyCustomDictionary();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        private async void Initialize()
        {
            // Create the US states feature table
            _usStatesTable = new ServiceFeatureTable(_usStatesServiceUri);

            try
            {
                // Load the table
                await _usStatesTable.LoadAsync();

                // Fill the fields combo and "group by" list with fields from the table
                FieldsComboBox.ItemsSource     = _usStatesTable.Fields;
                GroupFieldsListBox.ItemsSource = _usStatesTable.Fields;

                // Set the (initially empty) collection of fields as the "order by" fields list data source
                OrderByFieldsListBox.ItemsSource = _orderByFields;

                // Fill the statistics type combo with values from the StatisticType enum
                StatTypeComboBox.ItemsSource = Enum.GetValues(typeof(StatisticType));

                // Set the (initially empty) collection of statistic definitions as the statistics list box data source
                StatFieldsListBox.ItemsSource = _statDefinitions;
            }
            catch (Exception e)
            {
                await new MessageDialog(e.ToString(), "Error").ShowAsync();
            }
        }
        private void FillNetVersionSupport(FeatureTable table, ILibrary library, IEnumerable <IGrouping <string, FrameworkName> > allVersionsGrouped)
        {
            if (library.PackageId == null)
            {
                // this is always intentional
                foreach (var versionGroup in allVersionsGrouped)
                {
                    var cell = table[library, versionGroup];
                    cell.State        = FeatureState.Skipped;
                    cell.DisplayValue = "n/a";
                }

                return;
            }

            var package   = this.packageCache.GetPackage(library.PackageId);
            var supported = package.GetSupportedFrameworks().ToArray();

            foreach (var versionGroup in allVersionsGrouped)
            {
                var cell = table[library, versionGroup];
                if (versionGroup.Any(v => VersionUtility.IsCompatible(v, supported)))
                {
                    cell.State        = FeatureState.Success;
                    cell.DisplayValue = "yes";
                }
                else
                {
                    cell.State        = FeatureState.Concern;
                    cell.DisplayValue = "no";
                }
            }
        }
Ejemplo n.º 11
0
        private static void FillNetVersionSupport(FeatureTable table, IFrameworkAdapter diFramework, IPackage package, IEnumerable <IGrouping <string, FrameworkName> > allVersionsGrouped)
        {
            if (package == null)
            {
                // this is always intentional
                foreach (var versionGroup in allVersionsGrouped)
                {
                    var cell = table[diFramework, versionGroup];
                    cell.State       = FeatureState.Skipped;
                    cell.DisplayText = "n/a";
                }

                return;
            }

            var supported = package.GetSupportedFrameworks().ToArray();

            foreach (var versionGroup in allVersionsGrouped)
            {
                var cell = table[diFramework, versionGroup];
                if (versionGroup.Any(v => VersionUtility.IsCompatible(v, supported)))
                {
                    cell.State       = FeatureState.Success;
                    cell.DisplayText = "yes";
                }
                else
                {
                    cell.State       = FeatureState.Concern;
                    cell.DisplayText = "no";
                }
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Applies edits to a table
 /// </summary>
 internal static async Task ApplyEdits(this FeatureTable featureTable)
 {
     if (featureTable is ServiceFeatureTable serviceFeatureTable)
     {
         await serviceFeatureTable.ApplyEditsAsync();
     }
 }
Ejemplo n.º 13
0
        private async void Initialize()
        {
            // Create the US states feature table
            _usStatesTable = new ServiceFeatureTable(_usStatesServiceUri);

            try
            {
                // Load the table
                await _usStatesTable.LoadAsync();

                // Fill the fields combo and "group by" list with field names from the table
                List <string> fieldNames = _usStatesTable.Fields.Select(field => field.Name).ToList();
                FieldsComboBox.ItemsSource     = fieldNames;
                GroupFieldsListBox.ItemsSource = _usStatesTable.Fields;

                // Set the (initially empty) collection of fields as the "order by" fields list data source
                OrderByFieldsListBox.ItemsSource = _orderByFields;

                // Fill the statistics type combo with values from the StatisticType enum
                StatTypeComboBox.ItemsSource = Enum.GetValues(typeof(StatisticType));

                // Set the (initially empty) collection of statistic definitions as the statistics list box data source
                StatFieldsListBox.ItemsSource = _statDefinitions;
            }
            catch (Exception e)
            {
                await((Page)Parent).DisplayAlert("Error", e.ToString(), "OK");
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProcedureType"/> class.
 /// This constructor is required for deserialization.
 /// </summary>
 public ProcedureType()
 {
     FeatureTable.Seal();
     DiscreteTable.Seal();
     ConformanceTable.Seal();
     ExportTable.Seal();
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Logic to save the edits made to a feature
        /// </summary>
        internal async Task <Feature> SaveEdits(PopupManager popupManager, FeatureTable table, ObservableCollection <DestinationRelationshipViewModel> destinationRelationships)
        {
            // feature that was edited
            var editedFeature = popupManager.Popup.GeoElement as ArcGISFeature;

            // verify that the PopupManager doesn't have any errors and prompt the user to fix errors before allowing them to save
            if (popupManager.HasValidationErrors())
            {
                UserPromptMessenger.Instance.RaiseMessageValueChanged(Properties.Resources.GetString("InvalidInput_Title"),
                                                                      Properties.Resources.GetString("InvalidInput_Message"),
                                                                      true);
                return(null);
            }

            try
            {
                // exit the PopupManager edit session
                await popupManager.FinishEditingAsync();

                // get relationship changes (if they exist) and relate them to the feature
                foreach (var destinationRelationship in destinationRelationships ?? new ObservableCollection <DestinationRelationshipViewModel>())
                {
                    if (destinationRelationship.PopupManager != null)
                    {
                        try
                        {
                            editedFeature.RelateFeature((ArcGISFeature)destinationRelationship.PopupManager.Popup.GeoElement, destinationRelationship.RelationshipInfo);
                        }
                        catch (Exception ex)
                        {
                            UserPromptMessenger.Instance.RaiseMessageValueChanged(null, ex.Message, true, ex.StackTrace);
                        }
                    }
                }

                // update feature
                await table.UpdateFeatureAsync(editedFeature);

                // apply edits to save the changes
                await editedFeature.FeatureTable.ApplyEdits();

                // refresh the attributes and geometry of the feature after saving
                // this will returna valid ObjectID
                editedFeature.Refresh();

                // re-select the feature (new features get unselected after the ObjectID is refreshed)
                if (editedFeature.Geometry != null)
                {
                    var featureLayer = table.FeatureLayer;
                    featureLayer.SelectFeature(editedFeature);
                }

                return(editedFeature);
            }
            catch (Exception ex)
            {
                UserPromptMessenger.Instance.RaiseMessageValueChanged(null, ex.Message, true, ex.StackTrace);
                return(null);
            }
        }
Ejemplo n.º 16
0
        private static void CalculateTotal(FeatureTable general, IReadOnlyCollection <FeatureTable> all)
        {
            // special case
            var totals = general.Libraries.ToDictionary(
                library => library,
                library => all.Sum(t => t.GetScore(library))
                );

            var max = all.Sum(t => t.MaxScore);

            foreach (var total in totals)
            {
                var cell    = general[total.Key, MetadataKeys.TotalFeature];
                var percent = 100 * ((double)total.Value / max);
                cell.DisplayValue = string.Format("{0:F0}%", percent);
                if (percent > 70)
                {
                    cell.State = FeatureState.Success;
                }
                else if (percent > 40)
                {
                    cell.State = FeatureState.Concern;
                }
                else
                {
                    cell.State = FeatureState.Failure;
                }
            }
        }
Ejemplo n.º 17
0
        // 관리번호로 해당Feature 객체찾기
        public async void SelectFct(string _FTR_CDE, string _FTR_IDN, FeatureLayer _featureLayer)
        {
            // 0.Feature 테이블 가져오기
            //FeatureLayer __featureLayer = _featureLayer.Clone() as FeatureLayer;
            FeatureTable _featureTable = _featureLayer.FeatureTable;



            // Create a query parameters that will be used to Query the feature table.
            QueryParameters queryParams = new QueryParameters();


            // Construct and assign the where clause that will be used to query the feature table.
            queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' ORDER BY FTR_IDN DESC";
            if (!FmsUtil.IsNull(_FTR_IDN))
            {
                queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' AND FTR_IDN like '%' ||  " + _FTR_IDN + " || '%'";
            }


            List <Feature> features;

            try
            {
                // Query the feature table.
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                features = queryResult.ToList();
            }
            catch (Exception e)
            {
                Messages.ShowErrMsgBox(e.Message);
                return;
            }

            if (features.Any())
            {
                // Create an envelope.
                EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);



                if (features.Count == 1)
                {
                    //한건인 경우 선택처리
                    ShowFctPage(features[0]);
                }
                else
                {
                    //피쳐영역 Extent 위치이동
                    foreach (Feature feature in features)
                    {
                        envBuilder.UnionOf(feature.Geometry.Extent); //복수의 피처영역 합치기
                    }
                    // Zoom to the extent of the selected feature(s).
                    await mapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
            }
        }
Ejemplo n.º 18
0
        private async void Initialize()
        {
            // Create a new map centered on Aurora Colorado.
            _myMapView.Map = new Map(BasemapType.LightGrayCanvasVector, 39.7294, -104.8319, 9);

            // Get the full path.
            string geoPackagePath = DataManager.GetDataFolder("68ec42517cdd439e81b036210483e8e7", "AuroraCO.gpkg");

            // Open the GeoPackage.
            GeoPackage geoPackage = await GeoPackage.OpenAsync(geoPackagePath);

            // Read the feature tables and get the first one.
            FeatureTable geoPackageTable = geoPackage.GeoPackageFeatureTables.FirstOrDefault();

            // Make sure a feature table was found in the package.
            if (geoPackageTable == null)
            {
                return;
            }

            // Create a layer to show the feature table.
            FeatureLayer newLayer = new FeatureLayer(geoPackageTable);
            await newLayer.LoadAsync();

            // Add the feature table as a layer to the map (with default symbology).
            _myMapView.Map.OperationalLayers.Add(newLayer);
        }
        private async void Initialize()
        {
            // Create the US states feature table
            _usStatesTable = new ServiceFeatureTable(_usStatesServiceUri);

            try
            {
                // Load the table
                await _usStatesTable.LoadAsync();

                // Get a list of field names from the table
                _fieldNames = _usStatesTable.Fields.Select(field => field.Name).ToList();

                // Create a dictionary of fields the user can select for grouping
                // The value for each is set to false initially, as nothing is selected by default
                _groupByFields = _fieldNames.ToDictionary(name => name, name => false);

                // Create a list of field options for ordering results (initially empty)
                _orderByFields = new List <OrderFieldOption>();
            }
            catch (Exception e)
            {
                new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show();
            }
        }
        public IEnumerable <FeatureTable> GetTables()
        {
            var testRuns   = this.runner.RunAllTests(typeof(BasicTests).Assembly).ToDictionary(r => new { Test = r.Method, r.FrameworkType });
            var testGroups = testRuns.Keys
                             .Select(k => k.Test)
                             .Distinct()
                             .GroupBy(m => m.DeclaringType)
                             .OrderBy(g => this.GetDisplayOrder(g.Key))
                             .ToArray();

            foreach (var group in testGroups)
            {
                var features = group.ToDictionary(m => m, this.ConvertToFeature);
                var table    = new FeatureTable(AttributeHelper.GetDisplayName(group.Key), Frameworks.List(), features.Values)
                {
                    Description = this.GetDescription(@group.Key),
                    Scoring     = AttributeHelper.GetScoring(@group.Key)
                };

                foreach (var test in group.OrderBy(this.GetDisplayOrder))
                {
                    foreach (var framework in Frameworks.List())
                    {
                        var cell = table[framework, test];
                        var run  = testRuns[new { Test = test, FrameworkType = framework.GetType() }];

                        ApplyRunResultToCell(cell, run);
                    }
                }

                yield return(table);
            }
        }
        private async void Initialize()
        {
            // Create the US states feature table.
            _usStatesTable = new ServiceFeatureTable(_usStatesServiceUri);

            try
            {
                // Load the table.
                await _usStatesTable.LoadAsync();

                // Fill the fields combo and "group by" list with field names from the table.
                _fieldNames = _usStatesTable.Fields.Select(field => field.Name).ToList();

                // Create a model that will provide statistic definition choices for the picker.
                _statsPickerModel = new StatDefinitionModel(_fieldNames.ToArray());

                // Create a list of fields the user can select for grouping.
                // Value is initially false, since no fields are selected by default.
                _groupByFields = _fieldNames.ToDictionary(name => name, name => false);
            }
            catch (Exception e)
            {
                new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show();
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IndexerType"/> class.
 /// This constructor is required for deserialization.
 /// </summary>
 public IndexerType()
 {
     FeatureTable.Seal();
     DiscreteTable.Seal();
     ConformanceTable.Seal();
     ExportTable.Seal();
 }
Ejemplo n.º 23
0
 public void CleanUp()
 {
     if (_fTab != null)
     {
         _fTab.ReleaseCursor();
         _fTab.Dispose();
         _fTab = null;
     }
 }
Ejemplo n.º 24
0
        async private Task ProcessFeatureClass(IFeatureClass fc, IQueryFilter filter)
        {
            CleanUp();
            if (fc != null)
            {
                _cursor = await fc.Search(filter);

                if (_cursor == null)
                {
                    return;
                }

                _fTab = new FeatureTable(_cursor as IFeatureCursor, fc.Fields, fc);
                _fTab.RowsAddedToTable += new RowsAddedToTableEvent(fTab_RowsAddedToTable);

                try
                {
                    await _fTab.Fill(_firstFillMaximum, _cancelTracker);
                }
                catch (System.Threading.ThreadAbortException)
                {
                    _fTab.ReleaseCursor();
                    return;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (!_fTab.hasMore ||
                    (_cancelTracker != null && !_cancelTracker.Continue && !_cancelTracker.Paused))
                {
                    _fTab.ReleaseCursor();
                    _cursor = null;
                    if (ThreadFinished != null)
                    {
                        ThreadFinished();
                    }
                }
                else
                {
                    if (Paused != null)
                    {
                        Paused();
                    }
                }
            }
            else
            {
                if (ThreadFinished != null)
                {
                    ThreadFinished();
                }
            }
        }
Ejemplo n.º 25
0
        private string GenerateTableId(FeatureTable table)
        {
            var result = table.DisplayName;

            result = Regex.Replace(result, @"\<[^>]+\>", "");
            result = Regex.Replace(result, @"(?<=\W|$)\w", m => m.Value.ToUpperInvariant());
            result = Regex.Replace(result, @"\W+", "");

            return(result);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdentifiedFeatureViewModel"/> class.
 /// </summary>
 public IdentifiedFeatureViewModel(Feature feature, FeatureTable featureTable, ConnectivityMode connectivityMode)
 {
     if (feature != null)
     {
         Feature          = feature;
         PopupManager     = new PopupManager(new Popup(feature, featureTable.PopupDefinition));
         Fields           = FieldContainer.GetFields(PopupManager);
         FeatureTable     = featureTable;
         ConnectivityMode = connectivityMode;
     }
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TupleType"/> class.
        /// </summary>
        /// <param name="entityDeclarationList">The resolved list of fields.</param>
        /// <param name="sharing">The type sharing.</param>
        /// <param name="renamedFieldTable">The list of fields to rename.</param>
        public TupleType(IList <IEntityDeclaration> entityDeclarationList, BaseNode.SharingType sharing, ISealableDictionary <IFeatureName, IFeatureInstance> renamedFieldTable)
        {
            EntityDeclarationList = entityDeclarationList;
            Sharing = sharing;

            FeatureTable.Merge(renamedFieldTable);
            FeatureTable.Seal();
            DiscreteTable.Seal();
            ConformanceTable.Seal();
            ExportTable.Seal();
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Calls delete on a feature
 /// </summary>
 internal static async Task DeleteFeature(this FeatureTable featureTable, Feature feature)
 {
     if (featureTable is ServiceFeatureTable serviceFeatureTable)
     {
         await serviceFeatureTable.DeleteFeatureAsync(feature);
     }
     else if (featureTable is GeodatabaseFeatureTable geodatabaseFeatureTable)
     {
         await geodatabaseFeatureTable.DeleteFeatureAsync(feature);
     }
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Retrieves all relationship infos for a table
 /// </summary>
 internal static IReadOnlyList <RelationshipInfo> GetRelationshipInfos(this FeatureTable featureTable)
 {
     if (featureTable is ServiceFeatureTable serviceFeatureTable)
     {
         return(serviceFeatureTable.LayerInfo.RelationshipInfos);
     }
     else if (featureTable is GeodatabaseFeatureTable geodatabaseFeatureTable)
     {
         return(geodatabaseFeatureTable.LayerInfo.RelationshipInfos);
     }
     return(null);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Retrieves a related table based on information from the relationship info
 /// </summary>
 internal static ArcGISFeatureTable GetRelatedFeatureTable(this FeatureTable featureTable, RelationshipInfo relationshipInfo)
 {
     if (featureTable is ServiceFeatureTable serviceFeatureTable)
     {
         return(serviceFeatureTable.GetRelatedTables(relationshipInfo).FirstOrDefault());
     }
     else if (featureTable is GeodatabaseFeatureTable geodatabaseFeatureTable)
     {
         return(geodatabaseFeatureTable.GetRelatedTables(relationshipInfo).FirstOrDefault());
     }
     return(null);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Calculates the data statistics for a geodatabase table.
 /// </summary>
 /// <param name="table">The geodatabase table which statistics should be gathered.</param>
 /// <param name="field">The field which statistics should be gathered.</param>
 /// <returns>The calculated data statistics.</returns>
 internal async Task<DataStatisticsResult> CalculateStatistics(FeatureTable table, FieldInfo field)
 {
     var result = new DataStatisticsResult { TableName = table.Name, AttributeName = field.Alias };
     result.Count = table.RowCount;
     var filter = new QueryFilter { WhereClause = @"1=1" };
     var features = await table.QueryAsync(filter);
     var uniqueValues = new HashSet<object>();
     foreach (var feature in features)
     {
         var attributes = feature.Attributes;
         if (attributes.ContainsKey(field.Name))
         {
             var value = attributes[field.Name];
             if (!uniqueValues.Contains(value))
             {
                 uniqueValues.Add(value);
             }
         }
     }
     result.UniqueValueCount = uniqueValues.Count;
     return result;
 }
Ejemplo n.º 32
0
            public static FeatureTable CreateFrom(BinaryReader reader, long beginAt)
            {
                reader.BaseStream.Seek(beginAt, SeekOrigin.Begin);
                //
                short featureParams = reader.ReadInt16();//null, should be 0
                ushort lookupCount = reader.ReadUInt16();

                FeatureTable featureTable = new FeatureTable();
                featureTable.lookupListIndice = Utils.ReadUInt16Array(reader, lookupCount);

                return featureTable;
            }
Ejemplo n.º 33
0
 /// <summary>
 /// Creates a new instance of the FeatureRow class.
 /// </summary>
 /// <param name="rb"></param>
 internal FeatureRow(DataRowBuilder rb)
     : base(rb)
 {
     _featureTable = ((FeatureTable)(Table));
 }
Ejemplo n.º 34
0
        // Summary:
        //     Load features in a FeatureTable into a GraphicsLayer
        //
        async Task<IS3GraphicsLayer> featureTable2GraphicsLayer(FeatureTable table,
            int start = 0, int maxFeatures = 0, bool isShp = false)
        {
            if (table == null)
                return null;

            if (_srEMap == null)
            {
                // The spatial reference in the first table is used as the project spatial reference.
                // All features on other layers will be projected to the spatial reference.
                _srEMap = table.SpatialReference;
                _map.SpatialReference = table.SpatialReference;
            }

            //// We cannot use the feature layer class because it typically 
            //// has a different SpatialReferece object (coordinate system)
            //// other than the tiled layer (WKID = 3857 or 102100),
            //// and there is no easy way to reproject feature layer
            //// to another coordinate system.
            //// We can only use the feature layer when there is no tiled layer defined,
            //// which is not a usual case.
            //FeatureLayer fLayer = new FeatureLayer(table);
            //fLayer.ID = table.Name;
            //fLayer.DisplayName = table.Name;
            //_map.Layers.Add(fLayer);

            QueryFilter qf = new QueryFilter();
            qf.WhereClause = "1=1";
            IEnumerable<Feature> features = await table.QueryAsync(qf);
            IS3GraphicCollection graphics = new IS3GraphicCollection();

            int index = 0, count = 0;
            foreach (Feature f in features)
            {
                // jump to start position
                if (index++ < start)
                    continue;

                // Note:
                //     In ArcGIS Runtime SDK: User-defined coordinate system
                //     is not allowed when using ShapefileTable.OpenAsync().
                // Workaround:
                //     (1) Do not assign user-defined CS in shape file;
                //     (2) Assign CS dynamically here to _srEMap.
                //
                Geometry geometry = f.Geometry;
                if (isShp == true)
                {
                    geometry = ArcGISMappingUtility.ChangeSpatailReference(geometry, _srEMap);
                    if (geometry == null)
                        continue;
                }

                if (_srEMap != null && isShp == false && geometry.SpatialReference != _srEMap)
                    geometry = GeometryEngine.Project(geometry, _srEMap);

                // import the attributes
                IS3Graphic g = new IS3Graphic(geometry);
                foreach (KeyValuePair<string, object> item in f.Attributes.AsEnumerable())
                    g.Attributes.Add(item);
                graphics.Add(g);

                // Load max featuers
                if (maxFeatures != 0 && count++ == maxFeatures)
                    break;
            }

            IS3GraphicsLayer gLayer = new IS3GraphicsLayer();
            gLayer.DisplayName = table.Name;
            gLayer.GraphicsSource = graphics;
            gLayer.geometryType = (IS3.Core.Geometry.GeometryType)(int)table.GeometryType;

            return gLayer;
        }
Ejemplo n.º 35
0
 /// <inheritdoc/>
 public DataTable GetSchemaTable()
 {
     // FeatureTable automatically has a long FID and binary Geometry.
     FeatureTable result = new FeatureTable();
     foreach (Field field in _attributeTable.Columns)
     {
         if (Fields != null && Fields.Length > 0)
         {
             // only include desired fields in our output schema.
             if (!Fields.Contains(field.ColumnName)) continue;
         }
         result.Columns.Add(field.ColumnName, field.DataType);
     }
     return result;
 }