예제 #1
0
파일: main.cpp 프로젝트: zjnny/hdf
//HDF5转化成raw,geotif
//-o out.tif -i xxx.hdf -d ds1 ds2 //-b ds1<2,1,0> 或者ds1<0> ds2<1> ds3<2>
int main(int argc, char* argv[])
{
	try
	{
		//分析参数
		Analysis ana;
		ana.SetParam(argc,argv);
		ana.Execute();
		//处理获取-d指定的数据集
		vector<string> vc;
		ana.GetConvertedDataSet(vc);
		//依次处理每一个数据集
		for(int i=0;i<vc.size();++i)
		{
			cout<<"Convert DataSet:"<<vc[i]<<endl;
			string dsFile=ana.GetDataSetFile(vc[i].c_str());
			string dsGroup=ana.GetDataSetGroupPath(vc[i].c_str());
			if(dsFile.empty()||dsGroup.empty())
			{
				cout<<"Can not find dataset:"<<vc[i]<<endl;
				continue;
			}
			//格式转化输出
			ConvertDataset(dsFile,dsGroup,ana.GetOutputFile());
		}
	}
	catch (std::exception* e)
	{
		cout<<e->what()<<endl;
	}
	catch (...)
	{
		cout<<"Unknow error!"<<endl;
	}
#ifdef _DEBUG
	system("pause");
#endif
	return 0;
}