protected override void OnUpdate()
        {
            try
            {
                GsExtension extension = GsExtension.GetExtension();

                if (extension != null)
                {
                    CycloMediaGroupLayer cyclGroupLayer = extension.CycloMediaGroupLayer;
                    bool historicalEnabled = (cyclGroupLayer != null) && cyclGroupLayer.HistoricalLayerEnabled;

                    if (!historicalEnabled && FrmRecordingHistory.IsVisible)
                    {
                        FrmRecordingHistory.CloseForm();
                    }

                    Enabled = ((ArcMap.Application != null) && extension.Enabled && historicalEnabled);
                    Checked = FrmRecordingHistory.IsVisible;
                }
            }
            catch (Exception ex)
            {
                _logClient.Error("GsRecordingHistory.OnUpdate", ex.Message, ex);
                Trace.WriteLine(ex.Message, "GsRecordingHistory.OnUpdate");
            }
        }
        public GsHistoricalDataLayer()
        {
            _logClient = new LogClient(typeof(GsHistoricalDataLayer));
            Checked    = false;
            GsExtension          extension  = GsExtension.GetExtension();
            CycloMediaGroupLayer groupLayer = extension.CycloMediaGroupLayer;

            if (groupLayer != null)
            {
                IList <CycloMediaLayer> layers = groupLayer.Layers;

                foreach (var layer in layers)
                {
                    if (layer.IsRemoved)
                    {
                        CycloMediaLayerRemoved(layer);
                    }
                    else
                    {
                        CycloMediaLayerAdded(layer);
                    }
                }
            }

            CycloMediaLayer.LayerAddedEvent  += CycloMediaLayerAdded;
            CycloMediaLayer.LayerRemoveEvent += CycloMediaLayerRemoved;
        }
 protected override void OnUpdate()
 {
     try
     {
         GsExtension       extension        = GsExtension.GetExtension();
         ISpatialReference spatialReference = ArcUtils.SpatialReference;
         Enabled = ((ArcMap.Application != null) && extension.Enabled && (spatialReference != null));
     }
     catch (Exception ex)
     {
         _logClient.Error("GsHistoricalDataLayer.OnUpdate", ex.Message, ex);
         Trace.WriteLine(ex.Message, "GsHistoricalDataLayers.OnUpdate");
     }
 }
Esempio n. 4
0
 protected override void OnUpdate()
 {
     try
     {
         GsExtension extension = GsExtension.GetExtension();
         Enabled = ((ArcMap.Application != null) && extension.Enabled);
         Checked = FrmCycloMediaOptions.IsVisible;
     }
     catch (Exception ex)
     {
         _logClient.Error("GsCycloMediaOptions.OnUpdate", ex.Message, ex);
         Trace.WriteLine(ex.Message, "GsCycloMediaOptions.OnUpdate");
     }
 }
 protected override void OnUpdate()
 {
     try
     {
         GsExtension extension = GsExtension.GetExtension();
         Enabled = ((ArcMap.Application != null) && extension.Enabled);
         Checked = (_process != null);
     }
     catch (Exception ex)
     {
         _logClient.Error("GsHelp.OnUpdate", ex.Message, ex);
         Trace.WriteLine(ex.Message, "GsHelp.OnUpdate");
     }
 }
        protected override void OnUpdate()
        {
            try
            {
                GsExtension  extension   = GsExtension.GetExtension();
                IApplication application = ArcMap.Application;
                Enabled = ((application != null) && extension.Enabled);

                if (application != null)
                {
                    var document = application.Document as IMxDocument;

                    if (document != null)
                    {
                        var tocDisplayView = document.CurrentContentsView as TOCDisplayView;

                        if (tocDisplayView != null)
                        {
                            var selectedItem = tocDisplayView.SelectedItem as ILayer;

                            if (selectedItem != null)
                            {
                                _vectorLayer = VectorLayer.GetLayer(selectedItem);
                                CycloMediaGroupLayer cycloMediaGroupLayer = extension.CycloMediaGroupLayer;
                                _cycloMediaLayer = (cycloMediaGroupLayer == null) ? null : cycloMediaGroupLayer.GetLayer(selectedItem);

                                if (_cycloMediaLayer != null)
                                {
                                    Checked = _cycloMediaLayer.IsVisibleInGlobespotter;
                                    Enabled = _cycloMediaLayer.IsVisible;
                                }

                                if (_vectorLayer != null)
                                {
                                    Checked = _vectorLayer.IsVisibleInGlobespotter;
                                    Enabled = _vectorLayer.IsVisible;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logClient.Error("GsShowInCyclorama.OnUpdate", ex.Message, ex);
                Trace.WriteLine(ex.Message, "GsShowInCyclorama.OnUpdate");
            }
        }
        /// <summary>
        /// This function calculates the imageId for location on the screen
        /// </summary>
        /// <param name="arg">The mouse arguments</param>
        /// <param name="layer">The layer where the point has been found</param>
        /// <returns>The imageId of the point</returns>
        private static string GetImageIdFromPoint(MouseEventArgs arg, out CycloMediaLayer layer)
        {
            layer = null;
            string      result    = string.Empty;
            GsExtension extension = GsExtension.GetExtension();

            if (extension.InsideScale())
            {
                int x = arg.X;
                int y = arg.Y;
                CycloMediaGroupLayer cycloMediaGroupLayer = extension.CycloMediaGroupLayer;
                result = cycloMediaGroupLayer.GetFeatureFromPoint(x, y, out layer);
            }

            return(result);
        }
Esempio n. 8
0
        protected override void OnShutdown()
        {
            try
            {
                _extension = null;

                if (Enabled)
                {
                    Uninitialize();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message, "GsExtension.OnShutdown");
            }

            Config.AgreementChangedDelegate -= AgreementChangedDelegate;
            base.OnShutdown();
        }
Esempio n. 9
0
        internal static GsExtension GetExtension()
        {
            if (_extension == null)
            {
                try
                {
                    // ReSharper disable SuspiciousTypeConversion.Global
                    UID extId = new UIDClass {
                        Value = ThisAddIn.IDs.GsExtension
                    };
                    _extension = ArcMap.Application.FindExtensionByCLSID(extId) as GsExtension;
                    // ReSharper restore SuspiciousTypeConversion.Global
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex.Message, "GsExtension.GetExtension");
                }
            }

            return(_extension);
        }
        protected override void OnClick()
        {
            try
            {
                OnUpdate();
                GsExtension extension = GsExtension.GetExtension();

                if (Checked)
                {
                    extension.RemoveLayer(LayerName);
                }
                else
                {
                    extension.AddLayers(LayerName);
                }
            }
            catch (Exception ex)
            {
                _logClient.Error("GsHistoricalDataLayer.OnClick", ex.Message, ex);
                MessageBox.Show(ex.Message, Resources.GsCycloMediaOptions_OnClick_Globespotter_integration_Addin_Error_);
            }
        }
Esempio n. 11
0
 protected override void OnStartup()
 {
     Config.AgreementChangedDelegate += AgreementChangedDelegate;
     _extension = this;
     base.OnStartup();
 }