use of org.polymap.core.style.model.raster.ConstantRasterColorMap in project polymap4-core by Polymap4.
the class PredefinedColorMap method fillModel.
public void fillModel(RasterColorMapStyle style, GridCoverage2D grid, IProgressMonitor monitor) {
ConstantRasterColorMap newColorMap = style.colorMap.createValue(ConstantRasterColorMap.defaults());
fillModel(newColorMap, grid, monitor);
}
use of org.polymap.core.style.model.raster.ConstantRasterColorMap in project polymap4-core by Polymap4.
the class PredefinedColorMapEditor method createContents.
@Override
public Composite createContents(Composite parent) {
Composite contents = super.createContents(parent);
ComboViewer combo = new ComboViewer(contents, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
combo.getCombo().setVisibleItemCount(13);
combo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object elm) {
return ((PredefinedColorMap) elm).name;
}
});
combo.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object elm1, Object elm2) {
PredefinedColorMap cm1 = (PredefinedColorMap) elm1;
PredefinedColorMap cm2 = (PredefinedColorMap) elm2;
return cm1.name.compareToIgnoreCase(cm2.name);
}
});
combo.setContentProvider(ArrayContentProvider.getInstance());
combo.setInput(input = PredefinedColorMap.all.get());
findSelected().ifPresent(selected -> combo.setSelection(new StructuredSelection(selected)));
combo.addSelectionChangedListener(ev -> {
ConstantRasterColorMap newColorMap = prop.createValue(ConstantRasterColorMap.defaults());
newColorMap.entries.clear();
PredefinedColorMap colorMap = SelectionAdapter.on(ev.getSelection()).first(PredefinedColorMap.class).get();
UIJob.schedule("Color map", monitor -> {
// Thread.sleep( 3000 );
colorMap.fillModel(newColorMap, site().gridCoverage.get(), monitor);
});
});
return contents;
}
Aggregations