Merge "Issue #2001 fix message handling" into development

Former-commit-id: 8438eb1b4a [formerly 737b265c34] [formerly 4d519da3a9 [formerly 50ea25c2563c109b92e4251c05174b9b3d077909]]
Former-commit-id: 4d519da3a9
Former-commit-id: d2cccd342b
This commit is contained in:
Nate Jensen 2013-05-21 11:00:32 -05:00 committed by Gerrit Code Review
commit 0fc260728b
2 changed files with 34 additions and 60 deletions

View file

@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.graphics.RGB;
import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridGeometry2D;
@ -44,6 +43,8 @@ import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IExtent;
@ -53,7 +54,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.IRenderable;
@ -65,7 +65,6 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
import com.raytheon.viz.redbook.Activator;
import com.raytheon.viz.redbook.RedbookWMOMap;
import com.raytheon.viz.redbook.blocks.AbstractTextBlock;
import com.raytheon.viz.redbook.blocks.AlphaNumBlock;
@ -86,12 +85,13 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 29, 2008 #1162 chammack Initial creation
* Jan 28, 2010 #4224 M. Huang Added Line Style, Line Width
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 29, 2008 1162 chammack Initial creation
* Jan 28, 2010 4224 M. Huang Added Line Style, Line Width
* menu choice
* Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader.
* May 21, 2013 2001 njensen Fixed error handling
*
* </pre>
*
@ -100,6 +100,9 @@ import com.vividsolutions.jts.geom.Coordinate;
*/
public class RedbookFrame implements IRenderable {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(RedbookFrame.class);
protected JTSCompiler compiler;
protected IWireframeShape wireframeShape;
@ -184,14 +187,8 @@ public class RedbookFrame implements IRenderable {
try {
this.compiler.handle(vb.getGeometry());
} catch (VizException e) {
Activator
.getDefault()
.getLog()
.log(new Status(
Status.ERROR,
Activator.PLUGIN_ID,
"Error during rendering of redbook",
e));
statusHandler.error(
"Error during rendering of redbook", e);
status.vectorRenderingWarning = true;
}
} else if (currBlock.equals("001_004")) {
@ -218,12 +215,8 @@ public class RedbookFrame implements IRenderable {
}
}
} catch (Exception e) {
VizApp.logAndAlert(
org.eclipse.core.runtime.Status.ERROR,
e,
"Error rendering redbook product",
"The redbook product may not be rendered correctly due to an error determining the map projection.",
Activator.getDefault(), Activator.PLUGIN_ID);
statusHandler.error(
"Error rendering redbook product", e);
}
if (customProjection == null) {
@ -292,35 +285,23 @@ public class RedbookFrame implements IRenderable {
DefaultBlock block = new DefaultBlock(header, dataBuf);
if (!currBlock.equals("")) {
status.unhandledPackets = true;
Activator
.getDefault()
.getLog()
.log(new Status(Status.WARNING,
Activator.PLUGIN_ID,
"Unhandled redbook packet: (mode="
+ block.getMode()
+ ", submode="
+ block.getSubMode() + ")"));
statusHandler
.warn("Unhandled redbook packet: (mode="
+ block.getMode() + ", submode="
+ block.getSubMode() + ")");
}
}
}
} catch (TransformException e) {
VizApp.logAndAlert(
org.eclipse.core.runtime.Status.ERROR,
e,
"Error rendering redbook product",
"The redbook product cannot be rendered due to an error setting up the map projection.",
Activator.getDefault(), Activator.PLUGIN_ID);
statusHandler
.error("Error rendering redbook product due to an error setting up the map projection.",
e);
} catch (FactoryException e) {
VizApp.logAndAlert(
org.eclipse.core.runtime.Status.ERROR,
e,
"Error rendering redbook product",
"The redbook product cannot be rendered due to an error setting up the map projection.",
Activator.getDefault(), Activator.PLUGIN_ID);
statusHandler
.error("Error rendering redbook product due to an error setting up the map projection.",
e);
}
}
@ -578,8 +559,8 @@ public class RedbookFrame implements IRenderable {
dstring.textStyle = TextStyle.BLANKED;
}
if (isLegend) {
target.getExtension(ICanvasRenderingExtension.class).drawStrings(
paintProps, dstring);
target.getExtension(ICanvasRenderingExtension.class)
.drawStrings(paintProps, dstring);
} else {
target.drawStrings(dstring);

View file

@ -26,8 +26,6 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.Validate;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.edex.plugin.redbook.common.RedbookRecord;
@ -64,9 +62,10 @@ import com.raytheon.viz.redbook.rsc.RedbookFrame.RedbookStatus;
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 28, 2008 #1162 chammack Initial creation
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 28, 2008 1162 chammack Initial creation
* May 21, 2013 2001 njensen Fixed display of messages
*
* </pre>
*
@ -261,17 +260,11 @@ public class RedbookResource extends
if (status != null) {
if (status.unhandledPackets) {
MessageDialog
.openWarning(
Display.getCurrent().getActiveShell(),
"Redbook Rendering Warning",
"Warning: Unrecognized redbook packets found, rendering may not be complete. Details have been logged.");
statusHandler
.info("Warning: Unrecognized redbook packets found. Rendering may not be complete.");
} else if (status.vectorRenderingWarning) {
MessageDialog
.openWarning(
Display.getCurrent().getActiveShell(),
"Redbook Rendering Warning",
"Warning: Some redbook vectors could not be rendered. Rendering may not be complete. Details have been logged.");
statusHandler
.info("Warning: Some redbook vectors could not be rendered. Rendering may not be complete.");
}
}
}