private void CheckForVirtualGeometry(IGTKeyObject feature, ref bool isoPtDelete) { short virtualPointCNO = 0; try { if (m_IsoCommon.IsDetailMapWindow()) { virtualPointCNO = 79; } else { virtualPointCNO = 78; } IGTComponent virtualPointPrimaryComp = feature.Components.GetComponent(virtualPointCNO); if (virtualPointPrimaryComp != null) { if (virtualPointPrimaryComp.Geometry == null) { isoPtDelete = true; } } } catch { throw; } }
/// <summary> /// Method to create an Isolation Point. /// </summary> /// <param name="isoPtNumber">Isolation point number</param> /// <returns>Boolean indicating method execution status</returns> private bool CreateIsolationPoint(short isoPtNumber) { bool returnValue = false; short primaryCNO = 0; short isoPtCNO = 0; try { IGTKeyObject isoPtKO = m_dataContext.NewFeature(6); string errMessage; m_IsoCommon.SetAttributeDefaults(isoPtKO, out errMessage); m_IsoCommon.SetVirtualPointAttributes(m_IsolationScenarioFeature, isoPtKO, out errMessage); Recordset oRSFeature = m_dataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "g3e_fno = " + m_IsolationScenarioFeature.GtKeyObject.FNO); m_IsoCommon.IsDetailMapWindow(); if (m_IsoCommon.detailID == 0) { primaryCNO = Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value); isoPtCNO = 78; } else { primaryCNO = Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYDETAILCNO"].Value); isoPtCNO = 79; } // Check if symbol component has been created. If metadata is defined with alternate required component then symbol record will need to be added. if (isoPtKO.Components.GetComponent(isoPtCNO).Recordset.RecordCount == 0) { isoPtKO.Components.GetComponent(isoPtCNO).Recordset.AddNew(); isoPtKO.Components.GetComponent(isoPtCNO).Recordset.Fields["G3E_FNO"].Value = isoPtKO.FNO; isoPtKO.Components.GetComponent(isoPtCNO).Recordset.Fields["G3E_FID"].Value = isoPtKO.FID; if (m_IsoCommon.detailID != 0) { isoPtKO.Components.GetComponent(isoPtCNO).Recordset.Fields["G3E_DETAILID"].Value = m_IsoCommon.detailID; } isoPtKO.Components.GetComponent(isoPtCNO).Recordset.MoveFirst(); } // Set the geometry IGTPoint gtPt = GTClassFactory.Create <IGTPoint>(); IGTOrientedPointGeometry orientedPtGeom = GTClassFactory.Create <IGTOrientedPointGeometry>(); orientedPtGeom = (IGTOrientedPointGeometry)m_IsolationScenarioFeature.GtKeyObject.Components.GetComponent(primaryCNO).Geometry; double xOffset = 0; double yOffset = 0; if (isoPtNumber == 1) { xOffset = IsoCommon.AUTO_XFMR_ISO_PT1_OFFSET_X; yOffset = IsoCommon.AUTO_XFMR_ISO_PT1_OFFSET_Y; } else { xOffset = IsoCommon.AUTO_XFMR_ISO_PT2_OFFSET_X; yOffset = IsoCommon.AUTO_XFMR_ISO_PT2_OFFSET_Y; } gtPt = m_IsoCommon.GetOffsetPoint(orientedPtGeom.Origin, xOffset * .3048, yOffset * .3048, orientedPtGeom.Orientation); orientedPtGeom.Origin = gtPt; isoPtKO.Components.GetComponent(isoPtCNO).Geometry = orientedPtGeom; if (isoPtNumber == 1) { //m_IsoCommon.EstablishConnectivity(isoPtKO, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1); m_IsolationScenarioFeature.RelatedFeaturesNode1.Add(isoPtKO); m_IsolationScenarioFeature.IsolationPoint1 = isoPtKO; } else { //m_IsoCommon.EstablishConnectivity(isoPtKO, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2); m_IsolationScenarioFeature.RelatedFeaturesNode2.Add(isoPtKO); m_IsolationScenarioFeature.IsolationPoint2 = isoPtKO; } returnValue = true; } catch (Exception ex) { returnValue = false; if (m_IsoCommon.InteractiveMode) { MessageBox.Show("Error in Isolation Scenario FI:CreateIsolationPoint - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } return(returnValue); }