Beispiel #1
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            // TODO: Add CmdExportSHP.OnClick implementation
            IBasicMap map   = null;
            ILayer    layer = null;

            ClsGlobal.GetSelectedMapAndLayer(m_pTocCtl, ref map, ref layer);
            if (layer is IFeatureLayer)
            {
                LibCerMap.FrmExportSHP dlg = new LibCerMap.FrmExportSHP(map, layer);
                dlg.StartPosition = FormStartPosition.CenterScreen;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    IActiveView activiView = map as IActiveView;
                    activiView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                    m_pTocCtl.Update();
                }
            }
            else if (layer is IRasterLayer)
            {
                LibCerMap.FrmExportRaster frm = new LibCerMap.FrmExportRaster(map, layer);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    IActiveView activiView = map as IActiveView;
                    activiView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                    m_pTocCtl.Update();
                }
            }
        }
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            try
            {
                //ILayer player = ClsGlobal.GetSelectedLayer(m_hookHelper);
                IBasicMap map   = null;
                ILayer    layer = null;
                ClsGlobal.GetSelectedMapAndLayer(m_pTocCtl, ref map, ref layer);
                if (map == null || layer == null)
                {
                    return;
                }

                IFeatureLayer           pFLayer = (IFeatureLayer)layer;
                IFeatureLayerDefinition pFLDef  = (IFeatureLayerDefinition)pFLayer;
                IFeatureSelection       pFSel   = (IFeatureSelection)pFLayer;
                ISelectionSet           pSSet   = pFSel.SelectionSet;
                if (pSSet.Count > 0)
                {
                    IFeatureLayer pSelFL = pFLDef.CreateSelectionLayer(layer.Name + "Selection", true, null, null);
                    map.AddLayer(pSelFL);
                    IActiveView activiView = map as IActiveView;
                    activiView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                    m_pTocCtl.Update();
                }
            }
            catch (Exception ex)
            {
                ;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            IBasicMap map   = null;
            ILayer    layer = null;

            ClsGlobal.GetSelectedMapAndLayer(m_pTocCtl, ref map, ref layer);
            IActiveView activeView = map as IActiveView;

            activeView.Extent = layer.AreaOfInterest;
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
        }
Beispiel #4
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            ClsGlobal.GetSelectedMapAndLayer(m_pTocCtl, ref m_pMap, ref m_pLayer);

            if (m_pMap != null && m_pLayer != null)
            {
                m_pMap.DeleteLayer(m_pLayer);

                m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                m_pTocCtl.Update();
                if (m_pBar.Visible == true && m_pBar.Text == m_pLayer.Name)
                {
                    m_pDataTable.Clear();
                    m_pDataTable.Columns.Clear();
                    m_pBar.Visible = false;
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            try
            {
                ClsGlobal.GetSelectedMapAndLayer(m_pTocCtl, ref m_pMap, ref m_pLayer);
                if (m_pMap == null || m_pLayer == null)
                {
                    return;
                }


                IMap pMapHiden = m_HidenMapCtrl.Map;
                pMapHiden.ClearLayers();

                ICommand pCmd = new ControlsAddDataCommand();
                pCmd.OnCreate(m_HidenMapCtrl);
                pCmd.OnClick();

                ILayer pLayerSrc = null;
                if (pMapHiden.LayerCount > 0)
                {
                    pLayerSrc = pMapHiden.get_Layer(0);
                    if (pLayerSrc != null)
                    {
                        IDataset   pDatasetSrc         = pLayerSrc as IDataset;
                        IWorkspace pWksSrc             = pDatasetSrc.Workspace;
                        LibCerMap.ClsGDBDataCommon cls = new LibCerMap.ClsGDBDataCommon();
                        cls.SetDataSource(m_pLayer, pLayerSrc);
                        cls.RepairDataSource(m_pMap, pWksSrc);
                        m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        m_pTocCtl.Update();
                    }
                }
                pMapHiden.ClearLayers();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            #endregion
        }