Exemplo n.º 1
0
bool ossimHdf4SubDataset::open()
{
   static const char MODULE[] = "ossimHdf4SubDataset::open";

   bool result = false;
 
   m_sd_id = SDstart(m_fileName.c_str(), DFACC_READ);
   if (m_sd_id < 0)
   {
      result = false;
   }
   else
   {
      result = true;
   }

   m_sds_id = SDselect(m_sd_id, m_sds_index);
   if (m_sds_id < 0)
   {
      result = false;
   }
   else
   {
      result = true;
   }

   if (result == false)
   {
      SDendaccess (m_sds_id); 
      SDend (m_sd_id); 
   }
   
   initMeta();

   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << MODULE << " exit status = " << (result?"true":"false\n")
         << std::endl;
   }

   return result;
}
Exemplo n.º 2
0
/*
 * Class:     edu_uw_apl_commons_tsk4j_filesys_FileSystem
 * Method:    initNative
 * Signature: ()V
 */
JNIEXPORT void JNICALL 
Java_edu_uw_apl_commons_tsk4j_filesys_FileSystem_initNative
(JNIEnv *env, jclass clazz) {

  jint status;

  status = initBlock( env );
  if( status != JNI_OK )
	return;

  status = initBlockWalk( env );
  if( status != JNI_OK )
	return;

  status = initMeta( env );
  if( status != JNI_OK )
	return;

  status = initName( env );
  if( status != JNI_OK )
	return;

  status = initFile( env );
  if( status != JNI_OK )
	return;

  status = initWalkFile( env );
  if( status != JNI_OK )
	return;

  status = initDirectory( env );
  if( status != JNI_OK )
	return;

  status = initDirectoryWalk( env );
  if( status != JNI_OK )
	return;

  status = initMetaWalk( env );
  if( status != JNI_OK )
	return;
}
bool ossimHdf5SubDataset::open()
{
   static const char MODULE[] = "ossimHdf5SubDataset::open";

   bool result = false;

   m_fid = H5Fopen(m_fileName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
   if (m_fid < 0)
   {
      H5Fclose(m_fid);
      return false;
   }

   // Third arg added for compile fix but not checked. (drb)
   m_dataset_id = H5Dopen(m_fid, m_dataset_name, 0); 

   if (m_dataset_id < 0)
   {
      close();
      return false;
   }

   m_dataType = H5Dget_type(m_dataset_id);
   m_native = H5Tget_native_type(m_dataType, H5T_DIR_ASCEND );
   setOutputScalarType();

   H5Tget_class(m_dataType);   
   H5Tget_order(m_dataType);

   m_size = H5Tget_size(m_dataType);

   m_dataspace = H5Dget_space(m_dataset_id);    /* dataspace handle */
   m_rank = H5Sget_simple_extent_ndims(m_dataspace);

   if (m_rank == 4)
   {
      hsize_t  dims_out[4];
      herr_t status_n  = H5Sget_simple_extent_dims(m_dataspace, dims_out, NULL);
      if (status_n >= 0)
      {
         m_numberOfBands = dims_out[2];
         m_numberOfLines = dims_out[0];
         m_numberOfSamples = dims_out[1];
      }
   }
   else if (m_rank == 3)
   {
      hsize_t  dims_out[3];
      herr_t status_n  = H5Sget_simple_extent_dims(m_dataspace, dims_out, NULL);
      if (status_n >= 0)
      {
         if (dims_out[2] < dims_out[0] && dims_out[2] < dims_out[1])
         {
            m_numberOfBands = dims_out[2];
            m_numberOfLines = dims_out[0];
            m_numberOfSamples = dims_out[1];
         }
         else
         {
            m_numberOfBands = dims_out[0];
            m_numberOfLines = dims_out[1];
            m_numberOfSamples = dims_out[2];
         }
      }
   }
   else if (m_rank == 2)
   {
      hsize_t  dims_out[2];
      herr_t status_n  = H5Sget_simple_extent_dims(m_dataspace, dims_out, NULL);
      if (status_n >= 0)
      {
         m_numberOfBands = 1;
         m_numberOfLines = dims_out[0];
         m_numberOfSamples = dims_out[1];
      }
   }
   else if (m_rank == 1)
   {
      hsize_t  dims_out[1];
      herr_t status_n  = H5Sget_simple_extent_dims(m_dataspace, dims_out, NULL);
      if (status_n >= 0)
      {
         m_numberOfBands = 0;
         m_numberOfLines = dims_out[0];
         m_numberOfSamples = 0;
      }
   }
   else
   {
      m_numberOfBands = 0;
      m_numberOfLines = 0;
      m_numberOfSamples = 0;
   }

   result = initMeta();

   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << MODULE << " exit status = " << (result?"true":"false\n")
         << std::endl;
   }

   return result;
}