Exemple #1
0
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)//双击legend修改symbol
        {
            ILayer             pLayer       = null;
            IBasicMap          pBasicMap    = null;
            object             plegendGroup = null;
            object             pIndex       = null;
            esriTOCControlItem pTocItem     = esriTOCControlItem.esriTOCControlItemNone;

            axTOCControl1.HitTest(e.x, e.y, ref pTocItem, ref pBasicMap, ref pLayer,
                                  ref plegendGroup, ref pIndex);
            if (pTocItem == esriTOCControlItem.esriTOCControlItemLegendClass)
            {
                ILegendClass legendClass = (plegendGroup as ILegendGroup).get_Class((int)pIndex);
                if (!((pLayer is IRasterLayer &&
                       (pLayer as IRasterLayer).Renderer is IRasterStretchColorRampRenderer) ||
                      (pLayer is IFeatureLayer &&
                       (pLayer as IGeoFeatureLayer).Renderer is IProportionalSymbolRenderer)))
                {
                    ISymbolSelector selector = new SymbolSelectorClass();
                    selector.AddSymbol(legendClass.Symbol);
                    if (selector.SelectSymbol(0) == true)
                    {
                        legendClass.Symbol = selector.GetSymbolAt(0);
                    }
                    axMapControl1.Refresh();
                    axTOCControl1.Update();
                }
            }
        }
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            object unk  = null;
            object data = null;

            // 双击TOCControl控件时触发的事件
            esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap          basicMap = null;
            ILayer             layer    = null;

            this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);
            if (e.button == 1)
            {
                if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    //取得图例
                    ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
                    //创建符号选择器SymbolSelector实例
                    SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
                    if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
                    {
                        //局部更新主Map控件
                        m_mapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        //设置新的符号
                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                        //更新主Map控件和图层控件
                        m_mapControl.ActiveView.Refresh();
                        this.axTOCControl1.Refresh();
                    }
                }
            }
        }
Exemple #3
0
        private void TOCLayer_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            if (e.button != 1)
            {
                return;
            }
            esriTOCControlItem itemType  = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap          pBasicMap = null;
            ILayer             pLayer    = null;
            object             unk       = null;
            object             data      = null;

            TOCLayer.HitTest(e.x, e.y, ref itemType, ref pBasicMap, ref pLayer, ref unk, ref data);

            if (e.button == 1)
            {
                if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);

                    FrmSymbolSelect SymbolSelectorFrm = new FrmSymbolSelect(pLegendClass, pLayer);

                    if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
                    {
                        m_MapMain.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                        m_MapMain.ActiveView.Refresh();
                        TOCLayer.Refresh();
                    }
                }
            }
        }
        //TOCControl控件的鼠标双击事件
        public void m_tocControl_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            if (e.button == 1)
            {
                esriTOCControlItem item  = esriTOCControlItem.esriTOCControlItemNone;
                IBasicMap          map   = null;
                ILayer             layer = null;
                object             other = null;
                object             index = null;
                //判断所选菜单的类型
                m_tocControl.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);

                if (item == esriTOCControlItem.esriTOCControlItemLayer)
                {
                    /*                   AttributeForm af = new AttributeForm((IMapControl3)m_mapControl);
                     *                 af.m_layer = layer;
                     *                 af.ShowDialog();*/

                    // iAttribute_Click(null, null);
                }

                this.m_mapControl.ActiveView.Refresh();
                this.m_tocControl.Refresh();
            }
        }
Exemple #5
0
//        双击 axTOCControl1 显示符号系统

        private void axTOCControl1_OnDoubleClick(Object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem toccItem = esriTOCControlItem.esriTOCControlItemNone;

            ILayer iLayer = null;

            IBasicMap iBasicMap = null;

            object unk = null;

            object data = null;

            if (e.button == 1)
            {
                axTOCControl1.HitTest(e.x, e.y, ref toccItem, ref iBasicMap, ref iLayer, ref unk,
                                      ref data);

                new System.Drawing.Point(e.x, e.y);

                if (toccItem == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    ILegendClass pLC = new LegendClassClass();

                    ILegendGroup pLG = new LegendGroupClass();

                    if (unk is ILegendGroup)
                    {
                        pLG = (ILegendGroup)unk;
                    }

                    pLC = pLG.get_Class((int)data);

                    ISymbol pSym;

                    pSym = pLC.Symbol;

                    ESRI.ArcGIS.DisplayUI.ISymbolSelector pSS = new
                                                                ESRI.ArcGIS.DisplayUI.SymbolSelectorClass();


                    bool bOK;

                    pSS.AddSymbol(pSym);

                    bOK = pSS.SelectSymbol(0);

                    if (bOK)
                    {
                        pLC.Symbol = pSS.GetSymbolAt(0);
                    }

                    axMapControl1.ActiveView.Refresh();

                    axTOCControl1.Refresh();
                }
            }
        }
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            IBasicMap          map  = null;
            esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;

            ATOCControl.HitTest(e.x, e.y, ref item, ref map, ref _layer, ref _other, ref _index);

            if (item == esriTOCControlItem.esriTOCControlItemLegendClass)
            {
                SetSymbol(sender, e);
            }
        }
