/**
   * Unpacks a Pdu from the underlying data.
   *
   * @throws java.nio.BufferUnderflowException if buff is too small
   * @see java.nio.ByteBuffer
   * @param buff The ByteBuffer at the position to begin reading
   * @since ??
   */
  public void unmarshal(java.nio.ByteBuffer buff) {
    super.unmarshal(buff);

    minefieldID.unmarshal(buff);
    requestingEntityID.unmarshal(buff);
    minefieldSequenceNumbeer = (int) (buff.getShort() & 0xFFFF);
    requestID = (short) (buff.get() & 0xFF);
    pduSequenceNumber = (short) (buff.get() & 0xFF);
    numberOfPdus = (short) (buff.get() & 0xFF);
    numberOfMinesInThisPdu = (short) (buff.get() & 0xFF);
    numberOfSensorTypes = (short) (buff.get() & 0xFF);
    pad2 = (short) (buff.get() & 0xFF);
    dataFilter = buff.getInt();
    mineType.unmarshal(buff);
    for (int idx = 0; idx < numberOfSensorTypes; idx++) {
      TwoByteChunk anX = new TwoByteChunk();
      anX.unmarshal(buff);
      sensorTypes.add(anX);
    }

    pad3 = (short) (buff.get() & 0xFF);
    for (int idx = 0; idx < numberOfMinesInThisPdu; idx++) {
      Vector3Float anX = new Vector3Float();
      anX.unmarshal(buff);
      mineLocation.add(anX);
    }
  } // end of unmarshal method
Esempio n. 2
0
  public int getTopColor(DrawContext dc, java.awt.Point pickPoint) {
    GL gl = dc.getGL();

    java.nio.ByteBuffer pixel = BufferUtil.newByteBuffer(3);
    int yInGLCoords = dc.getView().getViewport().height - pickPoint.y - 1;
    gl.glReadPixels(
        pickPoint.x, yInGLCoords, 1, 1, javax.media.opengl.GL.GL_RGB, GL.GL_UNSIGNED_BYTE, pixel);

    java.awt.Color topColor = null;
    try {
      topColor =
          new java.awt.Color(pixel.get(0) & 0xff, pixel.get(1) & 0xff, pixel.get(2) & 0xff, 0);
    } catch (Exception e) {
      Logging.logger().severe("layers.InvalidPickColorRead");
    }

    return topColor != null ? topColor.getRGB() : 0;
  }
  /**
   * Unpacks a Pdu from the underlying data.
   *
   * @throws java.nio.BufferUnderflowException if buff is too small
   * @see java.nio.ByteBuffer
   * @param buff The ByteBuffer at the position to begin reading
   * @since ??
   */
  public void unmarshal(java.nio.ByteBuffer buff) {
    super.unmarshal(buff);

    minefieldID.unmarshal(buff);
    requestingEntityID.unmarshal(buff);
    requestID = (short) (buff.get() & 0xFF);
    numberOfPerimeterPoints = (short) (buff.get() & 0xFF);
    pad2 = (short) (buff.get() & 0xFF);
    numberOfSensorTypes = (short) (buff.get() & 0xFF);
    dataFilter = buff.getInt();
    requestedMineType.unmarshal(buff);
    for (int idx = 0; idx < numberOfPerimeterPoints; idx++) {
      Point anX = new Point();
      anX.unmarshal(buff);
      requestedPerimeterPoints.add(anX);
    }

    for (int idx = 0; idx < numberOfSensorTypes; idx++) {
      TwoByteChunk anX = new TwoByteChunk();
      anX.unmarshal(buff);
      sensorTypes.add(anX);
    }
  } // end of unmarshal method
 /**
  * Unpacks a Pdu from the underlying data.
  *
  * @throws java.nio.BufferUnderflowException if buff is too small
  * @see java.nio.ByteBuffer
  * @param buff The ByteBuffer at the position to begin reading
  * @since ??
  */
 public void unmarshal(java.nio.ByteBuffer buff) {
   recordType = (short) (buff.get() & 0xFF);
   changeIndicator = (short) (buff.get() & 0xFF);
   associationStatus = (short) (buff.get() & 0xFF);
   associationType = (short) (buff.get() & 0xFF);
   entityID.unmarshal(buff);
   ownStationLocation = (int) (buff.getShort() & 0xFFFF);
   physicalConnectionType = (short) (buff.get() & 0xFF);
   groupMemberType = (short) (buff.get() & 0xFF);
   groupNumber = (int) (buff.getShort() & 0xFFFF);
 } // end of unmarshal method
Esempio n. 5
0
 /**
  * Unpacks a Pdu from the underlying data.
  *
  * @throws java.nio.BufferUnderflowException if buff is too small
  * @see java.nio.ByteBuffer
  * @param buff The ByteBuffer at the position to begin reading
  * @since ??
  */
 public void unmarshal(java.nio.ByteBuffer buff) {
   for (int idx = 0; idx < otherParameters.length; idx++) {
     otherParameters[idx] = buff.get();
   } // end of array unmarshaling
 } // end of unmarshal method