Пример #1
0
Geostat_grid* Simulacre_input_filter::read( const std::string& filename, 
                                           std::string* errors ) {
  QFile file( filename.c_str() );
  if( !file.open( IO_ReadOnly ) ) {
    if( errors ) 
      errors->append( "can't open file: " + filename);
    return false;
  }

  QDataStream stream( &file );
  Q_UINT32 magic_nb;
  stream >> magic_nb;
  if( magic_nb != 0xB211175D ) {
    if( errors )
      errors->append( "wrong file format" );
    return 0;
  }

  char* type;
  stream >> type;
  std::string object_type( type );
  delete [] type;

  //TL modified
  if (object_type == Reduced_grid().classname())
	  return read_reduced_grid(stream, errors);
  if( object_type == Cartesian_grid().classname() ) 
    return read_cartesian_grid( stream, errors );
  if( object_type == Point_set().classname() ) 
    return read_pointset( stream, errors );

  return 0;
}
Пример #2
0
//------------------------
bool library_grid_init::init_property_copier_factory() {
  Property_copier_factory::add_method( Point_set().classname(), 
                                       Cartesian_grid().classname(), 
                                       Cgrid_to_pset_copier::create_new_interface );
  Property_copier_factory::add_method( Cartesian_grid().classname(), 
                                       Cartesian_grid().classname(), 
                                       Cgrid_to_cgrid_copier::create_new_interface );
  Property_copier_factory::add_method( Point_set().classname(), 
                                       Point_set().classname(), 
                                       Pset_to_pset_copier::create_new_interface );

  //TL modified
  Property_copier_factory::add_method( Reduced_grid().classname(), 
                                       Reduced_grid().classname(), 
                                       Mask_to_mask_copier::create_new_interface );
  Property_copier_factory::add_method( Point_set().classname(), 
                                       Reduced_grid().classname(), 
                                       Pset_to_mask_copier::create_new_interface );


  return true;
}