Beispiel #1
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;

            if (!m_bIsDynamicMode)
            {
                //switch into dynamic mode
                if (!m_dynamicMap.DynamicMapEnabled)
                {
                    m_dynamicMap.DynamicMapEnabled = true;
                }

                //start listening to DynamicMap's 'After Draw' events
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
            }
            else
            {
                //stop listening to DynamicMap's 'After Draw' events
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);

                //leave dynamic mode
                if (m_dynamicMap.DynamicMapEnabled)
                {
                    m_dynamicMap.DynamicMapEnabled = false;
                }
            }
            m_bIsDynamicMode = !m_bIsDynamicMode;
            m_hookHelper.ActiveView.Refresh();
        }
Beispiel #2
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            //make sure to switch into dynamic mode
            m_dynamicMap = (IDynamicMap)m_hookHelper.FocusMap;
            if (!m_dynamicMap.DynamicMapEnabled)
            {
                m_dynamicMap.DynamicMapEnabled = true;
            }

            //do initializations
            if (m_bOnce)
            {
                //generate the navigation data
                GenerateNavigationData();

                m_displayTransformation = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation;

                m_bOnce = false;
            }

            //hook the dynamic display events
            if (!m_bIsRunning)
            {
                ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapFinished += new IDynamicMapEvents_DynamicMapFinishedEventHandler(OnTimerElapsed);
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw   += new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
            }
            else
            {
                ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapFinished -= new IDynamicMapEvents_DynamicMapFinishedEventHandler(OnTimerElapsed);
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw   -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
            }

            //set the running flag
            m_bIsRunning = !m_bIsRunning;
        }
Beispiel #3
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            m_logoPath = GetLogoPath();
            IMap        map        = m_hookHelper.FocusMap;
            IDynamicMap dynamicMap = map as IDynamicMap;

            IActiveView activeView = map as IActiveView;

            /*IActiveViewEvents_Event */ avEvents = activeView as IActiveViewEvents_Event;
            IDynamicMapEvents_Event dynamicMapEvents = dynamicMap as IDynamicMapEvents_Event;
            IScreenDisplay          screenDisplay    = activeView.ScreenDisplay;

            if (!m_bIsOn)
            {
                avEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
                dynamicMapEvents.AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
            }
            else
            {
                dynamicMapEvents.AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
                avEvents.AfterDraw -= new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
            }
            m_bIsOn = !m_bIsOn;
            screenDisplay.Invalidate(null, true, (short)esriScreenCache.esriNoScreenCache);
            screenDisplay.UpdateWindow();
        }
        /// <summary>
        /// Turns Dynamic Display On.
        /// </summary>
        private void EnableDynamicDisplay()
        {
            IDynamicMap dynamicMap = ArcMap.Document.FocusMap as IDynamicMap;

            if (dynamicMap != null)
            {
                dynamicMap.DynamicMapEnabled = true;
            }
        }
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;
            if (m_dynamicMap == null)
            {
                return;
            }

            m_dynamicMap.DynamicDrawRate   = 15;
            m_dynamicMap.DynamicMapEnabled = !m_dynamicMap.DynamicMapEnabled;
        }
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            IDynamicMap dynamicMap = m_hookHelper.FocusMap as IDynamicMap;

            if (dynamicMap == null || dynamicMap.DynamicMapEnabled == false)
            {
                return;
            }

            MyDynamicLayer dynamicLayer = new MyDynamicLayer();

            m_hookHelper.FocusMap.AddLayer(dynamicLayer);
        }
