public frmFeatureSym(IFeatureLayer featLayer, AxMapControl mapcontrol, AxTOCControl toccontrol) { InitializeComponent(); this.Layer = featLayer; axmapcontrol = mapcontrol; axtoccontrol = toccontrol; }
public DisplayBandComForm(AxTOCControl axTOCControl, AxMapControl axMapControl, IRasterLayer TOCRightLayer) : this() { this.TOCRightLayer = TOCRightLayer; this.axMapControl = axMapControl; this.axTOCControl = axTOCControl; }
public RightMenu(AxTOCControl m_Toc) { m_TocC = m_Toc; ToolMenu.RemoveAll(); ToolMenu.AddItem(new RemoveLayer(), -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); ToolMenu.AddItem(new ZoomtoLayer(), -1, 1, true, esriCommandStyles.esriCommandStyleTextOnly); }
public FrmDuiqi2Waijian(AxMapControl mcontrol, AxTOCControl mtoccontrol) { InitializeComponent(); this.EnableGlass = false; m_pMapCtl = mcontrol; m_pTOCCtl = mtoccontrol; }
//退出程序 public void ExitProgram(AxMapControl axMapControl1, AxTOCControl axTOCControl1) { DialogResult dialogResult = MessageBox.Show("保存文件?", "关闭文件", MessageBoxButtons.YesNoCancel); if (dialogResult == DialogResult.Yes) { SaveDocument(axMapControl1); mapDocument.Close(); axMapControl1.ClearLayers(); axMapControl1.Refresh(); axTOCControl1.Update(); Application.Exit(); } if (dialogResult == DialogResult.No) { //mapDocument.Close(); //axMapControl1.ClearLayers(); //axMapControl1.Refresh(); //axTOCControl1.Update(); Application.Exit(); } if (dialogResult == DialogResult.Cancel) { return; } }
/// <summary> /// 地图及其图层/表格树、鹰眼图、导航工具、页面布局视图的组合控件的管理类 /// </summary> /// <param name="mainMapControl">主地图控件</param> /// <param name="eagleMapControl">鹰眼图地图控件</param> /// <param name="tocControl">图层树控件</param> /// <param name="pageLayoutControl">页面布局控件</param> /// <param name="switchView">显示指定的界面视图的操作</param> public MapViewerManager(AxMapControl mainMapControl, AxMapControl eagleMapControl, AxTOCControl tocControl, AxPageLayoutControl pageLayoutControl, Action <EViewActionType[]> switchView) { SwitchView = switchView; MainMapControl = mainMapControl; DocHelper = new MapCtrlDocument(mainMapControl); TocHelper = new MapCtrlToc(tocControl, mainMapControl, new AttributeForm(), switchView); MenuHelper = new MapCtrlMenu(mainMapControl); EagleMapHelper = new MapCtrlEagleMap(mainMapControl, eagleMapControl); DrawElementHelper = new MapCtrlDrawElement(mainMapControl); PageLayoutHelper = new MapCtrlPageLayoutSyn(mainMapControl, pageLayoutControl); mainMapControl.OnFullExtentUpdated += delegate { mainMapControl.Refresh(); }; //主地图:刷新地图 ((IActiveViewEvents_Event)mainMapControl.Map).ItemAdded += item => //向map/PageLayout中添加数据(图层、表格等)都会触发ItemAdded事件 { if (item is ILayer) { SwitchView(new[] { EViewActionType.MainMap, EViewActionType.LayerToc }); } else if (item is ITable) { SwitchView(new[] { EViewActionType.MainMap, EViewActionType.TableList }); } }; }
public Symbolization(AxMapControl axMapControl, AxTOCControl axToccontrol) { InitializeComponent(); axMapControl1 = axMapControl; pMap = axMapControl1.Map; axToccontrol1 = axToccontrol; }
public frmRasterSym(IRasterLayer rasLayer, AxMapControl mapcontrol, AxTOCControl toccontrol) { InitializeComponent(); this.rasterlayer = rasLayer; axmapcontrol = mapcontrol; axtoccontrol = toccontrol; }
public frmSymbol(IFeatureLayer featLayer,AxMapControl mapcontrol,AxTOCControl toccontrol) { InitializeComponent(); this.Layer = featLayer; axmapcontrol = mapcontrol; axtoccontrol = toccontrol; }
public FrmCreateGmpPoint(AxMapControl mcontrol, AxTOCControl mtoccontrol) { InitializeComponent(); this.EnableGlass = false; m_pMapCtl = mcontrol; m_pTOCCtl = mtoccontrol; }
public frmRaterSym1(IRasterLayer rasLayer, AxMapControl mapcontrol, AxTOCControl toccontrol) { InitializeComponent(); this.rasterlayer = rasLayer; axmapcontrol = mapcontrol; axtoccontrol = toccontrol; }
public ClsRemoveAllLayer(AxTOCControl pTocControl, IMapControl4 pMapControl) { // // m_pTocControl = pTocControl; m_pMapControl = pMapControl; base.m_category = "LayerManager"; //localizable text base.m_caption = "删除所有图层"; //localizable text base.m_message = "删除所有图层"; //localizable text base.m_toolTip = "删除所有图层"; //localizable text base.m_name = "RemoveAllLayer"; //unique id, non-localizable (e.g. "MyCategory_MyCommand") try { // ResourceManager resBitmap = new ResourceManager("ZJGISLayerManager.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly()); base.m_bitmap = (Bitmap)resBitmap.GetObject("RemoveLayer"); ////string bitmapResourceName = GetType().Name + ".bmp"; //base.m_bitmap = new Bitmap(GetType(), bitmapResourceName); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } }
public TOCHelper(MainFrm _pMainFrm, AxTOCControl _pTOCCtl) { // // TODO: 在此处添加构造函数逻辑 // pMainFrm = _pMainFrm; pTOCCtl = _pTOCCtl; }
public RasterRender(AxMapControl axMapControl1, AxTOCControl axTOCControl1, IRasterLayer rasterLayer) { this.axMapControl1 = axMapControl1; this.axTOCControl1 = axTOCControl1; this.rasterLayer = rasterLayer; InitializeComponent(); this.Height = 90; }
public TOCHelper(MainFrm _pMainFrm,AxTOCControl _pTOCCtl) { // // TODO: �ڴ˴���ӹ��캯���� // pMainFrm=_pMainFrm; pTOCCtl=_pTOCCtl; }
bool isminmax = false;//用于判定最大最小值选择次数 public FrmSymbolRGB(AxMapControl pmapcontral, AxTOCControl ptoccontral, IRasterLayer pLayer, AxSceneControl sceneControl) { InitializeComponent(); //this.EnableGlass = false; pMapContral = pmapcontral; pTocContral = ptoccontral; pRLayer = pLayer; pSceneControl = sceneControl; }
public FrmLabelDesign(AxMapControl mapControl, AxTOCControl toccontrol, ILayer layer, AxSceneControl sceneControl) { InitializeComponent(); this.EnableGlass = false; pMapControl = mapControl; pTocControl = toccontrol; pLayer = layer; pSceneControl = sceneControl; }
public FrmUniqueInLayer(ILayer layer, AxMapControl MapControl, AxTOCControl toccontrol, FrmUnique Frm, AxSceneControl scenecontrol) { InitializeComponent(); this.EnableGlass = false; pLayer = layer; pMapControl = MapControl; pTocControl = toccontrol; FrmUnique = Frm; pSceneControl = scenecontrol; }
public FrmSymboloTin(AxMapControl pmapcontral, AxTOCControl ptoccontral, AxSceneControl scenecontrol, ITinLayer pLayer, DevComponents.DotNetBar.Bar bar) { InitializeComponent(); this.EnableGlass = false; pMapContral = pmapcontral; pTocContral = ptoccontral; pTLayer = pLayer; pSceneControl = scenecontrol; bar3 = bar; }
/// <summary> /// 加载图层控件 /// </summary> /// <returns></returns> public AxTOCControl LoadaxTOCControl() { if (this.SceneControl != null) { AxTOCControl control = new AxTOCControl(); control.SetBuddyControl(m_sceneControl); return(control); } return(null); }
public void InitializeControls(IDsApplication hook) { m_app = hook; m_mapCtrl = new esriMapControl(hook); m_legendCtrl = new esriTOCControl(hook); AxMapControl axMapCtrl = (m_mapCtrl as esriMapControl).mapCtrl; AxTOCControl axTocCtrl = (m_legendCtrl as esriTOCControl).tocCtrl; axTocCtrl.SetBuddyControl(axMapCtrl); }
// Create ArcGIS Engine Controls and set them to be child of each WindowsFormsHost elements void CreateEngineControls() { //set Engine controls to the child of each hosts mapControl = new AxMapControl(); mapHost.Child = mapControl; toolbarControl = new AxToolbarControl(); toolbarHost.Child = toolbarControl; tocControl = new AxTOCControl(); tocHost.Child = tocControl; }
/// <summary> /// 创建Engine控件并将控件绑定到各自的 WindowsFormsHost 元素上 /// </summary> void CreateEngineControls() { //设置 Engine 控件到每个host的Child属性上 mapControl = new AxMapControl(); mapHost.Child = mapControl; toolbarControl = new AxToolbarControl(); toolbarHost.Child = toolbarControl; tocControl = new AxTOCControl(); tocHost.Child = tocControl; }
void CreateEngineControls() { //set Engine controls to the child of each hosts mapControl = new AxMapControl(); mapHost.Child = mapControl; toolbarControl = new AxToolbarControl(); toolbarHost.Child = toolbarControl; tocControl = new AxTOCControl(); tocHost.Child = tocControl; }
/// <summary> /// 地图控件与TOC控件的关联操作 /// </summary> /// <param name="tocCtrl">TOC控件</param> /// <param name="mapCtrl">地图控件</param> /// <param name="attributeCtrl">显示属性表的控件/窗体</param> /// <param name="switchView">将当前标签页设为地图页面</param> public MapCtrlToc(AxTOCControl tocCtrl, AxMapControl mapCtrl, IAttributeCtrl attributeCtrl, Action <EViewActionType[]> switchView = null) { MapControl = mapCtrl; TocControl = tocCtrl; TocControl.SetBuddyControl(MapControl); TocControl.OnMouseDown += tocCtrl_OnMouseDown; SwitchView = switchView; AttributeCtrl = attributeCtrl; _attributeCtrlType = AttributeCtrl.GetType(); Layer2FieldsMenuItems = new Dictionary <string, ToolStripMenuItem[]>(); InintMenuStrip(); }
public FeatureRender(AxMapControl axMapControl1, AxTOCControl axTOCControl1, IFeatureLayer featureLayer) { this.axMapControl1 = axMapControl1; this.axTOCControl1 = axTOCControl1; this.featureLayer = featureLayer; InitializeComponent(); IFeatureClass featureClass = featureLayer.FeatureClass; fieldChoose(field => { return(true); }); this.Height = 106; }
public 渲染(Form1 fff, IRasterLayer rasLayer, AxMapControl mapcontrol, AxTOCControl toccontrol) { InitializeComponent(); mainform = fff; DrawColorRamp(); colorComboBox.SelectedIndex = 0; pictureBox1.Image = colorComboBox.SelectedItem as Image; colorComboBox1.SelectedIndex = 0; pictureBox2.Image = colorComboBox1.SelectedItem as Image; this.rasterlayer = rasLayer; axmapcontrol = mapcontrol; axtoccontrol = toccontrol; }
private void frmDataTree_Load(object sender, System.EventArgs e) { this.TOCLayer.SetBuddyControl(m_pBuddyControl); //设置Toc的Buddy try { //初始化右键toc类 if (m_tocContextMenu == null) { AxTOCControl pAxTOCControl = TOCLayer as AxTOCControl; m_tocContextMenu = new ClsTOCContextMenu(pAxTOCControl, MapMain, FrmMain); } } catch (Exception) { } }
public ArcMapManager(System.Windows.Controls.Panel mapContainer, System.Windows.Controls.Panel layoutContainer, System.Windows.Controls.Panel tocContainer) { this._mapContainer = mapContainer; this._layoutContainer = layoutContainer; this._tocContainer = tocContainer; this._mode = MapFunctionMode.None; this._geoProcessor = new Geoprocessor(); this._geoProcessor.OverwriteOutput = true; this._symWindow = null; this._mapFile = ""; this._polygonName = ""; this._tempWorkspace = null; this._axLayoutCtrl = null; this._axTOCCtrl = null; this._axMapCtrl = null; this._mapAndLayoutSync = null; }
private void TocCtrl_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e) { AxTOCControl tocCtrl = (AxTOCControl)sender; esriTOCControlItem itemType = esriTOCControlItem.esriTOCControlItemNone; IBasicMap basicMap = null; ILayer layer = null; object unk = null; object data = null; tocCtrl.HitTest(e.x, e.y, ref itemType, ref basicMap, ref layer, ref unk, ref data); switch (e.button) { case 1: break; case 2: break; default: break; } }
void CreateEngineControls() { _tocControl = new AxTOCControl(); tocHost.Child = _tocControl; }
public Symbolize(AxMapControl _axMap, AxTOCControl _axTocControl) { InitializeComponent(); _MapControl = _axMap; axTOCControl1 = _axTocControl; }
public static void SetTOCControl(AxTOCControl tocControl) { m_tocControl = tocControl; }
public override void AddTOC(System.Windows.Controls.Panel tocContainer) { this._tocContainer = tocContainer; System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); // Create an object of the legend control. this._axTOCCtrl = new AxTOCControl(); this._axTOCCtrl.BeginInit(); host.Child = this._axTOCCtrl; this._tocContainer.Children.Add(host); this._axTOCCtrl.SetBuddyControl(this._axMapCtrl); this._axTOCCtrl.OnMouseDown += new ITOCControlEvents_Ax_OnMouseDownEventHandler(this._axTOCCtrl_OnMouseDown); this._axTOCCtrl.EndInit(); }
// 唯一值符号化 public static void UniqueValueRenderer(IFeatureLayer featureLayer, string fieldName, IMapControl2 mapControl, AxTOCControl tocControl) { ITable pTable = featureLayer as ITable; IUniqueValueRenderer pRenderer = new UniqueValueRendererClass(); pRenderer.FieldCount = 1; // 设置唯一值符号化的关键字段为一个 pRenderer.set_Field(0, fieldName); // 设置唯一值符号化的第一个关键字段 IRandomColorRamp pColorRamp = new RandomColorRampClass() { StartHue = 0, MinValue = 0, MinSaturation = 0, EndHue = 100, MaxValue = 100, MaxSaturation = 100 }; // 根据渲染字段的值的个数,设置一组随机颜色 pColorRamp.Size = featureLayer.FeatureClass.FeatureCount(new QueryFilterClass()); bool bSuccess = false; pColorRamp.CreateRamp(out bSuccess); IEnumColors pEnumColors = pColorRamp.Colors; IColor pNextUniqueColor = null; // 查询字段的值 IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.AddField(fieldName); int fieldNumber = pTable.FindField(fieldName); // 获取渲染字段索引 ICursor pCursor = pTable.Search(pQueryFilter, true); IRow pNextRow = pCursor.NextRow(); object codeValue = null; IRowBuffer pNextRowBuffer = null; while (pNextRow != null) { pNextRowBuffer = pNextRow as IRowBuffer; // 获取渲染字段的每一个值 codeValue = pNextRowBuffer.get_Value(fieldNumber); pNextUniqueColor = pEnumColors.Next(); if (pNextUniqueColor == null) { pEnumColors.Reset(); pNextUniqueColor = pEnumColors.Next(); } ISymbol pSymbol = null; switch (featureLayer.FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPolygon: pSymbol = new SimpleFillSymbolClass() { Color = pNextUniqueColor }; break; case esriGeometryType.esriGeometryPolyline: pSymbol = new SimpleLineSymbolClass() { Color = pNextUniqueColor }; break; case esriGeometryType.esriGeometryPoint: pSymbol = new SimpleMarkerSymbolClass() { Color = pNextUniqueColor }; break; } pRenderer.AddValue(codeValue.ToString(), "", pSymbol); pNextRow = pCursor.NextRow(); } (featureLayer as IGeoFeatureLayer).Renderer = pRenderer as IFeatureRenderer; mapControl.Refresh(); tocControl.Update(); }
//在OnviewRfeshed事件下使用(联动) public static void Use_OnViewRefreshed(AxTOCControl toccControl, AxMapControl mapControl, AxPageLayoutControl axPageLayoutControl) { toccControl.Update(); OperateFile.CopyAndOverwriteMap(mapControl, axPageLayoutControl); }
public static ILayer GetLayerFromTOCControl(AxTOCControl _axTOCControl) { IBasicMap map = new MapClass(); ILayer layer = new FeatureLayerClass(); object legendGroup = new object(); object index = new object(); esriTOCControlItem item = new esriTOCControlItem(); _axTOCControl.GetSelectedItem(ref item, ref map, ref layer, ref legendGroup, ref index); return layer; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.lblCulture = new System.Windows.Forms.Label(); this.axLicenseControl1 = new ESRI.ArcGIS.Controls.AxLicenseControl(); this.axPageLayoutControl1 = new ESRI.ArcGIS.Controls.AxPageLayoutControl(); this.axTOCControl1 = new ESRI.ArcGIS.Controls.AxTOCControl(); this.axToolbarControl1 = new ESRI.ArcGIS.Controls.AxToolbarControl(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axLicenseControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axPageLayoutControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axTOCControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axToolbarControl1)).BeginInit(); this.SuspendLayout(); // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.05695F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.94305F)); this.tableLayoutPanel1.Controls.Add(this.lblCulture, 0, 2); this.tableLayoutPanel1.Controls.Add(this.axLicenseControl1, 1, 2); this.tableLayoutPanel1.Controls.Add(this.axPageLayoutControl1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.axTOCControl1, 0, 1); this.tableLayoutPanel1.Controls.Add(this.axToolbarControl1, 0, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(2, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 3; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.598214F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 90.40179F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 39F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(731, 445); this.tableLayoutPanel1.TabIndex = 6; // // lblCulture // this.lblCulture.AutoSize = true; this.lblCulture.Location = new System.Drawing.Point(3, 405); this.lblCulture.Name = "lblCulture"; this.lblCulture.Size = new System.Drawing.Size(35, 13); this.lblCulture.TabIndex = 0; this.lblCulture.Text = "label1"; // // axLicenseControl1 // this.axLicenseControl1.Enabled = true; this.axLicenseControl1.Location = new System.Drawing.Point(186, 408); this.axLicenseControl1.Name = "axLicenseControl1"; this.axLicenseControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axLicenseControl1.OcxState"))); this.axLicenseControl1.Size = new System.Drawing.Size(32, 32); this.axLicenseControl1.TabIndex = 1; // // axPageLayoutControl1 // this.axPageLayoutControl1.Location = new System.Drawing.Point(186, 41); this.axPageLayoutControl1.Name = "axPageLayoutControl1"; this.axPageLayoutControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axPageLayoutControl1.OcxState"))); this.axPageLayoutControl1.Size = new System.Drawing.Size(542, 361); this.axPageLayoutControl1.TabIndex = 2; // // axTOCControl1 // this.axTOCControl1.Location = new System.Drawing.Point(3, 41); this.axTOCControl1.Name = "axTOCControl1"; this.axTOCControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axTOCControl1.OcxState"))); this.axTOCControl1.Size = new System.Drawing.Size(177, 361); this.axTOCControl1.TabIndex = 3; // // axToolbarControl1 // this.tableLayoutPanel1.SetColumnSpan(this.axToolbarControl1, 2); this.axToolbarControl1.Location = new System.Drawing.Point(3, 3); this.axToolbarControl1.Name = "axToolbarControl1"; this.axToolbarControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axToolbarControl1.OcxState"))); this.axToolbarControl1.Size = new System.Drawing.Size(725, 28); this.axToolbarControl1.TabIndex = 4; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(734, 454); this.Controls.Add(this.tableLayoutPanel1); this.MaximumSize = new System.Drawing.Size(750, 492); this.MinimumSize = new System.Drawing.Size(750, 492); this.Name = "Form1"; this.Text = "CulturalResources"; this.Load += new System.EventHandler(this.Form1_Load); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.axLicenseControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axPageLayoutControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axTOCControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axToolbarControl1)).EndInit(); this.ResumeLayout(false); }
// 唯一值符号化 public static void Symbology_UniqueValue(IFeatureLayer featureLayer, string fieldName, IMapControl2 mapControl, AxTOCControl tocControl) { IUniqueValueRenderer pRenderer = new UniqueValueRendererClass() { FieldCount = 1 }; // 随机色带 IColorRamp pColorRamp = new RandomColorRampClass() { StartHue = 0, MinSaturation = 0, MinValue = 0, EndHue = 360, MaxSaturation = 100, MaxValue = 100, Size = featureLayer.FeatureClass.FeatureCount(new QueryFilterClass()) }; bool bOk = false; pColorRamp.CreateRamp(out bOk); IEnumColors pColors = pColorRamp.Colors; ITable pTable = featureLayer as ITable; int fieldIndex = pTable.FindField(fieldName); IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.AddField(fieldName); ICursor pCursor = pTable.Search(pQueryFilter, true); IRow pRow = pCursor.NextRow(); while (pRow != null) { IRowBuffer pRowBuffer = pRow as IRowBuffer; string value = pRowBuffer.get_Value(fieldIndex).ToString(); IColor pColor = pColors.Next(); ISymbol pSymbol = null; switch (featureLayer.FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPoint: pSymbol = new SimpleMarkerSymbolClass() { Color = pColor }; break; case esriGeometryType.esriGeometryPolyline: pSymbol = new SimpleLineSymbolClass() { Color = pColor }; break; case esriGeometryType.esriGeometryPolygon: pSymbol = new SimpleFillSymbolClass() { Color = pColor }; break; } pRenderer.AddValue(value, "", pSymbol); pRow = pCursor.NextRow(); } (featureLayer as IGeoFeatureLayer).Renderer = pRenderer as IFeatureRenderer; mapControl.Refresh(); tocControl.Update(); }
public override void Initialize() { System.Windows.Forms.Integration.WindowsFormsHost host; // Initialize the map control. host = new System.Windows.Forms.Integration.WindowsFormsHost(); this._axMapCtrl = new AxMapControl(); this._axMapCtrl.BeginInit(); host.Child = this._axMapCtrl; this._mapContainer.Children.Add(host); this._axMapCtrl.OnMouseDown += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnMouseDownEventHandler(this.axMapControl_OnMouseDown); this._axMapCtrl.EndInit(); // Initialize the layout control host = new System.Windows.Forms.Integration.WindowsFormsHost(); this._axLayoutCtrl = new AxPageLayoutControl(); this._axLayoutCtrl.BeginInit(); host.Child = this._axLayoutCtrl; this._layoutContainer.Children.Add(host); this._axLayoutCtrl.EndInit(); // Initialize the toc control host = new System.Windows.Forms.Integration.WindowsFormsHost(); // Create an object of the legend control. this._axTOCCtrl = new AxTOCControl(); this._axTOCCtrl.BeginInit(); host.Child = this._axTOCCtrl; this._tocContainer.Children.Add(host); this._axTOCCtrl.OnMouseDown += new ITOCControlEvents_Ax_OnMouseDownEventHandler(this._axTOCCtrl_OnMouseDown); this._axTOCCtrl.EndInit(); //initialize the map and layout synchronization class //get a reference to the MapControl and the PageLayoutControl IMapControl3 mapCtrl = (IMapControl3)this._axMapCtrl.Object; IPageLayoutControl2 layoutCtrl = (IPageLayoutControl2)this._axLayoutCtrl.Object; this._mapAndLayoutSync = new MapAndLayoutSynchronizer(mapCtrl, layoutCtrl); //bind the controls together (both point at the same map) and set the MapControl as the active control this._mapAndLayoutSync.BindControls(true); //add the framework controls (TOC and Toolbars) in order to synchronize then when the //active control changes (call SetBuddyControl) this._mapAndLayoutSync.AddFrameworkControl(this._axTOCCtrl.Object); this._symWindow = new SymbologyWindow(); this._symWindow.Initialize(); ShapefileWorkspaceFactoryClass tempWSFactory = new ShapefileWorkspaceFactoryClass(); this._tempWorkspace = tempWSFactory.OpenFromFile(System.IO.Path.GetTempPath(), 0); /* Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.AccessWorkspaceFactory"); IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType); string tempWSPath = System.IO.Path.GetTempPath(); string tempWSName = "ArcMapMgr_" + this.GetHashCode().ToString() + "_WS.mdb"; string tempWSFile = System.IO.Path.Combine(tempWSPath, tempWSName); if (System.IO.File.Exists(tempWSFile)) { System.IO.File.Delete(tempWSFile); } IWorkspaceName workspaceName = workspaceFactory.Create(tempWSPath, tempWSName, null, 0); // Cast the workspace name object to the IName interface and open the workspace. IName name = (IName)workspaceName; this._tempWorkspace = (IWorkspace)name.Open(); */ }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChildForm)); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.打开属性表ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.自动标注ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.缩放到图层ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.移除图层ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.axPageLayoutControl1 = new ESRI.ArcGIS.Controls.AxPageLayoutControl(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.axTOCControl1 = new ESRI.ArcGIS.Controls.AxTOCControl(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.axMapControl1 = new ESRI.ArcGIS.Controls.AxMapControl(); this.axMapControl2 = new ESRI.ArcGIS.Controls.AxMapControl(); this.statusStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axPageLayoutControl1)).BeginInit(); this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axTOCControl1)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axMapControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axMapControl2)).BeginInit(); this.SuspendLayout(); // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1, this.toolStripStatusLabel2, this.toolStripStatusLabel3, this.toolStripStatusLabel4, this.toolStripStatusLabel5}); this.statusStrip1.Location = new System.Drawing.Point(0, 379); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(774, 22); this.statusStrip1.TabIndex = 1; this.statusStrip1.Text = "statusStrip1"; // // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(131, 17); this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; // // toolStripStatusLabel2 // this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; this.toolStripStatusLabel2.Size = new System.Drawing.Size(131, 17); this.toolStripStatusLabel2.Text = "toolStripStatusLabel2"; // // toolStripStatusLabel3 // this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; this.toolStripStatusLabel3.Size = new System.Drawing.Size(131, 17); this.toolStripStatusLabel3.Text = "toolStripStatusLabel3"; // // toolStripStatusLabel4 // this.toolStripStatusLabel4.Name = "toolStripStatusLabel4"; this.toolStripStatusLabel4.Size = new System.Drawing.Size(131, 17); this.toolStripStatusLabel4.Text = "toolStripStatusLabel4"; // // toolStripStatusLabel5 // this.toolStripStatusLabel5.Name = "toolStripStatusLabel5"; this.toolStripStatusLabel5.Size = new System.Drawing.Size(131, 17); this.toolStripStatusLabel5.Text = "toolStripStatusLabel5"; // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.打开属性表ToolStripMenuItem, this.缩放到图层ToolStripMenuItem, this.自动标注ToolStripMenuItem, this.移除图层ToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(153, 114); // // 打开属性表ToolStripMenuItem // this.打开属性表ToolStripMenuItem.Name = "打开属性表ToolStripMenuItem"; this.打开属性表ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.打开属性表ToolStripMenuItem.Text = "打开属性表"; this.打开属性表ToolStripMenuItem.Click += new System.EventHandler(this.打开属性表ToolStripMenuItem_Click); // // 自动标注ToolStripMenuItem // this.自动标注ToolStripMenuItem.Name = "自动标注ToolStripMenuItem"; this.自动标注ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.自动标注ToolStripMenuItem.Text = "标注"; // // 缩放到图层ToolStripMenuItem // this.缩放到图层ToolStripMenuItem.Name = "缩放到图层ToolStripMenuItem"; this.缩放到图层ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.缩放到图层ToolStripMenuItem.Text = "缩放到图层"; this.缩放到图层ToolStripMenuItem.Click += new System.EventHandler(this.缩放到图层ToolStripMenuItem_Click); // // 移除图层ToolStripMenuItem // this.移除图层ToolStripMenuItem.Name = "移除图层ToolStripMenuItem"; this.移除图层ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.移除图层ToolStripMenuItem.Text = "移除图层"; this.移除图层ToolStripMenuItem.Click += new System.EventHandler(this.移除图层ToolStripMenuItem_Click); // // axPageLayoutControl1 // this.axPageLayoutControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.axPageLayoutControl1.Location = new System.Drawing.Point(0, 0); this.axPageLayoutControl1.Name = "axPageLayoutControl1"; this.axPageLayoutControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axPageLayoutControl1.OcxState"))); this.axPageLayoutControl1.Size = new System.Drawing.Size(541, 352); this.axPageLayoutControl1.TabIndex = 3; // // tabPage2 // this.tabPage2.AutoScroll = true; this.tabPage2.Controls.Add(this.axPageLayoutControl1); this.tabPage2.Location = new System.Drawing.Point(4, 4); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(541, 352); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "出图"; this.tabPage2.UseVisualStyleBackColor = true; // // axTOCControl1 // this.axTOCControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.axTOCControl1.Location = new System.Drawing.Point(2, 1); this.axTOCControl1.Name = "axTOCControl1"; this.axTOCControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axTOCControl1.OcxState"))); this.axTOCControl1.Size = new System.Drawing.Size(221, 257); this.axTOCControl1.TabIndex = 0; this.axTOCControl1.OnMouseDown += new ESRI.ArcGIS.Controls.ITOCControlEvents_Ax_OnMouseDownEventHandler(this.axTOCControl1_OnMouseDown); // // tabControl1 // this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Bottom; this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Location = new System.Drawing.Point(225, 1); this.tabControl1.Multiline = true; this.tabControl1.Name = "tabControl1"; this.tabControl1.RightToLeftLayout = true; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(549, 377); this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.FillToRight; this.tabControl1.TabIndex = 2; this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged); // // tabPage1 // this.tabPage1.Controls.Add(this.axMapControl1); this.tabPage1.Location = new System.Drawing.Point(4, 4); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(541, 352); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "工程文件"; this.tabPage1.UseVisualStyleBackColor = true; // // axMapControl1 // this.axMapControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.axMapControl1.Location = new System.Drawing.Point(0, 0); this.axMapControl1.Name = "axMapControl1"; this.axMapControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMapControl1.OcxState"))); this.axMapControl1.Size = new System.Drawing.Size(541, 352); this.axMapControl1.TabIndex = 1; this.axMapControl1.OnExtentUpdated += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnExtentUpdatedEventHandler(this.axMapControl1_OnExtentUpdated); this.axMapControl1.OnViewRefreshed += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnViewRefreshedEventHandler(this.axMapControl1_OnViewRefreshed); this.axMapControl1.OnAfterScreenDraw += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnAfterScreenDrawEventHandler(this.axMapControl1_OnAfterScreenDraw); // // axMapControl2 // this.axMapControl2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.axMapControl2.Location = new System.Drawing.Point(2, 257); this.axMapControl2.Name = "axMapControl2"; this.axMapControl2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMapControl2.OcxState"))); this.axMapControl2.Size = new System.Drawing.Size(221, 119); this.axMapControl2.TabIndex = 4; this.axMapControl2.OnMouseDown += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnMouseDownEventHandler(this.axMapControl2_OnMouseDown); // // ChildForm // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.AutoScroll = true; this.AutoSize = true; this.ClientSize = new System.Drawing.Size(774, 401); this.Controls.Add(this.axMapControl2); this.Controls.Add(this.axTOCControl1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.tabControl1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "ChildForm"; this.ShowInTaskbar = false; this.Text = "子窗口"; this.Load += new System.EventHandler(this.ChildForm_Load); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); this.contextMenuStrip1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.axPageLayoutControl1)).EndInit(); this.tabPage2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.axTOCControl1)).EndInit(); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.axMapControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axMapControl2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }