Serialize image colormap settings in HTML/JS export.

This commit is contained in:
Peter Williams 2019-10-06 11:38:21 +02:00
Родитель e30be0289e
Коммит 0a6503c063
2 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -1037,9 +1037,12 @@ class ImageLayer(HasTraits):
state['settings'][wwt_name] = trait.get(self)
if self.vmin is not None and self.vmax is not None:
state['stretch_info'] = {'vmin': self.vmin,
'vmax': self.vmax,
'stretch':VALID_STRETCHES.index(self.stretch)}
state['stretch_info'] = {
'vmin': self.vmin,
'vmax': self.vmax,
'stretch': VALID_STRETCHES.index(self.stretch),
'cmap': self.cmap.name,
}
return state

Просмотреть файл

@ -167,10 +167,11 @@ function loadImageLayer(layerInfo) {
var id = layerInfo['id'];
var url = 'data/' + id + '.fits';
var onFitsLoad = function (layer) {
var stertchInfo = layerInfo['stretch_info'];
wwtLayer.setImageScale(stertchInfo['stretch'],
stertchInfo['vmin'],
stertchInfo['vmax']);
var stretchInfo = layerInfo['stretch_info'];
wwtLayer.setImageScale(stretchInfo['stretch'],
stretchInfo['vmin'],
stretchInfo['vmax']);
wwtLayer.set_colorMapperName(stretchInfo['cmap']);
layer.getFitsImage().transparentBlack = false;
var settings = layerInfo['settings'];
for (name in settings) {
@ -284,4 +285,4 @@ function handleConfigLoadError() {
//TODO replace with something a bit nicer before releasing this feature
$("#wwt-canvas").hide;
$("#wwt-error-text").append("<p>Unable to load configuration file wwt_figure.json</p>");
}
}