Package org.bridj

Examples of org.bridj.Pointer


      return false;
    allocateCompressedBuffer((int) (1.5 * p8BitImageByteBuffer.limit()));
    final StopWatch lCompressionTime = StopWatch.start();
    p8BitImageByteBuffer.position(0);

    final Pointer lPointerTo8BitImageByteBuffer = Pointer.pointerToBytes(p8BitImageByteBuffer);

    final int lErrorCode = TurbojpegLibrary.tjCompress2(mPointerToCompressor,
                                                        lPointerTo8BitImageByteBuffer,
                                                        pWidth,
                                                        0,
                                                        pHeight,
                                                        (int) TJPF.TJPF_GRAY.value,
                                                        mPointerToCompressedImageByteBufferPointer,
                                                        mPointerToCompressedBufferEffectiveSize,
                                                        (int) TJSAMP.TJSAMP_GRAY.value,
                                                        mQuality,
                                                        TurbojpegLibrary.TJFLAG_NOREALLOC | TurbojpegLibrary.TJFLAG_FORCESSE3
                                                            | TurbojpegLibrary.TJFLAG_FASTDCT);
    mLastCompressionElapsedTimeInMs = lCompressionTime.time(TimeUnit.MILLISECONDS);
    mCompressedImageByteBuffer.limit((int) mPointerToCompressedBufferEffectiveSize.getCLong());
    mLastCompressionRatio = ((double) mCompressedImageByteBuffer.limit()) / p8BitImageByteBuffer.limit();

    lPointerTo8BitImageByteBuffer.release();
    return lErrorCode == 0;

  }
View Full Code Here


    p8BitImageCompressedByteBuffer.position(0);



    final Pointer lPointerTo8BitImageCompressedByteBuffer = Pointer.pointerToBytes(p8BitImageCompressedByteBuffer);
    TurbojpegLibrary.tjDecompressHeader(mPointerToDecompressor,
                                        lPointerTo8BitImageCompressedByteBuffer,
                                        lCompressedImageBufferSize,
                                        mPointerToWidth,
                                        mPointerToHeight);
    lPointerTo8BitImageCompressedByteBuffer.release();

    final int lWidth = mPointerToWidth.getInt();
    final int lHeight = mPointerToHeight.getInt();

    allocateDecompressedBuffer(lWidth * lHeight);
    mDecompressedImageByteBuffer.rewind();
   
    final int lErrorCode = TurbojpegLibrary.tjDecompress2(mPointerToDecompressor,
                                                          lPointerTo8BitImageCompressedByteBuffer,
                                                          lCompressedImageBufferSize,
                                                          mPointerToDecompressedImageByteBuffer,
                                                          lWidth,
                                                          0,
                                                          lHeight,
                                                          (int) TJPF.TJPF_GRAY.value,
                                                          TurbojpegLibrary.TJFLAG_NOREALLOC | TurbojpegLibrary.TJFLAG_FORCESSE3
                                                              | TurbojpegLibrary.TJFLAG_FASTDCT);

    mLastDecompressionElapsedTimeInMs = lCompressionTime.time(TimeUnit.MILLISECONDS);

    lPointerTo8BitImageCompressedByteBuffer.release();
   
   
    return lErrorCode == 0;
  }
View Full Code Here

        }
      } catch(Exception e) {
        HAS_L_GETNAME = false;
      }
      if(namePtr == null) {
        Pointer layerDefinition = OGR_L_GetLayerDefn(layer);
      namePtr = OGR_FD_GetName(layerDefinition);
      }
    return getCString(namePtr);
    }
