Merge "Issue #1395 Updated SetOpacityDialog. Added source jars for geoapi. Removed legacy shapefile import menu item." into development
Former-commit-id:e49ea6c147
[formerly6f79ba14e6
] [formerlyc17e0a19c9
[formerly 6e0bfe56d437622b9c5f6e3d4d8d9c0192fc5a46]] Former-commit-id:c17e0a19c9
Former-commit-id:cb4721ae15
This commit is contained in:
commit
bf7960b5f9
4 changed files with 82 additions and 32 deletions
|
@ -45,6 +45,7 @@
|
||||||
commandId="com.raytheon.viz.shapefile.shapefileImport">
|
commandId="com.raytheon.viz.shapefile.shapefileImport">
|
||||||
</handler>
|
</handler>
|
||||||
</extension>
|
</extension>
|
||||||
|
<!--
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.menus">
|
point="org.eclipse.ui.menus">
|
||||||
<menuContribution
|
<menuContribution
|
||||||
|
@ -56,5 +57,6 @@
|
||||||
</command>
|
</command>
|
||||||
</menuContribution>
|
</menuContribution>
|
||||||
</extension>
|
</extension>
|
||||||
|
-->
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -24,14 +24,17 @@ 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.jface.action.Separator;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
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.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
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;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ShadeableCapability;
|
||||||
import com.raytheon.viz.ui.dialogs.SetOpacityDialog;
|
import com.raytheon.viz.ui.dialogs.SetOpacityDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.SetOpacityDialog.IOpacityChangedListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to set the shading field for a resource
|
* Action to set the shading field for a resource
|
||||||
|
@ -217,10 +220,25 @@ public class ShadedAction extends AbstractRightClickAction implements
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AbstractVizResource<?, ?> rsc = getTopMostSelectedResource();
|
final AbstractVizResource<?, ?> rsc = getTopMostSelectedResource();
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
.getShell();
|
.getShell();
|
||||||
SetOpacityDialog dlg = new SetOpacityDialog(shell, rsc);
|
float opacity = rsc.getCapability(ShadeableCapability.class)
|
||||||
|
.getOpacity();
|
||||||
|
RGB rgb;
|
||||||
|
if (rsc.hasCapability(ColorableCapability.class)) {
|
||||||
|
rgb = rsc.getCapability(ColorableCapability.class).getColor();
|
||||||
|
} else {
|
||||||
|
rgb = new RGB(0, 255, 255);
|
||||||
|
}
|
||||||
|
SetOpacityDialog dlg = new SetOpacityDialog(shell, opacity, rgb);
|
||||||
|
dlg.addOpacityChangedListener(new IOpacityChangedListener() {
|
||||||
|
@Override
|
||||||
|
public void opacityChanged(float opacity) {
|
||||||
|
rsc.getCapability(ShadeableCapability.class).setOpacity(
|
||||||
|
opacity);
|
||||||
|
}
|
||||||
|
});
|
||||||
dlg.open();
|
dlg.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.ui.dialogs;
|
package com.raytheon.viz.ui.dialogs;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.PaintEvent;
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
import org.eclipse.swt.events.PaintListener;
|
import org.eclipse.swt.events.PaintListener;
|
||||||
|
@ -37,10 +38,6 @@ import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Scale;
|
import org.eclipse.swt.widgets.Scale;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
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
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
|
@ -60,15 +57,23 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ShadeableCapability;
|
||||||
|
|
||||||
public class SetOpacityDialog extends CaveJFACEDialog {
|
public class SetOpacityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
private AbstractVizResource<?, ?> resource;
|
public static interface IOpacityChangedListener {
|
||||||
|
public void opacityChanged(float opacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ListenerList listenerList;
|
||||||
|
|
||||||
private float originalOpacity;
|
private float originalOpacity;
|
||||||
|
|
||||||
private float opacity;
|
private float opacity;
|
||||||
|
|
||||||
public SetOpacityDialog(Shell parentShell, AbstractVizResource<?, ?> rsc) {
|
private RGB color;
|
||||||
|
|
||||||
|
public SetOpacityDialog(Shell parentShell, float originalOpacity, RGB color) {
|
||||||
super(parentShell);
|
super(parentShell);
|
||||||
this.resource = rsc;
|
this.opacity = this.originalOpacity = originalOpacity;
|
||||||
|
this.color = color;
|
||||||
|
this.listenerList = new ListenerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,8 +108,6 @@ public class SetOpacityDialog extends CaveJFACEDialog {
|
||||||
scale.setLayoutData(layoutData);
|
scale.setLayoutData(layoutData);
|
||||||
scale.setMinimum(0);
|
scale.setMinimum(0);
|
||||||
scale.setMaximum(100);
|
scale.setMaximum(100);
|
||||||
opacity = originalOpacity = resource.getCapability(
|
|
||||||
ShadeableCapability.class).getOpacity();
|
|
||||||
|
|
||||||
scale.setSelection((int) (originalOpacity * 100));
|
scale.setSelection((int) (originalOpacity * 100));
|
||||||
|
|
||||||
|
@ -124,10 +127,9 @@ public class SetOpacityDialog extends CaveJFACEDialog {
|
||||||
Scale scale = (Scale) e.widget;
|
Scale scale = (Scale) e.widget;
|
||||||
label.setText(scale.getSelection() + "%");
|
label.setText(scale.getSelection() + "%");
|
||||||
opacity = scale.getSelection() / 100.0f;
|
opacity = scale.getSelection() / 100.0f;
|
||||||
resource.getCapability(ShadeableCapability.class).setOpacity(
|
|
||||||
opacity);
|
|
||||||
resource.issueRefresh();
|
|
||||||
canvas.redraw();
|
canvas.redraw();
|
||||||
|
|
||||||
|
fireListeners(opacity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -141,19 +143,15 @@ public class SetOpacityDialog extends CaveJFACEDialog {
|
||||||
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK));
|
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK));
|
||||||
gc.fillRectangle(rect1);
|
gc.fillRectangle(rect1);
|
||||||
|
|
||||||
Rectangle rect2 = new Rectangle(rect1.x + rect1.width / 2, rect1.y,
|
int dx = rect1.width / 5;
|
||||||
rect1.width / 2, rect1.height);
|
int dy = rect1.height / 5;
|
||||||
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
|
|
||||||
gc.fillRectangle(rect2);
|
|
||||||
|
|
||||||
RGB rgb;
|
Rectangle rect2 = new Rectangle(rect1.x + dx, rect1.y + dy, rect1.width
|
||||||
if (resource.hasCapability(ColorableCapability.class)) {
|
- 2 * dx, rect1.height - 2 * dy);
|
||||||
rgb = resource.getCapability(ColorableCapability.class).getColor();
|
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
|
||||||
} else {
|
gc.drawRectangle(rect2);
|
||||||
rgb = new RGB(0, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
Color color = new Color(gc.getDevice(), rgb);
|
Color color = new Color(gc.getDevice(), this.color);
|
||||||
gc.setBackground(color);
|
gc.setBackground(color);
|
||||||
gc.setAlpha((int) (opacity * 255));
|
gc.setAlpha((int) (opacity * 255));
|
||||||
gc.fillRectangle(rect1);
|
gc.fillRectangle(rect1);
|
||||||
|
@ -162,9 +160,41 @@ public class SetOpacityDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void cancelPressed() {
|
protected void cancelPressed() {
|
||||||
resource.getCapability(ShadeableCapability.class).setOpacity(
|
opacity = originalOpacity;
|
||||||
originalOpacity);
|
fireListeners(opacity);
|
||||||
resource.issueRefresh();
|
|
||||||
super.cancelPressed();
|
super.cancelPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add listener to be notified when opacity is changed
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void addOpacityChangedListener(IOpacityChangedListener listener) {
|
||||||
|
this.listenerList.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove opacity changed listener
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void removeOpacityChangedListener(IOpacityChangedListener listener) {
|
||||||
|
this.listenerList.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fireListeners(float opacity) {
|
||||||
|
for (Object listener : listenerList.getListeners()) {
|
||||||
|
((IOpacityChangedListener) listener).opacityChanged(opacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get selected opacity
|
||||||
|
*
|
||||||
|
* @return the opacity
|
||||||
|
*/
|
||||||
|
public float getOpacity() {
|
||||||
|
return opacity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
<classpathentry kind="lib" path="commons-lang-2.3.jar"/>
|
<classpathentry kind="lib" path="commons-lang-2.3.jar"/>
|
||||||
<classpathentry kind="lib" path="commons-pool-1.5.3.jar"/>
|
<classpathentry kind="lib" path="commons-pool-1.5.3.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="ecore-2.2.2.jar"/>
|
<classpathentry exported="true" kind="lib" path="ecore-2.2.2.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="geoapi-2.3-M1.jar"/>
|
<classpathentry exported="true" kind="lib" path="geoapi-2.3-M1.jar" sourcepath="geoapi-2.3-M1-sources.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="geoapi-pending-2.3-M1.jar"/>
|
<classpathentry exported="true" kind="lib" path="geoapi-pending-2.3-M1.jar" sourcepath="geoapi-pending-2.3-M1-sources.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-api-2.6.4.jar" sourcepath="gt-api-2.6.4-sources.jar"/>
|
<classpathentry exported="true" kind="lib" path="gt-api-2.6.4.jar" sourcepath="gt-api-2.6.4-sources.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-coverage-2.6.4.jar" sourcepath="gt-coverage-2.6.4-sources.jar"/>
|
<classpathentry exported="true" kind="lib" path="gt-coverage-2.6.4.jar" sourcepath="gt-coverage-2.6.4-sources.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-cql-2.6.4.jar"/>
|
<classpathentry exported="true" kind="lib" path="gt-cql-2.6.4.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-data-2.6.4.jar" sourcepath="gt-data-2.6.4-sources.zip"/>
|
<classpathentry exported="true" kind="lib" path="gt-data-2.6.4.jar" sourcepath="gt-data-2.6.4-sources.zip"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-directory-2.6.4.jar" sourcepath="gt-directory-2.6.4-sources.zip"/>
|
<classpathentry exported="true" kind="lib" path="gt-directory-2.6.4.jar" sourcepath="gt-directory-2.6.4-sources.zip"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-epsg-wkt-2.6.4.jar" sourcepath="gt-epsg-wkt-2.6.4-sources.jar"/>
|
<classpathentry exported="true" kind="lib" path="gt-epsg-wkt-2.6.4.jar" sourcepath="gt-epsg-wkt-2.6.4-sources.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-geotiff-2.6.4.jar" sourcepath="gt-geotiff-2.6.4-sources.jar"/>
|
<classpathentry exported="true" kind="lib" path="gt-geotiff-2.6.4.jar" sourcepath="gt-geotiff-2.6.4-sources.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="gt-graph-2.6.4.jar" sourcepath="gt-graph-2.6.4-sources.jar"/>
|
<classpathentry exported="true" kind="lib" path="gt-graph-2.6.4.jar" sourcepath="gt-graph-2.6.4-sources.jar"/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue