From 4c6d1a2aba15d57938f826a53d04caf0adc27bc3 Mon Sep 17 00:00:00 2001 From: PeterAlbus Date: Tue, 21 Mar 2023 19:42:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=86=B5=E5=80=BC=E6=B3=95c?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + sql/main.cpp | 117 ++++++++++++++++++ .../EarthquickApplicationTests.java | 54 +++++++- 3 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 sql/main.cpp diff --git a/.gitignore b/.gitignore index 9e97857..0d3416e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ build/ .vscode/ /src/main/resources/5963105_www.peteralbus.com.pfx /src/main/resources/application.yml +/src/main/resources/8128048_www.peteralbus.com.pfx diff --git a/sql/main.cpp b/sql/main.cpp new file mode 100644 index 0000000..66722e9 --- /dev/null +++ b/sql/main.cpp @@ -0,0 +1,117 @@ +#include +#include +#include +using namespace std; + +int main() +{ + clock_t start, finish; + double duration; + start = clock(); + double x[10][4]={{6.962645,67101,730.3979,1.3}, + {5.643831,50732,170.8517,1.7}, + {7.775079,39755,89.2054,1}, + {6.568763,67101,294.3379,1}, + {6.552100,67101,281.1741,1.9}, + {6.669364,43274,41.5144,1.2}, + {7.774892,39755,89.2054,1.4}, + {6.511145,67101,518.4596,1.4}, + {6.966898,67101,382.3772,1.7}, + {5.894564,35641,374.3219,1.2}}; + double max[4]; + double min[4]; + double sum[4]; + for(int i=0;i<4;i++) + { + max[i]=x[0][i]; + min[i]=x[0][i]; + sum[i]=x[0][i]; + for(int j=1;j<10;j++) + { + if(x[j][i]>max[i]) + { + max[i]=x[j][i]; + } + if(x[j][i] mapParameter = new HashMap(); +// mapParameter.put("earthquakeId",16); +// EarthquakeInfo earthquakeInfo=earthquakeInfoService.queryInfoWithLine(mapParameter).get(0); +// double magnitude = earthquakeInfo.getMagnitude(), +// highIntensity = earthquakeInfo.getHighIntensity(), +// longitude = earthquakeInfo.getLongitude(), +// latitude = earthquakeInfo.getLatitude(), +// longRadius = earthquakeInfo.getIntensityLineList().get(2).getLongRadius(), +// shortRadius = earthquakeInfo.getIntensityLineList().get(2).getShortRadius(); +// System.out.println(longRadius); +// LocalDateTime earthquakeTime = earthquakeInfo.getEarthquakeTime(); +// //将角度转换为弧度。 +// double radians = Math.toRadians(latitude); +// double minLongitude = longitude-shortRadius/(111-Math.cos(radians)), +// maxLongitude = longitude+shortRadius/(111-Math.cos(radians)), +// minLatitude = latitude-longRadius/111, +// maxLatitude = latitude+longRadius/111; +// int population=(int)estimateService.getPopulation(minLongitude,maxLongitude,minLatitude,maxLatitude); +// double death=estimateUtil.deathPredict(earthquakeInfo.getEarthquakeId(),population,magnitude,highIntensity,earthquakeTime,longitude,latitude); +// long endTime = System.currentTimeMillis(); +// long usedTime = (endTime-startTime)/1000; +// System.out.println(death + " " + usedTime); +// getPopulation(100.7342,25.5736); +// getPopulation(99.9586,25.6753); +// getPopulation(100.1926,25.9121); +// getPopulation(100.1885,25.9252); +// getPopulation(99.7768,25.3342); +// getPopulation(99.9586,25.6752); +// getPopulation(100.3105,25.6775); +// getPopulation(100.1209,25.7921); +// getPopulation(100.4937,25.3366); } + void getPopulation(double longitude,double latitude) + { + double minLongitude = longitude-0.1, + maxLongitude = longitude+0.1, + minLatitude = latitude-0.1, + maxLatitude = latitude+0.1; + System.out.println(estimateService.getPopulation(minLongitude, maxLongitude, minLatitude, maxLatitude)); + } }