Issue #1457 - Fix mpe problems - displaying gages on map and running fieldgen
Change-Id: I9c341235d0d9bfcf6b9b04aeed2ac2a1d96136ff Former-commit-id: 7fc127dfaacc36b4051fa5a46774c2823b1d42b2
This commit is contained in:
parent
c18b96dc4c
commit
058064ce0d
10 changed files with 378 additions and 130 deletions
|
@ -240,8 +240,7 @@
|
|||
<command
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.addpseudo"
|
||||
label="Add Pseudo Gage"
|
||||
mnemonic="A"
|
||||
style="toggle">
|
||||
mnemonic="A">
|
||||
</command>
|
||||
<command
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.gagetable"
|
||||
|
@ -251,8 +250,7 @@
|
|||
<command
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.display7x7"
|
||||
label="Display 7 x 7..."
|
||||
mnemonic="D"
|
||||
style="toggle">
|
||||
mnemonic="D">
|
||||
</command>
|
||||
<separator
|
||||
name="separator3"
|
||||
|
@ -264,24 +262,16 @@
|
|||
mnemonic="B">
|
||||
</command>
|
||||
<command
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.toggleGageDisplay"
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.toggleGageIdDisplay"
|
||||
label="Show Gage Identifiers"
|
||||
mnemonic="I"
|
||||
style="toggle">
|
||||
<parameter
|
||||
name="Gage"
|
||||
value="Ids">
|
||||
</parameter>
|
||||
</command>
|
||||
<command
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.toggleGageDisplay"
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.toggleGageValueDisplay"
|
||||
label="Show Gage Values"
|
||||
mnemonic="V"
|
||||
style="toggle">
|
||||
<parameter
|
||||
name="Gage"
|
||||
value="Values">
|
||||
</parameter>
|
||||
</command>
|
||||
<menu
|
||||
label="Show Missing Gages"
|
||||
|
@ -911,15 +901,6 @@
|
|||
id="com.raytheon.viz.mpe.ui.actions.toggleMpeInfo"
|
||||
name="Toggle MPE Info">
|
||||
</command>
|
||||
<command
|
||||
id="com.raytheon.viz.mpe.ui.actions.toggleGageDisplay"
|
||||
name="Show Gages">
|
||||
<commandParameter
|
||||
id="Gage"
|
||||
name="Gage"
|
||||
optional="false">
|
||||
</commandParameter>
|
||||
</command>
|
||||
<command
|
||||
id="com.raytheon.viz.mpe.ui.actions.toggleGageMissing"
|
||||
name="Show Missing">
|
||||
|
@ -1032,6 +1013,32 @@
|
|||
id="com.raytheon.viz.mpe.ui.dialogs.postanalysis.SummedHourlyMpe"
|
||||
name="Launch Post Analysis">
|
||||
</command>
|
||||
<command
|
||||
defaultHandler="com.raytheon.viz.mpe.ui.actions.ToggleGageValueDisplay"
|
||||
id="com.raytheon.viz.mpe.ui.actions.toggleGageValueDisplay"
|
||||
name="ToggleGageValueDisplay">
|
||||
<state
|
||||
class="org.eclipse.ui.handlers.RegistryToggleState:false"
|
||||
id="org.eclipse.ui.commands.toggleState">
|
||||
</state>
|
||||
</command>
|
||||
<command
|
||||
defaultHandler="com.raytheon.viz.mpe.ui.actions.ToggleGageIdDisplay"
|
||||
id="com.raytheon.viz.mpe.ui.actions.toggleGageIdDisplay"
|
||||
name="Toggle Gage Id Display">
|
||||
<state
|
||||
class="org.eclipse.ui.handlers.RegistryToggleState:false"
|
||||
id="org.eclipse.ui.commands.toggleState">
|
||||
</state>
|
||||
</command>
|
||||
<command
|
||||
id="com.raytheon.viz.mpe.ui.actions.ToggleGageTriangleDisplay"
|
||||
name="Toggle Gage Triangle Display">
|
||||
<state
|
||||
class="org.eclipse.ui.handlers.RegistryToggleState:false"
|
||||
id="org.eclipse.ui.commands.toggleState">
|
||||
</state>
|
||||
</command>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
|
@ -1209,8 +1216,8 @@
|
|||
</activeWhen>
|
||||
</handler>
|
||||
<handler
|
||||
class="com.raytheon.viz.mpe.ui.actions.ToggleGageDisplay"
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.toggleGageDisplay">
|
||||
class="com.raytheon.viz.mpe.ui.actions.ToggleGageValueDisplay"
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.toggleGageValueDisplay">
|
||||
<activeWhen>
|
||||
<reference
|
||||
definitionId="com.raytheon.viz.inMPEActionSet">
|
||||
|
@ -1394,6 +1401,24 @@
|
|||
class="com.raytheon.viz.mpe.ui.actions.SummedHourlyMpeAction"
|
||||
commandId="com.raytheon.viz.mpe.ui.dialogs.postanalysis.SummedHourlyMpe">
|
||||
</handler>
|
||||
<handler
|
||||
class="com.raytheon.viz.mpe.ui.actions.ToggleGageIdDisplay"
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.toggleGageIdDisplay">
|
||||
<activeWhen>
|
||||
<reference
|
||||
definitionId="com.raytheon.viz.inMPEActionSet">
|
||||
</reference>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
<handler
|
||||
class="com.raytheon.viz.mpe.ui.actions.ToggleGageTriangleDisplay"
|
||||
commandId="com.raytheon.viz.mpe.ui.actions.ToggleGageTriangleDisplay">
|
||||
<activeWhen>
|
||||
<reference
|
||||
definitionId="com.raytheon.viz.inMPEActionSet">
|
||||
</reference>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.viz.ui.perspectiveManager">
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.ui.IWorkbenchCommandConstants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 29, 2012 mschenke Initial creation
|
||||
* Mar 19, 2013 1457 mpduff Added gage toggle commands.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -39,12 +40,38 @@ import org.eclipse.ui.IWorkbenchCommandConstants;
|
|||
*/
|
||||
|
||||
public interface MPECommandConstants {
|
||||
|
||||
/**
|
||||
* Font command id.
|
||||
*/
|
||||
public static final String FONT = "com.raytheon.viz.mpe.ui.actions.setfont";
|
||||
|
||||
/**
|
||||
* Gage color command id.
|
||||
*/
|
||||
public static final String GAGE_COLOR = "com.raytheon.viz.mpe.ui.actions.toggleGageColor";
|
||||
|
||||
/**
|
||||
* Gage missing command id.
|
||||
*/
|
||||
public static final String GAGE_MISSING_OPTION = "com.raytheon.viz.mpe.ui.actions.toggleGageMissing";
|
||||
|
||||
/**
|
||||
* Display mode command id.
|
||||
*/
|
||||
public static final String DISPLAY_MODE = "com.raytheon.viz.mpe.ui.actions.toggleDisplayMode";
|
||||
|
||||
/**
|
||||
* Toggle Gage Id Command ID.
|
||||
*/
|
||||
public static final String TOGGLE_GAGEID_COMMAND_ID = "com.raytheon.viz.mpe.ui.actions.toggleGageIdDisplay";
|
||||
|
||||
/**
|
||||
* Toggle gage triangle command ID.
|
||||
*/
|
||||
public static final String TOGGLE_GAGE_TRIANGLE_COMMAND_ID = "com.raytheon.viz.mpe.ui.actions.ToggleGageTriangleDisplay";
|
||||
|
||||
/**
|
||||
* Toggle gage value Command ID.
|
||||
*/
|
||||
public static final String TOGGLE_GAGE_VALUE_COMMAND_ID = "com.raytheon.viz.mpe.ui.actions.toggleGageValueDisplay";
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.Map;
|
|||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic Field populator for the menu item BaseFields.
|
||||
*
|
||||
|
@ -17,6 +16,7 @@ import org.eclipse.jface.action.MenuManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 23, 2011 rgeorge Initial creation
|
||||
* Mar 14, 2013 1457 mpduff Changed to use the ToggleGageTriangleDisplay handler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -34,11 +34,13 @@ public class BaseFieldsPopulator extends FieldsPopulator {
|
|||
static {
|
||||
gageMap.put("Gage", "Triangles");
|
||||
}
|
||||
|
||||
private static Map<DisplayFieldData, MenuData> textMap = new HashMap<DisplayFieldData, MenuData>();
|
||||
static {
|
||||
textMap.put(DisplayFieldData.p3lMosaic, new MenuData(
|
||||
"Gage Triangles", "G", Action.AS_CHECK_BOX,
|
||||
"com.raytheon.viz.mpe.ui.actions.toggleGageDisplay", gageMap));
|
||||
textMap.put(DisplayFieldData.p3lMosaic, new MenuData("Gage Triangles",
|
||||
"G", Action.AS_CHECK_BOX,
|
||||
"com.raytheon.viz.mpe.ui.actions.ToggleGageTriangleDisplay",
|
||||
gageMap));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,5 +57,4 @@ public class BaseFieldsPopulator extends FieldsPopulator {
|
|||
protected MenuManager getMenuManger() {
|
||||
return BaseFieldsPopulator.menuMgr;
|
||||
}
|
||||
|
||||
}
|
|
@ -43,6 +43,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.commands.ICommandService;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.ui.handlers.RadioState;
|
||||
import org.eclipse.ui.handlers.RegistryToggleState;
|
||||
|
||||
import com.raytheon.uf.common.colormap.ColorMap;
|
||||
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
|
||||
|
@ -97,6 +98,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 18, 2012 mschenke Initial creation
|
||||
* Mar 14, 2013 1457 mpduff Reset the gages on the resource.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -391,15 +393,15 @@ public class MPEDisplayManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
private Set<IEditTimeChangedListener> timeChangedListeners = new LinkedHashSet<IEditTimeChangedListener>();
|
||||
private final Set<IEditTimeChangedListener> timeChangedListeners = new LinkedHashSet<IEditTimeChangedListener>();
|
||||
|
||||
private Set<IDisplayFieldChangedListener> fieldChangedListeners = new LinkedHashSet<IDisplayFieldChangedListener>();
|
||||
private final Set<IDisplayFieldChangedListener> fieldChangedListeners = new LinkedHashSet<IDisplayFieldChangedListener>();
|
||||
|
||||
private final IRenderableDisplay display;
|
||||
|
||||
private DisplayFieldData displayedField;
|
||||
|
||||
private MPEFieldResourceData fieldResourceData = new MPEFieldResourceData();
|
||||
private final MPEFieldResourceData fieldResourceData = new MPEFieldResourceData();
|
||||
|
||||
private MPEFieldResource displayedFieldResource;
|
||||
|
||||
|
@ -420,16 +422,7 @@ public class MPEDisplayManager {
|
|||
}
|
||||
editTime = getCurrentDisplayedDate();
|
||||
|
||||
displayedField = DisplayFieldData.rMosaic;
|
||||
String baseRadarMosaic = AppsDefaults.getInstance().getToken(
|
||||
"mpe_base_radar_mosaic");
|
||||
if (baseRadarMosaic != null) {
|
||||
DisplayFieldData fieldData = DisplayFieldData
|
||||
.fromString(baseRadarMosaic);
|
||||
if (fieldData != null) {
|
||||
displayedField = fieldData;
|
||||
}
|
||||
}
|
||||
displayedField = DisplayFieldData.mMosaic;
|
||||
|
||||
ChangeTimeProvider.update(this);
|
||||
|
||||
|
@ -549,12 +542,14 @@ public class MPEDisplayManager {
|
|||
/**
|
||||
* @param gageDisplay
|
||||
* the gageDisplay to set
|
||||
* @param isOn
|
||||
* is set to draw
|
||||
*/
|
||||
public void toggleGageDisplay(GageDisplay gageDisplay) {
|
||||
public void toggleGageDisplay(GageDisplay gageDisplay, boolean isOn) {
|
||||
List<MPEGageResource> rscs = display.getDescriptor().getResourceList()
|
||||
.getResourcesByTypeAsType(MPEGageResource.class);
|
||||
for (MPEGageResource rsc : rscs) {
|
||||
rsc.toggleGageDisplay(gageDisplay);
|
||||
rsc.toggleGageDisplay(gageDisplay, isOn);
|
||||
}
|
||||
display.refresh();
|
||||
}
|
||||
|
@ -730,6 +725,14 @@ public class MPEDisplayManager {
|
|||
listener.displayFieldChanged(oldField, fieldToDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
// reset gages
|
||||
List<MPEGageResource> rscs = display.getDescriptor()
|
||||
.getResourceList()
|
||||
.getResourcesByTypeAsType(MPEGageResource.class);
|
||||
for (MPEGageResource rsc : rscs) {
|
||||
rsc.reloadGages();
|
||||
}
|
||||
}
|
||||
|
||||
displayedFieldResource.issueRefresh();
|
||||
|
@ -817,6 +820,42 @@ public class MPEDisplayManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current command toggle state.
|
||||
*
|
||||
* @param commandId
|
||||
* The Command ID
|
||||
* @return the toggle state, or false if command not found
|
||||
*/
|
||||
public static Boolean getToggleState(String commandId) {
|
||||
Command command = service.getCommand(commandId);
|
||||
if (command != null) {
|
||||
State state = command.getState(RegistryToggleState.STATE_ID);
|
||||
if (state != null) {
|
||||
return (Boolean) state.getValue();
|
||||
}
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the toggle state.
|
||||
*
|
||||
* @param commandId
|
||||
* The command Id to set the toggle state on
|
||||
* @param toggleState
|
||||
* The toggle state value
|
||||
*/
|
||||
public static void setToggleState(String commandId, boolean toggleState) {
|
||||
Command command = service.getCommand(commandId);
|
||||
if (command != null) {
|
||||
State state = command.getState(RegistryToggleState.STATE_ID);
|
||||
if (state != null) {
|
||||
state.setValue(toggleState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the radio state id of the command specified by commandId as an
|
||||
* enum of the type of defaultValue with defaultValue being the default to
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.raytheon.uf.viz.core.IDisplayPane;
|
|||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.rsc.MPEGageResource;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
|
@ -45,6 +46,7 @@ import com.raytheon.viz.ui.input.EditableManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 6, 2009 snaples Initial creation
|
||||
* Mar 14, 2013 1457 mpduff Don't throw error if nothing displayed.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -54,6 +56,7 @@ public class ShowDisplay7x7 extends AbstractHandler implements IElementUpdater {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
if (MPEDisplayManager.getCurrent().getDisplayedFieldResource() != null) {
|
||||
IEditorPart activeEditor = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (activeEditor != null) {
|
||||
|
@ -68,6 +71,8 @@ public class ShowDisplay7x7 extends AbstractHandler implements IElementUpdater {
|
|||
rsc.issueRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -88,5 +93,4 @@ public class ShowDisplay7x7 extends AbstractHandler implements IElementUpdater {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.mpe.ui.actions;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.Command;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager.GageDisplay;
|
||||
|
||||
/**
|
||||
* Handler for Toggling Gage Id display.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 13, 2013 1457 mpduff Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ToggleGageIdDisplay extends AbstractHandler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
|
||||
* .ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
Command command = event.getCommand();
|
||||
boolean oldValue = HandlerUtil.toggleCommandState(command);
|
||||
|
||||
MPEDisplayManager dm = MPEDisplayManager.getCurrent();
|
||||
dm.toggleGageDisplay(GageDisplay.Ids, !oldValue);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.mpe.ui.actions;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.Command;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager.GageDisplay;
|
||||
|
||||
/**
|
||||
* Handler for Gage Triangle Display.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 13, 2013 1457 mpduff Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ToggleGageTriangleDisplay extends AbstractHandler {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
|
||||
* .ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
Command command = event.getCommand();
|
||||
boolean oldValue = HandlerUtil.toggleCommandState(command);
|
||||
MPEDisplayManager dm = MPEDisplayManager.getCurrent();
|
||||
dm.toggleGageDisplay(GageDisplay.Triangles, !oldValue);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -20,8 +20,10 @@
|
|||
package com.raytheon.viz.mpe.ui.actions;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.Command;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager.GageDisplay;
|
||||
|
@ -34,14 +36,14 @@ import com.raytheon.viz.mpe.ui.MPEDisplayManager.GageDisplay;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 24, 2008 1748 snaples Initial creation
|
||||
* Mar 14, 2013 1457 mpduff Renamed to ToggleGageValueDisplay.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ToggleGageDisplay extends AbstractHandler {
|
||||
|
||||
public class ToggleGageValueDisplay extends AbstractHandler {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -50,11 +52,12 @@ public class ToggleGageDisplay extends AbstractHandler {
|
|||
* .ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
String g = arg0.getParameter("Gage");
|
||||
GageDisplay disp = GageDisplay.valueOf(g);
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
Command command = event.getCommand();
|
||||
boolean oldValue = HandlerUtil.toggleCommandState(command);
|
||||
|
||||
MPEDisplayManager dm = MPEDisplayManager.getCurrent();
|
||||
dm.toggleGageDisplay(disp);
|
||||
dm.toggleGageDisplay(GageDisplay.Values, !oldValue);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -27,12 +27,12 @@ import java.nio.channels.FileChannel;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
|
@ -63,6 +63,7 @@ import com.raytheon.uf.viz.core.rsc.GenericResourceData;
|
|||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
|
||||
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
|
||||
import com.raytheon.viz.mpe.MPECommandConstants;
|
||||
import com.raytheon.viz.mpe.core.MPEDataManager;
|
||||
import com.raytheon.viz.mpe.core.MPEDataManager.MPEGageData;
|
||||
import com.raytheon.viz.mpe.ui.Activator;
|
||||
|
@ -93,6 +94,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
|
|||
* Aug 17, 2012 15271 snaples Added check to add only PP gages
|
||||
* Sep 5, 2012 15079 snaples Added constant for Milli to inches conversion factor
|
||||
* Feb 12, 2013 15773 snaples Updated addPoints to display PC gages when token is set to use PC data.
|
||||
* Mar 14, 2013 1457 mpduff Fixed various bugs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -107,8 +109,6 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
|
||||
private static final double POINT_RADIUS = 2;
|
||||
|
||||
private static final RGB WHITE = new RGB(255, 255, 255);
|
||||
|
||||
private final SimpleDateFormat sdf;
|
||||
|
||||
private final Object mutex = new Object();
|
||||
|
@ -135,29 +135,53 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
|
||||
private final AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
|
||||
private Set<GageDisplay> displayTypes = new HashSet<GageDisplay>();
|
||||
private final Map<GageDisplay, Boolean> displayTypes = new HashMap<GageDisplay, Boolean>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param resourceData
|
||||
* The resourceData
|
||||
* @param loadProperties
|
||||
* The loadProperties
|
||||
*/
|
||||
public MPEGageResource(GenericResourceData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
sdf = new SimpleDateFormat("yyyyMMddHH");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
|
||||
setStates();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the Gage display for values and Ids
|
||||
*/
|
||||
private void setStates() {
|
||||
boolean stateSetting = MPEDisplayManager
|
||||
.getToggleState(MPECommandConstants.TOGGLE_GAGE_VALUE_COMMAND_ID);
|
||||
displayTypes.put(GageDisplay.Values, stateSetting);
|
||||
|
||||
stateSetting = MPEDisplayManager
|
||||
.getToggleState(MPECommandConstants.TOGGLE_GAGEID_COMMAND_ID);
|
||||
displayTypes.put(GageDisplay.Ids, stateSetting);
|
||||
|
||||
// Triangles default to off
|
||||
MPEDisplayManager.setToggleState(
|
||||
MPECommandConstants.TOGGLE_GAGE_TRIANGLE_COMMAND_ID, false);
|
||||
displayTypes.put(GageDisplay.Triangles, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles visibility of {@link GageDisplay} type
|
||||
*
|
||||
* @param display
|
||||
* The GageDisplay
|
||||
* @param isOn
|
||||
* true if on
|
||||
*/
|
||||
public void toggleGageDisplay(GageDisplay display) {
|
||||
if (displayTypes.remove(display) == false) {
|
||||
displayTypes.add(display);
|
||||
}
|
||||
public void toggleGageDisplay(GageDisplay display, boolean isOn) {
|
||||
displayTypes.put(display, isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -215,8 +239,7 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
// set the plot draw or no draw values
|
||||
if (displayTypes.isEmpty()) {
|
||||
if (!displayTypes.containsValue(Boolean.TRUE)) {
|
||||
// Nothing to paint
|
||||
return;
|
||||
}
|
||||
|
@ -230,15 +253,15 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
}
|
||||
}
|
||||
|
||||
if (displayTypes.contains(GageDisplay.Ids)
|
||||
|| displayTypes.contains(GageDisplay.Values)) {
|
||||
if (displayTypes.get(GageDisplay.Ids)
|
||||
|| displayTypes.get(GageDisplay.Values)) {
|
||||
paintPlotInfo(target, paintProps,
|
||||
displayTypes.contains(GageDisplay.Ids),
|
||||
displayTypes.contains(GageDisplay.Values));
|
||||
displayTypes.get(GageDisplay.Ids),
|
||||
displayTypes.get(GageDisplay.Values));
|
||||
}
|
||||
|
||||
try {
|
||||
if (displayTypes.contains(GageDisplay.Triangles)) {
|
||||
if (displayTypes.get(GageDisplay.Triangles)) {
|
||||
paintTriangles(target, paintProps);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -264,7 +287,6 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
String fileName = String.format(GAGE_TRIANGLES,
|
||||
sdf.format(lastDate));
|
||||
File file = new File(dir, fileName);
|
||||
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
|
@ -327,18 +349,19 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
|
||||
MPEDisplayManager.GageMissingOptions gm = MPEDisplayManager
|
||||
.getGageMissing();
|
||||
boolean displayIsEdit = displayMgr.getCurrentEditDate().equals(
|
||||
boolean displayIsEdit = false;
|
||||
if (paintProps.getDataTime() != null
|
||||
&& displayMgr.getCurrentEditDate() != null) {
|
||||
displayIsEdit = displayMgr.getCurrentEditDate().equals(
|
||||
paintProps.getDataTime().getRefTime());
|
||||
}
|
||||
boolean xor = MPEDisplayManager.getGageColor() == GageColor.Contrast
|
||||
&& displayIsEdit;
|
||||
|
||||
for (Coordinate point : dataMap.keySet()) {
|
||||
if (extent.contains(new double[] { point.x, point.y })) {
|
||||
MPEGageData gageData = dataMap.get(point);
|
||||
RGB gageColor = WHITE;
|
||||
if (displayIsEdit) {
|
||||
gageColor = getGageColor(gageData);
|
||||
}
|
||||
RGB gageColor = getGageColor(gageData);
|
||||
|
||||
boolean isReportedMissing = gageData.isReported_missing();
|
||||
boolean isMissing = ((gageData.getGval() == -999.f || gageData
|
||||
|
@ -383,6 +406,7 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isGageIdsDisplayed) {
|
||||
gageId = gageData.getId();
|
||||
|
||||
|
@ -421,7 +445,7 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
|
||||
private RGB getGageColor(MPEGageData gageData) {
|
||||
RGB gageColor = new RGB(255, 255, 255);
|
||||
if (displayTypes.isEmpty() == false) {
|
||||
if (displayTypes.containsValue(Boolean.TRUE)) {
|
||||
MPEDisplayManager.GageColor gc = MPEDisplayManager.getGageColor();
|
||||
switch (gc) {
|
||||
case Solid:
|
||||
|
@ -449,9 +473,7 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
if (gageData.getId().contains("PSEUDO")) {
|
||||
fltVal = (float) (gageData.getGval() / MILLICVT);
|
||||
}
|
||||
// System.out.println("--- fltVal = " + fltVal);
|
||||
gageColor = getColorByValue(fltVal);
|
||||
// gageColor = getColorByValue(gageData.getGval());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -482,7 +504,8 @@ public class MPEGageResource extends AbstractMPEInputResource implements
|
|||
.hasNext();) {
|
||||
MPEGageData gageData = it.next();
|
||||
// DR15773 Use PC gages only when token set to ON.
|
||||
if ((gageData.getPe().equalsIgnoreCase("PC")) && (process_PC == false)) {
|
||||
if ((gageData.getPe().equalsIgnoreCase("PC"))
|
||||
&& (process_PC == false)) {
|
||||
continue;
|
||||
}
|
||||
Coordinate latLon = gageData.getLatLon();
|
||||
|
|
|
@ -31,8 +31,6 @@ import javax.measure.unit.NonSI;
|
|||
import javax.measure.unit.SI;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
@ -56,6 +54,7 @@ import com.raytheon.viz.mpe.core.MPEDataManager.MPEGageData;
|
|||
* Oct 30, 2008 snaples Initial creation
|
||||
* Aug 8, 2012 15271 snaples Updated hourly slot
|
||||
* Jan 02, 2013 15565 snaples Fixed problem with wrong time being sent to mpe_fieldgen
|
||||
* Mar 14, 2013 1457 mpduff Fixed memory leak.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -181,8 +180,6 @@ public class RegenHrFlds {
|
|||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
Cursor prev = shell.getCursor();
|
||||
Cursor wait = new Cursor(Display.getDefault(), SWT.CURSOR_WAIT);
|
||||
this.checkGages();
|
||||
boolean ref = MPEDataManager.getInstance().isRadarEditFlag();
|
||||
/* Store any gage edits into the HourlyPP or PseudoGageVal table. */
|
||||
|
@ -291,7 +288,7 @@ public class RegenHrFlds {
|
|||
String drr = "1 " + hour + " " + dr.format(datetime);
|
||||
System.out.println("Regen args are " + drr);
|
||||
MpeFieldGenJob regen = new MpeFieldGenJob(drr);
|
||||
shell.setCursor(wait);
|
||||
shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
regen.schedule();
|
||||
try {
|
||||
regen.join();
|
||||
|
@ -300,9 +297,8 @@ public class RegenHrFlds {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/* Clear gage edits */
|
||||
MPEDataManager.getInstance().clearEditGages();
|
||||
shell.setCursor(prev);
|
||||
shell.setCursor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue