/// <summary> /// Performs buffer query with a given reference point, distance and FNO. /// FNO is the target feature FNO for which feature class instances are to be searched inside the buffer zone. /// </summary> /// <returns>Key Value pair of feature class instance and distance from reference point</returns> public Dictionary <int, double> PerformBufferQuery() { Recordset resultRecordSet = null; IGTGeometry gTGeometry = null; try { IGTOrientedPointGeometry gTOrientedPointGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>(); gTOrientedPointGeometry.Origin = m_referencePoint; IGTZoneService gTZoneService = GTClassFactory.Create <IGTZoneService>(); gTZoneService.ZoneWidth = m_distance; gTZoneService.InputGeometries = gTOrientedPointGeometry; IGTGeometry outPutGeometry = gTZoneService.OutputGeometries; IGTSpatialService spatialService = GTClassFactory.Create <IGTSpatialService>(); spatialService.DataContext = m_iGtDataContext; spatialService.Operator = GTSpatialOperatorConstants.gtsoEntirelyContains; spatialService.FilterGeometry = outPutGeometry; resultRecordSet = spatialService.GetResultsByFNO(new short[] { this.m_targetFno }); if (resultRecordSet != null && resultRecordSet.RecordCount > 0) { resultRecordSet.MoveFirst(); m_fidDistancePair = new Dictionary <int, double>(); short primaryGraphicCno = GetPrimaryGraphicCno(m_targetFno); while (!resultRecordSet.EOF) { int fid = Convert.ToInt32(resultRecordSet.Fields["G3E_FID"].Value); gTGeometry = m_iGtDataContext.OpenFeature(m_targetFno, fid).Components.GetComponent(primaryGraphicCno).Geometry; if (gTGeometry != null) { m_fidDistancePair.Add(fid, CalculateDistanceFromReferencePoint(gTGeometry.FirstPoint)); } resultRecordSet.MoveNext(); } } return(m_fidDistancePair); } catch (Exception) { throw; } finally { if (resultRecordSet != null) { resultRecordSet.Close(); resultRecordSet = null; } } }
public void CreateTemporaryGeometryForVirtualPoint(IGTGeometry virtualPtGeom, double p_range, ref IGTGeometry p_tempGeom) { try { IGTZoneService gTZoneService = GTClassFactory.Create <IGTZoneService>(); gTZoneService.ZoneWidth = p_range; gTZoneService.InputGeometries = virtualPtGeom; p_tempGeom = gTZoneService.OutputGeometries; } catch { throw; } }
/// <summary> /// Method to set the Normal and As-Operated status for features in INI and CLS states /// </summary> /// <param name="activeFeature"></param> /// <param name="relatedFeatures"></param> private void SetNormalAndAsOperatedAttributes(IGTKeyObject activeFeature, IGTKeyObjects relatedFeatures) { Dictionary <int, short> relatedIsolationPoints = new Dictionary <int, short>(); string normalStatus = string.Empty; string asOperatedStatus = string.Empty; try { // Set status attributes for active feature irrespective of feature class // ALM-2356-JIRA-2798 // ALM-2356 change complete IGTComponent connectivityComponent = activeFeature.Components.GetComponent(11); if (connectivityComponent == null) { return; } Recordset connectivityRs = connectivityComponent.Recordset; normalStatus = Convert.ToString(connectivityRs.Fields["STATUS_NORMAL_C"].Value); asOperatedStatus = Convert.ToString(connectivityRs.Fields["STATUS_OPERATED_C"].Value); // If feature state is changed from INI to CLS, do nothing if (m_featureStateBeforeChange == "INI" && m_featureState == "CLS") { } else { if (asOperatedStatus != normalStatus) { connectivityRs.Fields["STATUS_OPERATED_C"].Value = normalStatus; } } // ALM-2360-JIRA-2799 - when feature state transitions to INI or CLS, // copy the affected proposed voltages to the actual voltage attributes (Voltage 2 for Transformers, and both Voltage 1 & 2 for Autotransformers). // ALM affects Auto Transformer, Transformer OH and OH Network, Transformer UG and UG Network features if (m_transformerFNOs.Contains(activeFeature.FNO)) { if (activeFeature.FNO == 34) // Autotransformer { connectivityRs.Fields["VOLT_1_Q"].Value = connectivityRs.Fields["PP_VOLT_1_Q"].Value; connectivityRs.Fields["VOLT_2_Q"].Value = connectivityRs.Fields["PP_VOLT_2_Q"].Value; } else // Other transformers { connectivityRs.Fields["VOLT_2_Q"].Value = connectivityRs.Fields["PP_VOLT_2_Q"].Value; } } // Set status attributes for associated isolation points incase of Isolation scenario features if (m_IsoScenarioFNOs.Contains(activeFeature.FNO)) { // update statuses for inline isolation points. Inlines isolation points are related/connected to active feature. foreach (IGTKeyObject relatedFeature in relatedFeatures) { if (m_virtualPointFNOs.Contains(relatedFeature.FNO)) { relatedIsolationPoints.Add(relatedFeature.FID, relatedFeature.FNO); Recordset relatedFeatureRs = relatedFeature.Components.GetComponent(11).Recordset; if (relatedFeatureRs.RecordCount > 0) { relatedFeatureRs.MoveFirst(); normalStatus = Convert.ToString(relatedFeatureRs.Fields["STATUS_NORMAL_C"].Value); asOperatedStatus = Convert.ToString(relatedFeatureRs.Fields["STATUS_OPERATED_C"].Value); if (!asOperatedStatus.Equals(normalStatus)) { relatedFeatureRs.Fields["STATUS_OPERATED_C"].Value = normalStatus; } } } } // Find out whether there is any third isolation point. The Recloser would have a third isolation point (true Bypass point) that is not connected to the Recloser. // We will find out the true Bypass point using Zone and Spatial service and if it exists we will update the statuses. // For some active features ,say Transformer UG, there are NO isolation points but they do have other connected features which are not isolated points. // We want to consider only related isolation points leaving out the rest of the connected features if (relatedIsolationPoints.Count != 0) { foreach (KeyValuePair <int, short> feature in relatedIsolationPoints) { IGTOrientedPointGeometry gTOrientedPointGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>(); gTOrientedPointGeometry.Origin = ((IGTOrientedPointGeometry)activeFeature.Components.GetComponent(GetPrimaryGraphicCno(activeFeature.FNO)).Geometry).Origin; IGTZoneService gTZoneService = GTClassFactory.Create <IGTZoneService>(); gTZoneService.ZoneWidth = 4; gTZoneService.InputGeometries = gTOrientedPointGeometry; IGTGeometry outPutGeometry = gTZoneService.OutputGeometries; IGTSpatialService gTSpatialService = GTClassFactory.Create <IGTSpatialService>(); gTSpatialService.DataContext = m_GTDataContext; gTSpatialService.Operator = GTSpatialOperatorConstants.gtsoEntirelyContains; gTSpatialService.FilterGeometry = outPutGeometry; Recordset resultRecordSet = gTSpatialService.GetResultsByFNO(new short[] { feature.Value }); if (resultRecordSet != null && resultRecordSet.RecordCount > 0) { // the recordset contains the isolated points that are within the zone and hence contains already connected isolation points resultRecordSet.MoveFirst(); while (!resultRecordSet.EOF) { int fid = Convert.ToInt32(resultRecordSet.Fields["G3E_FID"].Value); short fno = Convert.ToInt16(resultRecordSet.Fields["G3E_FNO"].Value); // we would like to consider the isolation point that is not connected to the active feature, but it is part of the active feature. if (!relatedIsolationPoints.ContainsKey(fid)) { Recordset thirdIsolationPoint = m_GTDataContext.OpenFeature(fno, fid).Components.GetComponent(11).Recordset; if (thirdIsolationPoint != null && thirdIsolationPoint.RecordCount > 0) { thirdIsolationPoint.MoveFirst(); normalStatus = Convert.ToString(thirdIsolationPoint.Fields["STATUS_NORMAL_C"].Value); asOperatedStatus = Convert.ToString(thirdIsolationPoint.Fields["STATUS_OPERATED_C"].Value); if (!asOperatedStatus.Equals(normalStatus)) { thirdIsolationPoint.Fields["STATUS_OPERATED_C"].Value = normalStatus; } } } resultRecordSet.MoveNext(); } } } } } } catch (Exception) { throw; } }