Exemple #7
0
 private void axTOCControl_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
 {
     esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
     IBasicMap basicMap = null;
     ILayer layer = null;
     object unk = null;
     object data = null;
     this.axTOCControl.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);
     //this.axTOCControl.GetSelectedItem(ref itemType, ref basicMap, ref layer, ref unk, ref data);
     //if (itemType == esriTOCControlItem.esriTOCControlItemLayer)
     //{
     //    if (layer is IGeoFeatureLayer)
     //    {
     //        FeatLyrFrm newFeatLyrFrm = new FeatLyrFrm(layer);
     //        newFeatLyrFrm.Show();
     //    }
     //}
     switch (itemType)
     {
         case esriTOCControlItem.esriTOCControlItemLayer:
             if (layer is IGeoFeatureLayer)
             {
                 if (this.newFeatLyrFrm == null)
                 {
                     this.newFeatLyrFrm = new FeatLyrFrm();
                 }
                 this.newFeatLyrFrm.Layer = layer;
                 if (this.newFeatLyrFrm.ShowDialog() == DialogResult.OK)
                 {
                     this.mainMapControl.Refresh();
                     this.EagleaxMapControl.Refresh();
                     this.axTOCControl.Update();
                 }
             }
             break;
         case esriTOCControlItem.esriTOCControlItemLegendClass:
             break;
     }
 }
Exemple #8
0
        /// <summary>
        ///     双击图层符号,修改整个图层符号类型
        /// </summary>
        /// <params name="sender"></params>
        /// <params name="e"></params>
        private void tocControl_OP_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            //esriTOCControlItem tocControlItem = esriTOCControlItem.esriTOCControlItemNone;
            //ILayer pLayer = null;
            //IBasicMap pBasicMap = null;
            //object unk = null;
            //object data = null;
            //if (e.button == 1)
            //{
            //    //判断点击的为哪种Item
            //    tocControl_OP.HitTest(e.x, e.y, ref tocControlItem, ref pBasicMap, ref pLayer, ref unk,
            //    ref data);
            //    //只有图层可设置符号
            //    if (tocControlItem == esriTOCControlItem.esriTOCControlItemLegendClass)
            //    {
            //        ESRI.ArcGIS.Carto.ILegendClass pLegendClass = new LegendClassClass();
            //        ESRI.ArcGIS.Carto.ILegendGroup pLegendGroup = new LegendGroupClass();
            //        if (unk is ILegendGroup)
            //        {
            //            pLegendGroup = (ILegendGroup)unk;
            //        }
            //        pLegendClass = pLegendGroup.get_Class((int)data);
            //        ISymbol pSymbol = pLegendClass.Symbol;
            //        ISymbolSelector pSymbolSelector = new SymbolSelectorClass();
            //        pSymbolSelector.AddSymbol(pSymbol);
            //        bool bOK = pSymbolSelector.SelectSymbol(0);
            //        if (bOK)
            //        {
            //            pLegendClass.Symbol = pSymbolSelector.GetSymbolAt(0);
            //        }

            //        this.mapControl_OP.ActiveView.Refresh();
            //        this.tocControl_OP.Refresh();
            //    }
            //}
        }
