Merge "Issue #1395 Updated ShadeableCapability to specify opacity (alpha) to be used for shading" into development
Former-commit-id:b15783eeee
[formerlyb15783eeee
[formerly 4af8030874d2737e652fcb89f913c8d327e83bb1]] Former-commit-id:3d876177d5
Former-commit-id:338ccc416d
This commit is contained in:
commit
6ebc07e20a
7 changed files with 247 additions and 54 deletions
|
@ -662,7 +662,9 @@ public class DbMapResource extends
|
||||||
float alpha = paintProps.getAlpha();
|
float alpha = paintProps.getAlpha();
|
||||||
|
|
||||||
if (shadedShape != null && shadedShape.isDrawable() && isShaded) {
|
if (shadedShape != null && shadedShape.isDrawable() && isShaded) {
|
||||||
aTarget.drawShadedShape(shadedShape, alpha);
|
float opacity = getCapability(ShadeableCapability.class)
|
||||||
|
.getOpacity();
|
||||||
|
aTarget.drawShadedShape(shadedShape, alpha * opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outlineShape != null && outlineShape.isDrawable()
|
if (outlineShape != null && outlineShape.isDrawable()
|
||||||
|
@ -670,7 +672,8 @@ public class DbMapResource extends
|
||||||
aTarget.drawWireframeShape(outlineShape,
|
aTarget.drawWireframeShape(outlineShape,
|
||||||
getCapability(ColorableCapability.class).getColor(),
|
getCapability(ColorableCapability.class).getColor(),
|
||||||
getCapability(OutlineCapability.class).getOutlineWidth(),
|
getCapability(OutlineCapability.class).getOutlineWidth(),
|
||||||
getCapability(OutlineCapability.class).getLineStyle());
|
getCapability(OutlineCapability.class).getLineStyle(),
|
||||||
|
alpha);
|
||||||
} else if (outlineShape == null
|
} else if (outlineShape == null
|
||||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
|
|
|
@ -44,6 +44,9 @@ public class ShadeableCapability extends AbstractCapability {
|
||||||
@XmlAttribute(required = false)
|
@XmlAttribute(required = false)
|
||||||
private String shadingField;
|
private String shadingField;
|
||||||
|
|
||||||
|
@XmlAttribute(required = false)
|
||||||
|
private float opacity = 1.0f;
|
||||||
|
|
||||||
private String[] availableShadingFields;
|
private String[] availableShadingFields;
|
||||||
|
|
||||||
public String[] getAvailableShadingFields() {
|
public String[] getAvailableShadingFields() {
|
||||||
|
@ -74,10 +77,23 @@ public class ShadeableCapability extends AbstractCapability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getOpacity() {
|
||||||
|
return opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpacity(float opacity) {
|
||||||
|
this.opacity = opacity;
|
||||||
|
if (this.opacity != opacity) {
|
||||||
|
this.opacity = opacity;
|
||||||
|
this.capabilityChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractCapability clone() {
|
public AbstractCapability clone() {
|
||||||
ShadeableCapability sc = new ShadeableCapability();
|
ShadeableCapability sc = new ShadeableCapability();
|
||||||
sc.shadingField = shadingField;
|
sc.shadingField = shadingField;
|
||||||
|
sc.opacity = opacity;
|
||||||
sc.availableShadingFields = availableShadingFields;
|
sc.availableShadingFields = availableShadingFields;
|
||||||
return sc;
|
return sc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,6 +587,13 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
|
super.initInternal(target);
|
||||||
|
getCapabilities().removeCapability(ShadeableCapability.class);
|
||||||
|
getCapabilities().removeCapability(LabelableCapability.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param zoneName
|
* @param zoneName
|
||||||
* @param groupLabel
|
* @param groupLabel
|
||||||
|
@ -742,15 +749,9 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
.getWidth()
|
.getWidth()
|
||||||
/ paintProps.getCanvasBounds().width;
|
/ paintProps.getCanvasBounds().width;
|
||||||
|
|
||||||
double offsetX = getCapability(LabelableCapability.class)
|
|
||||||
.getxOffset() * screenToWorldRatio;
|
|
||||||
double offsetY = getCapability(LabelableCapability.class)
|
|
||||||
.getyOffset() * screenToWorldRatio;
|
|
||||||
IExtent extent = paintProps.getView().getExtent();
|
IExtent extent = paintProps.getView().getExtent();
|
||||||
List<DrawableString> strings = new ArrayList<DrawableString>(
|
List<DrawableString> strings = new ArrayList<DrawableString>(
|
||||||
labels.size());
|
labels.size());
|
||||||
// List<IExtent> extents = new ArrayList<IExtent>();
|
|
||||||
// String lastLabel = null;
|
|
||||||
List<LabelTuple> alreadyDrawn = new ArrayList<ZoneSelectorResource.LabelTuple>(
|
List<LabelTuple> alreadyDrawn = new ArrayList<ZoneSelectorResource.LabelTuple>(
|
||||||
labels.size());
|
labels.size());
|
||||||
for (LabelNode node : labels) {
|
for (LabelNode node : labels) {
|
||||||
|
@ -780,8 +781,8 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
}
|
}
|
||||||
DrawableString ds = new DrawableString(text,
|
DrawableString ds = new DrawableString(text,
|
||||||
RGBColors.getRGBColor("white"));
|
RGBColors.getRGBColor("white"));
|
||||||
ds.setCoordinates(node.getLocation()[0] + offsetX,
|
ds.setCoordinates(node.getLocation()[0],
|
||||||
node.getLocation()[1] - offsetY);
|
node.getLocation()[1]);
|
||||||
ds.font = font;
|
ds.font = font;
|
||||||
ds.horizontalAlignment = HorizontalAlignment.CENTER;
|
ds.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||||
ds.verticallAlignment = VerticalAlignment.MIDDLE;
|
ds.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||||
|
@ -834,22 +835,6 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the label field
|
|
||||||
String labelField = getCapability(LabelableCapability.class)
|
|
||||||
.getLabelField();
|
|
||||||
if (labelField != null && !additionalColumns.contains(labelField)) {
|
|
||||||
query.append(", ");
|
|
||||||
query.append(labelField);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the shading field
|
|
||||||
String shadingField = getCapability(ShadeableCapability.class)
|
|
||||||
.getShadingField();
|
|
||||||
if (shadingField != null && !additionalColumns.contains(shadingField)) {
|
|
||||||
query.append(", ");
|
|
||||||
query.append(shadingField);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the geometry table
|
// add the geometry table
|
||||||
query.append(" FROM ");
|
query.append(" FROM ");
|
||||||
query.append(resourceData.getTable());
|
query.append(resourceData.getTable());
|
||||||
|
|
|
@ -261,7 +261,9 @@ public class ShapefileResource extends
|
||||||
if (isShadedCalculated
|
if (isShadedCalculated
|
||||||
&& getCapability(ShadeableCapability.class).getShadingField() != null
|
&& getCapability(ShadeableCapability.class).getShadingField() != null
|
||||||
&& shadedShape != null && shadedShape.isDrawable()) {
|
&& shadedShape != null && shadedShape.isDrawable()) {
|
||||||
aTarget.drawShadedShape(shadedShape, alpha);
|
float opacity = getCapability(ShadeableCapability.class)
|
||||||
|
.getOpacity();
|
||||||
|
aTarget.drawShadedShape(shadedShape, alpha * opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCapability(OutlineCapability.class).isOutlineOn()
|
if (getCapability(OutlineCapability.class).isOutlineOn()
|
||||||
|
@ -269,7 +271,8 @@ public class ShapefileResource extends
|
||||||
aTarget.drawWireframeShape(outlineShape,
|
aTarget.drawWireframeShape(outlineShape,
|
||||||
getCapability(ColorableCapability.class).getColor(),
|
getCapability(ColorableCapability.class).getColor(),
|
||||||
getCapability(OutlineCapability.class).getOutlineWidth(),
|
getCapability(OutlineCapability.class).getOutlineWidth(),
|
||||||
getCapability(OutlineCapability.class).getLineStyle());
|
getCapability(OutlineCapability.class).getLineStyle(),
|
||||||
|
alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCapability(LabelableCapability.class).getLabelField() != null
|
if (getCapability(LabelableCapability.class).getLabelField() != null
|
||||||
|
|
|
@ -28,10 +28,6 @@ import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
|
||||||
import com.raytheon.uf.common.util.FileUtil;
|
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
|
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
|
||||||
|
@ -107,25 +103,6 @@ public class ShapefileResourceData extends AbstractResourceData {
|
||||||
public ShapefileResource construct(LoadProperties loadProperties,
|
public ShapefileResource construct(LoadProperties loadProperties,
|
||||||
IDescriptor descriptor) throws VizException {
|
IDescriptor descriptor) throws VizException {
|
||||||
shapeFile = new File(filename);
|
shapeFile = new File(filename);
|
||||||
if (!shapeFile.isAbsolute()) {
|
|
||||||
shapeFile = PathManagerFactory.getPathManager().getStaticFile(
|
|
||||||
FileUtil.join(VizApp.getMapsDir(), filename));
|
|
||||||
if (shapeFile != null) {
|
|
||||||
// Get rid of shp
|
|
||||||
String name = filename.substring(0, filename.length() - 3);
|
|
||||||
// Get all corresponding shapefile files in directory
|
|
||||||
String path = shapeFile.getParentFile().getAbsolutePath();
|
|
||||||
int idx = path.indexOf(VizApp.getMapsDir());
|
|
||||||
String searchPath = path.substring(idx);
|
|
||||||
LocalizationFile[] files = PathManagerFactory.getPathManager()
|
|
||||||
.listStaticFiles(searchPath, null, false, true);
|
|
||||||
for (LocalizationFile f : files) {
|
|
||||||
if (shapeFile.getName().contains(name)) {
|
|
||||||
f.getFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (shapeFile == null || shapeFile.exists() == false) {
|
if (shapeFile == null || shapeFile.exists() == false) {
|
||||||
throw new VizException("Could not find shapefile",
|
throw new VizException("Could not find shapefile",
|
||||||
new FileNotFoundException(String.valueOf(shapeFile)));
|
new FileNotFoundException(String.valueOf(shapeFile)));
|
||||||
|
|
|
@ -22,11 +22,16 @@ package com.raytheon.viz.ui.cmenu;
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.ActionContributionItem;
|
import org.eclipse.jface.action.ActionContributionItem;
|
||||||
import org.eclipse.jface.action.IMenuCreator;
|
import org.eclipse.jface.action.IMenuCreator;
|
||||||
|
import org.eclipse.jface.action.Separator;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ShadeableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ShadeableCapability;
|
||||||
|
import com.raytheon.viz.ui.dialogs.SetOpacityDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to set the shading field for a resource
|
* Action to set the shading field for a resource
|
||||||
|
@ -133,6 +138,10 @@ public class ShadedAction extends AbstractRightClickAction implements
|
||||||
aci.fill(menu, -1);
|
aci.fill(menu, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
new Separator().fill(menu, -1);
|
||||||
|
|
||||||
|
aci = new ActionContributionItem(new SetAlphaInternalAction());
|
||||||
|
aci.fill(menu, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SetShadingInternalAction extends Action {
|
private class SetShadingInternalAction extends Action {
|
||||||
|
@ -161,9 +170,9 @@ public class ShadedAction extends AbstractRightClickAction implements
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
getTopMostSelectedResource().getCapability(
|
AbstractVizResource<?, ?> rsc = getTopMostSelectedResource();
|
||||||
ShadeableCapability.class).setShadingField(field);
|
rsc.getCapability(ShadeableCapability.class).setShadingField(field);
|
||||||
getContainer().refresh();
|
rsc.issueRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -185,4 +194,34 @@ public class ShadedAction extends AbstractRightClickAction implements
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SetAlphaInternalAction extends Action {
|
||||||
|
|
||||||
|
public SetAlphaInternalAction() {
|
||||||
|
super("Set Opacity", Action.AS_PUSH_BUTTON);
|
||||||
|
String currentField = getTopMostSelectedResource().getCapability(
|
||||||
|
ShadeableCapability.class).getShadingField();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText() {
|
||||||
|
int opacity = (int) (getTopMostSelectedResource().getCapability(
|
||||||
|
ShadeableCapability.class).getOpacity() * 100);
|
||||||
|
return String.format("Set Opacity (%d%%)", opacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.jface.action.Action#run()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AbstractVizResource<?, ?> rsc = getTopMostSelectedResource();
|
||||||
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
|
.getShell();
|
||||||
|
SetOpacityDialog dlg = new SetOpacityDialog(shell, rsc);
|
||||||
|
dlg.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.viz.ui.dialogs;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
|
import org.eclipse.swt.events.PaintListener;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
import org.eclipse.swt.graphics.GC;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Canvas;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Scale;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.capabilities.ShadeableCapability;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO Add Description
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Dec 4, 2012 randerso Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author randerso
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SetOpacityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
|
private AbstractVizResource<?, ?> resource;
|
||||||
|
|
||||||
|
private float originalOpacity;
|
||||||
|
|
||||||
|
private float opacity;
|
||||||
|
|
||||||
|
public SetOpacityDialog(Shell parentShell, AbstractVizResource<?, ?> rsc) {
|
||||||
|
super(parentShell);
|
||||||
|
this.resource = rsc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configureShell(Shell newShell) {
|
||||||
|
super.configureShell(newShell);
|
||||||
|
newShell.setText("Set Opacity");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
Composite comp = (Composite) super.createDialogArea(parent);
|
||||||
|
GridLayout layout = (GridLayout) comp.getLayout();
|
||||||
|
layout.numColumns = 1;
|
||||||
|
layout.makeColumnsEqualWidth = false;
|
||||||
|
|
||||||
|
final Canvas canvas = new Canvas(comp, SWT.BORDER);
|
||||||
|
GridData layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
|
layoutData.heightHint = 50;
|
||||||
|
canvas.setLayoutData(layoutData);
|
||||||
|
canvas.addPaintListener(new PaintListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paintControl(PaintEvent e) {
|
||||||
|
repaintCanvas(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Scale scale = new Scale(comp, SWT.HORIZONTAL);
|
||||||
|
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
|
layoutData.widthHint = 200;
|
||||||
|
scale.setLayoutData(layoutData);
|
||||||
|
scale.setMinimum(0);
|
||||||
|
scale.setMaximum(100);
|
||||||
|
opacity = originalOpacity = resource.getCapability(
|
||||||
|
ShadeableCapability.class).getOpacity();
|
||||||
|
|
||||||
|
scale.setSelection((int) (originalOpacity * 100));
|
||||||
|
|
||||||
|
final Label label = new Label(comp, SWT.CENTER);
|
||||||
|
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
|
GC gc = new GC(label.getDisplay());
|
||||||
|
gc.setFont(label.getFont());
|
||||||
|
layoutData.widthHint = gc.stringExtent("100%").x;
|
||||||
|
gc.dispose();
|
||||||
|
label.setLayoutData(layoutData);
|
||||||
|
label.setText(scale.getSelection() + "%");
|
||||||
|
|
||||||
|
scale.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
Scale scale = (Scale) e.widget;
|
||||||
|
label.setText(scale.getSelection() + "%");
|
||||||
|
opacity = scale.getSelection() / 100.0f;
|
||||||
|
resource.getCapability(ShadeableCapability.class).setOpacity(
|
||||||
|
opacity);
|
||||||
|
resource.issueRefresh();
|
||||||
|
canvas.redraw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return comp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void repaintCanvas(PaintEvent e) {
|
||||||
|
Canvas canvas = (Canvas) e.widget;
|
||||||
|
GC gc = e.gc;
|
||||||
|
Rectangle rect1 = canvas.getClientArea();
|
||||||
|
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
gc.fillRectangle(rect1);
|
||||||
|
|
||||||
|
Rectangle rect2 = new Rectangle(rect1.x + rect1.width / 2, rect1.y,
|
||||||
|
rect1.width / 2, rect1.height);
|
||||||
|
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
|
||||||
|
gc.fillRectangle(rect2);
|
||||||
|
|
||||||
|
RGB rgb;
|
||||||
|
if (resource.hasCapability(ColorableCapability.class)) {
|
||||||
|
rgb = resource.getCapability(ColorableCapability.class).getColor();
|
||||||
|
} else {
|
||||||
|
rgb = new RGB(0, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
Color color = new Color(gc.getDevice(), rgb);
|
||||||
|
gc.setBackground(color);
|
||||||
|
gc.setAlpha((int) (opacity * 255));
|
||||||
|
gc.fillRectangle(rect1);
|
||||||
|
color.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void cancelPressed() {
|
||||||
|
resource.getCapability(ShadeableCapability.class).setOpacity(
|
||||||
|
originalOpacity);
|
||||||
|
resource.issueRefresh();
|
||||||
|
super.cancelPressed();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue