Mapxtreme符号化

WX.Traffic.DBUtility.OracleHelper conn = new WX.Traffic.DBUtility.OracleHelper();
            string sql = "select * From T_pnametype2";
            DataSet ds = new DataSet();
            conn.RunSQL(sql, ref ds);
            ListBox list = new ListBox();
            list.DataSource = ds;
            list.DataTextField = "SYMBOL";
            list.DataValueField = "TYPEID";
            list.DataBind();

            string type = "";
            MapInfo.Styles.BitmapPointStyle sym;
            MapInfo.Styles.SimpleVectorPointStyle busstate = new SimpleVectorPointStyle(0, System.Drawing.Color.Transparent, 1);
            MapInfo.Data.Table tbl = MapInfo.Engine.Session.Current.Catalog.GetTable("Pname");
            IResultSetFeatureCollection ifs;
            MapInfo.Data.SearchInfo si;
            #region 处理PName
            foreach (ListItem li in list.Items)
            {
                si = MapInfo.Data.SearchInfoFactory.SearchWhere("code like '" + li.Value + "%'");
                si.QueryDefinition.SetColumns("*");
                ifs = MapInfo.Engine.Session.Current.Catalog.Search("Pname", si);
                sym = new BitmapPointStyle(li.Text, BitmapStyles.None, System.Drawing.Color.White, 12);
                if (ifs.Count > 0)
                {
                    foreach (Feature f in ifs)
                    {
                        f.Style = sym;
                        f.Update();
                    }
                }
            }

            si = MapInfo.Data.SearchInfoFactory.SearchAll();

            si.QueryDefinition.SetColumns("*");
            ifs = MapInfo.Engine.Session.Current.Catalog.Search("Pname", si);
            if (ifs.Count > 0)
            {
                foreach (Feature fea in ifs)
                {
                    bool isIn=false;
                    type = fea["code"].ToString().Substring(0,2);
                    foreach(ListItem litem in list.Items)
                    {
                        if (type == litem.Value)
                        {
                            isIn = true;
                            break;
                        }
                    }
                    if (isIn == false)
                    {
                        fea.Style = busstate;
                        fea.Update();

                    }
                    else
                    {
                        continue;
                    }
                }
            }
            #endregion

            tbl = MapInfo.Engine.Session.Current.Catalog.GetTable("Nleft");

            for (int i = 1; i < 9; i++)
            {
                si = MapInfo.Data.SearchInfoFactory.SearchWhere("direct='" + i.ToString() + "'");
                si.QueryDefinition.SetColumns("*");
                ifs = MapInfo.Engine.Session.Current.Catalog.Search("Nleft", si);
                if (ifs.Count > 0)
                {
                    sym = new BitmapPointStyle(i.ToString() + ".bmp", BitmapStyles.None, System.Drawing.Color.White, 12);
                    foreach (Feature fnlef in ifs)
                    {
                        fnlef.Style = sym;
                        fnlef.Update();
                    }
                }
            }

            tbl = MapInfo.Engine.Session.Current.Catalog.GetTable("jktt");
            si = MapInfo.Data.SearchInfoFactory.SearchAll();
            si.QueryDefinition.SetColumns("*");
            ifs = MapInfo.Engine.Session.Current.Catalog.Search("jktt", si);
            BitmapPointStyle sym1=new BitmapPointStyle("tv.bmp", BitmapStyles.None, System.Drawing.Color.White, 12);
            BitmapPointStyle sym2 = new BitmapPointStyle("hd.bmp", BitmapStyles.None, System.Drawing.Color.White, 12);
            BitmapPointStyle sym3 = new BitmapPointStyle("cs.bmp", BitmapStyles.None, System.Drawing.Color.White, 12);
            if (ifs.Count > 0)
            {
                foreach (Feature ftt in ifs)
                {
                    if (ftt["class"] == "电视监控")
                    {
                        ftt.Style = sym1;

                    }
                    else if (ftt["class"] == "闯红灯电子警察")
                    {
                        ftt.Style = sym2;
                    }
                    else if (ftt["class"] == "超速电子警察")
                    {
                        ftt.Style = sym3;
                    }
                    ftt.Update();
                }
            }

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhangjie_xiaoke/archive/2008/11/07/3245057.aspx

posted @ 2009-12-12 23:21  googlegis  阅读(225)  评论(0编辑  收藏  举报

坐标合肥,非典型GIS开发人员 GitHub