Issue #1638 Made Map scales more generalized for use outside of D2D

Amend: Added generalization to JaxbManager

Change-Id: Ic210b8b0d50b4f362321855268570147c439cc2a

Former-commit-id: e17d691400 [formerly dabffdbf79 [formerly fd375314cd] [formerly e17d691400 [formerly 1e5812d9796a77559d70392be18619a8f7316f2d]]]
Former-commit-id: dabffdbf79 [formerly fd375314cd]
Former-commit-id: dabffdbf79
Former-commit-id: 64df5b6e30
This commit is contained in:
Max Schenkelberg 2013-03-22 16:27:02 -05:00
parent 279f64b88a
commit 0f7bca0cab
15 changed files with 315 additions and 79 deletions

View file

@ -3,4 +3,5 @@ com.raytheon.uf.viz.core.maps.rsc.DbMapResourceData
com.raytheon.uf.viz.core.maps.rsc.DbPointMapResourceData com.raytheon.uf.viz.core.maps.rsc.DbPointMapResourceData
com.raytheon.uf.viz.core.maps.MapStylePreferenceStore com.raytheon.uf.viz.core.maps.MapStylePreferenceStore
com.raytheon.uf.viz.core.maps.display.MapRenderableDisplay com.raytheon.uf.viz.core.maps.display.MapRenderableDisplay
com.raytheon.uf.viz.core.maps.display.PlainMapRenderableDisplay com.raytheon.uf.viz.core.maps.display.PlainMapRenderableDisplay
com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay

View file

@ -56,6 +56,10 @@
class="com.raytheon.uf.viz.core.maps.actions.LoadMap" class="com.raytheon.uf.viz.core.maps.actions.LoadMap"
commandId="com.raytheon.uf.viz.core.maps.actions.LoadMap"> commandId="com.raytheon.uf.viz.core.maps.actions.LoadMap">
</handler> </handler>
<handler
class="com.raytheon.uf.viz.core.maps.scales.MapScaleHandler"
commandId="com.raytheon.viz.ui.setScale">
</handler>
</extension> </extension>
<extension <extension
point="com.raytheon.viz.ui.contextualMenu"> point="com.raytheon.viz.ui.contextualMenu">
@ -110,4 +114,14 @@
value="mapStyles"> value="mapStyles">
</path> </path>
</extension> </extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:com.raytheon.viz.ui.scale">
<dynamic
class="com.raytheon.uf.viz.core.maps.scales.MapScalePopulator"
id="com.raytheon.uf.viz.core.maps.mapScales">
</dynamic>
</menuContribution>
</extension>
</plugin> </plugin>

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus; import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus;
@ -91,7 +92,7 @@ public class MapRenderableDisplay extends AbstractRenderableDisplay implements
super(); super();
} }
public MapRenderableDisplay(MapDescriptor desc) { public MapRenderableDisplay(IMapDescriptor desc) {
this(); this();
setDescriptor(desc); setDescriptor(desc);
} }

View file

@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.ResourceList; import com.raytheon.uf.viz.core.rsc.ResourceList;
/** /**
@ -57,7 +57,7 @@ public class PlainMapRenderableDisplay extends MapRenderableDisplay {
/** /**
* @param desc * @param desc
*/ */
public PlainMapRenderableDisplay(MapDescriptor desc) { public PlainMapRenderableDisplay(IMapDescriptor desc) {
super(desc); super(desc);
} }

View file

@ -19,6 +19,8 @@
**/ **/
package com.raytheon.uf.viz.core.maps.scales; package com.raytheon.uf.viz.core.maps.scales;
import com.raytheon.uf.viz.core.maps.scales.MapScales.MapScale;
/** /**
* Interface for display containing a scale * Interface for display containing a scale
* *
@ -44,4 +46,10 @@ public interface IMapScaleDisplay {
*/ */
public String getScaleName(); public String getScaleName();
/**
* Changes the scale of the display
*
* @param scale
*/
public void changeScale(MapScale scale);
} }

View file

