/// <summary> /// Method to create work point feature /// </summary> /// <returns>Work point feature IGTKeyObject</returns> public IGTKeyObject CreateWorkPointFeature() { try { IGTKeyObject workPointFeature = m_dataContext.NewFeature(191); IGTComponents workPointComponents = workPointFeature.Components; int wpOffsetX = 0; int wpOffsetY = 0; GetWorkPointOffset(ref wpOffsetX, ref wpOffsetY); foreach (IGTComponent component in workPointComponents) { Recordset tempRs = component.Recordset; if (tempRs != null) { if (tempRs.RecordCount > 0) { if (component.CNO == 19102) // Work point symbol { IGTOrientedPointGeometry orientedPtGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>(); IGTPoint point = GTClassFactory.Create <IGTPoint>(); point.X = m_locationX - wpOffsetX; point.Y = m_locationY - wpOffsetY; orientedPtGeometry.Origin = point; component.Geometry = orientedPtGeometry; } if (component.CNO == 19103) // Work point Label { IGTTextPointGeometry gTTextPointGeometry = GTClassFactory.Create <IGTTextPointGeometry>(); IGTPoint gTPoint = GTClassFactory.Create <IGTPoint>(); gTPoint.X = m_locationX - wpOffsetX; gTPoint.Y = m_locationY - wpOffsetY; gTTextPointGeometry.Origin = gTPoint; gTTextPointGeometry.Alignment = GTAlignmentConstants.gtalBottomCenter; component.Geometry = gTTextPointGeometry; component.Recordset.Update(); } } } } // Leader Line should end at a point 70% of the way toward the structure from center of the Work Point. m_locationX = m_locationX - wpOffsetX * .3; m_locationY = m_locationY - wpOffsetY * .3; CreateLeaderLine(workPointFeature, m_locationX, m_locationY); return(workPointFeature); } catch (Exception) { throw; } }
/// <summary> /// Create new street light feature. /// </summary> /// <returns></returns> private IGTKeyObject NewStreetLight() { IGTKeyObject gtStreetLightKObject; try { m_gTTransactionManager.Begin("Importing Street Light(s) using Import Tool"); gtStreetLightKObject = m_oGTDataContext.NewFeature(56); UpdateStreetLightComponents(gtStreetLightKObject); EstablishOwnership(gtStreetLightKObject); if (m_gTTransactionManager.TransactionInProgress) { m_gTTransactionManager.Commit(true); } } catch { throw; } return(gtStreetLightKObject); }
public void CreateDuct(string sASSIGNMENT, int iPOS_HORZ_FROM, int iPOS_VERT_FROM, int iPOS_HORZ_TO, int iPOS_VERT_TO, int iSTALE_FLAG_FROM, int iSTALE_FLAG_TO) { IGTKeyObject tmpFeatureDuct = null; try { object oMissing = System.Reflection.Missing.Value; //Create fORMATION tmpFeatureDuct = m_oDataContext.NewFeature(csConstant.SHORT_DUCT); //NETELEM tmpFeatureDuct.Components["COMMON_N"].Recordset.MoveFirst(); //csGlobals.tmpFeatureFormation.Components["GC_NETELEM"].Recordset.Fields["FEATURE_STATE"].Value = dataGridViewExpansion.Rows[i].Cells["STATE"].Value.ToString(); //MAIN COMPONENT tmpFeatureDuct.Components["DUCT_N"].Recordset.MoveFirst(); //ASSIGNMENT,POS_HORZ_FROM,POS_HORZ_TO,POS_VERT_FROM,POS_VERT_TO,STALE_FLAG_FROM,STALE_FLAG_TO tmpFeatureDuct.Components["DUCT_N"].Recordset.Fields["ASSIGNMENT_ID"].Value = sASSIGNMENT; tmpFeatureDuct.Components["DUCT_N"].Recordset.Fields["FROM_POS_HORZ"].Value = iPOS_HORZ_FROM; tmpFeatureDuct.Components["DUCT_N"].Recordset.Fields["TO_POS_HORZ"].Value = iPOS_HORZ_TO; tmpFeatureDuct.Components["DUCT_N"].Recordset.Fields["FROM_POS_VERT"].Value = iPOS_VERT_FROM; tmpFeatureDuct.Components["DUCT_N"].Recordset.Fields["TO_POS_VERT"].Value = iPOS_VERT_TO; tmpFeatureDuct.Components["DUCT_N"].Recordset.Fields["FROM_STALE_FLAG"].Value = iSTALE_FLAG_FROM; tmpFeatureDuct.Components["DUCT_N"].Recordset.Fields["TO_STALE_FLAG"].Value = iSTALE_FLAG_TO; IGTRelationshipService gServices = GTClassFactory.Create <IGTRelationshipService>(); gServices.DataContext = m_oDataContext; gServices.ActiveFeature = m_FormationFeature; gServices.SilentEstablish(csConstant.iContains, tmpFeatureDuct); gServices.Dispose(); gServices = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "Create Duct", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <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); }
public void placeServiceLine() { gtTransactionManager.Begin("Service Line Placement"); serviceLine = dataContext.NewFeature(g_Service_Line_FNO); featurePlacementService.StartFeature(serviceLine); }