Issue #628 added PgenResourceGhost to track the gl ghost draw objects.
Former-commit-id:b0c29466de
[formerly3799026523
] [formerlybef2bfa7cc
[formerly 237309aab32cdb36703dbe62d2cfe102b3197863]] Former-commit-id:bef2bfa7cc
Former-commit-id:23ede5fa7b
This commit is contained in:
parent
927fd978b4
commit
be195ab805
12 changed files with 189 additions and 48 deletions
|
@ -1930,7 +1930,7 @@ public class GLTarget implements IGLTarget {
|
|||
@Override
|
||||
public BufferedImage screenshot() {
|
||||
|
||||
makeContextCurrent();
|
||||
boolean needsRelease = makeContextCurrent();
|
||||
if (theCanvas != null) {
|
||||
theCanvas.swapBuffers();
|
||||
}
|
||||
|
@ -1941,7 +1941,9 @@ public class GLTarget implements IGLTarget {
|
|||
theCanvas.swapBuffers();
|
||||
}
|
||||
|
||||
releaseContext();
|
||||
if (needsRelease) {
|
||||
releaseContext();
|
||||
}
|
||||
return bi;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="jaxen-1.1-beta-7.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="dom4j-1.6.1.jar" sourcepath="org.dom4jsrc.zip"/>
|
||||
|
|
|
@ -4,6 +4,7 @@ Bundle-Name: Dom4j Plug-in
|
|||
Bundle-SymbolicName: org.dom4j
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-ClassPath: dom4j-1.6.1.jar,
|
||||
jaxen-1.1-beta-7.jar,
|
||||
.
|
||||
Export-Package: org.dom4j,
|
||||
org.dom4j.bean,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
dom4j-1.6.1.jar
|
||||
dom4j-1.6.1.jar,\
|
||||
jaxen-1.1-beta-7.jar
|
||||
|
|
BIN
cots/org.dom4j/jaxen-1.1-beta-7.jar
Normal file
BIN
cots/org.dom4j/jaxen-1.1-beta-7.jar
Normal file
Binary file not shown.
|
@ -509,8 +509,8 @@
|
|||
name="NMAP Views"/>
|
||||
<view
|
||||
category="gov.noaa.nws.ncep.viz.ui.nmap"
|
||||
allowMultiple="false"
|
||||
restorable="true"
|
||||
allowMultiple="true"
|
||||
restorable="false"
|
||||
class="gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow"
|
||||
id="gov.noaa.nws.ncep.ui.PGEN"
|
||||
name="PGEN"/>
|
||||
|
|
|
@ -88,6 +88,17 @@ public abstract class AbstractElementContainer {
|
|||
public abstract void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayProperties dprops);
|
||||
|
||||
/**
|
||||
* Draws to the given graphics target. Recreates the IDisplayable objects, if
|
||||
* necessary.
|
||||
* @param target
|
||||
* @param paintProps
|
||||
* @param dprops PGEN Layer properties
|
||||
* @param needsCreate
|
||||
*/
|
||||
public abstract void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayProperties dprops, boolean needsCreate);
|
||||
|
||||
/**
|
||||
* Uses a DisplayElementFactory to create IDisplayable objects from the Drawable Element
|
||||
* @param paintProps
|
||||
|
@ -95,7 +106,7 @@ public abstract class AbstractElementContainer {
|
|||
protected void createDisplayables(PaintProperties paintProps) {
|
||||
|
||||
//Cleanup first
|
||||
if ( (displayEls!=null) && !displayEls.isEmpty() ) dispose();
|
||||
if ( (displayEls!=null) && !displayEls.isEmpty() ) reset();
|
||||
if ( element instanceof IAvnText ) {
|
||||
displayEls = def.createDisplayElements( (IAvnText) element, paintProps );
|
||||
}
|
||||
|
@ -145,6 +156,10 @@ public abstract class AbstractElementContainer {
|
|||
}
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
def.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases the resources held by any of the IDisplayables
|
||||
*/
|
||||
|
@ -157,6 +172,10 @@ public abstract class AbstractElementContainer {
|
|||
}
|
||||
displayEls.clear();
|
||||
}
|
||||
|
||||
public void setElement(DrawableElement el) {
|
||||
this.element = el;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -44,8 +44,17 @@ public class DefaultElementContainer extends AbstractElementContainer {
|
|||
@Override
|
||||
public void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayProperties dprops) {
|
||||
|
||||
boolean needsCreate = false;
|
||||
draw(target, paintProps, dprops, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draws to the given graphics target. Recreates the IDisplayable objects if zooming or
|
||||
* if the Layer properties change.
|
||||
* @see gov.noaa.nws.ncep.ui.pgen.display.AbstractTBNL#draw(com.raytheon.uf.viz.core.IGraphicsTarget, com.raytheon.uf.viz.core.drawables.PaintProperties, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayProperties dprops, boolean needsCreate) {
|
||||
|
||||
if ( (displayEls == null) || paintProps.isZooming() ) needsCreate = true;
|
||||
|
||||
|
|
|
@ -4632,4 +4632,20 @@ public class DisplayElementFactory {
|
|||
return new Line(null, new Color[]{color},1.5f,.5,false,
|
||||
false, pts, 0, null,"Lines","LINE_SOLID");
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (ss != null) {
|
||||
ss.reset();
|
||||
}
|
||||
if (sym != null) {
|
||||
sym.reset();
|
||||
}
|
||||
if (wfs != null) {
|
||||
for (IWireframeShape shape : wfs) {
|
||||
if (shape != null) {
|
||||
shape.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,17 @@ public class RasterElementContainer extends AbstractElementContainer {
|
|||
@Override
|
||||
public void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayProperties dprops) {
|
||||
draw(target, paintProps, dprops, false);
|
||||
}
|
||||
|
||||
boolean needsCreate = false;
|
||||
/*
|
||||
* Draws to the given graphics target. Recreates the IDisplayable objects
|
||||
* if the Layer properties change.
|
||||
* @see gov.noaa.nws.ncep.ui.pgen.display.AbstractTBNL#draw(com.raytheon.uf.viz.core.IGraphicsTarget, com.raytheon.uf.viz.core.drawables.PaintProperties, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void draw(IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayProperties dprops, boolean needsCreate) {
|
||||
|
||||
if ( displayEls == null ) needsCreate = true;
|
||||
|
||||
|
|
|
@ -142,7 +142,8 @@ public class PgenResource extends AbstractVizResource<PgenResourceData,MapDescri
|
|||
/**
|
||||
* Ghost line for multi-point element.
|
||||
*/
|
||||
private AbstractDrawableComponent ghost = null;
|
||||
// private AbstractDrawableComponent ghost = null;
|
||||
PgenResourceGhost ghost = null;
|
||||
|
||||
/*
|
||||
* List of elements that should be displayed in "selected" mode
|
||||
|
@ -311,7 +312,7 @@ public class PgenResource extends AbstractVizResource<PgenResourceData,MapDescri
|
|||
|
||||
drawProduct( target, paintProps );
|
||||
if ( elSelected != null ) drawSelected( target, paintProps);
|
||||
if ( ghost != null ) drawGhost( target, paintProps, df);
|
||||
if ( ghost != null ) ghost.draw(target, paintProps, df, descriptor);
|
||||
|
||||
// Save current graphics target for possible future reminder
|
||||
if ( saveOnNextPaint ) {
|
||||
|
@ -450,7 +451,11 @@ public class PgenResource extends AbstractVizResource<PgenResourceData,MapDescri
|
|||
*/
|
||||
public void setGhostLine(AbstractDrawableComponent ghost) {
|
||||
|
||||
this.ghost = ghost;
|
||||
if (this.ghost == null) {
|
||||
this.ghost = new PgenResourceGhost();
|
||||
}
|
||||
// this.ghost = ghost;
|
||||
this.ghost.setGhostLine(ghost);
|
||||
|
||||
}
|
||||
|
||||
|
@ -463,25 +468,6 @@ public class PgenResource extends AbstractVizResource<PgenResourceData,MapDescri
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates displayables for an element using an ElementContainer and call the
|
||||
* displayables' draw() method to draw the element.
|
||||
* @param target Graphic target
|
||||
* @param paintProps Paint properties
|
||||
* @param df Display element factory
|
||||
* @param el Input drawable element
|
||||
*/
|
||||
private void drawElement( IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayElementFactory df, DrawableElement el ){
|
||||
|
||||
AbstractElementContainer dispEl = null;
|
||||
|
||||
dispEl = new DefaultElementContainer(el, descriptor, target);
|
||||
dispEl.draw(target, paintProps, null);
|
||||
dispEl.dispose();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the nearest element in the products to the input point.
|
||||
* @param point
|
||||
|
@ -712,23 +698,6 @@ public class PgenResource extends AbstractVizResource<PgenResourceData,MapDescri
|
|||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Draw the ghost
|
||||
* @param target
|
||||
* @param paintProps
|
||||
* @param df
|
||||
*/
|
||||
private void drawGhost( IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayElementFactory df ){
|
||||
|
||||
df.setLayerDisplayAttr( false, null, false );
|
||||
|
||||
Iterator<DrawableElement> iterator = ghost.createDEIterator();
|
||||
while ( iterator.hasNext()){
|
||||
drawElement( target, paintProps, df, iterator.next() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected element to the input element.
|
||||
* @param element
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
/**
|
||||
* 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 gov.noaa.nws.ncep.ui.pgen.rsc;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.AbstractElementContainer;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.DefaultElementContainer;
|
||||
import gov.noaa.nws.ncep.ui.pgen.display.DisplayElementFactory;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
|
||||
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
|
||||
/**
|
||||
* Ghost drawing for the pgen resource.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 15, 2012 bgonzale Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bgonzale
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PgenResourceGhost {
|
||||
public AbstractDrawableComponent component;
|
||||
Map<Object, AbstractElementContainer> componentMap = new HashMap<Object, AbstractElementContainer>();
|
||||
|
||||
/**
|
||||
* Draw the ghost
|
||||
* @param target
|
||||
* @param paintProps
|
||||
* @param df
|
||||
* @param descriptor
|
||||
*/
|
||||
public void draw( IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayElementFactory df, IMapDescriptor descriptor){
|
||||
df.setLayerDisplayAttr( false, null, false );
|
||||
if (component != null) {
|
||||
Iterator<DrawableElement> iterator = component
|
||||
.createDEIterator();
|
||||
int count = 0;
|
||||
while (iterator.hasNext()) {
|
||||
DrawableElement element = iterator.next();
|
||||
drawElement(target, paintProps, df, element, descriptor);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates displayables for an element using an ElementContainer and call the
|
||||
* displayables' draw() method to draw the element.
|
||||
* @param target Graphic target
|
||||
* @param paintProps Paint properties
|
||||
* @param df Display element factory
|
||||
* @param el Input drawable element
|
||||
* @praram descriptor
|
||||
*/
|
||||
private void drawElement( IGraphicsTarget target, PaintProperties paintProps,
|
||||
DisplayElementFactory df, DrawableElement el, IMapDescriptor descriptor){
|
||||
Object key = createKey(el);
|
||||
AbstractElementContainer graphic = componentMap.get(key);
|
||||
|
||||
if (graphic == null) {
|
||||
graphic = new DefaultElementContainer(el, descriptor, target);
|
||||
componentMap.put(key, graphic);
|
||||
} else {
|
||||
graphic.setElement(el);
|
||||
}
|
||||
graphic.draw(target, paintProps, null, true);
|
||||
}
|
||||
|
||||
private Object createKey(DrawableElement el) {
|
||||
return el.getPgenCategory()+ ":"+el.getPgenType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ghost line for the PGEN drawing layer.
|
||||
* @param ghost
|
||||
*/
|
||||
public void setGhostLine(AbstractDrawableComponent ghost) {
|
||||
this.component = ghost;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue