Issue #588 Got crude string rendering working. Doesn't quite look good if canvas bounds are not same size and legends are not handled specially

Change-Id: I8f3d0560869178598f160fb2e7914c45f656a860

Former-commit-id: 5fca70461f [formerly 31243a9dfe] [formerly 5fca70461f [formerly 31243a9dfe] [formerly 074b9aba8c [formerly 24b673fcc45a4da27ac349bdebf8b48f6405607b]]]
Former-commit-id: 074b9aba8c
Former-commit-id: d2d6a4d1eb [formerly d22b403f48]
Former-commit-id: fc471eb557
This commit is contained in:
Max Schenkelberg 2012-05-10 18:03:00 -05:00
parent cb1ff65e77
commit 0f3d4cf0e4
10 changed files with 633 additions and 109 deletions

View file

@ -153,9 +153,6 @@
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.GeneralRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.FontRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.ImagingRenderingHandler">
</renderingExtension>
@ -165,6 +162,9 @@
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.WireframeShapeRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.StringRenderingHandler">
</renderingExtension>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">

View file

@ -142,8 +142,8 @@ public class CollaborationObjectEventStorage implements
HttpClientResponse response = executeRequest(put);
if (isSuccess(response.code) == false) {
throw new CollaborationException(
"Error uploading event object to server @ "
+ eventObjectURL + " : "
"Error uploading event object (" + event.getObjectId()
+ ") to server @ " + eventObjectURL + " : "
+ new String(response.data));
}
wrapped.setResourcePath(objectPath);

View file

