/// <summary> /// Creates a <c>SpatialController</c> with a map model that's suitable /// for use at design time. /// </summary> public SpatialController() { s_Controller = this; m_Data = new DesignTimeMapModel(); m_Selection = new SpatialSelection(); m_Displays = new List<ISpatialDisplay>(); // Initialize map model in case any of the prelim stuff needs it (the // running application needs to replace it with something more appropriate). SetMapModel(m_Data, null); }
/// <summary> /// Creates a <c>SpatialController</c> with a map model that's suitable /// for use at design time. /// </summary> public SpatialController() { s_Controller = this; m_Data = new DesignTimeMapModel(); m_Selection = new SpatialSelection(); m_Displays = new List <ISpatialDisplay>(); // Initialize map model in case any of the prelim stuff needs it (the // running application needs to replace it with something more appropriate). SetMapModel(m_Data, null); }
public void SetMapModel(ISpatialModel model, IWindow initialDrawExtent) { m_Data = model; SetSelection(null); foreach (ISpatialDisplay display in m_Displays) { display.ReplaceMapModel(initialDrawExtent); } // Ensure the active display has focus (so that it reacts to any mouse-wheel events) ISpatialDisplay ad = ActiveDisplay; if (ad != null) { ad.MapPanel.Focus(); } }
private void OnIdle(object sender, EventArgs e) { m_Actions.Update(); double mapScale = mapControl.MapScale; mapScaleLabel.Text = (Double.IsNaN(mapScale) ? "Scale undefined" : String.Format("1:{0:0}", mapScale)); ISpatialModel model = m_Controller.MapModel; if (model == null) { this.Text = "Cadastral Viewer (nothing opened)"; } else { this.Text = model.Name; } mnuViewStatusBar.Checked = statusStrip.Visible; }
public void SetMapModel(ISpatialModel model, IWindow initialDrawExtent) { m_Data = model; SetSelection(null); foreach (ISpatialDisplay display in m_Displays) display.ReplaceMapModel(initialDrawExtent); // Ensure the active display has focus (so that it reacts to any mouse-wheel events) ISpatialDisplay ad = ActiveDisplay; if (ad!=null) ad.MapPanel.Focus(); }
public virtual void Close() { m_Data = null; m_Selection = new SpatialSelection(); }
public virtual void Close() { m_Data = null; m_Selection = new SpatialSelection(); }
public DesignTimeController() { m_Model = new DesignTimeMapModel(); }
/// <summary> /// Draws from the map model and refreshes the display /// </summary> /// <param name="addToHistory">Should the map panel extent be added to the view history?</param> internal void Draw(bool addToHistory) { Rectangle rect = new Rectangle(0, 0, mapPanel.Width, mapPanel.Height); Brush b = new SolidBrush(mapPanel.BackColor); //m_Display.Graphics.FillRectangle(Brushes.AntiqueWhite, rect); m_Display.Graphics.FillRectangle(b, rect); ISpatialController controller = SpatialController.Current; ISpatialModel mapModel = controller.MapModel; if (mapModel == null) { return; } SetScrollBars(); //Rectangle rect = new Rectangle(0, 0, mapPanel.Width, mapPanel.Height); //m_Display.Graphics.FillRectangle(Brushes.White, rect); // TEST: Try drawing an image (in Selkirk) try { IWindow w = this.Extent; IWindow testw = new Window(651000.0, 5555000.0, 652000.0, 5556000.0); if (w.IsOverlap(testw)) { float fx = EastingToDisplay(651000.0); float fy = NorthingToDisplay(5556000.0); float fsz = LengthToDisplay(1000.0); Rectangle r = new Rectangle((int)fx, (int)fy, (int)fsz, (int)fsz); Image i = Bitmap.FromFile(@"C:\Users\sstanton\Data\6515555.tif"); m_Display.Graphics.DrawImage(i, r); } } catch { } // end test mapModel.Render(this, controller.DrawStyle); // Paint the map panel using (Graphics g = mapPanel.CreateGraphics()) { m_Display.Render(g); // Save the display without any highlighting m_Display.Render(m_SavedDisplay.Graphics); //CopyMapPanelToSavedDisplay(); // Any selection needs to be drawn too, but after the above ISpatialSelection ss = controller.SpatialSelection; if (ss.Count > 0) { IDrawStyle style = controller.HighlightStyle; foreach (ISpatialObject item in ss.Items) { item.Render(this, style); } m_Display.Render(g); } } if (addToHistory) { AddExtent(); } }
public DesignTimeController() { m_Model = new DesignTimeMapModel(); }