Exemple #9
0
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap          basicMap = null;
            ILayer             layer    = null;
            object             unk      = null;
            object             data     = null;

            this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);

            #region 调用ESRI自带的图层样式
            //if (e.button == 1)
            //{
            //    axTOCControl1.HitTest(e.x, e.y, ref item, ref pBasicMap, ref pLayer, ref other, ref index);
            //    System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
            //    if (item == esriTOCControlItem.esriTOCControlItemLegendClass)
            //    {
            //        ILegendClass pLC = new LegendClassClass();
            //        ILegendGroup pLG = new LegendGroupClass();
            //        if (other is ILegendGroup)
            //        {
            //            pLG = (ILegendGroup)other;
            //        }
            //        pLC = pLG.get_Class((int)index);
            //        ISymbol pSym = pLC.Symbol;
            //        ISymbolSelector pSS = new SymbolSelectorClass();
            //        bool bOK = false;
            //        pSS.AddSymbol(pSym);
            //        bOK = pSS.SelectSymbol(0);
            //        if (bOK)
            //        {
            //            pLC.Symbol = pSS.GetSymbolAt(0);
            //        }
            //        this.axMapControl1.ActiveView.Refresh();
            //        //this.axMapControl2.ActiveView.Refresh();
            //        this.axTOCControl1.Refresh();
            //    }
            //}
            #endregion

            if (e.button == 1)
            {
                System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
                if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    //取得图例
                    ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
                    //创建符号选择器SymbolSelector实例
                    SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
                    if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
                    {
                        //局部更新主Map控件
                        this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        //设置新的符号
                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                        //更新主Map控件和图层控件
                        this.axMapControl1.ActiveView.Refresh();
                        this.axTOCControl1.Refresh();
                    }
                }
            }
        }
        /// <summary>
        ///     双击图层符号,修改整个图层符号类型
        /// </summary>
        /// <params name="sender"></params>
        /// <params name="e"></params>
        private void tocControl_OP_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            //esriTOCControlItem tocControlItem = esriTOCControlItem.esriTOCControlItemNone;
            //ILayer pLayer = null;
            //IBasicMap pBasicMap = null;
            //object unk = null;
            //object data = null;
            //if (e.button == 1)
            //{
            //    //判断点击的为哪种Item
            //    tocControl_OP.HitTest(e.x, e.y, ref tocControlItem, ref pBasicMap, ref pLayer, ref unk,
            //    ref data);
            //    //只有图层可设置符号
            //    if (tocControlItem == esriTOCControlItem.esriTOCControlItemLegendClass)
            //    {
            //        ESRI.ArcGIS.Carto.ILegendClass pLegendClass = new LegendClassClass();
            //        ESRI.ArcGIS.Carto.ILegendGroup pLegendGroup = new LegendGroupClass();
            //        if (unk is ILegendGroup)
            //        {
            //            pLegendGroup = (ILegendGroup)unk;
            //        }
            //        pLegendClass = pLegendGroup.get_Class((int)data);
            //        ISymbol pSymbol = pLegendClass.Symbol;
            //        ISymbolSelector pSymbolSelector = new SymbolSelectorClass();
            //        pSymbolSelector.AddSymbol(pSymbol);
            //        bool bOK = pSymbolSelector.SelectSymbol(0);
            //        if (bOK)
            //        {
            //            pLegendClass.Symbol = pSymbolSelector.GetSymbolAt(0);
            //        }

            //        this.mapControl_OP.ActiveView.Refresh();
            //        this.tocControl_OP.Refresh();
            //    }
            //}
        }
