Beispiel #1
0
        /// <summary>
        /// Updates a specific feature.
        /// </summary>
        /// <param name="update">The feature selected for update.</param>
        /// <returns>True if feature accepted for update. False if an update is already in progress.</returns>
        internal bool Run(Feature update)
        {
            // Return if we're currently updating something, or we've
            // hit a problem during rollforward.
            if (m_Cmd != null || m_Problem != null)
            {
                return(false);
            }

            // If we prevously had something selected for update,
            // undo any drawing that we did for it.
            ErasePainting();

            // Remember the specified feature.
            m_SelectedFeature = update;

            // If the info dialog has not already been displayed, display it now.
            if (m_Info == null)
            {
                m_Info = new UpdateForm(this);
                m_Info.Show();
            }

            // Get the info window to display stuff about the selected feature.
            m_Info.Display(m_SelectedFeature);

            // Leave keyboard focus with the info dialog.
            m_Info.Focus();

            // Draw stuff.
            Draw();
            ActiveDisplay.PaintNow();
            return(true);
        }
Beispiel #2
0
        override public bool Execute()
        {
            ActiveDisplay.Delete();
            var images = new ImageList();

            ActiveImage = images[images.Count - 1];
            return(true);
        }
Beispiel #3
0
        internal void FinishCommand(CommandUI cmd)
        {
            if (!Object.ReferenceEquals(cmd, m_Command))
            {
                throw new InvalidOperationException();
            }

            /*
             *      if ( pCmd->GetCommandId() == ID_FILE_PRINT_WINDOW )
             *      {
             *              CuiGetRectangle* pRect = dynamic_cast<CuiGetRectangle*>(pCmd);
             *              CeVertex corners[5];
             *              if ( pRect->GetCorners(corners) )
             *                      m_PrintData.SetPrintCorners(corners);
             *              else
             *              {
             *                      m_PrintData.SetPrintCorners(0);
             *                      m_PrintData.SetRotation(0.0);
             *              }
             *      }
             */
            SetNormalCursor();

            // Refresh everything from the model. This may seem a bit of an effort, considering
            // that many edits don't do much to the display (some don't do anything). However,
            // it's fast and keeps things clean in more complex cases. Do it before saving the
            // map model, since it gives the impression that things are more responsive than
            // they actually are!
            RefreshAllDisplays();

            // Notify any check dialog (re-check all potential problems).
            // And repaint immediately to avoid flicker (icons wouldn't otherwise be repainted
            // until the idle handler gets called)
            if (m_Check != null)
            {
                m_Check.OnFinishOp();
                ActiveDisplay.PaintNow();
            }

            // Re-enable auto-highlighting if it was on before.
            if (m_IsAutoSelect < 0)
            {
                m_IsAutoSelect = -m_IsAutoSelect;
            }

            /*
             * if ( pCmd->GetCommandId() == ID_FEATURE_UPDATE )
             *  GetDocument()->OnFinishUpdate();
             * else
             *  FinishEdit((INT4)m_pCommand);
             * // m_pAutoSaver->FinishEdit(edid);
             */

            m_Command.Dispose();
            m_Command = null;
        }
Beispiel #4
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            if (_activeDisplay != null)
            {
                _activeDisplay.DisplayDeviceChanged -= DisplayDeviceChanged;
                _activeDisplay.Dispose();
                _activeDisplay = null;
            }
        }
 public static string ShowFileDialog(ActiveDisplay activeDisplay)
 {
     OpenFileDialog openFile = new OpenFileDialog();
     openFile.Multiselect = false;
     openFile.RestoreDirectory = true;
     openFile.Filter = @"PowerPoint Presentations|*.ppt";
     ;
     if (openFile.ShowDialog() == DialogResult.OK)
     {
         return openFile.FileName;
     }
     else
     {
         return null;
     }
 }
Beispiel #6
0
        /// <summary>
        /// Defines the dimensions of the text that's being added. For this to
        /// work, the <see cref="Entity"/> property must be defined beforehand.
        /// </summary>
        /// <param name="str">The text involved</param>
        /// <returns>True if dimensions set ok. False if the entity type
        /// was not defined, or it does not have an associated font.</returns>
        protected bool SetDimensions(string str)
        {
            // Confirm the entity type has been defined
            if (m_Entity == null)
            {
                MessageBox.Show("AddLabelUI.SetDimensions - Text type not specified.");
                DialFinish(null);
                return(false);
            }

            // Remember the text that the dimensions correspond to
            m_Text = str;

            // The entity type provides the height of the text (in point units)
            IFont fontInfo = m_Entity.Font;

            if (fontInfo == null)
            {
                fontInfo = FontInfo.Default;
            }

            // Figure out the ground height at the map's nominal scale
            float  fontSize     = fontInfo.PointSize;
            uint   nominalScale = EditingController.Current.Project.Settings.NominalMapScale;
            double ht           = (double)fontSize * (double)nominalScale * MathConstants.POINTSIZE_TO_METERS;

            // Convert into pixels on the active display
            float htPixels = ActiveDisplay.LengthToDisplay(ht);
            Font  font     = new Font(fontInfo.TypeFace, htPixels, fontInfo.Modifiers, GraphicsUnit.Pixel);

            // Get the size of the text
            Size proposedSize = new Size(int.MaxValue, int.MaxValue);
            Size size         = TextRenderer.MeasureText(str, font, proposedSize,
                                                         (TextFormatFlags.NoPadding | TextFormatFlags.NoClipping | TextFormatFlags.NoPrefix));

            // Remember the width and height of the text, in ground units (if
            // we stored logical units, the meaning of the values might change
            // if the scale changed during label positioning).
            ISpatialDisplay display = ActiveDisplay;

            m_Width  = display.DisplayToLength((float)size.Width);
            m_Height = display.DisplayToLength((float)size.Height);

            // Reset the position of the last text outline that was drawn.
            m_LastPos = null;
            return(true);
        }
