/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing"> true if managed resources should be disposed; otherwise, false. </param> protected override void Dispose(bool disposing) { EidssMapSerializer.Instance.LayerDeserializationExceptionEvent -= Instance_LayerDeserializationExceptionEvent; if (m_ZlyrSelector != null) { m_ZlyrSelector.Dispose(); m_ZlyrSelector = null; } if (m_MapSelector != null) { m_MapSelector.Dispose(); m_MapSelector = null; } if (m_mapImage != null && !m_mapImage.IsDisposed) { m_mapImage.Dispose(); //Crash where! m_mapImage = null; } if (m_MapContent != null) { m_MapContent.Map = null; } base.Dispose(disposing); }
public void InitBufZonesToolBar() { barManager.Form = this; //create map projects bar barManager.BeginUpdate(); var mapsBar = new Bar(barManager, "BufferZones"); mapsBar.OptionsBar.AllowDelete = false; mapsBar.OptionsBar.AllowQuickCustomization = false; mapsBar.OptionsBar.DisableClose = true; mapsBar.OptionsBar.DisableCustomization = true; mapsBar.DockStyle = BarDockStyle.Top; mapsBar.CanDockStyle = BarCanDockStyle.Top; mapsBar.OptionsBar.BarState = BarState.Expanded; mapsBar.Visible = true; mapsBar.DockRow = 0; mapsBar.DockCol = 4; mapsBar.ApplyDockRowCol(); //create AddBufZonesLayer tool var mbb = new MapBarButton(); CommandMapTool mCommandTool = new MtAddBufZonesLayer { MapImage = m_mapImage }; mbb.MapTool = mCommandTool; mapsBar.AddItem(mbb); //create MapSelectorTool var cmb = new RepositoryItemComboBox(); var bei = new BarEditItem(barManager, cmb) { SmallWithoutTextWidth = 90, SmallWithTextWidth = 90, Width = 90 }; if (m_ZlyrSelector != null) { m_ZlyrSelector.Dispose(); } m_ZlyrSelector = new MtZoneLayerSelector { ControlForVisualize = bei, MapControl = m_mapImage, AddBufZoneLayer = (MtAddBufZonesLayer)mCommandTool }; mapsBar.AddItem(bei); //create CircleWithCenterBufZone tool mbb = new MapBarButton(); ControllerMapTool mControllerTool = new MtCircleWithCenterBufZone { MapImage = m_mapImage, ConnectionString = ConnectionManager.DefaultInstance.ConnectionString, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create IndependentCircleBufferZone tool mbb = new MapBarButton(); mControllerTool = new MtIndependentCircleBufferZone { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create PolygonBufferZone tool mbb = new MapBarButton(); mControllerTool = new MtPolygonBufferZone { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent, ConnectionString = ConnectionManager.DefaultInstance.ConnectionString }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create IndependentPolygonBufferZone tool mbb = new MapBarButton(); mControllerTool = new MtIndependentPolygonBufferZone { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create RemoveBufZones tool mbb = new MapBarButton(); mControllerTool = new MtSelectBufZones { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //var mapSelector = new MapSelector { MapControl = m_mapImage, ControlForVisualize = bei }; barManager.EndUpdate(); }