private void button2_Click(object sender, EventArgs e) { List <IFeature> pFeatureList = new List <IFeature>(); List <IFeature> pCurFeatureList = EngineFuntions.GetSeartchFeatures(EngineFuntions.m_Layer_BusStation, "OBJECTID > -1"); foreach (IFeature pfeature in pCurFeatureList) { IFeatureLayer CurFeatureLayer = EngineFuntions.SetCanSelLay("道路中心线"); EngineFuntions.ClickSel(pfeature.ShapeCopy, false, true, 26); if (EngineFuntions.GetSeledFeatures(CurFeatureLayer, ref pFeatureList)) { foreach (IFeature pfea in pFeatureList) { int nIndex = pfeature.Fields.FindField("StationCharacter"); pfeature.set_Value(nIndex, pfea.get_Value(pfea.Fields.FindField("道路名称")) as string); } } pfeature.Store(); } MessageBox.Show("xxxxxx\n", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void frmMainNew_Load(object sender, EventArgs e) { EngineFuntions.m_AxMapControl = axMapControl1;//传递Map控件 axCommandBars1.LoadDesignerBars(null, null); axCommandBars1.ActiveMenuBar.Delete(); axCommandBars1.Options.UseDisabledIcons = true; UInt32 pColor; pColor = System.Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(255, 255, 255)).ToString()); axCommandBars1.SetSpecialColor((XtremeCommandBars.XTPColorManagerColor) 15, pColor); //m_pMapDocument = new MapDocumentClass(); //m_pMapDocument.Open("..\\..\\data\\DataSDE.mxd", string.Empty); //axMapControl1.Map = m_pMapDocument.get_Map(0); axMapControl1.Map.Name = "查询"; axMapControl1.Extent = axMapControl1.FullExtent; List <IFeatureLayer> colLayers; colLayers = EngineFuntions.GetAllValidFeatureLayers(axMapControl1.Map); //设置所有图层不能选择 EngineFuntions.SetCanSelLay("");//无图层名即所有不可选 EngineFuntions.m_Layer_BusStation = EngineFuntions.GetLayerByName("工程项目", colLayers); //EngineFuntions.m_Layer_BusRoad = EngineFuntions.GetLayerByName("公交站线", colLayers); //EngineFuntions.m_Layer_BackRoad = EngineFuntions.GetLayerByName("站线备份", colLayers); //Determine if Alpha Context is supported, if it is, then enable it axDockingPane1.Options.AlphaDockingContext = true; //Determine if Docking Stickers is supported, if they are, then enable them axDockingPane1.Options.ShowDockingContextStickers = true; axDockingPane1.Options.ThemedFloatingFrames = true; axDockingPane1.TabPaintManager.Position = XTPTabPosition.xtpTabPositionTop; axDockingPane1.TabPaintManager.Appearance = XtremeDockingPane.XTPTabAppearanceStyle.xtpTabAppearanceVisualStudio; XtremeDockingPane.Pane ThePane = axDockingPane1.CreatePane(ForAR.Pan_Layer, 200, 200, DockingDirection.DockLeftOf, null); ThePane.Title = "图层配置"; axDockingPane1.FindPane(ForAR.Pan_Layer).Handle = m_frmlayerToc.Handle.ToInt32(); ThePane = axDockingPane1.CreatePane(ForAR.Pan_Archive, 200, 200, DockingDirection.DockLeftOf, null); ThePane.Title = "工程入库"; axDockingPane1.FindPane(ForAR.Pan_Archive).Handle = m_frmArchivePane.Handle.ToInt32(); ThePane = axDockingPane1.CreatePane(ForAR.Pan_Query, 200, 200, DockingDirection.DockLeftOf, null); ThePane.Title = "工程查询"; axDockingPane1.FindPane(ForAR.Pan_Query).Handle = m_frmQueryPan.Handle.ToInt32(); axDockingPane1.AttachPane(axDockingPane1.FindPane(ForAR.Pan_Query), axDockingPane1.FindPane(ForAR.Pan_Archive)); axDockingPane1.AttachPane(axDockingPane1.FindPane(ForAR.Pan_Layer), axDockingPane1.FindPane(ForAR.Pan_Archive)); axDockingPane1.FindPane(ForAR.Pan_Layer).Select(); axDockingPane1.FindPane(ForAR.Pan_Query).Options = PaneOptions.PaneNoCloseable; axDockingPane1.FindPane(ForAR.Pan_Layer).Options = PaneOptions.PaneNoCloseable; axDockingPane1.FindPane(ForAR.Pan_Archive).Options = PaneOptions.PaneNoCloseable; //'鹰眼图: //String sHawkEyeFileName; //sHawkEyeFileName = ForAR.Mxd_Name; //m_frmlayerToc.MapHawkEye.LoadMxFile(sHawkEyeFileName); //m_frmlayerToc.MapHawkEye.Extent = m_frmlayerToc.MapHawkEye.FullExtent; //m_frmlayerToc.m_MapControl = axMapControl1.Object; m_frmlayerToc.TOCControl.SetBuddyControl(this.axMapControl1.Object); axDockingPane1.SetCommandBars(axCommandBars1.GetDispatch()); this.WindowState = FormWindowState.Maximized; m_bShowLayer = false; ForAR.m_FrmMain = this; if (ForAR.Login_Operation != "")//设置用户权限对应禁止的操作 { string[] strColu = ForAR.Login_Operation.Split(';'); int nCol; foreach (string eStrRow in strColu) { nCol = Convert.ToInt32(eStrRow[0].ToString()); string strRow = eStrRow.Substring(2); string[] strRows = strRow.Split('、'); foreach (string eStrRows in strRows) { axCommandBars1[nCol].Controls[Convert.ToInt32(eStrRows)].Enabled = false; } } } // Set what the Help file will be for the HelpProvider. this.helpProvider2.HelpNamespace = Winapp.StartupPath + @"\用户手册.doc"; }
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e) { m_mapPoint = axMapControl1.ToMapPoint(e.x, e.y); IActiveView pActiveView = axMapControl1.ActiveView; if (e.button == 1) { switch (m_ToolStatus) { case ForAR.Map3D_Select: if (axMapControl1.Visible == true) { IGeometry pGeo; pGeo = axMapControl1.TrackRectangle(); if (pGeo.Envelope.Height * pGeo.Envelope.Width == 0) { return; } List <IFeature> pSelFea = EngineFuntions.GetSeartchFeatures(EngineFuntions.m_Layer_BusStation, pGeo); if (pSelFea.Count > 0) { frmAttribute frmPopup = new frmAttribute(); frmPopup.m_featureCollection = pSelFea; frmPopup.ShowDialog(); } } break; case ForAR.Map3D_PointSelect: if (axMapControl1.Visible == true) { m_CurFeatureLayer = EngineFuntions.SetCanSelLay("工程项目"); EngineFuntions.ClickSel(m_mapPoint, false, false, 6); if (EngineFuntions.GetSeledFeatures(m_CurFeatureLayer, ref m_featureCollection)) { frmAttribute frmPopup = new frmAttribute(); frmPopup.m_featureCollection = m_featureCollection; frmPopup.ShowDialog(); } } break; case ForAR.Map3D_PolySelect: if (axMapControl1.Visible == true) { IGeometry pGeo; pGeo = axMapControl1.TrackPolygon(); if (pGeo.Envelope.Height * pGeo.Envelope.Width == 0) { return; } List <IFeature> pSelFea = EngineFuntions.GetSeartchFeatures(EngineFuntions.m_Layer_BusStation, pGeo); if (pSelFea.Count > 0) { frmAttribute frmPopup = new frmAttribute(); frmPopup.m_featureCollection = pSelFea; frmPopup.ShowDialog(); } } break; case ForAR.Map3D_CircleSelect: if (axMapControl1.Visible == true) { IGeometry pGeo; pGeo = axMapControl1.TrackCircle(); if (pGeo.Envelope.Height * pGeo.Envelope.Width == 0) { return; } List <IFeature> pSelFea = EngineFuntions.GetSeartchFeatures(EngineFuntions.m_Layer_BusStation, pGeo); if (pSelFea.Count > 0) { frmAttribute frmPopup = new frmAttribute(); frmPopup.m_featureCollection = pSelFea; frmPopup.ShowDialog(); } } break; default: break; } } if (2 == e.button) { EngineFuntions.ZoomPoint(m_mapPoint, EngineFuntions.m_AxMapControl.Map.MapScale); } }