Beispiel #7
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            // work only in dynamic mode
            IDynamicMap dynamicMap = m_hookHelper.FocusMap as IDynamicMap;

            if (dynamicMap == null || !dynamicMap.DynamicMapEnabled)
            {
                MessageBox.Show("Please enable dynamic mode and try again.");
                return;
            }

            CacheManagerDlg cacheMgrDlg = new CacheManagerDlg(m_hookHelper);;

            cacheMgrDlg.ShowDialog();
        }
        /// <summary>
        /// Occurs when this tool is clicked
        /// </summary>
        public override void OnClick()
        {
            IDynamicMap dynamicMap = m_hookHelper.FocusMap as IDynamicMap;

            if (false == dynamicMap.DynamicMapEnabled)
            {
                return;
            }

            m_dynamicMapEvents = null;
            m_dynamicMapEvents = m_hookHelper.FocusMap as IDynamicMapEvents_Event;
            m_dynamicMapEvents.DynamicMapStarted += new IDynamicMapEvents_DynamicMapStartedEventHandler(DynamicMapEvents_DynamicMapStarted);

            m_bIsAnimating = false;
            m_dStepCount   = 0;
            m_nTotalSteps  = 0;
        }
Beispiel #9
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            //cast into dynamic map. make sure that the current display supports dynamic display mode.
            m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;
            if (null == m_dynamicMap)
            {
                MessageBox.Show("The current display does not support dynamic mode.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //switch in and out of dynamic mode
            if (!m_bIsDynamicMode)
            {
                m_dynamicMap.DynamicMapEnabled = true;
            }
            else
            {
                m_dynamicMap.DynamicMapEnabled = false;
            }

            m_bIsDynamicMode = !m_bIsDynamicMode;
        }
        public override bool Deactivate()
        {
            m_bIsAnimating = false;
            m_dStepCount   = 0;
            m_nTotalSteps  = 0;

            if (null == m_hookHelper)
            {
                return(false);
            }

            IDynamicMap dynamicMap = m_hookHelper.FocusMap as IDynamicMap;

            if (false == dynamicMap.DynamicMapEnabled)
            {
                return(true);
            }

            m_dynamicMapEvents = m_hookHelper.FocusMap as IDynamicMapEvents_Event;
            m_dynamicMapEvents.DynamicMapStarted -= new IDynamicMapEvents_DynamicMapStartedEventHandler(DynamicMapEvents_DynamicMapStarted);

            return(true);
        }
Beispiel #11
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            //cast into dynamic map. make sure that the current display supports dynamic display mode.
            m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;
            if (null == m_dynamicMap)
            {
                MessageBox.Show("The current display does not support dynamic mode.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (!m_bIsDynamicMode)
            {
                //verify that the display is currently in dynamic mode
                if (!m_dynamicMap.DynamicMapEnabled)
                {
                    MessageBox.Show("In order to add the HUD you must enable dynamic mode", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //start listening to DynamicMap's 'After Draw' events
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);

                //need to redraw the screen
                m_hookHelper.ActiveView.ScreenDisplay.UpdateWindow();
            }
            else
            {
                //stop listening to DynamicMap's 'After Draw' events
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
            }

            //redraw the display
            m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            m_hookHelper.ActiveView.ScreenDisplay.UpdateWindow();

            m_bIsDynamicMode = !m_bIsDynamicMode;
        }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;

      if (!m_bIsDynamicMode)
      {
        //switch into dynamic mode
        if (!m_dynamicMap.DynamicMapEnabled)
          m_dynamicMap.DynamicMapEnabled = true;

        //start listening to DynamicMap's 'After Draw' events
        ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
      }
      else
      {
        //stop listening to DynamicMap's 'After Draw' events
        ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);

        //leave dynamic mode
        if (m_dynamicMap.DynamicMapEnabled)
          m_dynamicMap.DynamicMapEnabled = false;


      }
      m_bIsDynamicMode = !m_bIsDynamicMode;
			m_hookHelper.ActiveView.Refresh ();
    }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;
      if (m_dynamicMap == null)
        return;

      m_dynamicMap.DynamicDrawRate = 15;
      m_dynamicMap.DynamicMapEnabled = !m_dynamicMap.DynamicMapEnabled;
    }
