Merge branch 'ncep_14.4.1' of ssh://vlab.ncep.noaa.gov:29418/AWIPS2_Dev_Baseline into master_14.4.1
Former-commit-id:8d4bab98d5
[formerly30859f6ee6
] [formerly1208dbde06
[formerly bc482f433223eee5f9a2fa209e1e33a39d3b3aa8]] Former-commit-id:1208dbde06
Former-commit-id:10c325518c
This commit is contained in:
commit
c8b9377e84
67 changed files with 2682 additions and 1405 deletions
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
<contribute xsi:type="command"
|
<contribute xsi:type="command"
|
||||||
commandId="com.raytheon.viz.awipstools.lapstools"
|
commandId="com.raytheon.viz.awipstools.lapstools"
|
||||||
menuText="LAPS tools..." />
|
menuText="LAPS tools..." id="lapsTools" />
|
||||||
|
|
||||||
<contribute xsi:type="bundleItem" file="bundles/tools/Points.xml"
|
<contribute xsi:type="bundleItem" file="bundles/tools/Points.xml"
|
||||||
menuText="Points" id="pointsTool" timeQuery="false" />
|
menuText="Points" id="pointsTool" timeQuery="false" />
|
||||||
|
|
|
@ -23,3 +23,4 @@ Import-Package: com.vividsolutions.jts.geom,
|
||||||
org.dom4j,
|
org.dom4j,
|
||||||
org.dom4j.io
|
org.dom4j.io
|
||||||
Export-Package: gov.noaa.nws.ncep.staticdataprovider
|
Export-Package: gov.noaa.nws.ncep.staticdataprovider
|
||||||
|
Service-Component: OSGI-INF/staticDataProvider.xml
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<component name="gov.noaa.nws.ncep.staticdataprovider.StaticDataProvider" enabled="true">
|
||||||
|
|
||||||
|
<implementation
|
||||||
|
class="gov.noaa.nws.ncep.staticdataprovider.StaticDataProvider" />
|
||||||
|
<service>
|
||||||
|
<provide interface="gov.noaa.nws.ncep.common.staticdata.IStaticDataProvider" />
|
||||||
|
</service>
|
||||||
|
</component>
|
|
@ -1,4 +1,5 @@
|
||||||
source.. = src/
|
source.. = src/
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.
|
.,\
|
||||||
|
OSGI-INF/
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.staticdataprovider;
|
package gov.noaa.nws.ncep.staticdataprovider;
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.common.staticdata.IStaticDataProvider;
|
|
||||||
|
|
||||||
import org.osgi.framework.BundleActivator;
|
import org.osgi.framework.BundleActivator;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
@ -39,20 +37,22 @@ public class Activator implements BundleActivator {
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
||||||
*/
|
*/
|
||||||
public void start(BundleContext bundleContext) throws Exception {
|
@Override
|
||||||
|
public void start(BundleContext bundleContext) throws Exception {
|
||||||
Activator.context = bundleContext;
|
Activator.context = bundleContext;
|
||||||
|
|
||||||
//Register service
|
//Register service
|
||||||
context.registerService(IStaticDataProvider.class.getName(),
|
// context.registerService(IStaticDataProvider.class.getName(),
|
||||||
StaticDataProvider.getInstance(),
|
// StaticDataProvider.getInstance(),
|
||||||
null);
|
// null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||||
*/
|
*/
|
||||||
public void stop(BundleContext bundleContext) throws Exception {
|
@Override
|
||||||
|
public void stop(BundleContext bundleContext) throws Exception {
|
||||||
Activator.context = null;
|
Activator.context = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class StaticDataProvider implements IStaticDataProvider {
|
||||||
return dataProvider;
|
return dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
private StaticDataProvider() {
|
public StaticDataProvider() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,10 @@ Export-Package: gov.noaa.nws.ncep.ui.pgen,
|
||||||
gov.noaa.nws.ncep.ui.pgen.store,
|
gov.noaa.nws.ncep.ui.pgen.store,
|
||||||
gov.noaa.nws.ncep.ui.pgen.tca,
|
gov.noaa.nws.ncep.ui.pgen.tca,
|
||||||
gov.noaa.nws.ncep.ui.pgen.tools
|
gov.noaa.nws.ncep.ui.pgen.tools
|
||||||
Import-Package: com.raytheon.viz.core.contours.util,
|
Import-Package: com.raytheon.uf.viz.core.maps.display,
|
||||||
|
com.raytheon.viz.core.contours.util,
|
||||||
com.raytheon.viz.core.gl,
|
com.raytheon.viz.core.gl,
|
||||||
com.raytheon.viz.core.gl.images,
|
com.raytheon.viz.core.gl.images,
|
||||||
gov.noaa.nws.ncep.common.staticdata,
|
gov.noaa.nws.ncep.common.staticdata,
|
||||||
javax.measure.unit
|
javax.measure.unit
|
||||||
|
Bundle-ClassPath: .
|
||||||
|
|
|
@ -322,11 +322,6 @@
|
||||||
<handler
|
<handler
|
||||||
class="gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteAction"
|
class="gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteAction"
|
||||||
commandId="gov.noaa.nws.ncep.ui.pgen.palette">
|
commandId="gov.noaa.nws.ncep.ui.pgen.palette">
|
||||||
<enabledWhen>
|
|
||||||
<reference
|
|
||||||
definitionId="gov.noaa.nws.ncep.viz.ui.display.isMapEditor">
|
|
||||||
</reference>
|
|
||||||
</enabledWhen>
|
|
||||||
</handler>
|
</handler>
|
||||||
<handler
|
<handler
|
||||||
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenSinglePointDrawingTool"
|
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenSinglePointDrawingTool"
|
||||||
|
@ -577,15 +572,56 @@
|
||||||
name="NMAP Views"/>
|
name="NMAP Views"/>
|
||||||
<view
|
<view
|
||||||
category="gov.noaa.nws.ncep.viz.ui.nmap"
|
category="gov.noaa.nws.ncep.viz.ui.nmap"
|
||||||
allowMultiple="false"
|
allowMultiple="true"
|
||||||
restorable="true"
|
restorable="true"
|
||||||
class="gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow"
|
class="gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow"
|
||||||
id="gov.noaa.nws.ncep.ui.PGEN"
|
id="gov.noaa.nws.ncep.ui.PGEN"
|
||||||
name="PGEN"/>
|
name="PGEN"/>
|
||||||
|
<!--stickyView
|
||||||
|
closeable="true"
|
||||||
|
id="gov.noaa.nws.ncep.ui.PGEN"
|
||||||
|
location="RIGHT"
|
||||||
|
moveable="true">
|
||||||
|
</stickyView-->
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.menus">
|
point="org.eclipse.ui.menus">
|
||||||
|
<menuContribution locationURI="menu:tools?after=lapsTools">
|
||||||
|
<command
|
||||||
|
commandId="gov.noaa.nws.ncep.ui.pgen.palette"
|
||||||
|
label="PGEN">
|
||||||
|
<visibleWhen>
|
||||||
|
<reference
|
||||||
|
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
||||||
|
</reference>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
|
<!--menuContribution
|
||||||
|
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=plugins">
|
||||||
|
<toolbar
|
||||||
|
id="plugins">
|
||||||
|
<command
|
||||||
|
commandId="gov.noaa.nws.ncep.ui.pgen.palette"
|
||||||
|
label="PGEN">
|
||||||
|
<visibleWhen>
|
||||||
|
<and>
|
||||||
|
<reference
|
||||||
|
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
||||||
|
</reference>
|
||||||
|
<test
|
||||||
|
args="WFO"
|
||||||
|
forcePluginActivation="true"
|
||||||
|
property="com.raytheon.viz.warngen.site.SiteMode">
|
||||||
|
</test>
|
||||||
|
</and>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</toolbar>
|
||||||
|
</menuContribution-->
|
||||||
|
|
||||||
<menuContribution
|
<menuContribution
|
||||||
locationURI="toolbar:gov.noaa.nws.ncep.ui.PGEN">
|
locationURI="toolbar:gov.noaa.nws.ncep.ui.PGEN">
|
||||||
<command
|
<command
|
||||||
|
@ -3390,4 +3426,14 @@
|
||||||
</contextId>
|
</contextId>
|
||||||
</classContext>
|
</classContext>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension point="org.eclipse.ui.perspectiveExtensions">
|
||||||
|
<perspectiveExtension
|
||||||
|
targetID="com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane">
|
||||||
|
<view id="gov.noaa.nws.ncep.ui.PGEN"
|
||||||
|
relative="org.eclipse.ui.editorss"
|
||||||
|
relationship="right"
|
||||||
|
ratio="0.8"
|
||||||
|
visible="false"/>
|
||||||
|
</perspectiveExtension>
|
||||||
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -7,160 +7,478 @@
|
||||||
*/
|
*/
|
||||||
package gov.noaa.nws.ncep.ui.pgen;
|
package gov.noaa.nws.ncep.ui.pgen;
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil.PgenMode;
|
||||||
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.viz.ui.display.NmapUiUtils;
|
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool;
|
||||||
|
|
||||||
|
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.common.status.IUFStatusHandler;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
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.drawables.ResourcePair;
|
||||||
|
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||||
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
|
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
||||||
|
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||||
|
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This singleton is intended to couple a PGEN Palette with a PGgenResource, so that
|
* This singleton is intended to couple a PGEN Palette with a PGgenResource, so
|
||||||
* a palette can be updated and used to modify a specific PgenResource
|
* that a palette can be updated and used to modify a specific PgenResource
|
||||||
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PgenSession {
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* The singleton instance
|
* Implements a drawing layer for PGEN products.
|
||||||
*/
|
*
|
||||||
private static PgenSession instance = null;
|
* <pre>
|
||||||
|
* SOFTWARE HISTORY
|
||||||
/*
|
* Date Ticket# Engineer Description
|
||||||
* the current PGEN resource
|
* ------------ ---------- ----------- --------------------------
|
||||||
*/
|
* 12/14 R5413 B. Yin Added IPartListener2 and IRenderableDisplayChangedListener
|
||||||
private PgenResource pgenResource = null;
|
* to make the swapping in D2D work
|
||||||
|
* 12/14 R5413 B. Yin Added exception handling, perspective id, and endSession.
|
||||||
/*
|
* 01/15 R5413 B. Yin Added closePalette method.
|
||||||
* the current PGEN palette
|
*
|
||||||
*/
|
*/
|
||||||
private PgenPaletteWindow palette = null;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Hide default constructor
|
|
||||||
*/
|
|
||||||
private PgenSession() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static method to get THE PgenSession instance
|
|
||||||
* @return PgenSession reference
|
|
||||||
*/
|
|
||||||
public static synchronized PgenSession getInstance() {
|
|
||||||
|
|
||||||
if ( instance == null ) instance = new PgenSession();
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a PgenResource for the current session
|
|
||||||
* @param rsc a Pgen Resource
|
|
||||||
*/
|
|
||||||
public void setResource(PgenResource rsc) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove the current PGEN Resource from the Session
|
|
||||||
*/
|
|
||||||
removeResource();
|
|
||||||
|
|
||||||
// set new PGEN resource
|
|
||||||
pgenResource = rsc;
|
|
||||||
// add the palette's stack listener to new resource's command Manager
|
|
||||||
if ( pgenResource != null ) pgenResource.getCommandMgr().addStackListener(palette);
|
|
||||||
|
|
||||||
}
|
@SuppressWarnings("restriction")
|
||||||
|
public class PgenSession implements IPartListener2,
|
||||||
/**
|
IRenderableDisplayChangedListener {
|
||||||
* Removes the current PGEN resource from the Session
|
|
||||||
*/
|
|
||||||
public void removeResource() {
|
|
||||||
if ( pgenResource != null ) {
|
|
||||||
//Remove the Palette's stack listener from the Resource's CommandManager
|
|
||||||
pgenResource.getCommandMgr().removeStackListener(palette);
|
|
||||||
}
|
|
||||||
pgenResource = null;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* disable the palette's Undo and redo buttons.
|
|
||||||
*/
|
|
||||||
if ( palette != null ) palette.disableUndoRedo();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an appropriate PGEN Resource. Returns the current Pgen Resource registered with this
|
|
||||||
* PGEN Session if there is one. If not, it will look for an existing resource in the current
|
|
||||||
* editor. If one is not found, a new PgenResource will be created.
|
|
||||||
* @return the rsc
|
|
||||||
*/
|
|
||||||
public PgenResource getPgenResource() {
|
|
||||||
|
|
||||||
if ( pgenResource == null ) {
|
|
||||||
// PgenResource rsc = PgenUtil.findPgenResource(NmapUiUtils.getActiveNatlCntrsEditor());
|
|
||||||
PgenResource rsc = PgenUtil.findPgenResource(PgenUtil.getActiveEditor());
|
|
||||||
if ( rsc != null ) {
|
|
||||||
pgenResource = rsc;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pgenResource = PgenUtil.createNewResource();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pgenResource;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PGEN Resource currently registered with the session
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public PgenResource getCurrentResource() {
|
|
||||||
return pgenResource;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Gets the Resource's Command Manager
|
* The singleton instance
|
||||||
* @return the commandMgr
|
*/
|
||||||
*/
|
private static PgenSession instance = null;
|
||||||
public PgenCommandManager getCommandManager() {
|
|
||||||
return pgenResource.getCommandMgr();
|
/*
|
||||||
}
|
* the current PGEN resource
|
||||||
|
*/
|
||||||
|
private PgenResource pgenResource = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* the current PGEN palette
|
||||||
|
*/
|
||||||
|
private PgenPaletteWindow palette = null;
|
||||||
|
|
||||||
|
private List<AbstractEditor> editors = new ArrayList<AbstractEditor>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Active PGEN tool
|
||||||
|
*/
|
||||||
|
private AbstractPgenTool pgenTool = null;
|
||||||
|
|
||||||
|
private static final IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(PgenSession.class);
|
||||||
|
|
||||||
|
private String perspectiveId = "";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide default constructor
|
||||||
|
*/
|
||||||
|
private PgenSession() {
|
||||||
|
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
|
||||||
|
if ( pMngr != null ){
|
||||||
|
setPerspectiveId(pMngr.getPerspectiveId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static method to get THE PgenSession instance
|
||||||
|
*
|
||||||
|
* @return PgenSession reference
|
||||||
|
*/
|
||||||
|
public static synchronized PgenSession getInstance() {
|
||||||
|
|
||||||
|
if (instance == null)
|
||||||
|
instance = new PgenSession();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a PgenResource for the current session
|
||||||
|
*
|
||||||
|
* @param rsc
|
||||||
|
* a Pgen Resource
|
||||||
|
*/
|
||||||
|
public void setResource(PgenResource rsc) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove the current PGEN Resource from the Session
|
||||||
|
*/
|
||||||
|
removeResource();
|
||||||
|
|
||||||
|
// set new PGEN resource
|
||||||
|
pgenResource = rsc;
|
||||||
|
// add the palette's stack listener to new resource's command Manager
|
||||||
|
if (pgenResource != null && palette != null) {
|
||||||
|
pgenResource.getCommandMgr().addStackListener(palette);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the current PGEN resource from the Session
|
||||||
|
*/
|
||||||
|
public void removeResource() {
|
||||||
|
if (pgenResource != null) {
|
||||||
|
// Remove the Palette's stack listener from the Resource's
|
||||||
|
// CommandManager
|
||||||
|
pgenResource.getCommandMgr().removeStackListener(palette);
|
||||||
|
}
|
||||||
|
pgenResource = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* disable the palette's Undo and redo buttons.
|
||||||
|
*/
|
||||||
|
if (palette != null)
|
||||||
|
palette.disableUndoRedo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an appropriate PGEN Resource. Returns the current Pgen Resource
|
||||||
|
* registered with this PGEN Session if there is one. If not, it will look
|
||||||
|
* for an existing resource in the current editor. If one is not found, a
|
||||||
|
* new PgenResource will be created.
|
||||||
|
*
|
||||||
|
* @return the rsc
|
||||||
|
*/
|
||||||
|
public PgenResource getPgenResource() {
|
||||||
|
|
||||||
|
if (pgenResource == null) {
|
||||||
|
// PgenResource rsc =
|
||||||
|
// PgenUtil.findPgenResource(NmapUiUtils.getActiveNatlCntrsEditor());
|
||||||
|
PgenResource rsc = PgenUtil.findPgenResource(PgenUtil
|
||||||
|
.getActiveEditor());
|
||||||
|
if (rsc != null) {
|
||||||
|
pgenResource = rsc;
|
||||||
|
} else {
|
||||||
|
pgenResource = PgenUtil.createNewResource();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pgenResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PGEN Resource currently registered with the session
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PgenResource getCurrentResource() {
|
||||||
|
return pgenResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Resource's Command Manager
|
||||||
|
*
|
||||||
|
* @return the commandMgr
|
||||||
|
*/
|
||||||
|
public PgenCommandManager getCommandManager() {
|
||||||
|
return pgenResource.getCommandMgr();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the given palette with the Session
|
||||||
|
*
|
||||||
|
* @param pal
|
||||||
|
*/
|
||||||
|
public void setPalette(PgenPaletteWindow pal) {
|
||||||
|
palette = pal;
|
||||||
|
// Register this palette's stack listener with the CommandManager, if
|
||||||
|
// able
|
||||||
|
if (pgenResource != null) {
|
||||||
|
pgenResource.getCommandMgr().addStackListener(palette);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the current palette from this Session
|
||||||
|
*/
|
||||||
|
public void removePalette() {
|
||||||
|
// Remove this palette's stack listener from the CommandManager, if able
|
||||||
|
if (pgenResource != null)
|
||||||
|
pgenResource.getCommandMgr().removeStackListener(palette);
|
||||||
|
palette = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear and disable undo/redos.
|
||||||
|
*/
|
||||||
|
public void disableUndoRedo() {
|
||||||
|
|
||||||
|
if (pgenResource != null)
|
||||||
|
getCommandManager().clearStacks();
|
||||||
|
|
||||||
|
if (palette != null) {
|
||||||
|
palette.disableUndoRedo();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PgenResourceData getPgenResourceData() {
|
||||||
|
if (pgenResource != null) {
|
||||||
|
return pgenResource.getResourceData();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the palette window
|
||||||
|
*/
|
||||||
|
public PgenPaletteWindow getPgenPalette() {
|
||||||
|
return palette;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEditor(AbstractEditor editor) {
|
||||||
|
editors.add(editor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AbstractEditor> getEditors() {
|
||||||
|
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)
|
||||||
|
*/
|
||||||
|
@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();
|
||||||
|
|
||||||
|
// Make sure PGEN resource repaint in the new editor.
|
||||||
|
PgenResource rsc = PgenUtil.findPgenResource(editorChanged );
|
||||||
|
if ( rsc != null ){
|
||||||
|
rsc.resetAllElements();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
palette.setCurrentCategory(PgenPaletteWindow.CATEGORY_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());
|
||||||
|
this.palette.setCurrentCategory(PgenPaletteWindow.CATEGORY_ANY);
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
} catch (Exception e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Cannot open PGEN palette view", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure PGEN resource repaint in the new editor.
|
||||||
|
if (PgenUtil.getPgenMode() == PgenMode.SINGLE) {
|
||||||
|
ResourceList rscList = sideView.getActiveDisplayPane().getDescriptor().getResourceList();
|
||||||
|
|
||||||
|
for (ResourcePair rp : rscList) {
|
||||||
|
AbstractVizResource<?, ?> rsc = rp.getResource();
|
||||||
|
if ( rsc instanceof PgenResource) {
|
||||||
|
((PgenResource)rsc).resetAllElements();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPerspectiveId() {
|
||||||
|
return perspectiveId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPerspectiveId(String perspectiveId) {
|
||||||
|
this.perspectiveId = perspectiveId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endSession(){
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closePalette(){
|
||||||
|
if ( palette != null ){
|
||||||
|
if ( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
|
.getActivePage() != null ){
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
|
.getActivePage().hideView(palette);
|
||||||
|
removePalette();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the given palette with the Session
|
|
||||||
* @param pal
|
|
||||||
*/
|
|
||||||
public void setPalette(PgenPaletteWindow pal) {
|
|
||||||
palette = pal;
|
|
||||||
// Register this palette's stack listener with the CommandManager, if able
|
|
||||||
if ( pgenResource != null ) pgenResource.getCommandMgr().addStackListener(palette);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the current palette from this Session
|
|
||||||
*/
|
|
||||||
public void removePalette() {
|
|
||||||
// Remove this palette's stack listener from the CommandManager, if able
|
|
||||||
if ( pgenResource != null ) pgenResource.getCommandMgr().removeStackListener(palette);
|
|
||||||
palette = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear and disable undo/redos.
|
|
||||||
*/
|
|
||||||
public void disableUndoRedo() {
|
|
||||||
|
|
||||||
if ( pgenResource != null ) getCommandManager().clearStacks();
|
|
||||||
|
|
||||||
if ( palette != null ) {
|
|
||||||
palette.disableUndoRedo();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the palette window
|
|
||||||
*/
|
|
||||||
public PgenPaletteWindow getPgenPalette(){
|
|
||||||
return palette;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||||
|
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||||
|
@ -144,7 +145,10 @@ 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.
|
||||||
* </pre>
|
* 12/14 R5413 B. Yin Add a listener for D2D swapping pane
|
||||||
|
* 12/14 R5413 B. Yin Check null in findResource
|
||||||
|
*
|
||||||
|
</pre>
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
* @version 1
|
* @version 1
|
||||||
|
@ -682,6 +686,73 @@ public class PgenUtil {
|
||||||
PgenResource drawingLayer = null;
|
PgenResource drawingLayer = null;
|
||||||
// NCMapEditor editor = NmapUiUtils.getActiveNatlCntrsEditor();
|
// NCMapEditor editor = NmapUiUtils.getActiveNatlCntrsEditor();
|
||||||
AbstractEditor editor = getActiveEditor();
|
AbstractEditor editor = getActiveEditor();
|
||||||
|
if (editor != null) {
|
||||||
|
try {
|
||||||
|
if (PgenUtil.isNatlCntrsEditor(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()) {
|
||||||
|
case SINGLE:
|
||||||
|
/*
|
||||||
|
* Use existing (or new) PgenResourceData to construct new
|
||||||
|
* Resources to add to each Pane's ResourceList
|
||||||
|
*/
|
||||||
|
if (rscData == null) {
|
||||||
|
rscData = new PgenResourceData();
|
||||||
|
}
|
||||||
|
int iii = 0;
|
||||||
|
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||||
|
IDescriptor idesc = pane.getDescriptor();
|
||||||
|
if (idesc.getResourceList().size() > 0) {
|
||||||
|
drawingLayer = rscData.construct(
|
||||||
|
new LoadProperties(), idesc);
|
||||||
|
// System.out.println("NEW pgen resource: "+drawingLayer);
|
||||||
|
idesc.getResourceList().add(drawingLayer);
|
||||||
|
idesc.getResourceList().addPreRemoveListener(
|
||||||
|
drawingLayer);
|
||||||
|
drawingLayer.init(pane.getTarget());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MULTIPLE:
|
||||||
|
/*
|
||||||
|
* Add a new PgenResourceData and Resource to active Pane's
|
||||||
|
* ResourceList
|
||||||
|
*/
|
||||||
|
IMapDescriptor desc = (IMapDescriptor) editor
|
||||||
|
.getActiveDisplayPane().getRenderableDisplay()
|
||||||
|
.getDescriptor();
|
||||||
|
drawingLayer = new PgenResourceData().construct(
|
||||||
|
new LoadProperties(), desc);
|
||||||
|
desc.getResourceList().add(drawingLayer);
|
||||||
|
desc.getResourceList().addPreRemoveListener(drawingLayer);
|
||||||
|
drawingLayer
|
||||||
|
.init(editor.getActiveDisplayPane().getTarget());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return drawingLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PgenResource and add it to the current editor.
|
||||||
|
*
|
||||||
|
* @return the PgenResource
|
||||||
|
*/
|
||||||
|
public static final PgenResource addPgenResourceToActiveEditor() {
|
||||||
|
|
||||||
|
PgenResource drawingLayer = null;
|
||||||
|
AbstractEditor editor = getActiveEditor();
|
||||||
if (editor != null) {
|
if (editor != null) {
|
||||||
try {
|
try {
|
||||||
switch (getPgenMode()) {
|
switch (getPgenMode()) {
|
||||||
|
@ -696,8 +767,15 @@ public class PgenUtil {
|
||||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||||
IDescriptor idesc = pane.getDescriptor();
|
IDescriptor idesc = pane.getDescriptor();
|
||||||
if (idesc.getResourceList().size() > 0) {
|
if (idesc.getResourceList().size() > 0) {
|
||||||
drawingLayer = rscData.construct(
|
|
||||||
|
if ( PgenSession.getInstance().getPgenResource() != null ){
|
||||||
|
drawingLayer = PgenSession.getInstance().getPgenResource();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawingLayer = rscData.construct(
|
||||||
new LoadProperties(), idesc);
|
new LoadProperties(), idesc);
|
||||||
|
}
|
||||||
|
|
||||||
// System.out.println("NEW pgen resource: "+drawingLayer);
|
// System.out.println("NEW pgen resource: "+drawingLayer);
|
||||||
idesc.getResourceList().add(drawingLayer);
|
idesc.getResourceList().add(drawingLayer);
|
||||||
idesc.getResourceList().addPreRemoveListener(
|
idesc.getResourceList().addPreRemoveListener(
|
||||||
|
@ -2002,9 +2080,9 @@ public class PgenUtil {
|
||||||
ResourceList rscList = disp.getDescriptor().getResourceList();
|
ResourceList rscList = disp.getDescriptor().getResourceList();
|
||||||
|
|
||||||
for (ResourcePair rp : rscList) {
|
for (ResourcePair rp : rscList) {
|
||||||
AbstractVizResource rsc = rp.getResource();
|
AbstractVizResource<?, ?> rsc = rp.getResource();
|
||||||
|
|
||||||
if (rsc.getClass() == rscClass) {
|
if ( rsc != null && rsc.getClass() == rscClass) {
|
||||||
return rsc;
|
return rsc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
*
|
*
|
||||||
|
@ -170,6 +171,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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* 05/14 TTR1008 J. Wu Set default contour parameters through settings_tbl.xml.
|
* 05/14 TTR1008 J. Wu Set default contour parameters through settings_tbl.xml.
|
||||||
* 05/14 TTR990 J. Wu Set default attributes for different contour labels.
|
* 05/14 TTR990 J. Wu Set default attributes for different contour labels.
|
||||||
* 08/14 ? J. Wu "Edit" line color should go to contoursAttrSettings to take effect..
|
* 08/14 ? J. Wu "Edit" line color should go to contoursAttrSettings to take effect..
|
||||||
|
* 01/15 R5413 B. Yin Added open methods for circle and line dialogs.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -148,9 +149,9 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
|
|
||||||
private String contourFcstHr = "f000";
|
private String contourFcstHr = "f000";
|
||||||
|
|
||||||
private Calendar contourTime1 = (Calendar) Calendar.getInstance();
|
private Calendar contourTime1 = Calendar.getInstance();
|
||||||
|
|
||||||
private Calendar contourTime2 = (Calendar) Calendar.getInstance();
|
private Calendar contourTime2 = Calendar.getInstance();
|
||||||
|
|
||||||
private String defCint = ContoursInfoDlg.getCints().get(
|
private String defCint = ContoursInfoDlg.getCints().get(
|
||||||
contourParm + "-" + contourLevel);
|
contourParm + "-" + contourLevel);
|
||||||
|
@ -397,6 +398,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
setInfoBtnText();
|
setInfoBtnText();
|
||||||
|
|
||||||
infoBtn.addSelectionListener(new SelectionAdapter() {
|
infoBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
openContourInfoDlg();
|
openContourInfoDlg();
|
||||||
}
|
}
|
||||||
|
@ -407,6 +409,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
makeGridBtn.setText("Make Grid");
|
makeGridBtn.setText("Make Grid");
|
||||||
makeGridBtn.setToolTipText("Generate grid from this Contours");
|
makeGridBtn.setToolTipText("Generate grid from this Contours");
|
||||||
makeGridBtn.addSelectionListener(new SelectionAdapter() {
|
makeGridBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
openG2GDlg();
|
openG2GDlg();
|
||||||
}
|
}
|
||||||
|
@ -468,6 +471,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
quickLineBtns.add(btn);
|
quickLineBtns.add(btn);
|
||||||
|
|
||||||
btn.addListener(SWT.MouseDoubleClick, new Listener() {
|
btn.addListener(SWT.MouseDoubleClick, new Listener() {
|
||||||
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
openLineTypePanel();
|
openLineTypePanel();
|
||||||
}
|
}
|
||||||
|
@ -527,6 +531,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
lineClosedBtn.setToolTipText("Click to draw a closed line");
|
lineClosedBtn.setToolTipText("Click to draw a closed line");
|
||||||
lineClosedBtn.setSelection(drawClosedLine);
|
lineClosedBtn.setSelection(drawClosedLine);
|
||||||
lineClosedBtn.addSelectionListener(new SelectionAdapter() {
|
lineClosedBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
drawClosedLine = lineClosedBtn.getSelection();
|
drawClosedLine = lineClosedBtn.getSelection();
|
||||||
}
|
}
|
||||||
|
@ -564,7 +569,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
if (de != null && de.getParent() != null
|
if (de != null && de.getParent() != null
|
||||||
&& de.getParent() instanceof ContourLine) {
|
&& de.getParent() instanceof ContourLine) {
|
||||||
ContourLine pde = (ContourLine) de.getParent();
|
ContourLine pde = (ContourLine) de.getParent();
|
||||||
lineAttrDlg.setAttrForDlg((IAttribute) pde.getLine());
|
lineAttrDlg.setAttrForDlg(pde.getLine());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (lineTemplate == null) {
|
if (lineTemplate == null) {
|
||||||
|
@ -577,7 +582,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
.toString());
|
.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
lineAttrDlg.setAttrForDlg((IAttribute) lineTemplate);
|
lineAttrDlg.setAttrForDlg(lineTemplate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,6 +647,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
quickSymbolBtns.add(btn);
|
quickSymbolBtns.add(btn);
|
||||||
|
|
||||||
btn.addListener(SWT.MouseDoubleClick, new Listener() {
|
btn.addListener(SWT.MouseDoubleClick, new Listener() {
|
||||||
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
openSymbolPanel();
|
openSymbolPanel();
|
||||||
}
|
}
|
||||||
|
@ -724,7 +730,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
DrawableElement de = drawingLayer.getSelectedDE();
|
DrawableElement de = drawingLayer.getSelectedDE();
|
||||||
if (de != null && de instanceof Symbol
|
if (de != null && de instanceof Symbol
|
||||||
&& de.getParent() instanceof ContourMinmax) {
|
&& de.getParent() instanceof ContourMinmax) {
|
||||||
minmaxAttrDlg.setAttrForDlg((IAttribute) de);
|
minmaxAttrDlg.setAttrForDlg(de);
|
||||||
} else {
|
} else {
|
||||||
minmaxTemplate = (Symbol) contoursAttrSettings
|
minmaxTemplate = (Symbol) contoursAttrSettings
|
||||||
.get(activeQuickSymbolBtn.getData().toString());
|
.get(activeQuickSymbolBtn.getData().toString());
|
||||||
|
@ -736,8 +742,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
minmaxAttrDlg
|
minmaxAttrDlg.setAttrForDlg(minmaxTemplate);
|
||||||
.setAttrForDlg((IAttribute) minmaxTemplate);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,6 +784,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
setButtonColor(circleTypeBtn, circleTemplate.getColors()[0]);
|
setButtonColor(circleTypeBtn, circleTemplate.getColors()[0]);
|
||||||
|
|
||||||
circleTypeBtn.addSelectionListener(new SelectionAdapter() {
|
circleTypeBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
if (!ContoursAttrDlg.this.drawCircle()) {
|
if (!ContoursAttrDlg.this.drawCircle()) {
|
||||||
if (circleTemplate == null) {
|
if (circleTemplate == null) {
|
||||||
|
@ -830,8 +836,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
if (de != null && de.getParent() != null
|
if (de != null && de.getParent() != null
|
||||||
&& de.getParent() instanceof ContourCircle) {
|
&& de.getParent() instanceof ContourCircle) {
|
||||||
ContourCircle pde = (ContourCircle) de.getParent();
|
ContourCircle pde = (ContourCircle) de.getParent();
|
||||||
circleAttrDlg.setAttrForDlg((IAttribute) pde
|
circleAttrDlg.setAttrForDlg(pde.getCircle());
|
||||||
.getCircle());
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (circleTemplate == null) {
|
if (circleTemplate == null) {
|
||||||
|
@ -840,8 +845,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
circleTemplate.setPgenType("Circle");
|
circleTemplate.setPgenType("Circle");
|
||||||
}
|
}
|
||||||
|
|
||||||
circleAttrDlg
|
circleAttrDlg.setAttrForDlg(circleTemplate);
|
||||||
.setAttrForDlg((IAttribute) circleTemplate);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,6 +895,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
labelTxt.setText("0");
|
labelTxt.setText("0");
|
||||||
labelTxt.addFocusListener(new FocusListener() {
|
labelTxt.addFocusListener(new FocusListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
float value = 0;
|
float value = 0;
|
||||||
try {
|
try {
|
||||||
|
@ -905,6 +910,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void focusGained(FocusEvent e) {
|
public void focusGained(FocusEvent e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -912,6 +918,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
Button valueUpArrow = new Button(textValueComp, SWT.ARROW | SWT.UP);
|
Button valueUpArrow = new Button(textValueComp, SWT.ARROW | SWT.UP);
|
||||||
valueUpArrow.setLayoutData(new GridData(20, 22));
|
valueUpArrow.setLayoutData(new GridData(20, 22));
|
||||||
valueUpArrow.addSelectionListener(new SelectionAdapter() {
|
valueUpArrow.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
changeLabel(true);
|
changeLabel(true);
|
||||||
}
|
}
|
||||||
|
@ -921,6 +928,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
Button valueDownArrow = new Button(textValueComp, SWT.ARROW | SWT.DOWN);
|
Button valueDownArrow = new Button(textValueComp, SWT.ARROW | SWT.DOWN);
|
||||||
valueDownArrow.setLayoutData(new GridData(20, 22));
|
valueDownArrow.setLayoutData(new GridData(20, 22));
|
||||||
valueDownArrow.addSelectionListener(new SelectionAdapter() {
|
valueDownArrow.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
changeLabel(false);
|
changeLabel(false);
|
||||||
}
|
}
|
||||||
|
@ -967,18 +975,16 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
if (de.getParent() instanceof ContourLine
|
if (de.getParent() instanceof ContourLine
|
||||||
&& ((ContourLine) (de.getParent())).getLabels()
|
&& ((ContourLine) (de.getParent())).getLabels()
|
||||||
.size() > 0) {
|
.size() > 0) {
|
||||||
labelAttrDlg
|
labelAttrDlg.setAttrForDlg(((ContourLine) (de
|
||||||
.setAttrForDlg((IAttribute) ((ContourLine) (de
|
.getParent())).getLabels().get(0));
|
||||||
.getParent())).getLabels().get(0));
|
|
||||||
if (isUseMainColor()) {
|
if (isUseMainColor()) {
|
||||||
labelAttrDlg.setColor(lineTemplate.getColors()[0]);
|
labelAttrDlg.setColor(lineTemplate.getColors()[0]);
|
||||||
}
|
}
|
||||||
} else if (de.getParent() instanceof ContourMinmax
|
} else if (de.getParent() instanceof ContourMinmax
|
||||||
&& ((ContourMinmax) (de.getParent()))
|
&& ((ContourMinmax) (de.getParent()))
|
||||||
.getLabel() != null) {
|
.getLabel() != null) {
|
||||||
labelAttrDlg
|
labelAttrDlg.setAttrForDlg(((ContourMinmax) (de
|
||||||
.setAttrForDlg((IAttribute) ((ContourMinmax) (de
|
.getParent())).getLabel());
|
||||||
.getParent())).getLabel());
|
|
||||||
if (isUseMainColor()) {
|
if (isUseMainColor()) {
|
||||||
labelAttrDlg.setColor(minmaxTemplate
|
labelAttrDlg.setColor(minmaxTemplate
|
||||||
.getColors()[0]);
|
.getColors()[0]);
|
||||||
|
@ -986,9 +992,8 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
} else if (de.getParent() instanceof ContourCircle
|
} else if (de.getParent() instanceof ContourCircle
|
||||||
&& ((ContourCircle) (de.getParent()))
|
&& ((ContourCircle) (de.getParent()))
|
||||||
.getLabel() != null) {
|
.getLabel() != null) {
|
||||||
labelAttrDlg
|
labelAttrDlg.setAttrForDlg(((ContourCircle) (de
|
||||||
.setAttrForDlg((IAttribute) ((ContourCircle) (de
|
.getParent())).getLabel());
|
||||||
.getParent())).getLabel());
|
|
||||||
if (isUseMainColor()) {
|
if (isUseMainColor()) {
|
||||||
labelAttrDlg.setColor(circleTemplate
|
labelAttrDlg.setColor(circleTemplate
|
||||||
.getColors()[0]);
|
.getColors()[0]);
|
||||||
|
@ -999,7 +1004,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
labelTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Text) contoursAttrSettings
|
labelTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Text) contoursAttrSettings
|
||||||
.get(getLabelTempKey());
|
.get(getLabelTempKey());
|
||||||
|
|
||||||
labelAttrDlg.setAttrForDlg((IAttribute) labelTemplate);
|
labelAttrDlg.setAttrForDlg(labelTemplate);
|
||||||
|
|
||||||
if (isUseMainColor()) {
|
if (isUseMainColor()) {
|
||||||
if (drawingStatus == ContourDrawingStatus.DRAW_LINE) {
|
if (drawingStatus == ContourDrawingStatus.DRAW_LINE) {
|
||||||
|
@ -1381,6 +1386,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
btn.setText(lblstr);
|
btn.setText(lblstr);
|
||||||
btn.setData(lblstr);
|
btn.setData(lblstr);
|
||||||
btn.addSelectionListener(new SelectionAdapter() {
|
btn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
labelTxt.setText(event.widget.getData().toString());
|
labelTxt.setText(event.widget.getData().toString());
|
||||||
if (labelTemplate != null) {
|
if (labelTemplate != null) {
|
||||||
|
@ -1572,6 +1578,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
* Updates the selected contours and contour line, then redraws the PGEN
|
* Updates the selected contours and contour line, then redraws the PGEN
|
||||||
* layer.
|
* layer.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void okPressed() {
|
public void okPressed() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2294,6 +2301,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the dialog if it doesn't exist.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int open() {
|
||||||
|
|
||||||
|
if (this.getShell() == null || this.getShell().isDisposed()) {
|
||||||
|
return super.open();
|
||||||
|
} else {
|
||||||
|
return CANCEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* closes the line attribute dialog only
|
* closes the line attribute dialog only
|
||||||
*/
|
*/
|
||||||
|
@ -2463,6 +2483,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
}
|
}
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the dialog if it doesn't exist.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int open() {
|
||||||
|
|
||||||
|
if (this.getShell() == null || this.getShell().isDisposed()) {
|
||||||
|
return super.open();
|
||||||
|
} else {
|
||||||
|
return CANCEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* closes the circle attribute dialog only
|
* closes the circle attribute dialog only
|
||||||
|
@ -2943,6 +2976,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
/**
|
/**
|
||||||
* Updates the selected type's data string and image icon.
|
* Updates the selected type's data string and image icon.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void okPressed() {
|
public void okPressed() {
|
||||||
|
|
||||||
Color clr = activeButtonColor;
|
Color clr = activeButtonColor;
|
||||||
|
@ -3091,6 +3125,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
/**
|
/**
|
||||||
* Updates the selected type's data string and image icon.
|
* Updates the selected type's data string and image icon.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void okPressed() {
|
public void okPressed() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3199,7 +3234,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
* Update the symbol template first.
|
* Update the symbol template first.
|
||||||
*/
|
*/
|
||||||
minmaxTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Symbol) new DrawableElementFactory()
|
minmaxTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Symbol) new DrawableElementFactory()
|
||||||
.create(DrawableType.SYMBOL, (IAttribute) this, "Symbol",
|
.create(DrawableType.SYMBOL, this, "Symbol",
|
||||||
getActiveSymbolObjType(), (Coordinate) null, null);
|
getActiveSymbolObjType(), (Coordinate) null, null);
|
||||||
contoursAttrSettings.put(getActiveSymbolObjType(), minmaxTemplate);
|
contoursAttrSettings.put(getActiveSymbolObjType(), minmaxTemplate);
|
||||||
|
|
||||||
|
@ -3789,6 +3824,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
|
||||||
/**
|
/**
|
||||||
* Removes ghost line, handle bars, and closes the dialog
|
* Removes ghost line, handle bars, and closes the dialog
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void cancelPressed() {
|
public void cancelPressed() {
|
||||||
|
|
||||||
PgenUtil.setSelectingMode();
|
PgenUtil.setSelectingMode();
|
||||||
|
|
|
@ -140,13 +140,14 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
|
||||||
* this class
|
* this class
|
||||||
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
|
||||||
* 12/13 #1089 B. Yin Modify watch to display county list
|
* 12/13 #1089 B. Yin Modify watch to display county list
|
||||||
* 02/14 #2819 R. Anderson Removed unnecessary .clone() call
|
* 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.
|
* 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.
|
||||||
* 08/14 TTR972 J. Wu Draw filled object as filled only if either its layer's "filled" flag
|
* 08/14 TTR972 J. Wu Draw filled object as filled only if either its layer's "filled" flag
|
||||||
* "true" or they are on the active layer, .
|
* "true" or they are on the active layer, .
|
||||||
* 09/14 TTR750 J. Wu Draw track label with specified font styles.
|
* 09/14 TTR750 J. Wu Draw track label with specified font styles.
|
||||||
|
* 12/14 R5413 B. Yin Dispose image and font in find*Ranges methods
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
|
@ -711,8 +712,9 @@ public class DisplayElementFactory {
|
||||||
iDescriptor, PointStyle.CROSS);
|
iDescriptor, PointStyle.CROSS);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
compiler.handle(cntyUnion, new RGB(colors[1].getRed(),
|
compiler.handle((Geometry) cntyUnion.clone(),
|
||||||
colors[1].getGreen(), colors[1].getBlue()));
|
new RGB(colors[1].getRed(), colors[1].getGreen(),
|
||||||
|
colors[1].getBlue()));
|
||||||
|
|
||||||
if (elem.getFillPattern() != FillPattern.TRANSPARENCY
|
if (elem.getFillPattern() != FillPattern.TRANSPARENCY
|
||||||
&& elem.getFillPattern() != FillPattern.SOLID) {
|
&& elem.getFillPattern() != FillPattern.SOLID) {
|
||||||
|
@ -1818,8 +1820,7 @@ public class DisplayElementFactory {
|
||||||
double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1]));
|
double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1]));
|
||||||
double minor = major * arc.getAxisRatio();
|
double minor = major * arc.getAxisRatio();
|
||||||
|
|
||||||
if (major / this.screenToExtent < 0.000001) { // ignore circles with
|
if (major / this.screenToExtent < 0.000001) { // ignore circles with major = 0
|
||||||
// major = 0
|
|
||||||
return slist;
|
return slist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1890,6 +1891,7 @@ public class DisplayElementFactory {
|
||||||
return slist;
|
return slist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
/**
|
||||||
* Creates a list of IDisplayable Objects from an IArc object
|
* Creates a list of IDisplayable Objects from an IArc object
|
||||||
*
|
*
|
||||||
|
@ -5927,6 +5929,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6000,6 +6006,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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,8 @@ public class SymbolCirclePart extends SymbolPart {
|
||||||
* Gets the coordinates defining the line path
|
* Gets the coordinates defining the line path
|
||||||
* @return the line path
|
* @return the line path
|
||||||
*/
|
*/
|
||||||
public Coordinate[] getPath() {
|
@Override
|
||||||
|
public Coordinate[] getPath() {
|
||||||
if ( pathNeedsUpdate ) updatePath();
|
if ( pathNeedsUpdate ) updatePath();
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +89,8 @@ public class SymbolCirclePart extends SymbolPart {
|
||||||
* Gets whether area defined by line path should be filled
|
* Gets whether area defined by line path should be filled
|
||||||
* @return the filled flag
|
* @return the filled flag
|
||||||
*/
|
*/
|
||||||
public boolean isFilled() {
|
@Override
|
||||||
|
public boolean isFilled() {
|
||||||
return filled;
|
return filled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +145,7 @@ public class SymbolCirclePart extends SymbolPart {
|
||||||
int numpts = 16;
|
int numpts = 16;
|
||||||
path = new Coordinate[numpts];
|
path = new Coordinate[numpts];
|
||||||
|
|
||||||
double increment = 360.0 / (double)numpts;
|
double increment = 360.0 / numpts;
|
||||||
double angle = 0.0;
|
double angle = 0.0;
|
||||||
for (int j=0; j<numpts; j++) {
|
for (int j=0; j<numpts; j++) {
|
||||||
x = center.x + ( radius * Math.cos(Math.toRadians(angle)) );
|
x = center.x + ( radius * Math.cos(Math.toRadians(angle)) );
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.ui.pgen.file;
|
package gov.noaa.nws.ncep.ui.pgen.file;
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.TcmWindQuarters;
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.TcmFcst;
|
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.TcmFcst;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.TcmWindQuarters;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -20,12 +20,8 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
|
||||||
import javax.xml.datatype.XMLGregorianCalendar;
|
import javax.xml.datatype.XMLGregorianCalendar;
|
||||||
|
|
||||||
import com.raytheon.uf.common.geospatial.adapter.CoordAdapter;
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Java class for anonymous complex type.
|
* <p>Java class for anonymous complex type.
|
||||||
|
|
|
@ -18,6 +18,7 @@ import gov.noaa.nws.ncep.ui.pgen.elements.Text;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.labeledlines.LabeledLine;
|
import gov.noaa.nws.ncep.ui.pgen.elements.labeledlines.LabeledLine;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.Tcm;
|
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.Tcm;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
|
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement;
|
import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +37,10 @@ public class CategoryFilter implements ElementFilter {
|
||||||
public CategoryFilter(String category) {
|
public CategoryFilter(String category) {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CategoryFilter(){
|
||||||
|
this.category = PgenPaletteWindow.CATEGORY_ANY;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(AbstractDrawableComponent adc) {
|
public boolean accept(AbstractDrawableComponent adc) {
|
||||||
|
@ -88,14 +93,14 @@ public class CategoryFilter implements ElementFilter {
|
||||||
(adc.getParent() instanceof LabeledLine ||
|
(adc.getParent() instanceof LabeledLine ||
|
||||||
adc.getParent().getParent() instanceof LabeledLine )) {
|
adc.getParent().getParent() instanceof LabeledLine )) {
|
||||||
//cannot select individual from LabeledLine collection
|
//cannot select individual from LabeledLine collection
|
||||||
if ( category.equalsIgnoreCase("ANY")){
|
if ( category.equalsIgnoreCase(PgenPaletteWindow.CATEGORY_ANY)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( category.equalsIgnoreCase("any") ||
|
else if ( category.equalsIgnoreCase(PgenPaletteWindow.CATEGORY_ANY) ||
|
||||||
adc.getPgenCategory().equalsIgnoreCase(category) ) {
|
adc.getPgenCategory().equalsIgnoreCase(category) ) {
|
||||||
if ( category.equalsIgnoreCase("Lines") ) {
|
if ( category.equalsIgnoreCase("Lines") ) {
|
||||||
if ( adc.getParent() instanceof Jet ||
|
if ( adc.getParent() instanceof Jet ||
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.ui.pgen.palette;
|
package gov.noaa.nws.ncep.ui.pgen.palette;
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PGenRuntimeException;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenSession;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenStaticDataProvider;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
//import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor;
|
//import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor;
|
||||||
|
|
||||||
|
@ -23,8 +26,24 @@ import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.internal.WorkbenchPage;
|
import org.eclipse.ui.internal.WorkbenchPage;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
||||||
import com.raytheon.viz.ui.EditorUtil;
|
import com.raytheon.viz.ui.EditorUtil;
|
||||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
|
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||||
|
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* 01/15 #5413 B. Yin Added meesage box if PGEN is running in another perspective
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author ?
|
||||||
|
*/
|
||||||
|
|
||||||
public class PgenPaletteAction extends AbstractHandler {
|
public class PgenPaletteAction extends AbstractHandler {
|
||||||
|
|
||||||
|
@ -32,6 +51,39 @@ public class PgenPaletteAction extends AbstractHandler {
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
PgenStaticDataProvider.getProvider();
|
||||||
|
}
|
||||||
|
catch (PGenRuntimeException e ){
|
||||||
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||||
|
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
|
||||||
|
| SWT.OK);
|
||||||
|
|
||||||
|
mb.setMessage( "Please start NCP first to initialize PGEN data!");
|
||||||
|
mb.open();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
|
||||||
|
if ( pMngr != null && pMngr.getPerspectiveId() != PgenSession.getInstance().getPerspectiveId() ){
|
||||||
|
|
||||||
|
if (PgenSession.getInstance().getPgenPalette() == null ){
|
||||||
|
//if PGEN palette is closed
|
||||||
|
PgenSession.getInstance().setPerspectiveId(pMngr.getPerspectiveId() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// if PGEN palette is open in another perspective
|
||||||
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||||
|
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
|
||||||
|
| SWT.OK);
|
||||||
|
|
||||||
|
int idxLastDot = PgenSession.getInstance().getPerspectiveId().lastIndexOf('.');
|
||||||
|
mb.setMessage( "A PGEN session is alreadly running in perspective " + PgenSession.getInstance().getPerspectiveId().substring(++idxLastDot) + "!");
|
||||||
|
mb.open();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The viewID string is in the XML file for PGEN extension point.
|
* The viewID string is in the XML file for PGEN extension point.
|
||||||
*/
|
*/
|
||||||
|
@ -80,6 +132,9 @@ public class PgenPaletteAction extends AbstractHandler {
|
||||||
mb.setMessage( "Pgen is not supported in this editor. Please select a mapEditor for Pgen to use first!");
|
mb.setMessage( "Pgen is not supported in this editor. Please select a mapEditor for Pgen to use first!");
|
||||||
mb.open();
|
mb.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ 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.UiUtil;
|
import com.raytheon.viz.ui.UiUtil;
|
||||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||||
|
@ -110,6 +111,8 @@ import com.raytheon.viz.ui.tools.AbstractModalTool;
|
||||||
* 01/10 ? S. Gilbert Initial Creation.
|
* 01/10 ? S. Gilbert Initial Creation.
|
||||||
* 08/13 TTR696/774 J. Wu Reset title/Close product manage dialog.
|
* 08/13 TTR696/774 J. Wu Reset title/Close product manage dialog.
|
||||||
* 11/13 #1081 B. Yin Get selected DE to change front/line type.
|
* 11/13 #1081 B. Yin Get selected DE to change front/line type.
|
||||||
|
* 12/14 R5413 B. Yin Removed unused variables, loops.
|
||||||
|
* 01/15 R5413 B. Yin Set perspective ID and editor for PGEN session.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -203,6 +206,8 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
private IContextActivation pgenContextActivation;
|
private IContextActivation pgenContextActivation;
|
||||||
|
|
||||||
private AbstractEditor currentIsMultiPane = null;
|
private AbstractEditor currentIsMultiPane = null;
|
||||||
|
|
||||||
|
public static final String CATEGORY_ANY = "Any";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -305,14 +310,6 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
/* TODO: save on exit? dialog */
|
/* TODO: save on exit? dialog */
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
||||||
/*
|
|
||||||
* remove product manage/layer dialog
|
|
||||||
*/
|
|
||||||
PgenResource pgen = PgenSession.getInstance().getPgenResource();
|
|
||||||
if (pgen != null) {
|
|
||||||
pgen.closeDialogs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* remove this palette from Pgen Session
|
* remove this palette from Pgen Session
|
||||||
*/
|
*/
|
||||||
|
@ -395,8 +392,15 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
* the PgenSession
|
* the PgenSession
|
||||||
*/
|
*/
|
||||||
PgenResource current = PgenUtil.findPgenResource(null);
|
PgenResource current = PgenUtil.findPgenResource(null);
|
||||||
if (current != null)
|
if (current != null) {
|
||||||
PgenSession.getInstance().setResource(current);
|
PgenSession.getInstance().setResource(current);
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
AbstractEditor actEditor = PgenUtil.getActiveEditor();
|
||||||
|
if ( actEditor != null && !PgenSession.getInstance().getEditors().contains(actEditor)){
|
||||||
|
PgenSession.getInstance().getEditors().add(actEditor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,6 +607,16 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
|
|
||||||
IEditorPart editor = VizWorkbenchManager.getInstance()
|
IEditorPart editor = VizWorkbenchManager.getInstance()
|
||||||
.getActiveEditor();
|
.getActiveEditor();
|
||||||
|
|
||||||
|
//Set perspective ID in session
|
||||||
|
if ( PgenSession.getInstance().getPerspectiveId() == null ||
|
||||||
|
PgenSession.getInstance().getPerspectiveId().isEmpty()){
|
||||||
|
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
|
||||||
|
if ( pMngr != null ){
|
||||||
|
PgenSession.getInstance().setPerspectiveId(pMngr.getPerspectiveId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (editor instanceof AbstractEditor) {// && ((NCMapEditor)
|
if (editor instanceof AbstractEditor) {// && ((NCMapEditor)
|
||||||
// editor).getApplicationName().equals("NA")
|
// editor).getApplicationName().equals("NA")
|
||||||
// ) {
|
// ) {
|
||||||
|
@ -867,14 +881,28 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
// if ( part instanceof NCMapEditor &&((NCMapEditor)
|
// if ( part instanceof NCMapEditor &&((NCMapEditor)
|
||||||
// part).getApplicationName().equals("NA")) {
|
// part).getApplicationName().equals("NA")) {
|
||||||
|
|
||||||
if (PgenUtil.isNatlCntrsEditor(part)) {
|
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
|
||||||
|
|
||||||
|
//Prevent PGEN going to another perspective
|
||||||
|
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
|
||||||
|
if ( pMngr != null && pMngr.getPerspectiveId() != PgenSession.getInstance().getPerspectiveId() ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
|
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
|
||||||
if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE))
|
|
||||||
|
// if ( PgenSession.getInstance().getPgenResource().getDescriptor()
|
||||||
|
// != )
|
||||||
|
|
||||||
|
if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) {
|
||||||
rsc = PgenUtil.createNewResource();
|
rsc = PgenUtil.createNewResource();
|
||||||
if (rsc != null)
|
}
|
||||||
|
|
||||||
|
if (rsc != null) {
|
||||||
rsc.setCatFilter(new CategoryFilter(
|
rsc.setCatFilter(new CategoryFilter(
|
||||||
(currentCategory == null) ? "Any" : currentCategory));
|
(currentCategory == null) ? CATEGORY_ANY : currentCategory));
|
||||||
|
}
|
||||||
|
|
||||||
PgenSession.getInstance().setResource(rsc);
|
PgenSession.getInstance().setResource(rsc);
|
||||||
|
|
||||||
AbstractEditor editor = (AbstractEditor) part;
|
AbstractEditor editor = (AbstractEditor) part;
|
||||||
|
@ -885,9 +913,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
PgenUtil.addSelectedPaneChangedListener(editor, this);
|
PgenUtil.addSelectedPaneChangedListener(editor, this);
|
||||||
}
|
}
|
||||||
activatePGENContext();
|
activatePGENContext();
|
||||||
}
|
} else if (part instanceof PgenPaletteWindow) {
|
||||||
|
|
||||||
else if (part instanceof PgenPaletteWindow) {
|
|
||||||
activatePGENContext();
|
activatePGENContext();
|
||||||
|
|
||||||
// found NCMapEditor
|
// found NCMapEditor
|
||||||
|
@ -926,7 +952,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
// );
|
// );
|
||||||
partActivated(partRef);
|
partActivated(partRef);
|
||||||
|
|
||||||
if (PgenUtil.isNatlCntrsEditor(part)) {
|
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);
|
||||||
|
|
||||||
|
@ -966,17 +992,12 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
if (VizPerspectiveListener.getCurrentPerspectiveManager() == null)
|
if (VizPerspectiveListener.getCurrentPerspectiveManager() == null)
|
||||||
return; // workbench probably closing
|
return; // workbench probably closing
|
||||||
|
|
||||||
AbstractEditor[] editors = UiUtil.getEditors(PlatformUI
|
for (AbstractEditor editor : PgenSession.getInstance()
|
||||||
.getWorkbench().getActiveWorkbenchWindow(),
|
.getEditors()) {
|
||||||
VizPerspectiveListener.getCurrentPerspectiveManager()
|
unloadPgenResource(editor);
|
||||||
.getPerspectiveId());
|
|
||||||
/*
|
|
||||||
* UiUtil.getEditors returns active editor first. Run through
|
|
||||||
* list in reverse so that active editor is processed last.
|
|
||||||
*/
|
|
||||||
for (int i = editors.length - 1; i >= 0; i--) {
|
|
||||||
unloadPgenResource(editors[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PgenSession.getInstance().endSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ( currentIsMultiPane != null )
|
// if ( currentIsMultiPane != null )
|
||||||
|
@ -1055,11 +1076,12 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
|
||||||
// System.out.println("Something Hidden: "+part.getClass().getCanonicalName()
|
// System.out.println("Something Hidden: "+part.getClass().getCanonicalName()
|
||||||
// );
|
// );
|
||||||
|
|
||||||
if (PgenUtil.isNatlCntrsEditor(part)) {
|
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) {
|
||||||
pgen.closeDialogs();
|
pgen.closeDialogs();
|
||||||
|
pgen.deactivatePgenTools();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1403,4 +1425,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ 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.perspectives.AbstractVizPerspectiveManager;
|
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
|
@ -146,6 +147,9 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* 09/14 TTR972 J. Wu "Filled" object on the active layer should be
|
* 09/14 TTR972 J. Wu "Filled" object on the active layer should be
|
||||||
* drawn as "filled" even if the "filled" flag for
|
* drawn as "filled" even if the "filled" flag for
|
||||||
* the layer is "false".
|
* the layer is "false".
|
||||||
|
* 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
|
||||||
|
* 12/14 R5413 B. Yin Added resetAllElements(), reset ghost, removed "Any".
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author B. Yin
|
* @author B. Yin
|
||||||
|
@ -213,7 +217,7 @@ public class PgenResource extends
|
||||||
selectedSymbol = new HashMap<AbstractDrawableComponent, Symbol>();
|
selectedSymbol = new HashMap<AbstractDrawableComponent, Symbol>();
|
||||||
displayMap = new ConcurrentHashMap<DrawableElement, AbstractElementContainer>();
|
displayMap = new ConcurrentHashMap<DrawableElement, AbstractElementContainer>();
|
||||||
filters = new ElementFilterCollection();
|
filters = new ElementFilterCollection();
|
||||||
setCatFilter(new CategoryFilter("any"));
|
setCatFilter(new CategoryFilter());
|
||||||
|
|
||||||
// Register this new resource with the Session
|
// Register this new resource with the Session
|
||||||
PgenSession.getInstance().setResource(this);
|
PgenSession.getInstance().setResource(this);
|
||||||
|
@ -361,9 +365,10 @@ 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);
|
||||||
|
|
||||||
|
@ -541,6 +546,8 @@ public class PgenResource extends
|
||||||
|
|
||||||
if (this.ghost == null) {
|
if (this.ghost == null) {
|
||||||
this.ghost = new PgenResourceGhost();
|
this.ghost = new PgenResourceGhost();
|
||||||
|
} else {
|
||||||
|
this.ghost.dispose();
|
||||||
}
|
}
|
||||||
// this.ghost = ghost;
|
// this.ghost = ghost;
|
||||||
this.ghost.setGhostLine(ghost);
|
this.ghost.setGhostLine(ghost);
|
||||||
|
@ -679,7 +686,8 @@ 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>();
|
||||||
|
@ -1373,6 +1381,20 @@ public class PgenResource extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Releases the resources held by all DEs to refresh all.
|
||||||
|
*
|
||||||
|
* @param adc
|
||||||
|
*/
|
||||||
|
public void resetAllElements(){
|
||||||
|
for ( Product prd : this.resourceData.getProductList() ){
|
||||||
|
for ( Layer layer : prd.getLayers()) {
|
||||||
|
this.resetADC(layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the nearest element in the a DECollection to the input point.
|
* Finds the nearest element in the a DECollection to the input point.
|
||||||
*
|
*
|
||||||
|
@ -1745,22 +1767,26 @@ public class PgenResource extends
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* De-activate all PGEN tools
|
* De-activate all PGEN tools for all perspectives
|
||||||
*/
|
*/
|
||||||
public void deactivatePgenTools() {
|
public void deactivatePgenTools() {
|
||||||
AbstractVizPerspectiveManager mgr = VizPerspectiveListener
|
|
||||||
.getCurrentPerspectiveManager();
|
for (String pid : VizPerspectiveListener.getManagedPerspectives()) {
|
||||||
if (mgr != null) {
|
AbstractVizPerspectiveManager mgr = VizPerspectiveListener
|
||||||
Iterator<AbstractModalTool> it = mgr.getToolManager()
|
.getInstance().getPerspectiveManager(pid);
|
||||||
.getSelectedModalTools().iterator();
|
if (mgr != null) {
|
||||||
while (it.hasNext()) {
|
Iterator<AbstractModalTool> it = mgr.getToolManager()
|
||||||
AbstractModalTool tool = it.next();
|
.getSelectedModalTools().iterator();
|
||||||
if (tool != null && tool instanceof AbstractPgenTool) {
|
while (it.hasNext()) {
|
||||||
tool.deactivate();
|
AbstractModalTool tool = it.next();
|
||||||
it.remove();
|
if (tool != null && tool instanceof AbstractPgenTool) {
|
||||||
|
tool.deactivate();
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,6 +44,10 @@ import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
@ -69,10 +73,19 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Contains all the PGEN Products, layers, and Elements behind the PgenResource.
|
* Contains all the PGEN Products, layers, and Elements behind the PgenResource.
|
||||||
* Also holds the command manager to undo/redo changes to the data in the
|
* Also holds the command manager to undo/redo changes to the data in the
|
||||||
* productlist
|
* productlist
|
||||||
|
* <pre>
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* 01/15 #5413 B. Yin Close PGEN palette in cleanup
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author sgilbert
|
* @author sgilbert
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@XmlRootElement
|
||||||
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
public class PgenResourceData extends AbstractResourceData implements
|
public class PgenResourceData extends AbstractResourceData implements
|
||||||
CommandStackListener {
|
CommandStackListener {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
@ -116,6 +129,8 @@ public class PgenResourceData extends AbstractResourceData implements
|
||||||
private boolean needsDisplay = false;
|
private boolean needsDisplay = false;
|
||||||
|
|
||||||
private int numberOfResources = 0;
|
private int numberOfResources = 0;
|
||||||
|
|
||||||
|
private ArrayList<PgenResource> rscList = new ArrayList<PgenResource>();
|
||||||
|
|
||||||
// private static final String PRD_GRAPHIC = "xml";
|
// private static final String PRD_GRAPHIC = "xml";
|
||||||
|
|
||||||
|
@ -142,7 +157,9 @@ public class PgenResourceData extends AbstractResourceData implements
|
||||||
public PgenResource construct(LoadProperties loadProperties,
|
public PgenResource construct(LoadProperties loadProperties,
|
||||||
IDescriptor descriptor) throws VizException {
|
IDescriptor descriptor) throws VizException {
|
||||||
numberOfResources++;
|
numberOfResources++;
|
||||||
return new PgenResource(this, loadProperties);
|
PgenResource rsc = new PgenResource(this, loadProperties);
|
||||||
|
rscList.add(rsc);
|
||||||
|
return rsc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -740,10 +757,15 @@ public class PgenResourceData extends AbstractResourceData implements
|
||||||
*/
|
*/
|
||||||
public synchronized void cleanup(BufferedImage paneImage) {
|
public synchronized void cleanup(BufferedImage paneImage) {
|
||||||
|
|
||||||
|
closeDialogs();
|
||||||
|
PgenSession.getInstance().closePalette();
|
||||||
|
|
||||||
numberOfResources--;
|
numberOfResources--;
|
||||||
if (numberOfResources != 0)
|
if (numberOfResources != 0){
|
||||||
return; // not ready yet
|
return; // not ready yet
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
commandMgr.flushStacks();
|
commandMgr.flushStacks();
|
||||||
commandMgr.removeStackListener(this);
|
commandMgr.removeStackListener(this);
|
||||||
|
|
||||||
|
@ -751,19 +773,21 @@ public class PgenResourceData extends AbstractResourceData implements
|
||||||
* remove Temp recovery file
|
* remove Temp recovery file
|
||||||
*/
|
*/
|
||||||
removeTempFile();
|
removeTempFile();
|
||||||
|
|
||||||
|
if (needsSaving) {
|
||||||
|
promptToSave(paneImage);
|
||||||
|
}
|
||||||
|
|
||||||
if (autosave)
|
if (autosave)
|
||||||
storeAllProducts();
|
storeAllProducts();
|
||||||
// saveProducts(autoSaveFilename, multiSave);
|
// saveProducts(autoSaveFilename, multiSave);
|
||||||
|
|
||||||
if (needsSaving) {
|
if (PgenUtil.getPgenMode() == PgenMode.SINGLE){
|
||||||
promptToSave(paneImage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PgenUtil.getPgenMode() == PgenMode.SINGLE)
|
|
||||||
PgenUtil.resetResourceData();
|
PgenUtil.resetResourceData();
|
||||||
|
}
|
||||||
|
|
||||||
deactivatePgenTools();
|
deactivatePgenTools();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 15, 2012 bgonzale Initial creation
|
* Jun 15, 2012 bgonzale Initial creation
|
||||||
|
* Dec 10, 2014 R5413 byin Added dispose method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -118,4 +119,13 @@ public class PgenResourceGhost {
|
||||||
public void setGhostLine(AbstractDrawableComponent ghost) {
|
public void setGhostLine(AbstractDrawableComponent ghost) {
|
||||||
this.component = ghost;
|
this.component = ghost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Release resources held by the ghost elements.
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
for (AbstractElementContainer aec : componentMap.values()) {
|
||||||
|
aec.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.geotools.data.Query;
|
import org.geotools.data.DefaultQuery;
|
||||||
import org.geotools.data.shapefile.ShapefileDataStore;
|
import org.geotools.data.shapefile.ShapefileDataStore;
|
||||||
import org.geotools.feature.FeatureIterator;
|
import org.geotools.feature.FeatureIterator;
|
||||||
import org.geotools.referencing.GeodeticCalculator;
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
|
@ -60,7 +60,6 @@ import com.vividsolutions.jts.geom.Polygon;
|
||||||
* 02/2012 #597 S. Gurung Moved snap functionalities to SnapUtil. Removed GUI snapping for Non ConvSigmet.
|
* 02/2012 #597 S. Gurung Moved snap functionalities to SnapUtil. Removed GUI snapping for Non ConvSigmet.
|
||||||
* 02/2012 S. Gurung Moved back isSnapADC() and getNumOfCompassPts() to SigmetInfo from SnapUtil
|
* 02/2012 S. Gurung Moved back isSnapADC() and getNumOfCompassPts() to SigmetInfo from SnapUtil
|
||||||
* 11/12 #893 J. Wu TTR635 - Fix volcano in alphabetical breakdown order.
|
* 11/12 #893 J. Wu TTR635 - Fix volcano in alphabetical breakdown order.
|
||||||
* Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5
|
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author gzhang
|
* @author gzhang
|
||||||
|
@ -288,7 +287,7 @@ public class SigmetInfo {
|
||||||
public static Polygon getIsolatedPolygon(Coordinate vertex, double widthInNautical, IMapDescriptor mapDescriptor){
|
public static Polygon getIsolatedPolygon(Coordinate vertex, double widthInNautical, IMapDescriptor mapDescriptor){
|
||||||
Coordinate[] isolated = getIsolated(vertex, widthInNautical, mapDescriptor);
|
Coordinate[] isolated = getIsolated(vertex, widthInNautical, mapDescriptor);
|
||||||
Coordinate[] ip = new Coordinate[isolated.length+1];
|
Coordinate[] ip = new Coordinate[isolated.length+1];
|
||||||
ip = (Coordinate[]) Arrays.copyOf(isolated, isolated.length);
|
ip = Arrays.copyOf(isolated, isolated.length);
|
||||||
ip[ip.length-1] = isolated[0];
|
ip[ip.length-1] = isolated[0];
|
||||||
return getPolygon( ip,mapDescriptor );
|
return getPolygon( ip,mapDescriptor );
|
||||||
}
|
}
|
||||||
|
@ -296,7 +295,7 @@ public class SigmetInfo {
|
||||||
public static Polygon getSOLPolygon(Coordinate[] coors, String line, double width, IMapDescriptor mapDescriptor){
|
public static Polygon getSOLPolygon(Coordinate[] coors, String line, double width, IMapDescriptor mapDescriptor){
|
||||||
Coordinate[] ip = getSOLCoors(coors, line, width, mapDescriptor);
|
Coordinate[] ip = getSOLCoors(coors, line, width, mapDescriptor);
|
||||||
Coordinate[] ipPlus = new Coordinate[ip.length+1];
|
Coordinate[] ipPlus = new Coordinate[ip.length+1];
|
||||||
ipPlus = (Coordinate[]) Arrays.copyOf(ip, ipPlus.length);
|
ipPlus = Arrays.copyOf(ip, ipPlus.length);
|
||||||
ipPlus[ipPlus.length-1] = ip[0];
|
ipPlus[ipPlus.length-1] = ip[0];
|
||||||
return getPolygon( ipPlus,mapDescriptor );
|
return getPolygon( ipPlus,mapDescriptor );
|
||||||
}
|
}
|
||||||
|
@ -536,13 +535,18 @@ public class SigmetInfo {
|
||||||
|
|
||||||
FeatureIterator<SimpleFeature> featureIterator = null;
|
FeatureIterator<SimpleFeature> featureIterator = null;
|
||||||
HashMap<String,Coordinate[]> firGeoMap = new HashMap<String,Coordinate[]>();
|
HashMap<String,Coordinate[]> firGeoMap = new HashMap<String,Coordinate[]>();
|
||||||
ShapefileDataStore shapefileDataStore=null;
|
ShapefileDataStore shapefileDataStore = null;
|
||||||
String shapeField=null;
|
String shapeField=null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
File file = PgenStaticDataProvider.getProvider().getFirBoundsFile();
|
File file = PgenStaticDataProvider.getProvider().getFirBoundsFile();
|
||||||
shapefileDataStore = new ShapefileDataStore(file.toURI()
|
shapefileDataStore = new ShapefileDataStore(file.toURI().toURL());
|
||||||
.toURL());
|
shapefileDataStore.setMemoryMapped(false);
|
||||||
|
shapefileDataStore.setIndexCreationEnabled(true);
|
||||||
|
|
||||||
|
// shapefileDataStore = new IndexedShapefileDataStore(file.toURI()
|
||||||
|
// .toURL(), null, false, true,
|
||||||
|
// org.geotools.data.shapefile.indexed.IndexType.QIX);
|
||||||
|
|
||||||
shapeField = shapefileDataStore.getFeatureSource().getSchema().getGeometryDescriptor().getLocalName();
|
shapeField = shapefileDataStore.getFeatureSource().getSchema().getGeometryDescriptor().getLocalName();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
@ -554,7 +558,7 @@ public class SigmetInfo {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String[] types = shapefileDataStore.getTypeNames();
|
String[] types = shapefileDataStore.getTypeNames();
|
||||||
Query query = new Query();
|
DefaultQuery query = new DefaultQuery();
|
||||||
query.setTypeName(types[0]);
|
query.setTypeName(types[0]);
|
||||||
|
|
||||||
String[] fields = new String[labelFields.length+1];
|
String[] fields = new String[labelFields.length+1];
|
||||||
|
|
|
@ -18,8 +18,10 @@ import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
|
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
|
||||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
import com.raytheon.viz.ui.EditorUtil;
|
import com.raytheon.viz.ui.EditorUtil;
|
||||||
|
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
|
|
||||||
//import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor;
|
//import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor;
|
||||||
|
|
||||||
|
@ -75,9 +77,11 @@ public abstract class AbstractPgenDrawingTool extends AbstractPgenTool {
|
||||||
protected void activateTool() {
|
protected void activateTool() {
|
||||||
IEditorPart ep = EditorUtil.getActiveEditor();
|
IEditorPart ep = EditorUtil.getActiveEditor();
|
||||||
|
|
||||||
if (!PgenUtil.isNatlCntrsEditor(ep)) {
|
if (!PgenUtil.isNatlCntrsEditor(ep) && !(ep instanceof VizMapEditor)) {
|
||||||
// mapEditor = null;
|
// mapEditor = null;
|
||||||
return;
|
// drawingLayer = PgenUtil.findPgenResource((AbstractEditor)ep);
|
||||||
|
// if ( drawingLayer == null )
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!super.isDelObj()) {
|
if (!super.isDelObj()) {
|
||||||
|
|
|
@ -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>
|
||||||
*
|
*
|
||||||
|
@ -80,7 +81,8 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
|
||||||
|
|
||||||
// Get a PGEN Resource
|
// Get a PGEN Resource
|
||||||
drawingLayer = PgenSession.getInstance().getPgenResource();
|
drawingLayer = PgenSession.getInstance().getPgenResource();
|
||||||
|
|
||||||
|
|
||||||
if (this instanceof PgenDeleteObj) {
|
if (this instanceof PgenDeleteObj) {
|
||||||
delObjFlag = true;
|
delObjFlag = true;
|
||||||
} else if ((this instanceof PgenSelectingTool)
|
} else if ((this instanceof PgenSelectingTool)
|
||||||
|
@ -102,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();
|
||||||
|
@ -130,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -172,38 +172,6 @@ public class PgenAddLabelHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( ghostLabel != null ){
|
|
||||||
|
|
||||||
if(prevTool.getLabeledLine().getName().contains("CCFP_SIGMET")){
|
|
||||||
addCcfpLabel(loc, prevTool.getLabeledLine());
|
|
||||||
cleanUp();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
if ( !pts.isEmpty()){
|
|
||||||
// addLabel( pts.get(pts.size()-1), prevTool.getLabeledLine() );
|
|
||||||
addLabel( pts.get(pts.size()-1), (LabeledLine)lineSelected.getParent() );
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lineSelected = null;
|
|
||||||
ghostLabel = null;
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pts.clear();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//clean up and exit
|
|
||||||
lineSelected = null;
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
prevTool.resetMouseHandler();
|
|
||||||
dlg.resetLabeledLineBtns();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -296,8 +264,65 @@ public class PgenAddLabelHandler extends InputHandlerDefaultImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !drawingLayer.isEditable()|| shiftDown ) return false;
|
if ( !drawingLayer.isEditable()|| shiftDown ) return false;
|
||||||
else return true; }
|
else return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
// Check if mouse is in geographic extent
|
||||||
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
|
if ( loc == null ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mouseButton == 3 ){
|
||||||
|
if ( ghostLabel != null ){
|
||||||
|
|
||||||
|
if(prevTool.getLabeledLine().getName().contains("CCFP_SIGMET")){
|
||||||
|
addCcfpLabel(loc, prevTool.getLabeledLine());
|
||||||
|
cleanUp();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
if ( !pts.isEmpty()){
|
||||||
|
// addLabel( pts.get(pts.size()-1), prevTool.getLabeledLine() );
|
||||||
|
addLabel( pts.get(pts.size()-1), (LabeledLine)lineSelected.getParent() );
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lineSelected = null;
|
||||||
|
ghostLabel = null;
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pts.clear();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//clean up and exit
|
||||||
|
lineSelected = null;
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
prevTool.resetMouseHandler();
|
||||||
|
dlg.resetLabeledLineBtns();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create label for line ln at location loc.
|
* Create label for line ln at location loc.
|
||||||
* @param loc
|
* @param loc
|
||||||
|
|
|
@ -151,6 +151,9 @@ public class PgenAddPointAltHandler extends InputHandlerDefaultImpl {
|
||||||
return preempt;
|
return preempt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if ( button == 3 ){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
else{
|
else{
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,9 @@ public class PgenAddPointHandler extends InputHandlerDefaultImpl {
|
||||||
return preempt;
|
return preempt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if ( button == 3 ){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -115,12 +115,7 @@ public class PgenAvnTextDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
// The following methods are called when the tool is deactivated
|
|
||||||
// and are not needed here
|
|
||||||
//drawingLayer.removeGhostLine();
|
|
||||||
//mapEditor.refresh();
|
|
||||||
//attrDlg.close();
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -168,6 +163,26 @@ public class PgenAvnTextDrawingTool extends AbstractPgenDrawingTool {
|
||||||
if ( shiftDown || !isResourceEditable()) return false;
|
if ( shiftDown || !isResourceEditable()) return false;
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||||
|
if ( !isResourceEditable()|| shiftDown ) return false;
|
||||||
|
|
||||||
|
// prevent the click going through to other handlers
|
||||||
|
// in case adding labels to symbols or fronts.
|
||||||
|
if ( mouseButton == 3 ) {
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,32 +306,7 @@ public class PgenConnectTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
} else if (button == 3) {
|
} else if (button == 3) {
|
||||||
|
|
||||||
if (secondEl != null) {
|
return true;
|
||||||
// reselect the second element
|
|
||||||
ghostEl = createGhostElement(firstEl, nearPt, loc);
|
|
||||||
drawingLayer.setGhostLine(ghostEl);
|
|
||||||
|
|
||||||
secondEl = null;
|
|
||||||
secondJet = null;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (firstEl != null) {
|
|
||||||
// unselect the first element but stay in "Connect" mode
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
nearPt = 0;
|
|
||||||
firstEl = null;
|
|
||||||
firstJet = null;
|
|
||||||
} else {
|
|
||||||
// Exit "Connect" mode & set selecting mode
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else { // Button 2 - ignore
|
} else { // Button 2 - ignore
|
||||||
|
|
||||||
|
@ -383,6 +358,40 @@ public class PgenConnectTool extends AbstractPgenDrawingTool {
|
||||||
if (!isResourceEditable()) {
|
if (!isResourceEditable()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
|
if (loc == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
if (secondEl != null) {
|
||||||
|
// reselect the second element
|
||||||
|
ghostEl = createGhostElement(firstEl, nearPt, loc);
|
||||||
|
drawingLayer.setGhostLine(ghostEl);
|
||||||
|
|
||||||
|
secondEl = null;
|
||||||
|
secondJet = null;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (firstEl != null) {
|
||||||
|
// unselect the first element but stay in "Connect" mode
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
nearPt = 0;
|
||||||
|
firstEl = null;
|
||||||
|
firstJet = null;
|
||||||
|
} else {
|
||||||
|
// Exit "Connect" mode & set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,21 +8,9 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.ui.pgen.tools;
|
package gov.noaa.nws.ncep.ui.pgen.tools;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.widgets.Event;
|
|
||||||
import org.geotools.coverage.grid.GridEnvelope2D;
|
|
||||||
import org.opengis.coverage.grid.GridEnvelope;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
|
||||||
import com.raytheon.uf.viz.core.PixelExtent;
|
|
||||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.contours.Contours;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
||||||
|
@ -31,9 +19,19 @@ import gov.noaa.nws.ncep.ui.pgen.elements.WatchBox;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter;
|
import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
|
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.gfa.GfaReducePoint;
|
import gov.noaa.nws.ncep.ui.pgen.gfa.GfaReducePoint;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.contours.Contours;
|
|
||||||
import gov.noaa.nws.ncep.viz.common.SnapUtil;
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.sigmet.SigmetInfo;
|
import gov.noaa.nws.ncep.ui.pgen.sigmet.SigmetInfo;
|
||||||
|
import gov.noaa.nws.ncep.viz.common.SnapUtil;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.geotools.coverage.grid.GridEnvelope2D;
|
||||||
|
import org.geotools.referencing.CRS;
|
||||||
|
import org.opengis.coverage.grid.GridEnvelope;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a modal map tool for the PGEN copy element function.
|
* Implements a modal map tool for the PGEN copy element function.
|
||||||
|
@ -57,6 +55,7 @@ import gov.noaa.nws.ncep.ui.pgen.sigmet.SigmetInfo;
|
||||||
* 05/11 #808 J. Wu Update Gfa vor text
|
* 05/11 #808 J. Wu Update Gfa vor text
|
||||||
* 05/12 #610 J. Wu Add warning when GFA FROM lines > 3
|
* 05/12 #610 J. Wu Add warning when GFA FROM lines > 3
|
||||||
* 08/12 #760 B. Yin Check for world wrap
|
* 08/12 #760 B. Yin Check for world wrap
|
||||||
|
* 09/14 ? B. Yin Handle map bounds.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -109,6 +108,7 @@ public class PgenCopyElement extends AbstractPgenTool {
|
||||||
|
|
||||||
protected boolean simulate;
|
protected boolean simulate;
|
||||||
|
|
||||||
|
private boolean isMercator = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -121,7 +121,7 @@ public class PgenCopyElement extends AbstractPgenTool {
|
||||||
if ( !isResourceEditable() ) return false;
|
if ( !isResourceEditable() ) return false;
|
||||||
|
|
||||||
preempt = false;
|
preempt = false;
|
||||||
|
isMercator = (CRS.getMapProjection( mapEditor.getActiveDisplayPane().getDescriptor().getCRS())).getName().contains("Mercator");
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||||
if ( loc == null || shiftDown || simulate ) return false;
|
if ( loc == null || shiftDown || simulate ) return false;
|
||||||
|
@ -148,18 +148,6 @@ public class PgenCopyElement extends AbstractPgenTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( drawingLayer.getSelectedComp() != null ){
|
|
||||||
// de-select element
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
ghostEl = null;
|
|
||||||
mapEditor.refresh();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// set selecting mode
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -225,6 +213,15 @@ public class PgenCopyElement extends AbstractPgenTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ghostEl != null ) {
|
if ( ghostEl != null ) {
|
||||||
|
|
||||||
|
//save the original points
|
||||||
|
ArrayList<Coordinate> originalPts = new ArrayList<Coordinate>();
|
||||||
|
for ( Coordinate coord : ghostEl.getPoints()){
|
||||||
|
originalPts.add(new Coordinate(coord.x, coord.y, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hitBound = false;
|
||||||
|
|
||||||
// use screen coordinate to copy/move
|
// use screen coordinate to copy/move
|
||||||
//double[] locScreen = mapEditor.translateInverseClick(loc);
|
//double[] locScreen = mapEditor.translateInverseClick(loc);
|
||||||
double[] ptScreen = mapEditor.translateInverseClick(ptSelected);
|
double[] ptScreen = mapEditor.translateInverseClick(ptSelected);
|
||||||
|
@ -242,17 +239,21 @@ public class PgenCopyElement extends AbstractPgenTool {
|
||||||
|
|
||||||
double[] world = mapEditor.getActiveDisplayPane().screenToGrid(scnPt[0], scnPt[1], 0);
|
double[] world = mapEditor.getActiveDisplayPane().screenToGrid(scnPt[0], scnPt[1], 0);
|
||||||
|
|
||||||
if ( world[0] > ((GridEnvelope2D)ge).getWidth() ) {
|
if ( isMercator && world[0] > ((GridEnvelope2D)ge).getWidth() ) {
|
||||||
// System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() );
|
// System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() );
|
||||||
world[0] -= ((GridEnvelope2D)ge).getWidth();
|
world[0] -= ((GridEnvelope2D)ge).getWidth();
|
||||||
scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world );
|
scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world );
|
||||||
}
|
}
|
||||||
else if ( world[0] < 0 ){
|
else if ( isMercator && world[0] < 0 ){
|
||||||
// System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() );
|
// System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() );
|
||||||
world[0] += ((GridEnvelope2D)ge).getWidth();
|
world[0] += ((GridEnvelope2D)ge).getWidth();
|
||||||
scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world );
|
scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world );
|
||||||
}
|
}
|
||||||
|
else if ( world[0] > ((GridEnvelope2D)ge).getWidth() || world[0] < 0 ||
|
||||||
|
world[1] < 0 || world[1] > ((GridEnvelope2D)ge).getHeight()){
|
||||||
|
hitBound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Coordinate cord = mapEditor.translateClick(scnPt[0], scnPt[1]);
|
Coordinate cord = mapEditor.translateClick(scnPt[0], scnPt[1]);
|
||||||
|
|
||||||
|
@ -263,6 +264,14 @@ public class PgenCopyElement extends AbstractPgenTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( hitBound ){
|
||||||
|
//restore original points
|
||||||
|
for ( int idx = 0; idx < ghostEl.getPoints().size(); idx++ ){
|
||||||
|
ghostEl.getPoints().get(idx).x = originalPts.get(idx).x;
|
||||||
|
ghostEl.getPoints().get(idx).y = originalPts.get(idx).y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( elSelected instanceof Gfa ) {
|
if ( elSelected instanceof Gfa ) {
|
||||||
|
|
||||||
double[] scnPt = mapEditor.translateInverseClick( ((Gfa) elSelected).getGfaTextCoordinate() );
|
double[] scnPt = mapEditor.translateInverseClick( ((Gfa) elSelected).getGfaTextCoordinate() );
|
||||||
|
@ -323,6 +332,24 @@ public class PgenCopyElement extends AbstractPgenTool {
|
||||||
|
|
||||||
if ( !isResourceEditable()|| shiftDown || simulate ) return false;
|
if ( !isResourceEditable()|| shiftDown || simulate ) return false;
|
||||||
|
|
||||||
|
if ( button == 3 ) {
|
||||||
|
|
||||||
|
if ( drawingLayer.getSelectedComp() != null ){
|
||||||
|
// de-select element
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
ghostEl = null;
|
||||||
|
mapEditor.refresh();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ( ghostEl != null ) {
|
if ( ghostEl != null ) {
|
||||||
|
|
||||||
// reset color for the el and add it to PGEN resource
|
// reset color for the el and add it to PGEN resource
|
||||||
|
|
|
@ -60,6 +60,24 @@ public class PgenDeleteObj extends AbstractPgenTool {
|
||||||
if (!isResourceEditable())
|
if (!isResourceEditable())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
|
||||||
|
* int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button) {
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (button == 3) {
|
if (button == 3) {
|
||||||
// set selecting mode
|
// set selecting mode
|
||||||
PgenUtil.setSelectingMode();
|
PgenUtil.setSelectingMode();
|
||||||
|
|
|
@ -242,15 +242,7 @@ public class PgenDeletePart extends PgenSelectingTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
// reset
|
|
||||||
ptSelected = false;
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
lil = null;
|
|
||||||
mapEditor.refresh();
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -281,7 +273,23 @@ public class PgenDeletePart extends PgenSelectingTool {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseUp(int x, int y, int button){
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
return false;
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
// reset
|
||||||
|
ptSelected = false;
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
lil = null;
|
||||||
|
mapEditor.refresh();
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -126,7 +126,9 @@ public class PgenDeletePointHandler extends PgenSelectHandler{
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if ( button == 3 ){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -135,21 +135,6 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
// NmapUiUtils.setPanningMode();
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,7 +190,6 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -216,7 +200,36 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool {
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the given starting angle is less than the ending angle
|
* Check if the given starting angle is less than the ending angle
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,49 +36,49 @@ import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter;
|
||||||
* @author J. Wu
|
* @author J. Wu
|
||||||
*/
|
*/
|
||||||
public class PgenExtrapTool extends AbstractPgenDrawingTool {
|
public class PgenExtrapTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input handler for mouse events.
|
* Input handler for mouse events.
|
||||||
*/
|
*/
|
||||||
public PgenExtrapTool(){
|
public PgenExtrapTool(){
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current mouse handler.
|
* Returns the current mouse handler.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public IInputHandler getMouseHandler() {
|
public IInputHandler getMouseHandler() {
|
||||||
|
|
||||||
if ( this.mouseHandler == null ) {
|
if ( this.mouseHandler == null ) {
|
||||||
|
|
||||||
this.mouseHandler = new PgenExtrapHandler();
|
this.mouseHandler = new PgenExtrapHandler();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.mouseHandler;
|
return this.mouseHandler;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements input handler for mouse events.
|
* Implements input handler for mouse events.
|
||||||
* @author jwu
|
* @author jwu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PgenExtrapHandler extends InputHandlerDefaultImpl {
|
public class PgenExtrapHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
private boolean preempt;
|
private boolean preempt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current extrapolation dialog.
|
* Current extrapolation dialog.
|
||||||
*/
|
*/
|
||||||
private PgenExtrapDlg extrapDlg = null;
|
private PgenExtrapDlg extrapDlg = null;
|
||||||
|
|
||||||
private OperationFilter extrapFilter = new OperationFilter( Operation.EXTRAPOLATE );
|
private OperationFilter extrapFilter = new OperationFilter( Operation.EXTRAPOLATE );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -87,86 +87,102 @@ public class PgenExtrapTool extends AbstractPgenDrawingTool {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDown( int anX, int aY, int button ) {
|
public boolean handleMouseDown( int anX, int aY, int button ) {
|
||||||
if ( !isResourceEditable() ) return false;
|
if ( !isResourceEditable() ) return false;
|
||||||
|
|
||||||
preempt = false;
|
preempt = false;
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||||
if ( loc == null || shiftDown ) return false;
|
if ( loc == null || shiftDown ) return false;
|
||||||
|
|
||||||
if ( button == 1 ) {
|
if ( button == 1 ) {
|
||||||
|
|
||||||
if ( drawingLayer.getSelectedComp() == null ) {
|
if ( drawingLayer.getSelectedComp() == null ) {
|
||||||
|
|
||||||
// Get the nearest element and set it as the selected element.
|
|
||||||
AbstractDrawableComponent elSelected = drawingLayer.getNearestComponent( loc, extrapFilter, true );
|
|
||||||
drawingLayer.setSelected( elSelected );
|
|
||||||
if ( elSelected != null ) preempt = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
extrapDlg = (PgenExtrapDlg)attrDlg;
|
|
||||||
|
|
||||||
AbstractDrawableComponent elem = drawingLayer.getSelectedComp();
|
|
||||||
|
|
||||||
AbstractDrawableComponent newDE = PgenToolUtils.extrapElement( elem,
|
|
||||||
extrapDlg.getDirection(), extrapDlg.getDistance() );
|
|
||||||
|
|
||||||
boolean getNewDE = true;
|
// Get the nearest element and set it as the selected element.
|
||||||
if ( newDE instanceof WatchBox ){
|
AbstractDrawableComponent elSelected = drawingLayer.getNearestComponent( loc, extrapFilter, true );
|
||||||
getNewDE = PgenWatchBoxModifyTool.resnapWatchBox(mapEditor, (WatchBox)newDE, (WatchBox)newDE);
|
drawingLayer.setSelected( elSelected );
|
||||||
}
|
if ( elSelected != null ) preempt = true;
|
||||||
|
|
||||||
if ( getNewDE ){
|
|
||||||
if ( extrapDlg.isCopy() ) {
|
|
||||||
drawingLayer.addElement( newDE );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
drawingLayer.replaceElement( drawingLayer.getSelectedComp(), newDE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
return preempt;
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( button == 3 ) {
|
|
||||||
|
|
||||||
if ( drawingLayer.getSelectedComp() != null ) {
|
|
||||||
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// set selecting mode
|
extrapDlg = (PgenExtrapDlg)attrDlg;
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
AbstractDrawableComponent elem = drawingLayer.getSelectedComp();
|
||||||
|
|
||||||
|
AbstractDrawableComponent newDE = PgenToolUtils.extrapElement( elem,
|
||||||
|
extrapDlg.getDirection(), extrapDlg.getDistance() );
|
||||||
|
|
||||||
|
boolean getNewDE = true;
|
||||||
|
if ( newDE instanceof WatchBox ){
|
||||||
|
getNewDE = PgenWatchBoxModifyTool.resnapWatchBox(mapEditor, (WatchBox)newDE, (WatchBox)newDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getNewDE ){
|
||||||
|
if ( extrapDlg.isCopy() ) {
|
||||||
|
drawingLayer.addElement( newDE );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawingLayer.replaceElement( drawingLayer.getSelectedComp(), newDE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
return preempt;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !isResourceEditable() || shiftDown ) return false;
|
if ( !isResourceEditable() || shiftDown ) return false;
|
||||||
else return preempt;
|
else return preempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
if ( drawingLayer.getSelectedComp() != null ) {
|
||||||
|
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,52 +40,52 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PgenFlipDrawingElement extends AbstractPgenTool {
|
public class PgenFlipDrawingElement extends AbstractPgenTool {
|
||||||
|
|
||||||
//private Log log = LogFactory.getLog(getClass());
|
//private Log log = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input handler for mouse events.
|
* Input handler for mouse events.
|
||||||
*/
|
*/
|
||||||
protected IInputHandler flipHandler;
|
protected IInputHandler flipHandler;
|
||||||
|
|
||||||
|
|
||||||
public PgenFlipDrawingElement(){
|
public PgenFlipDrawingElement(){
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current mouse handler.
|
* Returns the current mouse handler.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public IInputHandler getMouseHandler() {
|
public IInputHandler getMouseHandler() {
|
||||||
if ( this.flipHandler == null ) {
|
if ( this.flipHandler == null ) {
|
||||||
this.flipHandler = new PgenFlipHandler(drawingLayer, mapEditor);
|
this.flipHandler = new PgenFlipHandler(drawingLayer, mapEditor);
|
||||||
}
|
}
|
||||||
return this.flipHandler;
|
return this.flipHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements input handler for mouse events.
|
* Implements input handler for mouse events.
|
||||||
* @author Michael Gao
|
* @author Michael Gao
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PgenFlipHandler extends InputHandlerDefaultImpl {
|
public class PgenFlipHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
private PgenResource flipPgenSource;
|
private PgenResource flipPgenSource;
|
||||||
// private NCMapEditor flipNCMapEditor;
|
// private NCMapEditor flipNCMapEditor;
|
||||||
private AbstractEditor flipNCMapEditor;
|
private AbstractEditor flipNCMapEditor;
|
||||||
private boolean preempt;
|
private boolean preempt;
|
||||||
private OperationFilter flipFilter;
|
private OperationFilter flipFilter;
|
||||||
|
|
||||||
// public PgenFlipHandler(PgenResource _flipPgenSource, NCMapEditor _flipNCMapEditor) {
|
// public PgenFlipHandler(PgenResource _flipPgenSource, NCMapEditor _flipNCMapEditor) {
|
||||||
public PgenFlipHandler(PgenResource _flipPgenSource, AbstractEditor _flipNCMapEditor) {
|
public PgenFlipHandler(PgenResource _flipPgenSource, AbstractEditor _flipNCMapEditor) {
|
||||||
flipPgenSource = _flipPgenSource;
|
flipPgenSource = _flipPgenSource;
|
||||||
flipNCMapEditor = _flipNCMapEditor;
|
flipNCMapEditor = _flipNCMapEditor;
|
||||||
flipFilter = new OperationFilter( Operation.FLIP );
|
flipFilter = new OperationFilter( Operation.FLIP );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -94,54 +94,73 @@ public class PgenFlipDrawingElement extends AbstractPgenTool {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDown(int anX, int aY, int button) {
|
public boolean handleMouseDown(int anX, int aY, int button) {
|
||||||
if ( !isResourceEditable() ) return false;
|
if ( !isResourceEditable() ) return false;
|
||||||
|
|
||||||
preempt = false;
|
preempt = false;
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = flipNCMapEditor.translateClick(anX, aY);
|
Coordinate loc = flipNCMapEditor.translateClick(anX, aY);
|
||||||
if ( loc == null || shiftDown ) return false;
|
if ( loc == null || shiftDown ) return false;
|
||||||
|
|
||||||
//DrawableElement selectedDrawableElement = flipPgenSource.getSelectedDE();
|
|
||||||
AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp();
|
|
||||||
|
|
||||||
if ( button == 1 ) {
|
//DrawableElement selectedDrawableElement = flipPgenSource.getSelectedDE();
|
||||||
/*
|
AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp();
|
||||||
* create a new DrawableElement with reversed points based on the selectedDrawableElement
|
|
||||||
*/
|
if ( button == 1 ) {
|
||||||
AbstractDrawableComponent reversedDrawableElement = null;
|
/*
|
||||||
if ( selectedDrawableElement instanceof Cloud ){
|
* create a new DrawableElement with reversed points based on the selectedDrawableElement
|
||||||
reversedDrawableElement = selectedDrawableElement.copy();
|
*/
|
||||||
DrawableElement de = flipPgenSource.getNearestElement( loc, (Cloud)reversedDrawableElement );
|
AbstractDrawableComponent reversedDrawableElement = null;
|
||||||
if ( de != null && de instanceof Line ){
|
if ( selectedDrawableElement instanceof Cloud ){
|
||||||
((Cloud)reversedDrawableElement).add(PgenToolUtils.createReversedDrawableElement(de));
|
reversedDrawableElement = selectedDrawableElement.copy();
|
||||||
((Cloud)reversedDrawableElement).remove(de);
|
DrawableElement de = flipPgenSource.getNearestElement( loc, (Cloud)reversedDrawableElement );
|
||||||
}
|
if ( de != null && de instanceof Line ){
|
||||||
else {
|
((Cloud)reversedDrawableElement).add(PgenToolUtils.createReversedDrawableElement(de));
|
||||||
return false;
|
((Cloud)reversedDrawableElement).remove(de);
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
return false;
|
||||||
reversedDrawableElement = PgenToolUtils.createReversedDrawableElement(selectedDrawableElement);
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
leftMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, reversedDrawableElement, loc);
|
reversedDrawableElement = PgenToolUtils.createReversedDrawableElement(selectedDrawableElement);
|
||||||
flipNCMapEditor.refresh();
|
}
|
||||||
if ( selectedDrawableElement != null ) preempt = true;
|
|
||||||
|
leftMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, reversedDrawableElement, loc);
|
||||||
|
flipNCMapEditor.refresh();
|
||||||
|
if ( selectedDrawableElement != null ) preempt = true;
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
rightMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, flipNCMapEditor);
|
return true;
|
||||||
}
|
}
|
||||||
return preempt;
|
return preempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
|
||||||
if ( !isResourceEditable() || shiftDown ) return false;
|
|
||||||
return preempt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
|
if ( !isResourceEditable() || shiftDown ) return false;
|
||||||
|
return preempt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp();
|
||||||
|
rightMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, flipNCMapEditor);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
* If the selectedDrawableElement is valid, reverse the Coordinate points of the
|
* If the selectedDrawableElement is valid, reverse the Coordinate points of the
|
||||||
* DrawableElement and then set the reversed points back to the DrawableElement. Otherwise,
|
* DrawableElement and then set the reversed points back to the DrawableElement. Otherwise,
|
||||||
* retrieve the nearest DrawableElement object using the current mouse location
|
* retrieve the nearest DrawableElement object using the current mouse location
|
||||||
|
@ -151,21 +170,21 @@ public class PgenFlipDrawingElement extends AbstractPgenTool {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private void leftMouseButtonDownHandler(PgenResource thePgenSource,
|
private void leftMouseButtonDownHandler(PgenResource thePgenSource,
|
||||||
AbstractDrawableComponent selectedDrawableElement,
|
AbstractDrawableComponent selectedDrawableElement,
|
||||||
AbstractDrawableComponent reversedDrawableElement,
|
AbstractDrawableComponent reversedDrawableElement,
|
||||||
Coordinate currentMouselocation) {
|
Coordinate currentMouselocation) {
|
||||||
if ( selectedDrawableElement == null ) {
|
if ( selectedDrawableElement == null ) {
|
||||||
// Get the nearest element and set it as the selected element.
|
// Get the nearest element and set it as the selected element.
|
||||||
selectedDrawableElement = thePgenSource.getNearestComponent( currentMouselocation, flipFilter, true );
|
selectedDrawableElement = thePgenSource.getNearestComponent( currentMouselocation, flipFilter, true );
|
||||||
if(selectedDrawableElement == null)
|
if(selectedDrawableElement == null)
|
||||||
return;
|
return;
|
||||||
thePgenSource.setSelected( selectedDrawableElement );
|
thePgenSource.setSelected( selectedDrawableElement );
|
||||||
} else {
|
} else {
|
||||||
thePgenSource.replaceElement(selectedDrawableElement, reversedDrawableElement);
|
thePgenSource.replaceElement(selectedDrawableElement, reversedDrawableElement);
|
||||||
thePgenSource.setSelected( reversedDrawableElement );
|
thePgenSource.setSelected( reversedDrawableElement );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a valid selectedDrawableElement still exists, de-select the element,
|
* If a valid selectedDrawableElement still exists, de-select the element,
|
||||||
* Otherwise, change the action mode to Selecting Mode from the Flip Mode
|
* Otherwise, change the action mode to Selecting Mode from the Flip Mode
|
||||||
|
@ -175,20 +194,20 @@ public class PgenFlipDrawingElement extends AbstractPgenTool {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private void rightMouseButtonDownHandler(PgenResource thePpgenSource,
|
private void rightMouseButtonDownHandler(PgenResource thePpgenSource,
|
||||||
// AbstractDrawableComponent selectedDrawableElement, NCMapEditor theNCMapEditor) {
|
// AbstractDrawableComponent selectedDrawableElement, NCMapEditor theNCMapEditor) {
|
||||||
AbstractDrawableComponent selectedDrawableElement, AbstractEditor theNCMapEditor) {
|
AbstractDrawableComponent selectedDrawableElement, AbstractEditor theNCMapEditor) {
|
||||||
if ( selectedDrawableElement != null ){
|
if ( selectedDrawableElement != null ){
|
||||||
// de-select element
|
// de-select element
|
||||||
thePpgenSource.removeSelected();
|
thePpgenSource.removeSelected();
|
||||||
selectedDrawableElement = null;
|
selectedDrawableElement = null;
|
||||||
theNCMapEditor.refresh();
|
theNCMapEditor.refresh();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// set selecting mode
|
// set selecting mode
|
||||||
PgenUtil.setSelectingMode();
|
PgenUtil.setSelectingMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,13 +110,6 @@ public class PgenFromTool extends AbstractPgenDrawingTool {
|
||||||
*/
|
*/
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
/*
|
|
||||||
* return to Pgen Select mode
|
|
||||||
*/
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -131,6 +124,29 @@ public class PgenFromTool extends AbstractPgenDrawingTool {
|
||||||
if ( !isResourceEditable() ) return false;
|
if ( !isResourceEditable() ) return false;
|
||||||
return preempt;
|
return preempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
/*
|
||||||
|
* return to Pgen Select mode
|
||||||
|
*/
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,73 +212,7 @@ public class PgenGfaDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
//exit drawing text mode
|
|
||||||
if ( startGfaText ) {
|
|
||||||
startGfaText = false;
|
|
||||||
|
|
||||||
if ( ((Gfa)elem).getGfaTextCoordinate() == null ){
|
|
||||||
//if right click before adding the text
|
|
||||||
((Gfa)elem).setGfaTextCoordinate(loc);
|
|
||||||
drawingLayer.addElement(elem);
|
|
||||||
validateGfa( (Gfa)elem) ;
|
|
||||||
mapEditor.refresh();
|
|
||||||
points.clear();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//change to selecting mode to move points
|
|
||||||
PgenUtil.setSelectingMode(elem);
|
|
||||||
elem = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
closeAttrDlg(attrDlg);
|
|
||||||
attrDlg = null;
|
|
||||||
drawingLayer.removeSelected((Gfa)elem);
|
|
||||||
elem = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
removeClearRefresh();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
|
|
||||||
|
|
||||||
if (drawableType == DrawableType.GFA && points.size() == 2 ) {
|
|
||||||
removeClearRefresh();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(!((GfaAttrDlg)attrDlg).validateRequiredFields()) return false;
|
|
||||||
|
|
||||||
if(((IGfa)attrDlg).getGfaFcstHr().indexOf("-") > -1) {
|
|
||||||
// snap
|
|
||||||
points = SnapUtil.getSnapWithStation(points,SnapUtil.VOR_STATION_LIST,10,16);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new DrawableElement.
|
|
||||||
elem = def.create( drawableType, (IAttribute)attrDlg,
|
|
||||||
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
//set the hour filter
|
|
||||||
if ( PgenFilterDlg.isFilterDlgOpen()){
|
|
||||||
PgenFilterDlg.getInstance(null).setHourChkBox(((Gfa)elem).getForecastHours(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//set from line
|
|
||||||
String vorText = Gfa.buildVorText( (Gfa)elem );
|
|
||||||
((Gfa)elem).setGfaVorText( vorText );
|
|
||||||
((GfaAttrDlg)attrDlg).setVorText( vorText );
|
|
||||||
|
|
||||||
startGfaText = true;
|
|
||||||
attrDlg.setAttrForDlg(attrDlg); // update the parameters in GfaAttrDlg
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ( button == 2 ){
|
else if ( button == 2 ){
|
||||||
|
@ -404,6 +338,94 @@ public class PgenGfaDrawingTool extends AbstractPgenDrawingTool {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if (!isResourceEditable() || shiftDown )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
|
if ( loc == null ) return true;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
//exit drawing text mode
|
||||||
|
if ( startGfaText ) {
|
||||||
|
startGfaText = false;
|
||||||
|
|
||||||
|
if ( ((Gfa)elem).getGfaTextCoordinate() == null ){
|
||||||
|
//if right click before adding the text
|
||||||
|
((Gfa)elem).setGfaTextCoordinate(loc);
|
||||||
|
drawingLayer.addElement(elem);
|
||||||
|
validateGfa( (Gfa)elem) ;
|
||||||
|
mapEditor.refresh();
|
||||||
|
points.clear();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//change to selecting mode to move points
|
||||||
|
PgenUtil.setSelectingMode(elem);
|
||||||
|
elem = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
closeAttrDlg(attrDlg);
|
||||||
|
attrDlg = null;
|
||||||
|
drawingLayer.removeSelected((Gfa)elem);
|
||||||
|
elem = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
removeClearRefresh();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
|
||||||
|
DrawableType drawableType = getDrawableType(pgenType);
|
||||||
|
|
||||||
|
if (drawableType == DrawableType.GFA && points.size() == 2 ) {
|
||||||
|
removeClearRefresh();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(!((GfaAttrDlg)attrDlg).validateRequiredFields()) return false;
|
||||||
|
|
||||||
|
if(((IGfa)attrDlg).getGfaFcstHr().indexOf("-") > -1) {
|
||||||
|
// snap
|
||||||
|
points = SnapUtil.getSnapWithStation(points,SnapUtil.VOR_STATION_LIST,10,16);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a new DrawableElement.
|
||||||
|
elem = def.create( drawableType, (IAttribute)attrDlg,
|
||||||
|
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
//set the hour filter
|
||||||
|
if ( PgenFilterDlg.isFilterDlgOpen()){
|
||||||
|
PgenFilterDlg.getInstance(null).setHourChkBox(((Gfa)elem).getForecastHours(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//set from line
|
||||||
|
String vorText = Gfa.buildVorText( (Gfa)elem );
|
||||||
|
((Gfa)elem).setGfaVorText( vorText );
|
||||||
|
((GfaAttrDlg)attrDlg).setVorText( vorText );
|
||||||
|
|
||||||
|
startGfaText = true;
|
||||||
|
attrDlg.setAttrForDlg(attrDlg); // update the parameters in GfaAttrDlg
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void clearPoints(){
|
public void clearPoints(){
|
||||||
points.clear();
|
points.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,6 @@ public class PgenGfaFormatTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
} else if (button == 3) {
|
} else if (button == 3) {
|
||||||
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -120,6 +119,24 @@ public class PgenGfaFormatTool extends AbstractPgenDrawingTool {
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringBuilder generate(PgenResource drawingLayer,
|
public StringBuilder generate(PgenResource drawingLayer,
|
||||||
|
|
|
@ -43,6 +43,7 @@ import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
|
||||||
* 04/11 #? B. Yin Re-factor IAttribute
|
* 04/11 #? B. Yin Re-factor IAttribute
|
||||||
* 11/12 #? J. Wu Added GFA
|
* 11/12 #? J. Wu Added GFA
|
||||||
* 07/13 #? J. Wu Interpolate GFA's top/bottom
|
* 07/13 #? J. Wu Interpolate GFA's top/bottom
|
||||||
|
* 01/15 R5413 B. Yin Clear status when de-activate.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author S. Gilbert
|
* @author S. Gilbert
|
||||||
|
@ -76,7 +77,20 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool {
|
||||||
verifySymbol = new Symbol(null, new Color[] { new Color(255,0,0) }, 1.0f, 1.0,
|
verifySymbol = new Symbol(null, new Color[] { new Color(255,0,0) }, 1.0f, 1.0,
|
||||||
false, null, "Marker", "FILLED_BOX" );
|
false, null, "Marker", "FILLED_BOX" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.tools.AbstractModalTool#deactivateTool()
|
||||||
|
*/
|
||||||
|
// @Override
|
||||||
|
public void deactivateTool() {
|
||||||
|
|
||||||
|
status = SELECT_STATUS.START;
|
||||||
|
super.deactivateTool();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns the current mouse handler.
|
* Creates and returns the current mouse handler.
|
||||||
* @return
|
* @return
|
||||||
|
@ -190,53 +204,7 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool {
|
||||||
* Right mouse button pressed
|
* Right mouse button pressed
|
||||||
*/
|
*/
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
switch (status) {
|
|
||||||
case START:
|
|
||||||
/*
|
|
||||||
* return to Pgen Select mode
|
|
||||||
*/
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
break;
|
|
||||||
case SELECTED_1:
|
|
||||||
/*
|
|
||||||
* Remove currently selected element from selected list
|
|
||||||
*/
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
status = SELECT_STATUS.START;
|
|
||||||
break;
|
|
||||||
case VERIFIED_1:
|
|
||||||
/*
|
|
||||||
* Remove currently verified element from selected list
|
|
||||||
*/
|
|
||||||
interpDlg.enableStartTime();
|
|
||||||
interpDlg.enableEndTime();
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
status = SELECT_STATUS.START;
|
|
||||||
break;
|
|
||||||
case SELECTED_2:
|
|
||||||
/*
|
|
||||||
* Remove second selected element from selected list
|
|
||||||
*/
|
|
||||||
drawingLayer.removeSelected( selectedEls.get(1) );
|
|
||||||
status = SELECT_STATUS.VERIFIED_1;
|
|
||||||
break;
|
|
||||||
case VERIFIED_2:
|
|
||||||
/*
|
|
||||||
* remove all elements from the selected list
|
|
||||||
*/
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
interpDlg.enableStartTime();
|
|
||||||
interpDlg.enableEndTime();
|
|
||||||
interpDlg.disarm(); // Disable Interpolation button
|
|
||||||
status = SELECT_STATUS.START;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
//System.out.println("Button 3333333 status = "+status);
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -244,6 +212,66 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
switch (status) {
|
||||||
|
case START:
|
||||||
|
/*
|
||||||
|
* return to Pgen Select mode
|
||||||
|
*/
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
break;
|
||||||
|
case SELECTED_1:
|
||||||
|
/*
|
||||||
|
* Remove currently selected element from selected list
|
||||||
|
*/
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
status = SELECT_STATUS.START;
|
||||||
|
break;
|
||||||
|
case VERIFIED_1:
|
||||||
|
/*
|
||||||
|
* Remove currently verified element from selected list
|
||||||
|
*/
|
||||||
|
interpDlg.enableStartTime();
|
||||||
|
interpDlg.enableEndTime();
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
status = SELECT_STATUS.START;
|
||||||
|
break;
|
||||||
|
case SELECTED_2:
|
||||||
|
/*
|
||||||
|
* Remove second selected element from selected list
|
||||||
|
*/
|
||||||
|
drawingLayer.removeSelected( selectedEls.get(1) );
|
||||||
|
status = SELECT_STATUS.VERIFIED_1;
|
||||||
|
break;
|
||||||
|
case VERIFIED_2:
|
||||||
|
/*
|
||||||
|
* remove all elements from the selected list
|
||||||
|
*/
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
interpDlg.enableStartTime();
|
||||||
|
interpDlg.enableEndTime();
|
||||||
|
interpDlg.disarm(); // Disable Interpolation button
|
||||||
|
status = SELECT_STATUS.START;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
//System.out.println("Button 3333333 status = "+status);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
//import gov.noaa.nws.ncep.ui.display.InputHandlerDefaultImpl;
|
//import gov.noaa.nws.ncep.ui.display.InputHandlerDefaultImpl;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.attrdialog.JetAttrDlg;
|
import gov.noaa.nws.ncep.ui.pgen.attrdialog.JetAttrDlg;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.display.IText.DisplayType;
|
import gov.noaa.nws.ncep.ui.pgen.display.IText.DisplayType;
|
||||||
|
@ -110,12 +111,7 @@ public class PgenJetBarbAddingHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
if ( jetDlg != null )((JetAttrDlg)jetDlg).closeBarbDlg();
|
|
||||||
|
|
||||||
prevTool.resetMouseHandler();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -157,6 +153,27 @@ public class PgenJetBarbAddingHandler extends InputHandlerDefaultImpl {
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
if ( jetDlg != null )((JetAttrDlg)jetDlg).closeBarbDlg();
|
||||||
|
|
||||||
|
prevTool.resetMouseHandler();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the wind info(barb and FL text) at location loc.
|
* Create the wind info(barb and FL text) at location loc.
|
||||||
* @param loc
|
* @param loc
|
||||||
|
|
|
@ -136,10 +136,6 @@ public class PgenJetBarbDeletingHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
prevTool.resetMouseHandler();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -151,6 +147,25 @@ public class PgenJetBarbDeletingHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
prevTool.resetMouseHandler();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
|
@ -184,54 +184,7 @@ public class PgenJetDrawingTool extends PgenMultiPointDrawingTool
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
return true;
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
attrDlg.close();
|
|
||||||
attrDlg = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
// create a new Jet.
|
|
||||||
elem = def.create( DrawableType.JET, (IAttribute)attrDlg,
|
|
||||||
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
jet = (Jet)elem;
|
|
||||||
|
|
||||||
jet.setSnapTool(new PgenSnapJet(drawingLayer.getDescriptor(), mapEditor, (JetAttrDlg)attrDlg));
|
|
||||||
|
|
||||||
// add the jet to PGEN resource
|
|
||||||
drawingLayer.addElement( jet );
|
|
||||||
|
|
||||||
//reset the jet line attributes
|
|
||||||
AbstractDrawableComponent adc = AttrSettings.getInstance().getSettings().get( pgenType );
|
|
||||||
if ( adc != null && adc instanceof Jet ){
|
|
||||||
((Jet)adc).getJetLine().update(attrDlg);
|
|
||||||
}
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
((JetAttrDlg)attrDlg).setJetDrawingTool(PgenJetDrawingTool.this);
|
|
||||||
((JetAttrDlg)attrDlg).enableBarbBtns(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -282,5 +235,70 @@ public class PgenJetDrawingTool extends PgenMultiPointDrawingTool
|
||||||
if ( !isResourceEditable() || shiftDown ) return false;
|
if ( !isResourceEditable() || shiftDown ) return false;
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
attrDlg.close();
|
||||||
|
attrDlg = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// create a new Jet.
|
||||||
|
elem = def.create( DrawableType.JET, (IAttribute)attrDlg,
|
||||||
|
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
jet = (Jet)elem;
|
||||||
|
|
||||||
|
jet.setSnapTool(new PgenSnapJet(drawingLayer.getDescriptor(), mapEditor, (JetAttrDlg)attrDlg));
|
||||||
|
|
||||||
|
// add the jet to PGEN resource
|
||||||
|
drawingLayer.addElement( jet );
|
||||||
|
|
||||||
|
//reset the jet line attributes
|
||||||
|
AbstractDrawableComponent adc = AttrSettings.getInstance().getSettings().get( pgenType );
|
||||||
|
if ( adc != null && adc instanceof Jet ){
|
||||||
|
((Jet)adc).getJetLine().update(attrDlg);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
((JetAttrDlg)attrDlg).setJetDrawingTool(PgenJetDrawingTool.this);
|
||||||
|
((JetAttrDlg)attrDlg).enableBarbBtns(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,10 +95,6 @@ public class PgenJetHashAddingHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
prevTool.resetMouseHandler();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,7 +105,27 @@ public class PgenJetHashAddingHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
prevTool.resetMouseHandler();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -125,11 +125,7 @@ public class PgenJetHashDeletingHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
prevTool.resetMouseHandler();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -140,7 +136,27 @@ public class PgenJetHashDeletingHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
prevTool.resetMouseHandler();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
|
@ -128,15 +128,6 @@ public class PgenKinkLineDrawingTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
} else if (button == 3) {
|
} else if (button == 3) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
if (points.size() == 0) {
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
} else {
|
|
||||||
points.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (button == 2) {
|
} else if (button == 2) {
|
||||||
|
@ -150,7 +141,32 @@ public class PgenKinkLineDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
if (points.size() == 0) {
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
} else {
|
||||||
|
points.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
package gov.noaa.nws.ncep.ui.pgen.tools;
|
package gov.noaa.nws.ncep.ui.pgen.tools;
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.attrdialog.AttrDlg;
|
import gov.noaa.nws.ncep.ui.pgen.attrdialog.AttrDlg;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
||||||
|
@ -153,8 +154,6 @@ public class PgenLabeledLineDelHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
dlg.resetLabeledLineBtns();
|
|
||||||
prevTool.resetMouseHandler();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -165,7 +164,24 @@ public class PgenLabeledLineDelHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
dlg.resetLabeledLineBtns();
|
||||||
|
prevTool.resetMouseHandler();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
|
@ -181,82 +181,6 @@ public class PgenLabeledLineDrawingTool extends AbstractPgenDrawingTool
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (button == 3) {
|
} else if (button == 3) {
|
||||||
|
|
||||||
if (points.size() == 0) {
|
|
||||||
|
|
||||||
if (attrDlg.isAddLineMode()) {
|
|
||||||
// add mode
|
|
||||||
attrDlg.resetLabeledLineBtns();
|
|
||||||
} else {
|
|
||||||
// clean up
|
|
||||||
closeAttrDlg(attrDlg, pgenType);
|
|
||||||
attrDlg = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
labeledLine = null;
|
|
||||||
|
|
||||||
} else if (points.size() < 2) {
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// add the labeled line to PGEN resource
|
|
||||||
if (attrDlg.isAddLineMode()) {
|
|
||||||
elem = def.createLabeledLine(pgenCategory, pgenType,
|
|
||||||
(IAttribute) attrDlg, points, null,
|
|
||||||
drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
drawingLayer.addElement(elem);
|
|
||||||
labeledLine = (LabeledLine) elem;
|
|
||||||
AttrSettings.getInstance().setSettings(elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("CCFP_SIGMET".equals(pgenType)) {
|
|
||||||
|
|
||||||
elem = def.createLabeledLine(pgenCategory, pgenType,
|
|
||||||
(IAttribute) attrDlg, points, null,
|
|
||||||
drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
drawingLayer.addElement(elem);
|
|
||||||
labeledLine = (LabeledLine) elem;
|
|
||||||
|
|
||||||
if (ccdlg.isAreaType()) {// avoid 2 Sigmet elements
|
|
||||||
// issue
|
|
||||||
// If auto placement is on, add label directly.
|
|
||||||
if (!PgenUtil.getTextAutoPlacement()) {
|
|
||||||
/*
|
|
||||||
* return true;avoid right click cause no
|
|
||||||
* showing issue
|
|
||||||
*/
|
|
||||||
ccfpTxtFlag = true;
|
|
||||||
setAddingLabelHandler();
|
|
||||||
} else {
|
|
||||||
Text t = new Text();
|
|
||||||
Label lbl = new Label(t);
|
|
||||||
lbl.setParent(labeledLine);
|
|
||||||
setCcfpText(
|
|
||||||
labeledLine,
|
|
||||||
((gov.noaa.nws.ncep.ui.pgen.sigmet.Ccfp) labeledLine)
|
|
||||||
.getAreaLine(), t, lbl);
|
|
||||||
|
|
||||||
labeledLine.addLabel(lbl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
if (!ccfpTxtFlag)
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (button == 2) {
|
} else if (button == 2) {
|
||||||
|
@ -335,6 +259,98 @@ public class PgenLabeledLineDrawingTool extends AbstractPgenDrawingTool
|
||||||
points.clear();
|
points.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||||
|
if ( !isResourceEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if ( mouseButton == 3 ){
|
||||||
|
if (points.size() == 0) {
|
||||||
|
|
||||||
|
if (attrDlg.isAddLineMode()) {
|
||||||
|
// add mode
|
||||||
|
attrDlg.resetLabeledLineBtns();
|
||||||
|
} else {
|
||||||
|
// clean up
|
||||||
|
closeAttrDlg(attrDlg, pgenType);
|
||||||
|
attrDlg = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
labeledLine = null;
|
||||||
|
|
||||||
|
} else if (points.size() < 2) {
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// add the labeled line to PGEN resource
|
||||||
|
if (attrDlg.isAddLineMode()) {
|
||||||
|
elem = def.createLabeledLine(pgenCategory, pgenType,
|
||||||
|
(IAttribute) attrDlg, points, null,
|
||||||
|
drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
drawingLayer.addElement(elem);
|
||||||
|
labeledLine = (LabeledLine) elem;
|
||||||
|
AttrSettings.getInstance().setSettings(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("CCFP_SIGMET".equals(pgenType)) {
|
||||||
|
|
||||||
|
elem = def.createLabeledLine(pgenCategory, pgenType,
|
||||||
|
(IAttribute) attrDlg, points, null,
|
||||||
|
drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
drawingLayer.addElement(elem);
|
||||||
|
labeledLine = (LabeledLine) elem;
|
||||||
|
|
||||||
|
if (ccdlg.isAreaType()) {// avoid 2 Sigmet elements
|
||||||
|
// issue
|
||||||
|
// If auto placement is on, add label directly.
|
||||||
|
if (!PgenUtil.getTextAutoPlacement()) {
|
||||||
|
/*
|
||||||
|
* return true;avoid right click cause no
|
||||||
|
* showing issue
|
||||||
|
*/
|
||||||
|
ccfpTxtFlag = true;
|
||||||
|
setAddingLabelHandler();
|
||||||
|
} else {
|
||||||
|
Text t = new Text();
|
||||||
|
Label lbl = new Label(t);
|
||||||
|
lbl.setParent(labeledLine);
|
||||||
|
setCcfpText(
|
||||||
|
labeledLine,
|
||||||
|
((gov.noaa.nws.ncep.ui.pgen.sigmet.Ccfp) labeledLine)
|
||||||
|
.getAreaLine(), t, lbl);
|
||||||
|
|
||||||
|
labeledLine.addLabel(lbl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
if (!ccfpTxtFlag)
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Labeled Line in the current layer with input
|
* Returns the Labeled Line in the current layer with input
|
||||||
* type(Turb/Cloud).
|
* type(Turb/Cloud).
|
||||||
|
|
|
@ -185,57 +185,7 @@ public class PgenLabeledLineModifyTool extends PgenSelectingTool implements
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//clean up
|
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( attrDlg.isAddLineMode()){
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
attrDlg.resetLabeledLineBtns();
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//add line to labeled line collection
|
|
||||||
// LabeledLine newll = def.createLabeledLine( labeledLine.getPgenCategory(), labeledLine.getPgenType(),
|
|
||||||
// (IAttribute)attrDlg, points, labeledLine.copy(), drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
LabeledLine newll = def.createLabeledLine( pgenCategory, PgenLabeledLineModifyTool.this.pgenType, (IAttribute)attrDlg,
|
|
||||||
points, null, drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
// drawingLayer.replaceElement(labeledLine, newll);
|
|
||||||
drawingLayer.addElement( newll );
|
|
||||||
labeledLine = newll;
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
//re-set selected
|
|
||||||
// resetSelected();
|
|
||||||
|
|
||||||
drawingLayer.setSelected(newll);
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Close the attribute dialog and do the cleanup.
|
|
||||||
if ( attrDlg != null ) {
|
|
||||||
attrDlg.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
attrDlg = null;
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
ptSelected2 = false; ptSelected = false;
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
mapEditor.refresh();
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -510,6 +460,58 @@ public class PgenLabeledLineModifyTool extends PgenSelectingTool implements
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if ( button ==3 ) {
|
||||||
|
|
||||||
|
if ( attrDlg.isAddLineMode()){
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
attrDlg.resetLabeledLineBtns();
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//add line to labeled line collection
|
||||||
|
// LabeledLine newll = def.createLabeledLine( labeledLine.getPgenCategory(), labeledLine.getPgenType(),
|
||||||
|
// (IAttribute)attrDlg, points, labeledLine.copy(), drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
LabeledLine newll = def.createLabeledLine( pgenCategory, PgenLabeledLineModifyTool.this.pgenType, (IAttribute)attrDlg,
|
||||||
|
points, null, drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
// drawingLayer.replaceElement(labeledLine, newll);
|
||||||
|
drawingLayer.addElement( newll );
|
||||||
|
labeledLine = newll;
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
//re-set selected
|
||||||
|
// resetSelected();
|
||||||
|
|
||||||
|
drawingLayer.setSelected(newll);
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Close the attribute dialog and do the cleanup.
|
||||||
|
if ( attrDlg != null ) {
|
||||||
|
attrDlg.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
attrDlg = null;
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
ptSelected2 = false; ptSelected = false;
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
mapEditor.refresh();
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//make sure the arrow line won't go through the text box.
|
//make sure the arrow line won't go through the text box.
|
||||||
if(labeledLine instanceof Ccfp) ((Ccfp)labeledLine).moveText2Last();
|
if(labeledLine instanceof Ccfp) ((Ccfp)labeledLine).moveText2Last();
|
||||||
|
|
|
@ -177,6 +177,67 @@ public class PgenModifyTool extends AbstractPgenTool {
|
||||||
|
|
||||||
} else if (button == 3) {
|
} else if (button == 3) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseMove(int,
|
||||||
|
* int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseMove(int x, int y) {
|
||||||
|
if (!isResourceEditable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Check if mouse is in geographic extent
|
||||||
|
Coordinate loc = mapEditor.translateClick(x, y);
|
||||||
|
if (loc == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// create the ghost element and put it in the drawing layer
|
||||||
|
if (clickPts != null && clickPts.size() >= 1) {
|
||||||
|
|
||||||
|
ArrayList<Coordinate> newPts = new ArrayList<Coordinate>(
|
||||||
|
clickPts);
|
||||||
|
newPts.add(loc);
|
||||||
|
|
||||||
|
pml.setClickPts(latlonToPixel(newPts
|
||||||
|
.toArray(new Coordinate[newPts.size()])));
|
||||||
|
|
||||||
|
ModifyLine();
|
||||||
|
|
||||||
|
ghostEl.setColors(new Color[] { ghostColor,
|
||||||
|
new java.awt.Color(255, 255, 255) });
|
||||||
|
drawingLayer.setGhostLine(ghostEl);
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
|
||||||
|
* int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button) {
|
||||||
|
if (!isResourceEditable() || shiftDown)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( button == 3 ) {
|
||||||
|
|
||||||
if (drawingLayer.getSelectedDE() != null) {
|
if (drawingLayer.getSelectedDE() != null) {
|
||||||
|
|
||||||
if (clickPts != null && !clickPts.isEmpty()) {
|
if (clickPts != null && !clickPts.isEmpty()) {
|
||||||
|
@ -265,68 +326,15 @@ public class PgenModifyTool extends AbstractPgenTool {
|
||||||
PgenUtil.setSelectingMode();
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseMove(int,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean handleMouseMove(int x, int y) {
|
|
||||||
if (!isResourceEditable())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
|
||||||
Coordinate loc = mapEditor.translateClick(x, y);
|
|
||||||
if (loc == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// create the ghost element and put it in the drawing layer
|
|
||||||
if (clickPts != null && clickPts.size() >= 1) {
|
|
||||||
|
|
||||||
ArrayList<Coordinate> newPts = new ArrayList<Coordinate>(
|
|
||||||
clickPts);
|
|
||||||
newPts.add(loc);
|
|
||||||
|
|
||||||
pml.setClickPts(latlonToPixel(newPts
|
|
||||||
.toArray(new Coordinate[newPts.size()])));
|
|
||||||
|
|
||||||
ModifyLine();
|
|
||||||
|
|
||||||
ghostEl.setColors(new Color[] { ghostColor,
|
|
||||||
new java.awt.Color(255, 255, 255) });
|
|
||||||
drawingLayer.setGhostLine(ghostEl);
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean handleMouseUp(int x, int y, int button) {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if (!isResourceEditable() || shiftDown)
|
if (!isResourceEditable() || shiftDown)
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Iterator;
|
||||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
||||||
import gov.noaa.nws.ncep.ui.pgen.elements.WatchBox;
|
import gov.noaa.nws.ncep.ui.pgen.elements.WatchBox;
|
||||||
|
@ -74,9 +75,27 @@ public class PgenMoveElement extends PgenCopyElement {
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseUp(int x, int y, int button) {
|
public boolean handleMouseUp(int x, int y, int button) {
|
||||||
|
|
||||||
if ( !isResourceEditable() || shiftDown || simulate ) return false;
|
if ( !isResourceEditable() || shiftDown || simulate ) return false;
|
||||||
|
|
||||||
if ( ghostEl != null ) {
|
if ( button == 3 ) {
|
||||||
|
|
||||||
|
if ( drawingLayer.getSelectedComp() != null ){
|
||||||
|
// de-select element
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
ghostEl = null;
|
||||||
|
mapEditor.refresh();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ghostEl != null ) {
|
||||||
|
|
||||||
AbstractDrawableComponent comp = drawingLayer.getSelectedComp();
|
AbstractDrawableComponent comp = drawingLayer.getSelectedComp();
|
||||||
// reset color for the el and add it to PGEN resource
|
// reset color for the el and add it to PGEN resource
|
||||||
|
|
|
@ -198,72 +198,7 @@ public class PgenMultiPointDrawingTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
closeAttrDlg(attrDlg, pgenType);
|
|
||||||
attrDlg = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
|
|
||||||
DrawableType drawableType = getDrawableType(pgenType);
|
|
||||||
// log.debug("PgenMultiPointDrawingTool, before call def.create, drawableType=" + drawableType + ", pgenType="+pgenType);
|
|
||||||
|
|
||||||
/*if(drawableType == DrawableType.CONV_SIGMET && ("NCON_SIGMET".equals(pgenType))) //"CONV_SIGMET".equals(pgenType)||
|
|
||||||
points = SnapUtil.getSnapWithStation(points, SnapUtil.VOR_STATION_LIST, 10, 8);*/
|
|
||||||
|
|
||||||
// create a new DrawableElement.
|
|
||||||
elem = def.create( drawableType, (IAttribute)attrDlg,
|
|
||||||
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
attrDlg.setDrawableElement((DrawableElement)elem);
|
|
||||||
AttrSettings.getInstance().setSettings((DrawableElement)elem);
|
|
||||||
|
|
||||||
if("CCFP_SIGMET".equals(pgenType)){//avoid 2 Sigmet elements issue
|
|
||||||
ccfpTxtFlag = true;
|
|
||||||
return true;//avoid right click cause no showing issue
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( elem != null && elem.getPgenCategory().equalsIgnoreCase("Front")
|
|
||||||
&& ((FrontAttrDlg)attrDlg).labelEnabled()){
|
|
||||||
|
|
||||||
DECollection dec = new DECollection("labeledFront");
|
|
||||||
dec.setPgenCategory(pgenCategory);
|
|
||||||
dec.setPgenType(pgenType);
|
|
||||||
dec.addElement(elem);
|
|
||||||
drawingLayer.addElement(dec);
|
|
||||||
|
|
||||||
PgenUtil.setDrawingTextMode( true, ((FrontAttrDlg)attrDlg).useFrontColor(), "", dec );
|
|
||||||
elem = null;
|
|
||||||
}else{
|
|
||||||
// add the product to PGEN resource
|
|
||||||
drawingLayer.addElement( elem );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(isTrackElement(drawableType)) {
|
|
||||||
displayTrackExtrapPointInfoDlg((TrackAttrDlg)attrDlg, (Track)elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
|
|
||||||
if( ! ccfpTxtFlag)
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -280,6 +215,87 @@ public class PgenMultiPointDrawingTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
closeAttrDlg(attrDlg, pgenType);
|
||||||
|
attrDlg = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
|
||||||
|
DrawableType drawableType = getDrawableType(pgenType);
|
||||||
|
// log.debug("PgenMultiPointDrawingTool, before call def.create, drawableType=" + drawableType + ", pgenType="+pgenType);
|
||||||
|
|
||||||
|
/*if(drawableType == DrawableType.CONV_SIGMET && ("NCON_SIGMET".equals(pgenType))) //"CONV_SIGMET".equals(pgenType)||
|
||||||
|
points = SnapUtil.getSnapWithStation(points, SnapUtil.VOR_STATION_LIST, 10, 8);*/
|
||||||
|
|
||||||
|
// create a new DrawableElement.
|
||||||
|
elem = def.create( drawableType, (IAttribute)attrDlg,
|
||||||
|
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
attrDlg.setDrawableElement((DrawableElement)elem);
|
||||||
|
AttrSettings.getInstance().setSettings((DrawableElement)elem);
|
||||||
|
|
||||||
|
if("CCFP_SIGMET".equals(pgenType)){//avoid 2 Sigmet elements issue
|
||||||
|
ccfpTxtFlag = true;
|
||||||
|
return true;//avoid right click cause no showing issue
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( elem != null && elem.getPgenCategory().equalsIgnoreCase("Front")
|
||||||
|
&& ((FrontAttrDlg)attrDlg).labelEnabled()){
|
||||||
|
|
||||||
|
DECollection dec = new DECollection("labeledFront");
|
||||||
|
dec.setPgenCategory(pgenCategory);
|
||||||
|
dec.setPgenType(pgenType);
|
||||||
|
dec.addElement(elem);
|
||||||
|
drawingLayer.addElement(dec);
|
||||||
|
|
||||||
|
PgenUtil.setDrawingTextMode( true, ((FrontAttrDlg)attrDlg).useFrontColor(), "", dec );
|
||||||
|
elem = null;
|
||||||
|
}else{
|
||||||
|
// add the product to PGEN resource
|
||||||
|
drawingLayer.addElement( elem );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(isTrackElement(drawableType)) {
|
||||||
|
displayTrackExtrapPointInfoDlg((TrackAttrDlg)attrDlg, (Track)elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
|
||||||
|
if( ! ccfpTxtFlag)
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int aX, int aY, int button) {
|
public boolean handleMouseDownMove(int aX, int aY, int button) {
|
||||||
if ( !isResourceEditable() || shiftDown ) return false;
|
if ( !isResourceEditable() || shiftDown ) return false;
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class PgenMultiSelectTool extends AbstractPgenDrawingTool {
|
||||||
// Keep in multi-selecting mode
|
// Keep in multi-selecting mode
|
||||||
// PgenUtil.setSelectingMode();
|
// PgenUtil.setSelectingMode();
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,6 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool {
|
||||||
public boolean handleMouseDown(int anX, int aY, int button) {
|
public boolean handleMouseDown(int anX, int aY, int button) {
|
||||||
if ( !isResourceEditable() ) return false;
|
if ( !isResourceEditable() ) return false;
|
||||||
|
|
||||||
DECollection dec = null;
|
|
||||||
|
|
||||||
// Check if mouse is in geographic extent
|
// Check if mouse is in geographic extent
|
||||||
Coordinate loc = mapEditor.translateClick(anX, aY);
|
Coordinate loc = mapEditor.translateClick(anX, aY);
|
||||||
|
@ -181,77 +180,6 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
attrDlg.close();
|
|
||||||
attrDlg = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
String lineType = ((OutlookAttrDlg)attrDlg).getLineType();
|
|
||||||
// create a new DrawableElement.
|
|
||||||
// if (((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("TROPICAL")
|
|
||||||
// || ((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("FLOOD"))
|
|
||||||
// elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
|
|
||||||
// "Lines", "LINE_SOLID", points, drawingLayer.getActiveLayer());
|
|
||||||
// else
|
|
||||||
elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
|
|
||||||
"Lines", lineType, points, drawingLayer.getActiveLayer());
|
|
||||||
//if (((IMultiPoint)attrDlg).getFillFlag()) ((Line)elem).setFillPattern(attrDlg.getFillPattern());
|
|
||||||
|
|
||||||
dec = new DECollection(Outlook.OUTLOOK_LABELED_LINE);
|
|
||||||
dec.setPgenCategory("MET");
|
|
||||||
|
|
||||||
otlk = getCurrentOtlk(((OutlookAttrDlg)attrDlg).getOutlookType());
|
|
||||||
|
|
||||||
Outlook newOtlk = def.createOutlook( ((OutlookAttrDlg)attrDlg).getOutlookType(),
|
|
||||||
elem, dec, otlk );
|
|
||||||
|
|
||||||
newOtlk.update( (OutlookAttrDlg)attrDlg );
|
|
||||||
|
|
||||||
// create a new outlook
|
|
||||||
if ( otlk == null || !otlk.getPgenType().equalsIgnoreCase(((OutlookAttrDlg)attrDlg).getOutlookType()) ){
|
|
||||||
drawingLayer.addElement( newOtlk );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
drawingLayer.replaceElement(otlk, newOtlk);
|
|
||||||
}
|
|
||||||
|
|
||||||
otlk = newOtlk;
|
|
||||||
|
|
||||||
attrDlg.setDrawableElement(elem);
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
//set TextDrawingtool or SymbolDrawingTool
|
|
||||||
//bring up the text or the symbol dialog
|
|
||||||
if ( ((OutlookAttrDlg)attrDlg).addLabel() ) {
|
|
||||||
if ( ((OutlookAttrDlg)attrDlg).addText() ) {
|
|
||||||
lbl = ((OutlookAttrDlg)attrDlg).getLblTxt();
|
|
||||||
PgenUtil.setDrawingTextMode( true, ((OutlookAttrDlg)attrDlg).useLineColor(),
|
|
||||||
lbl, dec );
|
|
||||||
}
|
|
||||||
else if ( ((OutlookAttrDlg)attrDlg).addSymbol() ) {
|
|
||||||
|
|
||||||
PgenUtil.setDrawingSymbolMode( ((OutlookAttrDlg)attrDlg).getSymbolCat(),
|
|
||||||
((OutlookAttrDlg)attrDlg).getSymbolType(),
|
|
||||||
((OutlookAttrDlg)attrDlg).useLineColor(), dec );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -267,7 +195,94 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
DECollection dec = null;
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
attrDlg.close();
|
||||||
|
attrDlg = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
String lineType = ((OutlookAttrDlg)attrDlg).getLineType();
|
||||||
|
// create a new DrawableElement.
|
||||||
|
// if (((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("TROPICAL")
|
||||||
|
// || ((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("FLOOD"))
|
||||||
|
// elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
|
||||||
|
// "Lines", "LINE_SOLID", points, drawingLayer.getActiveLayer());
|
||||||
|
// else
|
||||||
|
elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
|
||||||
|
"Lines", lineType, points, drawingLayer.getActiveLayer());
|
||||||
|
//if (((IMultiPoint)attrDlg).getFillFlag()) ((Line)elem).setFillPattern(attrDlg.getFillPattern());
|
||||||
|
|
||||||
|
dec = new DECollection(Outlook.OUTLOOK_LABELED_LINE);
|
||||||
|
dec.setPgenCategory("MET");
|
||||||
|
|
||||||
|
otlk = getCurrentOtlk(((OutlookAttrDlg)attrDlg).getOutlookType());
|
||||||
|
|
||||||
|
Outlook newOtlk = def.createOutlook( ((OutlookAttrDlg)attrDlg).getOutlookType(),
|
||||||
|
elem, dec, otlk );
|
||||||
|
|
||||||
|
newOtlk.update( (OutlookAttrDlg)attrDlg );
|
||||||
|
|
||||||
|
// create a new outlook
|
||||||
|
if ( otlk == null || !otlk.getPgenType().equalsIgnoreCase(((OutlookAttrDlg)attrDlg).getOutlookType()) ){
|
||||||
|
drawingLayer.addElement( newOtlk );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawingLayer.replaceElement(otlk, newOtlk);
|
||||||
|
}
|
||||||
|
|
||||||
|
otlk = newOtlk;
|
||||||
|
|
||||||
|
attrDlg.setDrawableElement(elem);
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
//set TextDrawingtool or SymbolDrawingTool
|
||||||
|
//bring up the text or the symbol dialog
|
||||||
|
if ( ((OutlookAttrDlg)attrDlg).addLabel() ) {
|
||||||
|
if ( ((OutlookAttrDlg)attrDlg).addText() ) {
|
||||||
|
lbl = ((OutlookAttrDlg)attrDlg).getLblTxt();
|
||||||
|
PgenUtil.setDrawingTextMode( true, ((OutlookAttrDlg)attrDlg).useLineColor(),
|
||||||
|
lbl, dec );
|
||||||
|
}
|
||||||
|
else if ( ((OutlookAttrDlg)attrDlg).addSymbol() ) {
|
||||||
|
|
||||||
|
PgenUtil.setDrawingSymbolMode( ((OutlookAttrDlg)attrDlg).getSymbolCat(),
|
||||||
|
((OutlookAttrDlg)attrDlg).getSymbolType(),
|
||||||
|
((OutlookAttrDlg)attrDlg).useLineColor(), dec );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -162,10 +162,6 @@ public class PgenOutlookSetCont extends AbstractPgenDrawingTool{
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
PgenUtil.loadOutlookDrawingTool();
|
|
||||||
dec = null;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -176,7 +172,26 @@ public class PgenOutlookSetCont extends AbstractPgenDrawingTool{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
PgenUtil.loadOutlookDrawingTool();
|
||||||
|
dec = null;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !isResourceEditable() ) return false;
|
if ( !isResourceEditable() ) return false;
|
||||||
|
|
|
@ -288,9 +288,31 @@ public class PgenRotateElement extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
mapEditor.refresh();
|
mapEditor.refresh();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (button == 3) {
|
||||||
|
|
||||||
return false;
|
if (trackExtrapPointInfoDlg != null) {
|
||||||
|
trackExtrapPointInfoDlg.close();
|
||||||
|
trackExtrapPointInfoDlg = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawingLayer.getSelectedDE() != null) {
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
ptSelected = false;
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// set selecting mode
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -474,7 +475,11 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else if (button == 3 && pgenrsc.getSelectedDE() != null) {
|
||||||
|
// Right button click does not fall through to other handlers if
|
||||||
|
// there is pgen element is selected
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1046,12 +1051,16 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
|
||||||
}
|
}
|
||||||
trackExtrapPointInfoDlg = null;
|
trackExtrapPointInfoDlg = null;
|
||||||
|
|
||||||
|
if (pgenrsc.getSelectedDE() != null) {
|
||||||
|
preempt = true;
|
||||||
|
}
|
||||||
|
|
||||||
pgenrsc.removeGhostLine();
|
pgenrsc.removeGhostLine();
|
||||||
ptSelected = false;
|
ptSelected = false;
|
||||||
pgenrsc.removeSelected();
|
pgenrsc.removeSelected();
|
||||||
mapEditor.refresh();
|
mapEditor.refresh();
|
||||||
|
|
||||||
// return false;
|
return preempt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,44 +184,6 @@ public class PgenSinglePointDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( elem != null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
String defaultTxt = "";
|
|
||||||
if ( attrDlg instanceof VolcanoAttrDlg ){
|
|
||||||
defaultTxt = ((VolcanoAttrDlg)attrDlg).getVolText();
|
|
||||||
dec.setCollectionName("Volcano");
|
|
||||||
}
|
|
||||||
|
|
||||||
//in case the label is enabled after symbol is placed.
|
|
||||||
if (dec == null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
|
|
||||||
dec = new DECollection("labeledSymbol");
|
|
||||||
dec.setPgenCategory(pgenCategory);
|
|
||||||
dec.setPgenType(pgenType);
|
|
||||||
dec.addElement(elem);
|
|
||||||
drawingLayer.replaceElement(elem, dec);
|
|
||||||
}
|
|
||||||
|
|
||||||
PgenUtil.setDrawingTextMode( true, ((LabeledSymbolAttrDlg)attrDlg).useSymbolColor(), defaultTxt, dec );
|
|
||||||
dec = null;
|
|
||||||
elem = null;
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ( prevElem != null){
|
|
||||||
usePrevColor = false;
|
|
||||||
if ( prevElem.getParent().getPgenCategory().equalsIgnoreCase("OUTLOOK")){
|
|
||||||
PgenUtil.loadOutlookDrawingTool();
|
|
||||||
}
|
|
||||||
prevElem = null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
elem = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -274,6 +236,62 @@ public class PgenSinglePointDrawingTool extends AbstractPgenDrawingTool {
|
||||||
else return true;
|
else return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||||
|
if ( !isResourceEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if ( mouseButton == 3 ){
|
||||||
|
// prevent the click going through to other handlers
|
||||||
|
// in case adding labels to symbols or fronts.
|
||||||
|
if ( elem != null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
String defaultTxt = "";
|
||||||
|
if ( attrDlg instanceof VolcanoAttrDlg ){
|
||||||
|
defaultTxt = ((VolcanoAttrDlg)attrDlg).getVolText();
|
||||||
|
dec.setCollectionName("Volcano");
|
||||||
|
}
|
||||||
|
|
||||||
|
//in case the label is enabled after symbol is placed.
|
||||||
|
if (dec == null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
|
||||||
|
dec = new DECollection("labeledSymbol");
|
||||||
|
dec.setPgenCategory(pgenCategory);
|
||||||
|
dec.setPgenType(pgenType);
|
||||||
|
dec.addElement(elem);
|
||||||
|
drawingLayer.replaceElement(elem, dec);
|
||||||
|
}
|
||||||
|
|
||||||
|
PgenUtil.setDrawingTextMode( true, ((LabeledSymbolAttrDlg)attrDlg).useSymbolColor(), defaultTxt, dec );
|
||||||
|
dec = null;
|
||||||
|
elem = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( prevElem != null){
|
||||||
|
usePrevColor = false;
|
||||||
|
if ( prevElem.getParent().getPgenCategory().equalsIgnoreCase("OUTLOOK")){
|
||||||
|
PgenUtil.loadOutlookDrawingTool();
|
||||||
|
}
|
||||||
|
prevElem = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
elem = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -111,48 +111,13 @@ public class PgenSpenesDrawingTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
if (attrDlg != null) attrDlg.close();
|
|
||||||
attrDlg = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
// create a line
|
|
||||||
elem = def.create( DrawableType.SPENES, (IAttribute)attrDlg,
|
|
||||||
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
|
||||||
|
|
||||||
attrDlg.setDrawableElement((DrawableElement)elem);
|
|
||||||
// AttrSettings.getInstance().setSettings((DrawableElement)elem);
|
|
||||||
|
|
||||||
// add the product to PGEN resource
|
|
||||||
drawingLayer.addElement( elem );
|
|
||||||
|
|
||||||
//System.out.println(USState.statesInGeometry(((Spenes)elem).toJTSPolygon()));
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 2 ){
|
else if ( button == 2 ){
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -203,6 +168,59 @@ public class PgenSpenesDrawingTool extends AbstractPgenDrawingTool {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
if (attrDlg != null) attrDlg.close();
|
||||||
|
attrDlg = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// create a line
|
||||||
|
elem = def.create( DrawableType.SPENES, (IAttribute)attrDlg,
|
||||||
|
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
|
||||||
|
|
||||||
|
attrDlg.setDrawableElement((DrawableElement)elem);
|
||||||
|
// AttrSettings.getInstance().setSettings((DrawableElement)elem);
|
||||||
|
|
||||||
|
// add the product to PGEN resource
|
||||||
|
drawingLayer.addElement( elem );
|
||||||
|
|
||||||
|
//System.out.println(USState.statesInGeometry(((Spenes)elem).toJTSPolygon()));
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void clearPoints(){
|
private void clearPoints(){
|
||||||
points.clear();
|
points.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,6 +413,22 @@ public class PgenTcaTool extends AbstractPgenDrawingTool {
|
||||||
// right mouse button pressed
|
// right mouse button pressed
|
||||||
else if (button == 3) {
|
else if (button == 3) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
||||||
case IDLE:
|
case IDLE:
|
||||||
|
@ -456,12 +472,12 @@ public class PgenTcaTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
} else
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -124,21 +124,7 @@ public class PgenTcmDrawingTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -154,7 +140,37 @@ public class PgenTcmDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -272,32 +272,6 @@ public class PgenTextDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
if (addLabelToSymbol){
|
|
||||||
addLabelToSymbol = false;
|
|
||||||
usePrevColor = false;
|
|
||||||
if ( prevElem.getName().equalsIgnoreCase("labeledSymbol") ){
|
|
||||||
if ( prevElem.getPrimaryDE() instanceof Symbol ) {
|
|
||||||
PgenUtil.setDrawingSymbolMode( prevElem.getPrimaryDE().getPgenCategory(), prevElem.getPgenType(), false, null );
|
|
||||||
}
|
|
||||||
else if ( prevElem.getPrimaryDE() instanceof ComboSymbol ){
|
|
||||||
PgenUtil.setDrawingSymbolMode( "Combo", prevElem.getPgenType(), false, null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( prevElem instanceof DECollection && prevElem.getPgenCategory().equalsIgnoreCase("Front") ){
|
|
||||||
PgenUtil.setDrawingFrontMode((Line)prevElem.getPrimaryDE());
|
|
||||||
}
|
|
||||||
else if ( prevElem.getName().equalsIgnoreCase(Outlook.OUTLOOK_LABELED_LINE)){
|
|
||||||
PgenUtil.loadOutlookDrawingTool();
|
|
||||||
}
|
|
||||||
prevElem = null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -379,7 +353,56 @@ public class PgenTextDrawingTool extends AbstractPgenDrawingTool {
|
||||||
if ( !isResourceEditable()|| shiftDown ) return false;
|
if ( !isResourceEditable()|| shiftDown ) return false;
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||||
|
if ( !isResourceEditable()|| shiftDown ) return false;
|
||||||
|
|
||||||
|
// prevent the click going through to other handlers
|
||||||
|
// in case adding labels to symbols or fronts.
|
||||||
|
if ( mouseButton == 3 ) {
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
if (addLabelToSymbol){
|
||||||
|
addLabelToSymbol = false;
|
||||||
|
usePrevColor = false;
|
||||||
|
if ( prevElem.getName().equalsIgnoreCase("labeledSymbol") ){
|
||||||
|
if ( prevElem.getPrimaryDE() instanceof Symbol ) {
|
||||||
|
PgenUtil.setDrawingSymbolMode( prevElem.getPrimaryDE().getPgenCategory(), prevElem.getPgenType(), false, null );
|
||||||
|
}
|
||||||
|
else if ( prevElem.getPrimaryDE() instanceof ComboSymbol ){
|
||||||
|
PgenUtil.setDrawingSymbolMode( "Combo", prevElem.getPgenType(), false, null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( prevElem instanceof DECollection && prevElem.getPgenCategory().equalsIgnoreCase("Front") ){
|
||||||
|
PgenUtil.setDrawingFrontMode((Line)prevElem.getPrimaryDE());
|
||||||
|
}
|
||||||
|
else if ( prevElem.getName().equalsIgnoreCase(Outlook.OUTLOOK_LABELED_LINE)){
|
||||||
|
PgenUtil.loadOutlookDrawingTool();
|
||||||
|
}
|
||||||
|
prevElem = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Check if a point is at right or left of the line.
|
* Check if a point is at right or left of the line.
|
||||||
|
|
|
@ -154,20 +154,6 @@ public class PgenVectorDrawingTool extends AbstractPgenDrawingTool {
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
if ( points.size() > 0 ) {
|
|
||||||
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
attrDlg.close();
|
|
||||||
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -213,7 +199,37 @@ public class PgenVectorDrawingTool extends AbstractPgenDrawingTool {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
if ( points.size() > 0 ) {
|
||||||
|
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
attrDlg.close();
|
||||||
|
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if (!isResourceEditable() || shiftDown ) return false;
|
if (!isResourceEditable() || shiftDown ) return false;
|
||||||
|
|
|
@ -16,11 +16,11 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.geotools.data.simple.SimpleFeatureCollection;
|
|
||||||
import org.geotools.data.simple.SimpleFeatureIterator;
|
|
||||||
import org.geotools.factory.CommonFactoryFinder;
|
import org.geotools.factory.CommonFactoryFinder;
|
||||||
import org.geotools.factory.GeoTools;
|
import org.geotools.factory.GeoTools;
|
||||||
import org.geotools.feature.DefaultFeatureCollection;
|
import org.geotools.feature.DefaultFeatureCollection;
|
||||||
|
import org.geotools.feature.FeatureCollection;
|
||||||
|
import org.geotools.feature.FeatureIterator;
|
||||||
import org.geotools.feature.simple.SimpleFeatureBuilder;
|
import org.geotools.feature.simple.SimpleFeatureBuilder;
|
||||||
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
|
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
|
||||||
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
||||||
|
@ -45,7 +45,6 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 12/09 #159 B. Yin Initial Creation.
|
* 12/09 #159 B. Yin Initial Creation.
|
||||||
* Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5
|
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -61,7 +60,7 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
|
|
||||||
//feature collection used to find which county a location is in
|
//feature collection used to find which county a location is in
|
||||||
static DefaultFeatureCollection counties;
|
static DefaultFeatureCollection counties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public constructor
|
* Public constructor
|
||||||
|
@ -106,9 +105,9 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
|
||||||
Point click = gf.createPoint(loc);
|
Point click = gf.createPoint(loc);
|
||||||
|
|
||||||
//apply filter
|
//apply filter
|
||||||
SimpleFeatureCollection fc = counties.subCollection(createFilter(click));
|
FeatureCollection<SimpleFeatureType,SimpleFeature> fc = counties.subCollection(createFilter(click));
|
||||||
|
|
||||||
SimpleFeatureIterator featureIterator = fc.features();
|
FeatureIterator<SimpleFeature> featureIterator = fc.features();
|
||||||
|
|
||||||
//find the ID of the county the location is inside of
|
//find the ID of the county the location is inside of
|
||||||
String ugc = null;
|
String ugc = null;
|
||||||
|
@ -122,7 +121,6 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
featureIterator.close();
|
|
||||||
|
|
||||||
boolean gotCnty = false;
|
boolean gotCnty = false;
|
||||||
SPCCounty county = null;
|
SPCCounty county = null;
|
||||||
|
@ -195,23 +193,35 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
return true;
|
||||||
wbTool.resetMouseHandler();
|
|
||||||
((WatchBoxAttrDlg)wbTool.attrDlg).getWatchInfoDlg().enableAllButtons(true);
|
|
||||||
((WatchBoxAttrDlg)wbTool.attrDlg).enableDspBtn(true);
|
|
||||||
((WatchBoxAttrDlg)wbTool.attrDlg).buttonBar.setEnabled(true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
wbTool.resetMouseHandler();
|
||||||
|
((WatchBoxAttrDlg)wbTool.attrDlg).getWatchInfoDlg().enableAllButtons(true);
|
||||||
|
((WatchBoxAttrDlg)wbTool.attrDlg).enableDspBtn(true);
|
||||||
|
((WatchBoxAttrDlg)wbTool.attrDlg).buttonBar.setEnabled(true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
|
||||||
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
@ -223,7 +233,7 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
|
||||||
*/
|
*/
|
||||||
private void createCountyFeatureCollection(){
|
private void createCountyFeatureCollection(){
|
||||||
|
|
||||||
counties = new DefaultFeatureCollection();
|
counties = new DefaultFeatureCollection(null, null);
|
||||||
|
|
||||||
// create simple feature type
|
// create simple feature type
|
||||||
SimpleFeatureTypeBuilder builder2 = new SimpleFeatureTypeBuilder();
|
SimpleFeatureTypeBuilder builder2 = new SimpleFeatureTypeBuilder();
|
||||||
|
|
|
@ -163,32 +163,11 @@ public class PgenWatchBoxDrawingTool extends AbstractPgenDrawingTool {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
attrDlg.close();
|
|
||||||
attrDlg = null;
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -246,12 +225,35 @@ public class PgenWatchBoxDrawingTool extends AbstractPgenDrawingTool {
|
||||||
points.clear();
|
points.clear();
|
||||||
|
|
||||||
mapEditor.refresh();
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
else if ( button == 3 ) {
|
||||||
return true;
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
attrDlg.close();
|
||||||
|
attrDlg = null;
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -133,29 +133,11 @@ public class PgenWatchBoxModifyTool extends PgenSelectingTool {
|
||||||
}
|
}
|
||||||
// clean up
|
// clean up
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
// Close the attribute dialog and do the cleanup.
|
|
||||||
if ( PgenWatchBoxModifyTool.this.attrDlg != null ) {
|
|
||||||
PgenWatchBoxModifyTool.this.attrDlg.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
PgenWatchBoxModifyTool.this.attrDlg = null;
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
ptSelected = false;
|
|
||||||
drawingLayer.removeSelected();
|
|
||||||
mapEditor.refresh();
|
|
||||||
PgenUtil.setSelectingMode();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -230,55 +212,76 @@ public class PgenWatchBoxModifyTool extends PgenSelectingTool {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseUp(int x, int y, int button) {
|
public boolean handleMouseUp(int x, int y, int button) {
|
||||||
firstDown = null;
|
firstDown = null;
|
||||||
if ( !isResourceEditable() ) return false;
|
if ( !isResourceEditable() ) return false;
|
||||||
|
|
||||||
// Finish the editing
|
// Finish the editing
|
||||||
if (button == 1 && drawingLayer != null ){
|
if (button == 1 && drawingLayer != null ){
|
||||||
|
|
||||||
// Create a copy of the currently editing watch box
|
|
||||||
WatchBox el = (WatchBox) drawingLayer.getSelectedDE();
|
|
||||||
|
|
||||||
if ( el != null ){
|
// Create a copy of the currently editing watch box
|
||||||
|
WatchBox el = (WatchBox) drawingLayer.getSelectedDE();
|
||||||
WatchBox newEl = (WatchBox)el.copy();
|
|
||||||
|
|
||||||
if ( ptSelected ) {
|
if ( el != null ){
|
||||||
|
|
||||||
ptSelected = false;
|
WatchBox newEl = (WatchBox)el.copy();
|
||||||
|
|
||||||
// re-snap the new watch box
|
|
||||||
resnapWatchBox( mapEditor, (WatchBox)ghostEl, newEl );
|
|
||||||
((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).setWatchBox(newEl);
|
|
||||||
WatchInfoDlg infoDlg = ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).getWatchInfoDlg();
|
|
||||||
if ( infoDlg != null && infoDlg.getShell()!= null ){
|
|
||||||
if ( ! infoDlg.isCountyLock()){
|
|
||||||
newEl.clearCntyList();
|
|
||||||
infoDlg.clearCwaPane();
|
|
||||||
}
|
|
||||||
infoDlg.setStatesWFOs();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace the selected watch box with this new watch box
|
|
||||||
drawingLayer.replaceElement(el, newEl);
|
|
||||||
|
|
||||||
// Set this new element as the currently selected element
|
|
||||||
// Collections do not need to reset.
|
|
||||||
if ( !(drawingLayer.getSelectedComp() instanceof DECollection )){
|
|
||||||
drawingLayer.setSelected(newEl);
|
|
||||||
}
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
if ( ptSelected ) {
|
||||||
|
|
||||||
}
|
ptSelected = false;
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
// re-snap the new watch box
|
||||||
}
|
resnapWatchBox( mapEditor, (WatchBox)ghostEl, newEl );
|
||||||
|
((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).setWatchBox(newEl);
|
||||||
return true;
|
WatchInfoDlg infoDlg = ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).getWatchInfoDlg();
|
||||||
|
if ( infoDlg != null && infoDlg.getShell()!= null ){
|
||||||
|
if ( ! infoDlg.isCountyLock()){
|
||||||
|
newEl.clearCntyList();
|
||||||
|
infoDlg.clearCwaPane();
|
||||||
|
}
|
||||||
|
infoDlg.setStatesWFOs();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace the selected watch box with this new watch box
|
||||||
|
drawingLayer.replaceElement(el, newEl);
|
||||||
|
|
||||||
|
// Set this new element as the currently selected element
|
||||||
|
// Collections do not need to reset.
|
||||||
|
if ( !(drawingLayer.getSelectedComp() instanceof DECollection )){
|
||||||
|
drawingLayer.setSelected(newEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ( button == 3 ) {
|
||||||
|
|
||||||
|
// Close the attribute dialog and do the cleanup.
|
||||||
|
if ( PgenWatchBoxModifyTool.this.attrDlg != null ) {
|
||||||
|
PgenWatchBoxModifyTool.this.attrDlg.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
PgenWatchBoxModifyTool.this.attrDlg = null;
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
ptSelected = false;
|
||||||
|
drawingLayer.removeSelected();
|
||||||
|
mapEditor.refresh();
|
||||||
|
PgenUtil.setSelectingMode();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,73 +139,84 @@ public class PgenWatchStatusLineDrawingTool extends AbstractPgenDrawingTool{
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 3 ) {
|
else if ( button == 3 ) {
|
||||||
|
return true;
|
||||||
if ( points.size() == 0 ) {
|
|
||||||
|
|
||||||
//close the line attr dialog
|
|
||||||
if ( attrDlg != null ) attrDlg.close();
|
|
||||||
attrDlg = null;
|
|
||||||
|
|
||||||
//return to watch modifying tool
|
|
||||||
PgenUtil.loadWatchBoxModifyTool(wb);
|
|
||||||
|
|
||||||
//set the watch element as selected
|
|
||||||
drawingLayer.setSelected(wb);
|
|
||||||
|
|
||||||
//open and initialize watch box attr dialog
|
|
||||||
WatchBoxAttrDlg wbdlg = WatchBoxAttrDlg.getInstance(null);
|
|
||||||
wbdlg.openSpecDlg( false );
|
|
||||||
wbdlg.setDrawableElement(wb);
|
|
||||||
wbdlg.setMouseHandlerName("Pgen Select");
|
|
||||||
wbdlg.setAttrForDlg( (IAttribute)wb );
|
|
||||||
wbdlg.enableButtons();
|
|
||||||
wbdlg.setPgenCategory(wb.getPgenCategory());
|
|
||||||
wbdlg.setPgenType( wb.getPgenType() );
|
|
||||||
wbdlg.setDrawingLayer( drawingLayer );
|
|
||||||
wbdlg.setMapEditor( mapEditor );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( points.size() < 2 ){
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
|
|
||||||
// create a status line
|
|
||||||
Line statusLine = new Line(null, attrDlg.getColors(), attrDlg.getLineWidth(),
|
|
||||||
1.0, false, false, points, ((ILine)attrDlg).getSmoothFactor(),FillPattern.SOLID,
|
|
||||||
"Lines","POINTED_ARROW");
|
|
||||||
|
|
||||||
// add the line to watch DECollection
|
|
||||||
((DECollection)wb.getParent()).add(statusLine);
|
|
||||||
|
|
||||||
drawingLayer.removeGhostLine();
|
|
||||||
points.clear();
|
|
||||||
mapEditor.refresh();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( button == 2 ){
|
else if ( button == 2 ){
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overrides the function in selecting tool
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean handleMouseUp(int x, int y, int button){
|
||||||
|
if ( !drawingLayer.isEditable() || shiftDown ) return false;
|
||||||
|
|
||||||
|
if (button == 3) {
|
||||||
|
|
||||||
|
if ( points.size() == 0 ) {
|
||||||
|
|
||||||
|
//close the line attr dialog
|
||||||
|
if ( attrDlg != null ) attrDlg.close();
|
||||||
|
attrDlg = null;
|
||||||
|
|
||||||
|
//return to watch modifying tool
|
||||||
|
PgenUtil.loadWatchBoxModifyTool(wb);
|
||||||
|
|
||||||
|
//set the watch element as selected
|
||||||
|
drawingLayer.setSelected(wb);
|
||||||
|
|
||||||
|
//open and initialize watch box attr dialog
|
||||||
|
WatchBoxAttrDlg wbdlg = WatchBoxAttrDlg.getInstance(null);
|
||||||
|
wbdlg.openSpecDlg( false );
|
||||||
|
wbdlg.setDrawableElement(wb);
|
||||||
|
wbdlg.setMouseHandlerName("Pgen Select");
|
||||||
|
wbdlg.setAttrForDlg( (IAttribute)wb );
|
||||||
|
wbdlg.enableButtons();
|
||||||
|
wbdlg.setPgenCategory(wb.getPgenCategory());
|
||||||
|
wbdlg.setPgenType( wb.getPgenType() );
|
||||||
|
wbdlg.setDrawingLayer( drawingLayer );
|
||||||
|
wbdlg.setMapEditor( mapEditor );
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( points.size() < 2 ){
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// create a status line
|
||||||
|
Line statusLine = new Line(null, attrDlg.getColors(), attrDlg.getLineWidth(),
|
||||||
|
1.0, false, false, points, ((ILine)attrDlg).getSmoothFactor(),FillPattern.SOLID,
|
||||||
|
"Lines","POINTED_ARROW");
|
||||||
|
|
||||||
|
// add the line to watch DECollection
|
||||||
|
((DECollection)wb.getParent()).add(statusLine);
|
||||||
|
|
||||||
|
drawingLayer.removeGhostLine();
|
||||||
|
points.clear();
|
||||||
|
mapEditor.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue