Issue #239 Moved initialization code in GFE resources so recycle() works properly

Change-Id: I3a4e1f18a7246af504a6d1ce791bd94ab1f721d5

Former-commit-id: 4c0a18894c [formerly e81a9ee935] [formerly 4c0a18894c [formerly e81a9ee935] [formerly 52a78af98c [formerly 1f092691e6e43bd8f6d10c2b8fab0a68eca38992]]]
Former-commit-id: 52a78af98c
Former-commit-id: da46b6efc0 [formerly 7b7e708092]
Former-commit-id: 4e9971aac6
This commit is contained in:
Max Schenkelberg 2012-05-22 09:56:27 -05:00
parent 501783794b
commit 2d9ccfe9ce
6 changed files with 50 additions and 36 deletions

View file

@ -291,6 +291,11 @@ public class CollaborationResource extends
@Subscribe
public void renderFrameEvent(RenderFrameEvent event) {
if (dataManager == null) {
// Haven't initialized yet, don't process
return;
}
if (event instanceof UpdateRenderFrameEvent == false) {
// Not an update event, new frame
int objectId = event.getObjectId();

View file

@ -77,6 +77,9 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
@DynamicSerializeElement
private RGB boxColor;
@DynamicSerializeElement
private RGB shadowColor;
@DynamicSerializeElement
private double magnification = 1.0f;
@ -103,6 +106,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
DrawStringEvent diffObject = new DrawStringEvent();
diffObject.alpha = diffEvent.alpha;
diffObject.boxColor = diffEvent.boxColor;
diffObject.shadowColor = diffEvent.shadowColor;
diffObject.xOrColors = diffEvent.xOrColors;
diffObject.fontId = diffEvent.fontId;
diffObject.magnification = diffEvent.magnification;
@ -140,6 +144,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
DrawStringEvent diffObject = (DrawStringEvent) diffEvent;
alpha = diffObject.alpha;
boxColor = diffObject.boxColor;
shadowColor = diffObject.shadowColor;
xOrColors = diffObject.xOrColors;
if (diffObject.colors != null) {
colors = diffObject.colors;
@ -169,6 +174,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
this.colors = string.getColors();
this.alpha = string.basics.alpha;
this.boxColor = string.boxColor;
this.shadowColor = string.shadowColor;
this.xOrColors = string.basics.xOrColors;
this.horizontalAlignment = string.horizontalAlignment;
this.verticalAlignment = string.verticallAlignment;
@ -187,6 +193,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
ds.basics.alpha = alpha;
ds.basics.xOrColors = xOrColors;
ds.boxColor = boxColor;
ds.shadowColor = shadowColor;
ds.horizontalAlignment = horizontalAlignment;
ds.verticallAlignment = verticalAlignment;
ds.textStyle = textStyle;
@ -316,6 +323,21 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
this.boxColor = boxColor;
}
/**
* @return the shadowColor
*/
public RGB getShadowColor() {
return shadowColor;
}
/**
* @param shadowColor
* the shadowColor to set
*/
public void setShadowColor(RGB shadowColor) {
this.shadowColor = shadowColor;
}
/**
* @return the magnification
*/

View file

@ -73,6 +73,7 @@ public class GLFont implements IGLFont {
public GLFont(File font, float fontSize, Style[] styles) {
try {
this.fontName = font.getName();
this.font = Font.createFont(Font.TRUETYPE_FONT, font).deriveFont(
fontSize);
this.currentFontSize = this.fontSize = fontSize;

View file

@ -287,7 +287,6 @@ public class GFEResource extends
* @param dataManager
* the datamanager responsible for it
*/
@SuppressWarnings("unchecked")
public GFEResource(Parm parm, DataManager dataManager) {
super(new GFEResourceData(), new LoadProperties());
this.resourceData.addChangeListener(this);
@ -312,11 +311,6 @@ public class GFEResource extends
GridParmInfo info = this.parm.getGridInfo();
this.gridGeometry = MapUtil.getGridGeometry(info.getGridLoc());
parm.getListeners().addGridChangedListener(this.gridChanged);
parm.getListeners().addParmInventoryChangedListener(
this.parmInventoryChanged);
parm.getListeners().addParmIDChangedListener(this.parmIdChanged);
lastIscMode = dataManager.getParmManager().iscMode();
updateRightClickMenu();
@ -338,10 +332,6 @@ public class GFEResource extends
}
}
};
dataManager.getNotificationRouter().addObserver(notificationObserver);
Message.registerInterest(this, ShowISCGridsMsg.class);
}
public void reset() {
@ -393,6 +383,7 @@ public class GFEResource extends
for (IWireframeShape shape : outlineShapes.values()) {
shape.dispose();
}
outlineShapes.clear();
}
if (shadedShapes != null) {
@ -402,6 +393,7 @@ public class GFEResource extends
shadedShape.dispose();
}
}
shadedShapes.clear();
}
dataManager.getNotificationRouter()
@ -414,13 +406,16 @@ public class GFEResource extends
if (this.gridDisplay != null) {
this.gridDisplay.dispose();
this.gridDisplay = null;
}
if (this.contourDisplay != null) {
this.contourDisplay.dispose();
this.contourDisplay = null;
}
clearVectorDisplays();
lastDisplayedTime = null;
}
private void clearVectorDisplays() {
@ -448,8 +443,17 @@ public class GFEResource extends
* @seecom.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
* IGraphicsTarget)
*/
@SuppressWarnings("unchecked")
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
parm.getListeners().addGridChangedListener(this.gridChanged);
parm.getListeners().addParmInventoryChangedListener(
this.parmInventoryChanged);
parm.getListeners().addParmIDChangedListener(this.parmIdChanged);
dataManager.getNotificationRouter().addObserver(notificationObserver);
Message.registerInterest(this, ShowISCGridsMsg.class);
// Get the font configured for this parm type
String fontPrefName = "";
@ -461,10 +465,6 @@ public class GFEResource extends
fontPrefName = "BoundedArea_font";
}
if (gfeFont != null) {
gfeFont.dispose();
}
gfeFont = GFEFonts.makeGFEIFont(target, fontPrefName, 2);
}

