Issue #239 Added circle drawing, fixed jumpiness issues

Change-Id: I3003fc4fd132dde2108ada5cb5ad1152bb8b4566

Former-commit-id: 80a7110f21 [formerly 4add8c7c8e] [formerly ab314d0333 [formerly fbf7ea43b20bff1c97dc38265d9dfae091e5dcb4]]
Former-commit-id: ab314d0333
Former-commit-id: f28f51f5a5
This commit is contained in:
Max Schenkelberg 2012-05-17 16:07:23 -05:00
parent 6723e813e6
commit a3df5975db
22 changed files with 1032 additions and 260 deletions

View file

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

View file

@ -19,10 +19,14 @@
**/ **/
package com.raytheon.uf.viz.collaboration.ui.rsc; package com.raytheon.uf.viz.collaboration.ui.rsc;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
@ -46,6 +50,7 @@ import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameN
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.UpdateRenderFrameEvent; import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.UpdateRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingDataManager; import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingDataManager;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler; import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -109,6 +114,26 @@ public class CollaborationResource extends
private Rectangle previousBounds = null; private Rectangle previousBounds = null;
private Map<IExtent, List<IRenderEvent>> renderableMap = new LinkedHashMap<IExtent, List<IRenderEvent>>() {
private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
*
* @see java.util.LinkedHashMap#removeEldestEntry(java.util.Map.Entry)
*/
@Override
protected boolean removeEldestEntry(
Entry<IExtent, List<IRenderEvent>> eldest) {
if (size() > 30) {
return true;
}
return false;
}
};
public CollaborationResource(CollaborationResourceData resourceData, public CollaborationResource(CollaborationResourceData resourceData,
LoadProperties loadProperties) { LoadProperties loadProperties) {
super(resourceData, loadProperties); super(resourceData, loadProperties);
@ -126,6 +151,19 @@ public class CollaborationResource extends
@Override @Override
protected void paintInternal(IGraphicsTarget target, protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException { PaintProperties paintProps) throws VizException {
// Get the renderables for my extent
List<IRenderEvent> currentRenderables = null;
synchronized (renderableMap) {
currentRenderables = renderableMap.get(paintProps.getView()
.getExtent());
if (currentRenderables == null) {
synchronized (this.currentRenderables) {
currentRenderables = new ArrayList<IRenderEvent>(
this.currentRenderables);
}
}
}
List<AbstractDispatchingObjectEvent> currentDataChangeEvents = new LinkedList<AbstractDispatchingObjectEvent>(); List<AbstractDispatchingObjectEvent> currentDataChangeEvents = new LinkedList<AbstractDispatchingObjectEvent>();
synchronized (dataChangeEvents) { synchronized (dataChangeEvents) {
if (waitingOnObjects.size() == 0) { if (waitingOnObjects.size() == 0) {
@ -143,17 +181,12 @@ public class CollaborationResource extends
dataManager.beginRender(target, paintProps); dataManager.beginRender(target, paintProps);
List<IRenderEvent> toRender = new LinkedList<IRenderEvent>();
synchronized (currentRenderables) {
toRender.addAll(currentRenderables);
}
synchronized (renderingRouter) { synchronized (renderingRouter) {
for (AbstractRemoteGraphicsEvent event : currentDataChangeEvents) { for (AbstractRemoteGraphicsEvent event : currentDataChangeEvents) {
renderingRouter.post(event); renderingRouter.post(event);
} }
for (IRenderEvent event : toRender) { for (IRenderEvent event : currentRenderables) {
renderingRouter.post(event); renderingRouter.post(event);
} }
if (latestMouseLocation != null) { if (latestMouseLocation != null) {
@ -262,7 +295,7 @@ public class CollaborationResource extends
// Not an update event, new frame // Not an update event, new frame
int objectId = event.getObjectId(); int objectId = event.getObjectId();
for (IRenderEvent re : event.getRenderEvents()) { for (IRenderEvent re : event.getRenderEvents()) {
renderableArrived((AbstractRemoteGraphicsEvent) re); renderableArrived((AbstractRemoteGraphicsEvent) re.clone());
} }
dataManager.putRenderableObject(objectId, event); dataManager.putRenderableObject(objectId, event);
} }
@ -313,6 +346,7 @@ public class CollaborationResource extends
activeRenderables.add((IRenderEvent) event); activeRenderables.add((IRenderEvent) event);
} else if (event instanceof EndFrameEvent) { } else if (event instanceof EndFrameEvent) {
synchronized (currentRenderables) { synchronized (currentRenderables) {
IExtent current = null;
currentRenderables.clear(); currentRenderables.clear();
// Frame over, process BeginFrameEvent now to keep in sync // Frame over, process BeginFrameEvent now to keep in sync
for (IRenderEvent renderable : activeRenderables) { for (IRenderEvent renderable : activeRenderables) {
@ -342,12 +376,15 @@ public class CollaborationResource extends
} else { } else {
display.getView().setExtent(bfe.getExtent()); display.getView().setExtent(bfe.getExtent());
} }
current = bfe.getExtent();
} else { } else {
// Add to list for processing in paintInternal // Add to list for processing in paintInternal
currentRenderables.add(renderable); currentRenderables.add(renderable);
} }
} }
activeRenderables.clear(); activeRenderables.clear();
renderableMap.put(current, new ArrayList<IRenderEvent>(
currentRenderables));
} }
issueRefresh(); issueRefresh();
} else if (event instanceof MouseLocationEvent) { } else if (event instanceof MouseLocationEvent) {

View file

@ -84,7 +84,7 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
public void renderImages(PaintImagesEvent event) { public void renderImages(PaintImagesEvent event) {
PaintProperties paintProps = getPaintProperties(); PaintProperties paintProps = getPaintProperties();
IGraphicsTarget target = getGraphicsTarget(); IGraphicsTarget target = getGraphicsTarget();
PaintImageEvent[] events = event.getImageEvents(); PaintImageEvent[] events = event.getObjects();
DrawableImage[] images = toDrawableImages(events, dataManager); DrawableImage[] images = toDrawableImages(events, dataManager);
if (images.length > 0) { if (images.length > 0) {
PaintProperties imageProps = new PaintProperties(paintProps); PaintProperties imageProps = new PaintProperties(paintProps);

View file

@ -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.uf.viz.collaboration.ui.rsc.rendering;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.remote.graphics.events.drawables.DrawCircleEvent;
import com.raytheon.uf.viz.remote.graphics.events.drawables.DrawCirclesEvent;
/**
* Rendering handler for primitive shapes (lines, rectangles, circles, etc)
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 17, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class PrimitiveRenderingHandler extends CollaborationRenderingHandler {
@Subscribe
public void drawCircles(DrawCirclesEvent event) {
DrawCircleEvent[] events = event.getObjects();
DrawableCircle[] circles = new DrawableCircle[events.length];
for (int i = 0; i < events.length; ++i) {
circles[i] = events[i].getDrawableCircle();
}
try {
getGraphicsTarget().drawCircle(circles);
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}

View file

@ -179,7 +179,7 @@ public class ShapeRenderingHandler extends CollaborationRenderingHandler {
@Subscribe @Subscribe
public void renderShadedShapes(DrawShadedShapesEvent event) { public void renderShadedShapes(DrawShadedShapesEvent event) {
DrawShadedShapeEvent[] shapeEvents = event.getShapes(); DrawShadedShapeEvent[] shapeEvents = event.getObjects();
float alpha = event.getAlpha(); float alpha = event.getAlpha();
float brightness = event.getBrightness(); float brightness = event.getBrightness();
IShadedShape[] shapes = new IShadedShape[shapeEvents.length]; IShadedShape[] shapes = new IShadedShape[shapeEvents.length];

View file

@ -57,7 +57,7 @@ public class StringRenderingHandler extends CollaborationRenderingHandler {
@Subscribe @Subscribe
public void drawStrings(DrawStringsEvent event) { public void drawStrings(DrawStringsEvent event) {
IGraphicsTarget target = getGraphicsTarget(); IGraphicsTarget target = getGraphicsTarget();
DrawStringEvent[] events = event.getStrings(); DrawStringEvent[] events = event.getObjects();
DrawableString[] strings = new DrawableString[events.length]; DrawableString[] strings = new DrawableString[events.length];
for (int i = 0; i < events.length; ++i) { for (int i = 0; i < events.length; ++i) {
strings[i] = events[i].getDrawableString(); strings[i] = events[i].getDrawableString();

View file

@ -22,6 +22,7 @@ Export-Package: com.raytheon.uf.viz.remote.graphics,
com.raytheon.uf.viz.remote.graphics.events, com.raytheon.uf.viz.remote.graphics.events,
com.raytheon.uf.viz.remote.graphics.events.clipping, com.raytheon.uf.viz.remote.graphics.events.clipping,
com.raytheon.uf.viz.remote.graphics.events.colormap, com.raytheon.uf.viz.remote.graphics.events.colormap,
com.raytheon.uf.viz.remote.graphics.events.drawables,
com.raytheon.uf.viz.remote.graphics.events.fonts, com.raytheon.uf.viz.remote.graphics.events.fonts,
com.raytheon.uf.viz.remote.graphics.events.imagery, com.raytheon.uf.viz.remote.graphics.events.imagery,
com.raytheon.uf.viz.remote.graphics.events.mesh, com.raytheon.uf.viz.remote.graphics.events.mesh,

View file

@ -75,6 +75,8 @@ import com.raytheon.uf.viz.remote.graphics.events.clipping.ClearClippingPane;
import com.raytheon.uf.viz.remote.graphics.events.clipping.SetupClippingPane; import com.raytheon.uf.viz.remote.graphics.events.clipping.SetupClippingPane;
import com.raytheon.uf.viz.remote.graphics.events.colormap.DispatchingColorMapManager; import com.raytheon.uf.viz.remote.graphics.events.colormap.DispatchingColorMapManager;
import com.raytheon.uf.viz.remote.graphics.events.colormap.DrawColorRampEvent; import com.raytheon.uf.viz.remote.graphics.events.colormap.DrawColorRampEvent;
import com.raytheon.uf.viz.remote.graphics.events.drawables.DrawCircleEvent;
import com.raytheon.uf.viz.remote.graphics.events.drawables.DrawCirclesEvent;
import com.raytheon.uf.viz.remote.graphics.events.imagery.CreateIImageEvent; 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.points.DrawPointsEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent;
@ -336,7 +338,7 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
strings[i].setDrawableString(param); strings[i].setDrawableString(param);
++i; ++i;
} }
event.setStrings(strings); event.setObjects(strings);
dispatch(event); dispatch(event);
} }
@ -420,7 +422,7 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
DrawShadedShapeEvent.class, (DispatchingShadedShape) shape); DrawShadedShapeEvent.class, (DispatchingShadedShape) shape);
actualShapes[i] = shape.getWrappedObject(); actualShapes[i] = shape.getWrappedObject();
} }
event.setShapes(shapeEvents); event.setObjects(shapeEvents);
dispatch(event); dispatch(event);
// Actual draw // Actual draw
@ -587,6 +589,16 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
*/ */
public void drawCircle(DrawableCircle... circles) throws VizException { public void drawCircle(DrawableCircle... circles) throws VizException {
wrappedObject.drawCircle(circles); wrappedObject.drawCircle(circles);
DrawCirclesEvent event = RemoteGraphicsEventFactory.createEvent(
DrawCirclesEvent.class, this);
DrawCircleEvent[] events = new DrawCircleEvent[circles.length];
for (int i = 0; i < circles.length; ++i) {
events[i] = RemoteGraphicsEventFactory.createEvent(
DrawCircleEvent.class, this);
events[i].setDrawableCircle(circles[i]);
}
event.setObjects(events);
dispatch(event);
} }
/** /**
@ -606,7 +618,7 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
* @param color * @param color
* @param width * @param width
* @param startAzimuth * @param startAzimuth
* @param arcWidth * @param endAzimuth
* @param lineStyle * @param lineStyle
* @param includeSides * @param includeSides
* @throws VizException * @throws VizException
@ -614,11 +626,24 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
* double, double, org.eclipse.swt.graphics.RGB, float, int, int, * double, double, org.eclipse.swt.graphics.RGB, float, int, int,
* com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle, boolean) * com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle, boolean)
*/ */
@Deprecated
public void drawArc(double x1, double y1, double z1, double radius, public void drawArc(double x1, double y1, double z1, double radius,
RGB color, float width, int startAzimuth, int arcWidth, RGB color, float width, int startAzimuth, int endAzimuth,
LineStyle lineStyle, boolean includeSides) throws VizException { LineStyle lineStyle, boolean includeSides) throws VizException {
wrappedObject.drawArc(x1, y1, z1, radius, color, width, startAzimuth, DrawableCircle dc = new DrawableCircle();
arcWidth, lineStyle, includeSides); dc.setCoordinates(x1, y1, z1);
dc.basics.color = color;
dc.lineStyle = lineStyle;
dc.startAzimuth = startAzimuth;
dc.endAzimuth = endAzimuth;
if (startAzimuth > endAzimuth) {
endAzimuth += 360;
}
dc.numberOfPoints = endAzimuth - startAzimuth;
dc.includeSides = includeSides;
dc.lineWidth = width;
dc.radius = radius;
drawCircle(dc);
} }
/** /**

View file

@ -0,0 +1,480 @@
/**
* 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.drawables;
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.DrawableCircle;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsRenderEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
/**
* Event for drawing a circle
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 17, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class DrawCircleEvent extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerializeElement
private double[] location;
@DynamicSerializeElement
private RGB color;
@DynamicSerializeElement
private Double screenRadius;
@DynamicSerializeElement
private Double radius;
@DynamicSerializeElement
private Boolean filled;
@DynamicSerializeElement
private Boolean includeSides;
@DynamicSerializeElement
private Integer numberOfPoints;
@DynamicSerializeElement
private Float startAzimuth;
@DynamicSerializeElement
private Float endAzimuth;
@DynamicSerializeElement
private Float lineWidth;
@DynamicSerializeElement
private LineStyle lineStyle;
@DynamicSerializeElement
private Float alpha;
@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 DrawCircleEvent createDiffObject(IRenderEvent event) {
DrawCircleEvent diffEvent = (DrawCircleEvent) event;
DrawCircleEvent diffObject = new DrawCircleEvent();
if (Arrays.equals(location, diffEvent.location) == false)
diffObject.location = diffEvent.location;
if (color.equals(diffEvent.color) == false)
diffObject.color = diffEvent.color;
if (alpha != diffEvent.alpha)
diffObject.alpha = diffEvent.alpha;
if (xorColors != diffEvent.xorColors)
diffObject.xorColors = diffEvent.xorColors;
if (filled != diffEvent.filled)
diffObject.filled = diffEvent.filled;
if (startAzimuth != diffEvent.startAzimuth)
diffObject.startAzimuth = diffEvent.startAzimuth;
if (endAzimuth != diffEvent.endAzimuth)
diffObject.endAzimuth = diffEvent.endAzimuth;
if (numberOfPoints != diffEvent.numberOfPoints)
diffObject.numberOfPoints = diffEvent.numberOfPoints;
if (radius != diffEvent.radius)
diffObject.radius = diffEvent.radius;
if (screenRadius != diffEvent.screenRadius)
diffObject.screenRadius = diffEvent.screenRadius;
if (lineStyle != diffEvent.lineStyle)
diffObject.lineStyle = diffEvent.lineStyle;
if (lineWidth != diffEvent.lineWidth)
diffObject.lineWidth = diffEvent.lineWidth;
if (includeSides != diffEvent.includeSides)
diffObject.includeSides = diffEvent.includeSides;
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) {
DrawCircleEvent o = (DrawCircleEvent) diffEvent;
if (o.location != null)
location = o.location;
if (o.color != null)
color = o.color;
if (o.alpha != null)
alpha = o.alpha;
if (o.xorColors != null)
xorColors = o.xorColors;
if (o.filled != null)
filled = o.filled;
if (o.startAzimuth != null)
startAzimuth = o.startAzimuth;
if (o.endAzimuth != null)
endAzimuth = o.endAzimuth;
if (o.numberOfPoints != null)
numberOfPoints = o.numberOfPoints;
if (o.lineStyle != null)
lineStyle = o.lineStyle;
if (o.lineWidth != null)
lineWidth = o.lineWidth;
if (o.includeSides != null) {
includeSides = o.includeSides;
}
if (o.radius != null) {
radius = o.radius;
screenRadius = null;
} else if (o.screenRadius != null) {
screenRadius = o.screenRadius;
radius = null;
}
}
public void setDrawableCircle(DrawableCircle circle) {
this.location = new double[] { circle.basics.x, circle.basics.y,
circle.basics.z };
this.color = circle.basics.color;
this.alpha = circle.basics.alpha;
this.xorColors = circle.basics.xOrColors;
this.filled = circle.filled;
this.startAzimuth = circle.startAzimuth;
this.endAzimuth = circle.endAzimuth;
this.numberOfPoints = circle.numberOfPoints;
this.radius = circle.radius;
this.screenRadius = circle.screenRadius;
this.lineStyle = circle.lineStyle;
this.lineWidth = circle.lineWidth;
this.includeSides = circle.includeSides;
}
public DrawableCircle getDrawableCircle() {
DrawableCircle circle = new DrawableCircle();
circle.setCoordinates(location[0], location[1], location[2]);
circle.basics.color = color;
circle.basics.alpha = alpha;
circle.basics.xOrColors = xorColors;
circle.filled = filled;
circle.startAzimuth = startAzimuth;
circle.endAzimuth = endAzimuth;
circle.numberOfPoints = numberOfPoints;
circle.radius = radius;
circle.screenRadius = screenRadius;
circle.lineStyle = lineStyle;
circle.lineWidth = lineWidth;
circle.includeSides = includeSides;
return circle;
}
/**
* @return the location
*/
public double[] getLocation() {
return location;
}
/**
* @param location
* the location to set
*/
public void setLocation(double[] location) {
this.location = location;
}
/**
* @return the color
*/
public RGB getColor() {
return color;
}
/**
* @param color
* the color to set
*/
public void setColor(RGB color) {
this.color = color;
}
/**
* @return the screenRadius
*/
public Double getScreenRadius() {
return screenRadius;
}
/**
* @param screenRadius
* the screenRadius to set
*/
public void setScreenRadius(Double screenRadius) {
this.screenRadius = screenRadius;
}
/**
* @return the radius
*/
public Double getRadius() {
return radius;
}
/**
* @param radius
* the radius to set
*/
public void setRadius(Double radius) {
this.radius = radius;
}
/**
* @return the filled
*/
public Boolean getFilled() {
return filled;
}
/**
* @param filled
* the filled to set
*/
public void setFilled(Boolean filled) {
this.filled = filled;
}
/**
* @return the includeSides
*/
public Boolean getIncludeSides() {
return includeSides;
}
/**
* @param includeSides
* the includeSides to set
*/
public void setIncludeSides(Boolean includeSides) {
this.includeSides = includeSides;
}
/**
* @return the numberOfPoints
*/
public Integer getNumberOfPoints() {
return numberOfPoints;
}
/**
* @param numberOfPoints
* the numberOfPoints to set
*/
public void setNumberOfPoints(Integer numberOfPoints) {
this.numberOfPoints = numberOfPoints;
}
/**
* @return the startAzimuth
*/
public Float getStartAzimuth() {
return startAzimuth;
}
/**
* @param startAzimuth
* the startAzimuth to set
*/
public void setStartAzimuth(Float startAzimuth) {
this.startAzimuth = startAzimuth;
}
/**
* @return the endAzimuth
*/
public Float getEndAzimuth() {
return endAzimuth;
}
/**
* @param endAzimuth
* the endAzimuth to set
*/
public void setEndAzimuth(Float endAzimuth) {
this.endAzimuth = endAzimuth;
}
/**
* @return the lineWidth
*/
public Float getLineWidth() {
return lineWidth;
}
/**
* @param lineWidth
* the lineWidth to set
*/
public void setLineWidth(Float lineWidth) {
this.lineWidth = lineWidth;
}
/**
* @return the lineStyle
*/
public LineStyle getLineStyle() {
return lineStyle;
}
/**
* @param lineStyle
* the lineStyle to set
*/
public void setLineStyle(LineStyle lineStyle) {
this.lineStyle = lineStyle;
}
/**
* @return the alpha
*/
public Float getAlpha() {
return alpha;
}
/**
* @param alpha
* the alpha to set
*/
public void setAlpha(Float alpha) {
this.alpha = alpha;
}
/**
* @return the xorColors
*/
public Boolean getXorColors() {
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;
DrawCircleEvent other = (DrawCircleEvent) obj;
if (alpha == null) {
if (other.alpha != null)
return false;
} else if (!alpha.equals(other.alpha))
return false;
if (color == null) {
if (other.color != null)
return false;
} else if (!color.equals(other.color))
return false;
if (endAzimuth == null) {
if (other.endAzimuth != null)
return false;
} else if (!endAzimuth.equals(other.endAzimuth))
return false;
if (filled == null) {
if (other.filled != null)
return false;
} else if (!filled.equals(other.filled))
return false;
if (includeSides == null) {
if (other.includeSides != null)
return false;
} else if (!includeSides.equals(other.includeSides))
return false;
if (lineStyle != other.lineStyle)
return false;
if (lineWidth == null) {
if (other.lineWidth != null)
return false;
} else if (!lineWidth.equals(other.lineWidth))
return false;
if (!Arrays.equals(location, other.location))
return false;
if (numberOfPoints == null) {
if (other.numberOfPoints != null)
return false;
} else if (!numberOfPoints.equals(other.numberOfPoints))
return false;
if (radius == null) {
if (other.radius != null)
return false;
} else if (!radius.equals(other.radius))
return false;
if (screenRadius == null) {
if (other.screenRadius != null)
return false;
} else if (!screenRadius.equals(other.screenRadius))
return false;
if (startAzimuth == null) {
if (other.startAzimuth != null)
return false;
} else if (!startAzimuth.equals(other.startAzimuth))
return false;
if (xorColors == null) {
if (other.xorColors != null)
return false;
} else if (!xorColors.equals(other.xorColors))
return false;
return true;
}
}

View file

@ -0,0 +1,56 @@
/**
* 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.drawables;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsBulkRenderEvent;
/**
* Event for drawing a series of circles
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 17, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class DrawCirclesEvent extends
AbstractRemoteGraphicsBulkRenderEvent<DrawCircleEvent> {
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsBulkRenderEvent#getObjectClass()
*/
@Override
protected Class<DrawCircleEvent> getObjectClass() {
return DrawCircleEvent.class;
}
}

View file

@ -242,4 +242,16 @@ public class PaintImageEvent extends AbstractDispatchingObjectEvent implements
return true; return true;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
PaintImageEvent newInstance = new PaintImageEvent();
newInstance.applyDiffObject(this);
return newInstance;
}
} }

View file

@ -19,8 +19,6 @@
**/ **/
package com.raytheon.uf.viz.remote.graphics.events.imagery; package com.raytheon.uf.viz.remote.graphics.events.imagery;
import java.util.Arrays;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.DrawableImage;
@ -28,7 +26,7 @@ import com.raytheon.uf.viz.core.IMesh;
import com.raytheon.uf.viz.core.PixelCoverage; import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsRenderEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsBulkRenderEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
import com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage; import com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage;
import com.raytheon.uf.viz.remote.graphics.objects.DispatchingMesh; import com.raytheon.uf.viz.remote.graphics.objects.DispatchingMesh;
@ -50,86 +48,40 @@ import com.raytheon.uf.viz.remote.graphics.objects.DispatchingMesh;
* @version 1.0 * @version 1.0
*/ */
@DynamicSerialize @DynamicSerialize
public class PaintImagesEvent extends AbstractRemoteGraphicsRenderEvent { public class PaintImagesEvent extends
AbstractRemoteGraphicsBulkRenderEvent<PaintImageEvent> {
@DynamicSerializeElement @DynamicSerializeElement
private float alpha; private float alpha;
@DynamicSerializeElement
private PaintImageEvent[] imageEvents;
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject * AbstractRemoteGraphicsBulkRenderEvent
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) * #createDiffObject(com.raytheon.uf.viz
* .remote.graphics.events.rendering.IRenderEvent)
*/ */
@Override @Override
public PaintImagesEvent createDiffObject(IRenderEvent event) { public PaintImagesEvent createDiffObject(IRenderEvent event) {
PaintImagesEvent diff = (PaintImagesEvent) event; PaintImagesEvent diffObject = (PaintImagesEvent) super
PaintImagesEvent diffEvent = new PaintImagesEvent(); .createDiffObject(event);
diffEvent.alpha = diff.alpha; diffObject.alpha = ((PaintImagesEvent) event).alpha;
if (diff.imageEvents != null) { return diffObject;
if (imageEvents != null
&& diff.imageEvents.length == imageEvents.length) {
diffEvent.imageEvents = new PaintImageEvent[diff.imageEvents.length];
for (int i = 0; i < imageEvents.length; ++i) {
PaintImageEvent paintEvent = imageEvents[i];
PaintImageEvent diffPaintEvent = diff.imageEvents[i];
if (paintEvent.equals(diffPaintEvent) == false) {
diffEvent.imageEvents[i] = paintEvent
.createDiffObject(diffPaintEvent);
}
}
} else {
diffEvent.imageEvents = diff.imageEvents;
}
}
return diffEvent;
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#applyDiffObject * AbstractRemoteGraphicsBulkRenderEvent
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) * #applyDiffObject(com.raytheon.uf.viz.
* remote.graphics.events.rendering.IRenderEvent)
*/ */
@Override @Override
public void applyDiffObject(IRenderEvent diffEvent) { public void applyDiffObject(IRenderEvent diffEvent) {
PaintImagesEvent event = (PaintImagesEvent) diffEvent; super.applyDiffObject(diffEvent);
PaintImageEvent[] diffImageEvents = event.imageEvents; this.alpha = ((PaintImagesEvent) diffEvent).alpha;
alpha = event.alpha;
if (diffImageEvents == null) {
imageEvents = null;
} else if (imageEvents == null) {
imageEvents = event.imageEvents;
} else if (imageEvents.length != diffImageEvents.length) {
imageEvents = event.imageEvents;
} else {
for (int i = 0; i < imageEvents.length; ++i) {
PaintImageEvent diffPaintEvent = diffImageEvents[i];
if (diffPaintEvent != null) {
imageEvents[i].applyDiffObject(diffPaintEvent);
}
}
}
}
/**
* @return the imageEvents
*/
public PaintImageEvent[] getImageEvents() {
return imageEvents;
}
/**
* @param imageEvents
* the imageEvents to set
*/
public void setImageEvents(PaintImageEvent[] imageEvents) {
this.imageEvents = imageEvents;
} }
/** /**
@ -213,6 +165,17 @@ public class PaintImagesEvent extends AbstractRemoteGraphicsRenderEvent {
return targeted; return targeted;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsBulkRenderEvent#getObjectClass()
*/
@Override
protected Class<PaintImageEvent> getObjectClass() {
return PaintImageEvent.class;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -222,16 +185,27 @@ public class PaintImagesEvent extends AbstractRemoteGraphicsRenderEvent {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
return true; return true;
if (obj == null) if (!super.equals(obj))
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
PaintImagesEvent other = (PaintImagesEvent) obj; PaintImagesEvent other = (PaintImagesEvent) obj;
if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha)) if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha))
return false; return false;
if (!Arrays.equals(imageEvents, other.imageEvents))
return false;
return true; return true;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsBulkRenderEvent#clone()
*/
@Override
public Object clone() {
PaintImagesEvent event = (PaintImagesEvent) super.clone();
event.alpha = alpha;
return event;
}
} }

View file

@ -112,4 +112,16 @@ public class RenderOffscreenEvent extends AbstractDispatchingObjectEvent
return true; return true;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
RenderOffscreenEvent newInstance = new RenderOffscreenEvent();
newInstance.applyDiffObject(this);
return newInstance;
}
} }