Beispiel #14
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            //make sure to switch into dynamic mode
            IDynamicMap dynamicMap = m_hookHelper.FocusMap as IDynamicMap;

            //make sure that the current Map supports the DynamicDisplay
            if (null == dynamicMap)
            {
                return;
            }

            if (!m_bIsConnected)
            {
                //make sure to switch into dynamic mode
                if (!dynamicMap.DynamicMapEnabled)
                {
                    dynamicMap.DynamicMapEnabled = true;
                }

                //do some initializations...
                if (m_bOnce)
                {
                    //initialize the dynamic layer
                    m_dynamicLayer      = new MyDynamicLayerClass();
                    m_dynamicLayer.Name = "Dynamic Layer";

                    m_bOnce = false;
                }

                //make sure that the layer did not get added to the map
                bool bLayerHasBeenAdded = false;
                if (m_hookHelper.FocusMap.LayerCount > 0)
                {
                    IEnumLayer layers = m_hookHelper.FocusMap.get_Layers(null, false);
                    layers.Reset();
                    ILayer layer = layers.Next();
                    while (layer != null)
                    {
                        if (layer is MyDynamicLayerClass)
                        {
                            bLayerHasBeenAdded = true;
                            break;
                        }
                        layer = layers.Next();
                    }
                }

                if (!bLayerHasBeenAdded)
                {
                    //add the dynamic layer to the map
                    m_hookHelper.FocusMap.AddLayer(m_dynamicLayer);
                }
                //connect to the synthetic data source
                m_dynamicLayer.Connect();
            }
            else
            {
                //disconnect to the synthetic data source
                m_dynamicLayer.Disconnect();

                //delete the layer from the map
                m_hookHelper.FocusMap.DeleteLayer(m_dynamicLayer);

                //disable the dynamic display
                if (dynamicMap.DynamicMapEnabled)
                {
                    dynamicMap.DynamicMapEnabled = false;
                }
            }

            //set the connected flag
            m_bIsConnected = !m_bIsConnected;
        }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      //make sure to switch into dynamic mode
      m_dynamicMap = (IDynamicMap)m_hookHelper.FocusMap;
      if (!m_dynamicMap.DynamicMapEnabled)
        m_dynamicMap.DynamicMapEnabled = true;

      //do initializations
      if (m_bOnce)
      {
        //generate the navigation data
        GenerateNavigationData();

        m_displayTransformation = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation;

        m_bOnce = false;
      }

      //hook the dynamic display events
      if (!m_bIsRunning)
      {
        ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapFinished += new IDynamicMapEvents_DynamicMapFinishedEventHandler(OnTimerElapsed);
        ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
      }
      else
      {
        ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapFinished -= new IDynamicMapEvents_DynamicMapFinishedEventHandler(OnTimerElapsed);
        ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
      }

      //set the running flag
      m_bIsRunning = !m_bIsRunning;
    }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      //cast into dynamic map. make sure that the current display supports dynamic display mode.
      m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;
      if (null == m_dynamicMap)
      {
        MessageBox.Show("The current display does not support dynamic mode.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        return;
      }

      //switch in and out of dynamic mode
      if (!m_bIsDynamicMode)
      {
        m_dynamicMap.DynamicMapEnabled = true;
      }
      else
      {
        m_dynamicMap.DynamicMapEnabled = false;
      }
      
      m_bIsDynamicMode = !m_bIsDynamicMode;
    }
