private bool CheckProjectInfos(string filename, Hdf4Operator oper) { string arg = ""; SetAttr(oper.GetAttributes(), _projectNames, ref arg); if (!string.IsNullOrEmpty(arg) || !string.IsNullOrEmpty(_currMosaicInfos.Project)) { if ((string.IsNullOrEmpty(arg) || string.IsNullOrEmpty(_currMosaicInfos.Project)) || arg.Trim().ToUpper() != _currMosaicInfos.Project.Trim().ToUpper()) { AddLog(Path.GetFileName(filename) + "投影方式不一致!"); return(false); } else if (!string.IsNullOrEmpty(arg) && arg.Trim().ToUpper().IndexOf("GLL") == -1) { SetAttr(oper.GetAttributes(), _projectArgsNames, ref arg); if ((string.IsNullOrEmpty(arg) || string.IsNullOrEmpty(_currMosaicInfos.ProjectArgs)) || arg.Trim().ToUpper() != _currMosaicInfos.ProjectArgs.Trim().ToUpper()) { AddLog(Path.GetFileName(filename) + "投影参数不一致!"); return(false); } } } return(true); }
private void GetFileAttrInfos(FileListItem fli) { if (HDF4Helper.IsHdf4(fli.FileName)) { Hdf4Operator oper = new Hdf4Operator(fli.FileName); try { Dictionary <string, string> fileAtrr = null; if (oper != null) { fileAtrr = oper.GetAttributes(); if (fileAtrr != null) { InitFileAttr(fileAtrr); } else { ClearFileAtrr(); } InitDataset(oper.GetDatasetNames, oper); } } catch (Exception ex) { AddLog(fli.FileName + "文件读取失败:" + ex.Message); } finally { if (oper != null) { oper.Dispose(); } } } }
public override Dictionary <string, string> GetDatasetAttributes(string datasetName) { using (IHdfOperator hdf = new Hdf4Operator(_provider.fileName)) { return(hdf.GetAttributes(datasetName)); } }
public override Dictionary <string, string> GetAttributes() { using (Hdf4Operator hdf4 = new Hdf4Operator(_provider.fileName)) { return(hdf4.GetAttributes()); } }
private void lstDataSets_SelectedIndexChanged(object sender, EventArgs e) { ClearDataSetCombox(); if (lstDataSets.SelectedItems.Count == 0 || lstDataSets.SelectedItems[0].Tag == null || lstFileInfoList.SelectedItems.Count == 0 || (lstFileInfoList.SelectedItems[0]).Tag == null) { return; } FileListItem fli = (lstFileInfoList.SelectedItems[0]).Tag as FileListItem; DataSetMosaicInfo dsi = lstDataSets.SelectedItems[0].Tag as DataSetMosaicInfo; if (fli == null) { return; } if (HDF4Helper.IsHdf4(fli.FileName)) { Hdf4Operator oper = new Hdf4Operator(fli.FileName); try { Dictionary <string, string> datasetAtrr = new Dictionary <string, string>(); if (oper != null) { datasetAtrr = oper.GetAttributes(dsi.DataSetName); if (datasetAtrr != null) { InitDataSetAttr(datasetAtrr, ref dsi); } Size size = Size.Empty; int bandCount = 0; Type datatype; int datatypeSize = 0; HDF4Helper.DataTypeDefinitions hdf4DataType = HDF4Helper.DataTypeDefinitions.DFNT_NUINT16; if (GetDataSetSize(dsi.DataSetName, oper, out size, out bandCount, out hdf4DataType, out datatype, out datatypeSize)) { InitHeigthWidth(size.Width, size.Height, bandCount, ref dsi); if (dsi != null) { dsi.HDF4DataType = hdf4DataType; } } } } finally { if (oper != null) { oper.Dispose(); } } } }
private bool CheckRegion(string filename, Hdf4Operator oper, out HdrFile.Envelope envelope) { envelope = null; string lefrupArg = ""; SetAttr(oper.GetAttributes(), _leftupPointNames, ref lefrupArg); if (string.IsNullOrEmpty(lefrupArg)) { AddLog(Path.GetFileName(filename) + "左上角坐标未找到!"); return(false); } string ringhtDownArg = ""; SetAttr(oper.GetAttributes(), _rightDownPointNames, ref ringhtDownArg); if (string.IsNullOrEmpty(ringhtDownArg)) { AddLog(Path.GetFileName(filename) + "右下角坐标未找到!"); return(false); } envelope = GetEnvelopeByAttr(lefrupArg, ringhtDownArg); return(true); }
private void InitDataset(string[] dataset, Hdf4Operator oper) { lstDataSets.Items.Clear(); if (dataset == null || dataset.Length == 0) { return; } ListViewItem lvi = null; Dictionary <string, string> attValues = null; foreach (string item in dataset) { lvi = new ListViewItem(item); attValues = oper.GetAttributes(item); lvi.SubItems.Add(attValues != null && attValues.ContainsKey("long_name") ? attValues["long_name"] : ""); lvi.Tag = new DataSetMosaicInfo(item); lvi.Checked = true; lstDataSets.Items.Add(lvi); } }