Beispiel #1
0
        public void ActiveCommand()
        {
            m_pEditWorkspace = null;
            if (this.Enabled)
            {
                _context.ShowCommandString("正在启动编辑", CommandTipsType.CTTLog);

                if (Editor2.StartEditing(_context.MapControl.Map, _context))
                {
                    m_pEditWorkspace = Editor2.EditWorkspace;

                    _context.Config.IsInEdit = true;
                    _context.ShowCommandString("启动编辑", CommandTipsType.CTTEnd);
                    EditorEvent.StartEditing();
                    //EditToolUI.EditTemplateCtrl.Map = _context.MapControl.Map;
                    //base.m_HookHelper.DockWindows(EditToolUI.EditTemplateCtrl, null);
                }
                else
                {
                    _context.ShowCommandString("未启动编辑", CommandTipsType.CTTEnd);
                }
            }
            else
            {
                if ((Editor2.EditMap != null) && (Editor2.EditMap != _context.MapControl.Map))
                {
                    _context.ShowCommandString("已处于编辑状态", CommandTipsType.CTTEnd);
                }
                else
                {
                    _context.ShowCommandString("开始编辑命令不可用", CommandTipsType.CTTEnd);
                }
            }
        }
Beispiel #2
0
 internal void EventApplied(EditorState state, EditorEvent e)
 {
     if (OnEventApplied != null)
     {
         OnEventApplied(state, e);
     }
 }
Beispiel #3
0
 public override void OnClick()
 {
     try
     {
         if (SketchToolAssist.Feedback != null && SketchToolAssist.Feedback is IOperation)
         {
             (SketchToolAssist.Feedback as IOperation).Undo();
         }
         else
         {
             Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.UndoEditOperation();
             if (Yutai.ArcGIS.Common.Editor.Editor.SecondEditWorkspace != null)
             {
                 bool flag = false;
                 Yutai.ArcGIS.Common.Editor.Editor.SecondEditWorkspace.HasUndos(ref flag);
                 if (flag)
                 {
                     Yutai.ArcGIS.Common.Editor.Editor.SecondEditWorkspace.UndoEditOperation();
                 }
             }
             if (Yutai.ArcGIS.Common.Editor.Editor.EditFeature != null)
             {
                 EditorEvent.FeatureGeometryChanged(Yutai.ArcGIS.Common.Editor.Editor.EditFeature);
             }
             (_context.FocusMap as IActiveView).Refresh();
         }
     }
     catch (Exception exception_)
     {
         //CErrorLog.writeErrorLog(this, exception_, "");
     }
 }
Beispiel #4
0
    public void ResizeEvent(EditorEvent e)
    {
        int   idx = eventTypeNameToIndex[e.kd.prop[EventTags.Type]];
        float t   = LevelPage.metaEventLengths[idx];

        foreach (var p in hasDuration)
        {
            string str;
            if (e.kd.prop.TryGetValue(p, out str))
            {
                float value;
                if (float.TryParse(str, out value))
                {
                    if (value > t)
                    {
                        t = value;
                    }
                }
            }
        }
        Vector2 newSize = new Vector2(Mathf.Max(4, t * LevelPage.lengthPerSec), LevelPage.ContentHeight);

        e.rt.sizeDelta = newSize;
        if (e.mirror)
        {
            e.mirror.rt.sizeDelta = newSize;
        }
    }
Beispiel #5
0
 void OnNext(EditorEvent evnt)
 {
     if (evnt is FocusEvent)
     {
         FocusedEditor = evnt.Source;
     }
 }
Beispiel #6
0
 /// <summary>
 /// Regenerate source symbols for methods moved by editting others.
 /// </summary>
 /// <param name="emitter">Symbol emitting interface.</param>
 /// <param name="edEvent">EditorEvent containing changed files.</param>
 private void regenMovedSymbols(SymbolWriterClass emitter, EditorEvent edEvent)
 {
     foreach (IClass cClass in ParserService.CurrentProjectContent.Classes)
     {
         regenMovedSymbolsClass(cClass, edEvent, emitter);
     }
 }
Beispiel #7
0
        /// <summary>
        /// Loads symbols generated by compiler when comopiling new version of assembly
        /// to the debugged module ISymUnamagedReader
        /// </summary>
        private bool processChanges(EditorEvent edEvent, DeltaBuilder dBuilder)
        {
            List <BuildError> errors = SourceChangeValidator.GetErrors(edEvent.changes);

            if (errors.Count > 0)
            {
                showErrors(errors);
                return(false);
            }
            else
            {
                // register new elements in metadata
                foreach (SourceChange change in edEvent.changes)
                {
                    if (change.MemberAction == SourceChangeAction.Created && change.MemberKind == SourceChangeMember.Method)
                    {
                        dBuilder.PreAddMethod((IMethod)change.NewEntity);
                    }
                }
                foreach (SourceChange change in edEvent.changes)
                {
                    dBuilder.MakeChange(change);
                }
                return(true);
            }
        }
Beispiel #8
0
        static void PlayModeStateChanged(PlayModeStateChange state)
        {
            switch (state)
            {
            case PlayModeStateChange.ExitingEditMode:
            {
                EditorEvent?.Invoke(Event.EnteringPlayMode, null);
            }
            break;

            case PlayModeStateChange.EnteredPlayMode:
            {
                EditorEvent?.Invoke(Event.EnteredPlayMode, null);
            }
            break;

            case PlayModeStateChange.ExitingPlayMode:
            {
                EditorEvent?.Invoke(Event.ExitingPlayMode, null);
            }
            break;

            case PlayModeStateChange.EnteredEditMode:
            {
                EditorEvent?.Invoke(Event.ExitedPlayMode, null);
            }
            break;
            }
        }
Beispiel #9
0
 void HandleEditorEvent(EditorEvent obj)
 {
     if (obj is IDocumentDirtyEvent)
     {
         UpdateChangeCount(NSDocumentChangeType.Done);
     }
 }
Beispiel #10
0
 public void NotifyEvent(EditorEvent evt)
 {
     if (evt == null)
     {
         return;
     }
     base.Notify(evt);
 }
        public EventListener(IEditor editor, EditorEvent editEvent)
        {
            if (editor == null)
            {
                throw new ArgumentNullException();
            }

            m_editor = editor;
        }
    public EventListener(IEditor editor, EditorEvent editEvent)
    {
      if (editor == null)
      {
        throw new ArgumentNullException();
      }

      m_editor = editor;

    }
Beispiel #13
0
        public override void OnClick()
        {
            EditorEvent.BeginSaveEditing();
            bool hasEdits = false;

            Editor2.EditWorkspace.HasEdits(ref hasEdits);
            if (hasEdits)
            {
                Editor2.EditWorkspace.StopEditing(true);
                Editor2.EditWorkspace.StartEditing(true);
                ((IActiveView)_context.MapControl.Map).Refresh();
                EditorEvent.SaveEditing();
            }
        }
