Issue #584 Got draw point calls working

Change-Id: I80f9061647a96e66acf70fb5c22aefb8916979b0

Former-commit-id: 39a9ae5047e2f873d9b09ba65eded740f6568cec
This commit is contained in:
Max Schenkelberg 2012-05-02 16:40:55 -05:00
parent 817bd297c8
commit 65f8b18194
22 changed files with 849 additions and 144 deletions

View file

@ -74,10 +74,12 @@ public class DrawPointImagesEvent extends AbstractRemoteGraphicsRenderEvent {
removals.removeAll(diffEvent.images);
DrawPointImagesEvent diffObject = new DrawPointImagesEvent();
diffObject.setAlpha(diffEvent.getAlpha());
if (additions.size() > 0) {
if (additions.size() + removals.size() > diffEvent.images.size()) {
// Just do a full replace
diffObject.setRemovals(null);
diffObject.setImages(diffEvent.images);
} else {
diffObject.setImages(additions);
}
if (removals.size() > 0) {
diffObject.setRemovals(removals);
}
return diffObject;
@ -96,9 +98,10 @@ public class DrawPointImagesEvent extends AbstractRemoteGraphicsRenderEvent {
synchronized (images) {
if (diffObject.removals != null) {
images.removeAll(diffObject.removals);
}
if (diffObject.images != null) {
images.addAll(diffObject.images);
} else {
// Null removals indicates full replaces
images = new HashSet<PointImageEvent>(diffObject.images);
}
}
alpha = diffObject.getAlpha();

View file

@ -24,8 +24,10 @@ import java.util.List;
import java.util.Set;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.pointdata.image.DrawPointImagesEvent;
import com.raytheon.uf.viz.collaboration.pointdata.image.PointImageEvent;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IImage;
@ -54,8 +56,8 @@ import com.raytheon.viz.pointdata.drawables.IPointImageExtension.PointImage;
public class PointImageRenderingHandler extends CollaborationRenderingHandler {
@Subscribe
public void drawPointImages(DrawPointImagesEvent event) throws VizException {
IGraphicsTarget target = getTarget();
public void drawPointImages(DrawPointImagesEvent event) {
IGraphicsTarget target = getGraphicsTarget();
PaintProperties newProps = new PaintProperties(getPaintProperties());
newProps.setAlpha(event.getAlpha());
Set<PointImageEvent> events = event.getImagesCopy();
@ -74,8 +76,13 @@ public class PointImageRenderingHandler extends CollaborationRenderingHandler {
}
}
target.getExtension(IPointImageExtension.class).drawPointImages(
newProps, images);
try {
target.getExtension(IPointImageExtension.class).drawPointImages(
newProps, images);
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}

View file

@ -20,10 +20,12 @@
package com.raytheon.uf.viz.collaboration.radar.rendering;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.radar.mesh.CreateRadarRadialMesh;
import com.raytheon.uf.viz.collaboration.radar.mosaic.CreateMosaicImageEvent;
import com.raytheon.uf.viz.collaboration.radar.mosaic.UpdateImagesToMosaic;
import com.raytheon.uf.viz.collaboration.radar.mosaic.UpdateMosaicExtent;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.ImagingRenderingHandler;
import com.raytheon.uf.viz.core.IExtent;
@ -55,21 +57,25 @@ public class RadarGraphicsExtRenderingHandler extends
CollaborationRenderingHandler {
@Subscribe
public void createRadarMesh(CreateRadarRadialMesh event)
throws VizException {
public void createRadarMesh(CreateRadarRadialMesh event) {
int meshId = event.getObjectId();
IGraphicsTarget target = getTarget();
dataManager.putRenderableObject(
meshId,
target.getExtension(IRadialMeshExtension.class).constructMesh(
event.getRadarRecord(), event.getTargetGeometry()));
IGraphicsTarget target = getGraphicsTarget();
try {
dataManager.putRenderableObject(
meshId,
target.getExtension(IRadialMeshExtension.class)
.constructMesh(event.getRadarRecord(),
event.getTargetGeometry()));
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe
public void createMosaicImage(CreateMosaicImageEvent event)
throws VizException {
public void createMosaicImage(CreateMosaicImageEvent event) {
int imageId = event.getObjectId();
IGraphicsTarget target = getTarget();
IGraphicsTarget target = getGraphicsTarget();
IExtent imageExtent = null;
ColorMapParameters parameters = null;
if (event.getExtent() != null) {
@ -81,11 +87,16 @@ public class RadarGraphicsExtRenderingHandler extends
parameters.setColorMap(event.getColorMap().getColorMap());
}
}
dataManager.putRenderableObject(
imageId,
target.getExtension(IRadarMosaicImageExtension.class)
.initializeRaster(event.getBounds(), imageExtent,
parameters));
try {
dataManager.putRenderableObject(
imageId,
target.getExtension(IRadarMosaicImageExtension.class)
.initializeRaster(event.getBounds(), imageExtent,
parameters));
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.ResourceList;
@ -257,11 +258,12 @@ public class DataProviderEventController extends AbstractRoleEventController {
DispatchingGraphicsFactory.injectRemoteFunctionality(container,
new DispatcherFactory() {
@Override
public Dispatcher createNewDispatcher()
public Dispatcher createNewDispatcher(
IRenderableDisplay display)
throws InstantiationException {
try {
CollaborationDispatcher dispatcher = new CollaborationDispatcher(
session);
session, display);
dispatchers.add(dispatcher);
return dispatcher;
} catch (CollaborationException e) {

View file

@ -20,8 +20,11 @@
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import org.eclipse.swt.widgets.Event;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -31,9 +34,14 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrame;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameNeededEvent;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.jobs.JobPool;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
import com.raytheon.uf.viz.remote.graphics.events.AbstractRemoteGraphicsEvent;
@ -41,6 +49,7 @@ import com.raytheon.uf.viz.remote.graphics.events.ICreationEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.EndFrameEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
import com.raytheon.viz.ui.input.InputAdapter;
/**
* Dispatches graphics objects to participants in the collaboration session
@ -75,12 +84,58 @@ public class CollaborationDispatcher extends Dispatcher {
private RenderFrame currentFrame;
public CollaborationDispatcher(ISharedDisplaySession session)
throws CollaborationException {
private IInputHandler mouseCapturer = new InputAdapter() {
private double[] mouseLocation;
@Override
public boolean handleMouseMove(int x, int y) {
IDisplayPaneContainer container = display.getContainer();
for (IDisplayPane pane : container.getDisplayPanes()) {
if (pane.getRenderableDisplay() == display) {
update(display.screenToGrid(x, y, 1.0, pane.getTarget()));
break;
}
}
return false;
}
@Override
public boolean handleMouseExit(Event event) {
update(null);
return false;
}
@Override
public boolean handleMouseEnter(Event event) {
handleMouseMove(event.x, event.y);
return false;
}
private void update(double[] mouseLocation) {
if (!Arrays.equals(mouseLocation, this.mouseLocation)) {
this.mouseLocation = mouseLocation;
MouseLocationEvent event = new MouseLocationEvent();
event.setDisplayId(getDispatcherId());
event.setMouseLocation(mouseLocation);
send(event);
}
}
};
private IRenderableDisplay display;
public CollaborationDispatcher(ISharedDisplaySession session,
IRenderableDisplay display) throws CollaborationException {
this.session = session;
this.display = display;
this.persistance = CollaborationObjectEventStorage
.createPersistanceObject(session);
session.registerEventHandler(this);
// TODO:
// Not sure if we should show mouse location or not due to
// bandwidth, messages are very small but frequent
// display.getContainer().registerMouseHandler(mouseCapturer);
}
@Subscribe

View file

@ -0,0 +1,98 @@
/**
* 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.role.dataprovider.event;
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;
/**
* Collaboration mouse location event, contains mouse coordinates of data
* provider
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class MouseLocationEvent extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerializeElement
private double[] mouseLocation;
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.EndFrameEvent#
* applyDiffObject
* (com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent)
*/
@Override
public void applyDiffObject(IRenderEvent diffEvent) {
mouseLocation = ((MouseLocationEvent) diffEvent).mouseLocation;
}
/**
* @return the mouseLocation
*/
public double[] getMouseLocation() {
return mouseLocation;
}
/**
* @param mouseLocation
* the mouseLocation to set
*/
public void setMouseLocation(double[] mouseLocation) {
this.mouseLocation = mouseLocation;
}
/*
* (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;
MouseLocationEvent other = (MouseLocationEvent) obj;
if (!Arrays.equals(mouseLocation, other.mouseLocation))
return false;
return true;
}
}

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.FrameDisposed;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameNeededEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.UpdateRenderFrameEvent;
@ -97,6 +98,8 @@ public class CollaborationResource extends
private BeginFrameEvent latestBeginFrameEvent;
private MouseLocationEvent latestMouseLocation;
private Set<Integer> waitingOnObjects = new HashSet<Integer>();
private Set<Integer> waitingOnFrames = new HashSet<Integer>();
@ -153,6 +156,9 @@ public class CollaborationResource extends
for (IRenderEvent event : toRender) {
renderingRouter.post(event);
}
if (latestMouseLocation != null) {
renderingRouter.post(latestMouseLocation);
}
}
}
@ -303,6 +309,9 @@ public class CollaborationResource extends
}
activeRenderables.clear();
issueRefresh();
} else if (event instanceof MouseLocationEvent) {
latestMouseLocation = (MouseLocationEvent) event;
issueRefresh();
} else {
activeRenderables.add((IRenderEvent) event);
}

View file

@ -119,7 +119,7 @@ public class CollaborationRenderingDataManager implements IObjectEventRetrieval
/**
* @return the target
*/
public IGraphicsTarget getTarget() {
public IGraphicsTarget getGraphicsTarget() {
return target;
}

View file

@ -49,8 +49,8 @@ public abstract class CollaborationRenderingHandler {
this.dataManager = dataManager;
}
protected final IGraphicsTarget getTarget() {
return dataManager.getTarget();
protected final IGraphicsTarget getGraphicsTarget() {
return dataManager.getGraphicsTarget();
}
protected final PaintProperties getPaintProperties() {

View file

@ -23,10 +23,11 @@ import java.io.File;
import java.io.IOException;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.remote.graphics.events.fonts.CreateFontEvent;
import com.raytheon.uf.viz.remote.graphics.events.fonts.UpdateFontDataEvent;
@ -50,8 +51,8 @@ import com.raytheon.uf.viz.remote.graphics.events.fonts.UpdateFontDataEvent;
public class FontRenderingHandler extends CollaborationRenderingHandler {
@Subscribe
public void createFont(CreateFontEvent event) throws VizException {
IGraphicsTarget target = getTarget();
public void createFont(CreateFontEvent event) {
IGraphicsTarget target = getGraphicsTarget();
int fontId = event.getObjectId();
IFont font = null;
if (event.getFontData() != null) {
@ -61,8 +62,8 @@ public class FontRenderingHandler extends CollaborationRenderingHandler {
font = target.initializeFont(fontFile, event.getFontSize(),
event.getFontStyle());
} catch (IOException e) {
throw new VizException("Unable to write font file: "
+ e.getLocalizedMessage());
Activator.statusHandler.handle(Priority.PROBLEM,
"Error creating font from file", e);
}
} else {
font = target.initializeFont(event.getFontName(),
@ -79,21 +80,12 @@ public class FontRenderingHandler extends CollaborationRenderingHandler {
IFont font = dataManager.getRenderableObject(event.getObjectId(),
IFont.class);
if (font != null) {
if (event.getMagnification() != null) {
if (event.getScaleFont() != null) {
font.setMagnification(event.getMagnification(),
event.getScaleFont());
} else {
font.setMagnification(event.getMagnification());
}
if (event.getScaleOnMagnify() != null) {
font.setMagnification(event.getMagnification(),
event.getScaleOnMagnify());
} else {
if (event.getScaleFont() != null) {
font.setScaleFont(event.getScaleFont());
} else if (event.getSmoothing() != null) {
font.setSmoothing(event.getSmoothing());
}
font.setMagnification(event.getMagnification());
}
font.setMagnification(event.getMagnification());
font.setSmoothing(event.getSmoothing());
font.setScaleFont(event.getScaleFont());
}

View file

@ -19,12 +19,22 @@
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
import org.eclipse.swt.graphics.RGB;
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.collaboration.ui.role.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.remote.graphics.events.DisposeObjectEvent;
import com.raytheon.uf.viz.remote.graphics.events.points.DrawPointsEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Handles general rendering events, begin frame and dispose
@ -63,7 +73,7 @@ public class GeneralRenderingHandler extends CollaborationRenderingHandler {
@Subscribe
public void handleBeginFrame(BeginFrameEvent event) {
PaintProperties paintProps = getPaintProperties();
IGraphicsTarget target = getTarget();
IGraphicsTarget target = getGraphicsTarget();
double[] center = event.getExtentCenter();
IExtent copy = paintProps.getView().getExtent().clone();
if (center != null) {
@ -77,4 +87,69 @@ public class GeneralRenderingHandler extends CollaborationRenderingHandler {
}
}
@Subscribe
public void handleDrawPoints(DrawPointsEvent event) {
try {
IGraphicsTarget target = getGraphicsTarget();
target.drawPoints(event.getPointsCollection(), event.getColor(),
event.getStyle(), event.getMagnification());
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe
public void handleEndFrame(MouseLocationEvent event) {
// TODO: Draw the best icon for a cursor, for now will use what
// VizDisplayPane uses, this is copypasta
double[] mouseLoc = event.getMouseLocation();
if (mouseLoc == null) {
// Don't draw if no location
return;
}
IGraphicsTarget target = getGraphicsTarget();
PaintProperties paintProps = getPaintProperties();
target.clearClippingPlane();
// Calculate scale for image
double screenToWorldRatio = paintProps.getCanvasBounds().width
/ paintProps.getView().getExtent().getWidth();
double middleValue = 5 / screenToWorldRatio;
double outsideValue = 6 / screenToWorldRatio;
double insideValue = 4 / screenToWorldRatio;
Coordinate virtualCursor = new Coordinate(mouseLoc[0], mouseLoc[1]);
try {
target.drawRect(new PixelExtent(virtualCursor.x - middleValue,
virtualCursor.x + middleValue, virtualCursor.y
- middleValue, virtualCursor.y + middleValue),
new RGB(255, 255, 255), 1.0f, 1.0f);
target.drawRect(new PixelExtent(virtualCursor.x - outsideValue,
virtualCursor.x + outsideValue, virtualCursor.y
- outsideValue, virtualCursor.y + outsideValue),
new RGB(0, 0, 0), 0.5f, 1.0f);
target.drawRect(new PixelExtent(virtualCursor.x - insideValue,
virtualCursor.x + insideValue, virtualCursor.y
- insideValue, virtualCursor.y + insideValue),
new RGB(0, 0, 0), 0.5f, 1.0f);
DrawableCircle circle = new DrawableCircle();
circle.filled = true;
circle.radius = 1.0 / screenToWorldRatio;
circle.basics.color = new RGB(255, 255, 255);
circle.numberOfPoints = 4;
circle.setCoordinates(virtualCursor.x, virtualCursor.y);
target.drawCircle(circle);
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} finally {
target.setupClippingPlane(paintProps.getClippingPane());
}
}
}

View file

@ -25,6 +25,8 @@ import java.util.List;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.colormap.IColorMap;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.DrawableImage;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IMesh;
@ -76,15 +78,20 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
private Object colorMapLock = new Object();
@Subscribe
public void renderImages(PaintImagesEvent event) throws VizException {
public void renderImages(PaintImagesEvent event) {
PaintProperties paintProps = getPaintProperties();
IGraphicsTarget target = getTarget();
IGraphicsTarget target = getGraphicsTarget();
PaintImageEvent[] events = event.getImageEvents();
DrawableImage[] images = toDrawableImages(events, dataManager);
if (images.length > 0) {
PaintProperties imageProps = new PaintProperties(paintProps);
imageProps.setAlpha(event.getAlpha());
target.drawRasters(imageProps, images);
try {
target.drawRasters(imageProps, images);
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
@ -114,8 +121,6 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
}
}
images.add(new DrawableImage(image, coverage));
} else {
// TODO: Log?
}
}
return images.toArray(new DrawableImage[images.size()]);
@ -158,7 +163,7 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
@Subscribe
public void createImage(CreateIImageEvent event) {
IGraphicsTarget target = getTarget();
IGraphicsTarget target = getGraphicsTarget();
RenderedImageDataCallback callback = new RenderedImageDataCallback();
IImage image = target.initializeRaster(callback);
dataManager.putRenderableObject(event.getObjectId(), new Object[] {
@ -190,9 +195,8 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
* @throws VizException
*/
@Subscribe
public void createColormappedImage(CreateColormappedImageEvent event)
throws VizException {
IGraphicsTarget target = getTarget();
public void createColormappedImage(CreateColormappedImageEvent event) {
IGraphicsTarget target = getGraphicsTarget();
int imageId = event.getObjectId();
IColorMapDataRetrievalCallback callback = new ColorMapDataCallback();
UpdateColorMapParametersEvent cmapParamEvent = event
@ -204,11 +208,16 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
params.setColorMap(event.getColorMap().getColorMap());
}
}
IColormappedImage image = target.getExtension(
IColormappedImageExtension.class).initializeRaster(callback,
params);
dataManager.putRenderableObject(imageId,
new Object[] { image, callback });
try {
IColormappedImage image = target.getExtension(
IColormappedImageExtension.class).initializeRaster(
callback, params);
dataManager.putRenderableObject(imageId, new Object[] { image,
callback });
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe
@ -282,23 +291,31 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
// ================== IMesh events ==================
@Subscribe
public void createMesh(CreateMeshEvent event) throws VizException {
IGraphicsTarget target = getTarget();
// TODO: Should we cache or should we expect data provider or even
// internal to the target?
public void createMesh(CreateMeshEvent event) {
IGraphicsTarget target = getGraphicsTarget();
int meshId = event.getObjectId();
IMesh mesh = target.getExtension(IMapMeshExtension.class)
.constructMesh(event.getImageGeometry(),
event.getTargetGeometry());
dataManager.putRenderableObject(meshId, mesh);
try {
IMesh mesh = target.getExtension(IMapMeshExtension.class)
.constructMesh(event.getImageGeometry(),
event.getTargetGeometry());
dataManager.putRenderableObject(meshId, mesh);
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe
public void reprojectMesh(ReprojectMeshEvent event) throws VizException {
public void reprojectMesh(ReprojectMeshEvent event) {
IMesh mesh = dataManager.getRenderableObject(event.getObjectId(),
IMesh.class);
if (mesh != null) {
mesh.reproject(event.getTargetGeometry());
try {
mesh.reproject(event.getTargetGeometry());
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
@ -310,16 +327,20 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler {
// ================== ISingleColorImage events ==================
@Subscribe
public void createSingleColorImage(CreateSingleColorImage event)
throws VizException {
IGraphicsTarget target = getTarget();
public void createSingleColorImage(CreateSingleColorImage event) {
IGraphicsTarget target = getGraphicsTarget();
RenderedImageDataCallback callback = new RenderedImageDataCallback();
int imageId = event.getObjectId();
ISingleColorImage image = target.getExtension(
ISingleColorImageExtension.class).constructImage(callback,
event.getColor());
dataManager.putRenderableObject(imageId,
new Object[] { image, callback });
try {
ISingleColorImage image = target.getExtension(
ISingleColorImageExtension.class).constructImage(callback,
event.getColor());
dataManager.putRenderableObject(imageId, new Object[] { image,
callback });
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe

View file

@ -22,6 +22,8 @@ package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
import java.nio.Buffer;
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.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
@ -50,9 +52,8 @@ import com.raytheon.uf.viz.remote.graphics.events.offscreen.RenderOnscreenEvent;
public class OffscreenRenderingHandler extends CollaborationRenderingHandler {
@Subscribe
public void createOffscreenImage(CreateOffscreenImageEvent event)
throws VizException {
IGraphicsTarget target = getTarget();
public void createOffscreenImage(CreateOffscreenImageEvent event) {
IGraphicsTarget target = getGraphicsTarget();
try {
IImage offscreenImage = null;
IOffscreenRenderingExtension ext = target
@ -77,32 +78,46 @@ public class OffscreenRenderingHandler extends CollaborationRenderingHandler {
offscreenImage);
}
} catch (ClassNotFoundException e) {
throw new VizException("Could not find class for buffer type: "
+ event.getBufferType(), e);
Activator.statusHandler.handle(Priority.PROBLEM,
"Error construcint offscreen image with buffer type: "
+ event.getBufferType(), e);
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
@Subscribe
public void renderOffscreen(RenderOffscreenEvent event) throws VizException {
IGraphicsTarget target = getTarget();
public void renderOffscreen(RenderOffscreenEvent event) {
IGraphicsTarget target = getGraphicsTarget();
IImage offscreenImage = dataManager.getRenderableObject(
event.getObjectId(), IImage.class);
if (offscreenImage != null) {
if (event.getExtent() != null) {
target.getExtension(IOffscreenRenderingExtension.class)
.renderOffscreen(offscreenImage, event.getIExtent());
} else {
target.getExtension(IOffscreenRenderingExtension.class)
.renderOffscreen(offscreenImage);
try {
if (event.getExtent() != null) {
target.getExtension(IOffscreenRenderingExtension.class)
.renderOffscreen(offscreenImage, event.getIExtent());
} else {
target.getExtension(IOffscreenRenderingExtension.class)
.renderOffscreen(offscreenImage);
}
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
@Subscribe
public void renderOnscreen(RenderOnscreenEvent event) throws VizException {
IGraphicsTarget target = getTarget();
target.getExtension(IOffscreenRenderingExtension.class)
.renderOnscreen();
public void renderOnscreen(RenderOnscreenEvent event) {
try {
IGraphicsTarget target = getGraphicsTarget();
target.getExtension(IOffscreenRenderingExtension.class)
.renderOnscreen();
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}

View file

@ -20,6 +20,8 @@
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.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
@ -53,7 +55,7 @@ public class WireframeShapeRenderingHandler extends
@Subscribe
public void createWireframeShape(CreateWireframeShapeEvent event) {
IGraphicsTarget target = getTarget();
IGraphicsTarget target = getGraphicsTarget();
int shapeId = event.getObjectId();
IWireframeShape shape = null;
if (event.getSimplificationLevel() != null) {
@ -119,9 +121,8 @@ public class WireframeShapeRenderingHandler extends
}
@Subscribe
public void renderWireframeShape(RenderWireframeShapeEvent event)
throws VizException {
IGraphicsTarget target = getTarget();
public void renderWireframeShape(RenderWireframeShapeEvent event) {
IGraphicsTarget target = getGraphicsTarget();
IWireframeShape shape = dataManager.getRenderableObject(
event.getObjectId(), IWireframeShape.class);
if (shape != null) {
@ -130,13 +131,18 @@ public class WireframeShapeRenderingHandler extends
font = dataManager.getRenderableObject(event.getFontId(),
IFont.class);
}
if (event.getAlpha() == null) {
target.drawWireframeShape(shape, event.getColor(),
event.getLineWidth(), event.getLineStyle(), font);
} else {
target.drawWireframeShape(shape, event.getColor(),
event.getLineWidth(), event.getLineStyle(), font,
event.getAlpha());
try {
if (event.getAlpha() == null) {
target.drawWireframeShape(shape, event.getColor(),
event.getLineWidth(), event.getLineStyle(), font);
} else {
target.drawWireframeShape(shape, event.getColor(),
event.getLineWidth(), event.getLineStyle(), font,
event.getAlpha());
}
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}

View file

@ -23,6 +23,7 @@ Export-Package: com.raytheon.uf.viz.remote.graphics,
com.raytheon.uf.viz.remote.graphics.events.imagery,
com.raytheon.uf.viz.remote.graphics.events.mesh,
com.raytheon.uf.viz.remote.graphics.events.offscreen,
com.raytheon.uf.viz.remote.graphics.events.points,
com.raytheon.uf.viz.remote.graphics.events.rendering,
com.raytheon.uf.viz.remote.graphics.events.wireframe,
com.raytheon.uf.viz.remote.graphics.extensions,

View file

@ -24,6 +24,7 @@ import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -67,6 +68,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.geom.PixelCoordinate;
import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory;
import com.raytheon.uf.viz.remote.graphics.events.imagery.CreateIImageEvent;
import com.raytheon.uf.viz.remote.graphics.events.points.DrawPointsEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.EndFrameEvent;
import com.raytheon.uf.viz.remote.graphics.events.wireframe.CreateWireframeShapeEvent;
@ -799,16 +801,14 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
previousExtent = curExtent.clone();
}
private EndFrameEvent endFrame = RemoteGraphicsEventFactory.createEvent(
EndFrameEvent.class, this);
/**
*
* @see com.raytheon.uf.viz.core.IGraphicsTarget#endFrame()
*/
public void endFrame() {
wrappedObject.endFrame();
dispatch(endFrame);
dispatch(RemoteGraphicsEventFactory.createEvent(EndFrameEvent.class,
this));
}
/**
@ -953,6 +953,8 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
public void drawPoint(double x, double y, double z, RGB color,
PointStyle pointStyle) throws VizException {
wrappedObject.drawPoint(x, y, z, color, pointStyle);
sendDrawPointsEvent(Arrays.asList(new double[] { x, y, z }), color,
pointStyle, 1.0f);
}
/**
@ -968,6 +970,7 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
public void drawPoints(Collection<double[]> locations, RGB color,
PointStyle pointStyle, float magnification) throws VizException {
wrappedObject.drawPoints(locations, color, pointStyle, magnification);
sendDrawPointsEvent(locations, color, pointStyle, magnification);
}
/**
@ -985,6 +988,19 @@ public class DispatchGraphicsTarget extends DispatchingObject<IGraphicsTarget>
public void drawPoint(double x, double y, double z, RGB color,
PointStyle pointStyle, float magnification) throws VizException {
wrappedObject.drawPoint(x, y, z, color, pointStyle, magnification);
sendDrawPointsEvent(Arrays.asList(new double[] { x, y, z }), color,
pointStyle, magnification);
}
private void sendDrawPointsEvent(Collection<double[]> points, RGB color,
PointStyle pointStyle, float magnification) {
DrawPointsEvent event = RemoteGraphicsEventFactory.createEvent(
DrawPointsEvent.class, this);
event.addPoints(points);
event.setColor(color);
event.setStyle(pointStyle);
event.setMagnification(magnification);
dispatch(event);
}
/**

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.viz.remote.graphics;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
/**
* Factory for creating Dispatcher objects for dispatching remote graphics
* events
@ -44,6 +46,7 @@ public interface DispatcherFactory {
*
* @return
*/
public Dispatcher createNewDispatcher() throws InstantiationException;
public Dispatcher createNewDispatcher(IRenderableDisplay display)
throws InstantiationException;
}

View file

@ -158,9 +158,8 @@ public class DispatchingGraphicsFactory extends AbstractGraphicsFactoryAdapter {
IDisplayPaneContainer container, DispatcherFactory factory) {
try {
for (IDisplayPane pane : container.getDisplayPanes()) {
Dispatcher dispatcher = factory.createNewDispatcher();
// Wrap view in dispatching view
IRenderableDisplay display = pane.getRenderableDisplay();
Dispatcher dispatcher = factory.createNewDispatcher(display);
// Wrap the graphics adapter in dispatching one
display.setGraphicsAdapter(new DispatchingGraphicsFactory(
display.getGraphicsAdapter(), dispatcher));

View file

@ -43,18 +43,21 @@ import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent
public class UpdateFontDataEvent extends AbstractDispatchingObjectEvent {
@DynamicSerializeElement
private Float magnification;
private float magnification;
@DynamicSerializeElement
private Boolean smoothing;
private Boolean scaleOnMagnify;
@DynamicSerializeElement
private Boolean scaleFont;
private boolean smoothing;
@DynamicSerializeElement
private boolean scaleFont;
/**
* @return the magnification
*/
public Float getMagnification() {
public float getMagnification() {
return magnification;
}
@ -62,14 +65,29 @@ public class UpdateFontDataEvent extends AbstractDispatchingObjectEvent {
* @param magnification
* the magnification to set
*/
public void setMagnification(Float magnification) {
public void setMagnification(float magnification) {
this.magnification = magnification;
}
/**
* @return the scaleOnMagnify
*/
public Boolean getScaleOnMagnify() {
return scaleOnMagnify;
}
/**
* @param scaleOnMagnify
* the scaleOnMagnify to set
*/
public void setScaleOnMagnify(Boolean scaleOnMagnify) {
this.scaleOnMagnify = scaleOnMagnify;
}
/**
* @return the smoothing
*/
public Boolean getSmoothing() {
public boolean getSmoothing() {
return smoothing;
}
@ -77,14 +95,14 @@ public class UpdateFontDataEvent extends AbstractDispatchingObjectEvent {
* @param smoothing
* the smoothing to set
*/
public void setSmoothing(Boolean smoothing) {
public void setSmoothing(boolean smoothing) {
this.smoothing = smoothing;
}
/**
* @return the scaleFont
*/
public Boolean getScaleFont() {
public boolean getScaleFont() {
return scaleFont;
}
@ -92,7 +110,7 @@ public class UpdateFontDataEvent extends AbstractDispatchingObjectEvent {
* @param scaleFont
* the scaleFont to set
*/
public void setScaleFont(Boolean scaleFont) {
public void setScaleFont(boolean scaleFont) {
this.scaleFont = scaleFont;
}

View file

@ -0,0 +1,366 @@
/**
* 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.points;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
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.IGraphicsTarget.PointStyle;
import com.raytheon.uf.viz.remote.graphics.events.rendering.AbstractRemoteGraphicsRenderEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;
/**
* Event for specifying the rendering of a collection of points
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class DrawPointsEvent extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerialize
public static class Point {
@DynamicSerializeElement
private double[] point;
/**
* @return the point
*/
public double[] getPoint() {
return point;
}
/**
* @param point
* the point to set
*/
public void setPoint(double[] point) {
this.point = point;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(point);
return result;
}
/*
* (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;
Point other = (Point) obj;
if (!Arrays.equals(point, other.point))
return false;
return true;
}
}
@DynamicSerializeElement
private Set<Point> points = new HashSet<Point>();
@DynamicSerializeElement
private Set<Point> removals = null;
@DynamicSerializeElement
private PointStyle style;
@DynamicSerializeElement
private float magnification;
@DynamicSerializeElement
private int red;
@DynamicSerializeElement
private int green;
@DynamicSerializeElement
private int blue;
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.remote.graphics.events.rendering.
* AbstractRemoteGraphicsRenderEvent
* #createDiffObject(com.raytheon.uf.viz.remote
* .graphics.events.rendering.IRenderEvent)
*/
@Override
public IRenderEvent createDiffObject(IRenderEvent diffEvent) {
DrawPointsEvent event = (DrawPointsEvent) diffEvent;
DrawPointsEvent diffObject = new DrawPointsEvent();
diffObject.red = event.red;
diffObject.green = event.green;
diffObject.blue = event.blue;
diffObject.magnification = event.magnification;
Set<Point> additions = new HashSet<Point>(event.points);
additions.removeAll(points);
Set<Point> removals = new HashSet<Point>(points);
removals.removeAll(event.points);
if (additions.size() + removals.size() > event.points.size()) {
// Just do a full replace
diffObject.setRemovals(null);
diffObject.setPoints(event.points);
} else {
diffObject.setPoints(additions);
diffObject.setRemovals(removals);
}
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) {
DrawPointsEvent event = (DrawPointsEvent) diffEvent;
red = event.red;
green = event.green;
blue = event.blue;
magnification = event.magnification;
synchronized (points) {
if (event.removals != null) {
points.removeAll(event.removals);
points.addAll(event.points);
} else {
points = new HashSet<Point>(event.points);
}
}
}
/**
* @return the points
*/
public Set<Point> getPoints() {
return points;
}
public Collection<double[]> getPointsCollection() {
synchronized (points) {
List<double[]> pointList = new ArrayList<double[]>(points.size());
for (Point p : points) {
pointList.add(p.getPoint());
}
return pointList;
}
}
public void addPoint(double[] point) {
Point p = new Point();
p.setPoint(point);
this.points.add(p);
}
public void addPoints(Collection<double[]> points) {
for (double[] point : points) {
addPoint(point);
}
}
/**
* @param points
* the points to set
*/
public void setPoints(Set<Point> points) {
this.points = points;
}
/**
* @return the removals
*/
public Set<Point> getRemovals() {
return removals;
}
/**
* @param removals
* the removals to set
*/
public void setRemovals(Set<Point> removals) {
this.removals = removals;
}
/**
* @return the style
*/
public PointStyle getStyle() {
return style;
}
/**
* @param style
* the style to set
*/
public void setStyle(PointStyle style) {
this.style = style;
}
/**
* @return the magnification
*/
public float getMagnification() {
return magnification;
}
/**
* @param magnification
* the magnification to set
*/
public void setMagnification(float magnification) {
this.magnification = magnification;
}
/**
* @return the red
*/
public int getRed() {
return red;
}
/**
* @param red
* the red to set
*/
public void setRed(int red) {
this.red = red;
}
/**
* @return the green
*/
public int getGreen() {
return green;
}
/**
* @param green
* the green to set
*/
public void setGreen(int green) {
this.green = green;
}
/**
* @return the blue
*/
public int getBlue() {
return blue;
}
/**
* @param blue
* the blue to set
*/
public void setBlue(int blue) {
this.blue = blue;
}
public void setColor(RGB color) {
if (color != null) {
red = color.red;
green = color.green;
blue = color.blue;
}
}
public RGB getColor() {
return new RGB(red, green, blue);
}
/*
* (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;
DrawPointsEvent other = (DrawPointsEvent) obj;
if (blue != other.blue)
return false;
if (green != other.green)
return false;
if (Float.floatToIntBits(magnification) != Float
.floatToIntBits(other.magnification))
return false;
if (points == null) {
if (other.points != null)
return false;
} else if (!points.equals(other.points))
return false;
if (red != other.red)
return false;
if (removals == null) {
if (other.removals != null)
return false;
} else if (!removals.equals(other.removals))
return false;
if (style != other.style)
return false;
return true;
}
}

View file

@ -25,7 +25,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
* Frame that specifies the begining of a new rendering sequence. EndFrameEvent
* signals the end of the rendering sequence
*
* <pre>
*

View file

@ -54,10 +54,14 @@ public class DispatchingFont extends DispatchingObject<IFont> implements IFont {
private float lastMagnification;
private Boolean lastScaleOnMagnify = null;
private boolean lastSmoothing;
private boolean lastScaleFont;
private boolean dirty;
/**
* @param wrappedObject
* @param dispatcher
@ -69,6 +73,7 @@ public class DispatchingFont extends DispatchingObject<IFont> implements IFont {
this.lastScaleFont = wrappedObject.isScaleFont();
sendCreateFontEvent(getFontName(), getFontSize(), getStyle(),
getMagnification(), getSmoothing(), isScaleFont(), null);
dirty = false;
}
public DispatchingFont(IFont wrappedObject, Dispatcher dispatcher,
@ -79,6 +84,7 @@ public class DispatchingFont extends DispatchingObject<IFont> implements IFont {
this.lastScaleFont = wrappedObject.isScaleFont();
sendCreateFontEvent(getFontName(), getFontSize(), getStyle(),
getMagnification(), getSmoothing(), isScaleFont(), fontFile);
dirty = false;
}
private void sendCreateFontEvent(String fontName, float fontSize,
@ -155,10 +161,8 @@ public class DispatchingFont extends DispatchingObject<IFont> implements IFont {
wrappedObject.setMagnification(magnification);
if (lastMagnification != magnification) {
lastMagnification = magnification;
UpdateFontDataEvent event = RemoteGraphicsEventFactory.createEvent(
UpdateFontDataEvent.class, this);
event.setMagnification(magnification);
dispatch(event);
lastScaleOnMagnify = null;
dirty = true;
}
}
@ -172,11 +176,8 @@ public class DispatchingFont extends DispatchingObject<IFont> implements IFont {
wrappedObject.setMagnification(magnification, scaleFont);
if (lastMagnification != magnification) {
lastMagnification = magnification;
UpdateFontDataEvent event = RemoteGraphicsEventFactory.createEvent(
UpdateFontDataEvent.class, this);
event.setScaleFont(scaleFont);
event.setMagnification(magnification);
dispatch(event);
lastScaleOnMagnify = scaleFont;
dirty = true;
}
}
@ -196,10 +197,7 @@ public class DispatchingFont extends DispatchingObject<IFont> implements IFont {
wrappedObject.setSmoothing(smooth);
if (lastSmoothing != smooth) {
lastSmoothing = smooth;
UpdateFontDataEvent event = RemoteGraphicsEventFactory.createEvent(
UpdateFontDataEvent.class, this);
event.setSmoothing(smooth);
dispatch(event);
dirty = true;
}
}
@ -227,11 +225,20 @@ public class DispatchingFont extends DispatchingObject<IFont> implements IFont {
wrappedObject.setScaleFont(scaleFont);
if (lastScaleFont != scaleFont) {
lastScaleFont = scaleFont;
UpdateFontDataEvent event = RemoteGraphicsEventFactory.createEvent(
UpdateFontDataEvent.class, this);
event.setScaleFont(scaleFont);
dispatch(event);
dirty = true;
}
}
public void flushState() {
if (dirty) {
UpdateFontDataEvent event = RemoteGraphicsEventFactory.createEvent(
UpdateFontDataEvent.class, this);
event.setMagnification(lastMagnification);
event.setScaleOnMagnify(lastScaleOnMagnify);
event.setScaleFont(lastScaleFont);
event.setSmoothing(lastSmoothing);
dispatch(event);
dirty = false;
}
}
}