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(); } } } }
/// <summary> /// 初始化封装AxSymbologyControl的常用操作的符号选择器,向AxSymbologyControl加载指定图例 /// </summary> /// <param name="symbologyControl"></param> /// <param name="layer">要设置样式的图层</param> /// <param name="legendClass">当前所选的图层图例(包含符号(Symbol)及其标注与描述等)</param> public SymbolSelector(AxSymbologyControl symbologyControl, ILayer layer, ILegendClass legendClass) { SymbologyControl = symbologyControl; LegendClass = legendClass; Layer = layer; LoadStyle(); }
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 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(); } } } }
private void InsertLegendInfoToTree(ILegendInfo pLegendInfo, TOCTreeNode pParantNode) { int legendGroupCount = pLegendInfo.LegendGroupCount; TOCTreeNode pNode = pParantNode; TOCTreeNode node2 = null; for (int i = 0; i < legendGroupCount; i++) { ILegendGroup group = pLegendInfo.get_LegendGroup(i); if (legendGroupCount > 1) { pNode = new TOCTreeNodeEx(group.Heading) { Tag = group }; pParantNode.Nodes.Add(pNode); } int classCount = group.ClassCount; for (int j = 0; j < classCount; j++) { ILegendClass class2 = group.get_Class(j); node2 = new TOCTreeNodeEx(class2.Label, false, true) { Tag = class2 }; pNode.Nodes.Add(node2); } } }
public FormSymbolSelector(ILegendClass legendClass, ILayer layer) { InitializeComponent(); this.mLegendClass = legendClass; this.mLayer = layer; }
private void axTOCControlLayerTree_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e)//TOCC左键设置图例,右键弹出菜单 { esriTOCControlItem pItem = esriTOCControlItem.esriTOCControlItemNone; IBasicMap pMap = null; object unk = null, data = null; axTOCControlLayerTree.HitTest(e.x, e.y, ref pItem, ref pMap, ref _toccSelectedLayer, ref unk, ref data); if (e.button == 1) { if (pItem == esriTOCControlItem.esriTOCControlItemLegendClass) { //取得图例 ILegendClass legendClass = ((ILegendGroup)unk).get_Class((int)data); var symbolSelectorForm = new SymbolSelectorDevForm(legendClass, _toccSelectedLayer); if (symbolSelectorForm.ShowDialog() == DialogResult.OK) { GoToMapView(); legendClass.Symbol = symbolSelectorForm.PSymbol; //设置新的符号 axMapControlMainMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); //更新主Map控件和图层控件 } _effectLayer.SwipeLayer = _toccSelectedLayer; } } else if (e.button == 2) { if (pItem == esriTOCControlItem.esriTOCControlItemLayer) { cMenuStripTocc.Show(axTOCControlLayerTree, new System.Drawing.Point(e.x, e.y)); ShowFieldLabelMenuItems(_toccSelectedLayer); } } }
public FormSymbology(ILegendClass tempLegendClass, ILayer tempLayer) { InitializeComponent(); //this.ControlBox = false; // 设置不出现关闭按钮 pLegendClass = tempLegendClass; //通过点击 toccontrol 时候可以获得要素类的 LegendClass! pLayer = tempLayer; //点击的图层 }
bool _contextMenuMoreSymbolInitiated = false;//判断菜单是否已经初始化 /// <summary> /// 符号选择器(Symbology)窗体 /// (注意Show窗体前先调用LoadSymbolSelector方法) /// </summary> public SymbolSelectorDevForm(ILegendClass tempLegendClass, ILayer tempLayer) { InitializeComponent(); this._pLegendClass = tempLegendClass; this._pLayer = tempLayer; }
public SymbolSelectorFrm(ILegendClass tempLegendClass, ILayer tempLayer) { InitializeComponent(); this.pLegendClass = tempLegendClass; this.pLayer = tempLayer; }
/// <summary> /// 符号选择器(Symbology)窗体(注意Show窗体前先调用LoadSymbolSelector方法) /// </summary> /// <param name="legendClass">当前所选的图层图例(包含符号(Symbol)及其标注与描述等)</param> /// <param name="layer">要设置样式的图层</param> public SymbolSelectorForm(ILegendClass legendClass, ILayer layer) { InitializeComponent(); btnOK.Click += delegate { DialogResult = DialogResult.OK; Close(); }; btnCancel.Click += delegate { DialogResult = DialogResult.Cancel; Close(); }; btnMoreSymbols.Click += delegate { Selector.MoreSymbolMenuStrip.Show(btnMoreSymbols.Location); }; }
private void axTOCControl1_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e) { try { 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 == 2)//鼠标右键 { switch (itemType) { case esriTOCControlItem.esriTOCControlItemLayer: this.TOCMenu.Show(this.axTOCControl1, e.x, e.y); break; case esriTOCControlItem.esriTOCControlItemMap: this.TOCMenu.Show(this.axTOCControl1, e.x, e.y); break; default: break; } } else if (e.button == 1) //鼠标左键 { switch (itemType) { case esriTOCControlItem.esriTOCControlItemLegendClass: ILegendClass pLegendClass = ((ILegendGroup)unk).get_Class((int)data); FrmSymbolSelector newSymbolSelectorFrm = new FrmSymbolSelector(pLegendClass, layer); if (newSymbolSelectorFrm.ShowDialog() == DialogResult.OK) { this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); pLegendClass.Symbol = newSymbolSelectorFrm.pSymbol; this.axTOCControl1.Update(); } break; default: break; } } } catch (Exception ex) { DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message); } }
/// <summary> /// 向AxSymbologyControl加载指定图例,初始化符号选择器 /// </summary> /// <param name="layer">要设置样式的图层</param> /// <param name="legendClass">当前所选的图层图例(包含符号(Symbol)及其标注与描述等)</param> public void LoadSymbolSelector(ILayer layer, ILegendClass legendClass) { Selector = new SymbolSelector(this.axSymbologyControl1, layer, legendClass); }
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(); } } } }
public void CalculateBounds(Graphics pGraphics, ref int x, ref int y, int Indent) { int num = x; int num2 = y; this.m_ExpandRect.X = x; this.m_ExpandRect.Y = y; this.m_ExpandRect.Width = 12; x += 12; this.m_ExpandRect.Height = this.m_nItemHeight; int nItemHeight = this.m_nItemHeight; if (this.m_HasCheck) { x += this.m_Space; this.m_ChectRect.X = x; this.m_ChectRect.Y = y; this.m_ChectRect.Width = 12; x += 12; this.m_ChectRect.Height = this.m_nItemHeight; } if (this.m_pTag is ILegendClass) { x += this.m_Space; ILegendClass pTag = this.m_pTag as ILegendClass; ISymbol symbol = pTag.Symbol; if (symbol is IMarkerSymbol) { IMarkerSymbol symbol2 = (IMarkerSymbol)symbol; double num5 = symbol2.Size + 10.0; double num4 = num5; if (((int)num5) < this.m_nItemHeight) { num5 = this.m_nItemHeight; } nItemHeight = (int)num5; if (num4 < 18.0) { num4 = 18.0; } this.m_ImageRect.X = x; this.m_ImageRect.Y = y; this.m_ImageRect.Width = (int)num4; this.m_ImageRect.Height = (int)num5; x += ((int)num4) + 10; } else { this.m_ImageRect.X = x; this.m_ImageRect.Y = y; this.m_ImageRect.Width = 18; this.m_ImageRect.Height = this.m_nItemHeight; x += 18; } } else if (this.m_HasImage) { x += this.m_Space; this.m_ImageRect.X = x; this.m_ImageRect.Y = y; this.m_ImageRect.Width = 12; x += 12; this.m_ImageRect.Height = this.m_nItemHeight; } if (this.m_HasText) { x += this.m_Space; SizeF ef = pGraphics.MeasureString(this.m_Text, this.m_NodeFont); this.m_TextRect.X = x; this.m_TextRect.Y = y; this.m_TextRect.Width = ((int)ef.Width) + 5; this.m_TextRect.Height = this.m_nItemHeight; x = (x + ((int)ef.Width)) + 5; } if (nItemHeight > this.m_nItemHeight) { this.m_TextRect.Height = nItemHeight; this.m_ExpandRect.Height = nItemHeight; this.m_ChectRect.Height = nItemHeight; this.m_ImageRect.Height = nItemHeight; } y += nItemHeight; if (this.m_IsExpanded) { int num6; x = num + Indent; for (num6 = 0; num6 < this.m_ChildNodes.Count; num6++) { (this.m_ChildNodes[num6] as TOCTreeNode).CalculateBounds(pGraphics, ref x, ref y, Indent); } if (this.m_ChildNodes.Count > 2) { int left = 0; left = (this.m_ChildNodes[0] as TOCTreeNode).TextRect.Left; int width = (this.m_ChildNodes[0] as TOCTreeNode).ImageRect.Width; for (num6 = 1; num6 < this.m_ChildNodes.Count; num6++) { left = (left > (this.m_ChildNodes[num6] as TOCTreeNode).TextRect.Left) ? left : (this.m_ChildNodes[num6] as TOCTreeNode).TextRect.Left; width = (width > (this.m_ChildNodes[num6] as TOCTreeNode).ImageRect.Width) ? width : (this.m_ChildNodes[num6] as TOCTreeNode).ImageRect.Width; } for (num6 = 0; num6 < this.m_ChildNodes.Count; num6++) { Rectangle textRect = (this.m_ChildNodes[num6] as TOCTreeNode).TextRect; textRect.X = left; (this.m_ChildNodes[num6] as TOCTreeNode).TextRect = textRect; textRect = (this.m_ChildNodes[num6] as TOCTreeNode).ImageRect; textRect.Width = width; (this.m_ChildNodes[num6] as TOCTreeNode).ImageRect = textRect; } } } x = num; }
private void buttonOK_Click(object sender, EventArgs e) { //高程底面 ILayer pBaseLayer = null; ISurface pSurface = null; if (m_pSceneCtrl != null) { try { // m_pSceneCtrl.LoadSxFile(ClsGDBDataCommon.GetParentPathofExe() +@"Resource\DefaultData\Default.sxd"); } catch { } //IScene pScene = new SceneClass(); //pScene.Name = "Scene"; //m_pSceneCtrl.Scene = pScene; IScene pScene = m_pSceneCtrl.Scene; pScene.Name = "Scene"; //ILayer pglayer = new GraphicsLayer3DClass(); //pScene.AddLayer(pglayer); //pScene.ActiveGraphicsLayer = new CompositeGraphicsLayerClass(); pScene.ExaggerationFactor = Convert.ToDouble(doubleInputExaFactor.Value.ToString()); while (pScene.LayerCount > 0) { pScene.DeleteLayer(pScene.get_Layer(0)); } // pScene.ClearLayers(); pScene.AddLayer(pScene.ActiveGraphicsLayer); GC.Collect(); for (int i = 0; i < m_pMapCtrl.Map.LayerCount; i++) { ILayer pMapLayer = m_pMapCtrl.Map.get_Layer(i); ILayer pLayer = pMapLayer; if (comboBoxExBaseHeightLayer.Items.Count > 0) { if (pLayer.Name == comboBoxExBaseHeightLayer.SelectedItem.ToString()) { pBaseLayer = pLayer; } } } if (pBaseLayer is IRasterLayer) { IRaster pRaster = ((IRasterLayer)pBaseLayer).Raster; IRasterBand pBand = ((IRasterBandCollection)pRaster).Item(0); IRasterSurface rsurface = new RasterSurface(); rsurface.RasterBand = pBand; //将dem的数据指定为surface pSurface = rsurface as ISurface; } if (pBaseLayer is ITinLayer) { ITin pTin = ((ITinLayer)pBaseLayer).Dataset; ITinSurface pTinSurface = pTin as ITinSurface; pSurface = pTinSurface as ISurface; } for (int i = 0; i < m_pMapCtrl.Map.LayerCount; i++) { ILayer pMapLayer = m_pMapCtrl.Map.get_Layer(i); ILayer pLayer = pMapLayer; string filepath = ""; string filename = ""; string sourcepath = GetDataLayerPath(pMapLayer as IDataLayer, ref filepath, ref filename); //if (pMapLayer is IRasterLayer) //{ // IRasterLayer prl = new RasterLayerClass(); // prl.CreateFromRaster(((IRasterLayer)pMapLayer).Raster); // pLayer = prl as ILayer; //} if (pMapLayer is IFeatureLayer) { // if (((IFeatureLayer)pMapLayer).FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch) // { IFeatureLayer pfl = new FeatureLayerClass(); IFeatureClass pFc = ((IFeatureLayer)pMapLayer).FeatureClass; if (pFc != null) { pfl.FeatureClass = ((IFeatureLayer)pMapLayer).FeatureClass; pLayer = pfl as ILayer; pLayer.Name = pMapLayer.Name; ///////////////////////////////////////////////////////////////////// //后期添加,用于带进涂层渲染 ///////////////////////////////////////////////////////////////////// IGeoFeatureLayer pGeoFLayer = pfl as IGeoFeatureLayer; IGeoFeatureLayer pGFMapLayer = pMapLayer as IGeoFeatureLayer; if (pGFMapLayer != null) //注记图层为空 { pGeoFLayer.Renderer = pGFMapLayer.Renderer; ILegendInfo pLegend3D = (ILegendInfo)pGeoFLayer; for (int k = 0; k < pLegend3D.LegendGroupCount; k++) { ILegendGroup pLgroup = pLegend3D.LegendGroup[k]; for (int p = 0; p < pLgroup.ClassCount; p++) { ILegendClass pLClass = pLgroup.Class[p]; if (pLClass.Symbol is IMarkerSymbol) { IMarkerSymbol pSMSymbol = pLClass.Symbol as IMarkerSymbol; pSMSymbol.Size /= 20; } } } if (pFc.ShapeType == esriGeometryType.esriGeometryMultipoint || pFc.ShapeType == esriGeometryType.esriGeometryPoint) { if (pGFMapLayer.Renderer is IUniqueValueRenderer) { } } } } // } } #region 这段代码家的有点重复,如果不加有时候会弹出设置数据源的对话框 if (pLayer is IRasterLayer) { I3DProperties properties = null; properties = new Raster3DPropertiesClass(); ILayerExtensions layerextensions = pLayer as ILayerExtensions; object p3d; for (int j = 0; j < layerextensions.ExtensionCount; j++) { p3d = layerextensions.get_Extension(j); if (p3d != null) { properties = p3d as I3DProperties; if (properties != null) { break; } } } properties.BaseOption = esriBaseOption.esriBaseSurface; properties.BaseSurface = pSurface; //I、更改分辨率后,如何让分辨率设置发挥作用。主要是刷新的问题(使用IActiveView刷新、而不能使用Iscene及IScenegraph刷新) //II、分辨率数值在( 262144-268435456)范围之内,越大越清晰。使用3DProperties.MaxTextureMemory 方法 properties.MaxTextureMemory = 268435456; } #endregion pScene.AddLayer(pLayer); //if (((CheckBoxItem)itemPanelSetVisible.Items[i]).Checked == false) //{ // pLayer.Visible = false; //} //else //{ // pLayer.Visible = true; //} if (comboBoxExBaseHeightLayer.Items.Count > 0) { if (pLayer.Name == comboBoxExBaseHeightLayer.SelectedItem.ToString()) { pBaseLayer = pLayer; } } } } if (pSurface != null) { for (int i = 0; i < m_pSceneCtrl.Scene.LayerCount; i++) { ILayer pLayer = m_pSceneCtrl.Scene.get_Layer(i); ILayerExtensions layerextensions = m_pSceneCtrl.Scene.get_Layer(i) as ILayerExtensions; I3DProperties properties = null; if (pLayer is IRasterLayer) { properties = new Raster3DPropertiesClass(); } if (pLayer is IFeatureLayer) { properties = new Feature3DPropertiesClass(); } if (pLayer is ITinLayer) { properties = new Tin3DPropertiesClass(); } object p3d; for (int j = 0; j < layerextensions.ExtensionCount; j++) { p3d = layerextensions.get_Extension(j); if (p3d != null) { properties = p3d as I3DProperties; if (properties != null) { break; } } } if (!(pLayer is IFeatureLayer)) { properties.BaseOption = esriBaseOption.esriBaseSurface; properties.BaseSurface = pSurface; //I、更改分辨率后,如何让分辨率设置发挥作用。主要是刷新的问题(使用IActiveView刷新、而不能使用Iscene及IScenegraph刷新) //II、分辨率数值在( 262144-268435456)范围之内,越大越清晰。使用3DProperties.MaxTextureMemory 方法 properties.MaxTextureMemory = 268435456; } else { IFeatureLayer pFlayer = pLayer as IFeatureLayer; //multipatch的本身有高度信息 if (pFlayer.FeatureClass != null && pFlayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch) { bool needConstantHeight = false; /* * try * { * //把导航点转向角,视场角等信息都设置成不贴在表面而需要根据生产该信息的文件设置高度 * IFeatureClass fc = pFlayer.FeatureClass; * IFeatureCursor pFcursor = fc.Search(null, false); * int OriginalFeatureidx = fc.FindField("OriginalFeatureClass"); * int OriginalFeatureOIDidx = fc.FindField("OID"); * IFeature pF = pFcursor.NextFeature(); * IFeatureLayer pOFeatureLayer = null; * if (OriginalFeatureidx == -1|| OriginalFeatureOIDidx == -1) * { * pF = null; * } * else * { * if (pF != null) * { * //获取路径点图层名称 * string orignalname = pF.get_Value(OriginalFeatureidx).ToString(); * IMap pMap = m_pMapCtrl.Map; * for (int k = 0; k < pMap.LayerCount; k++) * { * if (pMap.get_Layer(k).Name.Equals(orignalname)) * { * pOFeatureLayer = pMap.get_Layer(k) as IFeatureLayer; * break; * } * } * if (pOFeatureLayer == null) * { * pF = null; * } * } * } * * while (pF != null) * { * //IFeatureClass pFClass = pOFeatureLayer.FeatureClass; * //pFClass.FindField(OriginalFeatureOIDidx); * * * pF = pFcursor.NextFeature(); * } * } * catch * { * ; * } */ if (needConstantHeight == false) { properties.BaseOption = esriBaseOption.esriBaseSurface; //I3DProperties2 pr = properties as I3DProperties2; //if (pr != null) //{ // pr.OffsetExpressionString = "0.005"; //} // properties.BaseOption = esriBaseOption.esriBaseExpression; properties.BaseSurface = pSurface; //I、更改分辨率后,如何让分辨率设置发挥作用。主要是刷新的问题(使用IActiveView刷新、而不能使用Iscene及IScenegraph刷新) //II、分辨率数值在( 262144-268435456)范围之内,越大越清晰。使用3DProperties.MaxTextureMemory 方法 properties.MaxTextureMemory = 268435456; } } } // properties.Apply3DProperties(domlayer); // ps.SceneGraph.RefreshViewers(); IActiveView iv = m_pSceneCtrl.Scene as IActiveView; iv.PartialRefresh(esriViewDrawPhase.esriViewGeography, pLayer, null); } } }
/// <summary> /// ���캯��,��ʼ��ȫ�ֱ��� /// </summary> /// <param name="tempLegendClass">TOCͼ��</param> /// <param name="tempLayer">ͼ��</param> public FrmSymbolSelector(ILegendClass tempLegendClass, ILayer tempLayer) { InitializeComponent(); this.pLegendClass = tempLegendClass; this.pLayer = tempLayer; }
public FrmSymbolLibrary(ILegendClass tempLegendClass, ILayer tempLayer) { InitializeComponent(); pLegendClass = tempLegendClass; pLayer = tempLayer; }
private void _ChangeLegendItemSymbology(ILayer layer, ILegendClass legendItem, int index) { bool symbolChanged = false; IFeatureLayer featureLayer = layer as IFeatureLayer; if (featureLayer == null) return; //Get the IStyleGalleryItem IStyleGalleryItem styleGalleryItem = null; //Select SymbologyStyleClass based upon feature type switch (featureLayer.FeatureClass.ShapeType) { case esriGeometryType.esriGeometryPoint: styleGalleryItem = this._symWindow.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols, legendItem.Symbol); break; case esriGeometryType.esriGeometryPolyline: styleGalleryItem = this._symWindow.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols, legendItem.Symbol); break; case esriGeometryType.esriGeometryPolygon: styleGalleryItem = this._symWindow.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols, legendItem.Symbol); break; } if (styleGalleryItem == null) return; if (featureLayer is IGeoFeatureLayer) { IGeoFeatureLayer geoFeatureLayer = (IGeoFeatureLayer)featureLayer; if (geoFeatureLayer.Renderer is ISimpleRenderer) { ISimpleRenderer simpleRenderer = (ISimpleRenderer)(geoFeatureLayer.Renderer); //Set its symbol from the styleGalleryItem simpleRenderer.Symbol = (ISymbol)styleGalleryItem.Item; symbolChanged = true; } else if (geoFeatureLayer.Renderer is IUniqueValueRenderer) { IUniqueValueRenderer uniqueValueRenderer = (IUniqueValueRenderer)(geoFeatureLayer.Renderer); uniqueValueRenderer.Symbol[uniqueValueRenderer.Value[index]] = (ISymbol)styleGalleryItem.Item; symbolChanged = true; } } if (symbolChanged == true) { //Fire contents changed event that the TOCControl listens to this._axMapCtrl.ActiveView.ContentsChanged(); //Refresh the display this._axMapCtrl.Refresh(esriViewDrawPhase.esriViewGeography, null, null); } }
bool contextMenuMoreSymbolInitiated = false; //判断右键菜单是否已经初始化了 public SymbologyForm(ILegendClass tempLegendClass, ILayer tempLayer) { InitializeComponent(); pLegendClass = tempLegendClass; //通过点击 toccontrol 时候可以获得要素类的 LegendClass! pLayer = tempLayer; //点击的图层 }
//加载拓扑图层 public static void AddTopoLayer(ref AxMapControl pMapCtrl, string strTopoLayerName, ITopologyWorkspace ipTopologyWS, IFeatureClassContainer ipFeatClassContainer, IFeatureDataset ipFeatDataset) { int nOriginClassID, nDestClassID; ITopology ipTopology; //打开数据集 //ITopologyContainer ipTopoContainer = (ITopologyContainer)ipFeatDataset; IWorkspace2 pWorkspace = (IWorkspace2)ipFeatDataset.Workspace; if (pWorkspace.get_NameExists(esriDatasetType.esriDTTopology, strTopoLayerName)) { ipTopology = ipTopologyWS.OpenTopology(strTopoLayerName); if (ipTopology == null) { return; } ITopologyLayer ipTopologyLayer = new TopologyLayerClass(); ipTopologyLayer.Topology = ipTopology; ILegendInfo legendInfo = (ILegendInfo)ipTopologyLayer; for (int i = 0; i < legendInfo.LegendGroupCount; i++) { ILegendGroup legendgroup = legendInfo.get_LegendGroup(i); ILegendClass legendclass = legendgroup.get_Class(0); switch (legendgroup.Heading) { case "Area Errors": { legendgroup.Heading = ""; legendclass.Label = "面状错误"; legendclass.Description = "面状错误"; break; } case "Line Errors": { legendgroup.Heading = ""; legendclass.Label = "线状错误"; legendclass.Description = "线状错误"; break; } case "Point Errors": { legendgroup.Heading = ""; legendclass.Label = "点状错误"; legendclass.Description = "点状错误"; break; } } } ILayer ipLayer = (ILayer)ipTopologyLayer; ipLayer.Name = strTopoLayerName; //将拓扑检查合并后,将拓扑图层名指定为“拓扑错误”后,采用此方法命名 hehy20080724 /* 将拓扑检查合并后,将拓扑图层名指定为“拓扑错误”后,注销以下代码 hehy20080724 * /////////////////////////////////////////////////// * //得到拓扑层相对应的规则名称 * CModelSchema pModelSchema = new CModelSchema(); * string strRuleName = pModelSchema.GetRuleNameByTopoLayerName(m_pTask.pSchema, strTopoLayerName); * ////////////////////////////////////////////////// * if (strRuleName.Length == 0) * { * ipLayer.Name = strTopoLayerName; * } * else * { * ipLayer.Name = strRuleName; * } */ //把拓扑图层加载到map控件中 //pMapCtrl.AddLayer(ipLayer, pMapCtrl.LayerCount); pMapCtrl.Map.AddLayer(ipLayer); //pMapCtrl.ActiveView.Extent = ipLayer.AreaOfInterest; } }