diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/plugin.xml b/cave/com.raytheon.uf.viz.collaboration.ui/plugin.xml index 1267742a83..2d367fc561 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/plugin.xml +++ b/cave/com.raytheon.uf.viz.collaboration.ui/plugin.xml @@ -165,6 +165,9 @@ + + diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java index 59c548fb06..e937666ab3 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java @@ -19,10 +19,14 @@ **/ package com.raytheon.uf.viz.collaboration.ui.rsc; +import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import java.util.Set; 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.rsc.rendering.CollaborationRenderingDataManager; 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.VizApp; import com.raytheon.uf.viz.core.drawables.IDescriptor; @@ -109,6 +114,26 @@ public class CollaborationResource extends private Rectangle previousBounds = null; + private Map> renderableMap = new LinkedHashMap>() { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see java.util.LinkedHashMap#removeEldestEntry(java.util.Map.Entry) + */ + @Override + protected boolean removeEldestEntry( + Entry> eldest) { + if (size() > 30) { + return true; + } + return false; + } + + }; + public CollaborationResource(CollaborationResourceData resourceData, LoadProperties loadProperties) { super(resourceData, loadProperties); @@ -126,6 +151,19 @@ public class CollaborationResource extends @Override protected void paintInternal(IGraphicsTarget target, PaintProperties paintProps) throws VizException { + // Get the renderables for my extent + List currentRenderables = null; + synchronized (renderableMap) { + currentRenderables = renderableMap.get(paintProps.getView() + .getExtent()); + if (currentRenderables == null) { + synchronized (this.currentRenderables) { + currentRenderables = new ArrayList( + this.currentRenderables); + } + } + } + List currentDataChangeEvents = new LinkedList(); synchronized (dataChangeEvents) { if (waitingOnObjects.size() == 0) { @@ -143,17 +181,12 @@ public class CollaborationResource extends dataManager.beginRender(target, paintProps); - List toRender = new LinkedList(); - synchronized (currentRenderables) { - toRender.addAll(currentRenderables); - } - synchronized (renderingRouter) { for (AbstractRemoteGraphicsEvent event : currentDataChangeEvents) { renderingRouter.post(event); } - for (IRenderEvent event : toRender) { + for (IRenderEvent event : currentRenderables) { renderingRouter.post(event); } if (latestMouseLocation != null) { @@ -262,7 +295,7 @@ public class CollaborationResource extends // Not an update event, new frame int objectId = event.getObjectId(); for (IRenderEvent re : event.getRenderEvents()) { - renderableArrived((AbstractRemoteGraphicsEvent) re); + renderableArrived((AbstractRemoteGraphicsEvent) re.clone()); } dataManager.putRenderableObject(objectId, event); } @@ -313,6 +346,7 @@ public class CollaborationResource extends activeRenderables.add((IRenderEvent) event); } else if (event instanceof EndFrameEvent) { synchronized (currentRenderables) { + IExtent current = null; currentRenderables.clear(); // Frame over, process BeginFrameEvent now to keep in sync for (IRenderEvent renderable : activeRenderables) { @@ -342,12 +376,15 @@ public class CollaborationResource extends } else { display.getView().setExtent(bfe.getExtent()); } + current = bfe.getExtent(); } else { // Add to list for processing in paintInternal currentRenderables.add(renderable); } } activeRenderables.clear(); + renderableMap.put(current, new ArrayList( + currentRenderables)); } issueRefresh(); } else if (event instanceof MouseLocationEvent) { diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java index b2820b7c22..56c3621e55 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java @@ -84,7 +84,7 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler { public void renderImages(PaintImagesEvent event) { PaintProperties paintProps = getPaintProperties(); IGraphicsTarget target = getGraphicsTarget(); - PaintImageEvent[] events = event.getImageEvents(); + PaintImageEvent[] events = event.getObjects(); DrawableImage[] images = toDrawableImages(events, dataManager); if (images.length > 0) { PaintProperties imageProps = new PaintProperties(paintProps); diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/PrimitiveRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/PrimitiveRenderingHandler.java new file mode 100644 index 0000000000..4dcabb6b9a --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/PrimitiveRenderingHandler.java @@ -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) + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 17, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @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); + } + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ShapeRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ShapeRenderingHandler.java index 88aba11d44..7776d42b6a 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ShapeRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ShapeRenderingHandler.java @@ -179,7 +179,7 @@ public class ShapeRenderingHandler extends CollaborationRenderingHandler { @Subscribe public void renderShadedShapes(DrawShadedShapesEvent event) { - DrawShadedShapeEvent[] shapeEvents = event.getShapes(); + DrawShadedShapeEvent[] shapeEvents = event.getObjects(); float alpha = event.getAlpha(); float brightness = event.getBrightness(); IShadedShape[] shapes = new IShadedShape[shapeEvents.length]; diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/StringRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/StringRenderingHandler.java index 60de76ded1..875a7d4557 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/StringRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/StringRenderingHandler.java @@ -57,7 +57,7 @@ public class StringRenderingHandler extends CollaborationRenderingHandler { @Subscribe public void drawStrings(DrawStringsEvent event) { IGraphicsTarget target = getGraphicsTarget(); - DrawStringEvent[] events = event.getStrings(); + DrawStringEvent[] events = event.getObjects(); DrawableString[] strings = new DrawableString[events.length]; for (int i = 0; i < events.length; ++i) { strings[i] = events[i].getDrawableString(); diff --git a/cave/com.raytheon.uf.viz.remote.graphics/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.remote.graphics/META-INF/MANIFEST.MF index 40eef714e0..fecf91bd80 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.remote.graphics/META-INF/MANIFEST.MF @@ -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.clipping, 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.imagery, com.raytheon.uf.viz.remote.graphics.events.mesh, diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java index 50495de29b..7e8f3aa34c 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java @@ -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.colormap.DispatchingColorMapManager; 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.points.DrawPointsEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent; @@ -336,7 +338,7 @@ public class DispatchGraphicsTarget extends DispatchingObject strings[i].setDrawableString(param); ++i; } - event.setStrings(strings); + event.setObjects(strings); dispatch(event); } @@ -420,7 +422,7 @@ public class DispatchGraphicsTarget extends DispatchingObject DrawShadedShapeEvent.class, (DispatchingShadedShape) shape); actualShapes[i] = shape.getWrappedObject(); } - event.setShapes(shapeEvents); + event.setObjects(shapeEvents); dispatch(event); // Actual draw @@ -587,6 +589,16 @@ public class DispatchGraphicsTarget extends DispatchingObject */ public void drawCircle(DrawableCircle... circles) throws VizException { 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 * @param color * @param width * @param startAzimuth - * @param arcWidth + * @param endAzimuth * @param lineStyle * @param includeSides * @throws VizException @@ -614,11 +626,24 @@ public class DispatchGraphicsTarget extends DispatchingObject * double, double, org.eclipse.swt.graphics.RGB, float, int, int, * com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle, boolean) */ + @Deprecated 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 { - wrappedObject.drawArc(x1, y1, z1, radius, color, width, startAzimuth, - arcWidth, lineStyle, includeSides); + DrawableCircle dc = new DrawableCircle(); + 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); } /** diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/drawables/DrawCircleEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/drawables/DrawCircleEvent.java new file mode 100644 index 0000000000..15cac08d4c --- /dev/null +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/drawables/DrawCircleEvent.java @@ -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 + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 17, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @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; + } + +} diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/drawables/DrawCirclesEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/drawables/DrawCirclesEvent.java new file mode 100644 index 0000000000..3c23e8d8b7 --- /dev/null +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/drawables/DrawCirclesEvent.java @@ -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 + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 17, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@DynamicSerialize +public class DrawCirclesEvent extends + AbstractRemoteGraphicsBulkRenderEvent { + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent#getObjectClass() + */ + @Override + protected Class getObjectClass() { + return DrawCircleEvent.class; + } + +} diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java index 67aef8cfa5..d0f6a77b50 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImageEvent.java @@ -242,4 +242,16 @@ public class PaintImageEvent extends AbstractDispatchingObjectEvent implements return true; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#clone() + */ + @Override + public Object clone() { + PaintImageEvent newInstance = new PaintImageEvent(); + newInstance.applyDiffObject(this); + return newInstance; + } + } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java index 4583ff4214..a984d6c304 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java @@ -19,8 +19,6 @@ **/ 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.DynamicSerializeElement; 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.drawables.IImage; 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.objects.AbstractDispatchingImage; 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 */ @DynamicSerialize -public class PaintImagesEvent extends AbstractRemoteGraphicsRenderEvent { +public class PaintImagesEvent extends + AbstractRemoteGraphicsBulkRenderEvent { @DynamicSerializeElement private float alpha; - @DynamicSerializeElement - private PaintImageEvent[] imageEvents; - /* * (non-Javadoc) * - * @see - * com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject - * (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent + * #createDiffObject(com.raytheon.uf.viz + * .remote.graphics.events.rendering.IRenderEvent) */ @Override public PaintImagesEvent createDiffObject(IRenderEvent event) { - PaintImagesEvent diff = (PaintImagesEvent) event; - PaintImagesEvent diffEvent = new PaintImagesEvent(); - diffEvent.alpha = diff.alpha; - if (diff.imageEvents != null) { - 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; + PaintImagesEvent diffObject = (PaintImagesEvent) super + .createDiffObject(event); + diffObject.alpha = ((PaintImagesEvent) event).alpha; + return diffObject; } /* * (non-Javadoc) * - * @see - * com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#applyDiffObject - * (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent + * #applyDiffObject(com.raytheon.uf.viz. + * remote.graphics.events.rendering.IRenderEvent) */ @Override public void applyDiffObject(IRenderEvent diffEvent) { - PaintImagesEvent event = (PaintImagesEvent) diffEvent; - PaintImageEvent[] diffImageEvents = event.imageEvents; - 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; + super.applyDiffObject(diffEvent); + this.alpha = ((PaintImagesEvent) diffEvent).alpha; } /** @@ -213,6 +165,17 @@ public class PaintImagesEvent extends AbstractRemoteGraphicsRenderEvent { return targeted; } + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent#getObjectClass() + */ + @Override + protected Class getObjectClass() { + return PaintImageEvent.class; + } + /* * (non-Javadoc) * @@ -222,16 +185,27 @@ public class PaintImagesEvent extends AbstractRemoteGraphicsRenderEvent { public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) + if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; PaintImagesEvent other = (PaintImagesEvent) obj; if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha)) return false; - if (!Arrays.equals(imageEvents, other.imageEvents)) - return false; 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; + } + } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java index e8041a4b83..6a31321964 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/offscreen/RenderOffscreenEvent.java @@ -112,4 +112,16 @@ public class RenderOffscreenEvent extends AbstractDispatchingObjectEvent return true; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#clone() + */ + @Override + public Object clone() { + RenderOffscreenEvent newInstance = new RenderOffscreenEvent(); + newInstance.applyDiffObject(this); + return newInstance; + } + } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/AbstractRemoteGraphicsBulkRenderEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/AbstractRemoteGraphicsBulkRenderEvent.java new file mode 100644 index 0000000000..a161724d9d --- /dev/null +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/AbstractRemoteGraphicsBulkRenderEvent.java @@ -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 + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 17, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@SuppressWarnings("unchecked") +@DynamicSerialize +public abstract class AbstractRemoteGraphicsBulkRenderEvent + 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 createDiffObject( + IRenderEvent event) { + AbstractRemoteGraphicsBulkRenderEvent diff = (AbstractRemoteGraphicsBulkRenderEvent) event; + try { + AbstractRemoteGraphicsBulkRenderEvent diffEvent = (AbstractRemoteGraphicsBulkRenderEvent) 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 event = (AbstractRemoteGraphicsBulkRenderEvent) 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 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 other = (AbstractRemoteGraphicsBulkRenderEvent) obj; + if (!Arrays.equals(objects, other.objects)) + return false; + return true; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#clone() + */ + @Override + public Object clone() { + try { + AbstractRemoteGraphicsBulkRenderEvent 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"); + } + } + +} diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/AbstractRemoteGraphicsRenderEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/AbstractRemoteGraphicsRenderEvent.java index c6f1369356..4519fbe029 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/AbstractRemoteGraphicsRenderEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/AbstractRemoteGraphicsRenderEvent.java @@ -53,6 +53,23 @@ public abstract class AbstractRemoteGraphicsRenderEvent extends 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 public abstract boolean equals(Object obj); diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/IRenderEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/IRenderEvent.java index f2a2a67ec9..74160314e7 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/IRenderEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/rendering/IRenderEvent.java @@ -43,6 +43,8 @@ public interface IRenderEvent { @Override public abstract boolean equals(Object obj); + public abstract Object clone(); + public abstract IRenderEvent createDiffObject(IRenderEvent event); public abstract void applyDiffObject(IRenderEvent diffEvent); diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapeEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapeEvent.java index 60c84659e5..f16c2cf9a3 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapeEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapeEvent.java @@ -67,4 +67,15 @@ public class DrawShadedShapeEvent extends AbstractDispatchingObjectEvent setObjectId(((DrawShadedShapeEvent) diffEvent).getObjectId()); } + /* + * (non-Javadoc) + * + * @see java.lang.Object#clone() + */ + @Override + public Object clone() { + DrawShadedShapeEvent newInstance = new DrawShadedShapeEvent(); + newInstance.applyDiffObject(this); + return newInstance; + } } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapesEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapesEvent.java index f5f24eca3d..19e25b49ed 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapesEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/DrawShadedShapesEvent.java @@ -19,11 +19,9 @@ **/ 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.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; /** @@ -43,7 +41,8 @@ import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent; * @version 1.0 */ @DynamicSerialize -public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent { +public class DrawShadedShapesEvent extends + AbstractRemoteGraphicsBulkRenderEvent { @DynamicSerializeElement private float alpha; @@ -51,67 +50,38 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent { @DynamicSerializeElement private float brightness; - @DynamicSerializeElement - private DrawShadedShapeEvent[] shapes; - /* * (non-Javadoc) * - * @see - * com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject - * (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent + * #createDiffObject(com.raytheon.uf.viz + * .remote.graphics.events.rendering.IRenderEvent) */ @Override public DrawShadedShapesEvent createDiffObject(IRenderEvent event) { - DrawShadedShapesEvent diff = (DrawShadedShapesEvent) event; - DrawShadedShapesEvent diffEvent = new DrawShadedShapesEvent(); - if (diff.shapes != null) { - if (shapes != null && diff.shapes.length == shapes.length) { - diffEvent.shapes = new DrawShadedShapeEvent[diff.shapes.length]; - for (int i = 0; i < shapes.length; ++i) { - 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; + DrawShadedShapesEvent diffEvent = (DrawShadedShapesEvent) event; + DrawShadedShapesEvent diffObject = (DrawShadedShapesEvent) super + .createDiffObject(diffEvent); + diffObject.alpha = diffEvent.alpha; + diffObject.brightness = diffEvent.brightness; + return diffObject; } /* * (non-Javadoc) * - * @see - * com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#applyDiffObject - * (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent + * #applyDiffObject(com.raytheon.uf.viz. + * remote.graphics.events.rendering.IRenderEvent) */ @Override public void applyDiffObject(IRenderEvent diffEvent) { - DrawShadedShapesEvent event = (DrawShadedShapesEvent) diffEvent; - DrawShadedShapeEvent[] diffImageEvents = event.shapes; - if (diffImageEvents == null) { - shapes = null; - } 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; + super.applyDiffObject(diffEvent); + DrawShadedShapesEvent diffObject = (DrawShadedShapesEvent) diffEvent; + this.alpha = diffObject.alpha; + this.brightness = diffObject.brightness; } /** @@ -144,19 +114,15 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent { this.brightness = brightness; } - /** - * @return the shapes + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent#getObjectClass() */ - public DrawShadedShapeEvent[] getShapes() { - return shapes; - } - - /** - * @param shapes - * the shapes to set - */ - public void setShapes(DrawShadedShapeEvent[] shapes) { - this.shapes = shapes; + @Override + protected Class getObjectClass() { + return DrawShadedShapeEvent.class; } /* @@ -168,7 +134,7 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent { public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) + if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; @@ -178,9 +144,21 @@ public class DrawShadedShapesEvent extends AbstractRemoteGraphicsRenderEvent { if (Float.floatToIntBits(brightness) != Float .floatToIntBits(other.brightness)) return false; - if (!Arrays.equals(shapes, other.shapes)) - return false; 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; + } + } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/RenderWireframeShapeEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/RenderWireframeShapeEvent.java index 52b7c0ab91..0e00fb68cc 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/RenderWireframeShapeEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/shapes/RenderWireframeShapeEvent.java @@ -204,4 +204,16 @@ public class RenderWireframeShapeEvent extends AbstractDispatchingObjectEvent return true; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#clone() + */ + @Override + public Object clone() { + RenderWireframeShapeEvent newInstance = new RenderWireframeShapeEvent(); + newInstance.applyDiffObject(this); + return newInstance; + } + } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/strings/DrawStringsEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/strings/DrawStringsEvent.java index 8e80fa25fe..f1864b9b6c 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/strings/DrawStringsEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/strings/DrawStringsEvent.java @@ -19,12 +19,8 @@ **/ 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; +import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsBulkRenderEvent; /** * Event for drawing multiple strings in bulk @@ -43,99 +39,18 @@ import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent; * @version 1.0 */ @DynamicSerialize -public class DrawStringsEvent extends AbstractRemoteGraphicsRenderEvent { - - @DynamicSerializeElement - private DrawStringEvent[] strings; +public class DrawStringsEvent extends + AbstractRemoteGraphicsBulkRenderEvent { /* * (non-Javadoc) * - * @see - * com.raytheon.uf.viz.remote.graphics.events.IRenderEvent#createDiffObject - * (com.raytheon.uf.viz.remote.graphics.events.IRenderEvent) + * @see com.raytheon.uf.viz.remote.graphics.events.rendering. + * AbstractRemoteGraphicsBulkRenderEvent#getObjectClass() */ @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; + protected Class getObjectClass() { + return DrawStringEvent.class; } } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java index 4bdd655b38..36b59d7a87 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java @@ -72,7 +72,7 @@ public abstract class AbstractDispatchingImageExtension extends DrawableImage... images) throws VizException { PaintImagesEvent bulkRender = RemoteGraphicsEventFactory.createEvent( PaintImagesEvent.class, target); - bulkRender.setImageEvents(PaintImagesEvent.toPaintEvents(images)); + bulkRender.setObjects(PaintImagesEvent.toPaintEvents(images)); DrawableImage[] targeted = PaintImagesEvent.extractTargetImages(images); bulkRender.setAlpha(paintProps.getAlpha()); boolean rval = target.getWrappedObject().drawRasters(paintProps, diff --git a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java index 9a52fb9c56..b94e176ee2 100644 --- a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java +++ b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java @@ -598,23 +598,21 @@ public class GLTarget implements IGLTarget { public void drawArc(double x1, double y1, double z1, double radius, RGB color, float width, int startAzimuth, int endAzimuth, LineStyle lineStyle, boolean includeSides) throws VizException { - this.pushGLState(); - try { - gl.glPolygonMode(GL.GL_BACK, GL.GL_LINE); - handleLineStyle(lineStyle); - gl.glColor4d(color.red / 255.0, color.green / 255.0, - color.blue / 255.0, 1.0); - gl.glLineWidth(width); - gl.glBegin(GL.GL_LINE_STRIP); - - for (double i = startAzimuth; i <= endAzimuth; i++) { - double[] pointOnCircle = getPointOnCircle(x1, y1, z1, radius, i); - gl.glVertex2d(pointOnCircle[0], pointOnCircle[1]); - } - gl.glEnd(); - } finally { - this.popGLState(); + DrawableCircle dc = new DrawableCircle(); + dc.setCoordinates(x1, y1, z1); + dc.basics.color = color; + dc.lineStyle = lineStyle; + dc.startAzimuth = startAzimuth; + dc.endAzimuth = endAzimuth; + if (startAzimuth > endAzimuth) { + dc.numberOfPoints = (endAzimuth + 360) - startAzimuth; + } else { + dc.numberOfPoints = endAzimuth - startAzimuth; } + dc.includeSides = includeSides; + dc.lineWidth = width; + dc.radius = radius; + drawCircle(dc); } /* @@ -2184,7 +2182,7 @@ public class GLTarget implements IGLTarget { */ @Override public void setView(IView view) { - this.targetView = view; + this.targetView = (IView) view.clone(); this.targetView.setupView(this); }