@ -0,0 +1,89 @@
/**
* 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.uf.viz.core.maps.scales;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.core.maps.scales.MapScales.MapScale;
/**
* Handler of setScale command that looks for a {@link MapScale} by name of
* attribute scale and sets on any {@link IMapScaleDisplay}s on the current
* editor
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 22, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class MapScaleHandler extends AbstractHandler {
public static final String SET_SCALE_COMMAND_ID = "com.raytheon.viz.ui.setScale";
public static final String SCALE_NAME_ID = "scale";
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
* ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
MapScale scale = MapScales.getInstance().getScaleByName(
event.getParameter(SCALE_NAME_ID));
if (scale != null) {
IEditorPart part = HandlerUtil.getActiveEditor(event);
if (part instanceof IDisplayPaneContainer) {
IDisplayPaneContainer container = (IDisplayPaneContainer) part;
for (IDisplayPane pane : container.getDisplayPanes()) {
IRenderableDisplay display = pane.getRenderableDisplay();
if (display instanceof IMapScaleDisplay) {
((IMapScaleDisplay) display).changeScale(scale);
}
}
container.refresh();
VizGlobalsManager.getInstance(
HandlerUtil.getActiveWorkbenchWindow(event)).updateUI(
container);
}
}
return null;
}
}

View file

@ -63,20 +63,19 @@ public class MapScalePopulator extends CompoundContributionItem {
protected IContributionItem[] getContributionItems() { protected IContributionItem[] getContributionItems() {
MenuManager menuMgr = new MenuManager("Scales", "mapControls"); MenuManager menuMgr = new MenuManager("Scales", "mapControls");
IDisplayPaneContainer cont = EditorUtil.getActiveVizContainer(); IDisplayPaneContainer cont = EditorUtil.getActiveVizContainer();
// Load scales if we have d2d map renderable display on editor or, there
// is no editor opened in the d2d perspective
if ((cont != null && (cont.getActiveDisplayPane() if ((cont != null && (cont.getActiveDisplayPane()
.getRenderableDisplay() instanceof IMapScaleDisplay)) .getRenderableDisplay() instanceof IMapScaleDisplay))
|| EditorUtil.getActiveEditor() == null) { || EditorUtil.getActiveEditor() == null) {
for (MapScale scale : MapScales.getInstance().getScales()) { for (MapScale scale : MapScales.getInstance().getScales()) {
Map<String, String> parms = new HashMap<String, String>(); Map<String, String> parms = new HashMap<String, String>();
parms.put("scale", scale.getDisplayName()); parms.put(MapScaleHandler.SCALE_NAME_ID, scale.getDisplayName());
CommandContributionItem item = new CommandContributionItem( CommandContributionItem item = new CommandContributionItem(
new CommandContributionItemParameter( new CommandContributionItemParameter(
PlatformUI.getWorkbench(), null, PlatformUI.getWorkbench(), null,
"com.raytheon.viz.ui.setScale", parms, null, MapScaleHandler.SET_SCALE_COMMAND_ID, parms,
null, null, scale.getDisplayName(), null, null, null, null, null, scale.getDisplayName(), null,
CommandContributionItem.STYLE_PUSH, null, true)); null, CommandContributionItem.STYLE_PUSH, null,
true));
menuMgr.add(item); menuMgr.add(item);
} }
} }

View file

@ -0,0 +1,144 @@
/**
* 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.uf.viz.core.maps.scales;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.maps.display.PlainMapRenderableDisplay;
import com.raytheon.uf.viz.core.maps.scales.MapScales.MapScale;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.viz.ui.actions.LoadSerializedXml;
/**
* MapRenderableDisplay associated with a {@link MapScale}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 22, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class MapScaleRenderableDisplay extends PlainMapRenderableDisplay
implements IMapScaleDisplay {
@XmlAttribute
protected String scale = (String) VizGlobalsManager.getCurrentInstance()
.getPropery(VizConstants.SCALE_ID);
public MapScaleRenderableDisplay() {
super();
}
public MapScaleRenderableDisplay(IMapDescriptor desc) {
super(desc);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay#getScaleName()
*/
@Override
public String getScaleName() {
return scale;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay#changeScale(com
* .raytheon.uf.viz.core.maps.scales.MapScales.MapScale)
*/
@Override
public void changeScale(MapScale scale) {
MapScale currentScale = MapScales.getInstance().getScaleByName(
getScaleName());
Bundle bundle = (Bundle) LoadSerializedXml.deserialize(currentScale
.getFile());
for (AbstractRenderableDisplay display : bundle.getDisplays()) {
descriptor.getResourceList().removeAll(
display.getDescriptor().getResourceList());
}
loadScale(scale);
}
@Override
public void clear() {
MapScale scale = MapScales.getInstance().getScaleByName(getScaleName());
if (scale == null) {
scale = MapScales.getInstance().getScaleByName(
(String) VizGlobalsManager.getCurrentInstance().getPropery(
VizConstants.SCALE_ID));
}
if (scale != null) {
descriptor.getResourceList().clear();
loadScale(scale);
}
}
protected void loadScale(MapScale scale) {
Bundle bundle = (Bundle) LoadSerializedXml.deserialize(scale.getFile());
for (AbstractRenderableDisplay ard : bundle.getDisplays()) {
try {
descriptor.setGridGeometry(ard.getDescriptor()
.getGridGeometry());
descriptor.getResourceList().addAll(
ard.getDescriptor().getResourceList());
ard.getDescriptor().getResourceList().clear();
break;
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}
descriptor.getResourceList().instantiateResources(descriptor, true);
this.scale = scale.getDisplayName();
scaleToClientArea(getBounds());
}
@Override
public Map<String, Object> getGlobalsMap() {
Map<String, Object> globals = super.getGlobalsMap();
globals.put(VizConstants.SCALE_ID, getScaleName());
return globals;
}
}

