コード例 #1
0
        private bool ProcessVirtualPointAssociation(ref DataTable p_associatedFeaturesRs)
        {
            IGTGeometry primaryGeometry = null;
            IGTGeometry tempGeometry    = null;
            double      locateRange     = 0.0;
            bool        process         = false;

            try
            {
                IGTKeyObject virtualPtFeature = DataContext.OpenFeature(m_gtFeature.FNO, m_gtFeature.FID);
                m_relatedFeatures = new Dictionary <short, string>();
                DataAccess dataAccess = new DataAccess(m_gtApplication);

                dataAccess.GetPrimaryGeometry(virtualPtFeature, ref primaryGeometry);

                if (primaryGeometry != null)
                {
                    process = true;

                    dataAccess.GetRangeValueToLocateAssociateFeatures(ref locateRange);
                    dataAccess.GetListOfRelatedFeaturesOfVP(m_gtFeature.FNO, ref m_relatedFeatures);

                    VirtualPointAssociationUtility associationUtility = new VirtualPointAssociationUtility(m_gtApplication);
                    associationUtility.CreateTemporaryGeometryForVirtualPoint(primaryGeometry, locateRange, ref tempGeometry);
                    associationUtility.GetRecorsetOfAssociateFeaturesForVP(tempGeometry, m_relatedFeatures.Keys.ToArray(), ref p_associatedFeaturesRs, m_gtFeature.FNO, m_relatedFeatures);
                }
            }
            catch
            {
                throw;
            }
            return(process);
        }
