Example #1
0
 public void RemoveLayers()
 {
     if (CycloMediaGroupLayer != null)
     {
         GsShowInCyclorama.RemoveFromMenu();
         FrmCycloMediaOptions.CloseForm();
         FrmMeasurement.Close();
         FrmIdentify.Close();
         CycloMediaGroupLayer cycloLayer = CycloMediaGroupLayer;
         CycloMediaGroupLayer = null;
         cycloLayer.Dispose();
         FrmGlobespotter.ShutDown(true);
     }
 }
Example #2
0
        protected override void OnClick()
        {
            try
            {
                OnUpdate();

                if (Checked)
                {
                    FrmMeasurement.Close();
                }
                else
                {
                    FrmMeasurement.Open();
                }
            }
            catch (Exception ex)
            {
                _logClient.Error("GsMeasurementDetail.OnClick", ex.Message, ex);
                MessageBox.Show(ex.Message, Resources.GsCycloMediaOptions_OnClick_Globespotter_integration_Addin_Error_);
            }
        }
Example #3
0
        protected override void OnUpdate()
        {
            try
            {
                IEditor3 editor = ArcUtils.Editor;
                Enabled = (editor.EditState == esriEditState.esriStateEditing);
                bool visible = FrmMeasurement.IsVisible();

                if (!Enabled && visible)
                {
                    FrmMeasurement.Close();
                    visible = false;
                }

                Checked = visible;
            }
            catch (Exception ex)
            {
                _logClient.Error("GsMeasurementDetail.OnUpdate", ex.Message, ex);
                Trace.WriteLine(ex.Message, "GsMeasurementDetail.OnUpdate");
            }
        }
Example #4
0
        private void OpenDocument()
        {
            try
            {
                CycloMediaLayer.ResetYears();
                var arcEvents = ArcUtils.ActiveViewEvents;

                if (arcEvents != null)
                {
                    arcEvents.ItemDeleted += ItemDeleted;
                    arcEvents.AfterDraw   += Afterdraw;
                }

                if (OpenDocumentEvent != null)
                {
                    OpenDocumentEvent();
                }

                if (ContainsCycloMediaLayer())
                {
                    AddLayers();
                }

                CycloMediaLayer.LayerRemoveEvent += OnLayerRemoved;
                GsRecentDataLayer.AddToMenu();
                GsHistoricalDataLayer.AddToMenu();
                GsCycloMediaOptions.AddToMenu();
                GsMeasurementDetail.AddToMenu();
                FrmMeasurement.Close();
                FrmIdentify.Close();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message, "GsExtension.OpenDocument");
            }
        }
        private static void AvViewRefreshed(IActiveView view, esriViewDrawPhase phase, object data, IEnvelope envelope)
        {
            try
            {
                IEditor3     editor      = ArcUtils.Editor;
                IApplication application = ArcMap.Application;

                if ((editor != null) && (application != null))
                {
                    var editLayers = editor as IEditLayers;

                    if (editLayers != null)
                    {
                        ILayer       currentLayer = editLayers.CurrentLayer;
                        VectorLayer  vectorLayer  = (currentLayer == null) ? null : GetLayer(currentLayer);
                        ICommandItem tool         = application.CurrentTool;

                        if ((tool != null) && ((_beforeTool == null) || (_beforeTool.Name != tool.Name)))
                        {
                            _beforeTool = tool;

                            if ((vectorLayer != null) && (vectorLayer.IsVisibleInGlobespotter))
                            {
                                ICommandItem editorMenu     = application.Document.CommandBars.Find("Editor_EditTool");
                                string       editorCategory = (editorMenu != null) ? editorMenu.Category : string.Empty;
                                ICommand     command        = tool.Command;
                                string       category       = tool.Category;

                                if (!FrmMeasurement.IsPointOpen())
                                {
                                    if (((command is IEditTool) || (category != editorCategory)) && (category != "CycloMedia"))
                                    {
                                        OnSketchFinished();
                                    }
                                }
                                else
                                {
                                    if ((!(command is IEditTool)) && (category == editorCategory))
                                    {
                                        FrmMeasurement.DoCloseMeasurementPoint();
                                    }
                                }

                                if (category == editorCategory)
                                {
                                    var sketch = editor as IEditSketch3;

                                    if (sketch != null)
                                    {
                                        IGeometry geometry = sketch.Geometry;

                                        if ((!(command is IEditTool)) && (editor.EditState != esriEditState.esriStateNotEditing) && (StartMeasurementEvent != null))
                                        {
                                            StartMeasurementEvent(geometry);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                SketchFinishedEvent();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message, "VectorLayer.AvViewRefreshed");
            }
        }
 protected override void Dispose(bool disposing)
 {
     FrmMeasurement.DisposeFrm(disposing);
     base.Dispose(disposing);
 }