Exemple #11
0
        //符号选择器
        private void AxTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            ILayer             pLayer   = null;
            IBasicMap          pMap     = null;
            object             legendgp = null;
            object             index    = null;
            esriTOCControlItem pItem    = esriTOCControlItem.esriTOCControlItemNone;

            ILegendGroup pLegendGroup = new LegendGroup();
            ILegendClass pLegendClass = new LegendClass();

            try
            {
                axTOCControl1.HitTest(e.x, e.y, ref pItem, ref pMap, ref pLayer, ref legendgp, ref index);
            }
            catch (Exception)
            {
                throw;
            }
            pLegendGroup = (ILegendGroup)legendgp;

            if (pItem == esriTOCControlItem.esriTOCControlItemLegendClass)
            {
                pLegendClass = pLegendGroup.get_Class(Convert.ToInt32(index.ToString()));
                if (pLegendClass == null)
                {
                    return;
                }
                FrmSymbolLibrary dlg = new FrmSymbolLibrary(pLegendClass, pLayer);
                if (dlg != null)
                {
                    try
                    {
                        dlg.ShowDialog();
                        axTOCControl1.Update();
                        mainMapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
            //esriTOCControlItem toccItem = esriTOCControlItem.esriTOCControlItemNone;
            //ILayer iLayer = null;
            //IBasicMap iBasicMap = null;
            //object unk = null;
            //object data = null;
            //if (e.button == 1)
            //{
            //    axTOCControl1.HitTest(e.x, e.y, ref toccItem, ref iBasicMap, ref iLayer, ref unk, ref data);
            //    System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
            //    if (toccItem == esriTOCControlItem.esriTOCControlItemLegendClass)
            //    {
            //        ILegendClass pLC = new LegendClassClass();
            //        ILegendGroup pLG = new LegendGroupClass();
            //        if (unk is ILegendGroup)
            //        {
            //            pLG = (ILegendGroup)unk;
            //        }
            //        pLC = pLG.get_Class((int)data);
            //        ISymbol pSym = pLC.Symbol;
            //        ISymbolSelector pSS = new SymbolSelectorClass();
            //        bool bOK = false;
            //        pSS.AddSymbol(pSym);
            //        bOK = pSS.SelectSymbol(0);
            //        if (bOK)
            //        {
            //            pLC.Symbol = pSS.GetSymbolAt(0);
            //        }
            //        mainMapControl.ActiveView.Refresh();
            //        axTOCControl1.Refresh();
            //    }
            //}
        }
Exemple #12
0
 private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
 {
     esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
     IBasicMap basicMap = null;
     ILayer layer = null;
     object unk = null;
     object data = null;
     this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);
     if (e.button == 1)
     {
         System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
         if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
         {
             //取得图例
             ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
             //创建符号选择器SymbolSelector实例
             SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
             if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
             {
                 //局部更新主Map控件
                 this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                 //设置新的符号
                 pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                 //更新主Map控件和图层控件
                 this.axMapControl1.ActiveView.Refresh();
                 this.axTOCControl1.Refresh();
             }
         }
     }
 }
Exemple #13
0
        private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone;
            IBasicMap basicMap = null;
            ILayer layer = null;
            object unk = null;
            object data = null;
            this.axTOCControl1.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data);

            #region ����ESRI�Դ���ͼ����ʽ
            //if (e.button == 1)
            //{
            //    axTOCControl1.HitTest(e.x, e.y, ref item, ref pBasicMap, ref pLayer, ref other, ref index);
            //    System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
            //    if (item == esriTOCControlItem.esriTOCControlItemLegendClass)
            //    {
            //        ILegendClass pLC = new LegendClassClass();
            //        ILegendGroup pLG = new LegendGroupClass();
            //        if (other is ILegendGroup)
            //        {
            //            pLG = (ILegendGroup)other;
            //        }
            //        pLC = pLG.get_Class((int)index);
            //        ISymbol pSym = pLC.Symbol;
            //        ISymbolSelector pSS = new SymbolSelectorClass();
            //        bool bOK = false;
            //        pSS.AddSymbol(pSym);
            //        bOK = pSS.SelectSymbol(0);
            //        if (bOK)
            //        {
            //            pLC.Symbol = pSS.GetSymbolAt(0);
            //        }
            //        this.axMapControl1.ActiveView.Refresh();
            //        //this.axMapControl2.ActiveView.Refresh();
            //        this.axTOCControl1.Refresh();
            //    }
            //}
            #endregion

            if (e.button == 1)
            {
                System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
                if (itemType == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    //ȡ��ͼ��
                    ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data);
                    //��������ѡ����SymbolSelectorʵ��
                    SymbolSelectorFrm SymbolSelectorFrm = new SymbolSelectorFrm(pLegendClass, layer);
                    if (SymbolSelectorFrm.ShowDialog() == DialogResult.OK)
                    {
                        //�ֲ�������Map�ؼ�
                        this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        //�����µķ���
                        pLegendClass.Symbol = SymbolSelectorFrm.pSymbol;
                        //������Map�ؼ���ͼ��ؼ�
                        this.axMapControl1.ActiveView.Refresh();
                        this.axTOCControl1.Refresh();
                    }
                }
            }
        }
Exemple #14
0
 private void TocCtrl_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
 {
     //throw new NotImplementedException();
 }
Exemple #15
0
 private void axTOCControl1_OnDoubleClick(object sender, ITOCControlEvents_OnDoubleClickEvent e)
 {
     IBasicMap map = null;//设置要素符号
     object other = null;
     object index = null;
     esriTOCControlItem item = new esriTOCControlItem();
     this.axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref m_layer, ref other, ref index);
     if (item == esriTOCControlItem.esriTOCControlItemLegendClass)
     {
         ILegendGroup legendGroup = other as ILegendGroup;
         ILegendClass legendClass = legendGroup.get_Class(Convert.ToInt32(index));
         ISymbol symbol = legendClass.Symbol;
         ISymbolSelector pSS = new SymbolSelectorClass();
         pSS.AddSymbol(symbol);
         Boolean bOK = pSS.SelectSymbol(0);
         if (bOK == true)
         {
             legendClass.Symbol = pSS.GetSymbolAt(0);
         }
         axTOCControl1.Update();
         this.mapCtlMain.Refresh();
     }
 }