/// <summary> /// 绘制瓦斯含量点 /// </summary> /// <param name="editlayer"></param> /// <param name="ge"></param> public void DrawGasContentPointGE(IFeatureLayer editlayer, GasContentEntity ge) { IFeature f; IPoint p; //定义一个地物类,把要编辑的图层转化为定义的地物类 IFeatureClass fc = editlayer.FeatureClass; //先定义一个编辑的工作空间,然后把转化为数据集,最后转化为编辑工作空间, IWorkspaceEdit w = (fc as IDataset).Workspace as IWorkspaceEdit; //开始事务操作 w.StartEditing(false); //开始编辑 w.StartEditOperation(); //创建一个地物 f = fc.CreateFeature(); p = new PointClass(); //设置点的坐标 p.PutCoords(Convert.ToDouble(ge.CoordinateX), Convert.ToDouble(ge.CoordinateY)); try { //确定图形类型 f.Shape = p; int num3; //num3 = editlayer.FeatureClass.Fields.FindField("PRIMARY_KEY"); //f.set_Value(num3, ge.PrimaryKey); num3 = editlayer.FeatureClass.Fields.FindField("COORDINATE_X"); f.set_Value(num3, ge.CoordinateX); num3 = editlayer.FeatureClass.Fields.FindField("COORDINATE_Y"); f.set_Value(num3, ge.CoordinateY); num3 = editlayer.FeatureClass.Fields.FindField("COORDINATE_Z"); f.set_Value(num3, ge.CoordinateZ); num3 = editlayer.FeatureClass.Fields.FindField("DEPTH"); f.set_Value(num3, ge.Depth); num3 = editlayer.FeatureClass.Fields.FindField("GAS_CONTENT_VALUE"); f.set_Value(num3, ge.GasContentValue); num3 = editlayer.FeatureClass.Fields.FindField("MEASURE_DATE_TIME"); f.set_Value(num3, ge.MeasureDateTime); //保存地物 f.Store(); } catch (Exception e) { MessageBox.Show(e.Message); } ICharacterMarkerSymbol pMarkerSymbol; pMarkerSymbol = new CharacterMarkerSymbolClass(); stdole.IFontDisp stdFont = new stdole.StdFontClass() as stdole.IFontDisp; stdFont.Name = "ESRI Hazardous Materials"; stdFont.Size = 48; pMarkerSymbol.Font = stdFont; pMarkerSymbol.CharacterIndex = 216; //Symbol颜色 pMarkerSymbol.Color = getRGB(0, 0, 0); //Symbol旋转角度 pMarkerSymbol.Angle = 0; //Symbol大小 pMarkerSymbol.Size = 48; RenderfeatureLayer(editlayer, pMarkerSymbol as ISymbol); //结束编辑 w.StopEditOperation(); //结束事务操作 w.StopEditing(true); }