Exemplo n.º 1
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();
        }
Exemplo n.º 2
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);
            }
        }