mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Rewrote all kind of marks to fit marks specified in AC35 spec.
- added compound mark - added corner - rewrote mark as a single mark - added rounding type enum #story[828]
This commit is contained in:
@@ -0,0 +1,57 @@
|
|||||||
|
package seng302.server.simulator.mark;
|
||||||
|
|
||||||
|
public class CompoundMark {
|
||||||
|
|
||||||
|
private int markID;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Mark mark1;
|
||||||
|
private Mark mark2;
|
||||||
|
|
||||||
|
public CompoundMark(int markID, String name) {
|
||||||
|
this.markID = markID;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMark(int seqId, Mark mark) {
|
||||||
|
if (seqId == 1) {
|
||||||
|
setMark1(mark);
|
||||||
|
} else if (seqId == 2) {
|
||||||
|
setMark2(mark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMarkID() {
|
||||||
|
return markID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarkID(int markID) {
|
||||||
|
this.markID = markID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mark getMark1() {
|
||||||
|
return mark1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMark1(Mark mark1) {
|
||||||
|
this.mark1 = mark1;
|
||||||
|
mark1.setSeqID(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mark getMark2() {
|
||||||
|
return mark2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMark2(Mark mark2) {
|
||||||
|
this.mark2 = mark2;
|
||||||
|
mark2.setSeqID(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package seng302.server.simulator.mark;
|
||||||
|
|
||||||
|
public class Corner {
|
||||||
|
|
||||||
|
private int seqID;
|
||||||
|
private CompoundMark compoundMark;
|
||||||
|
//private int CompoundMarkID;
|
||||||
|
private RoundingType roundingType;
|
||||||
|
private int zoneSize; // size of the zone around a mark in boat-lengths.
|
||||||
|
|
||||||
|
public Corner(int seqID, CompoundMark compoundMark, RoundingType roundingType, int zoneSize) {
|
||||||
|
this.seqID = seqID;
|
||||||
|
this.compoundMark = compoundMark;
|
||||||
|
this.roundingType = roundingType;
|
||||||
|
this.zoneSize = zoneSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeqID() {
|
||||||
|
return seqID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeqID(int seqID) {
|
||||||
|
this.seqID = seqID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundMark getCompoundMark() {
|
||||||
|
return compoundMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompoundMark(CompoundMark compoundMark) {
|
||||||
|
this.compoundMark = compoundMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoundingType getRoundingType() {
|
||||||
|
return roundingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoundingType(RoundingType roundingType) {
|
||||||
|
this.roundingType = roundingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoneSize() {
|
||||||
|
return zoneSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoneSize(int zoneSize) {
|
||||||
|
this.zoneSize = zoneSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package seng302.server.simulator.mark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstract class to represent general marks
|
||||||
|
* Created by Haoming Yin (hyi25) on 17/3/17.
|
||||||
|
*/
|
||||||
|
public class Mark {
|
||||||
|
|
||||||
|
private int seqID;
|
||||||
|
private String name;
|
||||||
|
private double lat;
|
||||||
|
private double lng;
|
||||||
|
//private int sourceID;
|
||||||
|
|
||||||
|
public Mark(String name, double lat, double lng) {
|
||||||
|
this.name = name;
|
||||||
|
this.lat = lat;
|
||||||
|
this.lng = lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeqID() {
|
||||||
|
return seqID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeqID(int seqID) {
|
||||||
|
this.seqID = seqID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLat() {
|
||||||
|
return lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLat(double lat) {
|
||||||
|
this.lat = lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLng() {
|
||||||
|
return lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLng(double lng) {
|
||||||
|
this.lng = lng;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package seng302.server.simulator.mark;
|
||||||
|
|
||||||
|
public enum RoundingType{
|
||||||
|
|
||||||
|
// the mark should be rounded to port (boat's left)
|
||||||
|
PORT("PS"),
|
||||||
|
|
||||||
|
// the mark should be rounded to starboard (boat's right)
|
||||||
|
STARBOARD("Stbd"),
|
||||||
|
|
||||||
|
// the boat within the compound mark with the SeqID of 1 should be rounded
|
||||||
|
// to starboard and the boat within the compound mark with the SeqID of 2
|
||||||
|
// should be rounded to port.
|
||||||
|
SP("SP"),
|
||||||
|
|
||||||
|
// the opposite of SP
|
||||||
|
PS("PS");
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
RoundingType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user