View file

@ -106,9 +106,6 @@ public class GFESystemResource extends
this.dataManager = dataManager;
this.editTools = new HashSet<AbstractGFEEditTool>();
this.persistentRenderables = new HashSet<IRenderable>();
// The following renderables are always ready
this.persistentRenderables.add(new SampleRenderable());
}
/*
@ -127,6 +124,7 @@ public class GFESystemResource extends
((SampleRenderable) r).dispose();
}
}
this.persistentRenderables.clear();
}
/*
@ -147,7 +145,8 @@ public class GFESystemResource extends
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
// The following renderables are always ready
this.persistentRenderables.add(new SampleRenderable());
}
/**

View file

@ -355,7 +355,11 @@ public class GFEColorbarResource extends
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
// this.target = target;
colorbarScaleFont = GFEFonts.makeGFEIFont(target, "ColorBarScale_font",
1);
colorbarWxLabelFont = GFEFonts.makeGFEIFont(target,
"ColorBarWxLabel_font", 2);
pickupFont = GFEFonts.makeGFEIFont(target, "ColorBarPickUp_font", 3);
IDisplayPaneContainer container = getResourceContainer();
if (container != null) {
@ -379,23 +383,6 @@ public class GFEColorbarResource extends
return;
}
// int curIndex = this.descriptor.getCurrentTimeFrame();
if (colorbarScaleFont == null) {
colorbarScaleFont = GFEFonts.makeGFEIFont(target,
"ColorBarScale_font", 1);
}
if (colorbarWxLabelFont == null) {
colorbarWxLabelFont = GFEFonts.makeGFEIFont(target,
"ColorBarWxLabel_font", 2);
}
if (pickupFont == null) {
pickupFont = GFEFonts
.makeGFEIFont(target, "ColorBarPickUp_font", 3);
}
IExtent screenExtent = paintProps.getView().getExtent();
// Construct a bar that is 25 pixels high