コード例 #1
0
ファイル: NewPointForm.cs プロジェクト: 15831944/backsight
        /// <summary>
        /// Creates a new point, based on the information stored in the
        /// dialog. It is assumed that validation has already been done (see OnOK).
        /// </summary>
        /// <returns></returns>
        internal PointFeature Save()
        {
            // Handle 3D points some other day
            if (Math.Abs(m_Elevation) > Double.Epsilon)
            {
                throw new NotImplementedException("NewPointForm.Save - 3D points not currently supported");
            }

            try
            {
                NewPointOperation op  = new NewPointOperation();
                IEntity           ent = entityTypeComboBox.SelectedEntityType;
                DisplayId         did = (DisplayId)idComboBox.SelectedItem;
                FeatureId         fid = (did == null ? null : did.CreateId());
                op.Execute(m_Position, ent, fid);
                return(op.Point);
            }

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

            return(null);
        }
コード例 #2
0
ファイル: NewPointForm.cs プロジェクト: 15831944/backsight
        internal NewPointForm(CommandUI cmd, string title, Operation recall)
        {
            InitializeComponent();

            m_Cmd       = cmd;
            m_Position  = new Position(0.0, 0.0);
            m_Elevation = 0.0;
            m_Title     = (title == null ? String.Empty : title);

            NewPointOperation op = (recall as NewPointOperation);

            if (op != null)
            {
                PointFeature pt = op.Point;
                m_Position.X = pt.X;
                m_Position.Y = pt.Y;

                IPointGeometry pg = pt.Geometry;
                if (pg is IPosition3D)
                {
                    m_Elevation = (pg as IPosition3D).Z;
                }
            }
        }