コード例 #2
0
ファイル: CommonSPTCode.cs プロジェクト: git786hub/DLL
        /// <summary>
        /// Get Segment And Angle on which point is placed
        /// </summary>
        /// <param name="m_gtPolylineGeometry"></param>
        /// <param name="gtPoint"></param>
        /// <returns></returns>
        protected IGTGeometry GetSegmentAndAngle(IGTGeometry m_gtPolylineGeometry, IGTPoint gtPoint)
        {
            bool        flag = false;
            IGTGeometry m_gtPolylineGeometrySegment = GTClassFactory.Create <IGTGeometry>();
            IGTSegment  m_gtSegment   = GTClassFactory.Create <IGTSegment>();
            IGTPoint    m_gtsnapPoint = GetSnapPoint(m_gtPolylineGeometry, gtPoint);

            try
            {
                if (m_gtPolylineGeometry.Type == "CompositePolylineGeometry")
                {
                    //get the segment
                    for (int i = 0; i < m_gtPolylineGeometry.KeypointCount - 1; i++)
                    {
                        m_gtSegment.Begin = m_gtPolylineGeometry.GetKeypointPosition(i);
                        m_gtSegment.End   = m_gtPolylineGeometry.GetKeypointPosition(i + 1);
                        if (m_gtsnapPoint.IsOn(m_gtSegment))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (flag)
                    {
                        m_gtPolylineGeometrySegment = m_gtPolylineGeometry.ExtractGeometry(m_gtSegment.Point1, m_gtSegment.Point2, false);
                    }
                }
                return(m_gtPolylineGeometrySegment);
            }
            catch
            {
                throw;
            }
        }
コード例 #3
0
        /// <summary>
        /// UpdateWorkpointComponents : Update Workpoint feature  components.
        /// </summary>
        /// <param name="fno">Workpoint Fno</param>
        /// <param name="fid">Workpoint FID</param>
        /// <param name="workPointFeature">Workpoint Feature</param>
        /// <param name="geoUpdate">Bool value indicates the updation of geometry.</param>
        /// <param name="strStructureID">StructureID of Active Key Object</param>
        private void UpdateWorkpointComponents(short fno, int fid, IGTKeyObject workPointFeature, bool geoUpdate,
                                               string strStructureID, int ownerCount, bool isLinear)
        {
            IGTComponents workPointComponents = workPointFeature.Components;

            foreach (IGTComponent component in workPointComponents)
            {
                if (component.Name == "WORKPOINT_N" && geoUpdate)
                {
                    UpdateWorkPointAttributes(component, strStructureID);
                }
                else if (component.Name == "WORKPOINT_CU_N" && ownerCount == 0 && isLinear == true)
                {
                    UpdateWorkpointCUAttributes(workPointFeature.FID, component);
                }
                else if (component.Name == "WORKPOINT_CU_N" && isLinear == false)
                {
                    UpdateWorkpointCUAttributes(workPointFeature.FID, component);
                }
            }

            IGTKeyObject           oKeyObject       = m_dataContext.OpenFeature(fno, fid);
            IGTGeometry            gTGeometry       = oKeyObject.Components.GetComponent(m_gtcommonFunctions.GetPrimaryGraphicCno(fno, true)).Geometry;
            customWorkPointCreator workPointCreator = new customWorkPointCreator(m_dataContext, gTGeometry.FirstPoint.X, gTGeometry.FirstPoint.Y);

            workPointCreator.SynchronizeWPCuLabel(workPointFeature);
        }
コード例 #4
0
        /// <summary>
        ///  Gives the list of all directly connected point features to active feature which have different owner other than active feature owner
        /// </summary>
        /// <param name="activeFeature"></param>
        /// <param name="relatedFeatures"></param>
        /// <param name="noMatchingOwnerCnt"></param>
        private void GetActiveAndRelatedFeaturesOwners(IGTKeyObject activeFeature, IGTKeyObjects relatedFeatures, ref int noMatchingOwnerCnt)
        {
            int         aOwnerID           = 0;
            int         rOwnerID           = 0;
            IGTGeometry relatedPrimaryGeom = null;

            try
            {
                GetOwnerID(activeFeature.Components.GetComponent(oCNO).Recordset, ref aOwnerID);

                foreach (IGTKeyObject relatedFeature in relatedFeatures)
                {
                    GetPrimaryGeometry(relatedFeature, ref relatedPrimaryGeom);

                    if (relatedPrimaryGeom != null && relatedPrimaryGeom.Type == "OrientedPointGeometry")
                    {
                        GetOwnerID(relatedFeature.Components.GetComponent(oCNO).Recordset, ref rOwnerID);

                        if (aOwnerID != 0 && (rOwnerID != aOwnerID) && CheckValidOwner(relatedFeature.FNO, aOwnerID))
                        {
                            noMatchingOwnerCnt++;
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #5
0
ファイル: fiLocationAttributes.cs プロジェクト: git786hub/DLL
        public void Execute()
        {
            double dXoord = 0.0;
            double dYoord = 0.0;
            double dZoord = 0.0;

            try
            {
                IGTGeometry geometry = Components[ComponentName].Geometry;
                m_objAttributeHolder = new AttributeHolder();

                dXoord = ((IGTPointGeometry)geometry).FirstPoint.X;
                dYoord = ((IGTPointGeometry)geometry).FirstPoint.Y;

                ConvertToLatitudeAndLongitude(ref dXoord, ref dYoord, ref dZoord);

                m_objAttributeHolder.PointX      = ((IGTPointGeometry)geometry).FirstPoint.X;
                m_objAttributeHolder.PointY      = ((IGTPointGeometry)geometry).FirstPoint.Y;
                m_objAttributeHolder.XCoordinate = dXoord;
                m_objAttributeHolder.YCoordinate = dYoord;
                m_objAttributeHolder.ZCoordinate = dZoord;
                ProcessLocationFlags();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error during Location Attributes FI execution. " + ex.Message, "G/Technology");
            }
        }
コード例 #6
0
        /// <summary>
        /// Calculate Centroid for given boundayr Geometry
        /// </summary>
        /// <param name="gtGeometry"></param>
        /// <returns></returns>
        public IGTPoint CalculateCentroid(IGTGeometry gtGeometry)
        {
            IGTPoint gtCenterPt = GTClassFactory.Create <IGTPoint>();

            gtCenterPt.X = 0;
            gtCenterPt.Y = 0;
            gtCenterPt.Z = 0;
            if (gtGeometry.KeypointCount > 1)
            {
                for (int indx = 0; indx < gtGeometry.KeypointCount - 1; indx++)
                {
                    gtCenterPt.X += gtGeometry.GetKeypointPosition(indx).X;
                    gtCenterPt.Y += gtGeometry.GetKeypointPosition(indx).Y;
                    gtCenterPt.Z += gtGeometry.GetKeypointPosition(indx).Z;
                }
                gtCenterPt.X /= gtGeometry.KeypointCount - 1;
                gtCenterPt.Y /= gtGeometry.KeypointCount - 1;
                gtCenterPt.Z /= gtGeometry.KeypointCount - 1;
            }
            else
            {
                gtCenterPt = gtGeometry.FirstPoint;
            }
            return(gtCenterPt);
        }
コード例 #7
0
        /// <summary>
        /// Rotates input geometry relative to the reference geom
        /// </summary>
        /// <param name="ogeom"></param>
        /// <returns></returns>
        private void RotateGeom(IGTGeometry refGeom, ref IGTPolygonGeometry inpGeom)
        {
            double             dAngle     = 0;
            IGTPolygonGeometry oPolyGeom  = null;
            IGTMatrix          tmpTMatrix = null;
            IGTVector          transVec;

            try
            {
                if (refGeom == null || inpGeom == null)
                {
                    return;
                }
                if (refGeom.GetType().ToString() == "Intergraph.GTechnology.Private.GTOrientedPointGeometry")
                {
                    dAngle = AngleBetweenTwoPoints(((IGTOrientedPointGeometry)refGeom).Orientation);
                }
                else if (refGeom.GetType().ToString() == "Intergraph.GTechnology.Private.GTPolygonGeometry")
                {
                    oPolyGeom = (IGTPolygonGeometry)refGeom.Stroke();
                    dAngle    = AngleBetweenTwoPoints(oPolyGeom.Points[0], oPolyGeom.Points[1]);
                }
                transVec = GTClassFactory.Create <IGTVector>();

                if (inpGeom.GetType().ToString() == "Intergraph.GTechnology.Private.GTPolygonGeometry")
                {
                    oPolyGeom = (IGTPolygonGeometry)inpGeom.Stroke();

                    // move and rotate the geometry to the correct position
                    transVec.I = oPolyGeom.Points[0].X * -1;
                    transVec.J = oPolyGeom.Points[0].Y * -1;
                    transVec.K = oPolyGeom.Points[0].Z * -1;
                }

                tmpTMatrix = GTClassFactory.Create <IGTMatrix>();
                tmpTMatrix = TranslationTransform(transVec);
                inpGeom    = (IGTPolygonGeometry)inpGeom.Multiply(inpGeom, tmpTMatrix);

                // rotate the geometry to the angle of the
                tmpTMatrix = GTClassFactory.Create <IGTMatrix>();
                tmpTMatrix = RotateZTransform(dAngle, 'D');
                inpGeom    = (IGTPolygonGeometry)inpGeom.Multiply(inpGeom, tmpTMatrix);

                transVec   = transVec.NegateVector(transVec);
                tmpTMatrix = GTClassFactory.Create <IGTMatrix>();
                tmpTMatrix = TranslationTransform(transVec);
                inpGeom    = (IGTPolygonGeometry)inpGeom.Multiply(inpGeom, tmpTMatrix);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            finally
            {
            }
        }
コード例 #8
0
        public static IGTPoint RetrieveRelativePoint(IGTGraphicComponent relativeComponent)
        {
            //initialize
            IGTGeometry relativeGeometry = relativeComponent.Geometry;
            IGTPoint    relativePoint    = GTClassFactory.Create <IGTPoint>();

            relativePoint.X = ((IGTOrientedPointGeometry)relativeGeometry).Origin.X;
            relativePoint.Y = ((IGTOrientedPointGeometry)relativeGeometry).Origin.Y;
            relativePoint.Z = ((IGTOrientedPointGeometry)relativeGeometry).Origin.Z;
            return(relativePoint);
        }
コード例 #9
0
ファイル: CommandUtilities.cs プロジェクト: git786hub/DLL
 public static void LogLocationCriteria(IGTGeometry _locCritera, AssetHistory _obj, GTDiagnostics _odiag)
 {
     try
     {
     }
     catch (Exception ex)
     {
         LogException(_odiag, "LogLocationCrietria", ex);
         throw ex;
     }
 }
コード例 #10
0
ファイル: customBufferQuery.cs プロジェクト: git786hub/DLL
        /// <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;
                }
            }
        }
コード例 #11
0
 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;
     }
 }
コード例 #12
0
ファイル: Ticket.cs プロジェクト: git786hub/DLL
        /// <summary>
        /// Gets the list of member codes
        /// </summary>
        /// <returns></returns>
        private List <string> GetMemberCodes()
        {
            try
            {
                List <string> codesList   = new List <string>();
                IGTKeyObject  gTKeyObject = DataContext.OpenFeature(110, POLE_FID);
                Recordset     rs          = gTKeyObject.Components.GetComponent(1).Recordset;

                IGTGeometry geometry = gTKeyObject.Components.GetComponent(11002).Geometry;
                IGTPoint    point    = GTClassFactory.Create <IGTPoint>();
                point.X = geometry.FirstPoint.X;
                point.Y = geometry.FirstPoint.Y;
                point.Z = geometry.FirstPoint.Z;
                customBoundaryQuery boundaryQuery = new customBoundaryQuery(point, 235);// County boundary  FNO 235
                Recordset           resultRs1     = boundaryQuery.PerformPointInPolygon();

                if (resultRs1 != null && resultRs1.RecordCount > 0)
                {
                    IGTKeyObject countyFeature        = DataContext.OpenFeature(Convert.ToInt16(resultRs1.Fields["G3E_FNO"].Value), Convert.ToInt32(resultRs1.Fields["G3E_FID"].Value));
                    Recordset    boundaryAttributesRs = countyFeature.Components.GetComponent(23501).Recordset; // // County Boundary Attributes
                    if (boundaryAttributesRs != null && boundaryAttributesRs.RecordCount > 0)
                    {
                        boundaryAttributesRs.MoveFirst();
                        if (!string.IsNullOrEmpty(Convert.ToString(boundaryAttributesRs.Fields["ID"].Value)))
                        {
                            string    countyBoundaryId = Convert.ToString(boundaryAttributesRs.Fields["ID"].Value).Replace("TX", string.Empty).Trim();
                            Recordset memberCodeRS     = GetRecordSet(string.Format(@"SELECT NJUNS_MEMBER FROM NJUNS_MEMBER A , NJUNS_CONTACTS B WHERE A.NJUNS_MEMBER_ID = B.NJUNS_MEMBER_ID AND
                                                                        B.COUNTY_N_ID = {0} ", countyBoundaryId));

                            if (memberCodeRS != null && memberCodeRS.RecordCount > 0)
                            {
                                memberCodeRS.MoveFirst();
                                while (!memberCodeRS.EOF)
                                {
                                    codesList.Add(Convert.ToString(memberCodeRS.Fields["NJUNS_MEMBER"].Value));
                                    memberCodeRS.MoveNext();
                                }
                                memberCodeRS.Close();
                                memberCodeRS = null;
                            }
                        }
                    }
                }
                return(codesList);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #13
0
        private void DoLineGeometryByFID(List <AssetHistory> objHistList, int iFID)
        {
            try
            {
                IGTGeometry[] arrGeoms;
                object[]      arrStyles;
                object[]      arrToolTips;
                string        sDisplayName = string.Empty;

                IGTPolylineGeometry oPolyLine = GTClassFactory.Create <IGTPolylineGeometry>();

                string sFID = iFID.ToString();


                foreach (AssetHistory objToUse in objHistList)
                {
                    IGTPoint apoint = GTClassFactory.Create <IGTPoint>();

                    apoint.X = objToUse.OGG_X1;
                    apoint.Y = objToUse.OGG_Y1;
                    apoint.Z = objToUse.OGG_Z1;

                    oPolyLine.Points.Add(apoint);
                }

                if (oPolyLine.Points.Count > 0)
                {
                    arrGeoms    = new IGTGeometry[1];
                    arrStyles   = new object[1];
                    arrToolTips = new object[1];

                    arrGeoms[0]    = (IGTGeometry)oPolyLine;
                    arrStyles[0]   = this.oGenParams.HistoricalSymbol;
                    arrToolTips[0] = "FID " + sFID;
                    sDisplayName   = "Line FID " + sFID;


                    this.oDisplay.AppendTemporaryGeometries(sDisplayPathName, sDisplayName, arrGeoms, arrStyles, arrToolTips, true, true);
                }

                this.oApp.RefreshWindows();
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "CCStreetLightTracker.DoLineGeometry", ex);
                throw ex;
            }
        }
コード例 #14
0
        private void SetupLocationCriteria()
        {
            try
            {
                if (this.oMap == null)
                {
                    throw new Exception("Map object is null.");
                }

                IGTWorldRange oMapExtents = this.oMap.GetRange();

                IGTPolygonGeometry m_oPoly   = GTClassFactory.Create <IGTPolygonGeometry>();
                IGTPoint           m_ulPoint = GTClassFactory.Create <IGTPoint>();
                m_ulPoint.X = oMapExtents.BottomLeft.X;
                m_ulPoint.Y = oMapExtents.TopRight.Y;

                IGTPoint m_urPoint = GTClassFactory.Create <IGTPoint>();
                m_urPoint.X = oMapExtents.TopRight.X;
                m_urPoint.Y = oMapExtents.TopRight.Y;

                IGTPoint m_lrPoint = GTClassFactory.Create <IGTPoint>();
                m_lrPoint.X = oMapExtents.TopRight.X;
                m_lrPoint.Y = oMapExtents.BottomLeft.Y;

                IGTPoint m_llPoint = GTClassFactory.Create <IGTPoint>();
                m_llPoint.X = oMapExtents.BottomLeft.X;
                m_llPoint.Y = oMapExtents.BottomLeft.Y;

                m_oPoly.Points.Add(m_ulPoint);
                m_oPoly.Points.Add(m_urPoint);
                m_oPoly.Points.Add(m_lrPoint);
                m_oPoly.Points.Add(m_llPoint);

                this.oLocationCriteria = (IGTGeometry)m_oPoly;

                if (this.oLocationCriteria == null)
                {
                    throw new Exception("Map extents are null.");
                }
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "GTStreetLight.SetupLocationCriteria", ex);
                throw ex;
            }
        }
コード例 #15
0
        private void DoSymbolGeometryByFID(List <AssetHistory> objHistList)
        {
            try
            {
                IGTGeometry[] arrSymbolGeoms = new IGTGeometry[objHistList.Count];
                object[]      arrStyleIDs    = new object[objHistList.Count];
                object[]      arrToolTips    = new object[objHistList.Count];
                string        sDisplayName   = string.Empty;

                IGTOrientedPointGeometry oPointGeom = GTClassFactory.Create <IGTOrientedPointGeometry>();

                int iSymbol = 0;
                foreach (AssetHistory objToUse in objHistList)
                {
                    IGTPoint apoint = GTClassFactory.Create <IGTPoint>();
                    apoint.X = objToUse.OGG_X1;
                    apoint.Y = objToUse.OGG_Y1;
                    apoint.Z = objToUse.OGG_Z1;

                    oPointGeom.Origin = apoint;

                    arrSymbolGeoms    = new IGTGeometry[1];
                    arrSymbolGeoms[0] = (IGTGeometry)oPointGeom;

                    arrStyleIDs    = new object[1];
                    arrStyleIDs[0] = this.oGenParams.HistoricalSymbol;

                    string sToolTip = "FID " + objToUse.G3E_FID.ToString();
                    arrToolTips    = new object[1];
                    arrToolTips[0] = sToolTip;

                    sDisplayName = sToolTip + " " + iSymbol.ToString();


                    this.oDisplay.AppendTemporaryGeometries(this.sDisplayPathName, sDisplayName, arrSymbolGeoms, arrStyleIDs, arrToolTips, true, true);
                    iSymbol += 1;
                }

                this.oApp.RefreshWindows();
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "DoSymbolGeometry", ex);
                throw ex;
            }
        }
コード例 #16
0
        private bool AssignClipGeometryToFrame(IGTApplication oApp, IGTPlotFrame apf, IGTPolygonGeometry clipPG)
        {
            bool bReturn = false;

            apf.Activate();

            // Need to Zoom out a little more as the WorldToPaper seems to fail on pts that are on the edge.
            IGTPoint    originPt       = GTClassFactory.Create <IGTPoint>(0, 0, 0);
            IGTGeometry prClipBufferPG = ((IGTGeometry)clipPG).CopyGeometryParallel(originPt, 2);

            apf.PlotMap.ZoomArea(prClipBufferPG.Range);
            apf.ClipGeometry = GetClipBoundary(oApp, clipPG);
            apf.IsClipped    = true;
            apf.Deactivate();
            oApp.RefreshWindows();
            bReturn = true;
            return(bReturn);
        }
コード例 #17
0
        /// <summary>
        /// Intialize variables and check selected feature is valid.
        /// </summary>
        /// <param name="CustomCommandHelper"></param>
        public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_oGTCustomCommandHelper = CustomCommandHelper;
                m_oGTApplication.BeginWaitCursor();

                if (m_oGTApplication.SelectedObjects.FeatureCount > 0)
                {
                    //Get Source feature FNO,FID
                    m_sourceFNO = m_oGTApplication.SelectedObjects.GetObjects()[0].FNO;
                    m_sourceFID = m_oGTApplication.SelectedObjects.GetObjects()[0].FID;

                    //Get Primary Graphic component
                    m_primaryGeoCNO = GetPrimaryGeographicCNO(m_sourceFNO);
                    int m_componentType = GetComponentType(m_primaryGeoCNO);

                    //if selected feature is not valid then show the error message
                    if ((m_componentType != 8) || (!ValidateSelectedFeature(m_sourceFNO)))
                    {
                        MessageBox.Show(sValidationMsg, sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        ExitCommand();
                    }
                    else
                    {
                        //subscribe the events
                        SubscribeEvents();

                        //Get target feature FNO and source geometry
                        m_targetFNO    = GetTargetFeature(m_sourceFNO);
                        m_gSrcGeometry = m_oGTApplication.SelectedObjects.GetObjects()[0].Geometry;

                        m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, sStatusBarMsg1);
                        m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpCrossHair;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message, sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                ExitCommand();
            }
        }
コード例 #18
0
        public void Terminate()
        {
            try
            {
                UnsubscribeEvents();

                if (m_oEditService != null)
                {
                    if (m_oEditService.GeometryCount > 0)
                    {
                        m_oEditService.RemoveAllGeometries();
                    }
                }

                m_oGTApplication.Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                if (m_oGTTransactionManager != null && m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                    m_oGTTransactionManager.RefreshDatabaseChanges();
                }
                m_oGTApplication.EndWaitCursor();
                m_oGTApplication.SelectedObjects.Clear();
                m_oGTApplication.RefreshWindows();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message, m_sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                m_oGTApplication         = null;
                m_oGTCustomCommandHelper = null;
                m_osrcGeometry           = null;
                m_otrgFeature            = null;
                m_trgComponent           = null;
                m_oEditService           = null;
                m_oGTTransactionManager  = null;
                m_EditObjects            = null;
                m_locatedObjects         = null;
                m_snapPoint = null;
            }
        }
コード例 #19
0
ファイル: CommonIPTCode.cs プロジェクト: git786hub/DLL
        /// <summary>
        /// Get Point And Angle
        /// </summary>
        /// <param name="m_gtPolylineGeom"></param>
        /// <param name="m_gtPoint">Related Virtual point</param>
        /// <returns></returns>
        protected IGTPoint GetPointAndAngle(IGTGeometry m_gtPolylineGeom, IGTPoint m_gtPoint)
        {
            bool     flag = false;
            IGTPoint m_gtProjectedPoint = null;
            //Get snappoint if the point feature is not snapped to the linear
            IGTPoint m_gtsnapPoint = GetSnapPoint(m_gtPolylineGeom, m_gtPoint);

            try
            {
                //Check if the geometry is linear
                if ((m_gtPolylineGeom.Type == "CompositePolylineGeometry") || (m_gtPolylineGeom.Type == "PolylineGeometry"))
                {
                    IGTSegment m_segment = GTClassFactory.Create <IGTSegment>();
                    //get the segment
                    for (int i = 0; i < m_gtPolylineGeom.KeypointCount - 1; i++)
                    {
                        m_segment.Begin = m_gtPolylineGeom.GetKeypointPosition(i);
                        m_segment.End   = m_gtPolylineGeom.GetKeypointPosition(i + 1);
                        if (m_gtsnapPoint.IsOn(m_segment))
                        {
                            flag = true;
                            ang  = AngleBetweenTwoPoints(m_segment.Begin, m_segment.End);
                            break;
                        }
                        else
                        {
                            // m_gtProjectedPoint = m_gtsnapPoint;
                        }
                    }
                    if (flag)
                    {
                        m_gtProjectedPoint = m_segment.ProjectPointAtAngle(m_segment.Begin, m_gtsnapPoint, ang);
                    }
                }
                return(m_gtProjectedPoint);
            }
            catch
            {
                throw;
            }
        }
コード例 #20
0
 private IGTCompositePolylineGeometry BuildAreaGeometryFromPoint(IGTPoint point, double distance)
 {
     try
     {
         IGTArcGeometry arcGeometry = GTClassFactory.Create <IGTArcGeometry>();
         IGTCompositePolylineGeometry compositePolylineGeometry = GTClassFactory.Create <IGTCompositePolylineGeometry>();
         IGTVector vector = GTClassFactory.Create <IGTVector>();
         vector.I = 0;
         vector.J = 0;
         vector.K = 1;
         IGTGeometry geometry = arcGeometry.ComputeArcByOriginAndAngles(point, vector, distance, 0.0, Math.PI);
         compositePolylineGeometry.Add(geometry);
         geometry = arcGeometry.ComputeArcByOriginAndAngles(point, vector, distance, Math.PI, 2 * Math.PI);
         compositePolylineGeometry.Add(geometry);
         return(compositePolylineGeometry);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #21
0
 /// <summary>
 /// Get snap point
 /// </summary>
 /// <param name="sourceGeometry"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 private IGTPoint GetSnapPoint(IGTGeometry sourceGeometry, IGTPoint point)
 {
     try
     {
         IGTSnapService snap = GTClassFactory.Create <IGTSnapService>();
         snap.SnapTolerance    = 1;
         snap.SnapTypesEnabled = GTSnapTypesEnabledConstants.gtssAllSnaps;
         IGTPoint snapPt; IGTGeometry snapGeom; double distance;
         snap.SnapToGeometry(sourceGeometry, point, out snapPt, out snapGeom, out distance);
         if (distance < snap.SnapTolerance)
         {
             snap.SnapTolerance = distance;
             point = snapPt;
         }
         snap = null;
         return(point);
     }
     catch
     {
         throw;
     }
 }
コード例 #22
0
        /// <summary>
        /// This method performs point in polygon query and if the point exists inside polygon, then it returns the boundary feature recordset
        /// </summary>
        /// <returns></returns>
        public Recordset PerformPointInPolygon()
        {
            Recordset resultRecordSet = null;

            try
            {
                IGTSpatialService spatialService = GTClassFactory.Create <IGTSpatialService>();
                spatialService.DataContext = m_iGtDataContext;

                if (this.m_boundaryFid == 0)
                {
                    spatialService.Operator = GTSpatialOperatorConstants.gtsoEntirelyContainedBy;
                    IGTOrientedPointGeometry pointGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>();
                    IGTPoint gtPoint = GTClassFactory.Create <IGTPoint>();
                    gtPoint.X                     = m_iGtpoint.X;
                    gtPoint.Y                     = m_iGtpoint.Y;
                    gtPoint.Z                     = 0;
                    pointGeometry.Origin          = gtPoint;
                    spatialService.FilterGeometry = pointGeometry;
                    resultRecordSet               = spatialService.GetResultsByFNO(new short[] { this.m_boundaryFno });
                    return(resultRecordSet);
                }
                // FID is provided. Retrieve the geometry of the boundary feature and check whether the boundary contains the point
                IGTKeyObject boundaryFeature  = m_iGtDataContext.OpenFeature(this.m_boundaryFno, this.m_boundaryFid);
                IGTGeometry  boundaryGeometry = (IGTGeometry)boundaryFeature.Components.GetComponent(FnoGraphicCnoPair[this.m_boundaryFno]).Geometry;
                spatialService.Operator       = GTSpatialOperatorConstants.gtsoEntirelyContains;
                spatialService.FilterGeometry = boundaryGeometry;
                resultRecordSet = spatialService.GetResultsByFNO(new short[] { this.m_pointFno });
                if (resultRecordSet != null && resultRecordSet.RecordCount > 0)
                {
                    resultRecordSet = boundaryFeature.Components.GetComponent(FnoGraphicCnoPair[this.m_boundaryFno]).Recordset;
                }
                return(resultRecordSet);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #23
0
        /// <summary>
        /// Method create new polygon
        /// </summary>
        /// <param name="m_TargetPolygon"></param>
        /// <returns></returns>
        private IGTCompositePolygonGeometry CreatePolygon(IGTGeometry m_gTargetPolygon)
        {
            IGTPolylineGeometry         m_gPolylineGeometry         = GTClassFactory.Create <IGTPolylineGeometry>();
            IGTCompositePolygonGeometry m_gCompositePolygonGeometry = GTClassFactory.Create <IGTCompositePolygonGeometry>();
            IGTGeometryCollection       m_gGeometryCollection       = GTClassFactory.Create <IGTGeometryCollection>();

            try
            {
                //Remove duplicate points from New polygon
                for (int i = 0; i < m_gTargetPolygon.KeypointCount; i++)
                {
                    if (i > 0 && i < m_gTargetPolygon.KeypointCount - 1)
                    {
                        if (!m_gTargetPolygon.GetKeypointPosition(i).PointsAreEqual(m_gTargetPolygon.GetKeypointPosition(i + 1)))
                        {
                            m_gPolylineGeometry.Points.Add(m_gTargetPolygon.GetKeypointPosition(i));
                        }
                    }
                    else
                    {
                        m_gPolylineGeometry.Points.Add(m_gTargetPolygon.GetKeypointPosition(i));
                    }
                }

                //Add polylines to the collection
                m_gGeometryCollection.Add(m_gPolylineGeometry);

                //Build composite polygon
                foreach (IGTPolylineGeometry m_gtPolylineGeometry in m_gGeometryCollection)
                {
                    m_gCompositePolygonGeometry.Add(m_gtPolylineGeometry);
                }
                return(m_gCompositePolygonGeometry);
            }
            catch
            {
                throw;
            }
        }
コード例 #24
0
        /// <summary>
        /// Creates new workpoint feature.
        /// </summary>
        private void CreateNewWorkpointFeature(short fno, int fid, bool isLinear, string strStructureID, int ownerCount,
                                               short formationOwnerFno = 0, int formationOwnerFid = 0)
        {
            try
            {
                IGTGeometry gTGeometry = null;

                if (fno == 2400)
                {
                    gTGeometry = m_dataContext.OpenFeature(formationOwnerFno, formationOwnerFid).Components.GetComponent(m_gtcommonFunctions.GetPrimaryGraphicCno(formationOwnerFno, true)).Geometry;
                }
                else
                {
                    gTGeometry = m_dataContext.OpenFeature(fno, fid).Components.GetComponent(m_gtcommonFunctions.GetPrimaryGraphicCno(fno, true)).Geometry;
                }

                customWorkPointCreator workPointCreator = new customWorkPointCreator(m_dataContext, gTGeometry.FirstPoint.X, gTGeometry.FirstPoint.Y);
                IGTKeyObject           workPointFeature = workPointCreator.CreateWorkPointFeature();

                if (fno == 2400)
                {
                    m_NewWorkpointFidList.Add(formationOwnerFid, workPointFeature.FID);
                    UpdateWorkpointComponents(formationOwnerFno, formationOwnerFid, workPointFeature, true, strStructureID, ownerCount, isLinear);
                }
                else
                {
                    m_NewWorkpointFidList.Add(fid, workPointFeature.FID);
                    UpdateWorkpointComponents(fno, fid, workPointFeature, true, strStructureID, ownerCount, isLinear);
                }



                //workPointCreator.SynchronizeWPCuLabel(workPointFeature);
            }
            catch
            {
                throw;
            }
        }
コード例 #25
0
 /// <summary>
 /// Get Top Origin Point
 /// </summary>
 /// <param name="m_gtLineGeometry"></param>
 /// <returns></returns>
 private IGTPoint GetTopOriginPoint(IGTGeometry m_gtLineGeometry)
 {
     try
     {
         IGTPoint m_gtTopOriginPoint = null;
         //create offset geoemtry
         IGTGeometry[] geoms = m_gtLineGeometry.CreateOffsetGeometries(xOffset);
         if ((m_rlnode1 != 0) && (m_rlnode1 == m_rpnode1))
         {
             m_gtTopOriginPoint = geoms[0].FirstPoint;
         }
         if ((m_rlnode2 != 0) && (m_rlnode2 == m_rpnode1))
         {
             m_gtTopOriginPoint = geoms[0].LastPoint;
         }
         return(m_gtTopOriginPoint);
     }
     catch
     {
         throw;
     }
 }
コード例 #26
0
        public void Execute()
        {
            double           dXoord         = 0.0;
            double           dYoord         = 0.0;
            double           dZoord         = 0.0;
            IGTGeometry      geometry       = null;
            IGTDDCKeyObjects oDDCKeyObjects = default(IGTDDCKeyObjects);

            IGTApplication igtApp = GTClassFactory.Create <IGTApplication>();

            oDDCKeyObjects = igtApp.SelectedObjects.GetObjects();

            foreach (IGTDDCKeyObject item in oDDCKeyObjects)
            {
                geometry = item.Geometry;
            }

            if (geometry != null)
            {
                dXoord = ((IGTPointGeometry)geometry).FirstPoint.X;
                dYoord = ((IGTPointGeometry)geometry).FirstPoint.Y;


                IGTPoint point = GTClassFactory.Create <IGTPoint>();
                point.X = dXoord;
                point.Y = dYoord;
                point.Z = 0.0;

                IGTComponent commonComponent = Components.GetComponent(1);
                if (commonComponent != null)
                {
                    if (commonComponent.Recordset.RecordCount > 0)
                    {
                        commonComponent.Recordset.MoveFirst();
                        commonComponent.Recordset.Fields["OGGX_H"].Value = point.X;
                        commonComponent.Recordset.Fields["OGGY_H"].Value = point.Y;
                    }
                }
                //ICoordSystemsMgr oCoordSystemsMgr;
                //oCoordSystemsMgr = (ICoordSystemsMgr)m_oDataContext.CoordSystemsMgr;
                //ICoordSystem oCoordSystem;
                //oCoordSystem = oCoordSystemsMgr.BaseCoordSystem;
                //double dMeters2Database = 1.0 / oCoordSystem.StorageToProjectionScale;



                //string strCurrDir = System.IO.Directory.GetCurrentDirectory();
                //ICoordSystemsMgr iCSM = new Intergraph.CoordSystems.CoordSystemsMgr();
                //ICoordSystem iCS = iCSM.BaseCoordSystem;
                //iCS.LoadFromFile(strCurrDir + "\\StatePlane.csf");

                //ICoordSystem iTargCS = new Intergraph.CoordSystems.CoordSystem();

                //	//iTargCS.LoadFromFile(strCurrDir + "\\EPSG4326.csf");
                //iTargCS.LoadFromFile(strCurrDir + "\\0061_WGS84.csf");
                //IAltCoordSystemPath iACSP = iCSM.CreateNamedPath("CSFFileConvert");
                //ILinkableTransformation iLink = iACSP.CreateLinkableTransformation("CSFFileConvert", Intergraph.CoordSystems.CSTransformLinkConstants.cstlCoordinateSystem);
                //ICoordSystem altCS = (ICoordSystem)iLink;
                //((ICopyable<ICoordSystem>)iTargCS).CopyInto(altCS);
                //iACSP.AddChainLink(iLink, true, Intergraph.CoordSystems.CSTransDirectionConstants.cstdForward);
                //ILinkableTransformation iTrans = (ILinkableTransformation)iACSP;
                //iTrans.TransformPoint(Intergraph.CoordSystems.CSPointConstants.cspENU, 1, Intergraph.CoordSystems.CSPointConstants.cspLLG, 2, ref dXoord, ref dYoord, ref dZoord);
                //MessageBox.Show(dXoord + "   " + dYoord);

                //---------------------------------------------------------------------------------------------------------------------------

                Intergraph.CoordSystems.Interop.CoordSystemClass coords = new CoordSystemClass();
                int             outrec = 0;
                ADODB.Recordset rs     = DataContext.Execute("select c.*  from g3e_dataconnection_optable d , gcoordsystemtable  c where " +
                                                             " d.g3e_username ='******' and d.g3e_csname=c.name", out outrec, (int)ADODB.CommandTypeEnum.adCmdText, new object[0]);
                rs.MoveFirst();
                object[] rowformat = new object[rs.Fields.Count];
                for (int ifld = 0; ifld < rs.Fields.Count; ifld++)
                {
                    rowformat[ifld] = rs.Fields[ifld].Value;
                }
                coords.LoadFromGCoordSystemTableRowFormat(rowformat);


                coords.TransformPoint(Intergraph.CoordSystems.Interop.CSPointConstants.cspUOR, (int)Intergraph.CoordSystems.CSTransformLinkConstants.cstlDatumTransformation,
                                      Intergraph.CoordSystems.Interop.CSPointConstants.cspLLO, (int)Intergraph.CoordSystems.CSTransformLinkConstants.cstlDatumTransformation,
                                      ref dXoord, ref dYoord, ref dZoord);

                dXoord = dXoord * 180 / (4 * Math.Atan(1));
                dYoord = dYoord * 180 / (4 * Math.Atan(1));
            }
        }
コード例 #27
0
        /// <summary>
        /// Update MiscellaneousStructure components.
        /// </summary>
        /// <param name="p_GpsX">GPS X</param>
        /// <param name="p_GpsY">GPS Y</param>
        /// <param name="gtMiscellaneousStructureKO">MiscellaneousStructure Keyobject</param>
        /// <param name="p_ISNonLoc">Is MiscellaneousStructure locatable or not</param>
        private void UpdateMiscellaneousStructureComponents(double p_GpsX, double p_GpsY,
                                                            IGTKeyObject gtMiscellaneousStructureKO, bool p_ISNonLoc)
        {
            Recordset tempRs = null;

            try
            {
                foreach (IGTComponent gtCompo in gtMiscellaneousStructureKO.Components)
                {
                    if (gtCompo.CNO == 10702)
                    {
                        tempRs = gtCompo.Recordset;
                        if (tempRs != null)
                        {
                            if (tempRs.RecordCount > 0)
                            {
                                if (p_ISNonLoc)
                                {
                                    IGTGeometry bndryGeom = m_oGTDataContext.GetDDCKeyObjects(m_dataAccess.m_boundaryFNO,
                                                                                              m_dataAccess.m_boundaryFID, GTComponentGeometryConstants.gtddcgPrimaryGeographic)[0].Geometry;
                                    IGTPoint gtOrigin = CalculateCentroid(bndryGeom);
                                    IGTOrientedPointGeometry gtPointGeom = GTClassFactory.Create <IGTOrientedPointGeometry>();
                                    gtPointGeom.Origin = gtOrigin;

                                    gtCompo.Geometry = gtPointGeom;
                                    gtCompo.Recordset.Update();
                                }
                                else
                                {
                                    IGTPoint gTPoint = GTClassFactory.Create <IGTPoint>();
                                    gTPoint.X = p_GpsX;
                                    gTPoint.Y = p_GpsY;

                                    IGTPointGeometry gtPointGeom = GTClassFactory.Create <IGTOrientedPointGeometry>();
                                    gtPointGeom.Origin = gTPoint;

                                    gtCompo.Geometry = gtPointGeom;
                                    gtCompo.Recordset.Update();
                                }
                            }
                        }
                    }
                    else if (gtCompo.CNO == 10701)
                    {
                        if (p_ISNonLoc)
                        {
                            gtCompo.Recordset.Fields["TYPE_C"].Value = "SPNL";
                        }
                        else
                        {
                            gtCompo.Recordset.Fields["TYPE_C"].Value = "SP";
                        }
                        gtCompo.Recordset.Fields["g3e_fno"].Value = 107;
                        gtCompo.Recordset.Fields["g3e_fid"].Value = gtMiscellaneousStructureKO.FID;
                        gtCompo.Recordset.Fields["g3e_cno"].Value = gtCompo.CNO;
                        gtCompo.Recordset.Update();
                    }
                    else if (gtCompo.CNO == 1)
                    {
                        tempRs = gtCompo.Recordset;
                        if (tempRs != null)
                        {
                            if (tempRs.RecordCount > 0)
                            {
                                tempRs.MoveFirst();
                                if (!p_ISNonLoc)
                                {
                                    tempRs.Fields["FEATURE_STATE_C"].Value = "CLS";
                                }
                                tempRs.Fields["OWNED_TYPE_C"].Value = "CUSTOMER";
                                tempRs.Fields["G3E_CNO"].Value      = gtCompo.CNO;
                                tempRs.Update();
                                gtCompo.Recordset.Update();
                            }
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #28
0
 public bool AdjustGeometry(IGTGeometry BeforeGeometry)
 {
     return(true);
 }
コード例 #29
0
        /// <summary>
        /// Rotates input geometry relative to the reference geom
        /// </summary>
        /// <param name="ogeom"></param>
        /// <returns></returns>
        private void RotateGeom(IGTGeometry refGeom, ref IGTPolygonGeometry inpGeom)
        {
            double             dAngle    = 0;
            IGTPolygonGeometry oPolyGeom = null;

            try
            {
                if (refGeom == null || inpGeom == null)
                {
                    return;
                }
                if (refGeom.GetType().ToString() == "Intergraph.GTechnology.Private.GTOrientedPointGeometry")
                {
                    dAngle = AngleBetweenTwoPoints(((IGTOrientedPointGeometry)refGeom).Orientation);
                }
                else if (refGeom.GetType().ToString() == "Intergraph.GTechnology.Private.GTPolygonGeometry")
                {
                    oPolyGeom = (IGTPolygonGeometry)refGeom.Stroke();
                    dAngle    = AngleBetweenTwoPoints(oPolyGeom.Points[0], oPolyGeom.Points[1]);
                }

                if (dAngle < -90.0 || dAngle > 90.0)
                {
                    dAngle = dAngle + 180.0;
                }
                IGTVector transVec = GTClassFactory.Create <IGTVector>();

                if (inpGeom.GetType().ToString() == "Intergraph.GTechnology.Private.GTPolygonGeometry")
                {
                    // move and rotate the geometry to the correct position
                    if (m_ActiveMapWindow.DetailID == 0)
                    {
                        transVec.I = refGeom.FirstPoint.X * -1;
                        transVec.J = refGeom.FirstPoint.Y * -1;
                        transVec.K = refGeom.FirstPoint.Z * -1;
                    }
                    else
                    {
                        if (m_CentriodPoint != null)
                        {
                            transVec.I = m_CentriodPoint.X * -1;
                            transVec.J = m_CentriodPoint.Y * -1;
                            transVec.K = m_CentriodPoint.Z * -1;
                        }
                    }
                }

                IGTMatrix tmpTMatrix = GTClassFactory.Create <IGTMatrix>();
                tmpTMatrix = TranslationTransform(transVec);
                inpGeom    = (IGTPolygonGeometry)inpGeom.Multiply(inpGeom, tmpTMatrix);

                // rotate the geometry to the angle of the
                tmpTMatrix = GTClassFactory.Create <IGTMatrix>();
                tmpTMatrix = RotateZTransform(dAngle, 'D');
                inpGeom    = (IGTPolygonGeometry)inpGeom.Multiply(inpGeom, tmpTMatrix);

                transVec   = transVec.NegateVector(transVec);
                tmpTMatrix = GTClassFactory.Create <IGTMatrix>();
                tmpTMatrix = TranslationTransform(transVec);
                inpGeom    = (IGTPolygonGeometry)inpGeom.Multiply(inpGeom, tmpTMatrix);
            }

            catch (Exception)
            {
                throw;
            }

            finally
            {
            }
        }
コード例 #30
0
ファイル: customCreateTicket.cs プロジェクト: git786hub/DLL
        /// <summary>
        /// Get the pole attributes and populates Ticket Attributes class
        /// </summary>
        /// <returns>True, if Ticket Attributes are populated successfully. Else returns false</returns>
        private bool GetPoleAttributes()
        {
            string serviceAreaCode        = string.Empty;
            string countyBoundaryId       = string.Empty;
            int    nearestServicePointFid = 0;
            Dictionary <int, double> servicePointsDictionary = null;

            try
            {
                m_TicketAttributes = new TicketAttributes();
                IGTKeyObject gTKeyObject = m_DataContext.OpenFeature(110, m_PoleFid);
                Recordset    rs          = gTKeyObject.Components.GetComponent(1).Recordset;
                if (rs != null && rs.RecordCount > 0)
                {
                    rs.MoveFirst();
                    m_TicketAttributes.POLE_FID         = m_PoleFid;
                    m_TicketAttributes.POLE_NUMBER      = Convert.ToString(rs.Fields["STRUCTURE_ID"].Value);
                    m_TicketAttributes.MISCELLANEOUS_ID = m_WrNumber;
                    m_TicketAttributes.LATITUDE         = Convert.ToString(rs.Fields["LATITUDE"].Value);
                    m_TicketAttributes.LONGITUDE        = Convert.ToString(rs.Fields["LONGITUDE"].Value);
                }
                IGTGeometry geometry = gTKeyObject.Components.GetComponent(11002).Geometry;
                IGTPoint    point    = GTClassFactory.Create <IGTPoint>();
                point.X = geometry.FirstPoint.X;
                point.Y = geometry.FirstPoint.Y;
                point.Z = geometry.FirstPoint.Z;
                customBoundaryQuery boundaryQuery = new customBoundaryQuery(point, 235);// County boundary  FNO 235
                Recordset           resultRs1     = boundaryQuery.PerformPointInPolygon();
                if (resultRs1 != null && resultRs1.RecordCount > 0)
                {
                    IGTKeyObject countyFeature        = m_DataContext.OpenFeature(Convert.ToInt16(resultRs1.Fields["G3E_FNO"].Value), Convert.ToInt32(resultRs1.Fields["G3E_FID"].Value));
                    Recordset    boundaryAttributesRs = countyFeature.Components.GetComponent(23501).Recordset; // // County Boundary Attributes
                    if (boundaryAttributesRs != null && boundaryAttributesRs.RecordCount > 0)
                    {
                        boundaryAttributesRs.MoveFirst();
                        m_TicketAttributes.COUNTY = Convert.ToString(boundaryAttributesRs.Fields["NAME"].Value);
                        if (!string.IsNullOrEmpty(Convert.ToString(boundaryAttributesRs.Fields["ID"].Value)))
                        {
                            countyBoundaryId = Convert.ToString(boundaryAttributesRs.Fields["ID"].Value).Replace("TX", string.Empty).Trim();
                        }
                    }
                }
                if (!string.IsNullOrEmpty(countyBoundaryId))
                {
                    int nJunsMemberId = 0;

                    Recordset contactRs = GetRecordSet(string.Format("SELECT NJUNS_MEMBER_ID,CONTACT_NAME,CONTACT_PHONE FROM NJUNS_CONTACTS WHERE COUNTY_N_ID = {0}", countyBoundaryId));
                    if (contactRs != null && contactRs.RecordCount > 0)
                    {
                        contactRs.MoveFirst();
                        m_TicketAttributes.CONTACT_NAME  = Convert.ToString(contactRs.Fields["CONTACT_NAME"].Value);
                        m_TicketAttributes.CONTACT_PHONE = Convert.ToString(contactRs.Fields["CONTACT_PHONE"].Value);
                        // m_TicketAttributes.PLACE = Convert.ToString(contactRs.Fields["NJUNS_PLACE_NAME"].Value);
                        nJunsMemberId = Convert.ToInt32(contactRs.Fields["NJUNS_MEMBER_ID"].Value);
                        contactRs.Close();
                        contactRs = null;
                    }
                    contactRs = GetRecordSet(string.Format("SELECT NJUNS_MEMBER FROM NJUNS_MEMBER WHERE NJUNS_MEMBER_ID = {0}", nJunsMemberId));
                    if (contactRs != null && contactRs.RecordCount > 0)
                    {
                        contactRs.MoveFirst();
                        m_TicketAttributes.CREATED_MEMBER = Convert.ToString(contactRs.Fields["NJUNS_MEMBER"].Value);
                        m_TicketAttributes.POLE_OWNER     = Convert.ToString(contactRs.Fields["NJUNS_MEMBER"].Value);
                    }
                }

                customBufferQuery oCustomBufferQuery = new customBufferQuery(point, m_DistanceFromPoleInFeet, 55); //Closest Premise feature within 300 feet of the Pole. Service point FNO 55
                servicePointsDictionary = oCustomBufferQuery.PerformBufferQuery();
                if (servicePointsDictionary != null && servicePointsDictionary.Count > 0)
                {
                    servicePointsDictionary.OrderBy(key => key.Value);
                    nearestServicePointFid = servicePointsDictionary.First().Key;
                    IGTKeyObject servicePointFeature = m_DataContext.OpenFeature(55, nearestServicePointFid);
                    Recordset    premiseAttributesRs = servicePointFeature.Components.GetComponent(5504).Recordset; // PREMISE_N
                    if (premiseAttributesRs != null && premiseAttributesRs.RecordCount > 0)
                    {
                        premiseAttributesRs.MoveFirst();
                        m_TicketAttributes.HOUSE_NUMBER = Convert.ToString(premiseAttributesRs.Fields["HOUSE_NBR"].Value);
                        m_TicketAttributes.STREET_NAME  = Convert.ToString(premiseAttributesRs.Fields["DIR_LEADING_C"].Value) + " "
                                                          + Convert.ToString(premiseAttributesRs.Fields["STREET_NM"].Value) + " "
                                                          + Convert.ToString(premiseAttributesRs.Fields["STREET_TYPE_C"].Value) + " "
                                                          + Convert.ToString(premiseAttributesRs.Fields["DIR_TRAILING_C"].Value);
                    }
                }

                // Set default vaues
                m_TicketAttributes.TICKET_NUMBER   = string.Empty;
                m_TicketAttributes.TICKET_TYPE     = "Transfer";
                m_TicketAttributes.TICKET_STATUS   = "OPEN";
                m_TicketAttributes.STATE           = "TX";
                m_TicketAttributes.PRIORITY_CODE   = "3";
                m_TicketAttributes.NJUNS_TICKET_ID = -1;
                m_TicketAttributes.DAYS_INTERVAL   = "30";
                m_TicketAttributes.JOB_TYPE        = "Transfer";
                m_TicketAttributes.NUMBER_OF_POLES = "1";
                m_TicketAttributes.REMARKS         = string.Empty;
                return(true);
            }
            catch (Exception)
            {
                MessageBox.Show("Failed to populate some ticket attributes.", "Custom Create Ticket Error", MessageBoxButtons.OK);
                return(false);
            }
        }