/** @see ecologylab.oodss.messages.RequestMessage#performService(ecologylab.collections.Scope) */
  @Override
  public ResponseMessage performService(Scope objectRegistry) {
    GPSDatum gpsDatum = (GPSDatum) objectRegistry.get(EarthGPSSimulatorServer.GPS_DATUM);

    if (gpsDatum == null) gpsDatum = new GPSDatum();

    long lastTimePoint = (Long) objectRegistry.get(EarthGPSSimulatorServer.LAST_TIME_POINT);

    if (lastTimePoint != 0)
      gpsDatum.setGrndSpd(gpsDatum.distanceTo(lat, lon) / ((timePoint - lastTimePoint) / 1000.0));

    objectRegistry.put(EarthGPSSimulatorServer.LAST_TIME_POINT, timePoint);

    gpsDatum.setLat(lat);
    gpsDatum.setLon(lon);

    CompassDatum compassDatum =
        (CompassDatum) objectRegistry.get(EarthGPSSimulatorServer.COMPASS_DATUM);

    if (compassDatum == null) compassDatum = new CompassDatum();

    compassDatum.setHeading(heading);

    Kml currentLookPointKML = new Kml();
    Placemark currentLookPoint = new Placemark("location", "Current simulated GPS location.", null);
    currentLookPoint.setPoint(new Point(gpsDatum));

    try {
      debug(SimplTypesScope.serialize(currentLookPoint, StringFormat.XML));
    } catch (SIMPLTranslationException e) {
      e.printStackTrace();
    }

    currentLookPointKML.setPlacemark(currentLookPoint);

    KmlResponse resp = new KmlResponse(currentLookPointKML);

    debug("Ground speed: " + gpsDatum.getSpeed());

    return resp;
  }
  /** Called automatically by OODSS on client */
  @Override
  public void processUpdate(Scope appObjScope) {
    System.out.println("processUpdate has indeed been called we kind of win!!!");
    /* get the chat listener */
    ChatUpdateListener listener =
        (ChatUpdateListener) appObjScope.get(ChatUpdateListener.CHAT_UPDATE_LISTENER);

    /* report incoming update */
    if (listener != null) {
      listener.recievedUpdate(this);
    } else {
      warning(
          "Listener not set in application scope. Can't display message from\n"
              + id
              + ": "
              + message);
    }
  }