/* * This method returns the current utility network properties */ private IPropertySet GetUNProperties() { IPropertySet unProps = new PropertySet(); // Get UN IBaseNetwork bn = (IBaseNetwork)unDataset; // Get data element IDatasetComponent dsComponent = (IDatasetComponent)unDataset; IDEDataset deDS = dsComponent.DataElement; IDEBaseNetwork deBN = (IDEBaseNetwork)deDS; unProps.SetProperty("proVersion", deBN.ProVersion); unProps.SetProperty("schemaGeneration", deBN.SchemaGeneration); unProps.SetProperty("userIdentity", deBN.UserIdentity); unProps.SetProperty("creationTime", deBN.CreationTime.ToString()); // Get topology IBaseNetworkTopology bnTopo = (IBaseNetworkTopology)bn; unProps.SetProperty("hasValidNetworkTopology", bnTopo.HasValidNetworkTopology()); return(unProps); }
double GetMinScaleTolerance(ICadastralFabric pFab) { IDatasetComponent pDSComponent = (IDatasetComponent)pFab; IDEDataset pDEDS = pDSComponent.DataElement; IDECadastralFabric3 pDECadaFab = (IDECadastralFabric3)pDEDS; IPropertySet pPropSetTol = null; pDECadaFab.GetPropertySet(esriCadastralPropertySetType.esriCadastralPropSetEditSettings, out pPropSetTol); object retVal = null; try { retVal = pPropSetTol.GetProperty("esriMinScaleTolerance"); } catch { Marshal.ReleaseComObject(pDEDS); Marshal.ReleaseComObject(pPropSetTol); return(1.2); //default value } double d_retVal = Convert.ToDouble(retVal); return(d_retVal); }
public int GetFabricVersion(ICadastralFabric2 pFab) { IDECadastralFabric2 pDECadaFab = null; IDEDataset pDEDS = null; int iVersion = -1; try { IDatasetComponent pDSComponent = (IDatasetComponent)pFab; pDEDS = pDSComponent.DataElement; pDECadaFab = (IDECadastralFabric2)pDEDS; iVersion = pDECadaFab.Version; } catch (COMException ex) { MessageBox.Show(ex.Message); } if (pDEDS != null) { Marshal.ReleaseComObject(pDEDS); } return(iVersion); }
private int GetFabricVersion(ICadastralFabric pFab) { IDatasetComponent pDSComponent = (IDatasetComponent)pFab; IDEDataset pDEDS = pDSComponent.DataElement; IDECadastralFabric2 pDECadaFab2 = (IDECadastralFabric2)pDEDS; int x = pDECadaFab2.Version; return(x); }
private int CountPropertySetItems(ICadastralFabric pFab, esriCadastralPropertySetType PropertySetType) { IDatasetComponent pDSComponent = (IDatasetComponent)pFab; IDEDataset pDEDS = pDSComponent.DataElement; IDECadastralFabric3 pDECadaFab3 = (IDECadastralFabric3)pDEDS; IPropertySet pPropSetEdSettings = null; pDECadaFab3.GetPropertySet(PropertySetType, out pPropSetEdSettings); return(pPropSetEdSettings.Count); }
void SetMinScaleTolerance(ICadastralFabric pFab, double ScaleTolerance) { IDatasetComponent pDSComponent = (IDatasetComponent)pFab; IDEDataset pDEDS = pDSComponent.DataElement; IDECadastralFabric3 pDECadaFab3 = (IDECadastralFabric3)pDEDS; IPropertySet pPropSetEdSettings = null; pDECadaFab3.GetPropertySet(esriCadastralPropertySetType.esriCadastralPropSetEditSettings, out pPropSetEdSettings); pPropSetEdSettings.SetProperty("esriMinScaleTolerance", ScaleTolerance); pDECadaFab3.SetPropertySet(esriCadastralPropertySetType.esriCadastralPropSetEditSettings, pPropSetEdSettings); //Update the schema ICadastralFabricSchemaEdit pSchemaEd = (ICadastralFabricSchemaEdit)pFab; IDECadastralFabric pDECadaFab = (IDECadastralFabric)pDECadaFab3; pSchemaEd.UpdateSchema(pDECadaFab); }
bool GetReducedRegenerateTolerance(ICadastralFabric pFab) { IDatasetComponent pDSComponent = (IDatasetComponent)pFab; IDEDataset pDEDS = pDSComponent.DataElement; IDECadastralFabric3 pDECadaFab = (IDECadastralFabric3)pDEDS; IPropertySet pPropSetTol = null; pDECadaFab.GetPropertySet(esriCadastralPropertySetType.esriCadastralPropSetEditSettings, out pPropSetTol); object retVal = null; try { retVal = pPropSetTol.GetProperty("esriReduceRegenerateTolerance"); } catch { return(false); //default value } bool b_retVal = Convert.ToBoolean(retVal); return(b_retVal); }
/* * This method executes a utility network trace to find all the low voltage service points * serviced by the specified transformer and returns the service points global IDs */ private IStringArray FindLVServicePoints(string xfrGlobalID) { //Get required Utility Network interfaces IBaseNetwork unBaseNetwork = (IBaseNetwork)unDataset; IDatasetComponent datasetComponent = (IDatasetComponent)unDataset; IDEDataset deDataset = datasetComponent.DataElement; IDEBaseNetwork deBaseNetwork = (IDEBaseNetwork)deDataset; IDEUtilityNetwork deUtilityNetwork = (IDEUtilityNetwork)deBaseNetwork; IDataElement deElement = (IDataElement)deDataset; //Create and initialize network tracer IUtilityNetworkQuery unQry = unBaseNetwork.CreateQuery(); ITracer unTracer = unBaseNetwork.CreateTracer(); unTracer.Initialize(unQry, (IDataElement)deDataset); // Add transformer as trace starting point IStringArray startGUID = new StrArrayClass(); startGUID.Add(xfrGlobalID); ILongArray startTerm = new LongArrayClass(); startTerm.Add(MV_XFR_TERMINAL_ID); unTracer.AddTraceLocationForJunctionFeatures(esriTraceLocationType.esriTLTStartingPoint, startGUID, startTerm); // Configure trace parameters UNTraceConfiguration traceConfig = new UNTraceConfiguration(); traceConfig.IgnoreBarriersAtStartingPoints = true; traceConfig.IncludeContainers = false; traceConfig.IncludeBarriers = false; traceConfig.IncludeContent = true; traceConfig.IncludeIsolated = false; traceConfig.IncludeStructures = false; traceConfig.IncludeUpToFirstSpatialContainer = false; traceConfig.DomainNetworkName = DOMAIN_NETWORK; traceConfig.TierName = MV_TIER_NAME; traceConfig.TargetTierName = MV_TIER_NAME; traceConfig.TraversabilityScope = esriTraversabilityScope.esriTSJunctionsAndEdges; traceConfig.FilterScope = esriTraversabilityScope.esriTSJunctionsAndEdges; traceConfig.ValidateConsistency = false; // Add output filter to only return service points IArray outFilters = new ArrayClass(); for (int i = 0; i < LV_SERVICE_ASSETTYPES.Length; i++) { UNOutputFilter outFilter = new UNOutputFilter(); outFilter.NetworkSourceID = DEVICE_SOURCE_ID; outFilter.AssetGroupCode = LV_SERVICE_ASSETGROUP; outFilter.AssetTypeCode = LV_SERVICE_ASSETTYPES[i]; outFilters.Add(outFilter); } traceConfig.OutputFilters = outFilters; unTracer.TraceConfiguration = (ITraceConfiguration)traceConfig; // Execute the trace long[] jEid = new long[1]; long[] eEid = new long[1]; unTracer.Trace(esriUtilityNetworkTraceType.esriUNTTDownstream, out jEid, out eEid); // Get features from returned elements IUNTraceResults unTraceResults = (IUNTraceResults)unTracer; ILongArray junctionNetworkSourceIDs = new LongArrayClass(); IStringArray junctionGlobalIDs = new StrArrayClass(); ILongArray junctionObjectIDs = new LongArrayClass(); ILongArray junctionTerminalIDs = new LongArrayClass(); ILongArray junctionAssetGroupCodes = new LongArrayClass(); ILongArray junctionAssetTypeCodes = new LongArrayClass(); ILongArray edgeNetworkSourceIDs = new LongArrayClass(); IStringArray edgeGlobalIDs = new StrArrayClass(); ILongArray edgeObjectIDs = new LongArrayClass(); ILongArray edgeAssetGroupCodes = new LongArrayClass(); ILongArray edgeAssetTypeCodes = new LongArrayClass(); unTraceResults.TraceResultFeatures(out junctionNetworkSourceIDs, out junctionGlobalIDs, out junctionObjectIDs, out junctionTerminalIDs, out junctionAssetGroupCodes, out junctionAssetTypeCodes, out edgeNetworkSourceIDs, out edgeGlobalIDs, out edgeObjectIDs, out edgeAssetGroupCodes, out edgeAssetTypeCodes); return(junctionGlobalIDs); }
public bool CadastralTableAddFieldV1(ICadastralFabric pCadaFab, esriCadastralFabricTable eTable, esriFieldType FieldType, string FieldName, string FieldAlias, int FieldLength) { ITable pTable = pCadaFab.get_CadastralTable(eTable); // First check to see if a field with this name already exists if (pTable.FindField(FieldName) > -1) { if (pTable != null) { Marshal.ReleaseComObject(pTable); } return(false); } IDatasetComponent pDSComponent = (IDatasetComponent)pCadaFab; IDEDataset pDEDS = pDSComponent.DataElement; IDECadastralFabric pDECadaFab = (IDECadastralFabric)pDEDS; IField2 pField = null; try { //Create a new Field pField = new FieldClass(); //QI for IFieldEdit IFieldEdit2 pFieldEdit = (IFieldEdit2)pField; pFieldEdit.Type_2 = FieldType; pFieldEdit.Editable_2 = true; pFieldEdit.IsNullable_2 = true; pFieldEdit.Name_2 = FieldName; pFieldEdit.AliasName_2 = FieldAlias; pFieldEdit.Length_2 = FieldLength; //'.RasterDef_2 = pRasterDef } catch (COMException ex) { if (pField != null) { Marshal.ReleaseComObject(pField); } MessageBox.Show(ex.Message); return(false); } IArray pArr = pDECadaFab.CadastralTableFieldEdits; bool found = false; int cnt = pArr.Count; ICadastralTableFieldEdits pCadaTableFldEdits = null; IFields pFields = null; for (int i = 0; i <= (cnt - 1); i++) { pCadaTableFldEdits = (ICadastralTableFieldEdits)pArr.get_Element(i); IFieldsEdit pNewFields = new FieldsClass(); int fldCnt = 0; if (pCadaTableFldEdits.CadastralTable == eTable) { pFields = pCadaTableFldEdits.ExtendedAttributeFields; //Copy existing fields if (pFields != null) { fldCnt = pFields.FieldCount; pNewFields.FieldCount_2 = fldCnt + 1; for (int j = 0; j <= (fldCnt - 1); j++) { pNewFields.Field_2[j] = pFields.get_Field(j); } } else { pNewFields.FieldCount_2 = 1; } //Add the new field pNewFields.Field_2[fldCnt] = pField; //reset extended attribute fields pCadaTableFldEdits.ExtendedAttributeFields = pNewFields; found = true; break; } } if (!found) { pCadaTableFldEdits = new CadastralTableFieldEditsClass(); pCadaTableFldEdits.CadastralTable = eTable; //add the field to the table pFields = new FieldsClass(); int fldCnt = pFields.FieldCount; IFieldsEdit pFieldsEdit = (IFieldsEdit)pFields; pFieldsEdit.FieldCount_2 = fldCnt + 1; pFieldsEdit.Field_2[fldCnt] = pField; pCadaTableFldEdits.ExtendedAttributeFields = pFields; pArr.Add(pCadaTableFldEdits); Marshal.ReleaseComObject(pFields); } //Set the CadastralTableFieldEdits property on the DE to the array pDECadaFab.CadastralTableFieldEdits = pArr; // Update the schema ICadastralFabricSchemaEdit pSchemaEd = (ICadastralFabricSchemaEdit)pCadaFab; pSchemaEd.UpdateSchema(pDECadaFab); Marshal.ReleaseComObject(pField); return(true); }