This commit is contained in:
紫云徽 2024-10-17 11:28:52 +08:00
parent 4e7db1b6ba
commit 94a3dbaccb
30 changed files with 42 additions and 143 deletions

View File

@ -13,7 +13,7 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -31,6 +31,19 @@
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>

6
.gitignore vendored
View File

@ -1,9 +1,9 @@
dependency-reduced-pom.xml
target/
./target/
logs
*.log
.vscode/
.settings/
./.vscode/
./.settings/
.prettierrc

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding/<project>=UTF-8

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false

View File

@ -1,9 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,5 +0,0 @@
{
"java.format.onType.enabled": false,
"java.format.settings.url": "D:\\dformat.xml",
"maven.view": "flat"
}

View File

@ -8,7 +8,7 @@ import java.util.*;
import org.json.JSONArray;
import org.json.JSONObject;
public class PhysicalRealTimeRouteFinder{
public class PhysicalRealTimeRouteFinder {
public HttpSender httpSender;
public MapGenerator mapGenerator;
@ -18,67 +18,67 @@ public class PhysicalRealTimeRouteFinder{
public int currentFrame = 0;
public long startTime = System.currentTimeMillis();
public PhysicalRealTimeRouteFinder(){
public PhysicalRealTimeRouteFinder() {
}
public void generateMap(double x, double y, double z){
public void generateMap(double x, double y, double z) {
this.mapGenerator = new MapGenerator(this, x, y, z);
this.mapGenerator.start();
}
public boolean hasMap(){
if(this.mapGenerator != null){
if(this.mapGenerator.isSuccess()){
public boolean hasMap() {
if (this.mapGenerator != null) {
if (this.mapGenerator.isSuccess()) {
return true;
}
}
return false;
}
public HashMap<Vector3, Integer> getMap(){
if(this.hasMap()){
public HashMap<Vector3, Integer> getMap() {
if (this.hasMap()) {
return this.mapGenerator.mapData;
}
return new HashMap<Vector3, Integer>();
}
public void findRoute(HashMap<Vector3, Integer> map, Vector3 startPoint, Vector3 endPoint,
int threadCount){
int threadCount) {
this.routeFinder = new AdvancedRouteFinder(this, map, this.entity, threadCount);
this.routeFinder.setStart(startPoint);
this.routeFinder.setDestination(endPoint);
this.routeFinder.taskSearch();
}
public void setEntity(Entity e){
public void setEntity(Entity e) {
this.entity = e;
}
public boolean hasNewFrame(){
if(this.frameQueue.size() > 0){
public boolean hasNewFrame() {
if (this.frameQueue.size() > 0) {
return true;
}
return false;
}
public HashMap<String, Object> getNewFrame(){
public HashMap<String, Object> getNewFrame() {
return this.frameQueue.get(0);
}
public boolean deleteNewFrame(){
public boolean deleteNewFrame() {
this.frameQueue.remove(0);
return true;
}
public void addNewFrame(HashMap<String, Object> f){
public void addNewFrame(HashMap<String, Object> f) {
this.frameQueue.add(f);
}
public void resetHttpSender(){
if(this.httpSender == null){
public void resetHttpSender() {
if (this.httpSender == null) {
this.httpSender = new HttpSender(this);
}else{
} else {
HttpSender old = this.httpSender;
this.httpSender = new HttpSender(this);
this.httpSender.dataQueue = old.dataQueue;
@ -86,13 +86,13 @@ public class PhysicalRealTimeRouteFinder{
this.httpSender.start();
}
public String encodeMapJsonData(){
public String encodeMapJsonData() {
JSONObject jsonData = new JSONObject();
HashMap<Vector3, Integer> mdata = this.mapGenerator.mapData;
JSONArray map = new JSONArray();
int mapindex = 0;
Iterator<Vector3> it = (Iterator<Vector3>) mdata.keySet().iterator();
while(it.hasNext()){
while (it.hasNext()) {
Vector3 pos = (Vector3) it.next();
JSONArray point = new JSONArray();
point.put(0, pos.x);
@ -108,9 +108,9 @@ public class PhysicalRealTimeRouteFinder{
}
@SuppressWarnings("unchecked")
public String encodeFrameJsonData(){
public String encodeFrameJsonData() {
HashMap<String, Object> fdata = this.getNewFrame();
if(fdata == null){
if (fdata == null) {
return "";
}
ArrayList<Vector3> rdata = (ArrayList<Vector3>) fdata.get("Route");
@ -118,7 +118,7 @@ public class PhysicalRealTimeRouteFinder{
JSONObject en = new JSONObject();
JSONArray route = new JSONArray();
JSONObject info = new JSONObject();
for(int i = 0; i < rdata.size(); i++){
for (int i = 0; i < rdata.size(); i++) {
Vector3 pos = rdata.get(i);
JSONArray point = new JSONArray();
point.put(0, pos.x);
@ -128,7 +128,7 @@ public class PhysicalRealTimeRouteFinder{
}
HashMap<String, Object> idata = (HashMap<String, Object>) fdata.get("Info");
Iterator<String> it = (Iterator<String>) idata.keySet().iterator();
while(it.hasNext()){
while (it.hasNext()) {
String k = (String) it.next();
info.put(k, idata.get(k));
}
@ -143,7 +143,7 @@ public class PhysicalRealTimeRouteFinder{
jsonData.put("Route", route);
jsonData.put("Info", info);
jsonData.put("Entity", en);
System.out.println(this.currentFrame+"帧已打包,耗时"+String.valueOf(idata.get("FrameCalculateTime")));
System.out.println(this.currentFrame + "帧已打包,耗时" + String.valueOf(idata.get("FrameCalculateTime")));
this.currentFrame++;
this.deleteNewFrame();
return jsonData.toString();

Binary file not shown.

View File

@ -1,5 +0,0 @@
#Generated by Maven
#Mon May 10 14:25:53 CST 2021
groupId=cn.dxp
artifactId=PhysicalRealTimeRouteFinder
version=1.0-SNAPSHOT

View File

@ -1,11 +0,0 @@
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\PRTRF.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\route\Grid.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\route\AdvancedRouteFinder.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\route\RouteTask.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\math\Vector3.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\network\HttpSender.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\route\Node.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\PhysicalRealTimeRouteFinder.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\route\RouteFinder.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\map\MapGenerator.java
e:\PhysicalRealTimeRouteFinder\src\main\java\cn\dxp\math\Entity.java

View File

@ -1 +0,0 @@
E:\PhysicalRealTimeRouteFinder\src\test\java\cn\dxp\AppTest.java

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="1" failures="0" name="cn.dxp.AppTest" time="0.002" errors="0" skipped="0">
<properties>
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
<property name="java.vm.version" value="11.0.8+10-LTS"/>
<property name="sun.boot.library.path" value="D:\Java\bin"/>
<property name="maven.multiModuleProjectDirectory" value="E:\PhysicalRealTimeRouteFinder"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="java.vendor.url" value="https://openjdk.java.net/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="path.separator" value=";"/>
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
<property name="sun.os.patch.level" value=""/>
<property name="user.script" value=""/>
<property name="user.country" value="CN"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="E:\PhysicalRealTimeRouteFinder"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="java.runtime.version" value="11.0.8+10-LTS"/>
<property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="C:\Users\Dxp\AppData\Local\Temp\"/>
<property name="line.separator" value="
"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="user.variant" value=""/>
<property name="os.name" value="Windows 10"/>
<property name="classworlds.conf" value="D:\Maven\bin\..\bin\m2.conf"/>
<property name="sun.jnu.encoding" value="GBK"/>
<property name="java.library.path" value="D:\Java\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp;;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\Java\bin;D:\Java\jre\bin;D:\Maven\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\putty\;C:\Users\Dxp\AppData\Local\Programs\Python\Python39-32\Scripts\;C:\Users\Dxp\AppData\Local\Programs\Python\Python39-32\;C:\Users\Dxp\AppData\Local\Microsoft\WindowsApps;C:\Users\Dxp\AppData\Local\Temp\Astcenc;;C:\Users\Dxp\AppData\Local\Microsoft\WindowsApps;D:\Microsoft VS Code\bin;."/>
<property name="maven.conf" value="D:\Maven\bin\../conf"/>
<property name="jdk.debug" value="release"/>
<property name="java.class.version" value="55.0"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="10.0"/>
<property name="library.jansi.path" value="D:\Maven\bin\..\lib\jansi-native"/>
<property name="user.home" value="C:\Users\Dxp"/>
<property name="user.timezone" value="Asia/Shanghai"/>
<property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
<property name="file.encoding" value="GBK"/>
<property name="java.specification.version" value="11"/>
<property name="user.name" value="Dxp"/>
<property name="java.class.path" value="D:\Maven\bin\..\boot\plexus-classworlds-2.6.0.jar"/>
<property name="java.vm.specification.version" value="11"/>
<property name="sun.arch.data.model" value="64"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher package"/>
<property name="java.home" value="D:\Java"/>
<property name="user.language" value="zh"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="11.0.8"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="sun.stderr.encoding" value="ms936"/>
<property name="maven.home" value="D:\Maven\bin\.."/>
<property name="file.separator" value="\"/>
<property name="java.version.date" value="2020-07-14"/>
<property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.endian" value="little"/>
<property name="java.vendor.version" value="18.9"/>
<property name="sun.stdout.encoding" value="ms936"/>
<property name="sun.desktop" value="windows"/>
<property name="sun.cpu.isalist" value="amd64"/>
</properties>
<testcase classname="cn.dxp.AppTest" name="testApp" time="0.002"/>
</testsuite>

View File

@ -1,4 +0,0 @@
-------------------------------------------------------------------------------
Test set: cn.dxp.AppTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 sec