VLab Issue #5413 - Changes for PGEN in D2D fourth try
Change-Id: Iec34f20209748a661ee07d2960bd79132233cf1a Former-commit-id:5fc47fb52d
[formerly5fc47fb52d
[formerly 4d15f42f935cd71c1962292ecfacabfe49127027]] Former-commit-id:fe2010b4ec
Former-commit-id:5e5ddae357
This commit is contained in:
parent
78160d7106
commit
c32bc7a6a1
8 changed files with 298 additions and 54 deletions
|
@ -7,18 +7,32 @@
|
||||||
*/
|
*/
|
||||||
package gov.noaa.nws.ncep.ui.pgen;
|
package gov.noaa.nws.ncep.ui.pgen;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil.PgenMode;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
|
||||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.controls.PgenCommandManager;
|
import gov.noaa.nws.ncep.ui.pgen.controls.PgenCommandManager;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.filter.CategoryFilter;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow;
|
import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData;
|
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool;
|
||||||
|
|
||||||
//import gov.noaa.nws.ncep.viz.ui.display.NmapUiUtils;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.ui.IPartListener2;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
|
import org.eclipse.ui.IViewReference;
|
||||||
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchPartReference;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.internal.WorkbenchPage;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
|
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||||
|
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
||||||
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
|
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This singleton is intended to couple a PGEN Palette with a PGgenResource, so
|
* This singleton is intended to couple a PGEN Palette with a PGgenResource, so
|
||||||
|
@ -27,7 +41,21 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData;
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PgenSession {
|
|
||||||
|
/**
|
||||||
|
* Implements a drawing layer for PGEN products.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* 12/14 R5413 B. Yin Added IPartListener2 and IRenderableDisplayChangedListener
|
||||||
|
* to make the swapping in D2D work
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PgenSession implements IPartListener2,
|
||||||
|
IRenderableDisplayChangedListener {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The singleton instance
|
* The singleton instance
|
||||||
|
@ -45,6 +73,12 @@ public class PgenSession {
|
||||||
private PgenPaletteWindow palette = null;
|
private PgenPaletteWindow palette = null;
|
||||||
|
|
||||||
private List<AbstractEditor> editors = new ArrayList<AbstractEditor>();
|
private List<AbstractEditor> editors = new ArrayList<AbstractEditor>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Active PGEN tool
|
||||||
|
*/
|
||||||
|
private AbstractPgenTool pgenTool = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hide default constructor
|
* Hide default constructor
|
||||||
*/
|
*/
|
||||||
|
@ -80,8 +114,9 @@ public class PgenSession {
|
||||||
// set new PGEN resource
|
// set new PGEN resource
|
||||||
pgenResource = rsc;
|
pgenResource = rsc;
|
||||||
// add the palette's stack listener to new resource's command Manager
|
// add the palette's stack listener to new resource's command Manager
|
||||||
if (pgenResource != null)
|
if (pgenResource != null && palette != null) {
|
||||||
pgenResource.getCommandMgr().addStackListener(palette);
|
pgenResource.getCommandMgr().addStackListener(palette);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,8 +190,9 @@ public class PgenSession {
|
||||||
palette = pal;
|
palette = pal;
|
||||||
// Register this palette's stack listener with the CommandManager, if
|
// Register this palette's stack listener with the CommandManager, if
|
||||||
// able
|
// able
|
||||||
if (pgenResource != null)
|
if (pgenResource != null) {
|
||||||
pgenResource.getCommandMgr().addStackListener(palette);
|
pgenResource.getCommandMgr().addStackListener(palette);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,13 +233,194 @@ public class PgenSession {
|
||||||
public PgenPaletteWindow getPgenPalette() {
|
public PgenPaletteWindow getPgenPalette() {
|
||||||
return palette;
|
return palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEditor(AbstractEditor editor){
|
public void addEditor(AbstractEditor editor) {
|
||||||
editors.add(editor);
|
editors.add(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AbstractEditor> getEditors(){
|
public List<AbstractEditor> getEditors() {
|
||||||
return editors;
|
return editors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove PGEN handler when swapping to side view. Also open PGEN palette if
|
||||||
|
* there is a PGEN resource when swapping to main editor.
|
||||||
|
*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.uf.viz.core.IRenderableDisplayChangedListener#
|
||||||
|
* renderableDisplayChanged(com.raytheon.uf.viz.core.IDisplayPane,
|
||||||
|
* com.raytheon.uf.viz.core.drawables.IRenderableDisplay,
|
||||||
|
* com.raytheon.uf.viz
|
||||||
|
* .core.IRenderableDisplayChangedListener.DisplayChangeType)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
|
@Override
|
||||||
|
public void renderableDisplayChanged(IDisplayPane pane,
|
||||||
|
IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
|
||||||
|
|
||||||
|
if (type == DisplayChangeType.ADD
|
||||||
|
&& newRenderableDisplay.getContainer() instanceof VizMapEditor) {
|
||||||
|
|
||||||
|
VizMapEditor editorChanged = (VizMapEditor) newRenderableDisplay
|
||||||
|
.getContainer();
|
||||||
|
|
||||||
|
if (PgenUtil.getPgenMode() == PgenMode.SINGLE) { // for D2d
|
||||||
|
// swapping, single
|
||||||
|
// pane mode
|
||||||
|
if (pgenResource != null) {
|
||||||
|
pgenResource.removeGhostLine();
|
||||||
|
pgenResource.removeSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
else { // for D2d swapping, multi-pane mode
|
||||||
|
|
||||||
|
// clean up current pgen resource
|
||||||
|
if (pgenResource != null) {
|
||||||
|
pgenResource.closeDialogs();
|
||||||
|
pgenResource.deactivatePgenTools();
|
||||||
|
pgenResource.getCommandMgr().removeStackListener(palette);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (palette != null) {
|
||||||
|
if (PgenUtil.findPgenResource(editorChanged) == null) {
|
||||||
|
// editor does not have PGEN, close the palette
|
||||||
|
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
|
.getActivePage().hideView(palette);
|
||||||
|
palette = null;
|
||||||
|
} else {
|
||||||
|
// editor has PGEN resource, reset to selecting mode
|
||||||
|
pgenResource = PgenUtil.findPgenResource(editorChanged);
|
||||||
|
pgenResource.setCatFilter(new CategoryFilter("Any"));
|
||||||
|
palette.setCurrentCategory("Any");
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// palette is closed
|
||||||
|
if (PgenUtil.findPgenResource(editorChanged) != null) {
|
||||||
|
// editor has PGEN, open the palette
|
||||||
|
IWorkbenchPage wpage = PlatformUI.getWorkbench()
|
||||||
|
.getActiveWorkbenchWindow().getActivePage();
|
||||||
|
|
||||||
|
IViewPart vpart = wpage.findView(PgenUtil.VIEW_ID);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (vpart == null) {
|
||||||
|
|
||||||
|
vpart = wpage.showView(PgenUtil.VIEW_ID);
|
||||||
|
IViewReference pgenViewRef = wpage
|
||||||
|
.findViewReference(PgenUtil.VIEW_ID);
|
||||||
|
if (pgenViewRef != null
|
||||||
|
&& wpage instanceof WorkbenchPage) {
|
||||||
|
((WorkbenchPage) wpage)
|
||||||
|
.detachView(pgenViewRef);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!wpage.isPartVisible(vpart)) {
|
||||||
|
vpart = wpage.showView(PgenUtil.VIEW_ID);
|
||||||
|
IViewReference pgenViewRef = wpage
|
||||||
|
.findViewReference(PgenUtil.VIEW_ID);
|
||||||
|
if (pgenViewRef != null
|
||||||
|
&& wpage instanceof WorkbenchPage) {
|
||||||
|
((WorkbenchPage) wpage)
|
||||||
|
.detachView(pgenViewRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.pgenResource = PgenUtil
|
||||||
|
.findPgenResource(editorChanged);
|
||||||
|
this.pgenResource.setCatFilter(new CategoryFilter(
|
||||||
|
"Any"));
|
||||||
|
this.palette.setCurrentCategory("Any");
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (type == DisplayChangeType.REMOVE
|
||||||
|
&& !(newRenderableDisplay.getContainer() instanceof AbstractEditor)) {
|
||||||
|
// remove to side view
|
||||||
|
// unregister pgen handlers
|
||||||
|
|
||||||
|
if (newRenderableDisplay.getContainer() instanceof IMultiPaneEditor) {
|
||||||
|
IMultiPaneEditor sideView = (IMultiPaneEditor) newRenderableDisplay
|
||||||
|
.getContainer();
|
||||||
|
if (this.getPgenTool() != null) {
|
||||||
|
sideView.unregisterMouseHandler(this.getPgenTool()
|
||||||
|
.getMouseHandler());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partActivated(IWorkbenchPartReference partRef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partBroughtToTop(IWorkbenchPartReference partRef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partClosed(IWorkbenchPartReference partRef) {
|
||||||
|
IWorkbenchPart part = partRef.getPart(false);
|
||||||
|
if (part instanceof VizMapEditor) { // for D2D
|
||||||
|
if (PgenUtil.findPgenResource((VizMapEditor) part) != null) {
|
||||||
|
((VizMapEditor) part)
|
||||||
|
.removeRenderableDisplayChangedListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partDeactivated(IWorkbenchPartReference partRef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partOpened(IWorkbenchPartReference partRef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partHidden(IWorkbenchPartReference partRef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partVisible(IWorkbenchPartReference partRef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partInputChanged(IWorkbenchPartReference partRef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractPgenTool getPgenTool() {
|
||||||
|
return pgenTool;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPgenTool(AbstractPgenTool pgenTool) {
|
||||||
|
this.pgenTool = pgenTool;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,7 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine;
|
||||||
* 05/14 TTR998 J. Wu Added pixelToLatlon().
|
* 05/14 TTR998 J. Wu Added pixelToLatlon().
|
||||||
* 07/14 Chin Chen In latlonToPixel(), make sure not to add null pixel to its return pixel array
|
* 07/14 Chin Chen In latlonToPixel(), make sure not to add null pixel to its return pixel array
|
||||||
* 08/14 TTR962 J. Wu Add replaceWithDate to format output file with DD, MM, YYYY, HH.
|
* 08/14 TTR962 J. Wu Add replaceWithDate to format output file with DD, MM, YYYY, HH.
|
||||||
|
* 12/14 R5413 B. Yin Add a listener for D2D swapping pane
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
|
@ -685,9 +686,15 @@ public class PgenUtil {
|
||||||
AbstractEditor editor = getActiveEditor();
|
AbstractEditor editor = getActiveEditor();
|
||||||
if (editor != null) {
|
if (editor != null) {
|
||||||
try {
|
try {
|
||||||
if ( editor instanceof VizMapEditor || PgenUtil.isNatlCntrsEditor(editor)){
|
if (PgenUtil.isNatlCntrsEditor(editor)){
|
||||||
PgenSession.getInstance().addEditor(editor);
|
PgenSession.getInstance().addEditor(editor);
|
||||||
}
|
}
|
||||||
|
else if (editor instanceof VizMapEditor ){
|
||||||
|
//Add a listener for D2d to make the swap work.
|
||||||
|
PgenSession.getInstance().addEditor(editor);
|
||||||
|
editor.addRenderableDisplayChangedListener(PgenSession.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
switch (getPgenMode()) {
|
switch (getPgenMode()) {
|
||||||
case SINGLE:
|
case SINGLE:
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -64,6 +64,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
* 03/13 #928 B. Yin Make the button bar smaller.
|
* 03/13 #928 B. Yin Make the button bar smaller.
|
||||||
* 04/13 #874 B. Yin Handle collection when OK is pressed for multi-selection.
|
* 04/13 #874 B. Yin Handle collection when OK is pressed for multi-selection.
|
||||||
* 04/13 TTR399 J. Wu Make the dialog compact
|
* 04/13 TTR399 J. Wu Make the dialog compact
|
||||||
|
* 12/14 R5413 B. Yin Refresh editor after dialog close
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -156,6 +157,7 @@ public abstract class AttrDlg extends Dialog implements IAttribute {
|
||||||
public void handleShellCloseEvent() {
|
public void handleShellCloseEvent() {
|
||||||
drawingLayer.removeSelected();
|
drawingLayer.removeSelected();
|
||||||
drawingLayer.removeGhostLine();
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
super.handleShellCloseEvent();
|
super.handleShellCloseEvent();
|
||||||
PgenUtil.setSelectingMode();
|
PgenUtil.setSelectingMode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
|
||||||
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
|
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
|
||||||
* 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea.
|
* 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea.
|
||||||
* 08/14 ? B. Yin Fixed world wrap for TCM track and zero circle issues.
|
* 08/14 ? B. Yin Fixed world wrap for TCM track and zero circle issues.
|
||||||
|
* 12/14 R5413 B. Yin Dispose image and font in find*Ranges methods
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
|
@ -5910,6 +5911,10 @@ public class DisplayElementFactory {
|
||||||
List<Coordinate> textPos = new ArrayList<Coordinate>();
|
List<Coordinate> textPos = new ArrayList<Coordinate>();
|
||||||
textPos.add(new Coordinate(loc[0], loc[1]));
|
textPos.add(new Coordinate(loc[0], loc[1]));
|
||||||
|
|
||||||
|
if ( font != null ){
|
||||||
|
font.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
return new PgenRangeRecord(rngBox, textPos, false);
|
return new PgenRangeRecord(rngBox, textPos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5983,6 +5988,10 @@ public class DisplayElementFactory {
|
||||||
List<Coordinate> symPos = new ArrayList<Coordinate>();
|
List<Coordinate> symPos = new ArrayList<Coordinate>();
|
||||||
symPos.add(sym.getLocation());
|
symPos.add(sym.getLocation());
|
||||||
|
|
||||||
|
if ( pic != null ){
|
||||||
|
pic.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
return new PgenRangeRecord(rngBox, symPos, false);
|
return new PgenRangeRecord(rngBox, symPos, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,8 @@ import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
import org.eclipse.swt.events.ShellEvent;
|
|
||||||
import org.eclipse.swt.events.ShellListener;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.graphics.ImageData;
|
import org.eclipse.swt.graphics.ImageData;
|
||||||
import org.eclipse.swt.graphics.Point;
|
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
@ -64,9 +61,6 @@ import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IEditorPart;
|
import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.IPartListener2;
|
import org.eclipse.ui.IPartListener2;
|
||||||
import org.eclipse.ui.IPropertyListener;
|
|
||||||
import org.eclipse.ui.IViewPart;
|
|
||||||
import org.eclipse.ui.IViewReference;
|
|
||||||
import org.eclipse.ui.IViewSite;
|
import org.eclipse.ui.IViewSite;
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
@ -76,15 +70,14 @@ import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.commands.ICommandService;
|
import org.eclipse.ui.commands.ICommandService;
|
||||||
import org.eclipse.ui.contexts.IContextActivation;
|
import org.eclipse.ui.contexts.IContextActivation;
|
||||||
import org.eclipse.ui.contexts.IContextService;
|
import org.eclipse.ui.contexts.IContextService;
|
||||||
import org.eclipse.ui.internal.WorkbenchPage;
|
|
||||||
import org.eclipse.ui.part.ViewPart;
|
import org.eclipse.ui.part.ViewPart;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
|
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||||
import com.raytheon.viz.ui.EditorUtil;
|
|
||||||
import com.raytheon.viz.ui.UiUtil;
|
import com.raytheon.viz.ui.UiUtil;
|
||||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
|
@ -92,7 +85,6 @@ import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener;
|
||||||
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
import com.raytheon.viz.ui.tools.AbstractModalTool;
|
import com.raytheon.viz.ui.tools.AbstractModalTool;
|
||||||
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PGEN View is used for all interaction with the objects in the PGEN
|
* The PGEN View is used for all interaction with the objects in the PGEN
|
||||||
|
@ -242,7 +234,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
|
|
||||||
page = site.getPage();
|
page = site.getPage();
|
||||||
page.addPartListener(this);
|
page.addPartListener(this);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a list from registry of all elements that registered with the
|
* Get a list from registry of all elements that registered with the
|
||||||
* gov.noaa.nws.ncep.ui.pgen.palette extension point
|
* gov.noaa.nws.ncep.ui.pgen.palette extension point
|
||||||
|
@ -584,10 +576,10 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
/*
|
/*
|
||||||
* Force a resize
|
* Force a resize
|
||||||
*/
|
*/
|
||||||
Rectangle r = scroll.getClientArea();
|
Rectangle r = scroll.getClientArea();
|
||||||
paletteComp.setSize(paletteComp.computeSize(r.width, SWT.DEFAULT));
|
paletteComp.setSize(paletteComp.computeSize(r.width, SWT.DEFAULT));
|
||||||
paletteComp.layout();
|
paletteComp.layout();
|
||||||
|
|
||||||
// wait for buttons to be created
|
// wait for buttons to be created
|
||||||
disableUndoRedo();
|
disableUndoRedo();
|
||||||
}
|
}
|
||||||
|
@ -884,8 +876,9 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
|
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
|
||||||
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
|
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
|
||||||
|
|
||||||
// if ( PgenSession.getInstance().getPgenResource().getDescriptor() != )
|
// if ( PgenSession.getInstance().getPgenResource().getDescriptor()
|
||||||
|
// != )
|
||||||
|
|
||||||
if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) {
|
if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) {
|
||||||
rsc = PgenUtil.createNewResource();
|
rsc = PgenUtil.createNewResource();
|
||||||
}
|
}
|
||||||
|
@ -905,16 +898,9 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
PgenUtil.addSelectedPaneChangedListener(editor, this);
|
PgenUtil.addSelectedPaneChangedListener(editor, this);
|
||||||
}
|
}
|
||||||
activatePGENContext();
|
activatePGENContext();
|
||||||
} else if (part instanceof VizMapEditor) {
|
} else if (part instanceof PgenPaletteWindow) {
|
||||||
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
|
|
||||||
if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) {
|
|
||||||
rsc = PgenUtil.createNewResource();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (part instanceof PgenPaletteWindow) {
|
|
||||||
activatePGENContext();
|
activatePGENContext();
|
||||||
|
|
||||||
// found NCMapEditor
|
// found NCMapEditor
|
||||||
// AbstractEditor editor = NmapUiUtils.getActiveNatlCntrsEditor();
|
// AbstractEditor editor = NmapUiUtils.getActiveNatlCntrsEditor();
|
||||||
AbstractEditor editor = PgenUtil.getActiveEditor();
|
AbstractEditor editor = PgenUtil.getActiveEditor();
|
||||||
|
@ -951,7 +937,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
// );
|
// );
|
||||||
partActivated(partRef);
|
partActivated(partRef);
|
||||||
|
|
||||||
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor ) {
|
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
|
||||||
AbstractEditor editor = (AbstractEditor) part;
|
AbstractEditor editor = (AbstractEditor) part;
|
||||||
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
|
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
|
||||||
|
|
||||||
|
@ -1000,11 +986,12 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
* list in reverse so that active editor is processed last.
|
* list in reverse so that active editor is processed last.
|
||||||
*/
|
*/
|
||||||
for (int i = editors.length - 1; i >= 0; i--) {
|
for (int i = editors.length - 1; i >= 0; i--) {
|
||||||
// unloadPgenResource(editors[i]);
|
// unloadPgenResource(editors[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractEditor editor : PgenSession.getInstance().getEditors() ){
|
for (AbstractEditor editor : PgenSession.getInstance()
|
||||||
unloadPgenResource(editor);
|
.getEditors()) {
|
||||||
|
unloadPgenResource(editor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1083,8 +1070,8 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
IWorkbenchPart part = partRef.getPart(false);
|
IWorkbenchPart part = partRef.getPart(false);
|
||||||
// System.out.println("Something Hidden: "+part.getClass().getCanonicalName()
|
// System.out.println("Something Hidden: "+part.getClass().getCanonicalName()
|
||||||
// );
|
// );
|
||||||
|
|
||||||
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
|
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
|
||||||
PgenResource pgen = PgenUtil
|
PgenResource pgen = PgenUtil
|
||||||
.findPgenResource((AbstractEditor) part);
|
.findPgenResource((AbstractEditor) part);
|
||||||
if (pgen != null) {
|
if (pgen != null) {
|
||||||
|
@ -1433,4 +1420,13 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
public String getCurrentObject() {
|
public String getCurrentObject() {
|
||||||
return currentObject;
|
return currentObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the category and its icon.
|
||||||
|
*/
|
||||||
|
public void setCurrentCategory(String currentCategory) {
|
||||||
|
this.resetIcon(this.currentCategory);
|
||||||
|
this.currentCategory = currentCategory;
|
||||||
|
this.setActiveIcon(currentCategory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ import gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement;
|
import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.tca.TropicalCycloneAdvisory;
|
import gov.noaa.nws.ncep.ui.pgen.tca.TropicalCycloneAdvisory;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool;
|
import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.tools.InputHandlerDefaultImpl;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.tools.PgenSnapJet;
|
import gov.noaa.nws.ncep.ui.pgen.tools.PgenSnapJet;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
@ -76,14 +77,18 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||||
import com.raytheon.viz.core.gl.IGLTarget;
|
import com.raytheon.viz.core.gl.IGLTarget;
|
||||||
import com.raytheon.viz.ui.cmenu.IContextMenuProvider;
|
import com.raytheon.viz.ui.cmenu.IContextMenuProvider;
|
||||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
|
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
||||||
import com.raytheon.viz.ui.input.EditableManager;
|
import com.raytheon.viz.ui.input.EditableManager;
|
||||||
|
import com.raytheon.viz.ui.panes.PaneManager;
|
||||||
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
import com.raytheon.viz.ui.tools.AbstractModalTool;
|
import com.raytheon.viz.ui.tools.AbstractModalTool;
|
||||||
|
@ -144,6 +149,7 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* 04/13 #874 B. Yin Added a method replaceElements with parameter parent.
|
* 04/13 #874 B. Yin Added a method replaceElements with parameter parent.
|
||||||
* 04/13 #977 S. Gilbert PGEN Database support
|
* 04/13 #977 S. Gilbert PGEN Database support
|
||||||
* 11/13 TTR 752 J. Wu Add methods for CCFP text auto placement.
|
* 11/13 TTR 752 J. Wu Add methods for CCFP text auto placement.
|
||||||
|
* 11/14 R5413 B. Yin Display PGEN in side view in D2D
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author B. Yin
|
* @author B. Yin
|
||||||
|
@ -359,9 +365,9 @@ public class PgenResource extends
|
||||||
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
|
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
|
||||||
throws VizException {
|
throws VizException {
|
||||||
IDisplayPaneContainer editor = getResourceContainer();
|
IDisplayPaneContainer editor = getResourceContainer();
|
||||||
if (editor instanceof AbstractEditor) {// && ((NCMapEditor)
|
|
||||||
// editor).getApplicationName().equals("NA")
|
//Draw in main editor and side view (IMultiPaneEditor)
|
||||||
// ) {
|
if (editor instanceof AbstractEditor || editor instanceof IMultiPaneEditor) {
|
||||||
DisplayElementFactory df = new DisplayElementFactory(target,
|
DisplayElementFactory df = new DisplayElementFactory(target,
|
||||||
descriptor);
|
descriptor);
|
||||||
|
|
||||||
|
@ -677,7 +683,7 @@ public class PgenResource extends
|
||||||
|
|
||||||
private void drawSelected(IGraphicsTarget target, PaintProperties paintProps) {
|
private void drawSelected(IGraphicsTarget target, PaintProperties paintProps) {
|
||||||
|
|
||||||
if (!elSelected.isEmpty()) {
|
if ( !elSelected.isEmpty() && PgenSession.getInstance().getPgenPalette() != null ) {
|
||||||
DisplayElementFactory df = new DisplayElementFactory(target,
|
DisplayElementFactory df = new DisplayElementFactory(target,
|
||||||
descriptor);
|
descriptor);
|
||||||
List<IDisplayable> displayEls = new ArrayList<IDisplayable>();
|
List<IDisplayable> displayEls = new ArrayList<IDisplayable>();
|
||||||
|
|
|
@ -33,6 +33,7 @@ import com.raytheon.viz.ui.tools.AbstractModalTool;
|
||||||
* 12/13 TTR899 J. Wu Set delObjFlag to false when any Pgen Action
|
* 12/13 TTR899 J. Wu Set delObjFlag to false when any Pgen Action
|
||||||
* button is clicked
|
* button is clicked
|
||||||
* 04/2014 TTR900 pswamy R-click cannot return to SELECT from Rotate and DEL_OBJ
|
* 04/2014 TTR900 pswamy R-click cannot return to SELECT from Rotate and DEL_OBJ
|
||||||
|
* 12/2014 R5413 B. Yin Set PGEN tool in PGEN session
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -79,8 +80,8 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
|
||||||
PgenSession.getInstance().getPgenPalette().setActiveIcon(buttonName);
|
PgenSession.getInstance().getPgenPalette().setActiveIcon(buttonName);
|
||||||
|
|
||||||
// Get a PGEN Resource
|
// Get a PGEN Resource
|
||||||
// drawingLayer = PgenSession.getInstance().getPgenResource();
|
drawingLayer = PgenSession.getInstance().getPgenResource();
|
||||||
drawingLayer = PgenUtil.findPgenResource(PgenUtil.getActiveEditor());
|
|
||||||
|
|
||||||
if (this instanceof PgenDeleteObj) {
|
if (this instanceof PgenDeleteObj) {
|
||||||
delObjFlag = true;
|
delObjFlag = true;
|
||||||
|
@ -103,11 +104,14 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inputHandler = getMouseHandler();
|
this.inputHandler = getMouseHandler();
|
||||||
if (this.inputHandler != null)
|
if (this.inputHandler != null){
|
||||||
mapEditor.registerMouseHandler(this.inputHandler);
|
mapEditor.registerMouseHandler(this.inputHandler);
|
||||||
|
}
|
||||||
|
|
||||||
// Turn off, so tool doesn't exihibit toggle behavior
|
// Turn off, so tool doesn't exihibit toggle behavior
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
|
||||||
|
PgenSession.getInstance().setPgenTool(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public IInputHandler getMouseHandler();
|
abstract public IInputHandler getMouseHandler();
|
||||||
|
@ -131,9 +135,11 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapEditor != null && this.inputHandler != null)
|
if (mapEditor != null && this.inputHandler != null){
|
||||||
mapEditor.unregisterMouseHandler(this.inputHandler);
|
mapEditor.unregisterMouseHandler(this.inputHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
PgenSession.getInstance().setPgenTool(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -261,6 +261,7 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
.getShell()).setWatchBox((WatchBox) elSelected);
|
.getShell()).setWatchBox((WatchBox) elSelected);
|
||||||
PgenUtil.loadWatchBoxModifyTool(elSelected);
|
PgenUtil.loadWatchBoxModifyTool(elSelected);
|
||||||
|
return false;
|
||||||
} else if (elSelected instanceof Tcm) {
|
} else if (elSelected instanceof Tcm) {
|
||||||
PgenUtil.loadTcmTool(elSelected);
|
PgenUtil.loadTcmTool(elSelected);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue