Skip to content

Commit

Permalink
util/llf/LogUtils: Fix vehicle path drawing in the PDF report of the …
Browse files Browse the repository at this point in the history
…MRA.
  • Loading branch information
paulosousadias committed Feb 2, 2024
1 parent 3edb7ab commit 2da0386
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/java/pt/lsts/neptus/util/llf/LogUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,8 @@ public static LocationType getLocation(IMCMessage estimatedStateMessage) {

// 0 -> NED ONLY, 1 -> LLD ONLY, 2 -> NED_LLD
long refMode = estimatedStateMessage.getLong("ref");
// IMC5 Compatibility

// Pre IMC5 Compatibility
if(!estimatedStateMessage.getMessageType().getFieldNames().contains("ref")) {
refMode = 2;
}
Expand Down Expand Up @@ -743,7 +743,8 @@ public static LocationType getLocation(LocationType baseLoc, IMCMessage estimate
if (loc == null)
return null;

long refMode = estimatedStateEntry.getLong("ref");
// Pre IMC5 Compatibility
long refMode = estimatedStateEntry.getValue("ref") == null ? 2 : estimatedStateEntry.getLong("ref");
if (refMode == 0) {
loc.setLatitudeDegs(baseLoc.getLatitudeDegs());
loc.setLongitudeDegs(baseLoc.getLongitudeDegs());
Expand All @@ -756,6 +757,7 @@ public static PathElement generatePath(MissionType mission, IMraLogGroup source)
MapType mt = new MapType();
LocationType lt = new LocationType(mission.getStartLocation());
PathElement pe = new PathElement(MapGroup.getMapGroupInstance(mission), mt, lt);
pe.setShape(false);
pe.setParentMap(mt);
mt.addObject(pe);

Expand All @@ -772,7 +774,8 @@ public static PathElement generatePath(MissionType mission, IMraLogGroup source)
parser.advance(100);
entry = parser.nextLogEntry();
if (entry != null) {
long refMode = entry.getLong("ref");
// Pre IMC5 Compatibility
long refMode = entry.getValue("ref") == null ? 2 : entry.getLong("ref");
if (refMode == 0) {
pe.addPoint(entry.getDouble("y"),entry.getDouble("x"), entry.getDouble("z"),false);
}
Expand Down Expand Up @@ -802,10 +805,6 @@ else if (refMode == 2) {
tmp.setDepth(depth);

double[] offs = tmp.getOffsetFrom(mission.getStartLocation());
// if (!(xVals.contains(offs[0]+x) && yVals.contains(offs[1]+y))) {
// xVals.add(offs[0]+x);
// yVals.add(offs[1]+y);
// }
pe.addPoint(offs[1] + y, offs[0] + x, offs[2] + z, false);
}
}
Expand Down

0 comments on commit 2da0386

Please sign in to comment.