Package hla.rti

Examples of hla.rti.SuppliedAttributes


  }

  /**
   */
  private void updateAttributeValues(int objectHandle) throws RTIexception {
    SuppliedAttributes attributes = RtiFactoryFactory.getRtiFactory()
        .createSuppliedAttributes();

    // get the handles
    // this line gets the object class of the instance identified by the
    // object instance the handle points to
    int classHandle = rtiAmbassador.getObjectClass(objectHandle);
    int altitudeHandle = rtiAmbassador.getAttributeHandle("Altitude",
        classHandle);
    int latitudeHandle = rtiAmbassador.getAttributeHandle("Latitude",
        classHandle);
    int longitudeHandle = rtiAmbassador.getAttributeHandle("Longitude",
        classHandle);
    int statusHandle = rtiAmbassador.getAttributeHandle("Status",
        classHandle);

    double altitude = flyingObject.getAltitude();
    double longitude = flyingObject.getLongitude();
    double latitude = flyingObject.getLatitude();

    if (flyingObject.isWaitingFireSignal()) {
      altitude = plane.getAltitude();
      longitude = plane.getLontitude();
      latitude = plane.getLatitude();
    }

    logger.log("sending update... " + altitude);

    byte[] altitudeValue = EncodingHelpers.encodeString(String
        .valueOf(altitude));
    attributes.add(altitudeHandle, altitudeValue);
    byte[] latitudeValue = EncodingHelpers.encodeString(String
        .valueOf(latitude));
    attributes.add(latitudeHandle, latitudeValue);
    byte[] longitudeValue = EncodingHelpers.encodeString(String
        .valueOf(longitude));
    attributes.add(longitudeHandle, longitudeValue);
    byte[] statusValule = EncodingHelpers.encodeString(flyingObject
        .getStatus().toString());
    attributes.add(statusHandle, statusValule);

    LogicalTime time = convertTime(foAmbassador.getFederateTime()
        + foAmbassador.getFederateLookahead());

    rtiAmbassador.updateAttributeValues(objectHandle, attributes,
View Full Code Here

TOP

Related Classes of hla.rti.SuppliedAttributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.