📄 zkshow.cs
字号:
myPoints.Add2(0,ceng_z-5-lin_h);
myPoints.Add2(5,ceng_z-6-lin_h);
myPoints.Add2(10,ceng_z-5-lin_h);
myPoints.Add2(15,ceng_z-4-lin_h);
myPoints.Add2(20,ceng_z-5-lin_h);
myPoints.Add2(20,ceng_z-lin_h);
myPoints.Add2(0,ceng_z-lin_h);
}
else
{
myPoints.Add2(0,ceng_z);
myPoints.Add2(0,ceng_z+5);
myPoints.Add2(5,ceng_z+4);
myPoints.Add2(10,ceng_z+5);
myPoints.Add2(15,ceng_z+6);
myPoints.Add2(20,ceng_z+5);
myPoints.Add2(20,ceng_z);
myPoints.Add2(0,ceng_z);
}
return myPoints;
}
/// <summary>
/// 跟新myrecordset
/// </summary>
/// <param name="pencolor">pencolor</param>
/// <param name="bushstyle">bushstyle</param>
/// <param name="brushcolor">brushcolor</param>
/// <param name="penwidth">penwidth</param>
private void updata_Recordset(SuperMapLib.soGeoRegion myRegin,int pencolor,int bushstyle,int brushcolor,int penwidth,string txt)
{
myRecordset.AddNew((SuperMapLib.soGeometry)myRegin,true);
myRecordset.SetFieldValue("PenColor",pencolor); //这里加入属性数据
myRecordset.SetFieldValue("BrushStyle",bushstyle);
myRecordset.SetFieldValue("BrushColor",brushcolor);
myRecordset.SetFieldValue("PenWidth",penwidth);
myRecordset.SetFieldValue("txt",txt);
myRecordset.Update();
}
/// <summary>
/// 把填充层的信息更新到 recordset中去。
/// </summary>
/// <param name="up_t"></param>
/// <param name="down_t"></param>
/// <param name="up_h"></param>
/// <param name="down_h"></param>
/// <param name="ceng"></param>
/// <param name="j_z"></param>
/// <param name="j_h"></param>
/// <param name="ceng_z"></param>
/// <param name="ceng_h"></param>
/// <param name="pencolor"></param>
private void updata_fill(int up_t,int down_t,double up_h,double down_h,int ceng,double j_z,double j_h,double ceng_z,double ceng_h,int pencolor,string txt_di,string txt_ding)
{
lay_Region mylay_fill = new lay_Region(0,0);
SuperMapLib.soGeoRegion myRegin = new SuperMapLib.soGeoRegionClass();
mylay_fill= get_ceng_fill(up_t,down_t,up_h,down_h,ceng,j_z,j_h,ceng_z,ceng_h);
myRegin =mylay_fill.lay_down_Region;
updata_Recordset(myRegin,pencolor,mylay_fill.di,pencolor,1,txt_di);
myRegin = mylay_fill.lay_up_Region;
updata_Recordset(myRegin,pencolor,mylay_fill.ding,pencolor,1,txt_ding);
}
/// <summary>
/// 根据查询出来的相关煤层信息把钻孔的示意图画出来。
/// </summary>
/// <param name="Ceng_DataSet">包含钻孔信息的dataset</param>
private void Draw_lay(DataSet Ceng_DataSet)
{
SuperMapLib.soGeoRegion myRegin = new SuperMapLib.soGeoRegionClass();
this.myRecordset = get_Recordset();
if(this.myRecordset!=null)
{
double j_high =Convert.ToDouble(this.numericUpDown_h.Value); //井的深度
double j_z = Convert.ToDouble(this.numericUpDown_z.Value); //井口Y坐标
myRegin = get_kong_Region(j_high,j_z);
//1.1 设置字段的值
int brushcolor = (int)ColorTranslator.ToOle(Color.SkyBlue);
int pencolor = (int)ColorTranslator.ToOle(Color.Black);
updata_Recordset(myRegin,pencolor,1,brushcolor,1,""); //钻孔的填充风格
//2.0开始加入煤层信息
double ceng_h; //煤的厚度
double ceng_z; //煤的Z轴坐标
int m = Ceng_DataSet.Tables[0].Rows.Count; //总共有多少层煤
for(int n=0;n<m;n++)
{
if(Ceng_DataSet.Tables[0].Rows[n]["煤层名称"].ToString()!="未见煤"&&Ceng_DataSet.Tables[0].Rows[n]["煤层名称"].ToString()!="煤层露头外")
{
ceng_h = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n]["煤层伪厚"]);
ceng_z = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n]["底板坐标z"]);
myRegin = get_ceng_Region(ceng_h,ceng_z);
string meiName = Ceng_DataSet.Tables[0].Rows[n]["煤层名称"].ToString()+" z:"+ceng_z.ToString();
pencolor = (int)ColorTranslator.ToOle(Color.Black);
updata_Recordset(myRegin,pencolor,131,pencolor,1,meiName); //煤层的填充风格
//到此为止 煤层信息和钻孔边框加入完毕。
//3.0加入填充物多变形
//在这里计算出每层煤上下的间隔距离
//3.1
double up_h; // 与上一层的高度差
double down_h; //与下一层的高度差
double font_h; //上一层的煤厚
double font_z;//上一层的Z坐标
double next_z ; //下一层的Z坐标
int up_t;//顶板的填充物
int down_t;//底板的填充物
//只有一层煤的情况,
//###################################################find_fill_id
up_t =Convert.ToInt32(Ceng_DataSet.Tables[0].Rows[n]["ding"]);
down_t =Convert.ToInt32(Ceng_DataSet.Tables[0].Rows[n]["di"]);
pencolor = (int)ColorTranslator.ToOle(Color.Black);
string txt_di = Ceng_DataSet.Tables[0].Rows[n]["底板岩性"].ToString();
string txt_ding = Ceng_DataSet.Tables[0].Rows[n]["顶板岩性"].ToString();
if(m==1)
{ //跟钻孔的最高点和最低点比较
up_h = j_z-ceng_z;
down_h = ceng_z-ceng_h - (j_z-j_high);
updata_fill(up_t,down_t,up_h,down_h,1,j_z,j_high,ceng_z,ceng_h,pencolor,txt_di,txt_ding);
}
else //有两层及其以上的情况
{
//1.处理最上面那层煤
if(n==0)
{
next_z = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n+1]["底板坐标z"]);
up_h = j_z-ceng_z;
down_h = ceng_z-ceng_h - next_z;
updata_fill(up_t,down_t,up_h,down_h,2,j_z,j_high,ceng_z,ceng_h,pencolor,txt_di,txt_ding);
}
else if(n==m-1) //最下面那层
{
font_z = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n-1]["底板坐标z"]);
font_h = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n-1]["煤层伪厚"]);
up_h = font_z - font_h-ceng_z;
down_h = ceng_z-ceng_h - (j_z-j_high);
updata_fill(up_t,down_t,up_h,down_h,3,j_z,j_high,ceng_z,ceng_h,pencolor,txt_di,txt_ding);
}
else
{
font_z = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n-1]["底板坐标z"]);
font_h = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n-1]["煤层伪厚"]);
next_z = Convert.ToDouble(Ceng_DataSet.Tables[0].Rows[n+1]["底板坐标z"]);
up_h = font_z - font_h-ceng_z;
down_h = ceng_z-ceng_h - next_z;
updata_fill(up_t,down_t,up_h,down_h,4,j_z,j_high,ceng_z,ceng_h,pencolor,txt_di,txt_ding);
}
}
}
else
{
MessageBox.Show("临时文件打开失败,或者当前钻孔无煤层信息!不能绘制剖面图","错误信息",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
}
/// <summary>
/// 生成专题图
/// </summary>
private void theme()
{
SuperMapLib.soThemeCustom myTheme;
myTheme = this.axSuperMap1.Layers[1].ThemeCustom;
myTheme.BrushStyleField = "BrushStyle";
myTheme.BrushColorField = "BrushColor";
myTheme.PenWidthField = "PenWidth";
myTheme.PenColorField = "PenColor";
myTheme.Enable = true;
SuperMapLib.soThemeLabel myThemelabel;
SuperMapLib.soTextStyle myText = new SuperMapLib.soTextStyleClass();
myText.FontHeight =1.3;
myText.FontWidth =1.1;
myText.BgColor = 50;
myText.Color = 180;
myThemelabel = this.axSuperMap1.Layers[1].ThemeLabel;
myThemelabel.Field = "txt";
myThemelabel.TextStyle = myText;
myThemelabel.OffsetX = -8;
myThemelabel.Enable = true;
myTheme = null;
myThemelabel = null;
myText = null;
}
/// <summary>
/// 返回查找指定 ID 的填充模式实体的顺序号
/// </summary>
/// <param name="id">指定 ID </param>
/// <returns></returns>
private int find_fill_id(int id)
{
int f_id = 0;
SuperMapLib.soFillStyleLib myFill;
SuperMapLib.soResources myResourse;
myResourse = this.axSuperWorkspace1.Resources;
myFill = myResourse.FillStyleLib;
f_id = myFill.FindID(id);
myFill =null;
myResourse = null;
return f_id;
}
#endregion
#region 修改钻孔信息
/// <summary>
/// 根据datagrid的变化更新数据库
/// </summary>
/// <returns>成功为true</returns>
private bool lay_change()
{
string select = "select ceng.煤层名称,ceng.止煤深度,ceng.底板坐标x,ceng.底板坐标y,ceng.底板坐标z,ceng.煤层伪厚,ceng.煤层倾角,ceng.利用厚度,ceng.顶板岩性,ceng.底板岩性,ceng.钻孔序号,ceng.等级,ceng.编号 from 煤层关联钻孔 as ceng where 1>2";
DataBase myDB = new DataBase();
if(myDB.Run_change(select,this.Ceng_DataSet,"cenginfo"))
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 得到有钻孔关的基本信息
/// </summary>
private void get_value()
{
this.k_id = this.txt_No.Text.Trim();
this.k_x = Convert.ToDouble(this.numericUpDown_x.Value);
this.k_y = Convert.ToDouble(this.numericUpDown_y.Value);
this.k_z = Convert.ToDouble(this.numericUpDown_z.Value);
this.k_h = Convert.ToDouble(this.numericUpDown_h.Value);
this.k_other = this.txt_other.Text.Trim();
this.k_com = this.txt_com.Text.Trim();
this.k_date = (DateTime)this.dateTimePicker_data.Value;
this.k_lay = this.txt_lay.Text.Trim();
}
/// <summary>
/// 修改孔的基本信息
/// </summary>
/// <returns></returns>
private bool kong_change()
{
SqlParameter[] myParamers={
new SqlParameter("@id",SqlDbType.Int,4),
new SqlParameter("@x",SqlDbType.Float),
new SqlParameter("@y",SqlDbType.Float),
new SqlParameter("@z",SqlDbType.Float),
new SqlParameter("@shigong_time",SqlDbType.DateTime),
new SqlParameter("@shigong_danwei",SqlDbType.Char,30),
new SqlParameter("@beizhu",SqlDbType.VarChar,500),
new SqlParameter("@kong_shendu",SqlDbType.Float),
new SqlParameter("@kong_cengwei",SqlDbType.Char,5),
} ;
myParamers[0].Value = this.kong_id;
myParamers[1].Value = this.k_x;
myParamers[2].Value = this.k_y;
myParamers[3].Value = this.k_z;
myParamers[4].Value = this.k_date;
myParamers[5].Value = this.k_com;
myParamers[6].Value = this.k_other;
myParamers[7].Value = this.k_h;
myParamers[8].Value = this.k_lay;
DataBase myDB = new DataBase();
if(myDB.RunProcedure_Nr("up_change_kong",myParamers))
{
return true;
}
else
{
return false;
}
}
#endregion
#region 加载自己定义的填充库
/// <summary>
/// 获取系统填充库文件
/// </summary>
private void get_fill_file()
{
SuperMapLib.soFillStyleLib myFill;
SuperMapLib.soResources myResourse;
myResourse = this.axSuperWorkspace1.Resources;
myFill = myResourse.FillStyleLib;
string url = Application.StartupPath+"\\fill.dll";
try
{
myFill.Import(url,true);
}
catch(Exception e)
{
MessageBox.Show("岩性填充库加载失败,您可能无法看到正确的钻孔剖面示意图\n\n错误信息:"+e.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
finally
{
myFill =null;
myResourse = null;
}
}
#endregion
private void user_admin()
{
this.btn_ok.Enabled = false;
this.label10.Text = "您的身份为普通用户,不能修改数据";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -