| | |
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.DeviceService;
|
| | | import com.moral.service.MonitorPointService;
|
| | | import com.moral.util.LatLngTransformation;
|
| | | import com.moral.util.TkMybatisUtils;
|
| | |
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | |
| | | OrganizationMapper organizationMapper;
|
| | | @Resource
|
| | | DictionaryDataMapper dictionaryDataMapper;
|
| | | @Resource
|
| | | private MonitorPointService monitorPointService ;
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> getDeviceStatesByAccount(Map<String, Object> parameters) {
|
| | |
| | | public List<Device> query(Map<String, Object> params) {
|
| | | List<Integer> dv = deviceMapper.getHasWindDirAndWindSpeedDeviceVersion();
|
| | | Object orgIdObj = params.get("orgId");
|
| | | String regionCode = params.get("regionCode").toString();
|
| | | List<Device> deviceList = null;
|
| | | if (orgIdObj != null) {
|
| | | Integer orgId = Integer.parseInt(orgIdObj.toString());
|
| | | List<Integer> orgIds = orgMapper.selectLowerOrgIds(orgId);
|
| | | params.put("orgIds", orgIds);
|
| | | System.out.println(params);
|
| | | deviceList = deviceMapper.selectByMap(params);
|
| | | //剔除沧州地图页面非公司设备图标
|
| | | if (regionCode.startsWith("1309")) {
|
| | | orgIds = new ArrayList<>();
|
| | | Collections.addAll(orgIds, 60, 65, 159, 165, 166);
|
| | | deviceList = deviceMapper.selectByMap(params);
|
| | | Iterator<Device> iter = deviceList.iterator();
|
| | | while (iter.hasNext()) {
|
| | | Device device = iter.next();
|
| | | Integer mpId = device.getMonitorPointId();
|
| | | Integer oid = monitorPointService.byIdGetMonitorPoint(mpId).getOrganizationId();
|
| | | if (!orgIds.contains(oid)) {
|
| | | iter.remove();
|
| | | } else {
|
| | | if (orgId == 60) {
|
| | | if (mpId != 56) {
|
| | | iter.remove();
|
| | | }
|
| | | } else if (orgId == 65) {
|
| | | if (mpId != 83 && mpId != 84) {
|
| | | iter.remove();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }else {
|
| | | params.put("orgIds", orgIds);
|
| | | deviceList = deviceMapper.selectByMap(params);
|
| | | }
|
| | | // loadDeviceState(deviceList);
|
| | | }
|
| | | Example deviceExample = new Example(Device.class);//实例化
|
| | |
| | | params.put("orgIds", orgIds);
|
| | | deviceList = deviceMapper.selectDevicesAll(params);
|
| | | }
|
| | | List<Device> deviceListHasWind=new ArrayList<>();
|
| | | List<Device> deviceListHasWind = new ArrayList<>();
|
| | | for (Device d : deviceList) {
|
| | | if (dv.contains(d.getDeviceVersionId())) {
|
| | | deviceListHasWind.add(d);
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List byMonitorIdGetDeviceAndWind(String id,String tab) {
|
| | | List<DeviceAndWind> deviceAndWinds=deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id),tab);
|
| | | List loList=new ArrayList();
|
| | | List laList=new ArrayList();
|
| | | Double U=0.0;
|
| | | Double V=0.0;
|
| | | List list=new ArrayList();
|
| | | public List byMonitorIdGetDeviceAndWind(String id, String tab) {
|
| | | List<DeviceAndWind> deviceAndWinds = deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id), tab);
|
| | | List loList = new ArrayList();
|
| | | List laList = new ArrayList();
|
| | | Double U = 0.0;
|
| | | Double V = 0.0;
|
| | | List list = new ArrayList();
|
| | | for (DeviceAndWind andWind : deviceAndWinds) {
|
| | | Double lo=andWind.getLongitude();
|
| | | Double la=andWind.getLatitude();
|
| | | List tranlist= LatLngTransformation.Convert_BD09_To_GCJ02(la,lo);
|
| | | Double transLo=(Double) tranlist.get(0);
|
| | | Double transLa=(Double) tranlist.get(1);
|
| | | Double lo = andWind.getLongitude();
|
| | | Double la = andWind.getLatitude();
|
| | | List tranlist = LatLngTransformation.Convert_BD09_To_GCJ02(la, lo);
|
| | | Double transLo = (Double) tranlist.get(0);
|
| | | Double transLa = (Double) tranlist.get(1);
|
| | | loList.add(transLo);
|
| | | laList.add(transLa);
|
| | | }
|
| | | Double loma= 0.0;
|
| | | Double lomi= 0.0;
|
| | | Double lama= 0.0;
|
| | | Double lami= 0.0;
|
| | | if (loList.size()>0){
|
| | | loma= (Double) Collections.max(loList);
|
| | | lomi= (Double) Collections.min(loList);
|
| | | Double loma = 0.0;
|
| | | Double lomi = 0.0;
|
| | | Double lama = 0.0;
|
| | | Double lami = 0.0;
|
| | | if (loList.size() > 0) {
|
| | | loma = (Double) Collections.max(loList);
|
| | | lomi = (Double) Collections.min(loList);
|
| | | }
|
| | | if (laList.size()>0){
|
| | | lama= (Double) Collections.max(laList);
|
| | | lami= (Double) Collections.min(laList);
|
| | | if (laList.size() > 0) {
|
| | | lama = (Double) Collections.max(laList);
|
| | | lami = (Double) Collections.min(laList);
|
| | | }
|
| | | Map laLaMap=new HashMap();
|
| | | laLaMap.put("maxLo",loma);
|
| | | laLaMap.put("minLo",lomi);
|
| | | laLaMap.put("maxLa",lama);
|
| | | laLaMap.put("minLa",lami);
|
| | | Map laLaMap = new HashMap();
|
| | | laLaMap.put("maxLo", loma);
|
| | | laLaMap.put("minLo", lomi);
|
| | | laLaMap.put("maxLa", lama);
|
| | | laLaMap.put("minLa", lami);
|
| | |
|
| | | Double lo1=lomi-250*0.00001141;
|
| | | Double lo2=loma+250*0.00001141;
|
| | | Double la2=lami-250*0.00000899;
|
| | | Double la1=lama+250*0.00000899;
|
| | | Double lo1 = lomi - 250 * 0.00001141;
|
| | | Double lo2 = loma + 250 * 0.00001141;
|
| | | Double la2 = lami - 250 * 0.00000899;
|
| | | Double la1 = lama + 250 * 0.00000899;
|
| | |
|
| | | Double dx=0.00001141*20;
|
| | | Double dy=0.00000899*20;
|
| | | int nx=(int) Math.floor((lo2-lo1)/dx);
|
| | | int ny=(int) Math.floor((la1-la2)/dy);
|
| | | Double dx = 0.00001141 * 20;
|
| | | Double dy = 0.00000899 * 20;
|
| | | int nx = (int) Math.floor((lo2 - lo1) / dx);
|
| | | int ny = (int) Math.floor((la1 - la2) / dy);
|
| | | String header1 = "\"" + "header" + "\"" + ": " + "{" + "\"" + "parameterUnit" + "\"" + ": " + "\"" + "m/s" + "\"" + ", " + "\"" + "parameterNumber" + "\"" + ": " + 2 +
|
| | | ", " + "\"" + "dx" + "\"" + ": " + dx + ", " + "\"" + "dy" + "\"" + ": " + dy +
|
| | | ", " + "\"" + "parameterNumberName" + "\"" + ": " + "\"" + "eastward_wind" + "\"" + ", " + "\"" + "la1" + "\"" + ": " + la1 + ", " + "\"" + "la2" + "\"" + ": " + la2 +
|
| | |
| | | ", " + "\"" + "parameterCategory" + "\"" + ": " + 2 + ", " + "\"" + "lo1" + "\"" + ": " + lo1 + ", " + "\"" + "lo2" + "\"" + ": " + lo2 +
|
| | | ", " + "\"" + "nx" + "\"" + ": " + nx + ", " + "\"" + "ny" + "\"" + ": " + ny + ", " + "\"" + "refTime" + "\"" + ": " + "\"" + "2020-07-22 23:00:00" + "\"" + "}";
|
| | |
|
| | | List<Double> uList=new ArrayList<Double> ();
|
| | | List<Double> vList=new ArrayList<Double> ();
|
| | | int x=0;
|
| | | int y=0;
|
| | | List<Map> mapList=new ArrayList<Map>();
|
| | | List<Double> uList = new ArrayList<Double>();
|
| | | List<Double> vList = new ArrayList<Double>();
|
| | | int x = 0;
|
| | | int y = 0;
|
| | | List<Map> mapList = new ArrayList<Map>();
|
| | |
|
| | | for (int j = 0; j <deviceAndWinds.size() ; j++) {
|
| | | Map<String,Double> map=new HashMap<String,Double> ();
|
| | | Double windDir= deviceAndWinds.get(j).getWindDir();
|
| | | for (int j = 0; j < deviceAndWinds.size(); j++) {
|
| | | Map<String, Double> map = new HashMap<String, Double>();
|
| | | Double windDir = deviceAndWinds.get(j).getWindDir();
|
| | |
|
| | | Double windSpeed=deviceAndWinds.get(j).getWindSpeed();
|
| | | if (windDir==null){
|
| | | windDir=0.0;
|
| | | windSpeed=0.0;
|
| | | Double windSpeed = deviceAndWinds.get(j).getWindSpeed();
|
| | | if (windDir == null) {
|
| | | windDir = 0.0;
|
| | | windSpeed = 0.0;
|
| | | }
|
| | | Double tvoc=deviceAndWinds.get(j).getTVoc();
|
| | | Double tvoc = deviceAndWinds.get(j).getTVoc();
|
| | |
|
| | | List tranlist= LatLngTransformation.Convert_BD09_To_GCJ02(deviceAndWinds.get(j).getLatitude(),deviceAndWinds.get(j).getLongitude());
|
| | | Double transLo=(Double) tranlist.get(0);
|
| | | Double transLa=(Double) tranlist.get(1);
|
| | | if (tvoc==null){
|
| | | tvoc=0.0;
|
| | | List tranlist = LatLngTransformation.Convert_BD09_To_GCJ02(deviceAndWinds.get(j).getLatitude(), deviceAndWinds.get(j).getLongitude());
|
| | | Double transLo = (Double) tranlist.get(0);
|
| | | Double transLa = (Double) tranlist.get(1);
|
| | | if (tvoc == null) {
|
| | | tvoc = 0.0;
|
| | | }
|
| | | Double dir = (270.0 - windDir * Math.PI / 180.0);
|
| | |
|
| | | U = windSpeed * Math.cos(dir);
|
| | | V = windSpeed * Math.sin(dir);
|
| | | map.put("lo",transLo);
|
| | | map.put("la",transLa);
|
| | | map.put("U",U);
|
| | | map.put("V",V);
|
| | | map.put("lo", transLo);
|
| | | map.put("la", transLa);
|
| | | map.put("U", U);
|
| | | map.put("V", V);
|
| | | mapList.add(map);
|
| | | }
|
| | | for (int i = 0; i <mapList.size() ; i++) {
|
| | | Double lo= (Double) mapList.get(i).get("lo");
|
| | | Double la= (Double) mapList.get(i).get("la");
|
| | | x= (int) Math.floor((lo-lo1)/dx);
|
| | | y=Math.abs((int)Math.floor((la-la1)/dy));
|
| | | for (int i = 0; i < mapList.size(); i++) {
|
| | | Double lo = (Double) mapList.get(i).get("lo");
|
| | | Double la = (Double) mapList.get(i).get("la");
|
| | | x = (int) Math.floor((lo - lo1) / dx);
|
| | | y = Math.abs((int) Math.floor((la - la1) / dy));
|
| | | //y=Math.floor(Math.abs(la-la1)/dy);
|
| | | U=(Double) mapList.get(i).get("U");
|
| | | V=(Double) mapList.get(i).get("V");
|
| | | if (i==0){
|
| | | for (int j = 0; j <nx*ny ; j++) {
|
| | | U = (Double) mapList.get(i).get("U");
|
| | | V = (Double) mapList.get(i).get("V");
|
| | | if (i == 0) {
|
| | | for (int j = 0; j < nx * ny; j++) {
|
| | | uList.add(0.0);
|
| | | vList.add(0.0);
|
| | | }
|
| | | }
|
| | | for (int j = 0; j <nx*ny ; j++) {
|
| | | if (i==0){
|
| | | if ((y>=2 && j==(y)*nx+x)){
|
| | | for (int j = 0; j < nx * ny; j++) {
|
| | | if (i == 0) {
|
| | | if ((y >= 2 && j == (y) * nx + x)) {
|
| | | int k;
|
| | | for (k = j-2*nx; k <=j+2*nx ;k=k+nx) {
|
| | | uList.set(k,U);
|
| | | uList.set(k-1,U);
|
| | | uList.set(k-2,U);
|
| | | uList.set(k+1,U);
|
| | | uList.set(k+2,U);
|
| | | vList.set(k,V);
|
| | | vList.set(k-1,V);
|
| | | vList.set(k-2,V);
|
| | | vList.set(k+1,V);
|
| | | vList.set(k+2,V);
|
| | | for (k = j - 2 * nx; k <= j + 2 * nx; k = k + nx) {
|
| | | uList.set(k, U);
|
| | | uList.set(k - 1, U);
|
| | | uList.set(k - 2, U);
|
| | | uList.set(k + 1, U);
|
| | | uList.set(k + 2, U);
|
| | | vList.set(k, V);
|
| | | vList.set(k - 1, V);
|
| | | vList.set(k - 2, V);
|
| | | vList.set(k + 1, V);
|
| | | vList.set(k + 2, V);
|
| | | }
|
| | | }
|
| | | }else {
|
| | | if (y>=1 && j==y*nx+x){
|
| | | } else {
|
| | | if (y >= 1 && j == y * nx + x) {
|
| | | int k;
|
| | | for (k = j-2*nx; k <=j+2*nx ;) {
|
| | | uList.set(k-1,U);
|
| | | uList.set(k-2,U);
|
| | | uList.set(k+1,U);
|
| | | uList.set(k+2,U);
|
| | | vList.set(k-1,V);
|
| | | vList.set(k-2,V);
|
| | | vList.set(k+1,V);
|
| | | vList.set(k+2,V);
|
| | | k=k+nx;
|
| | | for (k = j - 2 * nx; k <= j + 2 * nx; ) {
|
| | | uList.set(k - 1, U);
|
| | | uList.set(k - 2, U);
|
| | | uList.set(k + 1, U);
|
| | | uList.set(k + 2, U);
|
| | | vList.set(k - 1, V);
|
| | | vList.set(k - 2, V);
|
| | | vList.set(k + 1, V);
|
| | | vList.set(k + 2, V);
|
| | | k = k + nx;
|
| | | }
|
| | | uList.set(j,U);
|
| | | vList.set(j,V);
|
| | | uList.set(j, U);
|
| | | vList.set(j, V);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | String vData = "\"" + "data" + "\"" + ": " + vList;
|
| | | String s1 = "[" + "{" + header1 + ", " + uData + "}" + ", " + "{" + header2 + ", " + vData + "}" + "]";
|
| | | JSONArray jsonArray = JSONArray.parseArray(s1);
|
| | | MonitorPoint monitorPoint=monitorPointMapper.byIdGetMonitorPoint(Integer.parseInt(id));
|
| | | Double monitorLo=monitorPoint.getLongitude();
|
| | | Double monitorLa=monitorPoint.getLatitude();
|
| | | List transList= LatLngTransformation.Convert_BD09_To_GCJ02(monitorLa,monitorLo);
|
| | | Double transLo=(Double) transList.get(0);
|
| | | Double transLa=(Double) transList.get(1);
|
| | | MonitorPoint monitorPoint = monitorPointMapper.byIdGetMonitorPoint(Integer.parseInt(id));
|
| | | Double monitorLo = monitorPoint.getLongitude();
|
| | | Double monitorLa = monitorPoint.getLatitude();
|
| | | List transList = LatLngTransformation.Convert_BD09_To_GCJ02(monitorLa, monitorLo);
|
| | | Double transLo = (Double) transList.get(0);
|
| | | Double transLa = (Double) transList.get(1);
|
| | | list.add(jsonArray);
|
| | | list.add(transLo);
|
| | | list.add(transLa);
|
| | |
| | |
|
| | | @Override
|
| | | public List byMonitorIdGetDeviceAndWindSpecial(String id, String tab) {
|
| | | MonitorPoint monitorPoint=monitorPointMapper.byIdGetMonitorPoint(Integer.parseInt(id));
|
| | | Integer areaCode=monitorPoint.getAreaCode();
|
| | | String townCode= monitorPoint.getTownCode()+"";
|
| | | int monitorPointId=monitorPoint.getId();
|
| | | Map<String, Object> parm=new HashMap<>();
|
| | | List<DeviceAndWind> deviceAndWinds=new ArrayList<>();
|
| | | Double loma= 0.0;
|
| | | Double lomi= 0.0;
|
| | | Double lama= 0.0;
|
| | | Double lami= 0.0;
|
| | | MonitorPoint monitorPoint = monitorPointMapper.byIdGetMonitorPoint(Integer.parseInt(id));
|
| | | Integer areaCode = monitorPoint.getAreaCode();
|
| | | String townCode = monitorPoint.getTownCode() + "";
|
| | | int monitorPointId = monitorPoint.getId();
|
| | | Map<String, Object> parm = new HashMap<>();
|
| | | List<DeviceAndWind> deviceAndWinds = new ArrayList<>();
|
| | | Double loma = 0.0;
|
| | | Double lomi = 0.0;
|
| | | Double lama = 0.0;
|
| | | Double lami = 0.0;
|
| | |
|
| | | int length=1;
|
| | | int perdlen=1;
|
| | | if (areaCode==320581){
|
| | | parm.put("areaCode",areaCode);
|
| | | List<Device> deviceList=deviceMapper.getDeviceByCode(parm);
|
| | | int length = 1;
|
| | | int perdlen = 1;
|
| | | if (areaCode == 320581) {
|
| | | parm.put("areaCode", areaCode);
|
| | | List<Device> deviceList = deviceMapper.getDeviceByCode(parm);
|
| | | for (Device d : deviceList) {
|
| | | String mac=d.getMac();
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac,tab);
|
| | | if (deviceAndWind!=null){
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | }
|
| | | }
|
| | | length=8000;
|
| | | perdlen=2200;
|
| | | }else if ((areaCode == 320583) && (townCode.equals("320583108000"))){
|
| | | parm.put("townCode",townCode);
|
| | | List<Device> deviceList=deviceMapper.getDeviceByCode(parm);
|
| | | for (Device d : deviceList) {
|
| | | String mac=d.getMac();
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac,tab);
|
| | | if (deviceAndWind!=null){
|
| | | String mac = d.getMac();
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac, tab);
|
| | | if (deviceAndWind != null) {
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | }
|
| | | }
|
| | | length=2000;
|
| | | perdlen=280;
|
| | | }else if(monitorPointId==35){
|
| | | DeviceAndWind deviceAndWind=deviceMapper.getDeviceAndWindByMac("898607b0101730392253",tab);
|
| | | DeviceAndWind deviceAndWind1=deviceMapper.getDeviceAndWindByMac("p5dnd7a0392083",tab);
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | deviceAndWinds.add(deviceAndWind1);
|
| | | length=2000;
|
| | | perdlen=50;
|
| | | length = 8000;
|
| | | perdlen = 2200;
|
| | | } else if ((areaCode == 320583) && (townCode.equals("320583108000"))) {
|
| | | parm.put("townCode", townCode);
|
| | | List<Device> deviceList = deviceMapper.getDeviceByCode(parm);
|
| | | for (Device d : deviceList) {
|
| | | String mac = d.getMac();
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac, tab);
|
| | | if (deviceAndWind != null) {
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | }
|
| | | }
|
| | | length = 2000;
|
| | | perdlen = 280;
|
| | | } else if (monitorPointId == 35) {
|
| | | DeviceAndWind deviceAndWind = deviceMapper.getDeviceAndWindByMac("898607b0101730392253", tab);
|
| | | DeviceAndWind deviceAndWind1 = deviceMapper.getDeviceAndWindByMac("p5dnd7a0392083", tab);
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | deviceAndWinds.add(deviceAndWind1);
|
| | | length = 2000;
|
| | | perdlen = 50;
|
| | |
|
| | | }else {
|
| | | deviceAndWinds=deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id),tab);
|
| | | length=2000;
|
| | | perdlen=80;
|
| | | } else {
|
| | | deviceAndWinds = deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id), tab);
|
| | | length = 2000;
|
| | | perdlen = 80;
|
| | | }
|
| | | List loList=new ArrayList();
|
| | | List laList=new ArrayList();
|
| | | Double U=0.0;
|
| | | Double V=0.0;
|
| | | List list=new ArrayList();
|
| | | List loList = new ArrayList();
|
| | | List laList = new ArrayList();
|
| | | Double U = 0.0;
|
| | | Double V = 0.0;
|
| | | List list = new ArrayList();
|
| | | for (DeviceAndWind andWind : deviceAndWinds) {
|
| | | Double lo=andWind.getLongitude();
|
| | | Double la=andWind.getLatitude();
|
| | | List tranlist= LatLngTransformation.Convert_BD09_To_GCJ02(la,lo);
|
| | | Double transLo=(Double) tranlist.get(0);
|
| | | Double transLa=(Double) tranlist.get(1);
|
| | | loList.add(transLo);
|
| | | laList.add(transLa);
|
| | | Double lo = andWind.getLongitude();
|
| | | Double la = andWind.getLatitude();
|
| | | List tranlist = LatLngTransformation.Convert_BD09_To_GCJ02(la, lo);
|
| | | Double transLo = (Double) tranlist.get(0);
|
| | | Double transLa = (Double) tranlist.get(1);
|
| | | loList.add(transLo);
|
| | | laList.add(transLa);
|
| | | }
|
| | |
|
| | | if (loList.size()>0){
|
| | | loma= (Double) Collections.max(loList);
|
| | | lomi= (Double) Collections.min(loList);
|
| | | if (loList.size() > 0) {
|
| | | loma = (Double) Collections.max(loList);
|
| | | lomi = (Double) Collections.min(loList);
|
| | | }
|
| | | if (laList.size()>0){
|
| | | lama= (Double) Collections.max(laList);
|
| | | lami= (Double) Collections.min(laList);
|
| | | if (laList.size() > 0) {
|
| | | lama = (Double) Collections.max(laList);
|
| | | lami = (Double) Collections.min(laList);
|
| | | }
|
| | | Map laLaMap=new HashMap();
|
| | | laLaMap.put("maxLo",loma);
|
| | | laLaMap.put("minLo",lomi);
|
| | | laLaMap.put("maxLa",lama);
|
| | | laLaMap.put("minLa",lami);
|
| | | Map laLaMap = new HashMap();
|
| | | laLaMap.put("maxLo", loma);
|
| | | laLaMap.put("minLo", lomi);
|
| | | laLaMap.put("maxLa", lama);
|
| | | laLaMap.put("minLa", lami);
|
| | |
|
| | | Double lo1=lomi-length*0.00001141;
|
| | | Double lo2=loma+length*0.00001141;
|
| | | Double la2=lami-length*0.00000899;
|
| | | Double la1=lama+length*0.00000899;
|
| | | Double lo1 = lomi - length * 0.00001141;
|
| | | Double lo2 = loma + length * 0.00001141;
|
| | | Double la2 = lami - length * 0.00000899;
|
| | | Double la1 = lama + length * 0.00000899;
|
| | |
|
| | | Double dx=0.00001141*perdlen;
|
| | | Double dy=0.00000899*perdlen;
|
| | | int nx=(int) Math.floor((lo2-lo1)/dx);
|
| | | int ny=(int) Math.floor((la1-la2)/dy);
|
| | | Double dx = 0.00001141 * perdlen;
|
| | | Double dy = 0.00000899 * perdlen;
|
| | | int nx = (int) Math.floor((lo2 - lo1) / dx);
|
| | | int ny = (int) Math.floor((la1 - la2) / dy);
|
| | | String header1 = "\"" + "header" + "\"" + ": " + "{" + "\"" + "parameterUnit" + "\"" + ": " + "\"" + "m/s" + "\"" + ", " + "\"" + "parameterNumber" + "\"" + ": " + 2 +
|
| | | ", " + "\"" + "dx" + "\"" + ": " + dx + ", " + "\"" + "dy" + "\"" + ": " + dy +
|
| | | ", " + "\"" + "parameterNumberName" + "\"" + ": " + "\"" + "eastward_wind" + "\"" + ", " + "\"" + "la1" + "\"" + ": " + la1 + ", " + "\"" + "la2" + "\"" + ": " + la2 +
|
| | |
| | | String header2 = "\"" + "header" + "\"" + ": " + "{" + "\"" + "parameterUnit" + "\"" + ": " + "\"" + "m/s" + "\"" + ", " + "\"" + "parameterNumber" + "\"" + ": " + 3 +
|
| | | ", " + "\"" + "dx" + "\"" + ": " + dx + ", " + "\"" + "dy" + "\"" + ": " + dy +
|
| | | ", " + "\"" + "parameterNumberName" + "\"" + ": " + "\"" + "eastward_wind" + "\"" + ", " + "\"" + "la1" + "\"" + ": " + la1 + ", " + "\"" + "la2" + "\"" + ": " + la2 +
|
| | | ", " + "\"" + "parameterCategory" + "\"" + ": " + 2 + ", " + "\"" + "lo1" + "\"" + ": " + lo1 + ", " + "\"" + "lo2" + "\"" + ": " + lo2 +
|
| | | ", " + "\"" + "parameterCategory" + "\"" + ": " + 2 + ", " + "\"" + "lo1" + "\"" + ": " + lo1 + ", " + "\"" + "lo2" + "\"" + ": " + lo2 +
|
| | | ", " + "\"" + "nx" + "\"" + ": " + nx + ", " + "\"" + "ny" + "\"" + ": " + ny + ", " + "\"" + "refTime" + "\"" + ": " + "\"" + "2020-07-22 23:00:00" + "\"" + "}";
|
| | |
|
| | | List<Double> uList=new ArrayList<Double> ();
|
| | | List<Double> vList=new ArrayList<Double> ();
|
| | | int x=0;
|
| | | int y=0;
|
| | | List<Map> mapList=new ArrayList<Map>();
|
| | | List<Double> uList = new ArrayList<Double>();
|
| | | List<Double> vList = new ArrayList<Double>();
|
| | | int x = 0;
|
| | | int y = 0;
|
| | | List<Map> mapList = new ArrayList<Map>();
|
| | |
|
| | | for (int j = 0; j <deviceAndWinds.size() ; j++) {
|
| | | Map<String,Double> map=new HashMap<String,Double> ();
|
| | | Double windDir= deviceAndWinds.get(j).getWindDir();
|
| | | Double windSpeed=deviceAndWinds.get(j).getWindSpeed();
|
| | | if (windDir==null){
|
| | | windDir=0.0;
|
| | | windSpeed=0.0;
|
| | | }
|
| | | Double tvoc=deviceAndWinds.get(j).getTVoc();
|
| | | for (int j = 0; j < deviceAndWinds.size(); j++) {
|
| | | Map<String, Double> map = new HashMap<String, Double>();
|
| | | Double windDir = deviceAndWinds.get(j).getWindDir();
|
| | | Double windSpeed = deviceAndWinds.get(j).getWindSpeed();
|
| | | if (windDir == null) {
|
| | | windDir = 0.0;
|
| | | windSpeed = 0.0;
|
| | | }
|
| | | Double tvoc = deviceAndWinds.get(j).getTVoc();
|
| | |
|
| | | List tranlist= LatLngTransformation.Convert_BD09_To_GCJ02(deviceAndWinds.get(j).getLatitude(),deviceAndWinds.get(j).getLongitude());
|
| | | Double transLo=(Double) tranlist.get(0);
|
| | | Double transLa=(Double) tranlist.get(1);
|
| | | if (tvoc==null){
|
| | | tvoc=0.0;
|
| | | }
|
| | | Double dir = (270.0 - windDir * Math.PI / 180.0);
|
| | | List tranlist = LatLngTransformation.Convert_BD09_To_GCJ02(deviceAndWinds.get(j).getLatitude(), deviceAndWinds.get(j).getLongitude());
|
| | | Double transLo = (Double) tranlist.get(0);
|
| | | Double transLa = (Double) tranlist.get(1);
|
| | | if (tvoc == null) {
|
| | | tvoc = 0.0;
|
| | | }
|
| | | Double dir = (270.0 - windDir * Math.PI / 180.0);
|
| | |
|
| | | U = windSpeed * Math.cos(dir);
|
| | | V = windSpeed * Math.sin(dir);
|
| | | map.put("lo",transLo);
|
| | | map.put("la",transLa);
|
| | | map.put("U",U);
|
| | | map.put("V",V);
|
| | | mapList.add(map);
|
| | | U = windSpeed * Math.cos(dir);
|
| | | V = windSpeed * Math.sin(dir);
|
| | | map.put("lo", transLo);
|
| | | map.put("la", transLa);
|
| | | map.put("U", U);
|
| | | map.put("V", V);
|
| | | mapList.add(map);
|
| | | }
|
| | | for (int i = 0; i <mapList.size() ; i++) {
|
| | | Double lo= (Double) mapList.get(i).get("lo");
|
| | | Double la= (Double) mapList.get(i).get("la");
|
| | | x= (int) Math.floor((lo-lo1)/dx);
|
| | | y=Math.abs((int)Math.floor((la-la1)/dy));
|
| | | for (int i = 0; i < mapList.size(); i++) {
|
| | | Double lo = (Double) mapList.get(i).get("lo");
|
| | | Double la = (Double) mapList.get(i).get("la");
|
| | | x = (int) Math.floor((lo - lo1) / dx);
|
| | | y = Math.abs((int) Math.floor((la - la1) / dy));
|
| | | //y=Math.floor(Math.abs(la-la1)/dy);
|
| | | U=(Double) mapList.get(i).get("U");
|
| | | V=(Double) mapList.get(i).get("V");
|
| | | if (i==0){
|
| | | for (int j = 0; j <nx*ny ; j++) {
|
| | | U = (Double) mapList.get(i).get("U");
|
| | | V = (Double) mapList.get(i).get("V");
|
| | | if (i == 0) {
|
| | | for (int j = 0; j < nx * ny; j++) {
|
| | | uList.add(0.0);
|
| | | vList.add(0.0);
|
| | | }
|
| | | }
|
| | | for (int j = 0; j <nx*ny ; j++) {
|
| | | if (i==0){
|
| | | if ((y>=2 && j==(y)*nx+x)){
|
| | | for (int j = 0; j < nx * ny; j++) {
|
| | | if (i == 0) {
|
| | | if ((y >= 2 && j == (y) * nx + x)) {
|
| | | int k;
|
| | | for (k = j-2*nx; k <=j+2*nx ;k=k+nx) {
|
| | | uList.set(k,U);
|
| | | uList.set(k-1,U);
|
| | | uList.set(k-2,U);
|
| | | uList.set(k+1,U);
|
| | | uList.set(k+2,U);
|
| | | vList.set(k,V);
|
| | | vList.set(k-1,V);
|
| | | vList.set(k-2,V);
|
| | | vList.set(k+1,V);
|
| | | vList.set(k+2,V);
|
| | | for (k = j - 2 * nx; k <= j + 2 * nx; k = k + nx) {
|
| | | uList.set(k, U);
|
| | | uList.set(k - 1, U);
|
| | | uList.set(k - 2, U);
|
| | | uList.set(k + 1, U);
|
| | | uList.set(k + 2, U);
|
| | | vList.set(k, V);
|
| | | vList.set(k - 1, V);
|
| | | vList.set(k - 2, V);
|
| | | vList.set(k + 1, V);
|
| | | vList.set(k + 2, V);
|
| | | }
|
| | | }
|
| | | }else {
|
| | | if (y>=1 && j==y*nx+x){
|
| | | } else {
|
| | | if (y >= 1 && j == y * nx + x) {
|
| | | int k;
|
| | | for (k = j-2*nx; k <=j+2*nx ;) {
|
| | | uList.set(k-1,U);
|
| | | uList.set(k-2,U);
|
| | | uList.set(k+1,U);
|
| | | uList.set(k+2,U);
|
| | | vList.set(k-1,V);
|
| | | vList.set(k-2,V);
|
| | | vList.set(k+1,V);
|
| | | vList.set(k+2,V);
|
| | | k=k+nx;
|
| | | for (k = j - 2 * nx; k <= j + 2 * nx; ) {
|
| | | uList.set(k - 1, U);
|
| | | uList.set(k - 2, U);
|
| | | uList.set(k + 1, U);
|
| | | uList.set(k + 2, U);
|
| | | vList.set(k - 1, V);
|
| | | vList.set(k - 2, V);
|
| | | vList.set(k + 1, V);
|
| | | vList.set(k + 2, V);
|
| | | k = k + nx;
|
| | | }
|
| | | uList.set(j,U);
|
| | | vList.set(j,V);
|
| | | uList.set(j, U);
|
| | | vList.set(j, V);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | String s1 = "[" + "{" + header1 + ", " + uData + "}" + ", " + "{" + header2 + ", " + vData + "}" + "]";
|
| | | JSONArray jsonArray = JSONArray.parseArray(s1);
|
| | |
|
| | | Double monitorLo=monitorPoint.getLongitude();
|
| | | Double monitorLa=monitorPoint.getLatitude();
|
| | | List transList= LatLngTransformation.Convert_BD09_To_GCJ02(monitorLa,monitorLo);
|
| | | Double transLo=(Double) transList.get(0);
|
| | | Double transLa=(Double) transList.get(1);
|
| | | Double monitorLo = monitorPoint.getLongitude();
|
| | | Double monitorLa = monitorPoint.getLatitude();
|
| | | List transList = LatLngTransformation.Convert_BD09_To_GCJ02(monitorLa, monitorLo);
|
| | | Double transLo = (Double) transList.get(0);
|
| | | Double transLa = (Double) transList.get(1);
|
| | |
|
| | | list.add(jsonArray);
|
| | | list.add(transLo);
|
| | |
| | |
|
| | | @Override
|
| | | public List<Device> getDeviceByCodeAndId(String code, String id) {
|
| | | return deviceMapper.getDeviceByCodeAndId(code,id);
|
| | | return deviceMapper.getDeviceByCodeAndId(code, id);
|
| | | }
|
| | |
|
| | | @Override
|