Issue #239 Moved initialization code in GFE resources so recycle() works properly
Change-Id: I3a4e1f18a7246af504a6d1ce791bd94ab1f721d5 Former-commit-id:2374bc2d88
[formerly4c0a18894c
] [formerlye81a9ee935
] [formerly52a78af98c
[formerlye81a9ee935
[formerly 1f092691e6e43bd8f6d10c2b8fab0a68eca38992]]] Former-commit-id:52a78af98c
Former-commit-id: 2583d28f688819b8221f8f2dd83602f8e821e9da [formerly7b7e708092
] Former-commit-id:da46b6efc0
This commit is contained in:
parent
6b81141c34
commit
7c014c9fbe
6 changed files with 50 additions and 36 deletions
|
@ -291,6 +291,11 @@ public class CollaborationResource extends
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void renderFrameEvent(RenderFrameEvent event) {
|
public void renderFrameEvent(RenderFrameEvent event) {
|
||||||
|
if (dataManager == null) {
|
||||||
|
// Haven't initialized yet, don't process
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event instanceof UpdateRenderFrameEvent == false) {
|
if (event instanceof UpdateRenderFrameEvent == false) {
|
||||||
// Not an update event, new frame
|
// Not an update event, new frame
|
||||||
int objectId = event.getObjectId();
|
int objectId = event.getObjectId();
|
||||||
|
|
|
@ -77,6 +77,9 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private RGB boxColor;
|
private RGB boxColor;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private RGB shadowColor;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private double magnification = 1.0f;
|
private double magnification = 1.0f;
|
||||||
|
|
||||||
|
@ -103,6 +106,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
|
||||||
DrawStringEvent diffObject = new DrawStringEvent();
|
DrawStringEvent diffObject = new DrawStringEvent();
|
||||||
diffObject.alpha = diffEvent.alpha;
|
diffObject.alpha = diffEvent.alpha;
|
||||||
diffObject.boxColor = diffEvent.boxColor;
|
diffObject.boxColor = diffEvent.boxColor;
|
||||||
|
diffObject.shadowColor = diffEvent.shadowColor;
|
||||||
diffObject.xOrColors = diffEvent.xOrColors;
|
diffObject.xOrColors = diffEvent.xOrColors;
|
||||||
diffObject.fontId = diffEvent.fontId;
|
diffObject.fontId = diffEvent.fontId;
|
||||||
diffObject.magnification = diffEvent.magnification;
|
diffObject.magnification = diffEvent.magnification;
|
||||||
|
@ -140,6 +144,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
|
||||||
DrawStringEvent diffObject = (DrawStringEvent) diffEvent;
|
DrawStringEvent diffObject = (DrawStringEvent) diffEvent;
|
||||||
alpha = diffObject.alpha;
|
alpha = diffObject.alpha;
|
||||||
boxColor = diffObject.boxColor;
|
boxColor = diffObject.boxColor;
|
||||||
|
shadowColor = diffObject.shadowColor;
|
||||||
xOrColors = diffObject.xOrColors;
|
xOrColors = diffObject.xOrColors;
|
||||||
if (diffObject.colors != null) {
|
if (diffObject.colors != null) {
|
||||||
colors = diffObject.colors;
|
colors = diffObject.colors;
|
||||||
|
@ -169,6 +174,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
|
||||||
this.colors = string.getColors();
|
this.colors = string.getColors();
|
||||||
this.alpha = string.basics.alpha;
|
this.alpha = string.basics.alpha;
|
||||||
this.boxColor = string.boxColor;
|
this.boxColor = string.boxColor;
|
||||||
|
this.shadowColor = string.shadowColor;
|
||||||
this.xOrColors = string.basics.xOrColors;
|
this.xOrColors = string.basics.xOrColors;
|
||||||
this.horizontalAlignment = string.horizontalAlignment;
|
this.horizontalAlignment = string.horizontalAlignment;
|
||||||
this.verticalAlignment = string.verticallAlignment;
|
this.verticalAlignment = string.verticallAlignment;
|
||||||
|
@ -187,6 +193,7 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
|
||||||
ds.basics.alpha = alpha;
|
ds.basics.alpha = alpha;
|
||||||
ds.basics.xOrColors = xOrColors;
|
ds.basics.xOrColors = xOrColors;
|
||||||
ds.boxColor = boxColor;
|
ds.boxColor = boxColor;
|
||||||
|
ds.shadowColor = shadowColor;
|
||||||
ds.horizontalAlignment = horizontalAlignment;
|
ds.horizontalAlignment = horizontalAlignment;
|
||||||
ds.verticallAlignment = verticalAlignment;
|
ds.verticallAlignment = verticalAlignment;
|
||||||
ds.textStyle = textStyle;
|
ds.textStyle = textStyle;
|
||||||
|
@ -316,6 +323,21 @@ public class DrawStringEvent extends AbstractRemoteGraphicsRenderEvent {
|
||||||
this.boxColor = boxColor;
|
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
|
* @return the magnification
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class GLFont implements IGLFont {
|
||||||
|
|
||||||
public GLFont(File font, float fontSize, Style[] styles) {
|
public GLFont(File font, float fontSize, Style[] styles) {
|
||||||
try {
|
try {
|
||||||
|
this.fontName = font.getName();
|
||||||
this.font = Font.createFont(Font.TRUETYPE_FONT, font).deriveFont(
|
this.font = Font.createFont(Font.TRUETYPE_FONT, font).deriveFont(
|
||||||
fontSize);
|
fontSize);
|
||||||
this.currentFontSize = this.fontSize = fontSize;
|
this.currentFontSize = this.fontSize = fontSize;
|
||||||
|
|
|
@ -287,7 +287,6 @@ public class GFEResource extends
|
||||||
* @param dataManager
|
* @param dataManager
|
||||||
* the datamanager responsible for it
|
* the datamanager responsible for it
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public GFEResource(Parm parm, DataManager dataManager) {
|
public GFEResource(Parm parm, DataManager dataManager) {
|
||||||
super(new GFEResourceData(), new LoadProperties());
|
super(new GFEResourceData(), new LoadProperties());
|
||||||
this.resourceData.addChangeListener(this);
|
this.resourceData.addChangeListener(this);
|
||||||
|
@ -312,11 +311,6 @@ public class GFEResource extends
|
||||||
GridParmInfo info = this.parm.getGridInfo();
|
GridParmInfo info = this.parm.getGridInfo();
|
||||||
this.gridGeometry = MapUtil.getGridGeometry(info.getGridLoc());
|
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();
|
lastIscMode = dataManager.getParmManager().iscMode();
|
||||||
|
|
||||||
updateRightClickMenu();
|
updateRightClickMenu();
|
||||||
|
@ -338,10 +332,6 @@ public class GFEResource extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
dataManager.getNotificationRouter().addObserver(notificationObserver);
|
|
||||||
|
|
||||||
Message.registerInterest(this, ShowISCGridsMsg.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
@ -393,6 +383,7 @@ public class GFEResource extends
|
||||||
for (IWireframeShape shape : outlineShapes.values()) {
|
for (IWireframeShape shape : outlineShapes.values()) {
|
||||||
shape.dispose();
|
shape.dispose();
|
||||||
}
|
}
|
||||||
|
outlineShapes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shadedShapes != null) {
|
if (shadedShapes != null) {
|
||||||
|
@ -402,6 +393,7 @@ public class GFEResource extends
|
||||||
shadedShape.dispose();
|
shadedShape.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
shadedShapes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
dataManager.getNotificationRouter()
|
dataManager.getNotificationRouter()
|
||||||
|
@ -414,13 +406,16 @@ public class GFEResource extends
|
||||||
|
|
||||||
if (this.gridDisplay != null) {
|
if (this.gridDisplay != null) {
|
||||||
this.gridDisplay.dispose();
|
this.gridDisplay.dispose();
|
||||||
|
this.gridDisplay = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.contourDisplay != null) {
|
if (this.contourDisplay != null) {
|
||||||
this.contourDisplay.dispose();
|
this.contourDisplay.dispose();
|
||||||
|
this.contourDisplay = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearVectorDisplays();
|
clearVectorDisplays();
|
||||||
|
lastDisplayedTime = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearVectorDisplays() {
|
private void clearVectorDisplays() {
|
||||||
|
@ -448,8 +443,17 @@ public class GFEResource extends
|
||||||
* @seecom.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
|
* @seecom.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
|
||||||
* IGraphicsTarget)
|
* IGraphicsTarget)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
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
|
// Get the font configured for this parm type
|
||||||
String fontPrefName = "";
|
String fontPrefName = "";
|
||||||
|
@ -461,10 +465,6 @@ public class GFEResource extends
|
||||||
fontPrefName = "BoundedArea_font";
|
fontPrefName = "BoundedArea_font";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfeFont != null) {
|
|
||||||
gfeFont.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
gfeFont = GFEFonts.makeGFEIFont(target, fontPrefName, 2);
|
gfeFont = GFEFonts.makeGFEIFont(target, fontPrefName, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,9 +106,6 @@ public class GFESystemResource extends
|
||||||
this.dataManager = dataManager;
|
this.dataManager = dataManager;
|
||||||
this.editTools = new HashSet<AbstractGFEEditTool>();
|
this.editTools = new HashSet<AbstractGFEEditTool>();
|
||||||
this.persistentRenderables = new HashSet<IRenderable>();
|
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();
|
((SampleRenderable) r).dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.persistentRenderables.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -147,7 +145,8 @@ public class GFESystemResource extends
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
|
// The following renderables are always ready
|
||||||
|
this.persistentRenderables.add(new SampleRenderable());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -355,7 +355,11 @@ public class GFEColorbarResource extends
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
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();
|
IDisplayPaneContainer container = getResourceContainer();
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
|
@ -379,23 +383,6 @@ public class GFEColorbarResource extends
|
||||||
return;
|
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();
|
IExtent screenExtent = paintProps.getView().getExtent();
|
||||||
|
|
||||||
// Construct a bar that is 25 pixels high
|
// Construct a bar that is 25 pixels high
|
||||||
|
|
Loading…
Add table
Reference in a new issue