コード例 #1
0
ファイル: SpiralCurveDialog.cs プロジェクト: EAWCS1/SUITT
        private void SpiralCurveDialog_Load(object sender, System.EventArgs e)
        {
            try
            {
                UID pUID;
                pUID = new UIDClass();
                pUID.Value = "esriEditor.TraverseWindow";
                m_pTraverseWindow = (ITraverseWindow)m_pEditor.FindExtension(pUID);

                IEditSketch2 pEditSketch2 = m_pEditor as IEditSketch2;
                IGeometry pGeom = pEditSketch2.Geometry;

                IPolycurve pPolycurve = pGeom as IPolycurve;

                m_pLine = new LineClass();
                pPolycurve.QueryTangent(esriSegmentExtension.esriExtendTangentAtTo,1.0,true,1000,m_pLine);

                Debug.WriteLine("Tangent Direction in radians: ", m_pLine.Angle.ToString() );
                Debug.WriteLine("Tangent Direction in degrees: ", utils.Rad2Deg(m_pLine.Angle).ToString() );

                // set the tangent bearing
                txtBearing.Text = RadiansToAngularDefaultUnits(m_pLine.Angle);

                // set some tool tips
                toolTip1.SetToolTip(txtBearing,"Direction Type: " + utils.DirectionTypeToString(m_pEditProp2.DirectionType) + "\n" +
                    "Direction Units: " + utils.DirectionUnitsToString(m_pEditProp2.DirectionUnits) );

                toolTip1.SetToolTip(txtChordLength,"The following Units are support: \n" +
                    String.Join(",", this.AllowedUnits));
                #region add tangent graphic to map for debugging purposes
                /*
                try
                {
                    ISegmentCollection pSegCollec = new PolylineClass() as ISegmentCollection;
                    object missing = System.Reflection.Missing.Value;

                    pSegCollec.AddSegment((ISegment)m_pLine,ref missing,ref missing);
                    IPolyline pPolylineGr = new PolylineClass();
                    pPolylineGr = (IPolyline)pSegCollec;

                    IElement pElement = new LineElementClass();
                    pElement.Geometry = pPolylineGr;

                    IGraphicsContainer pGC = (IGraphicsContainer)m_pMxDoc.FocusMap;
                    pGC.AddElement(pElement,0);
                    m_pMxDoc.ActiveView.Refresh();

                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                */
                #endregion
            }
            catch
            {
                this.Close();
            }
        }
コード例 #2
0
ファイル: Stationing.cs プロジェクト: EAWCS1/SUITT
        public override void OnCreate(object hook)
        {
            if (hook != null)
            {
                if (hook is IMxApplication)
                {
                    m_app = (IApplication) hook;

                    try
                    {
                        m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                    }
                    catch
                    { }

                    UID pUID;
                    pUID = new UIDClass();
                    pUID.Value = "esriEditor.Editor";
                    m_pEditor = (IEditor)m_app.FindExtensionByCLSID(pUID);

                    pUID.Value = "esriEditor.TraverseWindow";
                    m_pTraverseWindow = (ITraverseWindow)m_pEditor.FindExtension(pUID);

                }
            }
        }
