ProSymbolEditor.SymbolAttributeSet.PopulateRowBufferWithAttributes C# (CSharp) Method

PopulateRowBufferWithAttributes() public method

public PopulateRowBufferWithAttributes ( RowBuffer &rowBuffer ) : void
rowBuffer RowBuffer
return void
        public void PopulateRowBufferWithAttributes(ref RowBuffer rowBuffer)
        {
            if (!string.IsNullOrEmpty(DisplayAttributes.Identity))
            {
                rowBuffer["identity"] = DisplayAttributes.Identity;
            }

            if (!string.IsNullOrEmpty(DisplayAttributes.SymbolSet))
            {
                rowBuffer["symbolset"] = Convert.ToInt32(DisplayAttributes.SymbolSet);
            }

            if (!string.IsNullOrEmpty(DisplayAttributes.SymbolEntity))
            {
                rowBuffer["symbolentity"] = Convert.ToInt32(DisplayAttributes.SymbolEntity);
            }

            //Indicator / HQTFFD /

            if (!string.IsNullOrEmpty(DisplayAttributes.Indicator))
            {
                rowBuffer["indicator"] = DisplayAttributes.Indicator;
            }

            //Echelon or Mobility

            if (!string.IsNullOrEmpty(DisplayAttributes.Echelon))
            {
                rowBuffer["echelon"] = DisplayAttributes.Echelon;
            }

            if (!string.IsNullOrEmpty(DisplayAttributes.Mobility))
            {
                rowBuffer["mobility"] = DisplayAttributes.Mobility;
            }

            //Statuses or Operation

            if (!string.IsNullOrEmpty(DisplayAttributes.OperationalCondition))
            {
                rowBuffer["operationalcondition"] = DisplayAttributes.OperationalCondition;
            }

            if (!string.IsNullOrEmpty(DisplayAttributes.Status))
            {
                rowBuffer["status"] = DisplayAttributes.Status;
            }

            //Delta attributes
            if (!string.IsNullOrEmpty(DisplayAttributes.Context))
            {
                rowBuffer["context"] = DisplayAttributes.Context;
            }

            if (!string.IsNullOrEmpty(DisplayAttributes.Modifier1))
            {
                rowBuffer["modifier1"] = DisplayAttributes.Modifier1;
            }

            if (!string.IsNullOrEmpty(DisplayAttributes.Modifier2))
            {
                rowBuffer["modifier2"] = DisplayAttributes.Modifier2;
            }

            //LABELS
            if (LabelAttributes.DateTimeValid != null)
            {
                rowBuffer["datetimevalid"] = LabelAttributes.DateTimeValid.ToString();
            }

            if (LabelAttributes.DateTimeExpired != null)
            {
                rowBuffer["datetimeexpired"] = LabelAttributes.DateTimeExpired.ToString();
            }
            
            if (!string.IsNullOrEmpty(LabelAttributes.UniqueDesignation))
            {
                rowBuffer["uniquedesignation"] = LabelAttributes.UniqueDesignation;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.StaffComments))
            {
                rowBuffer["staffcomment"] = LabelAttributes.StaffComments;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.AdditionalInformation))
            {
                rowBuffer["additionalinformation"] = LabelAttributes.AdditionalInformation;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.Type))
            {
                rowBuffer["type"] = LabelAttributes.Type;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.CommonIdentifier))
            {
                rowBuffer["commonidentifier"] = LabelAttributes.CommonIdentifier;
            }

            if (LabelAttributes.Speed != null)
            {
                //Short
                rowBuffer["speed"] = LabelAttributes.Speed;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.HigherFormation))
            {
                rowBuffer["higherFormation"] = LabelAttributes.HigherFormation;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.Reinforced))
            {
                rowBuffer["reinforced"] = LabelAttributes.Reinforced;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.Credibility))
            {
                rowBuffer["credibility"] = LabelAttributes.Credibility;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.Reliability))
            {
                rowBuffer["reliability"] = LabelAttributes.Reliability;
            }

            if (!string.IsNullOrEmpty(LabelAttributes.CountryCode))
            {
                rowBuffer["countrycode"] = LabelAttributes.CountryCode;
            }
        }

Usage Example

示例#1
0
        public async void CreateNewFeatureAsync(object parameter)
        {
            string message        = String.Empty;
            bool   creationResult = false;

            //Generate geometry if polygon or polyline, if adding new feature is from using coordinates and not the map tool
            if (Convert.ToBoolean(parameter) == true)
            {
                if (GeometryType == GeometryType.Polyline || GeometryType == GeometryType.Polygon)
                {
                    GeneratePolyGeometry();
                }
            }

            IEnumerable <GDBProjectItem> gdbProjectItems = Project.Current.GetItems <GDBProjectItem>();
            await QueuedTask.Run(() =>
            {
                foreach (GDBProjectItem gdbProjectItem in gdbProjectItems)
                {
                    using (Datastore datastore = gdbProjectItem.GetDatastore())
                    {
                        //Unsupported datastores (non File GDB and non Enterprise GDB) will be of type UnknownDatastore
                        if (datastore is UnknownDatastore)
                        {
                            continue;
                        }
                        Geodatabase geodatabase = datastore as Geodatabase;
                        // Use the geodatabase.

                        string geodatabasePath = geodatabase.GetPath();
                        if (geodatabasePath.Contains(ProSymbolEditorModule.WorkspaceString))
                        {
                            //Correct GDB, open the current selected feature class
                            FeatureClass featureClass = geodatabase.OpenDataset <FeatureClass>(_currentFeatureClassName);
                            using (featureClass)
                                using (FeatureClassDefinition facilitySiteDefinition = featureClass.GetDefinition())
                                {
                                    EditOperation editOperation = new EditOperation();
                                    editOperation.Name          = "Military Symbol Insert";
                                    editOperation.Callback(context =>
                                    {
                                        try
                                        {
                                            RowBuffer rowBuffer = featureClass.CreateRowBuffer();
                                            _symbolAttributeSet.PopulateRowBufferWithAttributes(ref rowBuffer);
                                            rowBuffer["Shape"] = GeometryEngine.Project(MapGeometry, facilitySiteDefinition.GetSpatialReference());

                                            Feature feature = featureClass.CreateRow(rowBuffer);
                                            feature.Store();

                                            //To Indicate that the attribute table has to be updated
                                            context.Invalidate(feature);
                                        }
                                        catch (GeodatabaseException geodatabaseException)
                                        {
                                            message = geodatabaseException.Message;
                                        }
                                    }, featureClass);

                                    var task       = editOperation.ExecuteAsync();
                                    creationResult = task.Result;
                                    if (!creationResult)
                                    {
                                        message = editOperation.ErrorMessage;
                                    }

                                    break;
                                }
                        }
                    }
                }
            });

            if (!creationResult)
            {
                MessageBox.Show(message);
            }
        }