/** * Read a point of BIN file * * @param input input file to read * @param Offset Offset to data * @param index index of points to read * @return true if success else return false */ public void readPoint(BigByteBuffer2 input, LidarHeader hdr, long index) { try { if (index > hdr.getNumPointsRecord() || index < 0) { throw new UnexpectedPointException("Out of Index"); } if (index == lasIndex) return; else lasIndex = index; int auxIndex; byte[] punto = new byte[getSizeFormat()]; byte[] aux = new byte[2]; input.position(hdr.getOffsetData() + getSizeFormat() * index); input.get(punto); setClassification((char) (punto[0] & 0xFF)); setFlightLine((char) (punto[1] & 0xFF)); aux[0] = punto[2]; aux[1] = (byte) (punto[3] & 0X3F); setIntensity(ByteUtilities.arr2Unsignedshort(aux, 0)); // bits de 0-13 setEchoInformation((byte) ((punto[3] & 0xC0) >> 2)); // bits 14 y 15 setX(ByteUtilities.arr2Int(punto, 4)); setY(ByteUtilities.arr2Int(punto, 8)); setZ(ByteUtilities.arr2Int(punto, 12)); auxIndex = 16; // si hay gps leelo if (isTimeGPS) { setTime(ByteUtilities.arr2Int(punto, auxIndex)); auxIndex += 4; } // si hay color leelo if (isColor) { char[] c = new char[4]; c[0] = (char) (punto[auxIndex] & 0xFF); c[1] = (char) (punto[auxIndex + 1] & 0xFF); c[2] = (char) (punto[auxIndex + 2] & 0xFF); c[3] = (char) (punto[auxIndex + 3] & 0xFF); setcolor(c); } } catch (UnexpectedPointException e) { e.printStackTrace(); } }