예제 #1
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string)
     {
         return(value);
     }
     if (value is MSCFeatureClass.fcTypeCode || value is int)
     {
         return(MSCFeatureClass.GetTypeCodeString((MSCFeatureClass.fcTypeCode)value));
     }
     return(MSCFeatureClass.GetTypeCodeString(MSCFeatureClass.fcTypeCode.fcTypePoint));
 }
예제 #2
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string)
     {
         int num = 0;
         if (DocUtil.StringToDXFCode((string)value, ref num))
         {
             return(value);
         }
     }
     if (value is int)
     {
         return(DocUtil.DXFCodeToString((int)value));
     }
     return(MSCFeatureClass.GetTypeCodeString(MSCFeatureClass.fcTypeCode.fcTypePoint));
 }
예제 #3
0
 public FeatureClassProperties(MSCFeatureClass fc)
 {
     try
     {
         this._mColorList = this.InitColorList();
         this._FC         = fc;
         this._QueryData  = new DataTable();
         this._QueryData.Columns.Add("Type");
         this._QueryData.Columns.Add("Value");
         if (fc.Query != null)
         {
             TypedValue[] array  = fc.Query.AsArray();
             TypedValue[] array2 = array;
             for (int i = 0; i < array2.Length; i++)
             {
                 TypedValue typedValue = array2[i];
                 if (typedValue.TypeCode == 62)
                 {
                     this.BuildColorRow(typedValue.Value.ToString());
                 }
                 else
                 {
                     DataRow dataRow = this._QueryData.NewRow();
                     dataRow["Type"]  = new DXFCode((int)typedValue.TypeCode).CodeString;
                     dataRow["Value"] = typedValue.Value;
                     this._QueryData.Rows.Add(dataRow);
                 }
             }
         }
         this._QueryData.RowChanged += new DataRowChangeEventHandler(this._QueryData_RowChanged);
         this._FieldData             = new DataTable();
         this._FieldData.Columns.Add("Name");
         this._FieldData.Columns.Add("Type");
         this._FieldData.Columns.Add("Value");
         this._FieldData.Columns.Add("DisplayValue");
         this._FieldData.Columns.Add("Length", typeof(int));
         this._FieldData.Columns.Add("ReadOnly", typeof(bool));
         this._FieldData.Columns.Add("BaseField", typeof(CadField));
         this._FieldData.Columns.Add("CodedValues", typeof(List <MSCCodedValue>));
         this._FieldData.Columns.Add("CodedValue", typeof(MSCCodedValue));
         this._FieldData.Columns.Add("Domain", typeof(FieldDomain));
         this._FieldData.Columns.Add("CanEditType", typeof(bool));
         if (fc.Fields != null)
         {
             foreach (CadField current in fc.Fields)
             {
                 if (current != null && current.Visible)
                 {
                     DataRow dataRow2 = this._FieldData.NewRow();
                     dataRow2["Name"]         = current.Name;
                     dataRow2["Value"]        = current.Value.Value;
                     dataRow2["DisplayValue"] = dataRow2["Value"];
                     if (current.Value.TypeCode == 1)
                     {
                         dataRow2["Length"] = current.Length;
                     }
                     else
                     {
                         dataRow2["Length"] = 0;
                     }
                     dataRow2["Type"] = current.GetTypeString();
                     if (current.ReadOnly)
                     {
                         dataRow2["ReadOnly"] = true;
                     }
                     else
                     {
                         dataRow2["ReadOnly"] = false;
                     }
                     dataRow2["BaseField"] = current;
                     this._FieldData.Rows.Add(dataRow2);
                     if (current.Domain != null)
                     {
                         dataRow2["Domain"] = current.Domain;
                     }
                     dataRow2["CanEditType"] = true;
                     if (current.Domain != null)
                     {
                         dataRow2["CanEditType"]  = false;
                         current.Value            = current.Domain.CheckValue(current.Value.Value);
                         dataRow2["CodedValues"]  = current.Domain.CodedValuesDisplayList;
                         dataRow2["CodedValue"]   = current.Domain.GetCodedValue(current.Value.Value);
                         dataRow2["DisplayValue"] = dataRow2["CodedValue"];
                     }
                 }
             }
         }
         this._FieldData.RowChanged += new DataRowChangeEventHandler(this._FieldData_RowChanged);
         this.InitializeComponent();
         this.lblName.Content     = fc.Name;
         this.lblType.Content     = MSCFeatureClass.GetTypeCodeString(fc.GeometryType);
         this.dgQuery.ItemsSource = this.QueryData.DefaultView;
         this.BuildQueryPropertyOptions(fc.GeometryType);
         this.dgFields.ItemsSource = this._FieldData.DefaultView;
         if (fc.ReadOnly || fc.IsSubType || fc.SubTypes.Count > 0)
         {
             this.dgQuery.IsEnabled    = false;
             this.dgFields.IsEnabled   = false;
             this.cbProperty.IsEnabled = false;
             this.cbAppend.IsEnabled   = false;
             this.cbValue.IsEnabled    = false;
         }
     }
     catch (Exception ex)
     {
         ErrorReport.ShowErrorMessage(ex.Message);
     }
 }