public void LoadFrom(string filename) { this.filename = filename; PrismMap map = PrismFile.LoadMapFrom(filename); textureSetList.Clear(); rootLayer.Nodes.Clear(); Dictionary <PrismTexture.Tile, TextureSet.Tile> tileList = new Dictionary <PrismTexture.Tile, TextureSet.Tile>(); foreach (PrismTexture t in map.Textures) { TextureSet set = new TextureSet(t.Name, t.Bitmap); foreach (PrismTexture.Tile tile in t.Tiles) { TextureSet.Tile newTile = new TextureSet.Tile(tile.Name, set, tile.UV); tileList.Add(tile, newTile); set.AddTile(newTile); } CreateTextureSet(set); } rootLayer = new LayerNode(map.RootLayerNode, tileList, this); }
IDictionary <string, string> GetDictOptWeaselRasters(string aoiPath, FolderType fType) { IDictionary <string, string> dictRasters = new Dictionary <string, string>(); string surfacesGdb = GeodatabaseTools.GetGeodatabasePath(aoiPath, GeodatabaseNames.Surfaces, true); string layerPath = aoiPath + @"\output\surfaces\dem\grid"; string gdbPath = surfacesGdb + Constants.FILE_DEM; dictRasters[layerPath] = gdbPath; layerPath = aoiPath + @"\output\surfaces\dem\filled\hillshade\grid"; gdbPath = surfacesGdb + Constants.FILE_HILLSHADE; dictRasters[layerPath] = gdbPath; if (fType == FolderType.AOI) { // prism layers; optional because they can be reclipped string[] arrPrismLayers = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", "q1", "q2", "q3", "q4", "annual" }; string prismGdb = GeodatabaseTools.GetGeodatabasePath(aoiPath, GeodatabaseNames.Prism, true); int i = 0; foreach (var month in arrPrismLayers) { layerPath = aoiPath + @"\layers\PRISM\" + month + @"\grid"; PrismFile nextMonth = (PrismFile)i; gdbPath = prismGdb + nextMonth.ToString(); dictRasters[layerPath] = gdbPath; i++; } } return(dictRasters); }
public void Save() { PrismMap map = new PrismMap(FileStructureVersion); Dictionary <TextureSet.Tile, PrismTexture.Tile> tileList = new Dictionary <TextureSet.Tile, PrismTexture.Tile>(); foreach (TextureSet s in textureSetList) { PrismTexture set = new PrismTexture(s.Name, s.Bitmap); foreach (TextureSet.Tile t in s) { PrismTexture.Tile tile = new PrismTexture.Tile(t.Name, t.UV, set); tileList.Add(t, tile); set.AddTile(tile); } map.AddTexture(set); } map.RootLayerNode = rootLayer.GetPrismNode(null, tileList); if (filename == null) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "Prism Map (*.pm)|*.pm"; if (dialog.ShowDialog() == DialogResult.OK) { filename = dialog.FileName; } else { return; } } PrismFile.SaveMapTo(map, filename); }