View file

@ -0,0 +1,175 @@
/**
* 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;
import java.lang.reflect.Array;
import java.util.Arrays;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Abstract class for bulk rendering other objects
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 17, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@SuppressWarnings("unchecked")
@DynamicSerialize
public abstract class AbstractRemoteGraphicsBulkRenderEvent<T extends IRenderEvent>
extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerializeElement
private T[] objects;
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent)
*/
@Override
public AbstractRemoteGraphicsBulkRenderEvent<T> createDiffObject(
IRenderEvent event) {
AbstractRemoteGraphicsBulkRenderEvent<T> diff = (AbstractRemoteGraphicsBulkRenderEvent<T>) event;
try {
AbstractRemoteGraphicsBulkRenderEvent<T> diffEvent = (AbstractRemoteGraphicsBulkRenderEvent<T>) event
.getClass().newInstance();
if (diff.objects != null) {
if (objects != null && diff.objects.length == objects.length) {
diffEvent.objects = (T[]) Array.newInstance(
diff.getObjectClass(), diff.objects.length);
for (int i = 0; i < objects.length; ++i) {
T paintEvent = objects[i];
T diffPaintEvent = diff.objects[i];
if (paintEvent.equals(diffPaintEvent) == false) {
diffEvent.objects[i] = (T) paintEvent
.createDiffObject(diffPaintEvent);
}
}
} else {
diffEvent.objects = diff.objects;
}
}
return diffEvent;
} catch (Exception e) {
throw new RuntimeException("Error creating diff object", e);
}
}
/*
* (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) {
AbstractRemoteGraphicsBulkRenderEvent<T> event = (AbstractRemoteGraphicsBulkRenderEvent<T>) diffEvent;
T[] diffImageEvents = event.objects;
if (diffImageEvents == null) {
objects = null;
} else if (objects == null) {
objects = event.objects;
} else if (objects.length != diffImageEvents.length) {
objects = event.objects;
} else {
for (int i = 0; i < objects.length; ++i) {
T diffPaintEvent = diffImageEvents[i];
if (diffPaintEvent != null) {
objects[i].applyDiffObject(diffPaintEvent);
}
}
}
}
/**
* @return the objects
*/
public T[] getObjects() {
return objects;
}
/**
* @param objects
* the objects to set
*/
public void setObjects(T[] objects) {
this.objects = objects;
}
protected abstract Class<T> getObjectClass();
/*
* (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;
AbstractRemoteGraphicsBulkRenderEvent<T> other = (AbstractRemoteGraphicsBulkRenderEvent<T>) obj;
if (!Arrays.equals(objects, other.objects))
return false;
return true;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
try {
AbstractRemoteGraphicsBulkRenderEvent<T> newObject = getClass()
.newInstance();
if (objects != null) {
newObject.objects = (T[]) Array.newInstance(getObjectClass(),
objects.length);
for (int i = 0; i < objects.length; ++i) {
newObject.objects[i] = (T) objects[i].clone();
}
}
return newObject;
} catch (Exception e) {
throw new RuntimeException("Could not clone "
+ getClass().getSimpleName() + " object");
}
}
}

View file

@ -53,6 +53,23 @@ public abstract class AbstractRemoteGraphicsRenderEvent extends
return event; return event;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
try {
AbstractRemoteGraphicsRenderEvent newInstance = getClass()
.newInstance();
newInstance.applyDiffObject(this);
return newInstance;
} catch (Exception e) {
throw new RuntimeException("Error cloning render event", e);
}
}
@Override @Override
public abstract boolean equals(Object obj); public abstract boolean equals(Object obj);

View file

@ -43,6 +43,8 @@ public interface IRenderEvent {
@Override @Override
public abstract boolean equals(Object obj); public abstract boolean equals(Object obj);
public abstract Object clone();
public abstract IRenderEvent createDiffObject(IRenderEvent event); public abstract IRenderEvent createDiffObject(IRenderEvent event);
public abstract void applyDiffObject(IRenderEvent diffEvent); public abstract void applyDiffObject(IRenderEvent diffEvent);

View file

@ -67,4 +67,15 @@ public class DrawShadedShapeEvent extends AbstractDispatchingObjectEvent
setObjectId(((DrawShadedShapeEvent) diffEvent).getObjectId()); setObjectId(((DrawShadedShapeEvent) diffEvent).getObjectId());
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
DrawShadedShapeEvent newInstance = new DrawShadedShapeEvent();
newInstance.applyDiffObject(this);
return newInstance;
}
} }

View file

@ -19,11 +19,9 @@
**/ **/
package com.raytheon.uf.viz.remote.graphics.events.shapes; package com.raytheon.uf.viz.remote.graphics.events.shapes;
import java.util.Arrays;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; 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.AbstractRemoteGraphicsBulkRenderEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
/** /**
@ -43,7 +41,8 @@ import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
* @version 1.0 * @version 1.0
*/ */
@DynamicSerialize @DynamicSerialize
public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent { public class DrawShadedShapesEvent extends
AbstractRemoteGraphicsBulkRenderEvent<DrawShadedShapeEvent> {
@DynamicSerializeElement @DynamicSerializeElement
private float alpha; private float alpha;
@ -51,67 +50,38 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerializeElement @DynamicSerializeElement
private float brightness; private float brightness;
@DynamicSerializeElement
private DrawShadedShapeEvent[] shapes;
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject * AbstractRemoteGraphicsBulkRenderEvent
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) * #createDiffObject(com.raytheon.uf.viz
* .remote.graphics.events.rendering.IRenderEvent)
*/ */
@Override @Override
public DrawShadedShapesEvent createDiffObject(IRenderEvent event) { public DrawShadedShapesEvent createDiffObject(IRenderEvent event) {
DrawShadedShapesEvent diff = (DrawShadedShapesEvent) event; DrawShadedShapesEvent diffEvent = (DrawShadedShapesEvent) event;
DrawShadedShapesEvent diffEvent = new DrawShadedShapesEvent(); DrawShadedShapesEvent diffObject = (DrawShadedShapesEvent) super
if (diff.shapes != null) { .createDiffObject(diffEvent);
if (shapes != null && diff.shapes.length == shapes.length) { diffObject.alpha = diffEvent.alpha;
diffEvent.shapes = new DrawShadedShapeEvent[diff.shapes.length]; diffObject.brightness = diffEvent.brightness;
for (int i = 0; i < shapes.length; ++i) { return diffObject;
DrawShadedShapeEvent paintEvent = shapes[i];
DrawShadedShapeEvent diffPaintEvent = diff.shapes[i];
if (paintEvent.equals(diffPaintEvent) == false) {
diffEvent.shapes[i] = paintEvent
.createDiffObject(diffPaintEvent);
}
}
} else {
diffEvent.shapes = diff.shapes;
}
}
diffEvent.alpha = diff.alpha;
diffEvent.brightness = diff.brightness;
return diffEvent;
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#applyDiffObject * AbstractRemoteGraphicsBulkRenderEvent
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) * #applyDiffObject(com.raytheon.uf.viz.
* remote.graphics.events.rendering.IRenderEvent)
*/ */
@Override @Override
public void applyDiffObject(IRenderEvent diffEvent) { public void applyDiffObject(IRenderEvent diffEvent) {
DrawShadedShapesEvent event = (DrawShadedShapesEvent) diffEvent; super.applyDiffObject(diffEvent);
DrawShadedShapeEvent[] diffImageEvents = event.shapes; DrawShadedShapesEvent diffObject = (DrawShadedShapesEvent) diffEvent;
if (diffImageEvents == null) { this.alpha = diffObject.alpha;
shapes = null; this.brightness = diffObject.brightness;
} else if (shapes == null) {
shapes = event.shapes;
} else if (shapes.length != diffImageEvents.length) {
shapes = event.shapes;
} else {
for (int i = 0; i < shapes.length; ++i) {
DrawShadedShapeEvent diffPaintEvent = diffImageEvents[i];
if (diffPaintEvent != null) {
shapes[i].applyDiffObject(diffPaintEvent);
}
}
}
alpha = event.alpha;
brightness = event.brightness;
} }
/** /**
@ -144,19 +114,15 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent {
this.brightness = brightness; this.brightness = brightness;
} }
/** /*
* @return the shapes * (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsBulkRenderEvent#getObjectClass()
*/ */
public DrawShadedShapeEvent[] getShapes() { @Override
return shapes; protected Class<DrawShadedShapeEvent> getObjectClass() {
} return DrawShadedShapeEvent.class;
/**
* @param shapes
* the shapes to set
*/
public void setShapes(DrawShadedShapeEvent[] shapes) {
this.shapes = shapes;
} }
/* /*
@ -168,7 +134,7 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
return true; return true;
if (obj == null) if (!super.equals(obj))
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
@ -178,9 +144,21 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent {
if (Float.floatToIntBits(brightness) != Float if (Float.floatToIntBits(brightness) != Float
.floatToIntBits(other.brightness)) .floatToIntBits(other.brightness))
return false; return false;
if (!Arrays.equals(shapes, other.shapes))
return false;
return true; return true;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsBulkRenderEvent#clone()
*/
@Override
public Object clone() {
DrawShadedShapesEvent event = (DrawShadedShapesEvent) super.clone();
event.alpha = alpha;
event.brightness = brightness;
return event;
}
} }

