This is an old revision of the document! Table of Contents
Scripts > SetDesignMapLayer
Script contentshvar hDM set hDM <GetMap "DM"> assert <cast bool <map.GetWidth hDM>> "Design map not initialised!" // allow user to select layer combosel CS combosel.InitCS &CS "Altitude|PeakNoise|FracNoise|Cliffs|Erosion|Lakes|Climate|SpecType|SpecParam|" "Altitude" if <not <EditUI &CS "Select DM layer">> return 0 endif // determine layer ID int LayerID set LayerID -1 string LayerName set LayerName <combosel.GetCurSel &CS> if <iseq 0 <strcmp LayerName "Altitude">> set LayerID 0 elseif <iseq 0 <strcmp LayerName "PeakNoise">> set LayerID 1 elseif <iseq 0 <strcmp LayerName "FracNoise">> set LayerID 2 elseif <iseq 0 <strcmp LayerName "Cliffs">> set LayerID 3 elseif <iseq 0 <strcmp LayerName "Erosion">> set LayerID 4 elseif <iseq 0 <strcmp LayerName "Lakes">> set LayerID 5 elseif <iseq 0 <strcmp LayerName "Climate">> set LayerID 6 elseif <iseq 0 <strcmp LayerName "SpecType">> set LayerID 7 elseif <iseq 0 <strcmp LayerName "SpecParam">> set LayerID 8 else assert false "Invalid layer selection!" endif // get or create the map layer string MapName set MapName <strcat "DM-" LayerName> hvar hLayer set hLayer <GetMap MapName> if <not hLayer> assert hLayer <strcat <strcat "Layer '" MapName> "' does not exist in project!"> endif assert <cast bool <map.GetWidth hDM>> <strcat <strcat "Layer '" MapName> "' is not initialised!"> assert <calc.DM.SetLayer hDM hLayer LayerID> "Cannot set design map layer!" // and now show the updated design map view.ShowMap "DM" CommentsNone. Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
|