コード例 #3
0
ファイル: Stationing.cs プロジェクト: EAWCS1/SUITT
        public override void OnClick()
        {
            try
            {
                UID pUID = new UIDClass();
                try
                {
                    // TODO:
                    IDocument pDoc = m_app.Document;
                    ICommandItem pCommandItem;
                    pUID.Value = "{9EBF3A1E-D0C0-11D0-802D-0000F8037368}"; //edit tool
                    pUID.SubType = 0;
                    pCommandItem = pDoc.CommandBars.Find(pUID,false,false);

                    m_app.CurrentTool = pCommandItem;
                }
                catch{}

                pUID = new UIDClass();
                pUID.Value = "esriEditor.TraverseWindow";
                m_pTraverseWindow = (ITraverseWindow)m_pEditor.FindExtension(pUID);

                IPoint pPoint = m_pTraverseWindow.StartPoint;

                bool hasStartPoint = true;

                if (pPoint == null)
                {
                    hasStartPoint = false;
                    Debug.WriteLine("pPoint = null");
                }

                IEditSketch pEditSketch = (IEditSketch)m_pEditor;
                if (pEditSketch.Geometry.IsEmpty == true)
                {
                    hasStartPoint = false;
                }

                if (!hasStartPoint)
                {
                    MessageBox.Show("You need to have the start point defined in the Traverse Dialog first","Stationing Tool");
                    m_pTraverseWindow.Visible = true;
                    return;
                }

                Debug.WriteLine(pPoint.X + " " + pPoint.Y);

                if (m_pTraverseWindow.Visible == false)
                {
                    m_pTraverseWindow.Visible = true;
                }

                frmStationing = new StationingDialog(ref m_app,ref m_pEditor);

                //ISDUTExtension theExt = null;
                try
                {

                    //IExtension pExt = m_app.FindExtensionByName("SUITT Extension");
                    //theExt = pExt as ISDUTExtension;

                    Form frm = (Form)frmStationing;

                    util.RegistryHelper.set_ApplicationKey(m_pISDUTExt.RegistryKey);
                    util.RegistryHelper.applyFormBounds("StationingDialog", ref frm);
                    frmStationing.formSettings = util.RegistryHelper.readValue("cogo.ui.StationingDialog.formSettings");
                }
                catch{}

                //SetWindowLongA(frmStationing.Handle.ToInt32(), GWL_HWNDPARENT, this.m_app.hWnd);
                frmStationing.ShowDialog();

            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            finally
            {
                //util.Utils.Release(m_pTraverseWindow);
                //m_pTraverseWindow = null;
            }
        }
コード例 #4
0
ファイル: StationingDialog.cs プロジェクト: EAWCS1/SUITT
        private void StationingDialog_Load(object sender, System.EventArgs e)
        {
            try
            {
                UID pUID;
                pUID = new UIDClass();
                pUID.Value = "esriEditor.TraverseWindow";
                m_pTraverseWindow = (ITraverseWindow)m_pEditor.FindExtension(pUID);

                try
                {
                    IEditSketch2 pEditSketch2 = m_pEditor as IEditSketch2;
                    IGeometry pGeom = pEditSketch2.Geometry;

                    IPolycurve pPolycurve = pGeom as IPolycurve;

                    m_pLine = new LineClass();
                    pPolycurve.QueryTangent(esriSegmentExtension.esriExtendTangentAtTo,1.0,true,1000,m_pLine);

                    // set the tangent bearing
                    txtBearing.Text = RadiansToAngularDefaultUnits(m_pLine.Angle);

                }
                catch{}

                // set some tool tips
                toolTip1.SetToolTip(txtBearing,"Direction Type: " + utils.DirectionTypeToString(m_pEditProp2.DirectionType) + "\n" +
                    "Direction Units: " + utils.DirectionUnitsToString(m_pEditProp2.DirectionUnits) );

            //				toolTip1.SetToolTip(txtStartStation,"The following Units are support: \n" +
            //					String.Join(",", this.AllowedUnits));
            //
            //				toolTip1.SetToolTip(txtEndStation,"The following Units are support: \n" +
            //					String.Join(",", this.AllowedUnits));

                string GGonoff = "off";
                if (m_pEditProp2.UseGroundToGrid == true)
                    GGonoff = "on";

                toolTip1.SetToolTip(txtStartStation,"Ground To Grid Correction is: " + GGonoff + "\n" +
                    "Distance Correction Factor is: " + m_pEditProp2.DistanceCorrectionFactor);

                toolTip1.SetToolTip(txtEndStation,"Ground To Grid Correction is: " + GGonoff + "\n" +
                    "Distance Correction Factor is: " + m_pEditProp2.DistanceCorrectionFactor);

            }
            catch
            {
                this.Close();
            }
        }