• mapxtreme 添加图元


                            Table tblTemp1 = Session.Current.Catalog.GetTable("lyrPPHOLine");
                            tblTemp1.BeginAccess(TableAccessMode.Write);
                            //==================================================================================


                            CoordSys crdsys = ConstPar.map.GetDisplayCoordSys();
                            Feature ftr = new Feature(tblTemp.TableInfo.Columns);


                            frmp.Show();
                            frmp.TopMost = true;


                            frmp.ProgressBar1.Maximum = dt.Rows.Count + 10;
                            frmp.ProgressBar1.Value = 0;
                            frmp.Label1.Text = @"开始处理:...";


                            DataTable dtxy = new DataTable("dtxy");
                            DataColumn dc1 = new DataColumn("Lon");
                            dc1.DataType = System.Type.GetType("System.String");
                            dtxy.Columns.Add(dc1);


                            DataColumn dc2 = new DataColumn("Lat");
                            dc2.DataType = System.Type.GetType("System.String");
                            dtxy.Columns.Add(dc2);


                            Int32 i = 0;


                            foreach (DataRow dr in dt.Rows)
                            {
                                double x1 = 0;
                                double y1 = 0;
                                double x2 = 0;
                                double y2 = 0;
                                double x3 = 0;
                                double y3 = 0;
                                //====================================
                                try
                                {
                                    x1 = Convert.ToDouble(dr["Long"]);
                                }
                                catch (Exception ex)
                                {
                                    Debug.Print(ex.ToString());
                                }


                                try
                                {
                                    y1 = Convert.ToDouble(dr["Lat"]);
                                }
                                catch (Exception ex)
                                {
                                    Debug.Print(ex.ToString());
                                }
                                //===================================


                                try
                                {
                                    string cn = dr["LAC_CI"].ToString();
                                    if (cn.Trim().Length > 0)
                                    {
                                        SearchFeature(cn, ref x2, ref y2);
                                    }


                                }
                                catch (Exception ex)
                                {
                                    ConLog.Writelog(ex.ToString());
                                }
                                //=====================================


                                try
                                {
                                    string cn = dr["Oldcellid"].ToString();
                                    if (cn.Trim().Length > 0)
                                    {
                                        SearchFeature(cn, ref x3, ref y3);
                                    }


                                }
                                catch (Exception ex)
                                {
                                    ConLog.Writelog(ex.ToString());
                                }
                                //=========================================


                                if (x1 > 0 & y1 > 0)
                                {
                                    DataRow drow = null;
                                    drow = dtxy.NewRow();
                                    drow[0] = x1;
                                    drow[1] = y1;
                                    dtxy.Rows.Add(drow);


                                    //=========添加点======
                                    FeatureGeometry pt = new MapInfo.Geometry.Point((new FeatureLayer(tblTemp)).CoordSys, x1,
                                                                                    y1);
                                    FontPointStyle sty = new FontPointStyle();
                                    sty.Code = 35;
                                    sty.PointSize = 6;
                                    sty.Color = System.Drawing.Color.DarkGreen;
                                    sty.Font.Name = "MapInfo Symbols";


                                    ftr.Geometry = pt;
                                    ftr.Style = sty;
                                    tblTemp.InsertFeature(ftr);
                                    //===================
                                }


                                if (x1 != 0 & y1 != 0 & y2 != 0 & y2 != 0)
                                {
                                    CreateLine(x1, y1, x2, y2, Color.LimeGreen, "lyrPPHOLine", "", 2);
                                }


                                if (x1 != 0 & y1 != 0 & x3 != 0 & y3 != 0)
                                {
                                    CreateLine(x1, y1, x3, y3, Color.OrangeRed, "lyrPPHOLine", "", 2);
                                }


                                i = i + 1;
                                frmp.ProgressBar1.Value = i;
                                frmp.Label1.Text = "开始处理:... " + i.ToString() + "/" + (dt.Rows.Count + 10).ToString();
                                Application.DoEvents();


                            }


                            tblTemp.EndAccess();
                            //tabinfo.WriteTabFile();
                            //保存Point tab文件

  • 相关阅读:
    Subclipse安装及应用【eclipse 3.7 + subclipse1.8】
    淘宝有病!
    集装箱货柜号码 公式算法
    自己网站利用支付宝结算时的说明
    发现安全卫士360影响电脑正常运行
    中国银行的动态口令
    c#中的接口(interface)到底应用在哪些地方?
    淘宝有病(二)
    What 's CATT(Computer Aided Test Tool)?How to deal with the CATT in the SAP System?什么是CATT(计算机附加测试工具)
    Consultanting Service
  • 原文地址:https://www.cnblogs.com/googlegis/p/2978817.html
Copyright © 2020-2023  润新知