Ejemplo n.º 1
0
  private void drawPath(
      Graphics2D g, double scaleX, double scaleY, double minX, double minY, double timeStep) {

    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setTransform(new AffineTransform());
    g.setColor(new Color(0, 0, 0, 10));

    // IMraLog stateParser = logSource.getLog("EstimatedState");
    // IMCMessage stateEntry;

    LsfIterator<EstimatedState> iterator =
        logSource.getLsfIndex().getIterator(EstimatedState.class);
    if (timeStep > 0)
      iterator =
          logSource.getLsfIndex().getIterator(EstimatedState.class, (long) (timeStep * 1000));

    Point2D lastPt = null;
    EstimatedState state = iterator.next();

    if (state == null) {
      NeptusLog.pub().error("No estimatedstate messages in the log");
      return;
    }
    LocationType ref = IMCUtils.getLocation(state).convertToAbsoluteLatLonDepth();

    LinkedHashMap<Integer, Point2D> lastStates = new LinkedHashMap<>();

    while (state != null) {
      LocationType loc = IMCUtils.getLocation(state).convertToAbsoluteLatLonDepth();
      double[] offsets = loc.getOffsetFrom(ref);

      Point2D pt = new Point2D.Double((offsets[1] - minY) * scaleY, (-minX - offsets[0]) * scaleX);

      if (timeStep == 0) g.setColor(new Color(0, 0, 0, 20));
      else g.setColor(Color.black);

      lastPt = lastStates.get(state.getSrc());

      if (lastPt != null && pt != null) g.draw(new Line2D.Double(lastPt, pt));
      lastStates.put(state.getSrc(), pt);

      state = iterator.next();
    }
  }
Ejemplo n.º 2
0
  private DataDiscretizer parseLog(String entity) {
    DataDiscretizer dd = new DataDiscretizer(10);

    IMraLog parser = logSource.getLog(messageName);
    IMraLog stateParser = logSource.getLog("EstimatedState");

    if (parser == null || stateParser == null) {
      return dd;
    }

    IMCMessage entry = parser.nextLogEntry();
    IMCMessage stateEntry = stateParser.nextLogEntry();
    LocationType ref = IMCUtils.getLocation(stateEntry).convertToAbsoluteLatLonDepth();

    entityList.clear();
    entityList.add("ALL");
    while (entry != null) {
      parser.advance(1);
      entry = parser.getCurrentEntry();
      if (entry != null) {
        String entName = logSource.getEntityName(entry.getSrc(), entry.getSrcEnt());

        if (!entityList.contains(entName)) entityList.add(entName);

        if (!entity.equalsIgnoreCase("ALL") && !entName.equalsIgnoreCase(entity)) continue;

        stateEntry = stateParser.getEntryAtOrAfter(parser.currentTimeMillis());

        LocationType loc = new LocationType();
        loc.setLatitudeRads(stateEntry.getDouble("lat"));
        loc.setLongitudeRads(stateEntry.getDouble("lon"));
        loc.translatePosition(
            stateEntry.getDouble("x"), stateEntry.getDouble("y"), stateEntry.getDouble("z"));
        double[] offsets = loc.getOffsetFrom(ref);

        double[] vals = new double[4];

        vals[0] = Double.NaN;

        if (stateEntry != null) {
          vals[0] = entry.getDouble(varName);
          dd.addPoint(offsets[1], -offsets[0], vals);
        }
      }
    }
    entCombo.setModel(new DefaultComboBoxModel<>(entityList));

    return dd;
  }
Ejemplo n.º 3
0
 /** @see PropertiesProvider#setProperties(Property[]) */
 public void setProperties(Property[] properties) {
   IMCUtils.setProperties(properties, message);
 }
Ejemplo n.º 4
0
 /** @see PropertiesProvider#getProperties() */
 public DefaultProperty[] getProperties() {
   Vector<PluginProperty> properties = IMCUtils.getProperties(message);
   return properties.toArray(new DefaultProperty[] {});
 }