View Full Code Here

    public static void main(String[] args) {
        GdalInit.init();
        OGRRegisterAll();
        for (int i = 0; i < OGRGetDriverCount(); i++) {
            Pointer driver = OGRGetDriver(i);
            System.out.println(OGR_Dr_GetName(driver).getCString());
        }
       
        String path = "/home/aaime/devel/gisData/world.shp";
        Pointer ds = OGROpen(Pointer.pointerToCString(path), 0, null);
        System.out.println(ds);
        Pointer layer = OGR_DS_GetLayerByName(ds, Pointer.pointerToCString("world"));
       
        Pointer hFDefn = OGR_L_GetLayerDefn(layer);
        int iField;
       
        Pointer hFeature;

        OGR_L_ResetReading(layer);
        while( (hFeature = OGR_L_GetNextFeature(layer)) != null)
        {
            for( iField = 0; iField < OGR_FD_GetFieldCount(hFDefn); iField++ )
            {
                Pointer hFieldDefn = OGR_FD_GetFieldDefn( hFDefn, iField );
   
                if( OGR_Fld_GetType(hFieldDefn) == OGRFieldType.OFTInteger )
                    System.out.println(OGR_F_GetFieldAsInteger( hFeature, iField ) );
                else if( OGR_Fld_GetType(hFieldDefn) == OGRFieldType.OFTReal )
                    System.out.println(OGR_F_GetFieldAsDouble( hFeature, iField) );
View Full Code Here

    public static void main(String[] args) {
        GdalInit.init();
        OGRRegisterAll();
        for (int i = 0; i < OGRGetDriverCount(); i++) {
            Pointer driver = OGRGetDriver(i);
            System.out.println(OGR_Dr_GetName(driver).getCString());
        }
       
        String path = "/home/aaime/devel/gisData/world.shp";
        Pointer ds = OGROpen(Pointer.pointerToCString(path), 0, null);
        System.out.println(ds);
        Pointer layer = OGR_DS_GetLayerByName(ds, Pointer.pointerToCString("world"));
       
        Pointer hFDefn = OGR_L_GetLayerDefn(layer);
        int iField;
       
        Pointer hFeature;

        OGR_L_ResetReading(layer);
        while( (hFeature = OGR_L_GetNextFeature(layer)) != null)
        {
            for( iField = 0; iField < OGR_FD_GetFieldCount(hFDefn); iField++ )
            {
                Pointer hFieldDefn = OGR_FD_GetFieldDefn( hFDefn, iField );
   
                if( OGR_Fld_GetType(hFieldDefn) == OGRFieldType.OFTInteger )
                    System.out.println(OGR_F_GetFieldAsInteger( hFeature, iField ) );
                else if( OGR_Fld_GetType(hFieldDefn) == OGRFieldType.OFTReal )
                    System.out.println(OGR_F_GetFieldAsDouble( hFeature, iField) );
View Full Code Here

     * @param ogrName
     * @param driverName
     * @return
     */
    public boolean canProcess(String ogrName, String driverName) {
        Pointer dataset = OGROpenShared(pointerToCString(ogrName), 0, null);
        if (dataset != null) {
            OGRReleaseDataSource(dataset);
            return true;
        }

        Pointer driver = OGRGetDriverByName(pointerToCString(driverName));
        if (driver != null) {
            return true;
        }

        return false;
View Full Code Here

   
    public static Set<String> getAvailableDrivers() {
        int count = OGRGetDriverCount();
        Set<String> result = new HashSet<String>();
        for (int i = 0; i < count; i++) {
            Pointer driver = OGRGetDriver(i);
            String name = getCString(OGR_Dr_GetName(driver));
            result.add(name);
        }
       
        return result;
View Full Code Here

     * @param ogrName
     * @param driverName
     * @return
     */
    public boolean canProcess(String ogrName, String driverName) {
        Pointer dataset = OGROpenShared(pointerToCString(ogrName), 0, null);
        if (dataset != null) {
            OGRReleaseDataSource(dataset);
            return true;
        }

        Pointer driver = OGRGetDriverByName(pointerToCString(driverName));
        if (driver != null) {
            return true;
        }

        return false;
View Full Code Here

   
    public static Set<String> getAvailableDrivers() {
        int count = OGRGetDriverCount();
        Set<String> result = new HashSet<String>();
        for (int i = 0; i < count; i++) {
            Pointer driver = OGRGetDriver(i);
            String name = getCString(OGR_Dr_GetName(driver));
            result.add(name);
        }
       
        return result;
View Full Code Here

            return new ReferencedEnvelope(crs);
        } else if (!filterTx.isFilterFullySupported()) {
            return null;
        } else {
            // encodable, we then encode and get the bounds
            Pointer dataSource = null;
            Pointer layer = null;

            try {
                // grab the layer
                String typeName = getEntry().getTypeName();
                dataSource = getDataStore().openOGRDataSource(false);
View Full Code Here

TOP

Related Classes of org.bridj.Pointer

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.