internal static void Create(TX_Point pt) {
            try {
                Client.ClientHelper.PlatformSqlMap.Create<TX_Point>(pt);
            } catch (Exception err) {
                //MessageBox.Show(err.Message);
                if (err.Message.IndexOf("FOREIGN") > 0) {
                    TX_Project pro = new TX_Project();
                    pro.ProID = "0";
                    pro.ProjectName = "地理接线图";
                    try {
                        Client.ClientHelper.PlatformSqlMap.Create<TX_Project>(pro);
                    } catch { }

                    TX_Layer lay = new TX_Layer();
                    lay.LayerID = pt.LayerID;
                    lay.ProID = "0";
                    //try {
                        Client.ClientHelper.PlatformSqlMap.Create<TX_Layer>(lay);
                        Client.ClientHelper.PlatformSqlMap.Create<TX_Point>(pt);
                    //} catch { }
                }
            }
        }
Exemple #2
0
        private void initcity() {
            string s1 = "127.043175 47.167316,127.006096 47.166382,126.988243 47.154243,126.971764 47.131828,126.98275 47.11594,126.971764 47.095379,126.96627 47.083221,126.964897 47.062645,126.964897 47.035511,126.949791 47.028957,126.962151 46.981197,126.951164 46.968079,126.948418 46.952145,126.923698 46.942768,126.909966 46.929642,126.901726 46.912758,126.898979 46.885548,126.903099 46.861137,126.898979 46.846111,126.898979 46.831081,126.911339 46.812286,126.912712 46.779381,126.905846 46.766212,126.875633 46.767155,126.872887 46.756805,126.860527 46.756805,126.845421 46.755863,126.838554 46.746456,126.827568 46.755863,126.813835 46.741749,126.797356 46.739868,126.77401 46.731396,126.717705 46.717278,126.706718 46.703152,126.699852 46.69656,126.673759 46.692791,126.632561 46.68808,126.605095 46.687138,126.580376 46.675835,126.555656 46.657928,126.533684 46.658871,126.515831 46.647556,126.510338 46.637188,126.493858 46.647556,126.470512 46.647556,126.470512 46.631531,126.462273 46.622097,126.45266 46.607006,126.451286 46.599457,126.451286 46.5853,126.429314 46.58247,126.44442 46.566422,126.459526 46.557922,126.470512 46.547535,126.488365 46.525806,126.499352 46.505016,126.529564 46.467194,126.566643 46.439758,126.566643 46.416092,126.581749 46.391472,126.609215 46.364944,126.610588 46.354519,126.625694 46.33366,126.66964 46.340298,126.684746 46.380104,126.697105 46.398102,126.723198 46.399048,126.742424 46.4142,126.776756 46.42556,126.819328 46.432186,126.823448 46.453949,126.855034 46.487999,126.893486 46.497456,126.904472 46.514469,126.97451 46.526752,127.021202 46.549423,127.039055 46.578693,127.066521 46.5853,127.09124 46.599457,127.150291 46.623985,127.201103 46.647556,127.247795 46.650387,127.29174 46.652271,127.339806 46.670177,127.342552 46.701267,127.323326 46.737045,127.30822 46.759628,127.287621 46.791607,127.273888 46.802887,127.264275 46.813225,127.278008 46.825443,127.268394 46.846111,127.234062 46.859261,127.206596 46.862076,127.224449 46.879913,127.265648 46.886486,127.298607 46.898685,127.298607 46.920261,127.305473 46.958706,127.327446 46.972763,127.334312 47.013977,127.349419 47.02615,127.372765 47.051418,127.375511 47.06826,127.346672 47.081352,127.328819 47.054226,127.293114 47.050484,127.261528 47.060776,127.228569 47.075741,127.213463 47.07761,127.217583 47.090702,127.236809 47.116875,127.229942 47.143036,127.181877 47.14584,127.166771 47.149574,127.125572 47.150509,127.096733 47.161716,127.073387 47.162647,127.052788 47.162647,127.040428 47.163582";
            
            TX_Polygon obj=Ebada.Client.ClientHelper.PlatformSqlMap.GetOneByKey<TX_Polygon>("city_suihua");
            if (obj == null) {
                TX_Layer txlayer = new TX_Layer();
                txlayer.ProID = "0";
                txlayer.LayerID = "0455";
                txlayer.LayerName = "绥化";
                obj = new TX_Polygon();
                obj.ID = "city_suihua";
                obj.Text = "绥化市区界线";
                obj.LayerID = "0455";
                obj.Points = s1;
                Object[] objs = new Object[] { txlayer, obj };
                Ebada.Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(objs, null, null);
            }
            string[] lls = obj.Points.Split(',');
            List<PointLatLng> list = new List<PointLatLng>();
            foreach (string s in lls) {
                string[] ls = s.Split(' ');
                if (ls.Length == 2) {
                    list.Add(new PointLatLng(double.Parse(ls[1]),double.Parse(ls[0])));                    
                }
            }
            
            PointPolygon gp = new PointPolygon(list, "绥化");
            gp.Tag = obj;
            PloyLineOverLay lay = new PloyLineOverLay(rMap1, "city");
            lay.Polygons.Add(gp);

            foreach (var item in list) {
                GMapMarkerPoint m = new GMapMarkerPoint(item); m.IsVisible = false;
                lay.Markers.Add(m);
                gp.Markers.Add(m);
                m.Polygon = gp;
            }
            rMap1.Overlays.Insert(0,lay);
        }