private void ReadDataSource(string file) { // look for file-type foreach (FileType type in fileTypes) { if (type.IsFileType(file)) { fType = type; break; } } if (fType == null) { throw new Exception(String.Format("Unable to match file type for {0}", fType)); } // load data-source reader = new GDALReader(); reader.OpenFile(file, fType); // build source layers for UI dsInfo = reader.Info; DataSourceControl.DataSourcePreviewInfo info = new DataSourceControl.DataSourcePreviewInfo(); info.Dimensions = dsInfo.Resolution; info.Type = fType.Name; info.DataType = dsInfo.BppType; info.Groups = new DataSourceControl.DataSourceImageGroup[2]; DataSourceControl.DataSourcePreviewImage[] images = new DataSourceControl.DataSourcePreviewImage[dsInfo.Bands.Length]; for (int i = 0; i < dsInfo.Bands.Length; i++) { images[i] = new DataSourceControl.DataSourcePreviewImage(dsInfo.Bands[i].Image, dsInfo.Bands[i].Name, new Size(64, 64)); } DataSourceControl.DataSourcePreviewImage[] buildInImages = new DataSourceControl.DataSourcePreviewImage[2]; buildInImages[0] = new DataSourceControl.DataSourcePreviewImage(null, "NormalMap", new Size(64, 64)); buildInImages[1] = new DataSourceControl.DataSourcePreviewImage(/*Image.FromFile(file)*/ null, "TextureMap", new Size(64, 64)); info.Groups[1] = new DataSourceControl.DataSourceImageGroup(images); info.Groups[0] = new DataSourceControl.DataSourceImageGroup(buildInImages); dataSourceControl1.DataSource = info; // load profiles for data-type List <DataProfile> profiles = new List <DataProfile>(); foreach (DataProfile profile in dataProfiles) { if (profile.MatchProfile(fType)) { profiles.Add(profile); } } compatibleProfiles = profiles.ToArray(); dataProfileControl1.Profiles = compatibleProfiles; }
private void ReadDataSource(string file) { // look for file-type foreach (FileType type in fileTypes) { if (type.IsFileType(file)) { fType = type; break; } } if (fType == null) throw new Exception(String.Format("Unable to match file type for {0}", fType)); // load data-source reader = new GDALReader(); reader.OpenFile(file, fType); // build source layers for UI dsInfo = reader.Info; DataSourceControl.DataSourcePreviewInfo info = new DataSourceControl.DataSourcePreviewInfo(); info.Dimensions = dsInfo.Resolution; info.Type = fType.Name; info.DataType = dsInfo.BppType; info.Groups = new DataSourceControl.DataSourceImageGroup[2]; DataSourceControl.DataSourcePreviewImage[] images = new DataSourceControl.DataSourcePreviewImage[dsInfo.Bands.Length]; for (int i = 0; i < dsInfo.Bands.Length; i++) { images[i] = new DataSourceControl.DataSourcePreviewImage(dsInfo.Bands[i].Image, dsInfo.Bands[i].Name, new Size(64, 64)); } DataSourceControl.DataSourcePreviewImage[] buildInImages = new DataSourceControl.DataSourcePreviewImage[2]; buildInImages[0] = new DataSourceControl.DataSourcePreviewImage(null, "NormalMap", new Size(64, 64)); buildInImages[1] = new DataSourceControl.DataSourcePreviewImage(/*Image.FromFile(file)*/null, "TextureMap", new Size(64, 64)); info.Groups[1] = new DataSourceControl.DataSourceImageGroup(images); info.Groups[0] = new DataSourceControl.DataSourceImageGroup(buildInImages); dataSourceControl1.DataSource = info; // load profiles for data-type List<DataProfile> profiles = new List<DataProfile>(); foreach (DataProfile profile in dataProfiles) { if (profile.MatchProfile(fType)) profiles.Add(profile); } compatibleProfiles = profiles.ToArray(); dataProfileControl1.Profiles = compatibleProfiles; }