View file

@ -204,4 +204,16 @@ public class RenderWireframeShapeEvent extends AbstractDispatchingObjectEvent
return true; return true;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
RenderWireframeShapeEvent newInstance = new RenderWireframeShapeEvent();
newInstance.applyDiffObject(this);
return newInstance;
}
} }

View file

@ -19,12 +19,8 @@
**/ **/
package com.raytheon.uf.viz.remote.graphics.events.strings; 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.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsBulkRenderEvent;
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 * Event for drawing multiple strings in bulk
@ -43,99 +39,18 @@ import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
* @version 1.0 * @version 1.0
*/ */
@DynamicSerialize @DynamicSerialize
public class DrawStringsEvent extends AbstractRemoteGraphicsRenderEvent { public class DrawStringsEvent extends
AbstractRemoteGraphicsBulkRenderEvent<DrawStringEvent> {
@DynamicSerializeElement
private DrawStringEvent[] strings;
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject * AbstractRemoteGraphicsBulkRenderEvent#getObjectClass()
* (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent)
*/ */
@Override @Override
public DrawStringsEvent createDiffObject(IRenderEvent event) { protected Class<DrawStringEvent> getObjectClass() {
DrawStringsEvent diff = (DrawStringsEvent) event; return DrawStringEvent.class;
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;
} }
} }