Beispiel #7
0
        /// <summary>
        /// Called by the Authority to tell this surface to detach its current display.
        /// </summary>
        /// <param name="pDisplay">The display to detach.  Must be the current display.</param>
        internal void Authority_DetachDisplay(Display pDisplay)
        {
            // If this surface already has a display, raise an error.
            if (ActiveDisplay == null)
            {
                throw new Exception("Surface does not have a display attached.");
            }

            // Check the specified display is the display we want to unbind.
            if (pDisplay != ActiveDisplay)
            {
                throw new Exception("Surface cannot remove specified display because a different one is attached.");
            }

            // Signal the display to unbind from this.
            ActiveDisplay.Surface_UnbindFromSurface(this);

            // Remove the reference to the rendered control.
            //   n.b. this will already likely have been called by Surface_UnbindFromSurface
            Display_SetVisual(null);
            Display_ResetVisualRenderSize();

            // Set our opacity back to fully shown (defensive incase the display does not put it back).
            ContentOpacity = 1.0;

            // Uncomment this if we want transient projection surfaces.

            /*
             * // Remove the projection surface from the projection.
             * ProjectionRenderer.RemoveDisplay(pProjectionDisplay);
             */

            // Set the active display pointer.
            ActiveDisplay = null;

            // Raise the event for display change.
            if (OnDisplayChanged != null)
            {
                OnDisplayChanged(this);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Handles a key up event
        /// </summary>
        /// <param name="sender">The display where the key event originated</param>
        /// <param name="k">Information about the event</param>
        public override void KeyUp(ISpatialDisplay sender, KeyEventArgs k)
        {
            // Whereas Control.ModifierKeys sees Keys.Control, the KeyUp event passes Keys.ControlKey
            if (k.KeyCode == Keys.ControlKey && m_Sel != null)
            {
                // Grab the selected items (if any) and merge any currently selected features.
                Selection s = m_Sel.Selection;
                FreeAreaSelectionTool();
                if (s.Count > 0)
                {
                    s.AddRange(this.SpatialSelection.Items);
                    SetSelection(s);
                }

                // Ensure everything is back to normal
                ActiveDisplay.RestoreLastDraw();

                // Force any prior selection to show
                m_HasSelectionChanged = true;
                //ActiveDisplay.PaintNow();
            }
        }
Beispiel #9
0
        /// <summary>
        /// Cancels all updates.
        /// </summary>
        internal void Cancel()
        {
            // No can do if an update is currently in progress!
            if (m_Cmd != null)
            {
                string msg = "You are in the middle of making an update." + System.Environment.NewLine;
                msg += "You must cancel that first.";
                MessageBox.Show(msg);
                return;
            }

            // If we've currently got a problem, treat the cancellation
            // request as a request to undo just the last revision
            if (m_CurrentUpdate != null)
            {
                m_CurrentUpdate.RevertChanges();
                m_CurrentUpdate = null;
                m_Problem       = null;

                CadastralMapModel model = CadastralMapModel.Current;
                model.EnsureFeaturesAreIndexed();
                model.CleanEdit();

                if (m_SelectedFeature != null)
                {
                    Run(m_SelectedFeature);
                }

                m_Info.OnFinishUpdate(null);
                ActiveDisplay.Redraw();
            }
            else
            {
                // If we saved any updates, undo them all.
                UndoAll();

                FinishCommand();
            }
        }
Beispiel #10
0
 /// <summary>
 /// Indicates that any painting previously done by a command should be erased. This
 /// tells the command's active display that it should revert the display buffer to
 /// the way it was at the end of the last draw from the map model. Given that a command
 /// supports painting, it's <c>Paint</c> method will be called during idle time.
 /// </summary>
 void ErasePainting()
 {
     ActiveDisplay.RestoreLastDraw();
 }
Beispiel #11
0
        public MainWindow()
        {
            InitializeComponent();

            _activeDisplay = new ActiveDisplay();
        }