protected override void OnActivate()
        {
            m_edSketch = m_editor as IEditSketch3;

            m_editor.CurrentTask    = null;
            m_edSketch.GeometryType = esriGeometryType.esriGeometryPoint;

            //IEditTaskSearch editTaskSearch = m_editor as IEditTaskSearch;
            //IEditTask editTask = editTaskSearch.get_TaskByUniqueName("GarciaUI_CreateNewFeatureTask");
            //m_editor.CurrentTask = editTask;

            // Activate a shape constructor based on the current sketch geometry
            if (m_edSketch.GeometryType == esriGeometryType.esriGeometryPoint | m_edSketch.GeometryType == esriGeometryType.esriGeometryMultipoint)
            {
                m_csc = new PointConstructorClass();
            }
            else
            {
                m_csc = new StraightConstructorClass();
            }

            m_csc.Initialize(m_editor);
            m_edSketch.ShapeConstructor = m_csc;
            m_csc.Activate();


            // Setup events
            m_editEvents.OnSketchModified           += OnSketchModified;
            m_editEvents5.OnShapeConstructorChanged += OnShapeConstructorChanged;
            m_editEvents.OnSketchFinished           += OnSketchFinished;
        }
        protected override void OnActivate()
        {
            m_editor.CurrentTask = null;

            m_edSketch = m_editor as IEditSketch3;
            m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline;
            // Activate a shape constructor based on the current sketch geometry
            if (m_edSketch.GeometryType == esriGeometryType.esriGeometryPoint | m_edSketch.GeometryType == esriGeometryType.esriGeometryMultipoint)
            {
                m_csc = new PointConstructorClass();
            }
            else
            {
                m_csc = new StraightConstructorClass();
            }

            m_csc.Initialize(m_editor);
            m_edSketch.ShapeConstructor = m_csc;
            m_csc.Activate();

            // Setup events
            m_editEvents.OnSketchModified           += OnSketchModified;
            m_editEvents5.OnShapeConstructorChanged += OnShapeConstructorChanged;
            m_editEvents.OnSketchFinished           += OnSketchFinished;
        }
        public override void OnClick()
        {
            m_edSketch = m_editor as IEditSketch3;

            //Restrict to line constructors (for this tool)
            m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline;

            //Activate a constructor based on the current sketch geometry
            if (m_edSketch.GeometryType == esriGeometryType.esriGeometryPoint)
            {
                m_csc = new PointConstructorClass();
            }
            else
            {
                m_csc = new StraightConstructorClass();
            }
            m_csc.Initialize(m_editor);
            m_edSketch.ShapeConstructor = m_csc;
            m_csc.Activate();

            //set the current task to null
            m_editor.CurrentTask = null;

            //setup events
            m_editEvents.OnSketchModified           += new IEditEvents_OnSketchModifiedEventHandler(m_editEvents_OnSketchModified);
            m_editEvents5.OnShapeConstructorChanged += new IEditEvents5_OnShapeConstructorChangedEventHandler(m_editEvents5_OnShapeConstructorChanged);
            m_editEvents.OnSketchFinished           += new IEditEvents_OnSketchFinishedEventHandler(m_editEvents_OnSketchFinished);

            //Create form and pass initialization parameters
            m_form = new ViperPinForm(m_editor);

            base.OnClick();
        }
        protected override void OnActivate()
        {
            m_edSketch           = m_editor as IEditSketch3;
            m_editor.CurrentTask = null;

            if (m_editor.EditState == esriEditState.esriStateNotEditing)
            {
                return;
            }

            m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline;

            IEditProperties4 pEdProps = m_editor as IEditProperties4;

            m_bsnap2sketch        = pEdProps.SnapToSketch;
            pEdProps.SnapToSketch = true;

            m_csc = new StraightConstructorClass();
//      m_csc = new SketchConstructorClass();

            m_csc.Initialize(m_editor);
            m_edSketch.ShapeConstructor = m_csc;
            m_csc.Activate();

            // Setup events
            m_editEvents.OnSketchModified           += OnSketchModified;
            m_editEvents.OnSketchFinished           += OnSketchFinished;
            m_editEvents5.OnShapeConstructorChanged += OnShapeConstructorChanged;
        }
        protected override void OnActivate()
        {
            ConfigUtil.type      = "address";
            m_editor.CurrentTask = null;
            m_targetLayer        = ((IFeatureLayer)m_editor.CurrentTemplate.Layer);
            m_className          = Globals.getClassName(m_targetLayer);

            m_edSketch = m_editor as IEditSketch3;
            m_edSketch.GeometryType = esriGeometryType.esriGeometryMultipoint;
            // Activate a shape constructor based on the current sketch geometry
            if (m_edSketch.GeometryType == esriGeometryType.esriGeometryPoint | m_edSketch.GeometryType == esriGeometryType.esriGeometryMultipoint)
            {
                m_csc = new PointConstructorClass();
            }
            else
            {
                m_csc = new StraightConstructorClass();
            }

            m_csc.Initialize(m_editor);
            m_edSketch.ShapeConstructor = m_csc;
            m_csc.Activate();

            // Setup events
            m_editEvents.OnSketchModified           += OnSketchModified;
            m_editEvents5.OnShapeConstructorChanged += OnShapeConstructorChanged;
            m_editEvents.OnSketchFinished           += OnSketchFinished;

            // Initialize address map tip
            m_addressMaptip = new AddressMapTip();
            var mxPtr = new IntPtr(ArcMap.Application.hWnd);

            m_addressMaptip.Show(Control.FromHandle(mxPtr));
            m_addressMaptip.Visible = false;
        }
        protected override void OnActivate()
        {
            //get the cadastral editor and target fabric
            m_pCadEd  = (ICadastralEditor)ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension");
            m_pCadFab = m_pCadEd.CadastralFabric;

            if (m_pCadFab == null)
            {
                MessageBox.Show("No target fabric found. Please add a fabric to the map start editing, and try again.");
                return;
            }

            m_pFabricLines = (IFeatureClass)m_pCadFab.get_CadastralTable(esriCadastralFabricTable.esriCFTLines);

            m_editor.CurrentTask    = null;
            m_edSketch              = m_editor as IEditSketch3;
            m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline;
            m_csc = new TraceConstructorClass();
            m_csc.Initialize(m_editor);
            m_edSketch.ShapeConstructor = m_csc;
            m_csc.Activate();

            // Setup events
            m_editEvents.OnSketchModified           += OnSketchModified;
            m_editEvents5.OnShapeConstructorChanged += OnShapeConstructorChanged;
            m_editEvents.OnSketchFinished           += OnSketchFinished;
        }
        protected override void OnActivate()
        {
            //get the cadastral editor and target fabric
              m_pCadEd = (ICadastralEditor)ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension");
              m_pCadFab = m_pCadEd.CadastralFabric;

              if (m_pCadFab == null)
              {
            MessageBox.Show("No target fabric found. Please add a fabric to the map start editing, and try again.");
            return;
              }

              m_pFabricLines = (IFeatureClass)m_pCadFab.get_CadastralTable(esriCadastralFabricTable.esriCFTLines);

              m_editor.CurrentTask = null;
              m_edSketch = m_editor as IEditSketch3;
              m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline;
              m_csc = new TraceConstructorClass();
              m_csc.Initialize(m_editor);
              m_edSketch.ShapeConstructor = m_csc;
              m_csc.Activate();

              // Setup events
              m_editEvents.OnSketchModified += OnSketchModified;
              m_editEvents5.OnShapeConstructorChanged += OnShapeConstructorChanged;
              m_editEvents.OnSketchFinished += OnSketchFinished;
        }
 private void m_editEvents5_OnShapeConstructorChanged()
 {
     //activate new constructor
     m_csc.Deactivate();
     m_csc = null;
     m_csc = m_edSketch.ShapeConstructor;
     m_csc.Activate();
 }
 private void OnShapeConstructorChanged()
 {
     if (m_csc != null)
     {
         m_csc.Deactivate();
     }
     m_csc = null;
     m_csc = m_edSketch.ShapeConstructor;
     if (m_csc != null)
     {
         m_csc.Activate();
     }
 }
 private void OnShapeConstructorChanged()
 {
     // Activate a new constructor
     if (m_csc != null)
     {
         m_csc.Deactivate();
     }
     m_csc = null;
     m_csc = m_edSketch.ShapeConstructor;
     if (m_csc != null)
     {
         //Need these two lines or else the tool throws COMException if it is use immediatly after a save edits operation.
         m_edSketch.RefreshSketch();
         m_edSketch.GeometryType = esriGeometryType.esriGeometryPolyline;
         m_csc.Activate();
     }
 }
 private bool IsShapeConstructorOkay(IShapeConstructor m_csc)
 {
     if (m_csc == null)
     {
         return(false);
     }
     if (m_csc.Enabled != true)
     {
         return(false);
     }
     if (m_csc.Active)
     {
         return(true);
     }
     else
     {
         m_csc.Activate();
     }
     return(true);
 }
 private void OnShapeConstructorChanged()
 {
     if (m_csc != null)
         m_csc.Deactivate();
     m_csc = null;
     m_csc = m_edSketch.ShapeConstructor;
     if (m_csc != null)
         m_csc.Activate();
 }
Beispiel #13
0
 private void m_editEvents5_OnShapeConstructorChanged()
 {
     // Activate new constructor
     m_csc.Deactivate();
     m_csc = null;
     m_csc = m_edSketch.ShapeConstructor;
     m_csc.Activate();
 }