Beispiel #14
0
        void HandleFocusEvent(EditorEvent evnt, Models.CodeCellState sourceCodeCellState)
        {
            var sourceCell = ((CellEditorView)evnt.Source).Cell;

            if (focusedCellState == sourceCodeCellState && focusedWorkbookCell == sourceCell)
            {
                return;
            }

            focusedCellState = sourceCodeCellState;

            UpdateFocusedCellViewFooter(false);
            focusedWorkbookCell = sourceCell;
            UpdateFocusedCellViewFooter(true);
        }
 public int Execute(ref EditorSystemContext context, EditorEvent assetEvent)
 {
     if (assetEvent == EditorEvent.Build)
     {
         IParseDependencyWriter binarywriter = AssetWindowConfig.GetDepWriter();
         string exportPath       = GetOutputPath() + "/" + AssetBundleConfig.DepFileName;
         string streamexportPath = AssetBundleHelper.GetBundleStreamPath(AssetBundleConfig.DepFileName);
         if (binarywriter == null || !binarywriter.Write(exportPath) || !binarywriter.Write(streamexportPath))
         {
             return(-1);
         }
         AssetDatabase.Refresh();
     }
     return(0);
 }
Beispiel #16
0
 /// <summary>
 /// Is called by debugger before continueing in debug.
 /// </summary>
 /// <returns>Returns true if succeed.</returns>
 public bool BeforeContinue()
 {
     if (!eventCreator.UpToDate)
     {
         lastEvent = eventCreator.GetChanges();
         if (!this.patchWithEnC(lastEvent))
         {
             MessageService.ShowError("EnC was not to able to propagate changes. See Errors for detials.");
             WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger;
             winDebugger.Stop();
             return(false);
         }
         eventCreator.Reset();
     }
     return(true);
 }
        public int Execute(ref EditorSystemContext context, EditorEvent assetEvent)
        {
            if (assetEvent == EditorEvent.Enable)
            {
#if UNITY_EDITOR
                string path = GetOutputPath();
                if (!string.IsNullOrEmpty(path))
                {
                    string dirname   = AssetBundleEditorHelper.GetDirectoryName(path);
                    string allabpath = path + "/" + dirname;
                    if (File.Exists(allabpath) && AssetBundleLoadManager.mIns != null)
                    {
                        int retcode = 0;
                        try
                        {
                            var allmanifest = AssetBundleLoadManager.mIns.GetManifest(allabpath);
                            if (allmanifest != null)
                            {
                                if (context.Manifests == null)
                                {
                                    context.Manifests = new Dictionary <string, AssetBundleBuildInfo>();
                                }
                                else
                                {
                                    context.Manifests.Clear();
                                }

                                var ablist = allmanifest.GetAllAssetBundles();
                                foreach (var assetbundlename in ablist)
                                {
                                    AssignMainfest(ref context, allmanifest, path, assetbundlename);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(e);
                            retcode = -1;
                        }

                        return(retcode);
                    }
                }
#endif
            }
            return(0);
        }
Beispiel #18
0
        private void regenMovedSymbolsClass(IClass cClass, EditorEvent edEvent, SymbolWriterClass emitter)
        {
            Predicate <string> del = delegate(string name){
                return(FileUtility.IsEqualFileName(name, cClass.CompilationUnit.FileName));
            };

            if (edEvent.touched.Exists(del))
            {
                if (cClass is CompoundClass)
                {
                    foreach (IClass tClass in ((CompoundClass)cClass).Parts)
                    {
                        regenMovedSymbolsClass(tClass, edEvent, emitter);
                    }
                }
                else
                {
                    foreach (IMethod method in cClass.Methods)
                    {
                        if (!edEvent.changes.Exists(delegate(SourceChange change){
                            return(change.NewEntity is IMethod && MemberComparator.SameMethodOverloads(method, (IMethod)change.NewEntity));
                        }))
                        {
                            regenMovedSymbolsMethod(method, emitter);
                        }
                    }
                    foreach (IClass tClass in cClass.InnerClasses)
                    {
                        regenMovedSymbolsClass(tClass, edEvent, emitter);
                    }
                    foreach (IProperty tProp in cClass.Properties)
                    {
                        if (!edEvent.changes.Exists(delegate(SourceChange change){
                            return(change.NewEntity is IProperty && MemberComparator.SameProperties(tProp, (IProperty)change.NewEntity));
                        }))
                        {
                            regenMovedSymbolsProperty(tProp, emitter);
                        }
                    }
                }
            }
        }
Beispiel #19
0
        void HandleEditorEvent(EditorEvent evnt)
        {
            CodeCells.TryGetValue(evnt.Source, out var sourceCodeCellState);

            switch (evnt)
            {
            case EvaluateCodeCellEvent _:
                EvaluateCodeCellAsync(sourceCodeCellState).Forget();
                break;

            case InsertCellEvent <MarkdownCell> insertCellEvent:
                InsertOrFocusMarkdownCell(insertCellEvent.SourceCell);
                break;

            case InsertCellEvent <CodeCell> insertCellEvent:
                InsertCodeCell(insertCellEvent.SourceCell);
                break;

            case FocusEvent focusEvent:
                HandleFocusEvent(focusEvent, sourceCodeCellState);
                break;

            case FocusSiblingEditorEvent focusSiblingEditorEvent:
                HandleFocusSiblingEditor(focusSiblingEditorEvent);
                break;

            case NavigateReplHistoryEvent navigateReplHistoryEvent:
                HandleNavigateReplHistoryEvent(navigateReplHistoryEvent);
                break;

            case ChangeEvent _ when sourceCodeCellState != null &&
                ClientSession.SessionKind == ClientSessionKind.Workbook:
                sourceCodeCellState.View.IsDirty = true;
                break;
            }
        }
 public void Invoke(EditorEvent cb, Event e)
 {
     cb?.Invoke(e);
 }
Beispiel #21
0
        private void TryClose()
        {
            _context.ShowCommandString("结束编辑", CommandTipsType.CTTEnd);

            bool hasEdits = false;

            EditorEvent.BeginStopEditing();
            IActiveView focusMap = _context.MapControl.Map as IActiveView;

            _context.MapControl.Map.ClearSelection();
            try
            {
                Editor2.EditWorkspace.HasEdits(ref hasEdits);
            }
            catch
            {
            }
            if (hasEdits)
            {
                DialogResult result = MessageService.Current.AskWithCancel("数据已经被修改过,保存修改吗?");
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                if (result == DialogResult.Yes)
                {
                    Editor2.EditWorkspace.StopEditing(true);
                    Editor2.EditWorkspace       = null;
                    Editor2.EditMap             = null;
                    Editor2.CurrentEditTemplate = null;
                    //_context.HideDockWindow(EditToolUI.EditTemplateCtrl);
                    focusMap.Refresh();
                }
                else
                {
                    Editor2.EditWorkspace.StopEditing(false);
                    Editor2.EditWorkspace       = null;
                    Editor2.EditMap             = null;
                    Editor2.CurrentEditTemplate = null;
                    //_context.HideDockWindow(EditToolUI.EditTemplateCtrl);
                    focusMap.Refresh();
                }
            }
            else
            {
                try
                {
                    Editor2.EditWorkspace.StopEditing(true);
                }
                catch (Exception)
                {
                }
                Editor2.EditWorkspace       = null;
                Editor2.EditMap             = null;
                Editor2.CurrentEditTemplate = null;
                //_context.HideDockWindow(EditToolUI.EditTemplateCtrl);
                focusMap.Refresh();
            }
            // _context.ResetCurrentTool();
            _context.Config.IsInEdit = false;

            // CodeDomainManage.Clear();
            EditorEvent.StopEditing();
        }
Beispiel #22
0
    public void Show(EditorEvent e)
    {
        currentEvent  = e;
        hiddenTG.isOn = !e.gameObject.activeInHierarchy;
        for (int i = 0; i < pages.Length; ++i)
        {
            pages[i].SetActive(i != (int)e.eventType);
        }
        string str;

        if (e.eventType == LevelEventType.Meta)
        {
            if (e.kd.prop.TryGetValue("Type", out str))
            {
                eventTypeDP.value = eventTypeNameToIndex[str];
            }
            else
            {
                eventTypeDP.value = 0;
            }
            startTimeIF.text = e.kd.startTime.ToString();
            foreach (var p in addedTags)
            {
                Destroy(p.Value.Key);
            }
            addedTags.Clear();
            for (int i = 0; i < tagsToAdd.Length; ++i)
            {
                if (e.kd.prop.ContainsKey(tagsToAdd[i]))
                {
                    AddTag(i, true);
                }
            }
        }
        else
        {
            exitDP.onValueChanged.RemoveAllListeners();
            if (e.kd.prop.TryGetValue(EventTags.Exit, out str))
            {
                exitDP.value = int.Parse(str);
            }
            else
            {
                e.kd.prop[EventTags.Exit] = "0";
                exitDP.value = 0;
            }
            exitDP.onValueChanged.AddListener(OnExitChanged);
            panelDP.onValueChanged.RemoveAllListeners();
            if (e.kd.prop.TryGetValue(EventTags.Panel, out str))
            {
                panelDP.value = str == PanelType.Left.ToString() ? 0 : 1;
            }
            else
            {
                e.kd.prop[EventTags.Panel] = PanelType.Left.ToString();
                panelDP.value = 0;
            }
            panelDP.onValueChanged.AddListener(OnPanelChanged);
            if (e.kd.prop.TryGetValue(EventTags.Type, out str))
            {
                exitDP.interactable = str != EventTypes.HorizontalMove;
            }
            bool dissolvable = false;
            if (e.kd.prop.TryGetValue(EventTags.Note, out str))
            {
                if (str.Split(',').Length > 1)
                {
                    dissolvable = true;
                }
            }
            dissolveBTN.interactable = dissolvable;
            dissolveBTN.GetComponentInChildren <Text>().text = dissolvable ? "分解" : "无法分解";

            string text = "开始时间: " + e.kd.startTime + "\n";
            foreach (var kv in e.kd.prop)
            {
                if (!midiPropDontShow.Contains(kv.Key))
                {
                    text += EventTags.GetChinese(kv.Key) + ": " + kv.Value + "\n";
                }
            }
            midiDesc.text = text;
        }
    }
Beispiel #23
0
 public void CreateFeature(IGeometry igeometry_0)
 {
     try
     {
         if (igeometry_0 != null)
         {
             IFeatureLayer  featureLayer  = Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer;
             IDataset       dataset       = (IDataset)featureLayer.FeatureClass;
             IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)dataset.Workspace;
             int            index         = featureLayer.FeatureClass.FindField(featureLayer.FeatureClass.ShapeFieldName);
             IGeometryDef   geometryDef   = featureLayer.FeatureClass.Fields.get_Field(index).GeometryDef;
             if (geometryDef.HasZ)
             {
                 IZAware iZAware = (IZAware)igeometry_0;
                 iZAware.ZAware = true;
                 IZ     iZ = (IZ)igeometry_0;
                 double constantZ;
                 double num;
                 geometryDef.SpatialReference.GetZDomain(out constantZ, out num);
                 iZ.SetConstantZ(constantZ);
             }
             if (geometryDef.HasM)
             {
                 IMAware iMAware = (IMAware)igeometry_0;
                 iMAware.MAware = true;
             }
             workspaceEdit.StartEditOperation();
             IFeature feature = featureLayer.FeatureClass.CreateFeature();
             if (igeometry_0 is ITopologicalOperator)
             {
                 (igeometry_0 as ITopologicalOperator).Simplify();
             }
             feature.Shape = igeometry_0;
             try
             {
                 IRowSubtypes rowSubtypes = (IRowSubtypes)feature;
                 rowSubtypes.InitDefaultValues();
             }
             catch (Exception exception_)
             {
                 CErrorLog.writeErrorLog(this, exception_, "");
             }
             feature.Store();
             workspaceEdit.StopEditOperation();
             EditorEvent.AddFeature(featureLayer, feature);
             IActiveView activeView = (IActiveView)_context.FocusMap;
             _context.FocusMap.ClearSelection();
             _context.FocusMap.SelectFeature(featureLayer, feature);
             if (igeometry_0.GeometryType == esriGeometryType.esriGeometryPoint)
             {
                 double distance = Common.ConvertPixelsToMapUnits((IActiveView)_context.FocusMap, 30.0);
                 ITopologicalOperator topologicalOperator = (ITopologicalOperator)igeometry_0;
                 topologicalOperator.Buffer(distance);
                 activeView.Refresh();
             }
             else
             {
                 activeView.Refresh();
             }
         }
     }
     catch (COMException ex)
     {
         if (ex.ErrorCode == -2147220936)
         {
             System.Windows.Forms.MessageBox.Show("坐标值或量测值超出范围!", "创建要素",
                                                  System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
         }
     }
 }
Beispiel #24
0
 static void AssemblyCompilationStarted(string assembly)
 {
     EditorEvent?.Invoke(Event.AssemblyCompilationStarted, Path.GetFileName(assembly));
 }
Beispiel #25
0
 static void AssemblyCompilationFinished(string assembly, CompilerMessage[] messages)
 {
     EditorEvent?.Invoke(Event.AssemblyCompilationFinished, Path.GetFileName(assembly));
 }
    public void ListenToEvents(EditorEvent editEvent, bool start)
    {
      switch (editEvent)
      {
        case EditorEvent.AfterDrawSketch:
          if (start)
            ((IEditEvents_Event)m_editor).AfterDrawSketch += new 
              IEditEvents_AfterDrawSketchEventHandler(EventListener_AfterDrawSketch);
          else
            ((IEditEvents_Event)m_editor).AfterDrawSketch -= new
              IEditEvents_AfterDrawSketchEventHandler(EventListener_AfterDrawSketch);
          break;
        case EditorEvent.OnChangeFeature:
          if (start)
            ((IEditEvents_Event)m_editor).OnChangeFeature += new 
              IEditEvents_OnChangeFeatureEventHandler(EventListener_OnChangeFeature); 
          else
            ((IEditEvents_Event)m_editor).OnChangeFeature -= new
              IEditEvents_OnChangeFeatureEventHandler(EventListener_OnChangeFeature);
          break;
        case EditorEvent.OnConflictsDetected:
          if (start)
            ((IEditEvents_Event)m_editor).OnConflictsDetected += new 
              IEditEvents_OnConflictsDetectedEventHandler(EventListener_OnConflictsDetected);
          else
            ((IEditEvents_Event)m_editor).OnConflictsDetected -= new
              IEditEvents_OnConflictsDetectedEventHandler(EventListener_OnConflictsDetected);
          break;
        case EditorEvent.OnCreateFeature:
          if (start)
            ((IEditEvents_Event)m_editor).OnCreateFeature += new 
              IEditEvents_OnCreateFeatureEventHandler(EventListener_OnCreateFeature);
          else
            ((IEditEvents_Event)m_editor).OnCreateFeature -= new
              IEditEvents_OnCreateFeatureEventHandler(EventListener_OnCreateFeature);
          break;

        case EditorEvent.OnCurrentLayerChanged:
          if (start)
            ((IEditEvents_Event)m_editor).OnCurrentLayerChanged += new 
              IEditEvents_OnCurrentLayerChangedEventHandler(EventListener_OnCurrentLayerChanged); 
          else
            ((IEditEvents_Event)m_editor).OnCurrentLayerChanged -= new
              IEditEvents_OnCurrentLayerChangedEventHandler(EventListener_OnCurrentLayerChanged);
          break;
        case EditorEvent.OnCurrentTaskChanged:
          if (start)
          ((IEditEvents_Event)m_editor).OnCurrentTaskChanged += new 
            IEditEvents_OnCurrentTaskChangedEventHandler(OnCurrentTaskChanged);
          else
          ((IEditEvents_Event)m_editor).OnCurrentTaskChanged -= new
            IEditEvents_OnCurrentTaskChangedEventHandler(OnCurrentTaskChanged);
          break;
        case EditorEvent.OnDeleteFeature:
          if (start)
            ((IEditEvents_Event)m_editor).OnDeleteFeature += new 
              IEditEvents_OnDeleteFeatureEventHandler(EventListener_OnDeleteFeature);
          else
            ((IEditEvents_Event)m_editor).OnDeleteFeature -= new
              IEditEvents_OnDeleteFeatureEventHandler(EventListener_OnDeleteFeature);
          break;
        case EditorEvent.OnRedo:
          if (start)
            ((IEditEvents_Event)m_editor).OnRedo += new 
              IEditEvents_OnRedoEventHandler(EventListener_OnRedo); 
          else
            ((IEditEvents_Event)m_editor).OnRedo -= new
              IEditEvents_OnRedoEventHandler(EventListener_OnRedo);
          break;
        case EditorEvent.OnSelectionChanged:
          if (start)
            ((IEditEvents_Event)m_editor).OnSelectionChanged +=new 
              IEditEvents_OnSelectionChangedEventHandler(EventListener_OnSelectionChanged); 
          else
            ((IEditEvents_Event)m_editor).OnSelectionChanged -= new
              IEditEvents_OnSelectionChangedEventHandler(EventListener_OnSelectionChanged);
          break;
        case EditorEvent.OnSketchFinished:
          if (start)
            ((IEditEvents_Event)m_editor).OnSketchFinished += new 
              IEditEvents_OnSketchFinishedEventHandler(EventListener_OnSketchFinished);
          else
            ((IEditEvents_Event)m_editor).OnSketchFinished -= new
              IEditEvents_OnSketchFinishedEventHandler(EventListener_OnSketchFinished); 
          break;
        case EditorEvent.OnSketchModified:
          if (start)
            ((IEditEvents_Event)m_editor).OnSketchModified += new 
              IEditEvents_OnSketchModifiedEventHandler(EventListener_OnSketchModified);
          else
            ((IEditEvents_Event)m_editor).OnSketchModified -= new
              IEditEvents_OnSketchModifiedEventHandler(EventListener_OnSketchModified);
          break;
        case EditorEvent.OnStartEditing:
          if (start)
            ((IEditEvents_Event)m_editor).OnStartEditing += new
              IEditEvents_OnStartEditingEventHandler(OnStartEditing);
          else
            ((IEditEvents_Event)m_editor).OnStartEditing -= new
              IEditEvents_OnStartEditingEventHandler(OnStartEditing); 
          break;          
        case EditorEvent.OnStopEditing:
          if (start)
            ((IEditEvents_Event)m_editor).OnStopEditing += new 
              IEditEvents_OnStopEditingEventHandler(OnStopEditing);
          else
            ((IEditEvents_Event)m_editor).OnStopEditing -= new
              IEditEvents_OnStopEditingEventHandler(OnStopEditing); 
          break;
        case EditorEvent.OnUndo:
          if (start)
            ((IEditEvents_Event)m_editor).OnUndo += new 
              IEditEvents_OnUndoEventHandler(EventListener_OnUndo); 
          else
            ((IEditEvents_Event)m_editor).OnUndo -= new
              IEditEvents_OnUndoEventHandler(EventListener_OnUndo);
          break;
        case EditorEvent.BeforeStopEditing:
          if (start)
            ((IEditEvents2_Event)m_editor).BeforeStopEditing += new 
              IEditEvents2_BeforeStopEditingEventHandler(EventListener_BeforeStopEditing); 
          else
            ((IEditEvents2_Event)m_editor).BeforeStopEditing -= new
              IEditEvents2_BeforeStopEditingEventHandler(EventListener_BeforeStopEditing);
          break;
        case EditorEvent.BeforeStopOperation:
          if (start)
            ((IEditEvents2_Event)m_editor).BeforeStopOperation += new 
              IEditEvents2_BeforeStopOperationEventHandler(EventListener_BeforeStopOperation);
          else
            ((IEditEvents2_Event)m_editor).BeforeStopOperation -= new
              IEditEvents2_BeforeStopOperationEventHandler(EventListener_BeforeStopOperation);
          break;
        case EditorEvent.OnVertexAdded:
          if (start)
            ((IEditEvents2_Event)m_editor).OnVertexAdded +=new 
              IEditEvents2_OnVertexAddedEventHandler(EventListener_OnVertexAdded); 
          else
            ((IEditEvents2_Event)m_editor).OnVertexAdded -= new
              IEditEvents2_OnVertexAddedEventHandler(EventListener_OnVertexAdded);
          break;
        case EditorEvent.OnVertexMoved:
          if (start)
            ((IEditEvents2_Event)m_editor).OnVertexMoved += new 
              IEditEvents2_OnVertexMovedEventHandler(EventListener_OnVertexMoved); 
          else
            ((IEditEvents2_Event)m_editor).OnVertexMoved -= new
              IEditEvents2_OnVertexMovedEventHandler(EventListener_OnVertexMoved);
          break;
        case EditorEvent.OnVertexDeleted:
          if (start)
            ((IEditEvents2_Event)m_editor).OnVertexDeleted += new 
              IEditEvents2_OnVertexDeletedEventHandler(EventListener_OnVertexDeleted);              
          else
            ((IEditEvents2_Event)m_editor).OnVertexDeleted -= new
              IEditEvents2_OnVertexDeletedEventHandler(EventListener_OnVertexDeleted);
          break;
        case EditorEvent.BeforeDrawSketch:
          if (start)
            ((IEditEvents3_Event)m_editor).BeforeDrawSketch += new 
              IEditEvents3_BeforeDrawSketchEventHandler(EventListener_BeforeDrawSketch);              
          else
            ((IEditEvents3_Event)m_editor).BeforeDrawSketch -= new 
              IEditEvents3_BeforeDrawSketchEventHandler(EventListener_BeforeDrawSketch);              
          break;
        case EditorEvent.OnAngularCorrectionOffsetChanged:
          if (start)
            ((IEditEvents4_Event)m_editor).OnAngularCorrectionOffsetChanged += new 
              IEditEvents4_OnAngularCorrectionOffsetChangedEventHandler(EventListener_OnAngularCorrectionOffsetChanged);              
          else
            ((IEditEvents4_Event)m_editor).OnAngularCorrectionOffsetChanged -= new 
              IEditEvents4_OnAngularCorrectionOffsetChangedEventHandler(EventListener_OnAngularCorrectionOffsetChanged);              
          break;
        case EditorEvent.OnDistanceCorrectionFactorChanged:
          if (start)
            ((IEditEvents4_Event)m_editor).OnDistanceCorrectionFactorChanged += new 
              IEditEvents4_OnDistanceCorrectionFactorChangedEventHandler(EventListener_OnDistanceCorrectionFactorChanged); 
          else
            ((IEditEvents4_Event)m_editor).OnDistanceCorrectionFactorChanged -= new 
              IEditEvents4_OnDistanceCorrectionFactorChangedEventHandler(EventListener_OnDistanceCorrectionFactorChanged); 
          break;
        case EditorEvent.OnUseGroundToGridChanged:
          if (start)
            ((IEditEvents4_Event)m_editor).OnUseGroundToGridChanged += new 
              IEditEvents4_OnUseGroundToGridChangedEventHandler(EventListener_OnUseGroundToGridChanged);
        
          else
            ((IEditEvents4_Event)m_editor).OnUseGroundToGridChanged -= new 
              IEditEvents4_OnUseGroundToGridChangedEventHandler(EventListener_OnUseGroundToGridChanged);
          break;
        default:
          break;

      }

    }
Beispiel #27
0
 static void AssemblyReloadStarted()
 {
     EditorEvent?.Invoke(Event.AssemblyReloadStarted, null);
 }
Beispiel #28
0
 static void AssemblyReloadFinished()
 {
     EditorEvent?.Invoke(Event.AssemblyReloadFinished, null);
 }
Beispiel #29
0
        public void ListenToEvents(EditorEvent editEvent, bool start)
        {
            switch (editEvent)
            {
            case EditorEvent.OnAbort:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnAbort += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnAbort -= OnEvent;
                }
                break;

            case EditorEvent.OnAfterDrawSketch:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnAfterDrawSketch += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnAfterDrawSketch -= OnEvent;
                }
                break;

            case EditorEvent.OnBeforeStopEditing:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnBeforeStopEditing += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnBeforeStopEditing -= OnEvent;
                }
                break;

            case EditorEvent.OnBeforeStopOperation:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnBeforeStopOperation += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnBeforeStopOperation -= OnEvent;
                }
                break;

            case EditorEvent.OnChangeFeature:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnChangeFeature += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnChangeFeature -= OnEvent;
                }
                break;

            case EditorEvent.OnConflictsDetected:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnConflictsDetected += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnConflictsDetected -= OnEvent;
                }
                break;

            case EditorEvent.OnCreateFeature:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnCreateFeature += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnCreateFeature -= OnEvent;
                }
                break;

            case EditorEvent.OnCurrentTaskChanged:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnCurrentTaskChanged += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnCurrentTaskChanged -= OnEvent;
                }
                break;

            case EditorEvent.OnCurrentZChanged:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnCurrentZChanged += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnCurrentZChanged -= OnEvent;
                }
                break;

            case EditorEvent.OnDeleteFeature:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnDeleteFeature += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnDeleteFeature -= OnEvent;
                }
                break;

            case EditorEvent.OnSaveEdits:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnSaveEdits += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnSaveEdits -= OnEvent;
                }
                break;

            case EditorEvent.OnSelectionChanged:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnSelectionChanged += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnSelectionChanged -= OnEvent;
                }
                break;

            case EditorEvent.OnSketchFinished:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnSketchFinished += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnSketchFinished -= OnEvent;
                }
                break;

            case EditorEvent.OnSketchModified:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnSketchModified += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnSketchModified -= OnEvent;
                }
                break;

            case EditorEvent.OnStartEditing:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnStartEditing += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnStartEditing -= OnEvent;
                }
                break;

            case EditorEvent.OnStartOperation:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnStartOperation += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnStartOperation -= OnEvent;
                }
                break;

            case EditorEvent.OnStopEditing:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnStopEditing += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnStopEditing -= OnEvent;
                }
                break;

            case EditorEvent.OnStopOperation:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnStopOperation += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnStopOperation -= OnEvent;
                }
                break;

            case EditorEvent.OnTargetLayerChanged:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnTargetLayerChanged += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnTargetLayerChanged -= OnEvent;
                }
                break;

            case EditorEvent.OnVertexAdded:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnVertexAdded += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnVertexAdded -= OnEvent;
                }
                break;

            case EditorEvent.OnVertexMoved:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnVertexMoved += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnVertexMoved -= OnEvent;
                }
                break;

            case EditorEvent.OnVertexDeleted:
                if (start)
                {
                    ((IEngineEditEvents_Event)m_editor).OnVertexDeleted += OnEvent;
                }
                else
                {
                    ((IEngineEditEvents_Event)m_editor).OnVertexDeleted -= OnEvent;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #30
0
        public static string SketchMouseDown(IPoint ipoint_0, IActiveView iactiveView_0, IFeatureLayer ifeatureLayer_0)
        {
            INewPolylineFeedback feedback;
            string str;
            INewPolygonFeedbackEx newPolygonFeedbackEx;
            object value;
            INewPolylineFeedback newPolylineFeedback;
            double num;

            string[] strArrays;
            double   num1;
            double   length;

            if (SketchToolAssist.IsDrawTempLine == DrawTempGeometry.Line)
            {
                if (SketchToolAssist.Feedback != null)
                {
                    feedback = (INewPolylineFeedback)SketchToolAssist.Feedback;
                    feedback.AddPoint(SketchShareEx.m_pAnchorPoint);
                    object obj    = Missing.Value;
                    object value1 = Missing.Value;
                    SketchToolAssist.m_pPointColn.AddPoint(SketchShareEx.m_pAnchorPoint, ref obj, ref value1);
                }
                else
                {
                    SketchShareEx.m_bInUse    = true;
                    SketchToolAssist.Feedback = new NewPolylineFeedback();
                    feedback = (INewPolylineFeedback)SketchToolAssist.Feedback;
                    SketchToolAssist.Feedback.Display = iactiveView_0.ScreenDisplay;
                    feedback.ChangeLineType((enumLineType)SketchToolAssist.LineType);
                    feedback.Start(SketchShareEx.m_pAnchorPoint);
                    SketchToolAssist.m_pPointColn = new Polyline();
                    object obj1   = Missing.Value;
                    object value2 = Missing.Value;
                    SketchToolAssist.m_pPointColn.AddPoint(SketchShareEx.m_pAnchorPoint, ref obj1, ref value2);
                }
                str = "";
            }
            else if (SketchToolAssist.IsDrawTempLine == DrawTempGeometry.Fill)
            {
                if (SketchToolAssist.Feedback != null)
                {
                    newPolygonFeedbackEx = (INewPolygonFeedbackEx)SketchToolAssist.Feedback;
                    newPolygonFeedbackEx.AddPoint(SketchShareEx.m_pAnchorPoint);
                    object obj2   = Missing.Value;
                    object value3 = Missing.Value;
                    SketchToolAssist.m_pPointColn.AddPoint(SketchShareEx.m_pAnchorPoint, ref obj2, ref value3);
                }
                else
                {
                    SketchShareEx.m_bInUse            = true;
                    SketchToolAssist.Feedback         = new NewPolygonFeedbackEx();
                    newPolygonFeedbackEx              = (INewPolygonFeedbackEx)SketchToolAssist.Feedback;
                    SketchToolAssist.Feedback.Display = iactiveView_0.ScreenDisplay;
                    newPolygonFeedbackEx.ChangeLineType((enumLineType)SketchToolAssist.LineType);
                    newPolygonFeedbackEx.Start(SketchShareEx.m_pAnchorPoint);
                    SketchToolAssist.m_pPointColn = new Polygon();
                    object obj3   = Missing.Value;
                    object value4 = Missing.Value;
                    SketchToolAssist.m_pPointColn.AddPoint(SketchShareEx.m_pAnchorPoint, ref obj3, ref value4);
                }
                str = "";
            }
            else if (SketchToolAssist.IsDrawTempLine == DrawTempGeometry.Point)
            {
                SketchToolAssist.TempLine = SketchShareEx.m_pAnchorPoint;
                str = "";
            }
            else if (ifeatureLayer_0 == null)
            {
                str = "";
            }
            else if (ifeatureLayer_0.FeatureClass != null)
            {
                string str1 = "";
                string unit = "";
                SketchShareEx.IsFixDirection = false;
                SketchShareEx.IsFixLength    = false;
                if (SketchToolAssist.Feedback == null)
                {
                    if (ifeatureLayer_0.FeatureClass.FeatureType == esriFeatureType.esriFTAnnotation)
                    {
                        try
                        {
                            Editor.EditWorkspace.StartEditOperation();
                            IFeature feature    = ifeatureLayer_0.FeatureClass.CreateFeature();
                            int      num2       = 0;
                            object   fieldValue = Editor.CurrentEditTemplate.GetFieldValue("SymbolID");
                            if (fieldValue != null)
                            {
                                num2 = Convert.ToInt32(fieldValue);
                            }
                            ITextElement        textElement        = CreateFeatureTool.MakeTextElement("文本", 0, ipoint_0, num2);
                            IAnnotationFeature2 annotationFeature2 = feature as IAnnotationFeature2;
                            annotationFeature2.LinkedFeatureID   = -1;
                            annotationFeature2.AnnotationClassID = 0;
                            annotationFeature2.Annotation        = textElement as IElement;
                            EditorEvent.NewRow(feature);
                            feature.Store();
                            Editor.EditWorkspace.StopEditOperation();
                            EditorEvent.AfterNewRow(feature);
                            iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                            iactiveView_0.FocusMap.ClearSelection();
                            iactiveView_0.FocusMap.SelectFeature(ifeatureLayer_0, feature);
                            iactiveView_0.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        }
                        catch (Exception exception)
                        {
                            Logger.Current.Error("", exception, "");
                        }
                    }
                    else if (ifeatureLayer_0.FeatureClass.FeatureType != esriFeatureType.esriFTDimension)
                    {
                        value = Missing.Value;
                        switch (ifeatureLayer_0.FeatureClass.ShapeType)
                        {
                        case esriGeometryType.esriGeometryPoint:
                        {
                            CreateFeatureTool.CreateFeature(ipoint_0, iactiveView_0, ifeatureLayer_0);
                            break;
                        }

                        case esriGeometryType.esriGeometryMultipoint:
                        {
                            SketchShareEx.m_bInUse    = true;
                            SketchToolAssist.Feedback = new NewMultiPointFeedback();
                            INewMultiPointFeedback newMultiPointFeedback =
                                (INewMultiPointFeedback)SketchToolAssist.Feedback;
                            SketchToolAssist.Feedback.Display = iactiveView_0.ScreenDisplay;
                            SketchShareEx.m_pPointCollection  = new Multipoint();
                            newMultiPointFeedback.Start(SketchShareEx.m_pPointCollection, ipoint_0);
                            break;
                        }

                        case esriGeometryType.esriGeometryPolyline:
                        {
                            SketchShareEx.m_bInUse            = true;
                            SketchToolAssist.Feedback         = new NewPolylineFeedback();
                            newPolylineFeedback               = (INewPolylineFeedback)SketchToolAssist.Feedback;
                            SketchToolAssist.Feedback.Display = iactiveView_0.ScreenDisplay;
                            newPolylineFeedback.Start(ipoint_0);
                            SketchShareEx.PointCount      = 1;
                            SketchShareEx.StartPoint      = ipoint_0;
                            SketchToolAssist.m_pPointColn = new Polyline();
                            SketchToolAssist.m_pPointColn.AddPoint(ipoint_0, ref value, ref value);
                            unit = CommonHelper.GetUnit(iactiveView_0.FocusMap.MapUnits);
                            num  = CommonHelper.measureLength(ipoint_0, 1, ref SketchShareEx.m_pLastPoint1,
                                                              ref SketchShareEx.m_pEndPoint1, ref SketchShareEx.m_totalLength);
                            strArrays = new string[]
                            {
                                "距离 = ", num.ToString("0.###"), unit, ", 总长度 = ",
                                SketchShareEx.m_totalLength.ToString("0.###"), unit
                            };
                            str1 = string.Concat(strArrays);
                            break;
                        }

                        case esriGeometryType.esriGeometryPolygon:
                        {
                            SketchShareEx.m_bInUse    = true;
                            SketchToolAssist.Feedback = new NewPolygonFeedbackEx();
                            INewPolygonFeedbackEx feedback1 = (INewPolygonFeedbackEx)SketchToolAssist.Feedback;
                            SketchToolAssist.Feedback.Display = iactiveView_0.ScreenDisplay;
                            feedback1.Start(ipoint_0);
                            SketchShareEx.PointCount      = 0;
                            SketchToolAssist.m_pPointColn = new Polygon();
                            SketchShareEx.StartPoint      = ipoint_0;
                            unit   = CommonHelper.GetUnit(iactiveView_0.FocusMap.MapUnits);
                            num1   = CommonHelper.measureArea(ipoint_0, 1, ref SketchToolAssist.m_pPointColn);
                            length = (SketchToolAssist.m_pPointColn as IPolygon).Length;
                            if (num1 <= 0)
                            {
                                break;
                            }
                            str1 = string.Format("周长 = {0:0.###} {1} ,总面积 = {2:0.###} 平方{1}", length, unit, num1);
                            break;
                        }
                        }
                    }
                    else
                    {
                        SketchToolAssist.Feedback = new NewDimensionFeedback();
                        try
                        {
                            (SketchToolAssist.Feedback as INewDimensionFeedback).ReferenceScale =
                                (iactiveView_0 as IMap).ReferenceScale;
                            (SketchToolAssist.Feedback as INewDimensionFeedback).ReferenceScaleUnits =
                                (iactiveView_0 as IMap).MapUnits;
                        }
                        catch
                        {
                        }
                        SketchToolAssist.Feedback.Display = iactiveView_0.ScreenDisplay;
                        (SketchToolAssist.Feedback as INewDimensionFeedback).Start(ipoint_0);
                        SketchShareEx.PointCount = 1;
                    }
                }
                else if (SketchToolAssist.Feedback is INewDimensionFeedback)
                {
                    SketchShareEx.PointCount = SketchShareEx.PointCount + 1;
                    (SketchToolAssist.Feedback as INewDimensionFeedback).AddPoint(ipoint_0);
                    if (SketchShareEx.PointCount == 3)
                    {
                        IDimensionShape dimensionShape = (SketchToolAssist.Feedback as INewDimensionFeedback).Stop();
                        CreateFeatureTool.CreateDimensionFeature(dimensionShape,
                                                                 (SketchToolAssist.Feedback as INewDimensionFeedback).DimensionType, iactiveView_0,
                                                                 ifeatureLayer_0);
                    }
                }
                else if (SketchToolAssist.Feedback is INewMultiPointFeedback)
                {
                    value = Missing.Value;
                    SketchShareEx.m_pPointCollection.AddPoint(ipoint_0, ref value, ref value);
                    (SketchToolAssist.Feedback as INewMultiPointFeedback).Start(SketchShareEx.m_pPointCollection,
                                                                                ipoint_0);
                }
                else if (SketchToolAssist.Feedback is INewLineFeedback)
                {
                    newPolylineFeedback = (INewPolylineFeedback)SketchToolAssist.Feedback;
                    value = Missing.Value;
                    newPolylineFeedback.AddPoint(ipoint_0);
                    SketchToolAssist.m_pPointColn.AddPoint(ipoint_0, ref value, ref value);
                    SketchShareEx.PointCount = SketchShareEx.PointCount + 1;
                    unit = CommonHelper.GetUnit(iactiveView_0.FocusMap.MapUnits);
                    num  = CommonHelper.measureLength(ipoint_0, 1, ref SketchShareEx.m_pLastPoint1,
                                                      ref SketchShareEx.m_pEndPoint1, ref SketchShareEx.m_totalLength);
                    strArrays = new string[]
                    {
                        "距离 = ", num.ToString("0.###"), unit, ", 总长度 = ", SketchShareEx.m_totalLength.ToString("0.###"),
                        unit
                    };
                    str1 = string.Concat(strArrays);
                }
                else if (SketchToolAssist.Feedback is INewPolygonFeedback)
                {
                    ((INewPolygonFeedbackEx)SketchToolAssist.Feedback).AddPoint(ipoint_0);
                    SketchShareEx.PointCount = SketchShareEx.PointCount + 1;
                    unit   = CommonHelper.GetUnit(iactiveView_0.FocusMap.MapUnits);
                    num1   = CommonHelper.measureArea(ipoint_0, 1, ref SketchToolAssist.m_pPointColn);
                    length = (SketchToolAssist.m_pPointColn as IPolygon).Length;
                    if (num1 > 0)
                    {
                        str1 = string.Format("周长 = {0:0.###} {1} ,总面积 = {2:0.###} 平方{1}", length, unit, num1);
                    }
                }
                if (SketchShareEx.LastPoint == null)
                {
                    SketchShareEx.LastPoint = new ESRI.ArcGIS.Geometry.Point();
                }
                SketchShareEx.LastPoint.PutCoords(ipoint_0.X, ipoint_0.Y);
                str = str1;
            }
            else
            {
                str = "";
            }
            return(str);
        }
        public void ListenToEvents(EditorEvent editEvent, bool start)
        {
            switch (editEvent)
            {
            case EditorEvent.AfterDrawSketch:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).AfterDrawSketch += new
                                                                     IEditEvents_AfterDrawSketchEventHandler(EventListener_AfterDrawSketch);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).AfterDrawSketch -= new
                                                                     IEditEvents_AfterDrawSketchEventHandler(EventListener_AfterDrawSketch);
                }
                break;

            case EditorEvent.OnChangeFeature:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnChangeFeature += new
                                                                     IEditEvents_OnChangeFeatureEventHandler(EventListener_OnChangeFeature);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnChangeFeature -= new
                                                                     IEditEvents_OnChangeFeatureEventHandler(EventListener_OnChangeFeature);
                }
                break;

            case EditorEvent.OnConflictsDetected:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnConflictsDetected += new
                                                                         IEditEvents_OnConflictsDetectedEventHandler(EventListener_OnConflictsDetected);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnConflictsDetected -= new
                                                                         IEditEvents_OnConflictsDetectedEventHandler(EventListener_OnConflictsDetected);
                }
                break;

            case EditorEvent.OnCreateFeature:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnCreateFeature += new
                                                                     IEditEvents_OnCreateFeatureEventHandler(EventListener_OnCreateFeature);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnCreateFeature -= new
                                                                     IEditEvents_OnCreateFeatureEventHandler(EventListener_OnCreateFeature);
                }
                break;

            case EditorEvent.OnCurrentLayerChanged:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnCurrentLayerChanged += new
                                                                           IEditEvents_OnCurrentLayerChangedEventHandler(EventListener_OnCurrentLayerChanged);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnCurrentLayerChanged -= new
                                                                           IEditEvents_OnCurrentLayerChangedEventHandler(EventListener_OnCurrentLayerChanged);
                }
                break;

            case EditorEvent.OnCurrentTaskChanged:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnCurrentTaskChanged += new
                                                                          IEditEvents_OnCurrentTaskChangedEventHandler(OnCurrentTaskChanged);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnCurrentTaskChanged -= new
                                                                          IEditEvents_OnCurrentTaskChangedEventHandler(OnCurrentTaskChanged);
                }
                break;

            case EditorEvent.OnDeleteFeature:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnDeleteFeature += new
                                                                     IEditEvents_OnDeleteFeatureEventHandler(EventListener_OnDeleteFeature);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnDeleteFeature -= new
                                                                     IEditEvents_OnDeleteFeatureEventHandler(EventListener_OnDeleteFeature);
                }
                break;

            case EditorEvent.OnRedo:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnRedo += new
                                                            IEditEvents_OnRedoEventHandler(EventListener_OnRedo);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnRedo -= new
                                                            IEditEvents_OnRedoEventHandler(EventListener_OnRedo);
                }
                break;

            case EditorEvent.OnSelectionChanged:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnSelectionChanged += new
                                                                        IEditEvents_OnSelectionChangedEventHandler(EventListener_OnSelectionChanged);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnSelectionChanged -= new
                                                                        IEditEvents_OnSelectionChangedEventHandler(EventListener_OnSelectionChanged);
                }
                break;

            case EditorEvent.OnSketchFinished:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnSketchFinished += new
                                                                      IEditEvents_OnSketchFinishedEventHandler(EventListener_OnSketchFinished);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnSketchFinished -= new
                                                                      IEditEvents_OnSketchFinishedEventHandler(EventListener_OnSketchFinished);
                }
                break;

            case EditorEvent.OnSketchModified:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnSketchModified += new
                                                                      IEditEvents_OnSketchModifiedEventHandler(EventListener_OnSketchModified);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnSketchModified -= new
                                                                      IEditEvents_OnSketchModifiedEventHandler(EventListener_OnSketchModified);
                }
                break;

            case EditorEvent.OnStartEditing:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnStartEditing += new
                                                                    IEditEvents_OnStartEditingEventHandler(OnStartEditing);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnStartEditing -= new
                                                                    IEditEvents_OnStartEditingEventHandler(OnStartEditing);
                }
                break;

            case EditorEvent.OnStopEditing:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnStopEditing += new
                                                                   IEditEvents_OnStopEditingEventHandler(OnStopEditing);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnStopEditing -= new
                                                                   IEditEvents_OnStopEditingEventHandler(OnStopEditing);
                }
                break;

            case EditorEvent.OnUndo:
                if (start)
                {
                    ((IEditEvents_Event)m_editor).OnUndo += new
                                                            IEditEvents_OnUndoEventHandler(EventListener_OnUndo);
                }
                else
                {
                    ((IEditEvents_Event)m_editor).OnUndo -= new
                                                            IEditEvents_OnUndoEventHandler(EventListener_OnUndo);
                }
                break;

            case EditorEvent.BeforeStopEditing:
                if (start)
                {
                    ((IEditEvents2_Event)m_editor).BeforeStopEditing += new
                                                                        IEditEvents2_BeforeStopEditingEventHandler(EventListener_BeforeStopEditing);
                }
                else
                {
                    ((IEditEvents2_Event)m_editor).BeforeStopEditing -= new
                                                                        IEditEvents2_BeforeStopEditingEventHandler(EventListener_BeforeStopEditing);
                }
                break;

            case EditorEvent.BeforeStopOperation:
                if (start)
                {
                    ((IEditEvents2_Event)m_editor).BeforeStopOperation += new
                                                                          IEditEvents2_BeforeStopOperationEventHandler(EventListener_BeforeStopOperation);
                }
                else
                {
                    ((IEditEvents2_Event)m_editor).BeforeStopOperation -= new
                                                                          IEditEvents2_BeforeStopOperationEventHandler(EventListener_BeforeStopOperation);
                }
                break;

            case EditorEvent.OnVertexAdded:
                if (start)
                {
                    ((IEditEvents2_Event)m_editor).OnVertexAdded += new
                                                                    IEditEvents2_OnVertexAddedEventHandler(EventListener_OnVertexAdded);
                }
                else
                {
                    ((IEditEvents2_Event)m_editor).OnVertexAdded -= new
                                                                    IEditEvents2_OnVertexAddedEventHandler(EventListener_OnVertexAdded);
                }
                break;

            case EditorEvent.OnVertexMoved:
                if (start)
                {
                    ((IEditEvents2_Event)m_editor).OnVertexMoved += new
                                                                    IEditEvents2_OnVertexMovedEventHandler(EventListener_OnVertexMoved);
                }
                else
                {
                    ((IEditEvents2_Event)m_editor).OnVertexMoved -= new
                                                                    IEditEvents2_OnVertexMovedEventHandler(EventListener_OnVertexMoved);
                }
                break;

            case EditorEvent.OnVertexDeleted:
                if (start)
                {
                    ((IEditEvents2_Event)m_editor).OnVertexDeleted += new
                                                                      IEditEvents2_OnVertexDeletedEventHandler(EventListener_OnVertexDeleted);
                }
                else
                {
                    ((IEditEvents2_Event)m_editor).OnVertexDeleted -= new
                                                                      IEditEvents2_OnVertexDeletedEventHandler(EventListener_OnVertexDeleted);
                }
                break;

            case EditorEvent.BeforeDrawSketch:
                if (start)
                {
                    ((IEditEvents3_Event)m_editor).BeforeDrawSketch += new
                                                                       IEditEvents3_BeforeDrawSketchEventHandler(EventListener_BeforeDrawSketch);
                }
                else
                {
                    ((IEditEvents3_Event)m_editor).BeforeDrawSketch -= new
                                                                       IEditEvents3_BeforeDrawSketchEventHandler(EventListener_BeforeDrawSketch);
                }
                break;

            case EditorEvent.OnAngularCorrectionOffsetChanged:
                if (start)
                {
                    ((IEditEvents4_Event)m_editor).OnAngularCorrectionOffsetChanged += new
                                                                                       IEditEvents4_OnAngularCorrectionOffsetChangedEventHandler(EventListener_OnAngularCorrectionOffsetChanged);
                }
                else
                {
                    ((IEditEvents4_Event)m_editor).OnAngularCorrectionOffsetChanged -= new
                                                                                       IEditEvents4_OnAngularCorrectionOffsetChangedEventHandler(EventListener_OnAngularCorrectionOffsetChanged);
                }
                break;

            case EditorEvent.OnDistanceCorrectionFactorChanged:
                if (start)
                {
                    ((IEditEvents4_Event)m_editor).OnDistanceCorrectionFactorChanged += new
                                                                                        IEditEvents4_OnDistanceCorrectionFactorChangedEventHandler(EventListener_OnDistanceCorrectionFactorChanged);
                }
                else
                {
                    ((IEditEvents4_Event)m_editor).OnDistanceCorrectionFactorChanged -= new
                                                                                        IEditEvents4_OnDistanceCorrectionFactorChangedEventHandler(EventListener_OnDistanceCorrectionFactorChanged);
                }
                break;

            case EditorEvent.OnUseGroundToGridChanged:
                if (start)
                {
                    ((IEditEvents4_Event)m_editor).OnUseGroundToGridChanged += new
                                                                               IEditEvents4_OnUseGroundToGridChangedEventHandler(EventListener_OnUseGroundToGridChanged);
                }

                else
                {
                    ((IEditEvents4_Event)m_editor).OnUseGroundToGridChanged -= new
                                                                               IEditEvents4_OnUseGroundToGridChangedEventHandler(EventListener_OnUseGroundToGridChanged);
                }
                break;

            default:
                break;
            }
        }
Beispiel #32
0
 static void ScriptCompilationFinished(object obj)
 {
     EditorEvent?.Invoke(Event.ScriptCompilationFinished, null);
 }