@ -26,13 +26,17 @@ import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.remote.graphics.events.fonts.CreateFontEvent;
import com.raytheon.uf.viz.remote.graphics.events.fonts.UpdateFontDataEvent;
import com.raytheon.uf.viz.remote.graphics.events.strings.DrawStringEvent;
import com.raytheon.uf.viz.remote.graphics.events.strings.DrawStringsEvent;
/**
* Handles render events for Font objects
* Rendering handler for strings and fonts
*
* <pre>
*
@ -40,7 +44,7 @@ import com.raytheon.uf.viz.remote.graphics.events.fonts.UpdateFontDataEvent;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 16, 2012 mschenke Initial creation
* May 10, 2012 mschenke Initial creation
*
* </pre>
*
@ -48,7 +52,26 @@ import com.raytheon.uf.viz.remote.graphics.events.fonts.UpdateFontDataEvent;
* @version 1.0
*/
public class FontRenderingHandler extends CollaborationRenderingHandler {
public class StringRenderingHandler extends CollaborationRenderingHandler {
@Subscribe
public void drawStrings(DrawStringsEvent event) {
DrawStringEvent[] events = event.getStrings();
DrawableString[] strings = new DrawableString[events.length];
for (int i = 0; i < events.length; ++i) {
strings[i] = events[i].getDrawableString();
if (events[i].getFontId() > -1) {
strings[i].font = dataManager.getRenderableObject(
events[i].getFontId(), IFont.class);
}
}
try {
getGraphicsTarget().drawStrings(strings);
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe
public void createFont(CreateFontEvent event) {
@ -95,4 +118,5 @@ public class FontRenderingHandler extends CollaborationRenderingHandler {
public void disposeFont(IFont font) {
font.dispose();
}
}

View file

@ -68,12 +68,6 @@ public class DrawableString extends AbstractDrawableObject {
/** amount of rotation in degrees from right */
public double rotation = 0.0;
/**
* determines if the text rotation should be from start of text or x,y,z
* passed in
*/
public boolean rotateOnStartOfText = false;
/** The colors to use for the strings */
private RGB[] colors;

View file

@ -72,8 +72,6 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
public class D2DColorBarResource extends
AbstractVizResource<GenericResourceData, IDescriptor> {
private static IFont colorBarFont;
private static RGB COLOR = ColorFactory.getInstance().getColor(
D2DColorBarResource.class.getName() + "Color");
@ -81,6 +79,8 @@ public class D2DColorBarResource extends
LEFT, RIGHT
}
private IFont colorBarFont;
private Map<List<LabelEntry>, List<LabelEntry>> modifiedMap;
public D2DColorBarResource(GenericResourceData resourceData,
@ -96,18 +96,14 @@ public class D2DColorBarResource extends
@Override
protected void disposeInternal() {
colorBarFont.dispose();
}
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
synchronized (resourceData) {
if (colorBarFont == null) {
colorBarFont = target.initializeFont(D2DColorBarResource.class
.getName() + "Font");
colorBarFont.setScaleFont(false);
}
}
colorBarFont = target.initializeFont(D2DColorBarResource.class
.getName() + "Font");
colorBarFont.setScaleFont(false);
}
@Override

View file

@ -27,6 +27,7 @@ Export-Package: com.raytheon.uf.viz.remote.graphics,
com.raytheon.uf.viz.remote.graphics.events.offscreen,
com.raytheon.uf.viz.remote.graphics.events.points,
com.raytheon.uf.viz.remote.graphics.events.rendering,
com.raytheon.uf.viz.remote.graphics.events.strings,
com.raytheon.uf.viz.remote.graphics.events.wireframe,
com.raytheon.uf.viz.remote.graphics.extensions,
com.raytheon.uf.viz.remote.graphics.objects

View file

@ -26,6 +26,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.graphics.RGB;
@ -74,6 +75,8 @@ import com.raytheon.uf.viz.remote.graphics.events.imagery.CreateIImageEvent;
import com.raytheon.uf.viz.remote.graphics.events.points.DrawPointsEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.EndFrameEvent;
import com.raytheon.uf.viz.remote.graphics.events.strings.DrawStringEvent;
import com.raytheon.uf.viz.remote.graphics.events.strings.DrawStringsEvent;
import com.raytheon.uf.viz.remote.graphics.events.wireframe.CreateWireframeShapeEvent;
import com.raytheon.uf.viz.remote.graphics.events.wireframe.RenderWireframeShapeEvent;
import com.raytheon.uf.viz.remote.graphics.extensions.DispatchingImagingExtension;
@ -279,21 +282,7 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
* @see com.raytheon.uf.viz.core.IGraphicsTarget#drawStrings(com.raytheon.uf.viz.core.DrawableString[])
*/
public void drawStrings(DrawableString... parameters) throws VizException {
IFont[] originalFonts = new IFont[parameters.length];
for (int i = 0; i < parameters.length; ++i) {
DrawableString string = parameters[i];
originalFonts[i] = string.font;
if (string.font instanceof DispatchingFont) {
string.font = ((DispatchingFont) string.font)
.getWrappedObject();
}
}
wrappedObject.drawStrings(parameters);
for (int i = 0; i < parameters.length; ++i) {
parameters[i].font = originalFonts[i];
}
// TODO: Send rendering event for String drawing
drawStrings(Arrays.asList(parameters));
}
/**
@ -307,15 +296,31 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
for (DrawableString string : parameters) {
originalFonts.add(string.font);
if (string.font instanceof DispatchingFont) {
string.font = ((DispatchingFont) string.font)
.getWrappedObject();
DispatchingFont font = (DispatchingFont) string.font;
font.flushState();
string.font = font.getWrappedObject();
}
}
wrappedObject.drawStrings(parameters);
int i = 0;
for (DrawableString string : parameters) {
string.font = originalFonts.get(i);
Iterator<DrawableString> stringIter = parameters.iterator();
Iterator<IFont> fontIter = originalFonts.iterator();
while (stringIter.hasNext() && fontIter.hasNext()) {
stringIter.next().font = fontIter.next();
}
DrawStringsEvent event = RemoteGraphicsEventFactory.createEvent(
DrawStringsEvent.class, this);
DrawStringEvent[] strings = new DrawStringEvent[parameters.size()];
int i = 0;
for (DrawableString param : parameters) {
strings[i] = RemoteGraphicsEventFactory.createEvent(
DrawStringEvent.class, this);
strings[i].setDrawableString(param);
++i;
}
event.setStrings(strings);
dispatch(event);
}
/**
@ -506,7 +511,9 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
event.setLineStyle(lineStyle);
event.setAlpha(alpha);
if (font instanceof DispatchingFont) {
event.setFontId(((DispatchingFont) font).getObjectId());
DispatchingFont df = (DispatchingFont) font;
df.flushState();
event.setFontId(df.getObjectId());
}
dispatch(event);
}

View file

@ -1,64 +0,0 @@
/**
* 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.remote.graphics.events.rendering;
/**
* Event for drawing strings
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 3, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class DrawStringsEvent extends AbstractRemoteGraphicsRenderEvent {
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent#
* applyDiffObject
* (com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent)
*/
@Override
public void applyDiffObject(IRenderEvent diffEvent) {
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsRenderEvent#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
return false;
}
}

View file

@ -0,0 +1,425 @@
/**
* 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.remote.graphics.events.strings;
import java.util.Arrays;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsRenderEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingFont;
/**
* Drawing event that wraps a DrawableString object
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 10, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerializeElement
private int fontId = -1;
@DynamicSerializeElement
private String[] text;
@DynamicSerializeElement
private RGB[] colors;
@DynamicSerializeElement
private float alpha;
@DynamicSerializeElement
private HorizontalAlignment horizontalAlignment;
@DynamicSerializeElement
private VerticalAlignment verticalAlignment;
@DynamicSerializeElement
private TextStyle textStyle;
@DynamicSerializeElement
private RGB boxColor;
@DynamicSerializeElement
private double magnification = 1.0f;
@DynamicSerializeElement
private double rotation = 0.0;
@DynamicSerializeElement
private double[] point;
@DynamicSerializeElement
private boolean xOrColors;
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsRenderEvent
* #createDiffObject(com.raytheon.uf.viz.remote
* .graphics.events.rendering.IRenderEvent)
*/
@Override
public DrawStringEvent createDiffObject(IRenderEvent event) {
DrawStringEvent diffEvent = (DrawStringEvent) event;
DrawStringEvent diffObject = new DrawStringEvent();
diffObject.alpha = diffEvent.alpha;
diffObject.boxColor = diffEvent.boxColor;
diffObject.xOrColors = diffEvent.xOrColors;
diffObject.fontId = diffEvent.fontId;
diffObject.magnification = diffEvent.magnification;
diffObject.rotation = diffEvent.rotation;
if (Arrays.equals(colors, diffEvent.colors) == false) {
diffObject.colors = diffEvent.colors;
}
if (Arrays.equals(text, diffEvent.text) == false) {
diffObject.text = diffEvent.text;
}
if (Arrays.equals(point, diffEvent.point) == false) {
diffObject.point = diffEvent.point;
}
if (horizontalAlignment != diffEvent.horizontalAlignment) {
diffObject.horizontalAlignment = diffEvent.horizontalAlignment;
}
if (verticalAlignment != diffEvent.verticalAlignment) {
diffObject.verticalAlignment = diffEvent.verticalAlignment;
}
if (textStyle != diffEvent.textStyle) {
diffObject.textStyle = diffEvent.textStyle;
}
return diffObject;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent
* #applyDiffObject
* (com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent)
*/
@Override
public void applyDiffObject(IRenderEvent diffEvent) {
DrawStringEvent diffObject = (DrawStringEvent) diffEvent;
alpha = diffObject.alpha;
boxColor = diffObject.boxColor;
xOrColors = diffObject.xOrColors;
if (diffObject.colors != null) {
colors = diffObject.colors;
}
fontId = diffObject.fontId;
if (diffObject.horizontalAlignment != null) {
horizontalAlignment = diffObject.horizontalAlignment;
}
if (diffObject.verticalAlignment != null) {
verticalAlignment = diffObject.verticalAlignment;
}
magnification = diffObject.magnification;
if (diffObject.point != null) {
point = diffObject.point;
}
rotation = diffObject.rotation;
if (diffObject.text != null) {
text = diffObject.text;
}
if (diffObject.textStyle != null) {
textStyle = diffObject.textStyle;
}
}
public void setDrawableString(DrawableString string) {
this.text = string.getText();
this.colors = string.getColors();
this.alpha = string.basics.alpha;
this.boxColor = string.boxColor;
this.xOrColors = string.basics.xOrColors;
this.horizontalAlignment = string.horizontalAlignment;
this.verticalAlignment = string.verticallAlignment;
this.textStyle = string.textStyle;
this.magnification = string.magnification;
this.point = new double[] { string.basics.x, string.basics.y,
string.basics.z };
this.rotation = string.rotation;
if (string.font instanceof DispatchingFont) {
fontId = ((DispatchingFont) string.font).getObjectId();
}
}
public DrawableString getDrawableString() {
DrawableString ds = new DrawableString(text, colors);
ds.basics.alpha = alpha;
ds.basics.xOrColors = xOrColors;
ds.boxColor = boxColor;
ds.horizontalAlignment = horizontalAlignment;
ds.verticallAlignment = verticalAlignment;
ds.textStyle = textStyle;
ds.magnification = magnification;
ds.setCoordinates(point[0], point[1], point[2]);
ds.rotation = rotation;
return ds;
}
/**
* @return the fontId
*/
public int getFontId() {
return fontId;
}
/**
* @param fontId
* the fontId to set
*/
public void setFontId(int fontId) {
this.fontId = fontId;
}
/**
* @return the text
*/
public String[] getText() {
return text;
}
/**
* @param text
* the text to set
*/
public void setText(String[] text) {
this.text = text;
}
/**
* @return the colors
*/
public RGB[] getColors() {
return colors;
}
/**
* @param colors
* the colors to set
*/
public void setColors(RGB[] colors) {
this.colors = colors;
}
/**
* @return the alpha
*/
public float getAlpha() {
return alpha;
}
/**
* @param alpha
* the alpha to set
*/
public void setAlpha(float alpha) {
this.alpha = alpha;
}
/**
* @return the horizontalAlignment
*/
public HorizontalAlignment getHorizontalAlignment() {
return horizontalAlignment;
}
/**
* @param horizontalAlignment
* the horizontalAlignment to set
*/
public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
this.horizontalAlignment = horizontalAlignment;
}
/**
* @return the verticalAlignment
*/
public VerticalAlignment getVerticalAlignment() {
return verticalAlignment;
}
/**
* @param verticalAlignment
* the verticalAlignment to set
*/
public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
this.verticalAlignment = verticalAlignment;
}
/**
* @return the textStyle
*/
public TextStyle getTextStyle() {
return textStyle;
}
/**
* @param textStyle
* the textStyle to set
*/
public void setTextStyle(TextStyle textStyle) {
this.textStyle = textStyle;
}
/**
* @return the boxColor
*/
public RGB getBoxColor() {
return boxColor;
}
/**
* @param boxColor
* the boxColor to set
*/
public void setBoxColor(RGB boxColor) {
this.boxColor = boxColor;
}
/**
* @return the magnification
*/
public double getMagnification() {
return magnification;
}
/**
* @param magnification
* the magnification to set
*/
public void setMagnification(double magnification) {
this.magnification = magnification;
}
/**
* @return the rotation
*/
public double getRotation() {
return rotation;
}
/**
* @param rotation
* the rotation to set
*/
public void setRotation(double rotation) {
this.rotation = rotation;
}
/**
* @return the point
*/
public double[] getPoint() {
return point;
}
/**
* @param point
* the point to set
*/
public void setPoint(double[] point) {
this.point = point;
}
/**
* @return the xOrColors
*/
public boolean isxOrColors() {
return xOrColors;
}
/**
* @param xOrColors
* the xOrColors to set
*/
public void setxOrColors(boolean xOrColors) {
this.xOrColors = xOrColors;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DrawStringEvent other = (DrawStringEvent) obj;
if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha))
return false;
if (boxColor == null) {
if (other.boxColor != null)
return false;
} else if (!boxColor.equals(other.boxColor))
return false;
if (!Arrays.equals(colors, other.colors))
return false;
if (fontId != other.fontId)
return false;
if (horizontalAlignment != other.horizontalAlignment)
return false;
if (Double.doubleToLongBits(magnification) != Double
.doubleToLongBits(other.magnification))
return false;
if (!Arrays.equals(point, other.point))
return false;
if (Double.doubleToLongBits(rotation) != Double
.doubleToLongBits(other.rotation))
return false;
if (!Arrays.equals(text, other.text))
return false;
if (textStyle != other.textStyle)
return false;
if (verticalAlignment != other.verticalAlignment)
return false;
if (xOrColors != other.xOrColors)
return false;
return true;
}
}

View file

@ -0,0 +1,141 @@
/**
* 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.remote.graphics.events.strings;
import java.util.Arrays;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsRenderEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
/**
* Event for drawing multiple strings in bulk
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 3, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class DrawStringsEvent extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerializeElement
private DrawStringEvent[] strings;
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent)
*/
@Override
public DrawStringsEvent createDiffObject(IRenderEvent event) {
DrawStringsEvent diff = (DrawStringsEvent) event;
DrawStringsEvent diffEvent = new DrawStringsEvent();
if (diff.strings != null) {
if (strings != null && diff.strings.length == strings.length) {
diffEvent.strings = new DrawStringEvent[diff.strings.length];
for (int i = 0; i < strings.length; ++i) {
DrawStringEvent paintEvent = strings[i];
DrawStringEvent diffPaintEvent = diff.strings[i];
if (paintEvent.equals(diffPaintEvent) == false) {
diffEvent.strings[i] = paintEvent
.createDiffObject(diffPaintEvent);
}
}
} else {
diffEvent.strings = diff.strings;
}
}
return diffEvent;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#applyDiffObject
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent)
*/
@Override
public void applyDiffObject(IRenderEvent diffEvent) {
DrawStringsEvent event = (DrawStringsEvent) diffEvent;
DrawStringEvent[] diffImageEvents = event.strings;
if (diffImageEvents == null) {
strings = null;
} else if (strings == null) {
strings = event.strings;
} else if (strings.length != diffImageEvents.length) {
strings = event.strings;
} else {
for (int i = 0; i < strings.length; ++i) {
DrawStringEvent diffPaintEvent = diffImageEvents[i];
if (diffPaintEvent != null) {
strings[i].applyDiffObject(diffPaintEvent);
}
}
}
}
/**
* @return the strings
*/
public DrawStringEvent[] getStrings() {
return strings;
}
/**
* @param strings
* the strings to set
*/
public void setStrings(DrawStringEvent[] strings) {
this.strings = strings;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DrawStringsEvent other = (DrawStringsEvent) obj;
if (!Arrays.equals(strings, other.strings))
return false;
return true;
}
}