private void _SetupDocumentEvents() { //Listen to events which would change combobox contents IDocumentEvents_Event pNewDocEvents = (IDocumentEvents_Event)_document; pNewDocEvents.ActiveViewChanged += new IDocumentEvents_ActiveViewChangedEventHandler(this._OnFocusMapChanged); IActiveViewEvents_Event activeViewEvents = (IActiveViewEvents_Event)_activeView; activeViewEvents.FocusMapChanged += new IActiveViewEvents_FocusMapChangedEventHandler(this._OnFocusMapChanged); activeViewEvents.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(this._OnLayersChanged); activeViewEvents.ItemDeleted += new IActiveViewEvents_ItemDeletedEventHandler(this._OnLayersChanged); activeViewEvents.ItemReordered += new IActiveViewEvents_ItemReorderedEventHandler(this._OnLayersReordered); }
void mApplicationEvents_Initialized() { mDoc = (IMxDocument)ArcMap.Application.Document; mMap = mDoc.FocusMap; if (mMap != null) { mActiveViewEvents = (IActiveViewEvents_Event)mMap; mActiveViewEvents.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(mActiveViewEvents_ItemAdded); mActiveViewEvents.ItemDeleted += new IActiveViewEvents_ItemDeletedEventHandler(mActiveViewEvents_ItemDeleted); mActiveViewEvents.FocusMapChanged += new IActiveViewEvents_FocusMapChangedEventHandler(mActiveViewEvents_FocusMapChanged); mDocumentEvents = (IDocumentEvents_Event)mDoc; mDocumentEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(mDocumentEvents_OpenDocument); } setCurrentValues(); }
private static void SyncActiveEvents() { if (s_activeViewEvents == null) { s_activeViewEvents = (IActiveViewEvents_Event)((IMxDocument)s_app.Document).FocusMap; s_activeViewEvents.ItemAdded += ActiveViewEvents_ItemAdded; s_activeViewEvents.ItemDeleted += ActiveViewEvents_ItemDeleted; } if (s_docEvent == null) { s_docEvent = s_app.Document as IDocumentEvents_Event; s_docEvent.NewDocument += Events_NewDocument; s_docEvent.OpenDocument += s_docEvent_OpenDocument; } }
// Wiring private void SetUpDocumentEvent(IDocument myDocument) { m_docEvents = myDocument as IDocumentEvents_Event; m_docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(RefreshList); m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(RefreshList); }
// Wiring private void SetUpDocumentEvent(IDocument myDocument) { m_docEvents = myDocument as IDocumentEvents_Event; m_docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(OnOpenDocument); //Optional, new and close document events m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(OnNewDocument); m_docEvents.CloseDocument += new IDocumentEvents_CloseDocumentEventHandler(OnCloseDocument); }
//Wiring. private void WireDocumentEvents(ESRI.ArcGIS.Framework.IDocument myDocument) { m_docEvents = myDocument as IDocumentEvents_Event; //Safer wiring m_docNewHandler = new IDocumentEvents_NewDocumentEventHandler(OnNewDocument); m_docEvents.NewDocument += m_docNewHandler; m_docOpenHandler = new IDocumentEvents_OpenDocumentEventHandler(OnOpenDocument); m_docEvents.OpenDocument += m_docOpenHandler; }
protected override void OnStartup() { _document = ArcMap.Document; if (_document != null) { IDocumentEvents_Event documentEvents = _document as IDocumentEvents_Event; documentEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(_DocumentEvents_NewDocument); documentEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(_DocumentEvents_OpenDocument); documentEvents.CloseDocument += new IDocumentEvents_CloseDocumentEventHandler(_DocumentEvents_CloseDocument); } _extension = this; }
public void SetEvents() { mDoc = (IMxDocument)ArcMap.Application.Document; mMap = mDoc.FocusMap; if (mMap != null) { mActiveViewEvents = (IActiveViewEvents_Event)mMap; mActiveViewEvents.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(mActiveViewEvents_ItemAdded); mActiveViewEvents.ItemDeleted += new IActiveViewEvents_ItemDeletedEventHandler(mActiveViewEvents_ItemDeleted); mActiveViewEvents.FocusMapChanged += new IActiveViewEvents_FocusMapChangedEventHandler(mActiveViewEvents_FocusMapChanged); mDocumentEvents = (IDocumentEvents_Event)mDoc; mDocumentEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(mDocumentEvents_OpenDocument); //mActiveViewEvents.SelectionChanged += new IActiveViewEvents_SelectionChangedEventHandler(mActiveViewEvents_SelectionChanged); setCurrentValues(); EventsSet = true; } }
private void _RemoveDocumentEvents() { if (_activeView != null) { IActiveViewEvents_Event activeViewEvents = (IActiveViewEvents_Event)_activeView; activeViewEvents.FocusMapChanged -= new IActiveViewEvents_FocusMapChangedEventHandler(this._OnFocusMapChanged); activeViewEvents.ItemAdded -= new IActiveViewEvents_ItemAddedEventHandler(this._OnLayersChanged); activeViewEvents.ItemDeleted -= new IActiveViewEvents_ItemDeletedEventHandler(this._OnLayersChanged); activeViewEvents.ItemReordered -= new IActiveViewEvents_ItemReorderedEventHandler(this._OnLayersReordered); // UrbanDelineationExtension.ReleaseComObject(_activeView); _activeView = null; } if (_document != null) { IDocumentEvents_Event pDocEvents = (IDocumentEvents_Event)_document; pDocEvents.ActiveViewChanged -= new IDocumentEvents_ActiveViewChangedEventHandler(this._OnFocusMapChanged); // UrbanDelineationExtension.ReleaseComObject(_document); _document = null; } }
public void Startup(ref object initializationData) { m_application = initializationData as IApplication; if (m_application == null) { return; } m_doc = m_application.Document as IMxDocument; //Get dockable window. IDockableWindowManager dockableWindowManager = m_application as IDockableWindowManager; UID dockWinID = new UIDClass(); dockWinID.Value = @"SelectionCOMSample.SelectionCountDockWin"; s_dockWindow = dockableWindowManager.GetDockableWindow(dockWinID); //Wire up events. IDocumentEvents_Event docEvents = m_doc as IDocumentEvents_Event; docEvents.NewDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_NewDocumentEventHandler(ArcMap_NewOpenDocument); docEvents.OpenDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_OpenDocumentEventHandler(ArcMap_NewOpenDocument); }
public void Shutdown() { m_docEvents = null; m_application = null; }
protected override void OnClick() { if (!m_bIsConnected) { try { //open the shapefile with the recorded data IFeatureClass featureClass = openPlaybackData(); if (null == featureClass) return; //get the map container object mapObj = ArcMap.Application; //load the Tracking Analyst extension ITrackingEnvironment3 trackingEnv = setupTrackingEnv(ref mapObj); //set the mode to historic, since you need to do playback trackingEnv.DefaultTemporalReference.TemporalMode = enumTemporalMode.enumHistoric; //set the units of the temporal period to days trackingEnv.DefaultTemporalReference.TemporalPeriodUnits = enumTemporalUnits.enumDays; //set the update mode to manual so that it will be controlled by the application trackingEnv.DisplayManager.ManualUpdate = true; //set the temporal perspective to Aug 03 2000 7PM. trackingEnv.DefaultTemporalReference.TemporalPerspective = "8/3/2000 7:0:00 PM"; // Stop using the map's time to allow the layer to draw based on it's TemporalPerspective ITimeData timeData = m_temporalLayer as ITimeData; timeData.UseTime = false; //create a temporal operator that will serve as a base time for the tracking environment ITemporalOperator3 temporalOpBaseTime = new TemporalOperatorClass() as ITemporalOperator3; //set the base time to 6PM, Aug 3 2000 temporalOpBaseTime.SetDateTime(2000, 8, 3, 18, 0, 0, 0); //create the renderer for the temporal layer ITemporalRenderer temporalRenderer = setRenderer(featureClass, "DATE_TIME", "EVENTID"); //create the temporal layer for the playback data m_temporalLayer = new TemporalFeatureLayerClass(); //assign the featureclass for the layer ((IFeatureLayer)m_temporalLayer).FeatureClass = featureClass; //set the base time to initialize the time window of the layer m_temporalLayer.RelativeTimeOperator = (ITemporalOperator)temporalOpBaseTime; //set the renderer for the temporal layer m_temporalLayer.Renderer = temporalRenderer as IFeatureRenderer; //set the flag in order to display the track of previous locations m_temporalLayer.DisplayOnlyLastKnownEvent = false; //initialize labels for the event name setupLayerLabels(m_temporalLayer, "EVENTID"); m_activeView = ArcMap.Document.ActiveView; m_temporalEnv = trackingEnv; m_baseTime = temporalOpBaseTime; //add the temporal layer to the map ArcMap.Document.FocusMap.AddLayer((ILayer)m_temporalLayer); //enable the timer m_timer.Enabled = true; } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } else { //disable the timer m_timer.Enabled = false; if (null == m_temporalLayer) return; //remove the layer ArcMap.Document.FocusMap.DeleteLayer((ILayer)m_temporalLayer); m_temporalLayer = null; } m_bIsConnected = !m_bIsConnected; m_docEvent = ArcMap.Document as IDocumentEvents_Event; m_docEvent.CloseDocument += new IDocumentEvents_CloseDocumentEventHandler(docEvent_CloseDocument); ArcMap.Application.CurrentTool = null; }
private IDocumentEvents_Event m_docEvents = null; //Event member variable. private void SetUpDocumentEvent(IDocument myDocument) { m_docEvents = myDocument as IDocumentEvents_Event; m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(OnDocumentSession); m_docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(OnDocumentSession); }
// Wiring private void SetUpDocumentEvent(IDocument myDocument) { m_docEvents = myDocument as IDocumentEvents_Event; m_docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(RefreshList); m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(RefreshList); }
public void Shutdown() { m_docEvents = null; m_application = null; }
private void SetupEvents() { // Make sure we're dealing with ArcMap if (m_application.Document.Parent is IMxApplication) { m_docEvents = m_application.Document as IDocumentEvents_Event; m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(OnNewDocument); m_docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(OnOpenDocument); m_mapStatusEvents = m_application.Document.Parent as IApplicationStatusEvents_Event; m_mapStatusEvents.Initialized += new IApplicationStatusEvents_InitializedEventHandler(OnInitialized); } }
private void SetupDocumentEvents(IDocument document) { _focusMap = ((IMxDocument)_application.Document).FocusMap; _docEvents = document as IDocumentEvents_Event; _docEvents.NewDocument -= OnNewDocument; _docEvents.OpenDocument -= OnOpenDocument; _docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(OnNewDocument); _docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(OnOpenDocument); }
protected override void OnShutdown() { Uninitialize(); if (m_docEvents != null) { m_docEvents.NewDocument -= new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_NewDocumentEventHandler(ArcMap_NewOpenDocument); m_docEvents.OpenDocument -= new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_OpenDocumentEventHandler(ArcMap_NewOpenDocument); } m_pApp = null; m_pDoc = null; m_docEvents = null; s_extension = null; base.OnShutdown(); }
protected override void OnStartup() { s_extension = this; m_docEvents = ArcMap.Document as ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event; m_docEvents.NewDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_NewDocumentEventHandler(ArcMap_NewOpenDocument); m_docEvents.OpenDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_OpenDocumentEventHandler(ArcMap_NewOpenDocument); Initialize(); }
// Wiring private void SetUpDocumentEvent(IDocument myDocument) { m_docEvents = myDocument as IDocumentEvents_Event; m_docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(OnOpenDocument); //Optional, new and close document events m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(OnNewDocument); m_docEvents.CloseDocument += new IDocumentEvents_CloseDocumentEventHandler(OnCloseDocument); }
protected override void OnClick() { if (!m_bIsConnected) { try { //open the shapefile with the recorded data IFeatureClass featureClass = openPlaybackData(); if (null == featureClass) { return; } //get the map container object mapObj = ArcMap.Application; //load the Tracking Analyst extension ITrackingEnvironment3 trackingEnv = setupTrackingEnv(ref mapObj); //set the mode to historic, since you need to do playback trackingEnv.DefaultTemporalReference.TemporalMode = enumTemporalMode.enumHistoric; //set the units of the temporal period to days trackingEnv.DefaultTemporalReference.TemporalPeriodUnits = enumTemporalUnits.enumDays; //set the update mode to manual so that it will be controlled by the application trackingEnv.DisplayManager.ManualUpdate = true; //set the temporal perspective to Aug 03 2000 7PM. trackingEnv.DefaultTemporalReference.TemporalPerspective = "8/3/2000 7:0:00 PM"; // Stop using the map's time to allow the layer to draw based on it's TemporalPerspective ITimeData timeData = m_temporalLayer as ITimeData; timeData.UseTime = false; //create a temporal operator that will serve as a base time for the tracking environment ITemporalOperator3 temporalOpBaseTime = new TemporalOperatorClass() as ITemporalOperator3; //set the base time to 6PM, Aug 3 2000 temporalOpBaseTime.SetDateTime(2000, 8, 3, 18, 0, 0, 0); //create the renderer for the temporal layer ITemporalRenderer temporalRenderer = setRenderer(featureClass, "DATE_TIME", "EVENTID"); //create the temporal layer for the playback data m_temporalLayer = new TemporalFeatureLayerClass(); //assign the featureclass for the layer ((IFeatureLayer)m_temporalLayer).FeatureClass = featureClass; //set the base time to initialize the time window of the layer m_temporalLayer.RelativeTimeOperator = (ITemporalOperator)temporalOpBaseTime; //set the renderer for the temporal layer m_temporalLayer.Renderer = temporalRenderer as IFeatureRenderer; //set the flag in order to display the track of previous locations m_temporalLayer.DisplayOnlyLastKnownEvent = false; //initialize labels for the event name setupLayerLabels(m_temporalLayer, "EVENTID"); m_activeView = ArcMap.Document.ActiveView; m_temporalEnv = trackingEnv; m_baseTime = temporalOpBaseTime; //add the temporal layer to the map ArcMap.Document.FocusMap.AddLayer((ILayer)m_temporalLayer); //enable the timer m_timer.Enabled = true; } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } else { //disable the timer m_timer.Enabled = false; if (null == m_temporalLayer) { return; } //remove the layer ArcMap.Document.FocusMap.DeleteLayer((ILayer)m_temporalLayer); m_temporalLayer = null; } m_bIsConnected = !m_bIsConnected; m_docEvent = ArcMap.Document as IDocumentEvents_Event; m_docEvent.CloseDocument += new IDocumentEvents_CloseDocumentEventHandler(docEvent_CloseDocument); ArcMap.Application.CurrentTool = null; }
private IDocumentEvents_Event m_docEvents = null; //Event member variable. private void SetUpDocumentEvent(IDocument myDocument) { m_docEvents = myDocument as IDocumentEvents_Event; m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler(OnDocumentSession); m_docEvents.OpenDocument += new IDocumentEvents_OpenDocumentEventHandler(OnDocumentSession); }