-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
243 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package de.turnertech.frederick; | ||
|
||
import java.time.Instant; | ||
import java.util.Date; | ||
import java.util.Optional; | ||
|
||
import de.turnertech.frederick.data.Bullseye; | ||
import de.turnertech.frederick.data.EtbEntry; | ||
|
||
/** | ||
* This is the service layer for the application. All actions performed by the GUI | ||
* should come through here. Consider it the API for the application. | ||
* | ||
* This class should not have any dependency on Geotools, or the GUI in general. | ||
*/ | ||
public class Service { | ||
|
||
final Database database; | ||
|
||
Service(final Database database) { | ||
this.database = database; | ||
} | ||
|
||
/** | ||
* Sets the current deployments Bullseye position. | ||
* | ||
* @param bullseye Setting to null will clear the bullseye. | ||
* @param logPosition The bullseye coordinates as they should be entered into the ETB. | ||
*/ | ||
public void setBullseye(final Bullseye bullseye, final String logPosition) { | ||
database.getCurrentDeployment().setBullseye(bullseye); | ||
EtbEntry etbEntry = new EtbEntry(Date.from(Instant.now()), Application.CURRENT_USER, "Einsatzort festgelegt als " + logPosition); | ||
database.getCurrentDeployment().getEtbEntries().add(etbEntry); | ||
database.notifyActionListeners(Database.DEPLOYMENT_UPDATED_EVENT); | ||
database.saveCurrentDeployment(); | ||
} | ||
|
||
public Optional<Bullseye> getBullseye() { | ||
return Optional.ofNullable(database.getCurrentDeployment().getBullseye()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package de.turnertech.frederick.data; | ||
|
||
import java.io.Serializable; | ||
|
||
public class Bullseye implements Serializable { | ||
|
||
private double x; | ||
|
||
private double y; | ||
|
||
public Bullseye() { | ||
this(0.0, 0.0); | ||
} | ||
|
||
public Bullseye(final double x, final double y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
public double getX() { | ||
return x; | ||
} | ||
|
||
public void setX(final double x) { | ||
this.x = x; | ||
} | ||
|
||
public double getY() { | ||
return y; | ||
} | ||
|
||
public void setY(final double y) { | ||
this.y = y; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.