View file

@ -72,7 +72,7 @@ public abstract class AbstractDispatchingImageExtension extends
DrawableImage... images) throws VizException { DrawableImage... images) throws VizException {
PaintImagesEvent bulkRender = RemoteGraphicsEventFactory.createEvent( PaintImagesEvent bulkRender = RemoteGraphicsEventFactory.createEvent(
PaintImagesEvent.class, target); PaintImagesEvent.class, target);
bulkRender.setImageEvents(PaintImagesEvent.toPaintEvents(images)); bulkRender.setObjects(PaintImagesEvent.toPaintEvents(images));
DrawableImage[] targeted = PaintImagesEvent.extractTargetImages(images); DrawableImage[] targeted = PaintImagesEvent.extractTargetImages(images);
bulkRender.setAlpha(paintProps.getAlpha()); bulkRender.setAlpha(paintProps.getAlpha());
boolean rval = target.getWrappedObject().drawRasters(paintProps, boolean rval = target.getWrappedObject().drawRasters(paintProps,

View file

@ -598,23 +598,21 @@ public class GLTarget implements IGLTarget {
public void drawArc(double x1, double y1, double z1, double radius, public void drawArc(double x1, double y1, double z1, double radius,
RGB color, float width, int startAzimuth, int endAzimuth, RGB color, float width, int startAzimuth, int endAzimuth,
LineStyle lineStyle, boolean includeSides) throws VizException { LineStyle lineStyle, boolean includeSides) throws VizException {
this.pushGLState(); DrawableCircle dc = new DrawableCircle();
try { dc.setCoordinates(x1, y1, z1);
gl.glPolygonMode(GL.GL_BACK, GL.GL_LINE); dc.basics.color = color;
handleLineStyle(lineStyle); dc.lineStyle = lineStyle;
gl.glColor4d(color.red / 255.0, color.green / 255.0, dc.startAzimuth = startAzimuth;
color.blue / 255.0, 1.0); dc.endAzimuth = endAzimuth;
gl.glLineWidth(width); if (startAzimuth > endAzimuth) {
gl.glBegin(GL.GL_LINE_STRIP); dc.numberOfPoints = (endAzimuth + 360) - startAzimuth;
} else {
for (double i = startAzimuth; i <= endAzimuth; i++) { dc.numberOfPoints = endAzimuth - startAzimuth;
double[] pointOnCircle = getPointOnCircle(x1, y1, z1, radius, i);
gl.glVertex2d(pointOnCircle[0], pointOnCircle[1]);
}
gl.glEnd();
} finally {
this.popGLState();
} }
dc.includeSides = includeSides;
dc.lineWidth = width;
dc.radius = radius;
drawCircle(dc);
} }
/* /*
@ -2184,7 +2182,7 @@ public class GLTarget implements IGLTarget {
*/ */
@Override @Override
public void setView(IView view) { public void setView(IView view) {
this.targetView = view; this.targetView = (IView) view.clone();
this.targetView.setupView(this); this.targetView.setupView(this);
} }