Exemple #1
0
        public void EncodeTest()
        {
            PES.MapService.MapSearchService.IMapService target = new PES.MapService.MapSearchService.MapService(); // TODO: 初始化为适当的值
            string latitude = "22.59300"; // TODO: 初始化为适当的值
            string longitude = "113.87087"; // TODO: 初始化为适当的值
            string expected = string.Empty; // TODO: 初始化为适当的值
            string actual;
            actual = target.Encode(latitude, longitude);
            PES.MapService.Entity.LatLon latlon = target.Decode(actual);
            if (latlon == null)
            {
                Assert.Fail("latalon为null");
            }
            else
            {
                if (latlon.Latitude != Convert.ToDecimal(latitude))
                {
                    Assert.Fail("latlon.Latitude error,result is {0}",latlon.Latitude);
                }
                if (latlon.Longitude != Convert.ToDecimal(longitude))
                {
                    Assert.Fail("latlon.Longitude error,result is {0}", latlon.Longitude);
                }

            }
           // Assert.AreNotEqual(expected, actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
        public IList<VVehicleSearchResult> VehicleSearch(string maxEncodeLatLon, string minEncodeLatLon, string tenantCode, string userCode,
            string permissionCode,int rowIndex,int pageSize,ref int rowCount)
        {
            PES.MapService.MapSearchService.MapService mapService = new PES.MapService.MapSearchService.MapService();

            LatLon maxLatLon = mapService.Decode(maxEncodeLatLon);
            LatLon minLatLon = mapService.Decode(minEncodeLatLon);

            IVehicleManager vm = new VehicleManager();

            IList<EBaseVehicle> ltVehicle = vm.Get(tenantCode, userCode, permissionCode);

            Rectangle rec = new Rectangle(maxLatLon.Latitude, maxLatLon.Longitude, minLatLon.Latitude, minLatLon.Longitude);

            IGPSTrackManager trackManager = new GPSTrackManager();

            IList<EGPSCurrentInfo> ltCurrentInfo = trackManager.SearchVehicleInRectange(rec, ltVehicle.Select(s => s.Code).ToArray(), rowIndex, pageSize,ref rowCount);

            Dictionary<Guid, string> dcVehicle = ltVehicle.ToDictionary(new Func<EBaseVehicle, Guid>(c => c.Code),
                    new Func<EBaseVehicle, string>(c => c.LicenceNumber));

            IList<VVehicleSearchResult> ltResult = new List<VVehicleSearchResult>();

            if (ltCurrentInfo == null)
                return ltResult;
            foreach (EGPSCurrentInfo currentInfo in ltCurrentInfo)
            {
                string licenceNumber = dcVehicle[currentInfo.VehicleCode.Value];

                VVehicleSearchResult result = new VVehicleSearchResult(currentInfo.VehicleCode.Value, licenceNumber, currentInfo.GPSCode, currentInfo.ReportTime.ToString(),currentInfo.Latitude,currentInfo.Longitude);

                ltResult.Add(result);
            }
            SetEncodeLatLon(mapService, ltResult);

            return ltResult;
        }
        public IList<Guid> VehicleSearch(string maxEncodeLatLon,string minEncodeLatLon,string tenantCode)
        {
            PES.MapService.MapSearchService.MapService mapService = new PES.MapService.MapSearchService.MapService();

            LatLon maxLatLon = mapService.Decode(maxEncodeLatLon);
            LatLon minLatLon = mapService.Decode(minEncodeLatLon);

            IGPSInstallationManager installManager = new GPSInstallationManager();
            
            IList<string> ltGPSCode = installManager.GetGPSCode(tenantCode);

            IGPSTrackManager trackManager = new GPSTrackManager();

            Rectangle rec = new Rectangle(maxLatLon.Latitude, maxLatLon.Longitude, minLatLon.Latitude, minLatLon.Longitude);

            IList<EGPSCurrentInfo> ltCurrentInfo = trackManager.SearchVehicleInRectange(rec, ltGPSCode.ToArray<string>());


            if (ltCurrentInfo == null || ltCurrentInfo.Count == 0)
                return null;

            return ltCurrentInfo.Select(s => s.VehicleCode.Value).ToList();
        }
Exemple #4
0
        public void DecodeTest()
        {
            PES.MapService.MapSearchService.IMapService target = new PES.MapService.MapSearchService.MapService();

            string source = "ISGRCFVUADRDDG";
            LatLon latlons = new LatLon(22.593m,113.87087m);
            
            LatLon actual = target.Decode(source);
            if (latlons.Longitude != actual.Longitude || latlons.Latitude !=  latlons.Latitude)
            {
                Assert.Fail("Encode() failed, result:{0},{1}",actual.Latitude,actual.Longitude);
            }
        }