You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
305 lines
6.2 KiB
305 lines
6.2 KiB
using System; |
|
using System.Collections.Generic; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using ESRI.ArcGIS.Geometry; |
|
using KGIS.Plugin.LayerProperty2.Enum; |
|
using KGIS.Plugin.LayerProperty2.Interface; |
|
using KGIS.Plugin.LayerProperty2.Utils; |
|
|
|
namespace KGIS.Plugin.LayerProperty2.Model |
|
{ |
|
public class AETable : AbstractTable |
|
{ |
|
private IMapSet mapSet; |
|
private esriDatasetType m_DatasetType; |
|
private esriGeometryType m_GeometryType; |
|
private esriFeatureType m_FeatureType; |
|
private string m_Icon; |
|
private string m_Key; |
|
private AETable m_parent; |
|
private string m_WorkspaceKey; |
|
private List<AETable> subTables; |
|
private ISchemeLayerSource layerSource; |
|
private object openedObject; |
|
private object tag; |
|
private string parentKey; |
|
public IMapSet MapSet |
|
{ |
|
get |
|
{ |
|
return this.mapSet; |
|
} |
|
set |
|
{ |
|
this.mapSet = value; |
|
} |
|
} |
|
public esriDatasetType DatasetType |
|
{ |
|
get |
|
{ |
|
return this.m_DatasetType; |
|
} |
|
set |
|
{ |
|
this.m_DatasetType = value; |
|
} |
|
} |
|
public esriGeometryType GeometryType |
|
{ |
|
get |
|
{ |
|
return this.m_GeometryType; |
|
} |
|
set |
|
{ |
|
this.m_GeometryType = value; |
|
} |
|
} |
|
public esriFeatureType FeatureType |
|
{ |
|
get |
|
{ |
|
return this.m_FeatureType; |
|
} |
|
set |
|
{ |
|
this.m_FeatureType = value; |
|
} |
|
} |
|
public string Icon |
|
{ |
|
get |
|
{ |
|
return this.m_Icon; |
|
} |
|
set |
|
{ |
|
this.m_Icon = value; |
|
} |
|
} |
|
public string Key |
|
{ |
|
get |
|
{ |
|
return this.m_Key; |
|
} |
|
set |
|
{ |
|
this.m_Key = value; |
|
} |
|
} |
|
public AETable Parent |
|
{ |
|
get |
|
{ |
|
return this.m_parent; |
|
} |
|
set |
|
{ |
|
this.m_parent = value; |
|
if (this.m_parent != null) |
|
{ |
|
this.m_parent.SubTables.Add(this); |
|
} |
|
} |
|
} |
|
public string WorkspaceKey |
|
{ |
|
get |
|
{ |
|
return this.m_WorkspaceKey; |
|
} |
|
set |
|
{ |
|
this.m_WorkspaceKey = value; |
|
} |
|
} |
|
public List<AETable> SubTables |
|
{ |
|
get |
|
{ |
|
return this.subTables; |
|
} |
|
} |
|
public ISchemeLayerSource LayerSource |
|
{ |
|
get |
|
{ |
|
return this.layerSource; |
|
} |
|
internal set |
|
{ |
|
this.layerSource = value; |
|
} |
|
} |
|
public object OpenedObject |
|
{ |
|
get |
|
{ |
|
return this.openedObject; |
|
} |
|
internal set |
|
{ |
|
this.openedObject = value; |
|
} |
|
} |
|
public object Tag |
|
{ |
|
get |
|
{ |
|
return this.tag; |
|
} |
|
set |
|
{ |
|
this.tag = value; |
|
} |
|
} |
|
internal string ParentKey |
|
{ |
|
get |
|
{ |
|
return this.parentKey; |
|
} |
|
set |
|
{ |
|
this.parentKey = value; |
|
} |
|
} |
|
internal AETable(DataSourceGeneric dataSource, string name, string aliasName, string category, string description) : base(dataSource, name, aliasName, category, description) |
|
{ |
|
this.subTables = new List<AETable>(); |
|
} |
|
internal AETable(DataSourceGeneric dataSource, string name, string aliasName, string category, string description, esriDatasetType DatasetType) : base(dataSource, name, aliasName, category, description) |
|
{ |
|
this.m_DatasetType = DatasetType; |
|
this.subTables = new List<AETable>(); |
|
} |
|
internal AETable(DataSourceGeneric dataSource, string name, string aliasName, string category, string description, esriDatasetType DatasetType, esriGeometryType GeometryType) : base(dataSource, name, aliasName, category, description) |
|
{ |
|
this.m_DatasetType = DatasetType; |
|
this.m_GeometryType = GeometryType; |
|
this.subTables = new List<AETable>(); |
|
} |
|
internal AETable(DataSourceGeneric dataSource, string name, string aliasName, string category, string description, esriDatasetType DatasetType, esriGeometryType GeometryType, esriFeatureType featureType) : base(dataSource, name, aliasName, category, description) |
|
{ |
|
this.m_DatasetType = DatasetType; |
|
this.m_GeometryType = GeometryType; |
|
this.m_FeatureType = featureType; |
|
this.subTables = new List<AETable>(); |
|
} |
|
public void LoadSubTables() |
|
{ |
|
try |
|
{ |
|
this.subTables = SpatialDataOptFactory.GetSubTables(this); |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
public override AbstractField Create(string name, string aliasName, DBDataType dbType, IKgisDictionary dictionary, FieldKeyType fieldKeyType, string defaultValue, int length, string description) |
|
{ |
|
AEField aEField = new AEField(this, name, aliasName, dbType, dictionary, fieldKeyType, defaultValue, length, description); |
|
base.Add(aEField); |
|
return aEField; |
|
} |
|
public object OpenDataSource() |
|
{ |
|
return this.mapSet.OpenAETable(this); |
|
} |
|
public bool Update() |
|
{ |
|
return RDBOpt.UpdateAETable(this); |
|
} |
|
public void TranslateFields() |
|
{ |
|
try |
|
{ |
|
bool flag = false; |
|
using (IEnumerator<AbstractField> enumerator = base.Collection.GetEnumerator()) |
|
{ |
|
while (enumerator.MoveNext()) |
|
{ |
|
AEField aEField = (AEField)enumerator.Current; |
|
aEField.Translate(); |
|
flag = true; |
|
} |
|
} |
|
if (flag) |
|
{ |
|
this.UpdateAEFields(); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
RdbUtil.AddException(ex); |
|
} |
|
} |
|
public bool UpdateAEFields() |
|
{ |
|
return RDBOpt.UpdateAEFields(this); |
|
} |
|
public bool TranslateDataSourceFields() |
|
{ |
|
try |
|
{ |
|
IObjectClass objectClass = this.OpenDataSource() as IObjectClass; |
|
bool result; |
|
if (objectClass == null) |
|
{ |
|
result = false; |
|
return result; |
|
} |
|
IFields fields = objectClass.Fields; |
|
IClassSchemaEdit classSchemaEdit = objectClass as IClassSchemaEdit; |
|
for (int i = 0; i < fields.FieldCount; i++) |
|
{ |
|
IField field = fields.get_Field(i); |
|
AEField fieldByName = this.GetFieldByName(field.Name); |
|
if (fieldByName != null && !(fieldByName.AliasName == "") && !field.AliasName.Equals(fieldByName.AliasName)) |
|
{ |
|
try |
|
{ |
|
classSchemaEdit.AlterFieldAliasName(field.Name, fieldByName.AliasName); |
|
} |
|
catch (Exception ex) |
|
{ |
|
RdbUtil.AddException(ex); |
|
} |
|
} |
|
} |
|
result = true; |
|
return result; |
|
} |
|
catch (Exception ex2) |
|
{ |
|
RdbUtil.AddException(ex2); |
|
} |
|
return false; |
|
} |
|
public AEField GetFieldByName(string name) |
|
{ |
|
try |
|
{ |
|
using (IEnumerator<AbstractField> enumerator = base.Collection.GetEnumerator()) |
|
{ |
|
while (enumerator.MoveNext()) |
|
{ |
|
AEField aEField = (AEField)enumerator.Current; |
|
if (aEField.Name.Equals(name)) |
|
{ |
|
return aEField; |
|
} |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
RdbUtil.AddException(ex); |
|
} |
|
return null; |
|
} |
|
} |
|
}
|
|
|