View file

@ -74,7 +74,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractRenderableDisplay implements IRenderableDisplay { public abstract class AbstractRenderableDisplay implements IRenderableDisplay {
private static final transient IUFStatusHandler statusHandler = UFStatus protected static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractRenderableDisplay.class); .getHandler(AbstractRenderableDisplay.class);
private static RGB BACKGROUND_COLOR = null; private static RGB BACKGROUND_COLOR = null;

View file

@ -19,7 +19,6 @@
**/ **/
package com.raytheon.uf.viz.d2d.core.map; package com.raytheon.uf.viz.d2d.core.map;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -32,7 +31,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.VizConstants; import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor; import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.drawables.ResourcePair;
@ -40,10 +38,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.globals.VizGlobalsManager; import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
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.MapRenderableDisplay; import com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay;
import com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay;
import com.raytheon.uf.viz.core.maps.scales.MapScales;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceGroup; import com.raytheon.uf.viz.core.rsc.IResourceGroup;
import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder; import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder;
@ -56,7 +51,6 @@ import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay;
import com.raytheon.uf.viz.d2d.core.sampling.CloudHeightResourceData; import com.raytheon.uf.viz.d2d.core.sampling.CloudHeightResourceData;
import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher;
import com.raytheon.viz.core.imagery.ImageCombiner; import com.raytheon.viz.core.imagery.ImageCombiner;
import com.raytheon.viz.ui.actions.LoadSerializedXml;
/** /**
* Implementation of a D2D-specific map renderable display * Implementation of a D2D-specific map renderable display
@ -68,6 +62,7 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 9, 2009 njensen Initial creation * Feb 9, 2009 njensen Initial creation
* Mar 21, 2013 1638 mschenke Made map scales not tied to d2d * Mar 21, 2013 1638 mschenke Made map scales not tied to d2d
* Mar 22, 2013 1638 mschenke Moved map scale code to MapScaleRenderableDisplay
* *
* </pre> * </pre>
* *
@ -76,8 +71,8 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml;
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement @XmlRootElement
public class D2DMapRenderableDisplay extends MapRenderableDisplay implements public class D2DMapRenderableDisplay extends MapScaleRenderableDisplay
ID2DRenderableDisplay, IMapScaleDisplay { implements ID2DRenderableDisplay {
private static final CloudHeightResourceData cloudHeightData = new CloudHeightResourceData(); private static final CloudHeightResourceData cloudHeightData = new CloudHeightResourceData();
@ -92,11 +87,6 @@ public class D2DMapRenderableDisplay extends MapRenderableDisplay implements
protected double density = ((Double) VizGlobalsManager.getCurrentInstance() protected double density = ((Double) VizGlobalsManager.getCurrentInstance()
.getPropery(VizConstants.DENSITY_ID)).doubleValue(); .getPropery(VizConstants.DENSITY_ID)).doubleValue();
/** The current display scale */
@XmlAttribute
protected String scale = (String) VizGlobalsManager.getCurrentInstance()
.getPropery(VizConstants.SCALE_ID);
protected DataScaleListener scaleListener = null; protected DataScaleListener scaleListener = null;
protected ImageCombiner combinerListener = null; protected ImageCombiner combinerListener = null;
@ -264,28 +254,11 @@ public class D2DMapRenderableDisplay extends MapRenderableDisplay implements
} }
} }
@Override
public void clear() {
descriptor.getResourceList().clear();
File scaleFile = MapScales.getInstance().getScaleByName(getScale())
.getFile();
Bundle bundle = (Bundle) LoadSerializedXml.deserialize(scaleFile);
for (AbstractRenderableDisplay ard : bundle.getDisplays()) {
descriptor.getResourceList().addAll(
ard.getDescriptor().getResourceList());
ard.getDescriptor().getResourceList().clear();
break;
}
descriptor.getResourceList().instantiateResources(descriptor, true);
scaleToClientArea(getBounds());
}
@Override @Override
public Map<String, Object> getGlobalsMap() { public Map<String, Object> getGlobalsMap() {
Map<String, Object> globals = super.getGlobalsMap(); Map<String, Object> globals = super.getGlobalsMap();
globals.put(VizConstants.FRAMES_ID, new Integer(getDescriptor() globals.put(VizConstants.FRAMES_ID, new Integer(getDescriptor()
.getNumberOfFrames())); .getNumberOfFrames()));
globals.put(VizConstants.SCALE_ID, scale);
globals.put(VizConstants.DENSITY_ID, new Double(density)); globals.put(VizConstants.DENSITY_ID, new Double(density));
globals.put(VizConstants.MAGNIFICATION_ID, new Double(magnification)); globals.put(VizConstants.MAGNIFICATION_ID, new Double(magnification));
globals.put(VizConstants.LOADMODE_ID, ((D2DTimeMatcher) getDescriptor() globals.put(VizConstants.LOADMODE_ID, ((D2DTimeMatcher) getDescriptor()
@ -358,14 +331,4 @@ public class D2DMapRenderableDisplay extends MapRenderableDisplay implements
return combinerListener; return combinerListener;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay#getScaleName()
*/
@Override
public String getScaleName() {
return getScale();
}
} }

View file

@ -1375,13 +1375,6 @@
id="com.raytheon.uf.viz.d2d.ui.densityPopulator"> id="com.raytheon.uf.viz.d2d.ui.densityPopulator">
</dynamic> </dynamic>
</menuContribution> </menuContribution>
<menuContribution
locationURI="menu:com.raytheon.viz.ui.scale">
<dynamic
class="com.raytheon.uf.viz.core.maps.scales.MapScalePopulator"
id="com.raytheon.uf.viz.d2d.ui.mapScales">
</dynamic>
</menuContribution>
</extension> </extension>
@ -1398,13 +1391,14 @@
class="com.raytheon.uf.viz.d2d.ui.map.actions.ClearAction" class="com.raytheon.uf.viz.d2d.ui.map.actions.ClearAction"
commandId="com.raytheon.viz.ui.clear"> commandId="com.raytheon.viz.ui.clear">
</handler> </handler>
<handler
class="com.raytheon.uf.viz.d2d.ui.map.actions.ScaleButtonHandler"
commandId="com.raytheon.viz.ui.scalebutton">
</handler>
<handler <handler
class="com.raytheon.uf.viz.d2d.ui.map.actions.ScaleHandler" class="com.raytheon.uf.viz.d2d.ui.map.actions.ScaleHandler"
commandId="com.raytheon.viz.ui.setScale"> commandId="com.raytheon.viz.ui.setScale">
<activeWhen>
<reference
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference>
</activeWhen>
</handler> </handler>
<handler <handler
class="com.raytheon.uf.viz.d2d.ui.actions.TimeOptionsAction" class="com.raytheon.uf.viz.d2d.ui.actions.TimeOptionsAction"

View file

@ -216,7 +216,8 @@
</command> </command>
<command <command
id="com.raytheon.viz.ui.scalebutton" id="com.raytheon.viz.ui.scalebutton"
name="Update Scale Button"> name="Update Scale Button"
defaultHandler="com.raytheon.viz.ui.actions.ScaleButtonHandler">
</command> </command>
<command <command
id="com.raytheon.viz.ui.setScale" id="com.raytheon.viz.ui.setScale"

View file

@ -36,8 +36,9 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 8, 2013 mschenke Initial creation * Jan 8, 2013 mschenke Initial creation
* Feb 25, 2013 1640 bsteffen Dispose old display in BundleLoader * Feb 25, 2013 1640 bsteffen Dispose old display in BundleLoader
* Mar 22, 2013 1638 mschenke Made not throw errors when no time matcher
* *
* </pre> * </pre>
* *
@ -164,13 +165,17 @@ public class BundleLoader extends Job {
if (i == 0) { if (i == 0) {
IRenderableDisplay loadFrom = items[i].loadFrom; IRenderableDisplay loadFrom = items[i].loadFrom;
IDisplayPane loadTo = items[i].loadTo; IDisplayPane loadTo = items[i].loadTo;
AbstractTimeMatcher srcTimeMatcher = loadFrom
AbstractTimeMatcher destTimeMatcher = loadTo
.getDescriptor().getTimeMatcher(); .getDescriptor().getTimeMatcher();
if (srcTimeMatcher != null) { if (destTimeMatcher != null) {
loadTo.getDescriptor().getTimeMatcher() AbstractTimeMatcher srcTimeMatcher = loadFrom
.copyFrom(srcTimeMatcher); .getDescriptor().getTimeMatcher();
if (srcTimeMatcher != null) {
destTimeMatcher.copyFrom(srcTimeMatcher);
}
destTimeMatcher.resetMultiload();
} }
loadTo.getDescriptor().getTimeMatcher().resetMultiload();
t.run(); t.run();
} else { } else {
t.start(); t.start();

View file

@ -20,7 +20,7 @@
/** /**
* *
*/ */
package com.raytheon.uf.viz.d2d.ui.map.actions; package com.raytheon.viz.ui.actions;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.commands.IElementUpdater; import org.eclipse.ui.commands.IElementUpdater;
@ -28,7 +28,6 @@ import org.eclipse.ui.menus.UIElement;
import com.raytheon.uf.viz.core.VizConstants; import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.globals.IGlobalChangedListener; import com.raytheon.uf.viz.core.globals.IGlobalChangedListener;
import com.raytheon.viz.ui.actions.AbstractGlobalsButtonHandler;
/** /**
* Updates the scale * Updates the scale

View file

@ -20,10 +20,11 @@
package com.raytheon.uf.common.serialization; package com.raytheon.uf.common.serialization;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.ArrayList; import java.util.ArrayList;
@ -255,28 +256,45 @@ public class JAXBManager {
*/ */
public void jaxbMarshalToXmlFile(Object obj, String filePath) public void jaxbMarshalToXmlFile(Object obj, String filePath)
throws SerializationException { throws SerializationException {
FileWriter writer = null; try {
jaxbMarshalToStream(obj, new FileOutputStream(new File(filePath)));
} catch (SerializationException e) {
throw e;
} catch (Exception e) {
throw new SerializationException(e);
}
}
/**
* Convert an instance of a class to an XML representation and write XML to
* output stream. Uses JAXB.
*
* @param obj
* @param out
* @throws SerializationException
*/
public void jaxbMarshalToStream(Object obj, OutputStream out)
throws SerializationException {
Marshaller msh = null; Marshaller msh = null;
try { try {
msh = getMarshaller(); msh = getMarshaller();
msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true)); msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
writer = new FileWriter(new File(filePath)); msh.marshal(obj, out);
msh.marshal(obj, writer);
} catch (Exception e) { } catch (Exception e) {
throw new SerializationException(e); throw new SerializationException(e);
} finally { } finally {
if (msh != null && marshallers.size() < QUEUE_SIZE) { if (msh != null && marshallers.size() < QUEUE_SIZE) {
marshallers.add(msh); marshallers.add(msh);
} }
if (writer != null) { if (out != null) {
try { try {
writer.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
// ignore // ignore
} }
} }
} }
} }
/** /**