Beispiel #1
0
        void runx()
        {
            int fx = 1;

            Interlocked.Increment(ref fx);
            Thread.Sleep(5000);
            for (int i = 0; i < 9999; i++)
            {
                int rfx = i / 1000;
                Thread.Sleep(rfx * 3 + 8);

                Application.Current.Dispatcher.BeginInvoke(new Action(
                                                               () =>
                {
                    runxrf  = true;
                    int ifx = Interlocked.Increment(ref fx);
                    ;
                    double lat = 31;
                    double lng = 120;

                    int xfr = ifx % 60;
                    int yfr = ifx / 60;

                    lat += yfr * 0.001;
                    lng += xfr * 0.001;


                    //GMapMarker it =
                    //    new GMapMarker(new PointLatLng(lat, lng));
                    GMapMarker it =
                        new GMapMarker(new PointLatLng(lat > lng ? lng : lat, lat > lng ? lat  : lng));

                    var tmp = new CustomMarkerDemo(Gmap, it, ifx)
                    {
                        //EquipmentImageState = 2,
                        Visi                = Visibility.Visible,
                        EquipmentName       = "RtuX" + ifx,
                        EquipmentImageState = 3012
                    };

                    it.ZIndex = 10000 + ifx++;
                    it.Shape  = tmp;



                    Gmap.Markers.Add(it);
                    runxrf = false;
                }));
            }
        }
        // add objects and zone around them
        void AddDemoZone(double areaRadius, PointLatLng center, List <PointAndInfo> objects)
        {
            var objectsInArea = from p in objects
                                where MainMap.MapProvider.Projection.GetDistance(center, p.Point) <= areaRadius
                                select new
            {
                Obj  = p,
                Dist = MainMap.MapProvider.Projection.GetDistance(center, p.Point)
            };

            if (objectsInArea.Any())
            {
                var maxDistObject = (from p in objectsInArea
                                     orderby p.Dist descending
                                     select p).First();

                // add objects to zone
                foreach (var o in objectsInArea)
                {
                    GMapMarker it = new GMapMarker(o.Obj.Point);
                    {
                        it.ZIndex = 55;
                        var s = new CustomMarkerDemo(this, it, o.Obj.Info + ", distance from center: " + o.Dist + "km.");
                        it.Shape = s;
                    }

                    MainMap.Markers.Add(it);
                }

                // add zone circle
                //if(false)
                {
                    GMapMarker it = new GMapMarker(center);
                    it.ZIndex = -1;

                    Circle c = new Circle();
                    c.Center           = center;
                    c.Bound            = maxDistObject.Obj.Point;
                    c.Tag              = it;
                    c.IsHitTestVisible = false;

                    UpdateCircle(c);
                    Circles.Add(it);

                    it.Shape = c;
                    MainMap.Markers.Add(it);
                }
            }
        }
Beispiel #3
0
        //加载终端节点
        private void LoadMainEquipmentInfo()
        {
            int x = 0;

            EquipmentList.Clear();
            if (Gmap == null)
            {
                return;
            }
            Gmap.Markers.Clear();


            int index = 1;

            //main equipment
            foreach (
                var f in Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.Values)
            {
                try
                {
                    if (f.RtuFid > 0)
                    {
                        continue;
                    }

                    x++;
                    if (f.RtuMapX.Equals(0))
                    {
                        f.RtuMapX = Gmap.Position.Lng + (DateTime.Now.Ticks % 100) * 0.01;
                    }
                    if (f.RtuMapY.Equals(0))
                    {
                        f.RtuMapY = Gmap.Position.Lat + (DateTime.Now.Ticks % 100) * 0.01;
                    }

                    //    var tmx = WGSGCJLatLonHelper.WGS84ToGCJ02(new LatLngPoint(  f.Ymap , f.Xmap));

                    // GMapMarker it = new GMapMarker(new PointLatLng(f.Xmap, f.Ymap));
                    GMapMarker it = new GMapMarker(new PointLatLng(f.RtuMapX > f.RtuMapY ? f.RtuMapY : f.RtuMapX, f.RtuMapX > f.RtuMapY ? f.RtuMapX : f.RtuMapY));

                    var tmp = new CustomMarkerDemo(Gmap, it, f.RtuId)
                    {
                        //EquipmentImageState = 2,
                        Visi          = Visibility.Visible,
                        EquipmentName = f.RtuName
                    };

                    it.ZIndex = 1000 + index++;
                    it.Shape  = tmp;



                    EquipmentList.Add(tmp);
                    tmp.UpdateTmlStateInfomation();
                    Gmap.Markers.Add(it);
                }
                catch (Exception ex)
                {
                    WriteLog.WriteLogError("RadMapJpeg LoadEquipmentInfo Error when conver to IIEquipmentInfo:" + ex);
                }
            }

            return;

            //异步显示
            Thread th = new Thread(runx);

            th.Start();
        }
Beispiel #4
0
        public void AddMainEquipment(int rtuId)
        {
            try
            {
                if (
                    !Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.
                    ContainsKey(rtuId))
                {
                    return;
                }
                if (
                    Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[rtuId].
                    RtuFid != 0)
                {
                    return;
                }
                foreach (var t in EquipmentList)
                {
                    if (t.EquipmentRtuId == rtuId)
                    {
                        return;
                    }
                }

                var f =
                    Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[
                        rtuId]
                ;
                // if (f.RtuModel != 1050) return;

                if (f.RtuMapX.Equals(0))
                {
                    f.RtuMapX = Gmap.Position.Lng + (DateTime.Now.Ticks % 100) * 0.01;
                }
                if (f.RtuMapY.Equals(0))
                {
                    f.RtuMapY = Gmap.Position.Lat + (DateTime.Now.Ticks % 100) * 0.01;
                }

                GMapMarker it = new GMapMarker(new PointLatLng(f.RtuMapX > f.RtuMapY ? f.RtuMapY : f.RtuMapX, f.RtuMapX > f.RtuMapY ? f.RtuMapX : f.RtuMapY));

                //   GMapMarker it = new GMapMarker(new PointLatLng(f.Ymap, f.Xmap));

                var tmp = new CustomMarkerDemo(Gmap, it, f.RtuId)
                {
                    //EquipmentImageState = 2,
                    Visi          = Visibility.Visible,
                    EquipmentName = f.RtuName
                };
                it.ZIndex = 1000 + Gmap.Markers.Count + 1;
                it.Shape  = tmp;



                EquipmentList.Add(tmp);
                tmp.UpdateTmlStateInfomation();
                Gmap.Markers.Add(it);
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError(
                    "RadMapJpeg LoadAttachEquipmentInfo Error when conver to IIEquipmentInfo:" + ex);
            }
        }