Beispiel #17
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;
            if (m_dynamicMap == null)
            {
                return;
            }

            if (!m_dynamicMap.DynamicMapEnabled)
            {
                MessageBox.Show("Please enable dynamic mode and try again.");
                return;
            }

            if (!m_bConnected)
            {
                m_xmlPath = GetPlaybackXmlPath();
                if (m_xmlPath == string.Empty)
                {
                    return;
                }

                m_bikePositionInfo = new BikePositionInfo();
                m_bikePositionInfo.positionCount       = m_bikePositionCount;
                m_bikePositionInfo.altitudeMeters      = 0;
                m_bikePositionInfo.time                = DateTime.Now;
                m_bikePositionInfo.position.X          = 0;
                m_bikePositionInfo.position.Y          = 0;
                m_bikePositionInfo.heartRate           = 0;
                m_bikePositionInfo.lapCount            = 0;
                m_bikePositionInfo.lapAverageHeartRate = 0;
                m_bikePositionInfo.lapMaximumHeartRate = 0;
                m_bikePositionInfo.lapDistanceMeters   = 0;
                m_bikePositionInfo.lapMaximumSpeed     = 0;
                m_bikePositionInfo.lapCalories         = 0;

                m_gpsPosition         = new PointClass();
                m_additionalInfoPoint = new PointClass();
                m_additionalInfoPoint.PutCoords(70, 90);
                m_bikeRouteGeometry = new PolylineClass();

                // wire dynamic map events
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw  += new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
                ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapStarted += new IDynamicMapEvents_DynamicMapStartedEventHandler(OnDynamicMapStarted);

                // spin the thread that plays the data from the xml file
                m_dataLoaderThread = new Thread(new ParameterizedThreadStart(XmlReaderTask));

                XmlDocTaksData taskData;
                taskData.xmlDocPath = m_xmlPath;
                m_dataLoaderThread.Start(taskData);
            }
            else
            {
                // unwire wire dynamic map events
                ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw  -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
                ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapStarted -= new IDynamicMapEvents_DynamicMapStartedEventHandler(OnDynamicMapStarted);

                // force the bike xml playback thread to quite
                m_autoEvent.Set();
                m_dataLoaderThread.Join();

                System.Diagnostics.Trace.WriteLine("Done!!!");
            }

            m_bConnected = !m_bConnected;
        }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      m_dynamicMap = m_hookHelper.FocusMap as IDynamicMap;
      if (m_dynamicMap == null)
        return;

      if (!m_dynamicMap.DynamicMapEnabled)
      {
        MessageBox.Show("Please enable dynamic mode and try again.");
        return;
      }

      if (!m_bConnected)
      {
        m_xmlPath = GetPlaybackXmlPath();
        if (m_xmlPath == string.Empty)
          return;

        m_bikePositionInfo = new BikePositionInfo();
        m_bikePositionInfo.positionCount = m_bikePositionCount;
        m_bikePositionInfo.altitudeMeters = 0;
        m_bikePositionInfo.time = DateTime.Now;
        m_bikePositionInfo.position.X = 0;
        m_bikePositionInfo.position.Y = 0;
        m_bikePositionInfo.heartRate = 0;
        m_bikePositionInfo.lapCount = 0;
        m_bikePositionInfo.lapAverageHeartRate = 0;
        m_bikePositionInfo.lapMaximumHeartRate = 0;
        m_bikePositionInfo.lapDistanceMeters = 0;
        m_bikePositionInfo.lapMaximumSpeed = 0;
        m_bikePositionInfo.lapCalories = 0;

        m_gpsPosition = new PointClass();
        m_additionalInfoPoint = new PointClass();
        m_additionalInfoPoint.PutCoords(70, 90);
        m_bikeRouteGeometry = new PolylineClass();

        // wire dynamic map events
        ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
        ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapStarted += new IDynamicMapEvents_DynamicMapStartedEventHandler(OnDynamicMapStarted);

        // spin the thread that plays the data from the xml file
        m_dataLoaderThread = new Thread(new ParameterizedThreadStart(XmlReaderTask));

        XmlDocTaksData taskData;
        taskData.xmlDocPath = m_xmlPath;
        m_dataLoaderThread.Start(taskData);
      }
      else
      {
        // unwire wire dynamic map events
        ((IDynamicMapEvents_Event)m_dynamicMap).AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(OnAfterDynamicDraw);
        ((IDynamicMapEvents_Event)m_dynamicMap).DynamicMapStarted -= new IDynamicMapEvents_DynamicMapStartedEventHandler(OnDynamicMapStarted);

        // force the bike xml playback thread to quite
        m_autoEvent.Set();
        m_dataLoaderThread.Join();

        System.Diagnostics.Trace.WriteLine("Done!!!");
      }

      m_bConnected = !m_bConnected;
    }