diff --git a/libs.bsf/META-INF/MANIFEST.MF b/libs.bsf/META-INF/MANIFEST.MF index 6839658b7..eeee7ef3f 100644 --- a/libs.bsf/META-INF/MANIFEST.MF +++ b/libs.bsf/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast libs bsf Bundle-SymbolicName: libs.bsf -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: lib/bsf.jar, lib/bsh-2.0b4.jar Export-Package: bsh, diff --git a/libs.bsf/plugin_jpf.xml b/libs.bsf/plugin_jpf.xml index 5c85c2e0b..8bd07ae7b 100644 --- a/libs.bsf/plugin_jpf.xml +++ b/libs.bsf/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/libs.ext/.classpath b/libs.ext/.classpath index 88683b556..3115a9718 100644 --- a/libs.ext/.classpath +++ b/libs.ext/.classpath @@ -1,42 +1,42 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs.ext/META-INF/MANIFEST.MF b/libs.ext/META-INF/MANIFEST.MF index 2f4753cd8..daf7aa97f 100644 --- a/libs.ext/META-INF/MANIFEST.MF +++ b/libs.ext/META-INF/MANIFEST.MF @@ -2,17 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast libs ext Bundle-SymbolicName: libs.ext -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: lib/clibwrapper_jiio.jar, lib/gluegen-rt.jar, - lib/j3dcore.jar, - lib/j3dutils.jar, lib/jai_codec.jar, lib/jai_core.jar, lib/jai_imageio.jar, - lib/jogl-all.jar, lib/mlibwrapper_jai.jar, - lib/vecmath.jar, lib/batik-anim-1.8.jar, lib/batik-awt-util-1.8.jar, lib/batik-bridge-1.8.jar, @@ -33,7 +29,11 @@ Bundle-ClassPath: lib/clibwrapper_jiio.jar, lib/batik-xml-1.8.jar, lib/xml-apis-1.3.04.jar, lib/xmlgraphics-commons-2.0.jar, - lib/xml-apis-ext-1.3.04.jar + lib/xml-apis-ext-1.3.04.jar, + lib/jogl-all.jar, + lib/j3dcore.jar, + lib/j3dutils.jar, + lib/vecmath.jar Export-Package: com.jogamp.common, com.jogamp.common.jvm, com.jogamp.common.net, @@ -55,8 +55,11 @@ Export-Package: com.jogamp.common, com.jogamp.nativewindow, com.jogamp.nativewindow.awt, com.jogamp.nativewindow.egl, + com.jogamp.nativewindow.ios, + com.jogamp.nativewindow.javafx, com.jogamp.nativewindow.macosx, com.jogamp.nativewindow.swt, + com.jogamp.nativewindow.util, com.jogamp.nativewindow.windows, com.jogamp.nativewindow.x11, com.jogamp.newt, @@ -64,11 +67,20 @@ Export-Package: com.jogamp.common, com.jogamp.newt.awt.applet, com.jogamp.newt.event, com.jogamp.newt.event.awt, + com.jogamp.newt.javafx, com.jogamp.newt.opengl, + com.jogamp.newt.opengl.util, + com.jogamp.newt.opengl.util.stereo, com.jogamp.newt.swt, com.jogamp.newt.util, com.jogamp.newt.util.applet, com.jogamp.opengl, + com.jogamp.opengl.awt, + com.jogamp.opengl.egl, + com.jogamp.opengl.fixedfunc, + com.jogamp.opengl.glu, + com.jogamp.opengl.glu.gl2, + com.jogamp.opengl.glu.gl2es1, com.jogamp.opengl.math, com.jogamp.opengl.math.geom, com.jogamp.opengl.swt, @@ -81,46 +93,11 @@ Export-Package: com.jogamp.common, com.jogamp.opengl.util.glsl.sdk, com.jogamp.opengl.util.packrect, com.jogamp.opengl.util.stereo, + com.jogamp.opengl.util.stereo.generic, com.jogamp.opengl.util.texture, com.jogamp.opengl.util.texture.awt, com.jogamp.opengl.util.texture.spi, com.jogamp.opengl.util.texture.spi.awt, - com.sun.j3d.audioengines, - com.sun.j3d.audioengines.javasound, - com.sun.j3d.exp.swing, - com.sun.j3d.exp.swing.impl, - com.sun.j3d.internal, - com.sun.j3d.loaders, - com.sun.j3d.loaders.lw3d, - com.sun.j3d.loaders.objectfile, - com.sun.j3d.utils.applet, - com.sun.j3d.utils.audio, - com.sun.j3d.utils.behaviors.interpolators, - com.sun.j3d.utils.behaviors.keyboard, - com.sun.j3d.utils.behaviors.mouse, - com.sun.j3d.utils.behaviors.picking, - com.sun.j3d.utils.behaviors.sensor, - com.sun.j3d.utils.behaviors.vp, - com.sun.j3d.utils.compression, - com.sun.j3d.utils.geometry, - com.sun.j3d.utils.geometry.compression, - com.sun.j3d.utils.image, - com.sun.j3d.utils.pickfast, - com.sun.j3d.utils.pickfast.behaviors, - com.sun.j3d.utils.picking, - com.sun.j3d.utils.picking.behaviors, - com.sun.j3d.utils.scenegraph.io, - com.sun.j3d.utils.scenegraph.io.retained, - com.sun.j3d.utils.scenegraph.io.state.com.sun.j3d.utils.behaviors.interpolators, - com.sun.j3d.utils.scenegraph.io.state.com.sun.j3d.utils.behaviors.mouse, - com.sun.j3d.utils.scenegraph.io.state.com.sun.j3d.utils.geometry, - com.sun.j3d.utils.scenegraph.io.state.com.sun.j3d.utils.image, - com.sun.j3d.utils.scenegraph.io.state.com.sun.j3d.utils.universe, - com.sun.j3d.utils.scenegraph.io.state.javax.media.j3d, - com.sun.j3d.utils.scenegraph.transparency, - com.sun.j3d.utils.shader, - com.sun.j3d.utils.timer, - com.sun.j3d.utils.universe, com.sun.media.imageio.plugins.bmp, com.sun.media.imageio.plugins.jpeg2000, com.sun.media.imageio.plugins.pnm, @@ -159,7 +136,6 @@ Export-Package: com.jogamp.common, com.sun.medialib.codec.jpeg, com.sun.medialib.codec.png, com.sun.medialib.mlib, - javax.media.j3d, javax.media.jai, javax.media.jai.iterator, javax.media.jai.operator, @@ -168,15 +144,6 @@ Export-Package: com.jogamp.common, javax.media.jai.tilecodec, javax.media.jai.util, javax.media.jai.widget, - javax.media.nativewindow, - javax.media.nativewindow.util, - javax.media.opengl, - javax.media.opengl.awt, - javax.media.opengl.fixedfunc, - javax.media.opengl.glu, - javax.media.opengl.glu.gl2, - javax.media.opengl.glu.gl2es1, - javax.vecmath, jj2000.j2k, jj2000.j2k.codestream, jj2000.j2k.codestream.reader, @@ -206,6 +173,7 @@ Export-Package: com.jogamp.common, jogamp.common.jvm, jogamp.common.os, jogamp.common.os.elf, + jogamp.common.util, jogamp.common.util.locks, jogamp.graph.curve.opengl, jogamp.graph.curve.opengl.shader, @@ -220,6 +188,8 @@ Export-Package: com.jogamp.common, jogamp.graph.geom.plane, jogamp.nativewindow, jogamp.nativewindow.awt, + jogamp.nativewindow.drm, + jogamp.nativewindow.ios, jogamp.nativewindow.jawt, jogamp.nativewindow.jawt.macosx, jogamp.nativewindow.jawt.windows, @@ -234,12 +204,15 @@ Export-Package: com.jogamp.common, jogamp.newt.driver, jogamp.newt.driver.awt, jogamp.newt.driver.bcm.vc.iv, + jogamp.newt.driver.egl.gbm, + jogamp.newt.driver.ios, jogamp.newt.driver.linux, jogamp.newt.driver.macosx, jogamp.newt.driver.opengl, jogamp.newt.driver.windows, jogamp.newt.driver.x11, jogamp.newt.event, + jogamp.newt.javafx, jogamp.newt.swt, jogamp.newt.swt.event, jogamp.opengl, @@ -256,6 +229,7 @@ Export-Package: com.jogamp.common, jogamp.opengl.glu.nurbs, jogamp.opengl.glu.registry, jogamp.opengl.glu.tessellator, + jogamp.opengl.ios.eagl, jogamp.opengl.macosx.cgl, jogamp.opengl.macosx.cgl.awt, jogamp.opengl.openal.av, @@ -267,6 +241,7 @@ Export-Package: com.jogamp.common, jogamp.opengl.util.jpeg, jogamp.opengl.util.pngj, jogamp.opengl.util.pngj.chunks, + jogamp.opengl.util.stereo, jogamp.opengl.windows.wgl, jogamp.opengl.windows.wgl.awt, jogamp.opengl.x11.glx, @@ -373,6 +348,46 @@ Export-Package: com.jogamp.common, org.apache.xmlgraphics.xmp, org.apache.xmlgraphics.xmp.merge, org.apache.xmlgraphics.xmp.schemas, - org.apache.xmlgraphics.xmp.schemas.pdf + org.apache.xmlgraphics.xmp.schemas.pdf, + org.jogamp.java3d, + org.jogamp.java3d.audioengines, + org.jogamp.java3d.audioengines.javasound, + org.jogamp.java3d.exp.swing, + org.jogamp.java3d.exp.swing.impl, + org.jogamp.java3d.internal, + org.jogamp.java3d.loaders, + org.jogamp.java3d.loaders.lw3d, + org.jogamp.java3d.loaders.objectfile, + org.jogamp.java3d.utils.applet, + org.jogamp.java3d.utils.audio, + org.jogamp.java3d.utils.behaviors.interpolators, + org.jogamp.java3d.utils.behaviors.keyboard, + org.jogamp.java3d.utils.behaviors.mouse, + org.jogamp.java3d.utils.behaviors.picking, + org.jogamp.java3d.utils.behaviors.sensor, + org.jogamp.java3d.utils.behaviors.vp, + org.jogamp.java3d.utils.compression, + org.jogamp.java3d.utils.geometry, + org.jogamp.java3d.utils.geometry.compression, + org.jogamp.java3d.utils.image, + org.jogamp.java3d.utils.pickfast, + org.jogamp.java3d.utils.pickfast.behaviors, + org.jogamp.java3d.utils.picking, + org.jogamp.java3d.utils.picking.behaviors, + org.jogamp.java3d.utils.scenegraph.io, + org.jogamp.java3d.utils.scenegraph.io.retained, + org.jogamp.java3d.utils.scenegraph.io.state.org.jogamp.java3d, + org.jogamp.java3d.utils.scenegraph.io.state.org.jogamp.java3d.utils.behaviors.interpolators, + org.jogamp.java3d.utils.scenegraph.io.state.org.jogamp.java3d.utils.behaviors.mouse, + org.jogamp.java3d.utils.scenegraph.io.state.org.jogamp.java3d.utils.geometry, + org.jogamp.java3d.utils.scenegraph.io.state.org.jogamp.java3d.utils.image, + org.jogamp.java3d.utils.scenegraph.io.state.org.jogamp.java3d.utils.universe, + org.jogamp.java3d.utils.scenegraph.transparency, + org.jogamp.java3d.utils.shader, + org.jogamp.java3d.utils.timer, + org.jogamp.java3d.utils.universe, + org.jogamp.vecmath, + org.w3c.css.sac, + org.w3c.css.sac.helpers Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: Argonne National Laboratory diff --git a/libs.ext/build.properties b/libs.ext/build.properties index 31bcf4607..6c0c524e5 100644 --- a/libs.ext/build.properties +++ b/libs.ext/build.properties @@ -3,14 +3,10 @@ bin.includes = META-INF/,\ lib/,\ lib/clibwrapper_jiio.jar,\ lib/gluegen-rt.jar,\ - lib/j3dcore.jar,\ - lib/j3dutils.jar,\ lib/jai_codec.jar,\ lib/jai_core.jar,\ lib/jai_imageio.jar,\ - lib/jogl-all.jar,\ lib/mlibwrapper_jai.jar,\ - lib/vecmath.jar,\ lib/batik-anim-1.8.jar,\ lib/batik-awt-util-1.8.jar,\ lib/batik-bridge-1.8.jar,\ @@ -31,4 +27,8 @@ bin.includes = META-INF/,\ lib/batik-xml-1.8.jar,\ lib/xml-apis-1.3.04.jar,\ lib/xmlgraphics-commons-2.0.jar,\ - lib/xml-apis-ext-1.3.04.jar + lib/xml-apis-ext-1.3.04.jar,\ + lib/jogl-all.jar,\ + lib/j3dcore.jar,\ + lib/j3dutils.jar,\ + lib/vecmath.jar diff --git a/libs.ext/lib/gluegen-rt-natives-linux-amd64.jar b/libs.ext/lib/gluegen-rt-natives-linux-amd64.jar index 155be9ef5..826d6d6fa 100644 Binary files a/libs.ext/lib/gluegen-rt-natives-linux-amd64.jar and b/libs.ext/lib/gluegen-rt-natives-linux-amd64.jar differ diff --git a/libs.ext/lib/gluegen-rt-natives-linux-i586.jar b/libs.ext/lib/gluegen-rt-natives-linux-i586.jar index 53fd42b8b..ac9182c46 100644 Binary files a/libs.ext/lib/gluegen-rt-natives-linux-i586.jar and b/libs.ext/lib/gluegen-rt-natives-linux-i586.jar differ diff --git a/libs.ext/lib/gluegen-rt-natives-macosx-universal.jar b/libs.ext/lib/gluegen-rt-natives-macosx-universal.jar index 7816f2569..79bd94ee6 100644 Binary files a/libs.ext/lib/gluegen-rt-natives-macosx-universal.jar and b/libs.ext/lib/gluegen-rt-natives-macosx-universal.jar differ diff --git a/libs.ext/lib/gluegen-rt-natives-windows-amd64.jar b/libs.ext/lib/gluegen-rt-natives-windows-amd64.jar index e3c6cd1f9..2d1fe1411 100644 Binary files a/libs.ext/lib/gluegen-rt-natives-windows-amd64.jar and b/libs.ext/lib/gluegen-rt-natives-windows-amd64.jar differ diff --git a/libs.ext/lib/gluegen-rt-natives-windows-i586.jar b/libs.ext/lib/gluegen-rt-natives-windows-i586.jar index 2b3c0fe59..a0c69317c 100644 Binary files a/libs.ext/lib/gluegen-rt-natives-windows-i586.jar and b/libs.ext/lib/gluegen-rt-natives-windows-i586.jar differ diff --git a/libs.ext/lib/gluegen-rt.jar b/libs.ext/lib/gluegen-rt.jar index 62b2071a7..aef08ef85 100644 Binary files a/libs.ext/lib/gluegen-rt.jar and b/libs.ext/lib/gluegen-rt.jar differ diff --git a/libs.ext/lib/j3dcore.jar b/libs.ext/lib/j3dcore.jar index f2e02139b..0fe25ff03 100644 Binary files a/libs.ext/lib/j3dcore.jar and b/libs.ext/lib/j3dcore.jar differ diff --git a/libs.ext/lib/j3dutils.jar b/libs.ext/lib/j3dutils.jar index 2a9b6c8ce..ea05f64cb 100644 Binary files a/libs.ext/lib/j3dutils.jar and b/libs.ext/lib/j3dutils.jar differ diff --git a/libs.ext/lib/jogl-all-natives-linux-amd64.jar b/libs.ext/lib/jogl-all-natives-linux-amd64.jar index 6b7143164..55953e236 100644 Binary files a/libs.ext/lib/jogl-all-natives-linux-amd64.jar and b/libs.ext/lib/jogl-all-natives-linux-amd64.jar differ diff --git a/libs.ext/lib/jogl-all-natives-linux-i586.jar b/libs.ext/lib/jogl-all-natives-linux-i586.jar index 29da99356..979fa3648 100644 Binary files a/libs.ext/lib/jogl-all-natives-linux-i586.jar and b/libs.ext/lib/jogl-all-natives-linux-i586.jar differ diff --git a/libs.ext/lib/jogl-all-natives-macosx-universal.jar b/libs.ext/lib/jogl-all-natives-macosx-universal.jar index 3fdb0cc28..124ef6d7e 100644 Binary files a/libs.ext/lib/jogl-all-natives-macosx-universal.jar and b/libs.ext/lib/jogl-all-natives-macosx-universal.jar differ diff --git a/libs.ext/lib/jogl-all-natives-windows-amd64.jar b/libs.ext/lib/jogl-all-natives-windows-amd64.jar index b8bd7bbd6..438425036 100644 Binary files a/libs.ext/lib/jogl-all-natives-windows-amd64.jar and b/libs.ext/lib/jogl-all-natives-windows-amd64.jar differ diff --git a/libs.ext/lib/jogl-all-natives-windows-i586.jar b/libs.ext/lib/jogl-all-natives-windows-i586.jar index f0988add9..63b5ade5a 100644 Binary files a/libs.ext/lib/jogl-all-natives-windows-i586.jar and b/libs.ext/lib/jogl-all-natives-windows-i586.jar differ diff --git a/libs.ext/lib/jogl-all.jar b/libs.ext/lib/jogl-all.jar index 8440b3dfc..dbbde557f 100644 Binary files a/libs.ext/lib/jogl-all.jar and b/libs.ext/lib/jogl-all.jar differ diff --git a/libs.ext/lib/vecmath.jar b/libs.ext/lib/vecmath.jar index 5a748607a..7ec3323a1 100644 Binary files a/libs.ext/lib/vecmath.jar and b/libs.ext/lib/vecmath.jar differ diff --git a/libs.ext/plugin_jpf.xml b/libs.ext/plugin_jpf.xml index 7e3adf188..02178353a 100644 --- a/libs.ext/plugin_jpf.xml +++ b/libs.ext/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/libs.piccolo/META-INF/MANIFEST.MF b/libs.piccolo/META-INF/MANIFEST.MF index 97a2133fc..b9f75173e 100644 --- a/libs.piccolo/META-INF/MANIFEST.MF +++ b/libs.piccolo/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast libs piccolo Bundle-SymbolicName: libs.piccolo -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: lib/piccolo2d-core-3.0.jar, lib/piccolo2d-extras-3.0.jar Export-Package: org.piccolo2d, diff --git a/libs.piccolo/plugin_jpf.xml b/libs.piccolo/plugin_jpf.xml index c908923b6..f8d58cdc3 100644 --- a/libs.piccolo/plugin_jpf.xml +++ b/libs.piccolo/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/repast.simphony.R/META-INF/MANIFEST.MF b/repast.simphony.R/META-INF/MANIFEST.MF index 9913a9b1c..a051a73d1 100644 --- a/repast.simphony.R/META-INF/MANIFEST.MF +++ b/repast.simphony.R/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast R Bundle-SymbolicName: repast.simphony.R -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.gui, repast.simphony.data, repast.simphony.core, diff --git a/repast.simphony.R/licenses/repast-license.txt b/repast.simphony.R/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.R/licenses/repast-license.txt +++ b/repast.simphony.R/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.R/plugin_jpf.xml b/repast.simphony.R/plugin_jpf.xml index 5f589d28a..4121fe1ff 100644 --- a/repast.simphony.R/plugin_jpf.xml +++ b/repast.simphony.R/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.batch/META-INF/MANIFEST.MF b/repast.simphony.batch/META-INF/MANIFEST.MF index 1563b7ead..8005fc18a 100644 --- a/repast.simphony.batch/META-INF/MANIFEST.MF +++ b/repast.simphony.batch/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast batch Bundle-SymbolicName: repast.simphony.batch;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: libs.bsf, repast.simphony.dataLoader, repast.simphony.data, diff --git a/repast.simphony.batch/licenses/repast-license.txt b/repast.simphony.batch/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.batch/licenses/repast-license.txt +++ b/repast.simphony.batch/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.batch/plugin_jpf.xml b/repast.simphony.batch/plugin_jpf.xml index 379dd350f..b8dc485da 100644 --- a/repast.simphony.batch/plugin_jpf.xml +++ b/repast.simphony.batch/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/repast.simphony.bin_and_src/META-INF/MANIFEST.MF b/repast.simphony.bin_and_src/META-INF/MANIFEST.MF index bbd37058c..58837d94c 100644 --- a/repast.simphony.bin_and_src/META-INF/MANIFEST.MF +++ b/repast.simphony.bin_and_src/META-INF/MANIFEST.MF @@ -2,6 +2,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast bin and src Bundle-SymbolicName: repast.simphony.bin_and_src -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-Vendor: Argonne National Laboratory Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/repast.simphony.bin_and_src/repast.simphony.bin_and_src.jar b/repast.simphony.bin_and_src/repast.simphony.bin_and_src.jar index 2cced97ce..2a96f128b 100644 Binary files a/repast.simphony.bin_and_src/repast.simphony.bin_and_src.jar and b/repast.simphony.bin_and_src/repast.simphony.bin_and_src.jar differ diff --git a/repast.simphony.chart/META-INF/MANIFEST.MF b/repast.simphony.chart/META-INF/MANIFEST.MF index 030cfe6b9..ed12aaa32 100644 --- a/repast.simphony.chart/META-INF/MANIFEST.MF +++ b/repast.simphony.chart/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast chart Bundle-SymbolicName: repast.simphony.chart -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: lib/jcommon-1.0.23.jar, lib/jfreechart-1.0.19.jar Export-Package: com.keypoint, diff --git a/repast.simphony.chart/licenses/repast-license.txt b/repast.simphony.chart/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.chart/licenses/repast-license.txt +++ b/repast.simphony.chart/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.chart/plugin_jpf.xml b/repast.simphony.chart/plugin_jpf.xml index 9f4ba1f8b..e4071c381 100644 --- a/repast.simphony.chart/plugin_jpf.xml +++ b/repast.simphony.chart/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/repast.simphony.core/.classpath b/repast.simphony.core/.classpath index cd29e3fcc..69db65a9b 100644 --- a/repast.simphony.core/.classpath +++ b/repast.simphony.core/.classpath @@ -1,35 +1,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repast.simphony.core/META-INF/MANIFEST.MF b/repast.simphony.core/META-INF/MANIFEST.MF index 8ab28a4a0..ca600fa37 100644 --- a/repast.simphony.core/META-INF/MANIFEST.MF +++ b/repast.simphony.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast core Bundle-SymbolicName: repast.simphony.core -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: lib/jsr108-0.01.jar, lib/concurrent-1.3.4.jar, lib/collections-generic-4.01.jar, @@ -26,7 +26,8 @@ Bundle-ClassPath: lib/jsr108-0.01.jar, lib/jscience-4.3.1-no_ogis.jar, lib/commons-math3-3.6.1.jar, lib/commons-collections-3.2.2.jar, - lib/commons-io-2.5.jar + lib/commons-io-2.5.jar, + lib/stack-alloc.jar Bundle-Localization: plugin Export-Package: ., EDU.oswego.cs.dl.util.concurrent, diff --git a/repast.simphony.core/build.properties b/repast.simphony.core/build.properties index d4845ba15..470ae829f 100644 --- a/repast.simphony.core/build.properties +++ b/repast.simphony.core/build.properties @@ -31,7 +31,8 @@ bin.includes = META-INF/,\ lib/jscience-4.3.1-no_ogis.jar,\ lib/commons-math3-3.6.1.jar,\ lib/commons-collections-3.2.2.jar,\ - lib/commons-io-2.5.jar + lib/commons-io-2.5.jar,\ + lib/stack-alloc.jar src.includes = src/,\ test/ jars.compile.order = diff --git a/repast.simphony.core/lib/jbullet.jar b/repast.simphony.core/lib/jbullet.jar index 4422c8109..c6f805ebf 100644 Binary files a/repast.simphony.core/lib/jbullet.jar and b/repast.simphony.core/lib/jbullet.jar differ diff --git a/repast.simphony.core/lib/stack-alloc.jar b/repast.simphony.core/lib/stack-alloc.jar new file mode 100644 index 000000000..ab1d988ce Binary files /dev/null and b/repast.simphony.core/lib/stack-alloc.jar differ diff --git a/repast.simphony.core/licenses/repast-license.txt b/repast.simphony.core/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.core/licenses/repast-license.txt +++ b/repast.simphony.core/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.core/plugin_jpf.xml b/repast.simphony.core/plugin_jpf.xml index ef3467b37..9ee99ce8c 100644 --- a/repast.simphony.core/plugin_jpf.xml +++ b/repast.simphony.core/plugin_jpf.xml @@ -2,7 +2,7 @@ - + @@ -40,6 +40,7 @@ + diff --git a/repast.simphony.core/src/repast/simphony/context/Context.java b/repast.simphony.core/src/repast/simphony/context/Context.java index 8b90b1726..ab7938655 100644 --- a/repast.simphony.core/src/repast/simphony/context/Context.java +++ b/repast.simphony.core/src/repast/simphony/context/Context.java @@ -1,12 +1,14 @@ package repast.simphony.context; +import java.util.Collection; +import java.util.stream.Stream; + import org.apache.commons.collections15.Predicate; + import repast.simphony.space.projection.Projection; import repast.simphony.util.collections.IndexedIterable; import repast.simphony.valueLayer.ValueLayer; -import java.util.Collection; - /** * Represents a group of agents that participate in a simulation. A Context ecapsulates * a population of agents.

@@ -28,6 +30,11 @@ public interface Context extends Collection, RepastElement { static final String SYN_CONTEXT_PREFIX = "__Synthetic_Context__"; + /** + * @deprecated Use {@link #getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. + * + */ + @Deprecated Iterable query(Predicate query); /** @@ -40,7 +47,7 @@ public interface Context extends Collection, RepastElement { /** * Gets an iterable over a collection of objects chosen at random. The number of objects * is determined by the specified count and the type of objects by the specified class. - * If the context contains less objects than the specified count, all + * If the context contains fewer objects than the specified count, all * the appropriate objects in the context will be returned.

* * If this is repeatedly called with a count equal to the number of objects @@ -51,16 +58,43 @@ public interface Context extends Collection, RepastElement { * @return an iterable over a collection of random objects */ Iterable getRandomObjects(Class clazz, long count); + + /** + * Gets a sequential Stream over a collection of objects chosen at random. The number of objects + * is determined by the specified count and the type of objects by the specified class. + * If the context contains fewer objects than the specified count, all + * the appropriate objects in the context will be returned.

+ * + * If this is repeatedly called with a count equal to the number of objects + * in the context, the iteration order will be shuffled each time. + * + * @param clazz the class of the objects to return + * @param count the number of random objects to return + * @return a sequential Stream over a collection of random objects + */ + Stream getRandomObjectsAsStream(Class clazz, long count); + /** - * Gets a IndexedIterable over the all the objects in this context (and thus in the sub contexts) that are + * Gets a IndexedIterable over all the objects in this context (and thus in the sub contexts) that are * of the specified type. * * @param clazz the type of objects to return - * @return a IndexedIterable over the all the objects in this context (and thus in the sub contexts) that are + * @return a IndexedIterable over all the objects in this context (and thus in the sub contexts) that are * of the specified type. */ IndexedIterable getObjects(Class clazz); + + + /** + * Gets a sequential Stream over all the objects in this context (and thus in the sub contexts) that are + * of the specified type. + * + * @param clazz the type of objects to return + * @return a Stream over all the objects in this context (and thus in the sub contexts) that are + * of the specified type. + */ + Stream getObjectsAsStream(Class clazz); /** * Gets an id that indentifies the user-defined type of this context. A context type typically diff --git a/repast.simphony.core/src/repast/simphony/context/FormerDefaultContext.java b/repast.simphony.core/src/repast/simphony/context/FormerDefaultContext.java index 6afe7e3bf..c6e7836ae 100644 --- a/repast.simphony.core/src/repast/simphony/context/FormerDefaultContext.java +++ b/repast.simphony.core/src/repast/simphony/context/FormerDefaultContext.java @@ -1,13 +1,15 @@ package repast.simphony.context; +import java.util.Collection; +import java.util.Iterator; +import java.util.stream.Stream; + import org.apache.commons.collections15.Predicate; + import repast.simphony.space.projection.Projection; import repast.simphony.util.collections.IndexedIterable; import repast.simphony.valueLayer.ValueLayer; -import java.util.Collection; -import java.util.Iterator; - public class FormerDefaultContext implements Context { public enum ContextHint { @@ -323,4 +325,33 @@ public boolean hasSubContext(){ else return false; } + + /** + * Gets a sequential Stream over the all the objects in this context (and thus in the sub contexts) that are + * of the specified type. + * + * @param clazz the type of objects to return + * @return a Stream over the all the objects in this context (and thus in the sub contexts) that are + * of the specified type. + */ + public Stream getObjectsAsStream(Class clazz) { + throw new UnsupportedOperationException(); + } + + /** + * Gets a sequential Stream over a collection of objects chosen at random. The number of objects + * is determined by the specified count and the type of objects by the specified class. + * If the context contains less objects than the specified count, all + * the appropriate objects in the context will be returned.

+ * + * If this is repeatedly called with a count equal to the number of objects + * in the context, the iteration order will be shuffled each time. + * + * @param clazz the class of the objects to return + * @param count the number of random objects to return + * @return a sequential Stream over a collection of random objects + */ + public Stream getRandomObjectsAsStream(Class clazz, long count) { + throw new UnsupportedOperationException(); + } } diff --git a/repast.simphony.core/src/repast/simphony/context/SmallDefaultContext.java b/repast.simphony.core/src/repast/simphony/context/SmallDefaultContext.java index 7afdf9791..54274f094 100644 --- a/repast.simphony.core/src/repast/simphony/context/SmallDefaultContext.java +++ b/repast.simphony.core/src/repast/simphony/context/SmallDefaultContext.java @@ -9,6 +9,10 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; import org.apache.commons.collections15.iterators.IteratorChain; import org.apache.commons.collections15.iterators.SingletonIterator; @@ -128,11 +132,11 @@ public boolean retainAll(Collection c) { } /** - * Gets a IndexedIterable over the all the objects in this context (and thus in the sub contexts) that are + * Gets a IndexedIterable over all the objects in this context (and thus in the sub contexts) that are * of the specified type. * * @param clazz the type of objects to return - * @return a IndexedIterable over the all the objects in this context (and thus in the sub contexts) that are + * @return a IndexedIterable over all the objects in this context (and thus in the sub contexts) that are * of the specified type. */ public IndexedIterable getObjects(Class clazz) { @@ -150,11 +154,44 @@ public IndexedIterable getObjects(Class clazz) { } return iter; } + + /** + * Gets a sequential Stream over all the objects in this context (and thus in the sub contexts) that are + * of the specified type. + * + * @param clazz the type of objects to return + * @return a Stream over all the objects in this context (and thus in the sub contexts) that are + * of the specified type. The Stream is sequential. + */ + public Stream getObjectsAsStream(Class clazz) { + IndexedIterable iiter = getObjects(clazz); + Spliterator iter = Spliterators.spliterator(iiter.iterator(), iiter.size(), Spliterator.ORDERED | Spliterator.IMMUTABLE); + return StreamSupport.stream(iter, false); + } + + /** + * Gets a sequential Stream over a collection of objects chosen at random. The number of objects + * is determined by the specified count and the type of objects by the specified class. + * If the context contains fewer objects than the specified count, all + * the appropriate objects in the context will be returned.

+ * + * If this is repeatedly called with a count equal to the number of objects + * in the context, the iteration order will be shuffled each time. + * + * @param clazz the class of the objects to return + * @param count the number of random objects to return + * @return a sequential Stream over a collection of random objects + */ + public Stream getRandomObjectsAsStream(Class clazz, long count) { + Iterable riter = getRandomObjects(clazz, count); + Spliterator iter = Spliterators.spliteratorUnknownSize(riter.iterator(), Spliterator.ORDERED | Spliterator.IMMUTABLE); + return StreamSupport.stream(iter, false); + } /** * Gets an iterable over a collection of objects chosen at random. The number of objects * is determined by the specified count and the type of objects by the specified class. - * If the context contains less objects than the specified count, all + * If the context contains fewer objects than the specified count, all * the appropriate objects in the context will be returned. *

* If this is repeatedly called with a count equal to the number of objects diff --git a/repast.simphony.core/src/repast/simphony/engine/controller/ScheduledMethodControllerAction.java b/repast.simphony.core/src/repast/simphony/engine/controller/ScheduledMethodControllerAction.java index 38565a400..598ec252e 100644 --- a/repast.simphony.core/src/repast/simphony/engine/controller/ScheduledMethodControllerAction.java +++ b/repast.simphony.core/src/repast/simphony/engine/controller/ScheduledMethodControllerAction.java @@ -3,9 +3,9 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -35,7 +35,7 @@ static class PickData { ScheduledMethod annotation; long pickCount = 0; boolean shuffle = true; - Set> excludes = new HashSet>(); + Set> excludes = new LinkedHashSet>(); public PickData(Method method, ScheduledMethod annotation) { this.method = method; @@ -60,13 +60,13 @@ public ScheduleParameters getParameters() { } private List pickData = new ArrayList(); - private Set> processedClasses = new HashSet>(); - private Set processedMethods = new HashSet(); + private Set> processedClasses = new LinkedHashSet>(); + private Set processedMethods = new LinkedHashSet(); private ISchedule schedule; // we have to track that actions added for contexts and subcontexts // so if those are removed then we remove their actions - private Map contextActions = new HashMap(); + private Map contextActions = new LinkedHashMap(); /** * Creates a ScheduledMethodControllerAction with no methods scheduled. @@ -83,6 +83,9 @@ public ScheduledMethodControllerAction() { public ScheduledMethodControllerAction(List> clazzes) { // read the spec to find the schedule annotations and get the "pick" // information + clazzes.sort( (o1, o2) -> { + return o1.toString().compareTo(o2.toString()); + }); processAnnotations(clazzes); } @@ -97,7 +100,7 @@ public void processAnnotations(List> clazzes) { } for (Class clazz : clazzes) { - Set> interfaces = new HashSet>(); + Set> interfaces = new LinkedHashSet>(); gatherInterfaces(clazz, interfaces); for (Class inter : interfaces) { if (!processedClasses.contains(inter)) { diff --git a/repast.simphony.core/src/repast/simphony/parameter/DefaultParameterSchema.java b/repast.simphony.core/src/repast/simphony/parameter/DefaultParameterSchema.java index cc3248525..aacb14d05 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/DefaultParameterSchema.java +++ b/repast.simphony.core/src/repast/simphony/parameter/DefaultParameterSchema.java @@ -1,12 +1,12 @@ package repast.simphony.parameter; -import org.apache.commons.lang3.Range; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.Range; + /** * Default implementation of ParameterSchema. * @@ -29,7 +29,7 @@ public class DefaultParameterSchema implements ParameterSchema { private List list; - private Range range; + private SteppedRange range; private Class type; private Object defValue; private String name; @@ -55,7 +55,7 @@ public DefaultParameterSchema(String name, Class type, Object defValue, List pos setConstrainingList(possibleValues); } - public DefaultParameterSchema(String name, Class type, Object defValue, Range constrainingRange) { + public DefaultParameterSchema(String name, Class type, Object defValue, SteppedRange constrainingRange) { this(name, type, defValue); setConstrainingRange(constrainingRange); } @@ -143,7 +143,7 @@ public void setConstrainingList(List list) { * * @param range the constraining range. */ - public void setConstrainingRange(Range range) { + public void setConstrainingRange(SteppedRange range) { this.range = range; if (defValue != null && !validate(defValue)) { throw new IllegalParameterException("Constraining range '" + range + "' for parameter '" + @@ -159,7 +159,7 @@ public void setConstrainingRange(Range range) { * @return the numeric range of values that constrain this parameter or null * if the parameter is unconstrained by a range. */ - public Range getConstrainingRange() { + public SteppedRange getConstrainingRange() { return range; } @@ -184,8 +184,9 @@ public String getConstraintString() { if (list != null) { val = ParameterUtils.getStringValue(type, converter, list); } else if (range != null) { - val = range.toString(); + val = range.getMin() + " " + range.getMax() + " " + range.getStep(); } + return val; } /** diff --git a/repast.simphony.core/src/repast/simphony/parameter/DefaultParameters.java b/repast.simphony.core/src/repast/simphony/parameter/DefaultParameters.java index 02974ca38..7b6dadb90 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/DefaultParameters.java +++ b/repast.simphony.core/src/repast/simphony/parameter/DefaultParameters.java @@ -9,8 +9,6 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.lang3.Range; - import repast.simphony.util.ClassUtilities; /** @@ -163,7 +161,7 @@ public void addConvertor(String name, StringConverter converter) { * @param constrainingRange * a range of the possible values for the named parameter */ - public void addConstraint(String name, Range constrainingRange) { + public void addConstraint(String name, SteppedRange constrainingRange) { schema.addConstraint(name, constrainingRange); } diff --git a/repast.simphony.core/src/repast/simphony/parameter/DefaultSchema.java b/repast.simphony.core/src/repast/simphony/parameter/DefaultSchema.java index 5874ad422..d65a96a60 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/DefaultSchema.java +++ b/repast.simphony.core/src/repast/simphony/parameter/DefaultSchema.java @@ -1,6 +1,5 @@ package repast.simphony.parameter; -import org.apache.commons.lang3.Range; import repast.simphony.util.collections.Pair; import java.util.HashMap; @@ -94,7 +93,7 @@ public void addConvertor(String name, StringConverter converter) { * @param name the name of the parmaeter * @param constrainingRange a range of the possible values for the named parameter */ - public void addConstraint(String name, Range constrainingRange) { + public void addConstraint(String name, SteppedRange constrainingRange) { ParameterSchema schema = schemas.get(name); DefaultParameterSchema newSchema = new DefaultParameterSchema(schema); newSchema.setConstrainingRange(constrainingRange); diff --git a/repast.simphony.core/src/repast/simphony/parameter/MutableParameters.java b/repast.simphony.core/src/repast/simphony/parameter/MutableParameters.java index c1ec1328d..95ab60b87 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/MutableParameters.java +++ b/repast.simphony.core/src/repast/simphony/parameter/MutableParameters.java @@ -2,8 +2,6 @@ import java.util.List; -import org.apache.commons.lang3.Range; - /** * Encapsulates a mutable set of simulation time model parameters. * @@ -47,7 +45,7 @@ public void addParameter(String name, String displayName, Class type, * @param name the name of the parmaeter * @param constrainingRange a range of the possible values for the named parameter */ - public void addConstraint(String name, Range constrainingRange); + public void addConstraint(String name, SteppedRange constrainingRange); /** * Removes the named parameter diff --git a/repast.simphony.core/src/repast/simphony/parameter/ParameterSchema.java b/repast.simphony.core/src/repast/simphony/parameter/ParameterSchema.java index 5b3d14101..c35c38207 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/ParameterSchema.java +++ b/repast.simphony.core/src/repast/simphony/parameter/ParameterSchema.java @@ -1,6 +1,5 @@ package repast.simphony.parameter; -import org.apache.commons.lang3.Range; import java.util.List; @@ -40,7 +39,7 @@ public interface ParameterSchema { * @return the numeric range of values that constrain this parameter or null * if the parameter is unconstrained by a range. */ - Range getConstrainingRange(); + SteppedRange getConstrainingRange(); /** * Gets the list of values that constrain this parameter. This will return diff --git a/repast.simphony.core/src/repast/simphony/parameter/ParametersCreator.java b/repast.simphony.core/src/repast/simphony/parameter/ParametersCreator.java index a606b75e1..01ac5eda8 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/ParametersCreator.java +++ b/repast.simphony.core/src/repast/simphony/parameter/ParametersCreator.java @@ -1,6 +1,5 @@ package repast.simphony.parameter; -import org.apache.commons.lang3.Range; import simphony.util.messages.MessageCenter; import java.beans.BeanInfo; @@ -110,10 +109,10 @@ public void addConvertor(String name, StringConverter converter) { * Constrains the value of the named parameter to those in the * specified range. * - * @param name the name of the parmaeter + * @param name the name of the parameter * @param constrainingRange a range of the possible values for the named parameter */ - public void addConstraint(String name, Range constrainingRange) { + public void addConstraint(String name, SteppedRange constrainingRange) { parameters.addConstraint(name, constrainingRange); } diff --git a/repast.simphony.core/src/repast/simphony/parameter/ParametersParser.java b/repast.simphony.core/src/repast/simphony/parameter/ParametersParser.java index 4ceaf6b11..0a8d5e6c8 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/ParametersParser.java +++ b/repast.simphony.core/src/repast/simphony/parameter/ParametersParser.java @@ -1,15 +1,20 @@ package repast.simphony.parameter; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.ext.DefaultHandler2; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import java.io.File; -import java.io.IOException; -import java.util.*; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.ext.DefaultHandler2; /** * Parser for parsing parameter defs and values in xml format. @@ -19,120 +24,134 @@ */ public class ParametersParser extends DefaultHandler2 { - private static final String PARAMETER = "parameter"; - - private ParametersCreator creator; - - public static Map typeMap = new HashMap(); - - static { - typeMap.put("int", int.class); - typeMap.put("double", double.class); - typeMap.put("long", long.class); - typeMap.put("float", float.class); - typeMap.put("boolean", boolean.class); - typeMap.put("byte", byte.class); - typeMap.put("short", short.class); - typeMap.put("String", String.class); - typeMap.put("string", String.class); - } - - public ParametersParser(Parameters params, File file) throws IOException, SAXException, - ParserConfigurationException { - creator = new ParametersCreator(); - if (params != null) creator.addParameters(params); - Parameters p = creator.createParameters(); - SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); - parser.parse(file, this); - } - - public ParametersParser(File file) throws ParserConfigurationException, SAXException, IOException { - this(null, file); - } - - public Parameters getParameters() { - Parameters params = creator.createParameters(); - ParameterSchema details = params.getSchema().getDetails(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME); - if (details != null && params.getValue(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME) == Parameters.NULL) { - int val = (int) System.currentTimeMillis(); - // per JIRA 76 - "Use positive default random seeds" - if (val < 0) val = Math.abs(val); - params.setValue(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME, val); - } - - return params; - } - - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { - try { - if (qName.equals(PARAMETER)) { - String name = attributes.getValue("name"); - String sType = attributes.getValue("type"); - String defaultValue = attributes.getValue("defaultValue"); - - if (name == null || sType == null || defaultValue == null) - throw new ParameterFormatException("Parameter element is missing required attributes"); - - String strConvertor = attributes.getValue("converter"); - StringConverter converter = null; - if (strConvertor != null) { - Class clazz = Class.forName(strConvertor); - converter = (StringConverter) clazz.newInstance(); + private static final String PARAMETER = "parameter"; + + private ParametersCreator creator; + + public static Map typeMap = new HashMap(); + + static { + typeMap.put("int", int.class); + typeMap.put("double", double.class); + typeMap.put("long", long.class); + typeMap.put("float", float.class); + typeMap.put("boolean", boolean.class); + typeMap.put("byte", byte.class); + typeMap.put("short", short.class); + typeMap.put("String", String.class); + typeMap.put("string", String.class); } - String readOnly = attributes.getValue("isReadOnly"); - Class type = typeMap.get(sType); - if (type == null) - type = Class.forName(sType); - - Object defVal; - if (defaultValue.equals("__NULL__")) { - defVal = null; - } else { - if (converter != null) - defVal = converter.fromString(defaultValue); - else - defVal = ParameterUtils.parseDefaultValue(type, name, defaultValue)[0]; + public ParametersParser(Parameters params, File file) + throws IOException, SAXException, ParserConfigurationException { + creator = new ParametersCreator(); + if (params != null) + creator.addParameters(params); + Parameters p = creator.createParameters(); + SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); + parser.parse(file, this); } - - if (name.equals(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME) && - defVal == null && creator.contains(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME)) return; - - - String displayName = attributes.getValue("displayName"); - if (displayName == null) - displayName = name; - creator.addParameter(name, displayName, type, defVal, Boolean.parseBoolean(readOnly)); - if (converter != null) - creator.addConvertor(name, converter); - - String list = attributes.getValue("values"); - if (list != null) { - if (converter == null) { - Object[] vals = ParameterUtils.parseDefaultValue(type, name, list); - creator.addConstraint(name, Arrays.asList(vals)); - } else { - List objs = new ArrayList(); - Object[] vals = ParameterUtils.parseDefaultValue(String.class, name, list); - for (Object val : vals) { - objs.add(converter.fromString(val.toString())); - } - creator.addConstraint(name, objs); - } + + public ParametersParser(File file) throws ParserConfigurationException, SAXException, IOException { + this(null, file); + } + + public Parameters getParameters() { + Parameters params = creator.createParameters(); + ParameterSchema details = params.getSchema().getDetails(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME); + if (details != null && params.getValue(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME) == Parameters.NULL) { + int val = (int) System.currentTimeMillis(); + // per JIRA 76 - "Use positive default random seeds" + if (val < 0) + val = Math.abs(val); + params.setValue(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME, val); + } + + return params; + } + + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + try { + if (qName.equals(PARAMETER)) { + String name = attributes.getValue("name"); + String sType = attributes.getValue("type"); + String defaultValue = attributes.getValue("defaultValue"); + + if (name == null || sType == null || defaultValue == null) + throw new ParameterFormatException("Parameter element is missing required attributes"); + + String strConvertor = attributes.getValue("converter"); + StringConverter converter = null; + if (strConvertor != null) { + Class clazz = Class.forName(strConvertor); + converter = (StringConverter) clazz.newInstance(); + } + + String readOnly = attributes.getValue("isReadOnly"); + Class type = typeMap.get(sType); + if (type == null) + type = Class.forName(sType); + + Object defVal; + if (defaultValue.equals("__NULL__")) { + defVal = null; + } else { + if (converter != null) + defVal = converter.fromString(defaultValue); + else + defVal = ParameterUtils.parseDefaultValue(type, name, defaultValue)[0]; + } + + if (name.equals(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME) && defVal == null + && creator.contains(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME)) + return; + + String displayName = attributes.getValue("displayName"); + if (displayName == null) + displayName = name; + creator.addParameter(name, displayName, type, defVal, Boolean.parseBoolean(readOnly)); + if (converter != null) + creator.addConvertor(name, converter); + + String list = attributes.getValue("values"); + if (list != null) { + if (converter == null) { + Object[] vals = ParameterUtils.parseDefaultValue(type, name, list); + creator.addConstraint(name, Arrays.asList(vals)); + } else { + List objs = new ArrayList(); + Object[] vals = ParameterUtils.parseDefaultValue(String.class, name, list); + for (Object val : vals) { + objs.add(converter.fromString(val.toString())); + } + creator.addConstraint(name, objs); + } + } + + String range = attributes.getValue("range"); + if (range != null) { + String[] vals = range.split(" "); + if (vals.length != 3) + throw new SAXException("Invalid range for ranged parameter '" + name + "'"); + try { + SteppedRange sr = new SteppedRange(Double.parseDouble(vals[0]), Double.parseDouble(vals[1]), + Double.parseDouble(vals[2])); + creator.addConstraint(name, sr); + } catch (NumberFormatException ex) { + throw new SAXException("Invalid range for ranged parameter '" + name + "'. Values must be numeric"); + } + } + } + } catch (ClassNotFoundException e) { + throw new SAXException("Unable to creates parameters", e); + } catch (ParameterFormatException ex) { + throw new SAXException("Unable to convert parameter type. Please use a convertor.", ex); + } catch (IllegalAccessException e) { + throw new SAXException("Unable to creates parameters. Bad convertor value", e); + } catch (InstantiationException e) { + throw new SAXException("Unable to creates parameters. Bad convertor value", e); + } catch (ClassCastException ex) { + throw new SAXException("Unable to creates parameters. Convertor must implement StringConverter"); + } } - } - } catch (ClassNotFoundException e) { - throw new SAXException("Unable to creates parameters", e); - } catch (ParameterFormatException ex) { - throw new SAXException("Unable to convert parameter type. Please use a convertor.", ex); - } catch (IllegalAccessException e) { - throw new SAXException("Unable to creates parameters. Bad convertor value", e); - } catch (InstantiationException e) { - throw new SAXException("Unable to creates parameters. Bad convertor value", e); - } catch (ClassCastException ex) { - throw new SAXException( - "Unable to creates parameters. Convertor must implement StringConverter"); - } - } } diff --git a/repast.simphony.core/src/repast/simphony/parameter/ParametersWriter.java b/repast.simphony.core/src/repast/simphony/parameter/ParametersWriter.java index 5a28f7b7a..77c2165ca 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/ParametersWriter.java +++ b/repast.simphony.core/src/repast/simphony/parameter/ParametersWriter.java @@ -1,13 +1,18 @@ package repast.simphony.parameter; -import org.apache.commons.lang3.Range; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; - -import java.io.*; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; + /** * Writes the current values of a Parameters object out to an xml file. The * format consists of a name value pair where the value is a string @@ -35,63 +40,74 @@ */ public class ParametersWriter { - private void write(Parameters params, Writer writer, String templateFile) throws IOException { - VelocityContext context = new VelocityContext(); - context.put("parameters", params); - context.put("NULL", Parameters.NULL); + private void write(Parameters params, Writer writer, Map displayOrder, String templateFile) throws IOException { + if (displayOrder == null) { + displayOrder = new HashMap<>(); + } + VelocityContext context = new VelocityContext(); + context.put("parameters", params); + context.put("displayOrder", displayOrder); + context.put("NULL", Parameters.NULL); + + String template = getClass().getPackage().getName(); + template = template.replace('.', '/'); + template = template + "/" + templateFile; + try { + Velocity.mergeTemplate(template, "UTF-8", context, writer); + } catch (Exception ex) { + IOException ioEx = new IOException("Error writing parameters"); + ioEx.initCause(ex); + throw ioEx; + } + } - String template = getClass().getPackage().getName(); - template = template.replace('.', '/'); - template = template + "/" + templateFile; - try { - Velocity.mergeTemplate(template, "UTF-8", context, writer); - } catch (Exception ex) { - IOException ioEx = new IOException("Error writing parameters"); - ioEx.initCause(ex); - throw ioEx; - } - } + public String writeValuesToString(Parameters params) throws IOException { + StringWriter writer = new StringWriter(); + write(params, writer, null, "params.vt"); + return writer.toString(); + } - public String writeValuesToString(Parameters params) throws IOException { - StringWriter writer = new StringWriter(); - write(params, writer, "params.vt"); - return writer.toString(); - } + public void writeValuesToFile(Parameters params, File file) throws IOException { + FileWriter writer = new FileWriter(file); + write(params, writer, null, "params.vt"); + writer.close(); + } - public void writeValuesToFile(Parameters params, File file) throws IOException { - FileWriter writer = new FileWriter(file); - write(params, writer, "params.vt"); - writer.close(); - } + public void writeSpecificationToFile(Parameters params, Map displayOrder, File file) + throws IOException { + FileWriter writer = new FileWriter(file); + write(params, writer, displayOrder, "parameters.vt"); + writer.close(); + } - public void writeSpecificationToFile(Parameters params, File file) throws IOException { - FileWriter writer = new FileWriter(file); - write(params, writer, "parameters.vt"); - writer.close(); - } + public void writeSpecificationToFile(Parameters params, File file) throws IOException { + FileWriter writer = new FileWriter(file); + write(params, writer, null, "parameters.vt"); + writer.close(); + } - public static void main(String[] args) { - try { - Properties props = new Properties(); - props.put("resource.loader", "class"); - props.put("class.resource.loader.description", "Velocity Classpath Resource Loader"); - props.put("class.resource.loader.class", - "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - Velocity.init(props); + public static void main(String[] args) { + try { + Properties props = new Properties(); + props.put("resource.loader", "class"); + props.put("class.resource.loader.description", "Velocity Classpath Resource Loader"); + props.put("class.resource.loader.class", + "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + Velocity.init(props); - DefaultParameters p = new DefaultParameters(); - p.addParameter("foo", String.class, "Hello", true); - p.addParameter("bar", int.class, 12, false); - p.addParameter("test", "Test Number", int.class, 10, false); + DefaultParameters p = new DefaultParameters(); + p.addParameter("foo", String.class, "Hello", true); + p.addParameter("bar", int.class, 12, false); + p.addParameter("test", "Test Number", int.class, 10, false); - p.addConstraint("foo", Arrays.asList("Hello", "Test 1", "test2", "test 3")); - p.addConstraint("bar", Range.between(10, 15)); + p.addConstraint("foo", Arrays.asList("Hello", "Test 1", "test2", "test 3")); + // p.addConstraint("bar", Range.between(10, 15)); - ParametersWriter writer = new ParametersWriter(); - writer.writeValuesToFile(p, new File("/Users/kehrer/tmp/params.xml")); - writer.writeSpecificationToFile(p, new File("/Users/kehrer/tmp/parameters.xml")); - } catch (Exception ex) { - ex.printStackTrace(); - } - } + ParametersWriter writer = new ParametersWriter(); + writer.writeValuesToFile(p, new File("/Users/kehrer/tmp/params.xml")); + writer.writeSpecificationToFile(p, null, new File("/Users/kehrer/tmp/parameters.xml")); + } catch (Exception ex) { + ex.printStackTrace(); + } + } } diff --git a/repast.simphony.core/src/repast/simphony/parameter/SteppedRange.java b/repast.simphony.core/src/repast/simphony/parameter/SteppedRange.java new file mode 100644 index 000000000..1ef186a87 --- /dev/null +++ b/repast.simphony.core/src/repast/simphony/parameter/SteppedRange.java @@ -0,0 +1,75 @@ +/** + * + */ +package repast.simphony.parameter; + +/** + * Implements a range with step information for a GUI. + * + * @author nick + */ +public class SteppedRange { + + private double min, max; + private double step; + private int hashCode; + + /** + * Creates a SteppedRange with the specified min, max and step values. + * + * @param min + * @param max + * @param step + */ + public SteppedRange(double min, double max, double step) { + this.min = min; + this.max = max; + this.step = step; + + long l = Double.doubleToLongBits(this.min); + hashCode = 31 * hashCode + (int)(l ^ (l >>> 32)); + l = Double.doubleToLongBits(this.max); + hashCode = 31 * hashCode + (int)(l ^ (l >>> 32)); + l = Double.doubleToLongBits(this.step); + hashCode = 31 * hashCode + (int)(l ^ (l >>> 32)); + } + + /** + * Gets whether or not the specified value is within the range ( >= min && <= + * max). + * + * @param val + * @return true if the specified val is within the range, otherwise false. + */ + public boolean contains(double val) { + return val >= min && val <= max; + } + + public double getMin() { + return min; + } + + public double getMax() { + return max; + } + + public double getStep() { + return step; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof SteppedRange)) { + return false; + } + + SteppedRange other = (SteppedRange) obj; + return other.min == min && other.max == max && other.step == step; + } + + @Override + public int hashCode() { + return hashCode; + } + +} diff --git a/repast.simphony.core/src/repast/simphony/parameter/parameters.vt b/repast.simphony.core/src/repast/simphony/parameter/parameters.vt index 1d57bd249..a060374c8 100644 --- a/repast.simphony.core/src/repast/simphony/parameter/parameters.vt +++ b/repast.simphony.core/src/repast/simphony/parameter/parameters.vt @@ -14,10 +14,16 @@ converter="$details.getConverter().getClass().getName()" #end #set ($constraint = $details.getConstraintString()) - #if (($constraint) && !($constraint == "")) + #if (($constraint) && !($constraint == "")) + #if($details.getConstrainingRange()) + range="$constraint" + #else values="$constraint" #end - + #end + #if($displayOrder.containsKey($name)) + displayOrder="$displayOrder.get($name)" + #end /> #end diff --git a/repast.simphony.core/src/repast/simphony/query/AbstractPropertyQuery.java b/repast.simphony.core/src/repast/simphony/query/AbstractPropertyQuery.java index f694bd0bd..edfd9591b 100644 --- a/repast.simphony.core/src/repast/simphony/query/AbstractPropertyQuery.java +++ b/repast.simphony.core/src/repast/simphony/query/AbstractPropertyQuery.java @@ -15,6 +15,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public abstract class AbstractPropertyQuery implements Query { diff --git a/repast.simphony.core/src/repast/simphony/query/AndQuery.java b/repast.simphony.core/src/repast/simphony/query/AndQuery.java index 4a68dc68d..df50ed012 100644 --- a/repast.simphony.core/src/repast/simphony/query/AndQuery.java +++ b/repast.simphony.core/src/repast/simphony/query/AndQuery.java @@ -1,5 +1,6 @@ package repast.simphony.query; +import repast.simphony.context.Context; import repast.simphony.util.collections.FilteredIterator; /** @@ -7,6 +8,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class AndQuery implements Query{ diff --git a/repast.simphony.core/src/repast/simphony/query/InstanceOfQuery.java b/repast.simphony.core/src/repast/simphony/query/InstanceOfQuery.java index c04c34eeb..5758726df 100644 --- a/repast.simphony.core/src/repast/simphony/query/InstanceOfQuery.java +++ b/repast.simphony.core/src/repast/simphony/query/InstanceOfQuery.java @@ -8,6 +8,7 @@ * instances of the specified type. * * @author Nick Collier + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class InstanceOfQuery implements Query { diff --git a/repast.simphony.core/src/repast/simphony/query/NotQuery.java b/repast.simphony.core/src/repast/simphony/query/NotQuery.java index 7f731cbf0..0b1c07fea 100644 --- a/repast.simphony.core/src/repast/simphony/query/NotQuery.java +++ b/repast.simphony.core/src/repast/simphony/query/NotQuery.java @@ -11,6 +11,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class NotQuery implements Query { diff --git a/repast.simphony.core/src/repast/simphony/query/OrQuery.java b/repast.simphony.core/src/repast/simphony/query/OrQuery.java index 44b085aed..1c79b7549 100644 --- a/repast.simphony.core/src/repast/simphony/query/OrQuery.java +++ b/repast.simphony.core/src/repast/simphony/query/OrQuery.java @@ -1,5 +1,6 @@ package repast.simphony.query; +import repast.simphony.context.Context; import repast.simphony.util.collections.FilteredIterator; import java.util.HashSet; @@ -10,6 +11,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class OrQuery implements Query{ diff --git a/repast.simphony.core/src/repast/simphony/query/PredicateQuery.java b/repast.simphony.core/src/repast/simphony/query/PredicateQuery.java index 5f6ae478f..a22d17ed7 100644 --- a/repast.simphony.core/src/repast/simphony/query/PredicateQuery.java +++ b/repast.simphony.core/src/repast/simphony/query/PredicateQuery.java @@ -2,6 +2,8 @@ import org.apache.commons.collections15.Predicate; +import repast.simphony.context.Context; + /** * Iterface marks a Query as dependent on an org.apache.commons.collections.Predicate. * This Predicate can then be returned. Certain queries can use this information to @@ -9,6 +11,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public interface PredicateQuery extends Query { diff --git a/repast.simphony.core/src/repast/simphony/query/PropertyEquals.java b/repast.simphony.core/src/repast/simphony/query/PropertyEquals.java index 24718866a..29d0f6c36 100644 --- a/repast.simphony.core/src/repast/simphony/query/PropertyEquals.java +++ b/repast.simphony.core/src/repast/simphony/query/PropertyEquals.java @@ -19,7 +19,10 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ +@Deprecated public class PropertyEquals extends AbstractPropertyQuery { private class Equals implements Predicate { diff --git a/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThan.java b/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThan.java index ae9468582..0bc0195fd 100644 --- a/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThan.java +++ b/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThan.java @@ -19,6 +19,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class PropertyGreaterThan extends AbstractPropertyQuery { diff --git a/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThanEquals.java b/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThanEquals.java index 91aa07eff..b6b18aa27 100644 --- a/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThanEquals.java +++ b/repast.simphony.core/src/repast/simphony/query/PropertyGreaterThanEquals.java @@ -19,6 +19,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class PropertyGreaterThanEquals extends AbstractPropertyQuery { diff --git a/repast.simphony.core/src/repast/simphony/query/PropertyLessThan.java b/repast.simphony.core/src/repast/simphony/query/PropertyLessThan.java index ff90633c1..5cb273975 100644 --- a/repast.simphony.core/src/repast/simphony/query/PropertyLessThan.java +++ b/repast.simphony.core/src/repast/simphony/query/PropertyLessThan.java @@ -19,6 +19,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class PropertyLessThan extends AbstractPropertyQuery { diff --git a/repast.simphony.core/src/repast/simphony/query/PropertyLessThanEquals.java b/repast.simphony.core/src/repast/simphony/query/PropertyLessThanEquals.java index b44dfead7..37cb0a0b4 100644 --- a/repast.simphony.core/src/repast/simphony/query/PropertyLessThanEquals.java +++ b/repast.simphony.core/src/repast/simphony/query/PropertyLessThanEquals.java @@ -19,6 +19,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class PropertyLessThanEquals extends AbstractPropertyQuery { diff --git a/repast.simphony.core/src/repast/simphony/query/PropertyNotEquals.java b/repast.simphony.core/src/repast/simphony/query/PropertyNotEquals.java index 61df23c0a..36c8c989a 100644 --- a/repast.simphony.core/src/repast/simphony/query/PropertyNotEquals.java +++ b/repast.simphony.core/src/repast/simphony/query/PropertyNotEquals.java @@ -21,6 +21,8 @@ * * @author Nick Collier * @version $Revision$ $Date$ + * + * @deprecated Use {@link Context#getObjectsAsStream(Class)} and the Java 8+ streaming API {@link java.util.stream.Stream} instead. */ public class PropertyNotEquals extends AbstractPropertyQuery { diff --git a/repast.simphony.core/src/repast/simphony/space/physics/DefaultPhysicsSpace.java b/repast.simphony.core/src/repast/simphony/space/physics/DefaultPhysicsSpace.java index a32d1eb85..3d5a82803 100644 --- a/repast.simphony.core/src/repast/simphony/space/physics/DefaultPhysicsSpace.java +++ b/repast.simphony.core/src/repast/simphony/space/physics/DefaultPhysicsSpace.java @@ -2,28 +2,26 @@ import java.util.HashMap; -import javax.vecmath.Vector3f; - -import repast.simphony.engine.environment.RunEnvironment; -import repast.simphony.engine.schedule.ISchedule; -import repast.simphony.engine.schedule.ScheduleParameters; -import repast.simphony.space.continuous.ContinuousAdder; -import repast.simphony.space.continuous.DefaultContinuousSpace; -import repast.simphony.space.continuous.MultiOccupancyCoordinateAccessor; -import repast.simphony.space.continuous.PointTranslator; +import org.jogamp.vecmath.Vector3f; import com.bulletphysics.collision.broadphase.AxisSweep3; import com.bulletphysics.collision.dispatch.CollisionConfiguration; import com.bulletphysics.collision.dispatch.CollisionDispatcher; import com.bulletphysics.collision.dispatch.CollisionObject; import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; -import com.bulletphysics.collision.narrowphase.ManifoldPoint; -import com.bulletphysics.collision.narrowphase.PersistentManifold; import com.bulletphysics.dynamics.DiscreteDynamicsWorld; import com.bulletphysics.dynamics.RigidBody; import com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver; import com.bulletphysics.linearmath.Transform; +import repast.simphony.engine.environment.RunEnvironment; +import repast.simphony.engine.schedule.ISchedule; +import repast.simphony.engine.schedule.ScheduleParameters; +import repast.simphony.space.continuous.ContinuousAdder; +import repast.simphony.space.continuous.DefaultContinuousSpace; +import repast.simphony.space.continuous.MultiOccupancyCoordinateAccessor; +import repast.simphony.space.continuous.PointTranslator; + /** * A special 3-dimensional subclass of continuous space that determines the * positions of agents based on physics. @@ -103,8 +101,7 @@ protected void initPhysics(boolean scheduleStep){ Vector3f worldAabbMin = new Vector3f(-1000, -1000, -1000); Vector3f worldAabbMax = new Vector3f(1000, 1000, 1000); int maxProxies = 4*4096; - AxisSweep3 overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax, - maxProxies); + AxisSweep3 overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax, maxProxies); // the default constraint solver. For parallel processing you can use a // different solver (see Extras/BulletMultiThreaded) @@ -112,7 +109,6 @@ protected void initPhysics(boolean scheduleStep){ dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, solver, collisionConfiguration); - dynamicsWorld.setGravity(new Vector3f(0, -9.8f, 0)); if (scheduleStep){ @@ -139,7 +135,6 @@ public boolean addObject(T object, RigidBody body) { return super.moveTo(object, (double)trans.origin.x, (double)trans.origin.y, (double)trans.origin.z); - } public Transform getTransformForObject(T object){ @@ -158,9 +153,9 @@ public void step() { if (bodyToObjectMap.get(body) != null){ // TODO handle super.moveTo() here or let user update via PhysicsSpace.getTransform()? - + super.moveTo(bodyToObjectMap.get(body), (double)trans.origin.x, - (double)trans.origin.y, (double)trans.origin.z); + (double)trans.origin.y, (double)trans.origin.z); } } } diff --git a/repast.simphony.core/src/repast/simphony/space/physics/PhysicsSpace.java b/repast.simphony.core/src/repast/simphony/space/physics/PhysicsSpace.java index be24ffc24..08ad58ac0 100644 --- a/repast.simphony.core/src/repast/simphony/space/physics/PhysicsSpace.java +++ b/repast.simphony.core/src/repast/simphony/space/physics/PhysicsSpace.java @@ -1,6 +1,6 @@ package repast.simphony.space.physics; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.space.projection.Projection; diff --git a/repast.simphony.core/src/repast/simphony/space/physics/RigidBodyFactory.java b/repast.simphony.core/src/repast/simphony/space/physics/RigidBodyFactory.java index e7c4325e7..9cbbb4888 100644 --- a/repast.simphony.core/src/repast/simphony/space/physics/RigidBodyFactory.java +++ b/repast.simphony.core/src/repast/simphony/space/physics/RigidBodyFactory.java @@ -1,6 +1,6 @@ package repast.simphony.space.physics; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.Vector3f; import com.bulletphysics.collision.shapes.BoxShape; import com.bulletphysics.collision.shapes.CollisionShape; @@ -17,41 +17,38 @@ */ public class RigidBodyFactory { - public static RigidBody createSphereBody(float radius, float mass, float[] loc){ + public static RigidBody createSphereBody(float radius, float mass, float[] loc) { CollisionShape colShape = new SphereShape(radius); RigidBodyConstructionInfo rbInfo = ConstructBodyInfo(colShape, mass, loc); return new RigidBody(rbInfo); - } - - public static RigidBody createCubeBody(float edgeLength, float mass, float[] loc){ - + } + + public static RigidBody createCubeBody(float edgeLength, float mass, float[] loc) { + return createBoxBody(edgeLength, edgeLength, edgeLength, mass, loc); - } - - public static RigidBody createBoxBody(float xLength, float yLength, - float zLength, float mass, float[] loc){ - + } + + public static RigidBody createBoxBody(float xLength, float yLength, float zLength, float mass, float[] loc) { + // BoxShape uses half-lengths - Vector3f extents = new Vector3f(xLength/2,yLength/2,zLength/2); + Vector3f extents = new Vector3f(xLength / 2, yLength / 2, zLength / 2); CollisionShape colShape = new BoxShape(extents); RigidBodyConstructionInfo rbInfo = ConstructBodyInfo(colShape, mass, loc); return new RigidBody(rbInfo); - } - - protected static RigidBodyConstructionInfo ConstructBodyInfo(CollisionShape colShape, - float mass, float[] loc){ - + } + + protected static RigidBodyConstructionInfo ConstructBodyInfo(CollisionShape colShape, float mass, float[] loc) { + Vector3f localInertia = new Vector3f(0, 0, 0); - + // don't calculate mass for static objects. if (mass != 0) - colShape.calculateLocalInertia(mass, localInertia); - + colShape.calculateLocalInertia(mass, localInertia); + Transform startTransform = new Transform(); - startTransform.setIdentity(); + startTransform.setIdentity(); startTransform.origin.set(new Vector3f(loc)); DefaultMotionState myMotionState = new DefaultMotionState(startTransform); - - return new RigidBodyConstructionInfo(mass,myMotionState, colShape, localInertia); + return new RigidBodyConstructionInfo(mass, myMotionState, colShape, localInertia); } } \ No newline at end of file diff --git a/repast.simphony.core/src/repast/simphony/visualization/Box.java b/repast.simphony.core/src/repast/simphony/visualization/Box.java index a7d8c569b..1c2a4f6dc 100644 --- a/repast.simphony.core/src/repast/simphony/visualization/Box.java +++ b/repast.simphony.core/src/repast/simphony/visualization/Box.java @@ -3,8 +3,8 @@ */ package repast.simphony.visualization; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; /** * @author Nick Collier diff --git a/repast.simphony.core/test/repast/simphony/context/DefaultContextTest.java b/repast.simphony.core/test/repast/simphony/context/DefaultContextTest.java index 30f2fd61a..b86a5ae56 100644 --- a/repast.simphony.core/test/repast/simphony/context/DefaultContextTest.java +++ b/repast.simphony.core/test/repast/simphony/context/DefaultContextTest.java @@ -7,6 +7,8 @@ import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.function.IntUnaryOperator; +import java.util.stream.Stream; import org.apache.commons.collections15.PredicateUtils; import org.apache.log4j.BasicConfigurator; @@ -115,6 +117,28 @@ public void testIterator() { Iterator intIter = child2.iterator(); assertEquals(new Integer(10), intIter.next()); } + + public void testStream() { + for (int i = 11; i < 20; ++i) { + child2.add(i); + } + + Stream s = child2.getObjectsAsStream(Integer.class); + List list = new ArrayList<>(); + s.forEach(list::add); + + for (int i = 10; i < 20; ++i) { + assertEquals(i, list.get(i - 10).intValue()); + } + + Stream s1 = parent.getObjectsAsStream(Integer.class); + List l2 = new ArrayList<>(); + s1.forEach(l2::add); + + for (int i = 10; i < 20; ++i) { + assertEquals(i, l2.get(i - 10)); + } + } /* * Test method for 'repast.context.DefaultContext.contains(Object)' @@ -424,6 +448,37 @@ public void testGetRandomObjects() { // the same 3 every time. assertTrue(!pickedObjs.containsAll(set)); } + + public void testGetRandomStream() { + for (int i = 20; i < 30; i++) { + child2.add(i); + child1.add(String.valueOf(i)); + } + + parent.add("Foo"); + parent.add("Bar"); + + Set set = new HashSet<>(); + for (Object obj : parent) { + set.add(obj); + } + + for (Object obj : child2) { + set.add(obj); + } + + for (Object obj : child1) { + set.add(obj); + } + + List pickedObj = new ArrayList<>(); + Stream s = parent.getRandomObjectsAsStream(Object.class, 3); + s.forEach(pickedObj::add); + assertEquals(3, pickedObj.size()); + for (Object obj : pickedObj) { + assertTrue(set.contains(obj)); + } + } // tests for duplicate projection adding public void testAddProjection() { diff --git a/repast.simphony.core/test/repast/simphony/parameter/ParametersCreatorTest.java b/repast.simphony.core/test/repast/simphony/parameter/ParametersCreatorTest.java index eb9392d42..0c6b5a963 100644 --- a/repast.simphony.core/test/repast/simphony/parameter/ParametersCreatorTest.java +++ b/repast.simphony.core/test/repast/simphony/parameter/ParametersCreatorTest.java @@ -1,12 +1,12 @@ package repast.simphony.parameter; -import junit.framework.TestCase; -import org.apache.commons.lang3.Range; -import repast.simphony.parameter.*; - import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.Range; + +import junit.framework.TestCase; + /** * @author Nick Collier */ @@ -69,7 +69,7 @@ public void testConvertor() { public void testConstraints() { ParametersCreator creator = new ParametersCreator(); creator.addParameter("int", "My Int", int.class, 3, false); - creator.addConstraint("int", Range.between(0.0, 11.2)); + creator.addConstraint("int", new SteppedRange(0.0, 11.2, 1.0)); List list = new ArrayList(); list.add("foo"); list.add("bar"); @@ -83,7 +83,7 @@ public void testConstraints() { assertEquals("int", details.getName()); assertEquals(int.class, details.getType()); assertEquals(3, details.getDefaultValue()); - assertEquals(Range.between(0d, 11.2d), details.getConstrainingRange()); + assertEquals(new SteppedRange(0d, 11.2d, 1.0), details.getConstrainingRange()); assertEquals(3, params.getValue("int")); assertEquals("foo", params.getValue("string")); @@ -122,7 +122,7 @@ public void testBadConstraint() { ParametersCreator creator = new ParametersCreator(); creator.addParameter("int", "My Int", int.class, 3, false); try { - creator.addConstraint("int", Range.between(-3.0, 0.0)); + creator.addConstraint("int", new SteppedRange(-3.0, 0.0, 1.0)); fail("should throw exception"); } catch (IllegalParameterException ex) { //ex.printStackTrace(); diff --git a/repast.simphony.core/test/repast/simphony/space/grid/GridTest.java b/repast.simphony.core/test/repast/simphony/space/grid/GridTest.java index 1356dc380..f6e93ba7d 100644 --- a/repast.simphony.core/test/repast/simphony/space/grid/GridTest.java +++ b/repast.simphony.core/test/repast/simphony/space/grid/GridTest.java @@ -8,8 +8,8 @@ import java.util.Map; import java.util.Set; -import javax.vecmath.Matrix3d; -import javax.vecmath.Vector3d; +import org.jogamp.vecmath.Matrix3d; +import org.jogamp.vecmath.Vector3d; import junit.framework.TestCase; import junit.framework.TestSuite; diff --git a/repast.simphony.data.ui/META-INF/MANIFEST.MF b/repast.simphony.data.ui/META-INF/MANIFEST.MF index 6003897a9..403fc1a2b 100644 --- a/repast.simphony.data.ui/META-INF/MANIFEST.MF +++ b/repast.simphony.data.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast ui Bundle-SymbolicName: repast.simphony.data.ui -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: saf.core.ui, repast.simphony.data, repast.simphony.gui, @@ -10,7 +10,7 @@ Require-Bundle: saf.core.ui, repast.simphony.core, repast.simphony.runtime, repast.simphony.scenario, - repast.simphony.eclipse;bundle-version="2.7.0" + repast.simphony.eclipse;bundle-version="2.8.0" Export-Package: repast.simphony.data.analysis, repast.simphony.data2.gui, repast.simphony.data2.wizard diff --git a/repast.simphony.data.ui/licenses/repast-license.txt b/repast.simphony.data.ui/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.data.ui/licenses/repast-license.txt +++ b/repast.simphony.data.ui/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.data.ui/plugin_jpf.xml b/repast.simphony.data.ui/plugin_jpf.xml index e50ea6b0a..0dc6f52cd 100644 --- a/repast.simphony.data.ui/plugin_jpf.xml +++ b/repast.simphony.data.ui/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.data/META-INF/MANIFEST.MF b/repast.simphony.data/META-INF/MANIFEST.MF index 4e7d3f954..45eac7178 100644 --- a/repast.simphony.data/META-INF/MANIFEST.MF +++ b/repast.simphony.data/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast data Bundle-SymbolicName: repast.simphony.data -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: bin/ Export-Package: repast.simphony.data2, repast.simphony.data2.builder, diff --git a/repast.simphony.data/licenses/repast-license.txt b/repast.simphony.data/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.data/licenses/repast-license.txt +++ b/repast.simphony.data/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.data/plugin_jpf.xml b/repast.simphony.data/plugin_jpf.xml index 7082f104b..fe0e2a6cb 100644 --- a/repast.simphony.data/plugin_jpf.xml +++ b/repast.simphony.data/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/repast.simphony.dataLoader.ui/META-INF/MANIFEST.MF b/repast.simphony.dataLoader.ui/META-INF/MANIFEST.MF index b93022a94..86a486f98 100644 --- a/repast.simphony.dataLoader.ui/META-INF/MANIFEST.MF +++ b/repast.simphony.dataLoader.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast dataloader ui Bundle-SymbolicName: repast.simphony.dataLoader.ui -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Export-Package: repast.simphony.dataLoader.ui, repast.simphony.dataLoader.ui.wizard, repast.simphony.dataLoader.ui.wizard.builder diff --git a/repast.simphony.dataLoader.ui/licenses/repast-license.txt b/repast.simphony.dataLoader.ui/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.dataLoader.ui/licenses/repast-license.txt +++ b/repast.simphony.dataLoader.ui/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.dataLoader.ui/plugin_jpf.xml b/repast.simphony.dataLoader.ui/plugin_jpf.xml index 4a246a813..f18ce4b31 100644 --- a/repast.simphony.dataLoader.ui/plugin_jpf.xml +++ b/repast.simphony.dataLoader.ui/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.dataLoader/META-INF/MANIFEST.MF b/repast.simphony.dataLoader/META-INF/MANIFEST.MF index ab0b61948..9b8cc6cd9 100644 --- a/repast.simphony.dataLoader/META-INF/MANIFEST.MF +++ b/repast.simphony.dataLoader/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast dataloader Bundle-SymbolicName: repast.simphony.dataLoader -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.core, repast.simphony.plugin.util, repast.simphony.scenario, diff --git a/repast.simphony.dataLoader/licenses/repast-license.txt b/repast.simphony.dataLoader/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.dataLoader/licenses/repast-license.txt +++ b/repast.simphony.dataLoader/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.dataLoader/plugin_jpf.xml b/repast.simphony.dataLoader/plugin_jpf.xml index 0dd82947f..0930f5cdd 100644 --- a/repast.simphony.dataLoader/plugin_jpf.xml +++ b/repast.simphony.dataLoader/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.deployment/Building Javadoc.txt b/repast.simphony.deployment/Building Javadoc.txt index f11bd8c21..c5ce6a4f5 100644 --- a/repast.simphony.deployment/Building Javadoc.txt +++ b/repast.simphony.deployment/Building Javadoc.txt @@ -2,6 +2,10 @@ Building Repast Javadoc 1. Run the Ant javadoc.xml. You may need to modify or create a launch config that provides the javadoc executable if not on the system path. + + - Update the javadoc title in javadoc.xml + - Check the link href to online Java API in javadoc.xml + - Make sure that links to Java base classes work in the generated javadoc. 2. Run the buildGroovydocs ant script in r.s.relogo.runtime as described in the r.s.relogo.runtime/docs/Readme.txt Step 1. diff --git a/repast.simphony.deployment/Generate javadoc Win.launch b/repast.simphony.deployment/Generate javadoc Win.launch index 75c2f2603..5778256ab 100644 --- a/repast.simphony.deployment/Generate javadoc Win.launch +++ b/repast.simphony.deployment/Generate javadoc Win.launch @@ -8,6 +8,7 @@ + @@ -15,7 +16,7 @@ - + diff --git a/repast.simphony.deployment/installer_scripts/repast-license.txt b/repast.simphony.deployment/installer_scripts/repast-license.txt index 94ee72cab..62ffb3d87 100644 --- a/repast.simphony.deployment/installer_scripts/repast-license.txt +++ b/repast.simphony.deployment/installer_scripts/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.deployment/javadoc.xml b/repast.simphony.deployment/javadoc.xml index e3fecc17a..f4062596d 100644 --- a/repast.simphony.deployment/javadoc.xml +++ b/repast.simphony.deployment/javadoc.xml @@ -1,9 +1,16 @@ + + additionalparam="--ignore-source-errors"> + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/repast.simphony.deployment/licenses/repast-license.txt b/repast.simphony.deployment/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.deployment/licenses/repast-license.txt +++ b/repast.simphony.deployment/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.deployment/update_jpf_plugins.xml b/repast.simphony.deployment/update_jpf_plugins.xml index 74ff0e250..bfc96138d 100644 --- a/repast.simphony.deployment/update_jpf_plugins.xml +++ b/repast.simphony.deployment/update_jpf_plugins.xml @@ -1,6 +1,6 @@ - + diff --git a/repast.simphony.distributed.batch.ui/META-INF/MANIFEST.MF b/repast.simphony.distributed.batch.ui/META-INF/MANIFEST.MF index e88535bac..d9e198aa3 100644 --- a/repast.simphony.distributed.batch.ui/META-INF/MANIFEST.MF +++ b/repast.simphony.distributed.batch.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast distriubuted batch ui Bundle-SymbolicName: repast.simphony.distributed.batch.ui -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.scenario, saf.core.ui, repast.simphony.gui, diff --git a/repast.simphony.distributed.batch.ui/plugin_jpf.xml b/repast.simphony.distributed.batch.ui/plugin_jpf.xml index 63cf25d57..db7fb306f 100644 --- a/repast.simphony.distributed.batch.ui/plugin_jpf.xml +++ b/repast.simphony.distributed.batch.ui/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.distributed.batch.ui/src-standalone/repast/simphony/batch/standalone/StandAloneMain.java b/repast.simphony.distributed.batch.ui/src-standalone/repast/simphony/batch/standalone/StandAloneMain.java index eb402212e..15b367a02 100644 --- a/repast.simphony.distributed.batch.ui/src-standalone/repast/simphony/batch/standalone/StandAloneMain.java +++ b/repast.simphony.distributed.batch.ui/src-standalone/repast/simphony/batch/standalone/StandAloneMain.java @@ -57,7 +57,7 @@ public static Options getOptions() { return options; } - private static final String PLUGINS_VERSION = "2.7.0"; + private static final String PLUGINS_VERSION = "2.8.0"; private static final String PLUGIN_DIR = "plugin_dir"; public static final String MODEL_DIR = "model_dir"; public static final String PROPS_FILE = "props_file"; diff --git a/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/Main.java b/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/Main.java index 39029f556..47d9e2a5d 100644 --- a/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/Main.java +++ b/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/Main.java @@ -4,6 +4,7 @@ package repast.simphony.batch.gui; import java.awt.BorderLayout; +import java.awt.Dimension; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -66,7 +67,9 @@ public void run(String modelDir) { else frame.add(new MainPanel(), BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setSize(650, 550); + frame.setSize(650, 650); + frame.setMinimumSize(new Dimension(600, 430)); + frame.setTitle("Repast Simphony Batch"); frame.setLocationRelativeTo(null); frame.setVisible(true); } diff --git a/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/ModelPanel.java b/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/ModelPanel.java index b803e27a7..6b4a7a1bd 100644 --- a/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/ModelPanel.java +++ b/repast.simphony.distributed.batch.ui/src/repast/simphony/batch/gui/ModelPanel.java @@ -73,7 +73,7 @@ public ModelPanel(PresentationModel pModel) { formBuilder.nextLine(); formBuilder.append(new JLabel("Optional Output File Patterns:"), 4); formBuilder.nextLine(); - formBuilder.defaultRowSpec(RowSpec.decode("fill:pref")); + formBuilder.defaultRowSpec(RowSpec.decode("fill:pref:grow")); formBuilder.append(createPatternPanel(), 5); formBuilder.defaultRowSpec(FormSpecs.PREF_ROWSPEC); @@ -91,8 +91,12 @@ public ModelPanel(PresentationModel pModel) { formBuilder.append("Poll Frequency (minutes):"); formBuilder.append(pollSpn, 1); - - add(formBuilder.getPanel(), BorderLayout.CENTER); + + JScrollPane sp = new JScrollPane(formBuilder.getPanel()); + sp.getVerticalScrollBar().setUnitIncrement(8); + sp.getViewport().setOpaque(false); + sp.setBackground(new JPanel().getBackground()); + add(sp, BorderLayout.CENTER); bindComponents(pModel); initListeners(); } diff --git a/repast.simphony.distributed.batch/META-INF/MANIFEST.MF b/repast.simphony.distributed.batch/META-INF/MANIFEST.MF index f74083b10..fd8cf9fc4 100644 --- a/repast.simphony.distributed.batch/META-INF/MANIFEST.MF +++ b/repast.simphony.distributed.batch/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast distributed batch Bundle-SymbolicName: repast.simphony.distributed.batch -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.batch, repast.simphony.core, repast.simphony.data, diff --git a/repast.simphony.distributed.batch/plugin_jpf.xml b/repast.simphony.distributed.batch/plugin_jpf.xml index 5916e43bf..e4686348e 100644 --- a/repast.simphony.distributed.batch/plugin_jpf.xml +++ b/repast.simphony.distributed.batch/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.distributed.batch/resources/repast.slurm b/repast.simphony.distributed.batch/resources/repast.slurm new file mode 100644 index 000000000..06f3c2535 --- /dev/null +++ b/repast.simphony.distributed.batch/resources/repast.slurm @@ -0,0 +1,30 @@ +#!/bin/bash + +#SBATCH --job-name= +#SBATCH --partition= +#SBATCH --nodes= +#SBATCH --ntasks-per-node= +#SBATCH --time= +#SBATCH --output=output.txt +#SBATCH --mail-user= +#SBATCH --mail-type=all + +cd $SLURM_SUBMIT_DIR + +ROOT=$( /bin/pwd ) +PARAMETER_FILE=$ROOT/unrolledParamFile.txt +TOTAL_LINES=`wc -l $PARAMETER_FILE | cut -f1 -d' '` +echo "Total lines: $TOTAL_LINES" + +PROCS=$(($SLURM_NTASKS_PER_NODE * $SLURM_JOB_NUM_NODES)) +if [ "$TOTAL_LINES" -lt "$PROCS" ] +then + echo "Number of allocated processes ($PROCS) is greater than the number of parameter combinations to run ($TOTAL_LINES). Nu\ +mber of processes is equal to --nodes ($SLURM_JOB_NUM_NODES) * --ntasks-per_node ($SLURM_NTASKS_PER_NODE). Aborting job." +exit +fi + +echo "Total Processes: $PROCS" + +srun -n $PROCS --ntasks-per-node=$SLURM_NTASKS_PER_NODE $SLURM_SUBMIT_DIR/repastwrapper_slurm.sh $TOTAL_LINES $PARAMETER_FILE + diff --git a/repast.simphony.distributed.batch/resources/repastwrapper.sh b/repast.simphony.distributed.batch/resources/repastwrapper.sh index 111fedf52..f76c03330 100755 --- a/repast.simphony.distributed.batch/resources/repastwrapper.sh +++ b/repast.simphony.distributed.batch/resources/repastwrapper.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd $PBS_O_WORKDIR +cd $SUBMIT_DIR totr=$1 # total runs rpi=$2 # runs per instance diff --git a/repast.simphony.distributed.batch/resources/repastwrapper_slurm.sh b/repast.simphony.distributed.batch/resources/repastwrapper_slurm.sh new file mode 100755 index 000000000..a78edf62d --- /dev/null +++ b/repast.simphony.distributed.batch/resources/repastwrapper_slurm.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +cd $SLURM_SUBMIT_DIR + +TOTAL_RUNS=$1 # Total number of runs +PARAMETER_FILE=$2 # unrolled param file +INSTANCE="instance_"$SLURM_PROCID + +PROCS=$(($SLURM_NTASKS_PER_NODE * $SLURM_JOB_NUM_NODES)) +RUNS_PER_INSTANCE=$(($TOTAL_RUNS / $PROCS)) +REMAINDER=$(($TOTAL_RUNS % $PROCS)) + +if [ "$SLURM_PROCID" -lt "$REMAINDER" ] +then + RUNS_PER_INSTANCE=$(($RUNS_PER_INSTANCE + 1)) +fi + +BEGIN=$(( $SLURM_PROCID * $RUNS_PER_INSTANCE + 1 )) + +if [ "$SLURM_PROCID" -ge "$REMAINDER" ] +then + BEGIN=$(( $BEGIN + $REMAINDER )) +fi + +END=$(( $BEGIN + $RUNS_PER_INSTANCE - 1 )) + +echo "Instance_$SLURM_PROCID - RUNS_PER_INSTANCE: $RUNS_PER_INSTANCE, LINES: $BEGIN to $END" + +mkdir $INSTANCE +cd $INSTANCE + +sed -n "$BEGIN","$END"p "$PARAMETER_FILE" > localParamFile.txt +ln -s "../data" data + +java -Xmx512m -cp "../lib/*" repast.simphony.batch.InstanceRunner \ + -pxml ../scenario.rs/batch_params.xml \ + -scenario ../scenario.rs \ + -id $SLURM_PROCID \ + -pinput localParamFile.txt diff --git a/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/OutputFinder.java b/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/OutputFinder.java index 3656873ca..c568575a6 100755 --- a/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/OutputFinder.java +++ b/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/OutputFinder.java @@ -114,10 +114,12 @@ protected void findFiles(List matchers, List allFiles, Str for (String file : allFiles) { for (MatchedFiles matcher : matchers) { + // System.out.println("Attempting to match " + file); if (matcher.matches(new File(file).toPath())) { matcher.addFile(new File(instanceDir, file)); + // System.out.println("Matcher matched " + file); break; - } + } } } diff --git a/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/RemoteOutputFinderCopier.java b/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/RemoteOutputFinderCopier.java index 9b4c60038..0abe7c740 100755 --- a/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/RemoteOutputFinderCopier.java +++ b/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/RemoteOutputFinderCopier.java @@ -4,14 +4,16 @@ package repast.simphony.batch.ssh; import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; -import repast.simphony.batch.BatchConstants; - import com.jcraft.jsch.JSchException; import com.jcraft.jsch.SftpException; +import repast.simphony.batch.BatchConstants; + /** * Copies the output from remote ssh runs into a local directory. * @@ -24,18 +26,29 @@ private List findOutputFiles(SSHSession session, List inst // assumes remote file use "/" as separator so useWindowsSeparator is false List matchers = createMatches(false); + for (String dir : instanceDirs) { List files = session.listRemoteDirectory(dir, true); // session returns file including instance directory, we want to remove // that and the trailing "/" List fixedFiles = new ArrayList<>(); for (String file : files) { - fixedFiles.add(file.substring(dir.length() + 1)); - //System.out.println(fixedFiles.get(fixedFiles.size() - 1)); + fixedFiles.add(file.substring(dir.length() + 1)); } - + findFiles(matchers, fixedFiles, dir); } + + // This adds the root data directory to the list of files to try to match to +// Path parent = Paths.get(instanceDirs.get(0)).getParent(); +// Path p = Paths.get(parent.toString(), "data"); +// List files = session.listRemoteDirectory(p.toString(), true); +// List fixedFiles = new ArrayList<>(); +// for (String f : files) { +// fixedFiles.add(f.substring(parent.toString().length() + 1)); +// } +// findFiles(matchers, fixedFiles, "."); + return matchers; } diff --git a/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/SSHSession.java b/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/SSHSession.java index e54b7f29b..3e887780c 100755 --- a/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/SSHSession.java +++ b/repast.simphony.distributed.batch/src/repast/simphony/batch/ssh/SSHSession.java @@ -21,6 +21,7 @@ import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; +import com.jcraft.jsch.SftpATTRS; import com.jcraft.jsch.SftpException; /** @@ -29,307 +30,316 @@ */ public class SSHSession { - private static Logger logger = Logger.getLogger(SSHSession.class); - - private Session session; - - public SSHSession(Session session) { - this.session = session; - } - - /** - * Executes teh specified command in the background. - * - * @param cmd - * @throws JSchException - */ - public void executeBackgroundCommand(String cmd) throws JSchException { - Channel channel = null; - try { - channel = session.openChannel("exec"); - ((ChannelExec) channel).setPty(false); - // TODO maybe remove 2>&1 as that is bash specific - ((ChannelExec) channel).setCommand(cmd + " > /dev/null 2>&1 &"); - channel.setInputStream(null); - channel.connect(); - - } finally { - if (channel != null) - channel.disconnect(); - } - } - - /* - * Lists the non-directory contents the specified remote directory and places the - * results into the files parameters. If recurse is true, then - * this will recurse into any directories and list the contents - * of those directories. - * - * @param sftp - * @param remoteDir - * @param files - * @param recurse - * @throws SftpException - */ - @SuppressWarnings("unchecked") - private void listRemoteDirectory(ChannelSftp sftp, String remoteDir, List files, - boolean recurse) throws SftpException { - - Vector entries = sftp.ls(remoteDir); - List subs = new ArrayList<>(); - for (ChannelSftp.LsEntry entry : entries) { - String filename = entry.getFilename(); - if (!filename.equals(".") && !filename.equals("..")) { - if (recurse && entry.getAttrs().isDir()) - subs.add(remoteDir + "/" + filename); - - files.add(remoteDir + "/" + filename); - } - } - - for (String sub : subs) { - listRemoteDirectory(sftp, sub, files, true); - } - } - - /** - * Returns the listing of the specified remote directory as a list of Strings. - * - * @param remoteDir - * @return - * @throws JSchException - * @throws SftpException - */ - public List listRemoteDirectory(String remoteDir) throws JSchException, SftpException { - return listRemoteDirectory(remoteDir, false); - } - - /** - * Returns the file listing of the specified remote directory as a list of Strings - * with an option to recurse into any directories that are found. If recurse is true - * then the files in the subdirectories will be returned with that subdirectory - * prefixed to the file name (e.g. output/file1). - * - * @param remoteDir - * @return - * @throws JSchException - * @throws SftpException - */ - public List listRemoteDirectory(String remoteDir, boolean recurse) throws JSchException, - SftpException { - List out = new ArrayList(); - ChannelSftp sftp = null; - try { - sftp = (ChannelSftp) session.openChannel("sftp"); - sftp.connect(); - listRemoteDirectory(sftp, remoteDir, out, recurse); - } finally { - if (sftp != null) - sftp.exit(); - sftp.disconnect(); - } - - return out; - } - - /** - * Execute the specifed command on the remote machine and - * wait for the resutl. - * - * @param cmd - * @param level - * @return - * @throws JSchException - */ - public int executeCmd(String cmd, Level level) throws JSchException { - Channel channel = null; - try { - channel = session.openChannel("exec"); - - ((ChannelExec) channel).setCommand(cmd); - channel.setInputStream(null); - - ((ChannelExec) channel).setErrStream(new PrintStream(new LoggingOutputStream(logger, level))); - channel.connect(); - - while (!channel.isClosed()) { - try { - Thread.sleep(1000); - } catch (InterruptedException ex) { - } - } - - return channel.getExitStatus(); - } finally { - if (channel != null) - channel.disconnect(); - } - } - - /** - * Execute the specified command on the remote machine and append any - * output to the StringBuilder. If setErrStream is true then errors - * will be directory to a LoggingOutputStream. - * - * @param cmd - * @param builder - * @param setErrStream - * @return - * @throws JSchException - * @throws IOException - */ - public int executeCmd(String cmd, StringBuilder builder, boolean setErrStream) - throws JSchException, IOException { - Channel channel = null; - int exitStatus = 0; - try { - channel = session.openChannel("exec"); - ((ChannelExec) channel).setCommand(cmd); - channel.setInputStream(null); - - if (setErrStream) - ((ChannelExec) channel).setErrStream(new PrintStream(new LoggingOutputStream(logger, - Level.ERROR))); - InputStream in = channel.getInputStream(); - channel.connect(); - - // idea here is to poll for the channel to be closed, - // and get any output from the command, if there is any. - // exit status should 0 on success. - - byte[] tmp = new byte[1024]; - while (true) { - while (in.available() > 0) { - int i = in.read(tmp, 0, 1024); - if (i < 0) - break; - builder.append(new String(tmp, 0, i)); - } - - if (channel.isClosed()) { - exitStatus = channel.getExitStatus(); - break; - } - try { - Thread.sleep(1000); - } catch (Exception ee) { - } - } - - } finally { - if (channel != null) - channel.disconnect(); - } - - return exitStatus; - } - - /** - * Compies the specified file to the home directory of the user - * used to log in to the remote. - * - * @param localFile - * @throws JSchException - * @throws SftpException - */ - public void copyFileToRemote(File localFile) throws JSchException, SftpException { - ChannelSftp sftp = null; - try { - sftp = (ChannelSftp) session.openChannel("sftp"); - sftp.connect(); - sftp.put(localFile.getAbsolutePath().replace("\\", "/"), localFile.getName()); - } finally { - if (sftp != null) - sftp.exit(); - sftp.disconnect(); - } - } - - /** - * Copies the specified file to the specified remote directory. - * - * @param localFile - * @param remoteDirectory - * @throws JSchException - * @throws SftpException - */ - public void copyFileToRemote(File localFile, String remoteDirectory) throws JSchException, - SftpException { - ChannelSftp sftp = null; - try { - sftp = (ChannelSftp) session.openChannel("sftp"); - sftp.connect(); - sftp.cd(remoteDirectory); - sftp.put(localFile.getAbsolutePath().replace("\\", "/"), localFile.getName()); - } finally { - if (sftp != null) - sftp.exit(); - sftp.disconnect(); - } - } - - /** - * Copies the specified remote file to the specified local directory. If preserveRemotePath - * is true then path will be preserved when the file is copied. For example, assuming a local - * directory of "foo", then copying "output/out.txt" will create "foo/output/out.txt". - * - * @param localDir - * @param remoteFile - * @param preserveRemotePath - * @return - * @throws SftpException - * @throws JSchException - */ - public File copyFileFromRemote(String localDir, File remoteFile, boolean preserveRemotePath) throws SftpException, - JSchException { - List files = new ArrayList(); - files.add(remoteFile); - return copyFilesFromRemote(localDir, files, preserveRemotePath).get(0); - } - - /** - * Copies files from the remote to the local directory preserving the directory - * structure. If preserveRemotePath - * is true then path will be preserved when the file is copied. For example, assuming a local - * directory of "foo", then copying "output/out.txt" will create "foo/output/out.txt". - * - * - * @param localDir - * @param remoteFiles - * @return - * @throws SftpException - * @throws JSchException - */ - public List copyFilesFromRemote(String localDir, List remoteFiles, boolean preserveRemotePath) - throws SftpException, JSchException { - ChannelSftp sftp = null; - List out = new ArrayList(); - try { - sftp = (ChannelSftp) session.openChannel("sftp"); - sftp.connect(); - File ld = new File(localDir); - ld.mkdirs(); - - for (File remoteFile : remoteFiles) { - String path = preserveRemotePath ? remoteFile.getPath() : remoteFile.getName(); - File dst = new File(localDir, path); - dst.getParentFile().mkdirs(); - //System.out.printf("copying %s to %s%n", remoteFile.getPath(), dst.toString()); - sftp.get(remoteFile.getPath().replace("\\", "/"), dst.getPath().replace("\\", "/")); - - out.add(dst); - } - } finally { - if (sftp != null) - sftp.exit(); - sftp.disconnect(); - } - - return out; - } - - public void disconnect() { - session.disconnect(); - } + private static Logger logger = Logger.getLogger(SSHSession.class); + + private Session session; + + public SSHSession(Session session) { + this.session = session; + } + + /** + * Executes teh specified command in the background. + * + * @param cmd + * @throws JSchException + */ + public void executeBackgroundCommand(String cmd) throws JSchException { + Channel channel = null; + try { + channel = session.openChannel("exec"); + ((ChannelExec) channel).setPty(false); + // TODO maybe remove 2>&1 as that is bash specific + ((ChannelExec) channel).setCommand(cmd + " > /dev/null 2>&1 &"); + channel.setInputStream(null); + channel.connect(); + + } finally { + if (channel != null) + channel.disconnect(); + } + } + + /* + * Lists the non-directory contents the specified remote directory and places + * the results into the files parameters. If recurse is true, then this will + * recurse into any directories and list the contents of those directories. + * + * @param sftp + * + * @param remoteDir + * + * @param files + * + * @param recurse + * + * @throws SftpException + */ + @SuppressWarnings("unchecked") + private void listRemoteDirectory(ChannelSftp sftp, String remoteDir, List files, boolean recurse) + throws SftpException { + + Vector entries = sftp.ls(remoteDir); + List subs = new ArrayList<>(); + for (ChannelSftp.LsEntry entry : entries) { + String filename = entry.getFilename(); + if (!filename.equals(".") && !filename.equals("..")) { + SftpATTRS attrs = entry.getAttrs(); +// if (attrs.isLink()) { +// String target = sftp.readlink(remoteDir + "/" + filename); +// SftpATTRS linkAttrs = sftp.stat(target); +// if (linkAttrs.isDir()) { +// subs.add(target); +// } +// } else { + if (recurse && attrs.isDir()) { + subs.add(remoteDir + "/" + filename); + } + //} + files.add(remoteDir + "/" + filename); + } + } + + for (String sub : subs) { + listRemoteDirectory(sftp, sub, files, true); + } + } + + /** + * Returns the listing of the specified remote directory as a list of Strings. + * + * @param remoteDir + * @return + * @throws JSchException + * @throws SftpException + */ + public List listRemoteDirectory(String remoteDir) throws JSchException, SftpException { + return listRemoteDirectory(remoteDir, false); + } + + /** + * Returns the file listing of the specified remote directory as a list of + * Strings with an option to recurse into any directories that are found. If + * recurse is true then the files in the subdirectories will be returned with + * that subdirectory prefixed to the file name (e.g. output/file1). + * + * @param remoteDir + * @return + * @throws JSchException + * @throws SftpException + */ + public List listRemoteDirectory(String remoteDir, boolean recurse) throws JSchException, SftpException { + List out = new ArrayList(); + ChannelSftp sftp = null; + try { + sftp = (ChannelSftp) session.openChannel("sftp"); + sftp.connect(); + listRemoteDirectory(sftp, remoteDir, out, recurse); + } finally { + if (sftp != null) + sftp.exit(); + sftp.disconnect(); + } + + return out; + } + + /** + * Execute the specifed command on the remote machine and wait for the resutl. + * + * @param cmd + * @param level + * @return + * @throws JSchException + */ + public int executeCmd(String cmd, Level level) throws JSchException { + Channel channel = null; + try { + channel = session.openChannel("exec"); + + ((ChannelExec) channel).setCommand(cmd); + channel.setInputStream(null); + + ((ChannelExec) channel).setErrStream(new PrintStream(new LoggingOutputStream(logger, level))); + channel.connect(); + + while (!channel.isClosed()) { + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + } + } + + return channel.getExitStatus(); + } finally { + if (channel != null) + channel.disconnect(); + } + } + + /** + * Execute the specified command on the remote machine and append any output to + * the StringBuilder. If setErrStream is true then errors will be directory to a + * LoggingOutputStream. + * + * @param cmd + * @param builder + * @param setErrStream + * @return + * @throws JSchException + * @throws IOException + */ + public int executeCmd(String cmd, StringBuilder builder, boolean setErrStream) throws JSchException, IOException { + Channel channel = null; + int exitStatus = 0; + try { + channel = session.openChannel("exec"); + ((ChannelExec) channel).setCommand(cmd); + channel.setInputStream(null); + + if (setErrStream) + ((ChannelExec) channel).setErrStream(new PrintStream(new LoggingOutputStream(logger, Level.ERROR))); + InputStream in = channel.getInputStream(); + channel.connect(); + + // idea here is to poll for the channel to be closed, + // and get any output from the command, if there is any. + // exit status should 0 on success. + + byte[] tmp = new byte[1024]; + while (true) { + while (in.available() > 0) { + int i = in.read(tmp, 0, 1024); + if (i < 0) + break; + builder.append(new String(tmp, 0, i)); + } + + if (channel.isClosed()) { + exitStatus = channel.getExitStatus(); + break; + } + try { + Thread.sleep(1000); + } catch (Exception ee) { + } + } + + } finally { + if (channel != null) + channel.disconnect(); + } + + return exitStatus; + } + + /** + * Compies the specified file to the home directory of the user used to log in + * to the remote. + * + * @param localFile + * @throws JSchException + * @throws SftpException + */ + public void copyFileToRemote(File localFile) throws JSchException, SftpException { + ChannelSftp sftp = null; + try { + sftp = (ChannelSftp) session.openChannel("sftp"); + sftp.connect(); + sftp.put(localFile.getAbsolutePath().replace("\\", "/"), localFile.getName()); + } finally { + if (sftp != null) + sftp.exit(); + sftp.disconnect(); + } + } + + /** + * Copies the specified file to the specified remote directory. + * + * @param localFile + * @param remoteDirectory + * @throws JSchException + * @throws SftpException + */ + public void copyFileToRemote(File localFile, String remoteDirectory) throws JSchException, SftpException { + ChannelSftp sftp = null; + try { + sftp = (ChannelSftp) session.openChannel("sftp"); + sftp.connect(); + sftp.cd(remoteDirectory); + sftp.put(localFile.getAbsolutePath().replace("\\", "/"), localFile.getName()); + } finally { + if (sftp != null) + sftp.exit(); + sftp.disconnect(); + } + } + + /** + * Copies the specified remote file to the specified local directory. If + * preserveRemotePath is true then path will be preserved when the file is + * copied. For example, assuming a local directory of "foo", then copying + * "output/out.txt" will create "foo/output/out.txt". + * + * @param localDir + * @param remoteFile + * @param preserveRemotePath + * @return + * @throws SftpException + * @throws JSchException + */ + public File copyFileFromRemote(String localDir, File remoteFile, boolean preserveRemotePath) + throws SftpException, JSchException { + List files = new ArrayList(); + files.add(remoteFile); + return copyFilesFromRemote(localDir, files, preserveRemotePath).get(0); + } + + /** + * Copies files from the remote to the local directory preserving the directory + * structure. If preserveRemotePath is true then path will be preserved when the + * file is copied. For example, assuming a local directory of "foo", then + * copying "output/out.txt" will create "foo/output/out.txt". + * + * + * @param localDir + * @param remoteFiles + * @return + * @throws SftpException + * @throws JSchException + */ + public List copyFilesFromRemote(String localDir, List remoteFiles, boolean preserveRemotePath) + throws SftpException, JSchException { + ChannelSftp sftp = null; + List out = new ArrayList(); + try { + sftp = (ChannelSftp) session.openChannel("sftp"); + sftp.connect(); + File ld = new File(localDir); + ld.mkdirs(); + + for (File remoteFile : remoteFiles) { + String path = preserveRemotePath ? remoteFile.getPath() : remoteFile.getName(); + File dst = new File(localDir, path); + dst.getParentFile().mkdirs(); + // System.out.printf("copying %s to %s%n", remoteFile.getPath(), + // dst.toString()); + sftp.get(remoteFile.getPath().replace("\\", "/"), dst.getPath().replace("\\", "/")); + + out.add(dst); + } + } finally { + if (sftp != null) + sftp.exit(); + sftp.disconnect(); + } + + return out; + } + + public void disconnect() { + session.disconnect(); + } } diff --git a/repast.simphony.distributed.batch/src/scripts/build.xml b/repast.simphony.distributed.batch/src/scripts/build.xml index 2985a0f2f..1b8e10723 100644 --- a/repast.simphony.distributed.batch/src/scripts/build.xml +++ b/repast.simphony.distributed.batch/src/scripts/build.xml @@ -68,6 +68,8 @@ + + @@ -155,12 +157,12 @@ - + - - + + diff --git a/repast.simphony.eclipse/META-INF/MANIFEST.MF b/repast.simphony.eclipse/META-INF/MANIFEST.MF index 5e3fe8a52..e0e9ac023 100644 --- a/repast.simphony.eclipse/META-INF/MANIFEST.MF +++ b/repast.simphony.eclipse/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast Simphony Bundle-SymbolicName: repast.simphony.eclipse;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: bin/ Bundle-Activator: repast.simphony.eclipse.RepastSimphonyPlugin Bundle-Vendor: Argonne National Laboratory diff --git a/repast.simphony.eclipse/Simphony Eclipse Application.launch b/repast.simphony.eclipse/Simphony Eclipse Application.launch index 6f9e59b65..ee7c2fd36 100644 --- a/repast.simphony.eclipse/Simphony Eclipse Application.launch +++ b/repast.simphony.eclipse/Simphony Eclipse Application.launch @@ -1,208 +1,769 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repast.simphony.eclipse/about.properties b/repast.simphony.eclipse/about.properties index 0a28e26f2..0e87aded2 100644 --- a/repast.simphony.eclipse/about.properties +++ b/repast.simphony.eclipse/about.properties @@ -8,5 +8,5 @@ blurb=Repast Simphony\n\ \n\ Version: {featureVersion}\n\ \n\ -(c) Copyright Argonne National Laboratory, 2019. All rights reserved.\n\ +(c) Copyright Argonne National Laboratory, 2020. All rights reserved.\n\ Visit http://repast.github.io \ No newline at end of file diff --git a/repast.simphony.eclipse/licenses/repast-license.txt b/repast.simphony.eclipse/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.eclipse/licenses/repast-license.txt +++ b/repast.simphony.eclipse/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.eclipse/plugin.xml b/repast.simphony.eclipse/plugin.xml index fad908990..03c4dcf85 100644 --- a/repast.simphony.eclipse/plugin.xml +++ b/repast.simphony.eclipse/plugin.xml @@ -18,7 +18,7 @@ - + diff --git a/repast.simphony.eclipse/setupfiles/installer/installation_coordinator.xml b/repast.simphony.eclipse/setupfiles/installer/installation_coordinator.xml index 566a29c94..f9d577466 100644 --- a/repast.simphony.eclipse/setupfiles/installer/installation_coordinator.xml +++ b/repast.simphony.eclipse/setupfiles/installer/installation_coordinator.xml @@ -16,7 +16,7 @@ - + diff --git a/repast.simphony.eclipse/setupfiles/repast-licenses/repast-license.txt b/repast.simphony.eclipse/setupfiles/repast-licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.eclipse/setupfiles/repast-licenses/repast-license.txt +++ b/repast.simphony.eclipse/setupfiles/repast-licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastLauncherClasspathContainer.java b/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastLauncherClasspathContainer.java index cb34d69e1..12c1b6803 100644 --- a/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastLauncherClasspathContainer.java +++ b/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastLauncherClasspathContainer.java @@ -20,7 +20,7 @@ public class GroovyRepastLauncherClasspathContainer extends GroovyClasspathConta private IClasspathEntry[] classpathList = null; public GroovyRepastLauncherClasspathContainer(IJavaProject project) { - super(project); + super(PATH); } public IClasspathEntry[] getClasspathEntries() { diff --git a/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastServerLauncherClasspathContainer.java b/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastServerLauncherClasspathContainer.java index fee99a95f..07183b9b9 100644 --- a/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastServerLauncherClasspathContainer.java +++ b/repast.simphony.eclipse/src/repast/simphony/eclipse/GroovyRepastServerLauncherClasspathContainer.java @@ -20,7 +20,7 @@ public class GroovyRepastServerLauncherClasspathContainer extends GroovyClasspat private IClasspathEntry[] classpathList = null; public GroovyRepastServerLauncherClasspathContainer(IJavaProject project) { - super(project); + super(PATH); } public IClasspathEntry[] getClasspathEntries() { diff --git a/repast.simphony.eclipse/src/repast/simphony/eclipse/PerspectiveFactory.java b/repast.simphony.eclipse/src/repast/simphony/eclipse/PerspectiveFactory.java index 501681949..409f37bab 100644 --- a/repast.simphony.eclipse/src/repast/simphony/eclipse/PerspectiveFactory.java +++ b/repast.simphony.eclipse/src/repast/simphony/eclipse/PerspectiveFactory.java @@ -96,7 +96,7 @@ public void createInitialLayout(IPageLayout layout) { } } folder.addView(JavaUI.ID_PACKAGES); - folder.addView(IPageLayout.ID_RES_NAV); +// folder.addView(IPageLayout.ID_RES_NAV); IFolderLayout outputfolder = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, //$NON-NLS-1$ editorArea); @@ -118,7 +118,7 @@ public void createInitialLayout(IPageLayout layout) { // views - standard workbench layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); - layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); +// layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID); layout.addShowViewShortcut("org.eclipse.ui.navigator.ProjectExplorer"); diff --git a/repast.simphony.eclipse/src/repast/simphony/eclipse/RSProjectConfigurator.java b/repast.simphony.eclipse/src/repast/simphony/eclipse/RSProjectConfigurator.java index aabcbbcb7..43205cd50 100644 --- a/repast.simphony.eclipse/src/repast/simphony/eclipse/RSProjectConfigurator.java +++ b/repast.simphony.eclipse/src/repast/simphony/eclipse/RSProjectConfigurator.java @@ -323,7 +323,7 @@ else if (SystemUtils.IS_OS_WINDOWS) r.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); classpath.add(r.getMemento()); - jarPath = GroovyClasspathContainer.CONTAINER_ID; + jarPath = new Path(GroovyClasspathContainer.ID); r = JavaRuntime.newRuntimeContainerClasspathEntry(jarPath, IRuntimeClasspathEntry.USER_CLASSES); r.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); classpath.add(r.getMemento()); @@ -543,7 +543,7 @@ else if (SystemUtils.IS_OS_WINDOWS) r.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); classpath.add(r.getMemento()); - jarPath = GroovyClasspathContainer.CONTAINER_ID; + jarPath = new Path(GroovyClasspathContainer.ID); r = JavaRuntime.newRuntimeContainerClasspathEntry(jarPath, IRuntimeClasspathEntry.USER_CLASSES); r.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); classpath.add(r.getMemento()); diff --git a/repast.simphony.eclipse/src/repast/simphony/eclipse/RepastSimphonyPlugin.java b/repast.simphony.eclipse/src/repast/simphony/eclipse/RepastSimphonyPlugin.java index ee9e8e2d3..6a31c430f 100644 --- a/repast.simphony.eclipse/src/repast/simphony/eclipse/RepastSimphonyPlugin.java +++ b/repast.simphony.eclipse/src/repast/simphony/eclipse/RepastSimphonyPlugin.java @@ -36,7 +36,7 @@ public class RepastSimphonyPlugin extends AbstractUIPlugin { public static final String REPAST_SIMPHONY_PLUGIN_ID = "repast.simphony.eclipse"; public static final String REPAST_SIMPHONY_NATURE_ID = REPAST_SIMPHONY_PLUGIN_ID + ".repast_simphony_nature"; - public static final String REPAST_SIMPHONY_PLUGIN_VERSION = "2.7.0"; + public static final String REPAST_SIMPHONY_PLUGIN_VERSION = "2.8.0"; public static final String JAR_FILE = "repast.simphony.bin_and_src.jar"; public static final String JAR_PROJECT = "repast.simphony.bin_and_src_" + REPAST_SIMPHONY_PLUGIN_VERSION; diff --git a/repast.simphony.essentials/META-INF/MANIFEST.MF b/repast.simphony.essentials/META-INF/MANIFEST.MF index d4848439c..9329cef11 100644 --- a/repast.simphony.essentials/META-INF/MANIFEST.MF +++ b/repast.simphony.essentials/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast essentials Bundle-SymbolicName: repast.simphony.essentials -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-Localization: plugin Require-Bundle: repast.simphony.integration, repast.simphony.sql, diff --git a/repast.simphony.essentials/licenses/repast-license.txt b/repast.simphony.essentials/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.essentials/licenses/repast-license.txt +++ b/repast.simphony.essentials/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.essentials/plugin_jpf.xml b/repast.simphony.essentials/plugin_jpf.xml index e43ed242c..d5f91df16 100644 --- a/repast.simphony.essentials/plugin_jpf.xml +++ b/repast.simphony.essentials/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.freezedry/META-INF/MANIFEST.MF b/repast.simphony.freezedry/META-INF/MANIFEST.MF index 11b77dc48..927b20ca0 100644 --- a/repast.simphony.freezedry/META-INF/MANIFEST.MF +++ b/repast.simphony.freezedry/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast freezedry Bundle-SymbolicName: repast.simphony.freezedry -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Export-Package: repast.simphony.freezedry.engine, repast.simphony.freezedry.gui, repast.simphony.freezedry.wizard diff --git a/repast.simphony.freezedry/licenses/repast-license.txt b/repast.simphony.freezedry/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.freezedry/licenses/repast-license.txt +++ b/repast.simphony.freezedry/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.freezedry/plugin_jpf.xml b/repast.simphony.freezedry/plugin_jpf.xml index abc12ad78..4c811f8c2 100644 --- a/repast.simphony.freezedry/plugin_jpf.xml +++ b/repast.simphony.freezedry/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.gis.visualization/.classpath b/repast.simphony.gis.visualization/.classpath index 2719e6a3d..2eb93484f 100644 --- a/repast.simphony.gis.visualization/.classpath +++ b/repast.simphony.gis.visualization/.classpath @@ -1,5 +1,6 @@ + @@ -8,7 +9,6 @@ - diff --git a/repast.simphony.gis.visualization/META-INF/MANIFEST.MF b/repast.simphony.gis.visualization/META-INF/MANIFEST.MF index 4fa7417c5..bc50efd0f 100644 --- a/repast.simphony.gis.visualization/META-INF/MANIFEST.MF +++ b/repast.simphony.gis.visualization/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast gis visualization Bundle-SymbolicName: repast.simphony.gis.visualization -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-Vendor: Argonne National Laboratory Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: libs.ext, @@ -17,8 +17,8 @@ Require-Bundle: libs.ext, repast.simphony.plugin.util, org.junit Bundle-ClassPath: ., - lib/worldwind-2.1.0.jar, - lib/gt-render-19.1.jar + lib/gt-render-19.1.jar, + lib/worldwind-2.2.0.jar Export-Package: com.zebraimaging, gov.nasa.worldwind, gov.nasa.worldwind.animation, diff --git a/repast.simphony.gis.visualization/build.properties b/repast.simphony.gis.visualization/build.properties index 18260e17a..87d1e9180 100644 --- a/repast.simphony.gis.visualization/build.properties +++ b/repast.simphony.gis.visualization/build.properties @@ -6,8 +6,8 @@ bin.includes = META-INF/,\ icons/,\ plugin_jpf.xml,\ licenses/,\ - lib/worldwind-2.1.0.jar,\ lib/gt-render-18.0.jar,\ - lib/gt-render-19.1.jar + lib/gt-render-19.1.jar,\ + lib/worldwind-2.2.0.jar src.includes = src/,\ test/ diff --git a/repast.simphony.gis.visualization/lib/worldwind-2.1.0.jar b/repast.simphony.gis.visualization/lib/worldwind-2.2.0.jar similarity index 52% rename from repast.simphony.gis.visualization/lib/worldwind-2.1.0.jar rename to repast.simphony.gis.visualization/lib/worldwind-2.2.0.jar index 18240f448..bf204b6e5 100644 Binary files a/repast.simphony.gis.visualization/lib/worldwind-2.1.0.jar and b/repast.simphony.gis.visualization/lib/worldwind-2.2.0.jar differ diff --git a/repast.simphony.gis.visualization/plugin_jpf.xml b/repast.simphony.gis.visualization/plugin_jpf.xml index 594e26260..6d994f6f1 100644 --- a/repast.simphony.gis.visualization/plugin_jpf.xml +++ b/repast.simphony.gis.visualization/plugin_jpf.xml @@ -3,7 +3,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/repast.simphony.gis.visualization/src/repast/simphony/gis/visualization/engine/GIS3DVisualizationRegistryData.java b/repast.simphony.gis.visualization/src/repast/simphony/gis/visualization/engine/GIS3DVisualizationRegistryData.java index daf15f1ab..41dac9b84 100644 --- a/repast.simphony.gis.visualization/src/repast/simphony/gis/visualization/engine/GIS3DVisualizationRegistryData.java +++ b/repast.simphony.gis.visualization/src/repast/simphony/gis/visualization/engine/GIS3DVisualizationRegistryData.java @@ -83,7 +83,7 @@ public ProjectionDescriptorFactory getProjectionDescriptorFactory() { @Override public String getRequiredLibraryClassName() { - return "javax.media.opengl.glu.GLU"; + return "com.jogamp.opengl.glu.GLU"; } @Override diff --git a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/DisplayGIS3D.java b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/DisplayGIS3D.java index 0166e2d62..5102627c9 100644 --- a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/DisplayGIS3D.java +++ b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/DisplayGIS3D.java @@ -9,6 +9,8 @@ import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; import java.awt.image.BufferedImage; @@ -38,8 +40,6 @@ import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.geometry.jts.ReferencedEnvelope; -import com.jogamp.common.os.Platform; - import gov.nasa.worldwind.BasicModel; import gov.nasa.worldwind.Configuration; import gov.nasa.worldwind.Model; @@ -47,6 +47,7 @@ import gov.nasa.worldwind.WorldWind; import gov.nasa.worldwind.WorldWindow; import gov.nasa.worldwind.avlist.AVKey; +import gov.nasa.worldwind.awt.WorldWindowGLJPanel; import gov.nasa.worldwind.event.PositionEvent; import gov.nasa.worldwind.event.PositionListener; import gov.nasa.worldwind.event.SelectEvent; @@ -134,7 +135,7 @@ public class DisplayGIS3D extends AbstractDisplay { protected List globeLayers; protected Map coverageToRenderableMap; - protected WorldWindow worldWindow; + protected WorldWindowGLJPanel worldWindow; protected String displayMode = AVKey.STEREO_MODE_NONE; protected LayerPanel layerPanel; @@ -219,7 +220,7 @@ public DisplayGIS3D(GISDisplayData data, Layout layout) { // } // US GLPanel implementation on all OS to avoid display issues with Java 11 - worldWindow = new RepastWorldWindowGLJPanel(); + worldWindow = new WorldWindowGLJPanel(); worldWindow.setModel(model); @@ -319,6 +320,17 @@ public void createPanel() { JPanel wwPanel = new JPanel(new BorderLayout()); wwPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 10, 0)); wwPanel.add(((Component) worldWindow), BorderLayout.CENTER); + + // Update the WorldWindow size on window resize/move + wwPanel.addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + if (isVisible()) { + int w = e.getComponent().getWidth(); + int h = e.getComponent().getHeight(); + worldWindow.setSize(w, h); + } + } + }); panel.add(wwPanel, BorderLayout.CENTER); diff --git a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastTexture.java b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastTexture.java index e62ac37a9..2034f160a 100644 --- a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastTexture.java +++ b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastTexture.java @@ -1,7 +1,6 @@ package repast.simphony.visualization.gis3D; -import javax.media.opengl.GL; - +import com.jogamp.opengl.GL; import com.jogamp.opengl.util.texture.Texture; import gov.nasa.worldwind.render.DrawContext; diff --git a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLCanvas.java b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLCanvas.java index 75d1ecf54..6d2c16c3d 100644 --- a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLCanvas.java +++ b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLCanvas.java @@ -2,8 +2,6 @@ import java.beans.PropertyChangeListener; -import javax.media.nativewindow.ScalableSurface; - import gov.nasa.worldwind.awt.WorldWindowGLCanvas; import gov.nasa.worldwind.globes.Earth; import gov.nasa.worldwind.layers.LayerList; @@ -18,8 +16,8 @@ public class RepastWorldWindowGLCanvas extends WorldWindowGLCanvas { public RepastWorldWindowGLCanvas() { - setSurfaceScale(new int[] { ScalableSurface.IDENTITY_PIXELSCALE, - ScalableSurface.IDENTITY_PIXELSCALE }); +// setSurfaceScale(new int[] { ScalableSurface.IDENTITY_PIXELSCALE, +// ScalableSurface.IDENTITY_PIXELSCALE }); } @Override diff --git a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLJPanel.java b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLJPanel.java index 41f924a8e..0c95f8633 100644 --- a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLJPanel.java +++ b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/RepastWorldWindowGLJPanel.java @@ -2,8 +2,6 @@ import java.beans.PropertyChangeListener; -import javax.media.nativewindow.ScalableSurface; - import gov.nasa.worldwind.awt.WorldWindowGLJPanel; import gov.nasa.worldwind.globes.Earth; import gov.nasa.worldwind.layers.LayerList; @@ -18,8 +16,8 @@ public class RepastWorldWindowGLJPanel extends WorldWindowGLJPanel { public RepastWorldWindowGLJPanel() { - setSurfaceScale(new int[] { ScalableSurface.IDENTITY_PIXELSCALE, - ScalableSurface.IDENTITY_PIXELSCALE }); +// setSurfaceScale(new int[] { ScalableSurface.IDENTITY_PIXELSCALE, +// ScalableSurface.IDENTITY_PIXELSCALE }); } @Override diff --git a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/ScreenShotAction.java b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/ScreenShotAction.java index 79d46db19..d54599be6 100644 --- a/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/ScreenShotAction.java +++ b/repast.simphony.gis.visualization/src/repast/simphony/visualization/gis3D/ScreenShotAction.java @@ -13,7 +13,7 @@ import java.io.IOException; import javax.imageio.ImageIO; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLAutoDrawable; import javax.swing.AbstractAction; import javax.swing.JFileChooser; import javax.swing.JOptionPane; diff --git a/repast.simphony.gis/META-INF/MANIFEST.MF b/repast.simphony.gis/META-INF/MANIFEST.MF index fdcc2b9e5..b2058d17a 100644 --- a/repast.simphony.gis/META-INF/MANIFEST.MF +++ b/repast.simphony.gis/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast gis Bundle-SymbolicName: repast.simphony.gis -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: libs.ext, repast.simphony.runtime, repast.simphony.core, diff --git a/repast.simphony.gis/licenses/repast-license.txt b/repast.simphony.gis/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.gis/licenses/repast-license.txt +++ b/repast.simphony.gis/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.gis/plugin_jpf.xml b/repast.simphony.gis/plugin_jpf.xml index 8122383d8..e345dbd47 100644 --- a/repast.simphony.gis/plugin_jpf.xml +++ b/repast.simphony.gis/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.groovy/.gitignore b/repast.simphony.groovy/.gitignore new file mode 100644 index 000000000..2f7896d1d --- /dev/null +++ b/repast.simphony.groovy/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/repast.simphony.groovy/META-INF/MANIFEST.MF b/repast.simphony.groovy/META-INF/MANIFEST.MF index 13273bacf..2655c42c5 100644 --- a/repast.simphony.groovy/META-INF/MANIFEST.MF +++ b/repast.simphony.groovy/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast groovy Bundle-SymbolicName: repast.simphony.groovy -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Export-Package: repast.simphony.groovy.math Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: Argonne National Laboratory diff --git a/repast.simphony.groovy/licenses/repast-license.txt b/repast.simphony.groovy/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.groovy/licenses/repast-license.txt +++ b/repast.simphony.groovy/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.groovy/plugin_jpf.xml b/repast.simphony.groovy/plugin_jpf.xml index 81aa4a9a1..550d198d8 100644 --- a/repast.simphony.groovy/plugin_jpf.xml +++ b/repast.simphony.groovy/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.gui/META-INF/MANIFEST.MF b/repast.simphony.gui/META-INF/MANIFEST.MF index 8e323f86f..4be6d95c8 100644 --- a/repast.simphony.gui/META-INF/MANIFEST.MF +++ b/repast.simphony.gui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast gui Bundle-SymbolicName: repast.simphony.gui -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: lib/jmf.jar, bin/, lib/spark-1.2.jar, diff --git a/repast.simphony.gui/licenses/repast-license.txt b/repast.simphony.gui/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.gui/licenses/repast-license.txt +++ b/repast.simphony.gui/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.gui/plugin_jpf.xml b/repast.simphony.gui/plugin_jpf.xml index d854e41f7..c7884777d 100644 --- a/repast.simphony.gui/plugin_jpf.xml +++ b/repast.simphony.gui/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.gui/src/repast/simphony/ui/GUIParametersManager.java b/repast.simphony.gui/src/repast/simphony/ui/GUIParametersManager.java index d59a63986..17ed59170 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/GUIParametersManager.java +++ b/repast.simphony.gui/src/repast/simphony/ui/GUIParametersManager.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardOpenOption; +import java.util.Map; import repast.simphony.parameter.ParameterConstants; import repast.simphony.parameter.ParameterSchema; @@ -69,6 +70,15 @@ public void reset(Parameters params) { } } } + + /** + * Gets GUI display order of the current parameters. + * + * @return the order (a double) of the display parameters by display id. + */ + public Map getDisplayOrder() { + return pui.getDisplayOrder(); + } /** * Resets the parameters managed by this GUIParametersManager back to their diff --git a/repast.simphony.gui/src/repast/simphony/ui/RSApplication.java b/repast.simphony.gui/src/repast/simphony/ui/RSApplication.java index f792c02a1..b420c4060 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/RSApplication.java +++ b/repast.simphony.gui/src/repast/simphony/ui/RSApplication.java @@ -487,7 +487,7 @@ public File saveCurrentParameters() { } ParametersWriter pw = new ParametersWriter(); - pw.writeSpecificationToFile(paramsManager.getParameters(), paramFile); + pw.writeSpecificationToFile(paramsManager.getParameters(), paramsManager.getDisplayOrder(), paramFile); } } catch (Exception ex) { diff --git a/repast.simphony.gui/src/repast/simphony/ui/parameters/AbstractParameterBinder.java b/repast.simphony.gui/src/repast/simphony/ui/parameters/AbstractParameterBinder.java index d136e3719..8519b17fb 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/parameters/AbstractParameterBinder.java +++ b/repast.simphony.gui/src/repast/simphony/ui/parameters/AbstractParameterBinder.java @@ -19,6 +19,7 @@ public abstract class AbstractParameterBinder implements ParameterBinder { protected String name, displayName; protected Parameters params; + protected double order = Double.MAX_VALUE; protected static Map, String> typeMap = new HashMap, String>(); @@ -41,6 +42,14 @@ public AbstractParameterBinder(String name, String displayName) { this.name = name; this.displayName = displayName; } + + public void setDisplayOrder(double val) { + order = val; + } + + public double getDisplayOrder() { + return order; + } /* * (non-Javadoc) diff --git a/repast.simphony.gui/src/repast/simphony/ui/parameters/FPRangeParameterBinder.java b/repast.simphony.gui/src/repast/simphony/ui/parameters/FPRangeParameterBinder.java index 5d565ecb1..9d011ad0b 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/parameters/FPRangeParameterBinder.java +++ b/repast.simphony.gui/src/repast/simphony/ui/parameters/FPRangeParameterBinder.java @@ -61,7 +61,7 @@ public JComponent getComponent(Parameters params) { @Override public void resetToDefault() { Object defaultValue = params.getSchema().getDetails(getName()).getDefaultValue(); - int val = ((Integer) defaultValue).intValue(); + double val = ((Double) defaultValue).doubleValue(); spinner.setValue(val); } diff --git a/repast.simphony.gui/src/repast/simphony/ui/parameters/ParameterBinder.java b/repast.simphony.gui/src/repast/simphony/ui/parameters/ParameterBinder.java index 460319bd1..1ee480434 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/parameters/ParameterBinder.java +++ b/repast.simphony.gui/src/repast/simphony/ui/parameters/ParameterBinder.java @@ -56,4 +56,16 @@ public interface ParameterBinder { * @return the parameter xml representation of this ParameterBinder. */ String toXML(); + + /** + * Sets the order of the created component in the display. + * + * @param val + */ + void setDisplayOrder(double val); + + /** + * Gets the order of the created component in the display. + */ + double getDisplayOrder(); } diff --git a/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUI.java b/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUI.java index 2f5902465..1cd01794b 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUI.java +++ b/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUI.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -21,87 +22,88 @@ import javax.swing.JScrollPane; import javax.xml.stream.XMLStreamException; -import repast.simphony.parameter.ParameterConstants; -import repast.simphony.parameter.Parameters; - import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.factories.Borders; import com.jgoodies.forms.layout.FormLayout; +import repast.simphony.parameter.ParameterConstants; +import repast.simphony.parameter.Parameters; + /** * @author Nick Collier */ public class ParametersUI { - public static final String DEFAULT_PARAM_GROUP = "Other"; - public static final String NAME = "NAME"; - - private Map> bindersMap = new LinkedHashMap>(); - // reference to the current set of parameters used duing a run. - private Parameters params; - private JPanel topPanel; - - public ParametersUI(Parameters params) { - this.params = params; - } - - public void addBinder(String group, ParameterBinder creator) { - List binders = bindersMap.get(group); - if (binders == null) { - binders = new ArrayList(); - bindersMap.put(group, binders); - } - binders.add(creator); - } - - /** - * Updates the panel with the latest parameters from the parameters file. - * @throws XMLStreamException - * @throws FileNotFoundException - */ - public void updatePanel(File paramsFile) throws FileNotFoundException, XMLStreamException { - createPanel(paramsFile); - } - - /** - * Creates a JPanel that will display the specified parameters. This assumes - * the passed in parameters are identical to those used to make the creators - * that were added with addBinder. - * - * @param params - * - * @return the created JPanel. - * @throws XMLStreamException - * @throws FileNotFoundException - */ - public JPanel createPanel(String parametersFile) throws FileNotFoundException, - XMLStreamException { - return createPanel(new File(parametersFile)); - } - - /** - * Creates a JPanel that will display the specified parameters. This assumes - * the passed in parameters are identical to those used to make the creators - * that were added with addCreator. - * - * @param params - * - * @return the created JPanel. - * @throws XMLStreamException - * @throws FileNotFoundException - */ - public JPanel createPanel(File parametersFile) throws FileNotFoundException, - XMLStreamException { - - bindersMap.clear(); - - ParametersUIParser parser = new ParametersUIParser(); - parser.read(this, parametersFile); - - if (bindersMap.size() == 1) { - return createPanel(params, bindersMap.values().iterator().next()); - } - + public static final String DEFAULT_PARAM_GROUP = "Other"; + public static final String NAME = "NAME"; + public static final double LAST = Double.MAX_VALUE; + + private Map> bindersMap = new LinkedHashMap>(); + // reference to the current set of parameters used duing a run. + private Parameters params; + private JPanel topPanel; + + public ParametersUI(Parameters params) { + this.params = params; + } + + public void addBinder(String group, ParameterBinder creator, double displayOrder) { + creator.setDisplayOrder(displayOrder); + List binders = bindersMap.get(group); + if (binders == null) { + binders = new ArrayList(); + bindersMap.put(group, binders); + } + binders.add(creator); + } + + /** + * Updates the panel with the latest parameters from the parameters file. + * + * @throws XMLStreamException + * @throws FileNotFoundException + */ + public void updatePanel(File paramsFile) throws FileNotFoundException, XMLStreamException { + createPanel(paramsFile); + } + + /** + * Creates a JPanel that will display the specified parameters. This assumes the + * passed in parameters are identical to those used to make the creators that + * were added with addBinder. + * + * @param params + * + * @return the created JPanel. + * @throws XMLStreamException + * @throws FileNotFoundException + */ + public JPanel createPanel(String parametersFile) throws FileNotFoundException, XMLStreamException { + return createPanel(new File(parametersFile)); + } + + /** + * Creates a JPanel that will display the specified parameters. This assumes the + * passed in parameters are identical to those used to make the creators that + * were added with addCreator. + * + * @param params + * + * @return the created JPanel. + * @throws XMLStreamException + * @throws FileNotFoundException + */ + public JPanel createPanel(File parametersFile) throws FileNotFoundException, XMLStreamException { + + bindersMap.clear(); + + ParametersUIParser parser = new ParametersUIParser(); + parser.read(this, parametersFile); + + if (bindersMap.size() == 1) { + return createPanel(params, bindersMap.values().iterator().next()); + } + // TODO use this when have sections in the parameters that can be // put into or demarkated in someway. // JPanel panel = new JPanel(new BorderLayout()); @@ -114,108 +116,149 @@ public JPanel createPanel(File parametersFile) throws FileNotFoundException, // tabs.addTab(group, createPanel(params, bindersMap.get(group))); // } - return topPanel; - } - - private JPanel createPanel(Parameters params, List binders) { - - Collections.sort(binders, new Comparator() { - - @Override - public int compare(ParameterBinder o1, ParameterBinder o2) { - return o1.getLabel().compareTo(o2.getLabel()); - } - }); - - FormLayout layout = new FormLayout("6dlu, pref:grow", ""); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.border(Borders.DIALOG); - - for (ParameterBinder creator : binders) { - builder.leadingColumnOffset(0); - builder.append(new JLabel(creator.getLabel() + ":"), 2); - builder.leadingColumnOffset(1); - JComponent comp = creator.getComponent(params); - comp.putClientProperty(NAME, creator.getName()); - comp.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent arg0) { - if (ParametersUI.this.params != null) { - commitParameters(); - } - } - }); - builder.append(creator.getComponent(params)); - } - - if (topPanel == null) - topPanel = new JPanel(new BorderLayout()); - else - topPanel.removeAll(); - JScrollPane scrollPane = new JScrollPane(builder.getPanel()); - // on OSX java 7, the scrollpane has a white background and - // this looks odd when any of the widgets have a gray background - scrollPane.getViewport().setBackground(topPanel.getBackground()); - topPanel.add(scrollPane, BorderLayout.CENTER); - - return topPanel; - } - - /** - * Commits any changes made using the parameter JComponents to the specified - * params. - * - * @param params - * the Parameters to commmit the changes to - */ - public void commitParameters() { - for (List binders : bindersMap.values()) { - for (ParameterBinder binder : binders) { - binder.toParameter(); - } - } - } - - public void resetParameters() { - for (String name : params.getSchema().parameterNames()) { - Object val = params.getSchema().getDetails(name).getDefaultValue(); - if (name.equals(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME) - && val.equals(Parameters.NULL)) { - int seed = (int) System.currentTimeMillis(); - if (seed < 0) - val = Math.abs(seed); - params.setValue(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME, seed); - } else if (!val.equals(Parameters.NULL)) { - params.setValue(name, val); - } - } - - for (List binders : bindersMap.values()) { - for (ParameterBinder binder : binders) { - binder.resetToDefault(); - } - } - } - - /** - * Gets the parameter xml representation of the currently created parameter - * UI. The current values in the UI will become the default values. - * - * @return the XML. - */ - public String toXML() { - - StringBuilder buf = new StringBuilder(""); - buf.append(String.format("%n")); - for (List binders : bindersMap.values()) { - for (ParameterBinder binder : binders) { - buf.append("\t"); - buf.append(binder.toXML()); - buf.append(String.format("%n")); - } - } - buf.append(""); - return buf.toString(); - - } + return topPanel; + } + + private void addComponent(DefaultFormBuilder builder, ParameterBinder creator) { + builder.leadingColumnOffset(0); + builder.append(new JLabel(creator.getLabel() + ":"), 2); + builder.leadingColumnOffset(1); + JComponent comp = creator.getComponent(params); + comp.putClientProperty(NAME, creator.getName()); + comp.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent arg0) { + if (ParametersUI.this.params != null) { + commitParameters(); + } + } + }); + builder.append(creator.getComponent(params)); + } + + private JPanel createPanel(Parameters params, List binders) { + + List unordered = new ArrayList<>(); + List ordered = new ArrayList<>(); + for (ParameterBinder binder : binders) { + if (binder.getDisplayOrder() == LAST) { + unordered.add(binder); + } else { + ordered.add(binder); + } + } + + Collections.sort(unordered, new Comparator() { + @Override + public int compare(ParameterBinder o1, ParameterBinder o2) { + return o1.getLabel().compareTo(o2.getLabel()); + } + }); + + Collections.sort(ordered, new Comparator() { + @Override + public int compare(ParameterBinder o1, ParameterBinder o2) { + double v1 = o1.getDisplayOrder(); + double v2 = o2.getDisplayOrder(); + return v1 > v2 ? 1 : v1 == v2 ? 0 : -1; + } + }); + + FormLayout layout = new FormLayout("6dlu, pref:grow", ""); + DefaultFormBuilder builder = new DefaultFormBuilder(layout); + builder.border(Borders.DIALOG); + + for (ParameterBinder creator : ordered) { + addComponent(builder, creator); + } + + for (ParameterBinder creator : unordered) { + addComponent(builder, creator); + } + + if (topPanel == null) + topPanel = new JPanel(new BorderLayout()); + else + topPanel.removeAll(); + JScrollPane scrollPane = new JScrollPane(builder.getPanel()); + // on OSX java 7, the scrollpane has a white background and + // this looks odd when any of the widgets have a gray background + scrollPane.getViewport().setBackground(topPanel.getBackground()); + topPanel.add(scrollPane, BorderLayout.CENTER); + + return topPanel; + } + + /** + * Commits any changes made using the parameter JComponents to the specified + * params. + * + * @param params the Parameters to commmit the changes to + */ + public void commitParameters() { + for (List binders : bindersMap.values()) { + for (ParameterBinder binder : binders) { + binder.toParameter(); + } + } + } + + public void resetParameters() { + for (String name : params.getSchema().parameterNames()) { + Object val = params.getSchema().getDetails(name).getDefaultValue(); + if (name.equals(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME) && val.equals(Parameters.NULL)) { + int seed = (int) System.currentTimeMillis(); + if (seed < 0) + val = Math.abs(seed); + params.setValue(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME, seed); + } else if (!val.equals(Parameters.NULL)) { + params.setValue(name, val); + } + } + + for (List binders : bindersMap.values()) { + for (ParameterBinder binder : binders) { + binder.resetToDefault(); + } + } + } + + /** + * Gets GUI display order of the current parameters. + * + * @return the order (a double) of the display parameters by display id. + */ + public Map getDisplayOrder() { + Map map = new HashMap<>(); + for (List binders : bindersMap.values()) { + for (ParameterBinder binder : binders) { + if (binder.getDisplayOrder() != LAST) + map.put(binder.getName(), binder.getDisplayOrder()); + } + } + + return map; + } + + /** + * Gets the parameter xml representation of the currently created parameter UI. + * The current values in the UI will become the default values. + * + * @return the XML. + */ + public String toXML() { + + StringBuilder buf = new StringBuilder(""); + buf.append(String.format("%n")); + for (List binders : bindersMap.values()) { + for (ParameterBinder binder : binders) { + buf.append("\t"); + buf.append(binder.toXML()); + buf.append(String.format("%n")); + } + } + buf.append(""); + return buf.toString(); + + } } diff --git a/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUIParser.java b/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUIParser.java index 825f2f8df..cab281a89 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUIParser.java +++ b/repast.simphony.gui/src/repast/simphony/ui/parameters/ParametersUIParser.java @@ -27,111 +27,124 @@ */ public class ParametersUIParser { - // name, displayName, type, defaultValue, range, values, isReadOnly - private static final QName PARAMETER_E = new QName("parameter"); - private static final QName NAME_A = new QName("name"); - private static final QName DISPLAY_NAME_A = new QName("displayName"); - private static final QName TYPE_A = new QName("type"); - private static final QName RANGE_A = new QName("range"); - private static final QName VALUES_A = new QName("values"); - private static final QName IS_READ_ONLY_A = new QName("isReadOnly"); - private static final QName GROUP_E = new QName("group"); - private static final QName HIDE_A = new QName("hide"); + // name, displayName, type, defaultValue, range, values, isReadOnly + private static final QName PARAMETER_E = new QName("parameter"); + private static final QName NAME_A = new QName("name"); + private static final QName DISPLAY_NAME_A = new QName("displayName"); + private static final QName TYPE_A = new QName("type"); + private static final QName RANGE_A = new QName("range"); + private static final QName VALUES_A = new QName("values"); + private static final QName IS_READ_ONLY_A = new QName("isReadOnly"); + private static final QName GROUP_E = new QName("group"); + private static final QName HIDE_A = new QName("hide"); + private static final QName ORDER_A = new QName("displayOrder"); + - public static Map> typeMap = new HashMap>(); + public static Map> typeMap = new HashMap>(); + - static { - typeMap.put("int", int.class); - typeMap.put("double", double.class); - typeMap.put("long", long.class); - typeMap.put("float", float.class); - typeMap.put("boolean", boolean.class); - // this is on purpose - typeMap.put("byte", int.class); - // as is this - typeMap.put("short", int.class); - typeMap.put("String", String.class); - typeMap.put("string", String.class); - } + static { + typeMap.put("int", int.class); + typeMap.put("double", double.class); + typeMap.put("long", long.class); + typeMap.put("float", float.class); + typeMap.put("boolean", boolean.class); + // this is on purpose + typeMap.put("byte", int.class); + // as is this + typeMap.put("short", int.class); + typeMap.put("String", String.class); + typeMap.put("string", String.class); + } - private String group = ParametersUI.DEFAULT_PARAM_GROUP; + private String group = ParametersUI.DEFAULT_PARAM_GROUP; - public void read(ParametersUI paramsUI, File file) throws FileNotFoundException, XMLStreamException { - XMLInputFactory factory = XMLInputFactory.newInstance(); - XMLEventReader reader = factory.createXMLEventReader(new BufferedReader(new FileReader(file))); + public void read(ParametersUI paramsUI, File file) throws FileNotFoundException, XMLStreamException { + XMLInputFactory factory = XMLInputFactory.newInstance(); + XMLEventReader reader = factory.createXMLEventReader(new BufferedReader(new FileReader(file))); - while (reader.hasNext()) { - XMLEvent evt = reader.nextEvent(); - if (evt.isStartElement()) { - StartElement elmt = evt.asStartElement(); - if (elmt.getName().equals(PARAMETER_E)) { - processParameter(elmt, paramsUI); - } else if (elmt.getName().equals(GROUP_E)) { - group = elmt.getAttributeByName(NAME_A).getValue(); - } - } else if (evt.isEndElement()) { - EndElement elmt = evt.asEndElement(); - if (elmt.getName().equals(GROUP_E)) { - group = ParametersUI.DEFAULT_PARAM_GROUP; - } - } - } - } + while (reader.hasNext()) { + XMLEvent evt = reader.nextEvent(); + if (evt.isStartElement()) { + StartElement elmt = evt.asStartElement(); + if (elmt.getName().equals(PARAMETER_E)) { + processParameter(elmt, paramsUI); + } else if (elmt.getName().equals(GROUP_E)) { + group = elmt.getAttributeByName(NAME_A).getValue(); + } + } else if (evt.isEndElement()) { + EndElement elmt = evt.asEndElement(); + if (elmt.getName().equals(GROUP_E)) { + group = ParametersUI.DEFAULT_PARAM_GROUP; + } + } + } + } - private void processParameter(StartElement elmt, ParametersUI creator) { - String name = elmt.getAttributeByName(NAME_A).getValue(); - String displayName = elmt.getAttributeByName(DISPLAY_NAME_A).getValue(); - String type = elmt.getAttributeByName(TYPE_A).getValue(); - String range = elmt.getAttributeByName(RANGE_A) == null ? null : elmt.getAttributeByName(RANGE_A).getValue(); - // don't need the values because those should be in the parameter's - // schema - boolean isList = elmt.getAttributeByName(VALUES_A) != null; - boolean readOnly = elmt.getAttributeByName(IS_READ_ONLY_A) == null ? false : Boolean.parseBoolean(elmt.getAttributeByName(IS_READ_ONLY_A) - .getValue()); + private void processParameter(StartElement elmt, ParametersUI creator) { + String name = elmt.getAttributeByName(NAME_A).getValue(); + String displayName = elmt.getAttributeByName(DISPLAY_NAME_A).getValue(); + String type = elmt.getAttributeByName(TYPE_A).getValue(); + String range = elmt.getAttributeByName(RANGE_A) == null ? null : elmt.getAttributeByName(RANGE_A).getValue(); + // don't need the values because those should be in the parameter's + // schema + boolean isList = elmt.getAttributeByName(VALUES_A) != null; + boolean readOnly = elmt.getAttributeByName(IS_READ_ONLY_A) == null ? false + : Boolean.parseBoolean(elmt.getAttributeByName(IS_READ_ONLY_A).getValue()); - boolean hide = elmt.getAttributeByName(HIDE_A) == null ? false : Boolean.parseBoolean(elmt.getAttributeByName(HIDE_A).getValue()); + boolean hide = elmt.getAttributeByName(HIDE_A) == null ? false + : Boolean.parseBoolean(elmt.getAttributeByName(HIDE_A).getValue()); + - if (!hide) { - if (readOnly) { - creator.addBinder(group, new ReadOnlyParameterBinder(name, displayName)); - } else if (name.equals(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME)) { - creator.addBinder(group, new RandomSeedParameterBinder(name, displayName)); - } else if (range != null) { - if (!(type.equals("int") || type.equals("double") || type.equals("float"))) - throw new IllegalArgumentException("Ranged parameters must be of the int, double, or float type"); - String[] vals = range.split(" "); - if (vals.length != 3) - throw new IllegalArgumentException("Invalid range for ranged parameter '" + name + "'"); - if (type.equals("int")) { - try { - int min = Integer.parseInt(vals[0]); - int max = Integer.parseInt(vals[1]); - int spacing = Integer.parseInt(vals[2]); - creator.addBinder(group, new RangeParameterBinder(name, displayName, min, max, spacing)); - } catch (NumberFormatException ex) { - throw new IllegalArgumentException("Invalid range for ranged parameter '" + name + "'"); - } - } else { - // type is double or float - try { - double min = Double.parseDouble(vals[0]); - double max = Double.parseDouble(vals[1]); - double spacing = Double.parseDouble(vals[2]); - creator.addBinder(group, new FPRangeParameterBinder(name, displayName, min, max, spacing)); - } catch (NumberFormatException ex) { - throw new IllegalArgumentException("Invalid range for ranged parameter '" + name + "'"); - } - } - } else if (isList) { - creator.addBinder(group, new ListParameterBinder(name, displayName)); - } else if (type.equals("boolean")) { - creator.addBinder(group, new BooleanParameterBinder(name, displayName)); - } else { - Class clazz = typeMap.get(type); - if (clazz == null) - clazz = Object.class; - creator.addBinder(group, new DefaultParameterBinder(name, displayName, clazz)); - } - } - } + double displayOrder = ParametersUI.LAST; + try { + displayOrder = elmt.getAttributeByName(ORDER_A) == null ? ParametersUI.LAST : Double.parseDouble(elmt.getAttributeByName(ORDER_A).getValue()); + } catch (NumberFormatException ex) { + throw new IllegalArgumentException("Parameter display order attribute must be a number"); + } + + if (!hide) { + if (readOnly) { + creator.addBinder(group, new ReadOnlyParameterBinder(name, displayName), displayOrder); + } else if (name.equals(ParameterConstants.DEFAULT_RANDOM_SEED_USAGE_NAME)) { + creator.addBinder(group, new RandomSeedParameterBinder(name, displayName), displayOrder); + } else if (range != null) { + if (!(type.equals("int") || type.equals("double") || type.equals("float"))) + throw new IllegalArgumentException("Ranged parameters must be of the int, double, or float type"); + String[] vals = range.split(" "); + if (vals.length != 3) + throw new IllegalArgumentException("Invalid range for ranged parameter '" + name + "'"); + if (type.equals("int")) { + try { + + int min = (int) Double.parseDouble(vals[0]); + int max = (int) Double.parseDouble(vals[1]); + int spacing = (int) Double.parseDouble(vals[2]); + creator.addBinder(group, new RangeParameterBinder(name, displayName, min, max, spacing), displayOrder); + } catch (NumberFormatException ex) { + throw new IllegalArgumentException("Invalid range for ranged parameter '" + name + "'"); + } + } else { + // type is double or float + try { + double min = Double.parseDouble(vals[0]); + double max = Double.parseDouble(vals[1]); + double spacing = Double.parseDouble(vals[2]); + creator.addBinder(group, new FPRangeParameterBinder(name, displayName, min, max, spacing), displayOrder); + } catch (NumberFormatException ex) { + throw new IllegalArgumentException("Invalid range for ranged parameter '" + name + "'"); + } + } + } else if (isList) { + creator.addBinder(group, new ListParameterBinder(name, displayName), displayOrder); + } else if (type.equals("boolean")) { + creator.addBinder(group, new BooleanParameterBinder(name, displayName), displayOrder); + } else { + Class clazz = typeMap.get(type); + if (clazz == null) + clazz = Object.class; + creator.addBinder(group, new DefaultParameterBinder(name, displayName, clazz), displayOrder); + } + } + } } diff --git a/repast.simphony.gui/src/repast/simphony/ui/plugin/editor/OptionsDialog.java b/repast.simphony.gui/src/repast/simphony/ui/plugin/editor/OptionsDialog.java index 0e1ba8dbb..b64f8c405 100644 --- a/repast.simphony.gui/src/repast/simphony/ui/plugin/editor/OptionsDialog.java +++ b/repast.simphony.gui/src/repast/simphony/ui/plugin/editor/OptionsDialog.java @@ -103,7 +103,7 @@ public boolean isCanceled() { private void createButtons() { JButton okBtn = new JButton("OK"); - JButton applyBtn = new JButton("Apply All"); +// JButton applyBtn = new JButton("Apply All"); JButton cancelBtn = new JButton("Cancel"); okBtn.setMnemonic('o'); okBtn.addActionListener(new ActionListener() { @@ -112,12 +112,12 @@ public void actionPerformed(ActionEvent evt) { } }); - applyBtn.setMnemonic('a'); - applyBtn.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - apply(); - } - }); +// applyBtn.setMnemonic('a'); +// applyBtn.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent evt) { +// apply(); +// } +// }); cancelBtn.setMnemonic('c'); cancelBtn.addActionListener(new ActionListener() { @@ -132,8 +132,8 @@ public void actionPerformed(ActionEvent evt) { panel.add(Box.createHorizontalGlue()); panel.add(okBtn); panel.add(Box.createRigidArea(new Dimension(6, 0))); - panel.add(applyBtn); - panel.add(Box.createRigidArea(new Dimension(6, 0))); + //panel.add(applyBtn); + //panel.add(Box.createRigidArea(new Dimension(6, 0))); panel.add(cancelBtn); FormLayout dlgLayout = new FormLayout("fill:p:grow", "pref, 3dlu, pref"); diff --git a/repast.simphony.integration/META-INF/MANIFEST.MF b/repast.simphony.integration/META-INF/MANIFEST.MF index b838e7046..820531f8e 100644 --- a/repast.simphony.integration/META-INF/MANIFEST.MF +++ b/repast.simphony.integration/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast integration Bundle-SymbolicName: repast.simphony.integration;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: bin/, lib/cglib-nodep-2.1_3.jar, lib/commons-exec-1.1.jar, diff --git a/repast.simphony.integration/licenses/repast-license.txt b/repast.simphony.integration/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.integration/licenses/repast-license.txt +++ b/repast.simphony.integration/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.integration/plugin_jpf.xml b/repast.simphony.integration/plugin_jpf.xml index 496a11fc6..61a686c29 100644 --- a/repast.simphony.integration/plugin_jpf.xml +++ b/repast.simphony.integration/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.jasperreports/META-INF/MANIFEST.MF b/repast.simphony.jasperreports/META-INF/MANIFEST.MF index 08a6cdf94..61e2e0411 100644 --- a/repast.simphony.jasperreports/META-INF/MANIFEST.MF +++ b/repast.simphony.jasperreports/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast jasper reports Bundle-SymbolicName: repast.simphony.jasperreports -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Export-Package: net.sf.jasperreports.ant, net.sf.jasperreports.charts, diff --git a/repast.simphony.jasperreports/licenses/repast-license.txt b/repast.simphony.jasperreports/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.jasperreports/licenses/repast-license.txt +++ b/repast.simphony.jasperreports/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.jasperreports/plugin_jpf.xml b/repast.simphony.jasperreports/plugin_jpf.xml index dc8ceb12b..e0546bb8f 100644 --- a/repast.simphony.jasperreports/plugin_jpf.xml +++ b/repast.simphony.jasperreports/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.jdbcfreezedryer/META-INF/MANIFEST.MF b/repast.simphony.jdbcfreezedryer/META-INF/MANIFEST.MF index 315490d53..d6ce136fe 100644 --- a/repast.simphony.jdbcfreezedryer/META-INF/MANIFEST.MF +++ b/repast.simphony.jdbcfreezedryer/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast jdbc freezedryer Bundle-SymbolicName: repast.simphony.jdbcfreezedryer -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: ., lib/commons-dbcp-1.4.jar, lib/commons-pool-1.6.jar diff --git a/repast.simphony.jdbcfreezedryer/plugin_jpf.xml b/repast.simphony.jdbcfreezedryer/plugin_jpf.xml index 0ed3f5aa1..96ee3450b 100644 --- a/repast.simphony.jdbcfreezedryer/plugin_jpf.xml +++ b/repast.simphony.jdbcfreezedryer/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.jung/META-INF/MANIFEST.MF b/repast.simphony.jung/META-INF/MANIFEST.MF index cf578b047..58ac1850b 100644 --- a/repast.simphony.jung/META-INF/MANIFEST.MF +++ b/repast.simphony.jung/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast jung Bundle-SymbolicName: repast.simphony.jung -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.gui, repast.simphony.data, repast.simphony.core, diff --git a/repast.simphony.jung/licenses/repast-license.txt b/repast.simphony.jung/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.jung/licenses/repast-license.txt +++ b/repast.simphony.jung/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.jung/plugin_jpf.xml b/repast.simphony.jung/plugin_jpf.xml index 04634154d..d59b502f5 100644 --- a/repast.simphony.jung/plugin_jpf.xml +++ b/repast.simphony.jung/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.pajek/META-INF/MANIFEST.MF b/repast.simphony.pajek/META-INF/MANIFEST.MF index a4bfd2c03..7cd6d7e8c 100644 --- a/repast.simphony.pajek/META-INF/MANIFEST.MF +++ b/repast.simphony.pajek/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast pajek Bundle-SymbolicName: repast.simphony.pajek -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.gui, repast.simphony.data, repast.simphony.core, diff --git a/repast.simphony.pajek/licenses/repast-license.txt b/repast.simphony.pajek/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.pajek/licenses/repast-license.txt +++ b/repast.simphony.pajek/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.pajek/plugin_jpf.xml b/repast.simphony.pajek/plugin_jpf.xml index 315306211..1474c6aa0 100644 --- a/repast.simphony.pajek/plugin_jpf.xml +++ b/repast.simphony.pajek/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.plugin.util/META-INF/MANIFEST.MF b/repast.simphony.plugin.util/META-INF/MANIFEST.MF index 7e9c86eb2..5ff7b8161 100644 --- a/repast.simphony.plugin.util/META-INF/MANIFEST.MF +++ b/repast.simphony.plugin.util/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast plugin ui Bundle-SymbolicName: repast.simphony.plugin.util -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: . Export-Package: org.jdesktop.swingx.autocomplete, repast.simphony.util.wizard diff --git a/repast.simphony.plugin.util/licenses/repast-license.txt b/repast.simphony.plugin.util/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.plugin.util/licenses/repast-license.txt +++ b/repast.simphony.plugin.util/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.plugin.util/plugin_jpf.xml b/repast.simphony.plugin.util/plugin_jpf.xml index fcf971fbf..9ced71bd3 100644 --- a/repast.simphony.plugin.util/plugin_jpf.xml +++ b/repast.simphony.plugin.util/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/repast.simphony.relogo.builder/META-INF/MANIFEST.MF b/repast.simphony.relogo.builder/META-INF/MANIFEST.MF index 37cf3aa79..8d913b08d 100644 --- a/repast.simphony.relogo.builder/META-INF/MANIFEST.MF +++ b/repast.simphony.relogo.builder/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast relogo builder Bundle-SymbolicName: repast.simphony.relogo.builder;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-Activator: repast.simphony.relogo.builder.Activator Require-Bundle: org.eclipse.core.runtime, repast.simphony.eclipse, @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime, org.junit, org.eclipse.jdt.launching, org.eclipse.core.resources, - repast.simphony.groovy;bundle-version="2.7.0" + repast.simphony.groovy;bundle-version="2.8.0" Bundle-ActivationPolicy: lazy Import-Package: org.codehaus.jdt.groovy.model, org.eclipse.core.resources, diff --git a/repast.simphony.relogo.ide/META-INF/MANIFEST.MF b/repast.simphony.relogo.ide/META-INF/MANIFEST.MF index b592e7b31..615ec2de6 100644 --- a/repast.simphony.relogo.ide/META-INF/MANIFEST.MF +++ b/repast.simphony.relogo.ide/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast relogo ide Bundle-SymbolicName: repast.simphony.relogo.ide;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-Activator: relogo.Activator Require-Bundle: org.eclipse.debug.core, org.eclipse.debug.ui, diff --git a/repast.simphony.relogo.ide/plugin_jpf.xml b/repast.simphony.relogo.ide/plugin_jpf.xml index 378e550f6..5e564fc50 100644 --- a/repast.simphony.relogo.ide/plugin_jpf.xml +++ b/repast.simphony.relogo.ide/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.relogo.ide/src/repast/simphony/relogo/ide/ReLogoPerspectiveFactory.java b/repast.simphony.relogo.ide/src/repast/simphony/relogo/ide/ReLogoPerspectiveFactory.java index 655cea7d9..2d1e3da58 100644 --- a/repast.simphony.relogo.ide/src/repast/simphony/relogo/ide/ReLogoPerspectiveFactory.java +++ b/repast.simphony.relogo.ide/src/repast/simphony/relogo/ide/ReLogoPerspectiveFactory.java @@ -101,7 +101,7 @@ public void createInitialLayout(IPageLayout layout) { } } folder.addView(JavaUI.ID_PACKAGES); - folder.addView(IPageLayout.ID_RES_NAV); +// folder.addView(IPageLayout.ID_RES_NAV); IFolderLayout outputfolder = layout.createFolder( "bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$ @@ -129,7 +129,7 @@ public void createInitialLayout(IPageLayout layout) { // views - standard workbench layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); - layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); +// layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID); layout.addShowViewShortcut(ID_PROJECT_EXPLORER); diff --git a/repast.simphony.relogo.runtime/META-INF/MANIFEST.MF b/repast.simphony.relogo.runtime/META-INF/MANIFEST.MF index 0f41df826..83ebb6cb8 100644 --- a/repast.simphony.relogo.runtime/META-INF/MANIFEST.MF +++ b/repast.simphony.relogo.runtime/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast relogo runtime Bundle-SymbolicName: repast.simphony.relogo.runtime -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Export-Package: repast.simphony.relogo, repast.simphony.relogo.factories, repast.simphony.relogo.image, diff --git a/repast.simphony.relogo.runtime/buildGroovyDocs.xml b/repast.simphony.relogo.runtime/buildGroovyDocs.xml index 951199167..0b4572dff 100644 --- a/repast.simphony.relogo.runtime/buildGroovyDocs.xml +++ b/repast.simphony.relogo.runtime/buildGroovyDocs.xml @@ -12,7 +12,7 @@ - + @@ -44,7 +44,7 @@ private="false"> - + diff --git a/repast.simphony.relogo.runtime/buildGroovyDocs.xml.launch b/repast.simphony.relogo.runtime/buildGroovyDocs.xml.launch index ec9a082e3..6a57821dd 100644 --- a/repast.simphony.relogo.runtime/buildGroovyDocs.xml.launch +++ b/repast.simphony.relogo.runtime/buildGroovyDocs.xml.launch @@ -75,7 +75,7 @@ - + diff --git a/repast.simphony.relogo.runtime/plugin_jpf.xml b/repast.simphony.relogo.runtime/plugin_jpf.xml index e0b9ebd5b..9141f9389 100644 --- a/repast.simphony.relogo.runtime/plugin_jpf.xml +++ b/repast.simphony.relogo.runtime/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.relogo.runtime/src/repast/simphony/relogo/AbstractObserver.java b/repast.simphony.relogo.runtime/src/repast/simphony/relogo/AbstractObserver.java index e95ef7ce7..64a2d1085 100644 --- a/repast.simphony.relogo.runtime/src/repast/simphony/relogo/AbstractObserver.java +++ b/repast.simphony.relogo.runtime/src/repast/simphony/relogo/AbstractObserver.java @@ -857,7 +857,7 @@ public int getMaxPycor() { * Diffuses to the eight neighboring patches a fraction number of the patch * variable. * - * @param patchVarible + * @param patchVariable * the name of a diffusible patch variable * @param number * a number in the range [0,1] @@ -870,7 +870,7 @@ public void diffuse(String patchVariable, double number) { * Diffuses to the four neighboring patches a fraction number of the patch * variable. * - * @param patchVarible + * @param patchVariable * the name of a diffusible patch variable * @param number * a number number in the range [0,1] diff --git a/repast.simphony.relogo.runtime/src/repast/simphony/relogo/Observer.java b/repast.simphony.relogo.runtime/src/repast/simphony/relogo/Observer.java index 04b30b699..378d32400 100644 --- a/repast.simphony.relogo.runtime/src/repast/simphony/relogo/Observer.java +++ b/repast.simphony.relogo.runtime/src/repast/simphony/relogo/Observer.java @@ -40,7 +40,7 @@ public interface Observer extends ProjectionListener { * Diffuses to the eight neighboring patches a fraction number of the patch * variable. * - * @param patchVarible + * @param patchVariable * the name of a diffusible patch variable * @param number * a number in the range [0,1] @@ -51,7 +51,7 @@ public interface Observer extends ProjectionListener { * Diffuses to the four neighboring patches a fraction number of the patch * variable. * - * @param patchVarible + * @param patchVariable * the name of a diffusible patch variable * @param number * a number number in the range [0,1] diff --git a/repast.simphony.relogo.runtime/src/repast/simphony/relogo/util/ReLogoReferenceCreator.groovy b/repast.simphony.relogo.runtime/src/repast/simphony/relogo/util/ReLogoReferenceCreator.groovy index 98c3e8eba..5d460e9c6 100644 --- a/repast.simphony.relogo.runtime/src/repast/simphony/relogo/util/ReLogoReferenceCreator.groovy +++ b/repast.simphony.relogo.runtime/src/repast/simphony/relogo/util/ReLogoReferenceCreator.groovy @@ -29,7 +29,7 @@ import repast.simphony.relogo.UtilityG; class ReLogoReferenceCreator { - static final String docTitle = "ReLogo Primitives ver. 2.7" + static final String docTitle = "ReLogo Primitives ver. 2.8" static final String filename = "data/ReLogoPrimitives.xls" static final String docLocation = "docs/ReLogo API/repast/simphony/relogo/" static final String refURLbase = "repast/simphony/relogo/" diff --git a/repast.simphony.runtime/META-INF/MANIFEST.MF b/repast.simphony.runtime/META-INF/MANIFEST.MF index aaa2b0972..d2b1a0562 100644 --- a/repast.simphony.runtime/META-INF/MANIFEST.MF +++ b/repast.simphony.runtime/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast runtime Bundle-SymbolicName: repast.simphony.runtime -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: testlib/jmock-1.0.1.jar, testlib/jmock-cglib-1.0.1.jar, lib/saf.core.runtime.jar, diff --git a/repast.simphony.runtime/boot.properties b/repast.simphony.runtime/boot.properties index 33856f3a6..122679c70 100644 --- a/repast.simphony.runtime/boot.properties +++ b/repast.simphony.runtime/boot.properties @@ -10,4 +10,4 @@ org.java.plugin.standard.PluginLifecycleHandler = repast.simphony.plugin.PluginL org.java.plugin.boot.pluginFileName = plugin_jpf.xml # restriction to only load plugins with this tag and value -plugin.restrict.simphony = 2.7.0 +plugin.restrict.simphony = 2.8.0 diff --git a/repast.simphony.runtime/licenses/repast-license.txt b/repast.simphony.runtime/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.runtime/licenses/repast-license.txt +++ b/repast.simphony.runtime/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.runtime/plugin_jpf.xml b/repast.simphony.runtime/plugin_jpf.xml index 471bcc230..5907fa3ef 100644 --- a/repast.simphony.runtime/plugin_jpf.xml +++ b/repast.simphony.runtime/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/repast.simphony.scenario/META-INF/MANIFEST.MF b/repast.simphony.scenario/META-INF/MANIFEST.MF index 2f16c6bac..913804482 100644 --- a/repast.simphony.scenario/META-INF/MANIFEST.MF +++ b/repast.simphony.scenario/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast scenario Bundle-SymbolicName: repast.simphony.scenario;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.runtime, repast.simphony.core, org.junit, diff --git a/repast.simphony.scenario/licenses/repast-license.txt b/repast.simphony.scenario/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.scenario/licenses/repast-license.txt +++ b/repast.simphony.scenario/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.scenario/plugin_jpf.xml b/repast.simphony.scenario/plugin_jpf.xml index b8d57cb9f..03736f9bd 100644 --- a/repast.simphony.scenario/plugin_jpf.xml +++ b/repast.simphony.scenario/plugin_jpf.xml @@ -2,7 +2,7 @@ - + diff --git a/repast.simphony.server/META-INF/MANIFEST.MF b/repast.simphony.server/META-INF/MANIFEST.MF index f9a342f5c..a7fa03185 100644 --- a/repast.simphony.server/META-INF/MANIFEST.MF +++ b/repast.simphony.server/META-INF/MANIFEST.MF @@ -2,18 +2,18 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast Simphony Server Bundle-SymbolicName: repast.simphony.server -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Automatic-Module-Name: repast.simphony.server Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Require-Bundle: repast.simphony.core;bundle-version="2.7.0", - repast.simphony.runtime;bundle-version="2.7.0", - repast.simphony.batch;bundle-version="2.7.0", - repast.simphony.chart;bundle-version="2.7.0", - repast.simphony.gis;bundle-version="2.7.0", - repast.simphony.gis.visualization;bundle-version="2.7.0", - repast.simphony.scenario;bundle-version="2.7.0", - repast.simphony.data;bundle-version="2.7.0", - repast.simphony.gui;bundle-version="2.7.0" +Require-Bundle: repast.simphony.core;bundle-version="2.8.0", + repast.simphony.runtime;bundle-version="2.8.0", + repast.simphony.batch;bundle-version="2.8.0", + repast.simphony.chart;bundle-version="2.8.0", + repast.simphony.gis;bundle-version="2.8.0", + repast.simphony.gis.visualization;bundle-version="2.8.0", + repast.simphony.scenario;bundle-version="2.8.0", + repast.simphony.data;bundle-version="2.8.0", + repast.simphony.gui;bundle-version="2.8.0" Bundle-ClassPath: lib/annotations-13.0.jar, lib/jackson-annotations-2.9.9.jar, lib/jackson-core-2.9.9.jar, diff --git a/repast.simphony.spreadsheet/META-INF/MANIFEST.MF b/repast.simphony.spreadsheet/META-INF/MANIFEST.MF index a5793118e..a820555be 100644 --- a/repast.simphony.spreadsheet/META-INF/MANIFEST.MF +++ b/repast.simphony.spreadsheet/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast spreadsheet Bundle-SymbolicName: repast.simphony.spreadsheet -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.gui, repast.simphony.data, repast.simphony.core, diff --git a/repast.simphony.spreadsheet/licenses/repast-license.txt b/repast.simphony.spreadsheet/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.spreadsheet/licenses/repast-license.txt +++ b/repast.simphony.spreadsheet/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.spreadsheet/plugin_jpf.xml b/repast.simphony.spreadsheet/plugin_jpf.xml index 2d6255bc2..3875a6dcc 100644 --- a/repast.simphony.spreadsheet/plugin_jpf.xml +++ b/repast.simphony.spreadsheet/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.sql/META-INF/MANIFEST.MF b/repast.simphony.sql/META-INF/MANIFEST.MF index cf113a980..9f118b65c 100644 --- a/repast.simphony.sql/META-INF/MANIFEST.MF +++ b/repast.simphony.sql/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast sql Bundle-SymbolicName: repast.simphony.sql -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.gui, repast.simphony.data, repast.simphony.core, diff --git a/repast.simphony.sql/licenses/repast-license.txt b/repast.simphony.sql/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.sql/licenses/repast-license.txt +++ b/repast.simphony.sql/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.sql/plugin_jpf.xml b/repast.simphony.sql/plugin_jpf.xml index 9bec8542d..1f4a10364 100644 --- a/repast.simphony.sql/plugin_jpf.xml +++ b/repast.simphony.sql/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.statecharts.diagram/META-INF/MANIFEST.MF b/repast.simphony.statecharts.diagram/META-INF/MANIFEST.MF index d25d00f30..b0991d4c7 100644 --- a/repast.simphony.statecharts.diagram/META-INF/MANIFEST.MF +++ b/repast.simphony.statecharts.diagram/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast statecharts diagram Bundle-SymbolicName: repast.simphony.statecharts.diagram; singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: bin/, . Bundle-Activator: repast.simphony.statecharts.part.StatechartDiagramEditorPlugin diff --git a/repast.simphony.statecharts.diagram/src/repast/simphony/statecharts/sheets/BindingSupport.java b/repast.simphony.statecharts.diagram/src/repast/simphony/statecharts/sheets/BindingSupport.java index ebd33966a..0fdf56c43 100644 --- a/repast.simphony.statecharts.diagram/src/repast/simphony/statecharts/sheets/BindingSupport.java +++ b/repast.simphony.statecharts.diagram/src/repast/simphony/statecharts/sheets/BindingSupport.java @@ -42,7 +42,7 @@ public BindingSupport(EMFDataBindingContext context, EObject eObject) { } /** - * Removes the all the bindings created by this BindingSupport. + * Removes all the bindings created by this BindingSupport. */ public void removeBindings() { for (Binding binding : bindings.values()) { diff --git a/repast.simphony.statecharts.edit/META-INF/MANIFEST.MF b/repast.simphony.statecharts.edit/META-INF/MANIFEST.MF index c2b175cff..0cdb0918a 100644 --- a/repast.simphony.statecharts.edit/META-INF/MANIFEST.MF +++ b/repast.simphony.statecharts.edit/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast statecharts edit Bundle-SymbolicName: repast.simphony.statecharts.edit;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: bin/ Bundle-Activator: repast.simphony.statecharts.scmodel.provider.StatechartEditPlugin$Implementation Bundle-Vendor: Argonne National Laboratory diff --git a/repast.simphony.statecharts.generator/META-INF/MANIFEST.MF b/repast.simphony.statecharts.generator/META-INF/MANIFEST.MF index 3c39b42a4..a871086fe 100644 --- a/repast.simphony.statecharts.generator/META-INF/MANIFEST.MF +++ b/repast.simphony.statecharts.generator/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast statecharts generator Bundle-SymbolicName: repast.simphony.statecharts.generator; singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: org.eclipse.jdt.core, org.eclipse.xtend.profiler;resolution:=optional, org.apache.commons.logging, diff --git a/repast.simphony.statecharts.model/META-INF/MANIFEST.MF b/repast.simphony.statecharts.model/META-INF/MANIFEST.MF index cfe0b8f1d..7d40f05fc 100644 --- a/repast.simphony.statecharts.model/META-INF/MANIFEST.MF +++ b/repast.simphony.statecharts.model/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast statecharts model Bundle-SymbolicName: repast.simphony.statecharts.model;singleton:=true -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: bin/ Bundle-Vendor: Argonne National Laboratory Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/repast.simphony.statecharts.visualization/META-INF/MANIFEST.MF b/repast.simphony.statecharts.visualization/META-INF/MANIFEST.MF index 6ccc47f29..cf44f0fd8 100644 --- a/repast.simphony.statecharts.visualization/META-INF/MANIFEST.MF +++ b/repast.simphony.statecharts.visualization/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast statecharts visualization Bundle-SymbolicName: repast.simphony.statecharts.visualization -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Bundle-ClassPath: runtime.jar Require-Bundle: org.w3c.dom.svg, repast.simphony.statecharts, diff --git a/repast.simphony.statecharts.visualization/plugin_jpf.xml b/repast.simphony.statecharts.visualization/plugin_jpf.xml index d61775a4e..ca759fafa 100644 --- a/repast.simphony.statecharts.visualization/plugin_jpf.xml +++ b/repast.simphony.statecharts.visualization/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.statecharts/META-INF/MANIFEST.MF b/repast.simphony.statecharts/META-INF/MANIFEST.MF index f06c61d8f..75502be6c 100644 --- a/repast.simphony.statecharts/META-INF/MANIFEST.MF +++ b/repast.simphony.statecharts/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast statecharts Bundle-SymbolicName: repast.simphony.statecharts -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Export-Package: repast.simphony.statecharts Require-Bundle: repast.simphony.core;visibility:=reexport Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/repast.simphony.statecharts/plugin_jpf.xml b/repast.simphony.statecharts/plugin_jpf.xml index d67f5a6cb..541fc3e9d 100644 --- a/repast.simphony.statecharts/plugin_jpf.xml +++ b/repast.simphony.statecharts/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.userpanel.ui/META-INF/MANIFEST.MF b/repast.simphony.userpanel.ui/META-INF/MANIFEST.MF index 58fd844bd..7f27b17b5 100644 --- a/repast.simphony.userpanel.ui/META-INF/MANIFEST.MF +++ b/repast.simphony.userpanel.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast userpanel Bundle-SymbolicName: repast.simphony.userpanel.ui -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.gui, saf.core.ui, repast.simphony.plugin.util, diff --git a/repast.simphony.userpanel.ui/licenses/repast-license.txt b/repast.simphony.userpanel.ui/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.userpanel.ui/licenses/repast-license.txt +++ b/repast.simphony.userpanel.ui/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.userpanel.ui/plugin_jpf.xml b/repast.simphony.userpanel.ui/plugin_jpf.xml index 368e5fb8e..81717d139 100644 --- a/repast.simphony.userpanel.ui/plugin_jpf.xml +++ b/repast.simphony.userpanel.ui/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.visualization/META-INF/MANIFEST.MF b/repast.simphony.visualization/META-INF/MANIFEST.MF index 763d49806..aa5ceec4a 100644 --- a/repast.simphony.visualization/META-INF/MANIFEST.MF +++ b/repast.simphony.visualization/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast visualization Bundle-SymbolicName: repast.simphony.visualization -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.core, repast.simphony.scenario, repast.simphony.gui, diff --git a/repast.simphony.visualization/lib/MS3DLoader-1.0.8.jar b/repast.simphony.visualization/lib/MS3DLoader-1.0.8.jar index c69694f4a..6b07c0698 100644 Binary files a/repast.simphony.visualization/lib/MS3DLoader-1.0.8.jar and b/repast.simphony.visualization/lib/MS3DLoader-1.0.8.jar differ diff --git a/repast.simphony.visualization/licenses/repast-license.txt b/repast.simphony.visualization/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.visualization/licenses/repast-license.txt +++ b/repast.simphony.visualization/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.visualization/plugin_jpf.xml b/repast.simphony.visualization/plugin_jpf.xml index 17a51e050..fb217e3a2 100644 --- a/repast.simphony.visualization/plugin_jpf.xml +++ b/repast.simphony.visualization/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/repast.simphony.visualization/src/aragost/repast/visualization/UpdatableTexture2D.java b/repast.simphony.visualization/src/aragost/repast/visualization/UpdatableTexture2D.java index 0df686de5..9dbe0d566 100644 --- a/repast.simphony.visualization/src/aragost/repast/visualization/UpdatableTexture2D.java +++ b/repast.simphony.visualization/src/aragost/repast/visualization/UpdatableTexture2D.java @@ -36,8 +36,8 @@ import java.awt.image.BufferedImage; -import javax.media.opengl.GL2; -import javax.vecmath.Point3f; +import com.jogamp.opengl.GL2; +import org.jogamp.vecmath.Point3f; import saf.v3d.picking.BoundingSphere; import saf.v3d.render.RenderState; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous2DLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous2DLayout.java index 872206805..991d40911 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous2DLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous2DLayout.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.continuous; -import javax.vecmath.Point3f; +import org.jogamp.vecmath.Point3f; import repast.simphony.space.Dimensions; import repast.simphony.space.continuous.ContinuousSpace; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DLayout.java index 21f7248bb..3b7bd7b56 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DLayout.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.continuous; -import javax.vecmath.Point3f; +import org.jogamp.vecmath.Point3f; import repast.simphony.visualization.Box; import repast.simphony.visualization.Layout; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DProjectionDecorator.java b/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DProjectionDecorator.java index 9f98244c4..f26615ee5 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DProjectionDecorator.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/continuous/Continuous3DProjectionDecorator.java @@ -1,8 +1,8 @@ package repast.simphony.visualization.continuous; -import javax.media.j3d.Appearance; -import javax.media.j3d.Group; -import javax.media.j3d.Shape3D; +import org.jogamp.java3d.Appearance; +import org.jogamp.java3d.Group; +import org.jogamp.java3d.Shape3D; import repast.simphony.space.continuous.ContinuousSpace; import repast.simphony.visualization.decorator.AbstractProjectionDecorator; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/decorator/ProjectionDecorator3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/decorator/ProjectionDecorator3D.java index 8ccc2a2ed..f8e8cb498 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/decorator/ProjectionDecorator3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/decorator/ProjectionDecorator3D.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.decorator; -import javax.media.j3d.Group; +import org.jogamp.java3d.Group; import repast.simphony.space.projection.Projection; import repast.simphony.visualization.visualization3D.Display3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedEdgeStyle3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedEdgeStyle3D.java index d87439b62..9405fdb6f 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedEdgeStyle3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedEdgeStyle3D.java @@ -3,7 +3,7 @@ import java.awt.Color; import java.awt.Font; -import javax.media.j3d.Shape3D; +import org.jogamp.java3d.Shape3D; import repast.simphony.visualization.visualization3D.AppearanceFactory; import repast.simphony.visualization.visualization3D.ShapeFactory; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedStyle3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedStyle3D.java index 33b906c92..225101a5d 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedStyle3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/EditedStyle3D.java @@ -5,13 +5,14 @@ import java.awt.Font; import java.io.FileNotFoundException; import java.util.Enumeration; +import java.util.Iterator; -import javax.media.j3d.Appearance; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.Node; -import javax.media.j3d.Shape3D; -import javax.media.j3d.Texture; -import javax.media.j3d.TextureAttributes; +import org.jogamp.java3d.Appearance; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.Node; +import org.jogamp.java3d.Shape3D; +import org.jogamp.java3d.Texture; +import org.jogamp.java3d.TextureAttributes; import repast.simphony.visualization.visualization3D.AppearanceFactory; import repast.simphony.visualization.visualization3D.ShapeFactory; @@ -19,12 +20,12 @@ import repast.simphony.visualization.visualization3D.style.TaggedAppearance; import repast.simphony.visualization.visualization3D.style.TaggedBranchGroup; -import com.sun.j3d.loaders.IncorrectFormatException; -import com.sun.j3d.loaders.Loader; -import com.sun.j3d.loaders.ParsingErrorException; -import com.sun.j3d.loaders.Scene; -import com.sun.j3d.utils.geometry.Primitive; -import com.sun.j3d.utils.image.TextureLoader; +import org.jogamp.java3d.loaders.IncorrectFormatException; +import org.jogamp.java3d.loaders.Loader; +import org.jogamp.java3d.loaders.ParsingErrorException; +import org.jogamp.java3d.loaders.Scene; +import org.jogamp.java3d.utils.geometry.Primitive; +import org.jogamp.java3d.utils.image.TextureLoader; /** * @@ -100,8 +101,9 @@ public TaggedBranchGroup getBranchGroup(Object o, TaggedBranchGroup taggedGroup) if (modelGroup != null){ BranchGroup aGroup = new BranchGroup(); - for (Enumeration e=modelGroup.getAllChildren(); e.hasMoreElements();){ - Node node = (Node) e.nextElement(); + // for (Enumeration e=modelGroup.getAllChildren(); e.hasMoreElements();){ + for (Iterator iter = modelGroup.getAllChildren(); iter.hasNext(); ) { + Node node = (Node) iter.next(); node.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE); aGroup.addChild(node.cloneNode(true)); } diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/ModelLoaderUtils.java b/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/ModelLoaderUtils.java index e4ff89291..da9a90500 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/ModelLoaderUtils.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/editedStyle/ModelLoaderUtils.java @@ -3,16 +3,17 @@ import java.io.File; import java.io.FileNotFoundException; +import org.jogamp.java3d.loaders.IncorrectFormatException; +import org.jogamp.java3d.loaders.Loader; +import org.jogamp.java3d.loaders.ParsingErrorException; +import org.jogamp.java3d.loaders.Scene; +import org.jogamp.java3d.loaders.lw3d.Lw3dLoader; +import org.jogamp.java3d.loaders.objectfile.ObjectFile; + import com.glyphein.j3d.loaders.milkshape.MS3DLoader; -import com.sun.j3d.loaders.IncorrectFormatException; -import com.sun.j3d.loaders.Loader; -import com.sun.j3d.loaders.ParsingErrorException; -import com.sun.j3d.loaders.Scene; -import com.sun.j3d.loaders.lw3d.Lw3dLoader; -import com.sun.j3d.loaders.objectfile.ObjectFile; /** - * Utils class for finding a com.sun.j3d.loaders.Loader based on the + * Utils class for finding a org.jogamp.java3d.loaders.Loader based on the * file type. * * @author Eric Tatara diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayComponentControllerAction.java b/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayComponentControllerAction.java index b2c5a8ac7..575704b95 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayComponentControllerAction.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayComponentControllerAction.java @@ -70,7 +70,7 @@ public void runInitialize(RunState runState, Object contextId, Parameters params if (descriptor.getDisplayType().equals(DisplayType.THREE_D)) { // try to load a 3D class to make sure that the user has J3D installed try { - Class.forName("com.sun.j3d.utils.behaviors.mouse.MouseWheelZoom"); + Class.forName("org.jogamp.java3d.utils.behaviors.mouse.MouseWheelZoom"); } catch (ClassNotFoundException e) { JOptionPane.showMessageDialog(null, "Java3D 1.6 (java3d.dev.java.net) is required for 3D displays." + "\nAborting 3D display creation of '" + descriptor.getName() + "'."); @@ -78,17 +78,17 @@ public void runInitialize(RunState runState, Object contextId, Parameters params } // Java 3D not supported on Java9+ on macOS - if (SystemUtils.IS_OS_MAC && !SystemUtils.IS_JAVA_8) { - JOptionPane.showMessageDialog(null, "3D displays are only supported with Java 8 on macOS." + - "\nAborting display creation of '" + descriptor.getName() + "'."); - - return; - } +// if (SystemUtils.IS_OS_MAC && !SystemUtils.IS_JAVA_8) { +// JOptionPane.showMessageDialog(null, "3D displays are only supported with Java 8 on macOS." + +// "\nAborting display creation of '" + descriptor.getName() + "'."); +// +// return; +// } } else if (descriptor.getDisplayType().equals(DisplayType.TWO_D)) { // try to load a JOGL class to make sure that the user has JOGL installed try { - Class.forName("javax.media.opengl.glu.GLU"); + Class.forName("com.jogamp.opengl.glu.GLU"); } catch (ClassNotFoundException e) { JOptionPane.showMessageDialog(null, "JOGL (jogl.dev.java.net) is required for 2D displays." + "\nAborting display creation of '" + descriptor.getName() + "'."); diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayProducer.java b/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayProducer.java index 318263f17..2265eb339 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayProducer.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/engine/DisplayProducer.java @@ -27,7 +27,7 @@ public DisplayProducer(Object contextID, RunState runState, DisplayDescriptor di Context masterContext = runState.getMasterContext(); setContext(masterContext, contextID); if (context == null) { - throw new IllegalArgumentException("Unable to create display for context id: '" + contextID + "'. This is must match that set in the model's ContextBuilder."); + throw new IllegalArgumentException("Unable to create display for context id: '" + contextID + "'. This must match that set in the model's ContextBuilder."); } } diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid2DLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid2DLayout.java index 6b2d11fbf..6107c1d1d 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid2DLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid2DLayout.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.grid; -import javax.vecmath.Point3f; +import org.jogamp.vecmath.Point3f; import repast.simphony.space.grid.Grid; import repast.simphony.space.grid.GridDimensions; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DLayout.java index b61b0f299..ee59a7002 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DLayout.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.grid; -import javax.vecmath.Point3f; +import org.jogamp.vecmath.Point3f; import repast.simphony.visualization.Box; import repast.simphony.visualization.Layout; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DProjectionDecorator.java b/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DProjectionDecorator.java index 684fdf2bd..6516576d4 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DProjectionDecorator.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/grid/Grid3DProjectionDecorator.java @@ -7,11 +7,11 @@ import repast.simphony.visualization.visualization3D.Display3D; import repast.simphony.visualization.visualization3D.ShapeFactory; -import javax.media.j3d.Group; -import javax.media.j3d.Shape3D; -import javax.media.j3d.Transform3D; -import javax.media.j3d.TransformGroup; -import javax.vecmath.Vector3f; +import org.jogamp.java3d.Group; +import org.jogamp.java3d.Shape3D; +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.vecmath.Vector3f; /** * Decorator for 2D and 3D grids when displayed in 3D. This can diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedEdgeVisualItem.java b/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedEdgeVisualItem.java index 5325ff338..243b12e8c 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedEdgeVisualItem.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedEdgeVisualItem.java @@ -1,10 +1,10 @@ package repast.simphony.visualization.network; -import javax.media.j3d.Shape3D; -import javax.media.j3d.Transform3D; -import javax.media.j3d.TransformGroup; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.java3d.Shape3D; +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.visualization.visualization3D.Label; import repast.simphony.visualization.visualization3D.ShapeFactory; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedLineEdgeVisualItem.java b/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedLineEdgeVisualItem.java index 0b62dbaff..6f5752c13 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedLineEdgeVisualItem.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/network/DirectedLineEdgeVisualItem.java @@ -1,10 +1,10 @@ package repast.simphony.visualization.network; -import javax.media.j3d.Shape3D; -import javax.media.j3d.Transform3D; -import javax.media.j3d.TransformGroup; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.java3d.Shape3D; +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.visualization.visualization3D.Label; import repast.simphony.visualization.visualization3D.ShapeFactory; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeLabel.java b/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeLabel.java index cba877450..69dbfefac 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeLabel.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeLabel.java @@ -1,7 +1,7 @@ package repast.simphony.visualization.network; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.random.RandomHelper; import repast.simphony.visualization.visualization3D.AbstractLabel; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeVisualItem.java b/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeVisualItem.java index bdfc03855..79bfef1b0 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeVisualItem.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/network/EdgeVisualItem.java @@ -1,8 +1,8 @@ package repast.simphony.visualization.network; -import javax.vecmath.AxisAngle4f; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.AxisAngle4f; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.visualization.visualization3D.Label; import repast.simphony.visualization.visualization3D.VisualItem3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/network/LineEdgeVisualItem3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/network/LineEdgeVisualItem3D.java index fc76c1529..732df6684 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/network/LineEdgeVisualItem3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/network/LineEdgeVisualItem3D.java @@ -3,10 +3,10 @@ import java.util.Map; import java.util.Set; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.GeometryArray; -import javax.media.j3d.Shape3D; -import javax.vecmath.Point3f; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.GeometryArray; +import org.jogamp.java3d.Shape3D; +import org.jogamp.vecmath.Point3f; import repast.simphony.visualization.visualization3D.Label; import repast.simphony.visualization.visualization3D.style.Style3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/network/NetworkDisplayLayer3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/network/NetworkDisplayLayer3D.java index 39bd21c13..1954ee02f 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/network/NetworkDisplayLayer3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/network/NetworkDisplayLayer3D.java @@ -2,11 +2,11 @@ import java.util.Iterator; -import javax.media.j3d.BoundingSphere; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.Group; -import javax.media.j3d.Shape3D; -import javax.vecmath.Point3f; +import org.jogamp.java3d.BoundingSphere; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.Group; +import org.jogamp.java3d.Shape3D; +import org.jogamp.vecmath.Point3f; import repast.simphony.space.graph.Network; import repast.simphony.space.graph.RepastEdge; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/Random2DLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/Random2DLayout.java index 48c2dbb22..ae7ce8e1d 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/Random2DLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/Random2DLayout.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.visualization2D; -import javax.vecmath.Point3f; +import org.jogamp.vecmath.Point3f; import repast.simphony.space.projection.Projection; import repast.simphony.visualization.Box; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/layout/JungLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/layout/JungLayout.java index 77157a2d1..e8cb5c08a 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/layout/JungLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization2D/layout/JungLayout.java @@ -2,7 +2,7 @@ import java.awt.Dimension; -import javax.vecmath.Point3f; +import org.jogamp.vecmath.Point3f; import repast.simphony.space.graph.Network; import repast.simphony.space.graph.RepastEdge; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplay3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplay3D.java index 1810900fe..f59da2ffc 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplay3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplay3D.java @@ -15,7 +15,7 @@ import java.util.HashMap; import java.util.Map; -import javax.media.j3d.Behavior; +import org.jogamp.java3d.Behavior; import javax.swing.JPanel; import javax.swing.SwingUtilities; @@ -38,7 +38,7 @@ import repast.simphony.visualization.visualization3D.style.Style3D; import repast.simphony.visualization.visualization3D.style.ValueLayerStyle3D; -import com.sun.j3d.exp.swing.JCanvas3D; +import org.jogamp.java3d.exp.swing.JCanvas3D; /** * Abstract base class for 3D displays. diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplayLayer3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplayLayer3D.java index a51f8cdfa..9a6c0356d 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplayLayer3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractDisplayLayer3D.java @@ -6,9 +6,9 @@ import java.util.Map; import java.util.Set; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.Group; -import javax.media.j3d.Shape3D; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.Group; +import org.jogamp.java3d.Shape3D; import repast.simphony.visualization.Layout; import repast.simphony.visualization.LayoutUpdater; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractLabel.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractLabel.java index 0afdf00a7..ea3cd86af 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractLabel.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AbstractLabel.java @@ -3,23 +3,23 @@ import java.awt.Color; import java.awt.Font; -import javax.media.j3d.Appearance; -import javax.media.j3d.BoundingBox; -import javax.media.j3d.BoundingSphere; -import javax.media.j3d.Bounds; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.ColoringAttributes; -import javax.media.j3d.Font3D; -import javax.media.j3d.FontExtrusion; -import javax.media.j3d.Group; -import javax.media.j3d.OrientedShape3D; -import javax.media.j3d.Text3D; -import javax.media.j3d.Transform3D; -import javax.media.j3d.TransformGroup; -import javax.vecmath.Color3f; -import javax.vecmath.Point3d; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.java3d.Appearance; +import org.jogamp.java3d.BoundingBox; +import org.jogamp.java3d.BoundingSphere; +import org.jogamp.java3d.Bounds; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.ColoringAttributes; +import org.jogamp.java3d.Font3D; +import org.jogamp.java3d.FontExtrusion; +import org.jogamp.java3d.Group; +import org.jogamp.java3d.OrientedShape3D; +import org.jogamp.java3d.Text3D; +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.vecmath.Color3f; +import org.jogamp.vecmath.Point3d; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.visualization.visualization3D.style.Style3D; @@ -34,7 +34,8 @@ public abstract class AbstractLabel implements Label { protected Style3D.LabelPosition position; protected BranchGroup group; protected boolean updated = true; - protected Color3f color = new Color3f(Color.YELLOW); + protected Color3f color = new Color3f(Color.YELLOW.getRGBColorComponents(null)); + protected Color jColor = new Color(color.getX(), color.getY(), color.getZ()); protected Font3D font = new Font3D(new Font("Helvetica", Font.PLAIN, 10), new FontExtrusion()); protected Appearance appearance = new Appearance(); protected float textScale = font.getFont().getSize() / SCALE; @@ -86,14 +87,15 @@ public Style3D.LabelPosition getPosition() { } public void setColor(Color color) { - if (color != null && !color.equals(this.color.get())) { - this.color.set(color); + if (color != null && !color.equals(jColor)) { + this.color.set(color.getColorComponents(null)); + this.jColor = color; appearance.getColoringAttributes().setColor(this.color); } } public Color getColor() { - return this.color.get(); + return jColor; } public void setFont(Font font) { diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AgentLabel.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AgentLabel.java index 3a643c58d..5cf63e407 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AgentLabel.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AgentLabel.java @@ -1,7 +1,7 @@ package repast.simphony.visualization.visualization3D; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.visualization.visualization3D.style.Style3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AppearanceFactory.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AppearanceFactory.java index 77cd28128..6505b5376 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AppearanceFactory.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/AppearanceFactory.java @@ -2,12 +2,12 @@ import java.awt.Color; -import javax.media.j3d.Appearance; -import javax.media.j3d.ColoringAttributes; -import javax.media.j3d.Material; -import javax.media.j3d.PolygonAttributes; -import javax.media.j3d.TransparencyAttributes; -import javax.vecmath.Color3f; +import org.jogamp.java3d.Appearance; +import org.jogamp.java3d.ColoringAttributes; +import org.jogamp.java3d.Material; +import org.jogamp.java3d.PolygonAttributes; +import org.jogamp.java3d.TransparencyAttributes; +import org.jogamp.vecmath.Color3f; /** * @author Nick Collier diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometry.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometry.java index dcc69ce6d..3c866e112 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometry.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometry.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.visualization3D; -import javax.media.j3d.Geometry; +import org.jogamp.java3d.Geometry; import repast.simphony.visualization.visualization3D.style.ValueLayerStyle3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometryUpdater.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometryUpdater.java index d667dfe6f..f3b45ab6a 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometryUpdater.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataGeometryUpdater.java @@ -1,7 +1,7 @@ package repast.simphony.visualization.visualization3D; -import javax.media.j3d.Geometry; -import javax.media.j3d.GeometryUpdater; +import org.jogamp.java3d.Geometry; +import org.jogamp.java3d.GeometryUpdater; /** * @author Nick Collier diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataUpdateBehavior.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataUpdateBehavior.java index 0ff21f340..0266a4144 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataUpdateBehavior.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DataUpdateBehavior.java @@ -1,10 +1,10 @@ package repast.simphony.visualization.visualization3D; -import java.util.Enumeration; +import java.util.Iterator; -import javax.media.j3d.Behavior; -import javax.media.j3d.Geometry; -import javax.media.j3d.WakeupOnBehaviorPost; +import org.jogamp.java3d.Behavior; +import org.jogamp.java3d.Geometry; +import org.jogamp.java3d.WakeupOnBehaviorPost; /** * Behavior to update geometry. @@ -29,7 +29,7 @@ public void initialize() { wakeupOn(wakeUp); } - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator criteria) { updater.updateData(geometry); wakeupOn(wakeUp); } diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DefaultValueDisplayLayer3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DefaultValueDisplayLayer3D.java index f9294cf65..6d9ebea3d 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DefaultValueDisplayLayer3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DefaultValueDisplayLayer3D.java @@ -1,15 +1,15 @@ package repast.simphony.visualization.visualization3D; -import com.sun.j3d.utils.picking.PickTool; +import org.jogamp.java3d.utils.picking.PickTool; import repast.simphony.space.Dimensions; import repast.simphony.valueLayer.ValueLayer; import repast.simphony.visualization.visualization3D.style.DefaultValueLayerStyle3D; import repast.simphony.visualization.visualization3D.style.ValueLayerStyle3D; -import javax.media.j3d.*; -import javax.vecmath.Point3d; -import javax.vecmath.Vector3d; -import javax.vecmath.Vector3f; +import org.jogamp.java3d.*; +import org.jogamp.vecmath.Point3d; +import org.jogamp.vecmath.Vector3d; +import org.jogamp.vecmath.Vector3f; import java.awt.*; import java.util.HashMap; import java.util.Map; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Display3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Display3D.java index df4283c5d..49ab372fb 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Display3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Display3D.java @@ -10,27 +10,33 @@ import java.awt.event.MouseEvent; import java.awt.event.WindowEvent; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.List; -import javax.media.j3d.AmbientLight; -import javax.media.j3d.Background; -import javax.media.j3d.Behavior; -import javax.media.j3d.BoundingSphere; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.DirectionalLight; -import javax.media.j3d.GraphicsConfigTemplate3D; -import javax.media.j3d.PickInfo; -import javax.media.j3d.Shape3D; -import javax.media.j3d.Transform3D; -import javax.media.j3d.TransformGroup; -import javax.media.j3d.View; -import javax.media.j3d.WakeupCondition; -import javax.media.j3d.WakeupOnElapsedFrames; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import javax.vecmath.Point3d; -import javax.vecmath.Vector3d; + +import org.jogamp.java3d.AmbientLight; +import org.jogamp.java3d.Background; +import org.jogamp.java3d.Behavior; +import org.jogamp.java3d.BoundingSphere; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.DirectionalLight; +import org.jogamp.java3d.GraphicsConfigTemplate3D; +import org.jogamp.java3d.PickInfo; +import org.jogamp.java3d.Shape3D; +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.java3d.View; +import org.jogamp.java3d.WakeupCondition; +import org.jogamp.java3d.WakeupOnElapsedFrames; +import org.jogamp.java3d.exp.swing.JCanvas3D; +import org.jogamp.java3d.utils.behaviors.mouse.MouseBehavior; +import org.jogamp.java3d.utils.behaviors.mouse.MouseWheelZoom; +import org.jogamp.java3d.utils.pickfast.PickCanvas; +import org.jogamp.java3d.utils.universe.SimpleUniverse; +import org.jogamp.vecmath.Point3d; +import org.jogamp.vecmath.Vector3d; import repast.simphony.space.graph.Network; import repast.simphony.space.projection.Projection; @@ -47,17 +53,6 @@ import repast.simphony.visualization.visualization3D.style.Style3D; import repast.simphony.visualization.visualization3D.style.ValueLayerStyle3D; -import com.sun.j3d.exp.swing.JCanvas3D; -import com.sun.j3d.utils.behaviors.mouse.MouseBehavior; -import com.sun.j3d.utils.behaviors.mouse.MouseRotate; -import com.sun.j3d.utils.behaviors.mouse.MouseTranslate; -import com.sun.j3d.utils.behaviors.mouse.MouseWheelZoom; -import com.sun.j3d.utils.behaviors.mouse.MouseZoom; -import com.sun.j3d.utils.pickfast.PickCanvas; -import com.sun.j3d.utils.picking.PickResult; -import com.sun.j3d.utils.picking.PickTool; -import com.sun.j3d.utils.universe.SimpleUniverse; - /** * 3D Display class based on J3D. Uses a behavior to update the display. * @@ -542,7 +537,7 @@ public void initialize() { this.wakeupOn(wakeup); } - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator criteria) { if (triggered) { for (IDisplayLayer display : displayMap.values()) { diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DisplayLayer3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DisplayLayer3D.java index 2a283600e..97932fd00 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DisplayLayer3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/DisplayLayer3D.java @@ -2,8 +2,8 @@ import java.util.Iterator; -import javax.media.j3d.Group; -import javax.media.j3d.Shape3D; +import org.jogamp.java3d.Group; +import org.jogamp.java3d.Shape3D; import repast.simphony.visualization.Layout; import repast.simphony.visualization.visualization3D.style.DefaultStyle3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/IDisplayLayer3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/IDisplayLayer3D.java index a9bed3b61..8cd36ed6d 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/IDisplayLayer3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/IDisplayLayer3D.java @@ -1,7 +1,7 @@ /*CopyrightHere*/ package repast.simphony.visualization.visualization3D; -import javax.media.j3d.Shape3D; +import org.jogamp.java3d.Shape3D; import repast.simphony.visualization.IDisplayLayer; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Label.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Label.java index f73c15e10..e155fb95e 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Label.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Label.java @@ -4,9 +4,9 @@ import java.awt.Color; import java.awt.Font; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.Group; -import javax.vecmath.Point3f; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.Group; +import org.jogamp.vecmath.Point3f; import repast.simphony.visualization.visualization3D.style.Style3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MeshGridGeometry.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MeshGridGeometry.java index d857f4b0e..4e6cb03b3 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MeshGridGeometry.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MeshGridGeometry.java @@ -1,12 +1,12 @@ package repast.simphony.visualization.visualization3D; -import com.sun.j3d.utils.geometry.GeometryInfo; -import com.sun.j3d.utils.geometry.NormalGenerator; +import org.jogamp.java3d.utils.geometry.GeometryInfo; +import org.jogamp.java3d.utils.geometry.NormalGenerator; import repast.simphony.visualization.visualization3D.style.ValueLayerStyle3D; -import javax.media.j3d.Geometry; -import javax.media.j3d.GeometryArray; -import javax.media.j3d.TriangleStripArray; +import org.jogamp.java3d.Geometry; +import org.jogamp.java3d.GeometryArray; +import org.jogamp.java3d.TriangleStripArray; import java.awt.*; /** diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseRotate.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseRotate.java new file mode 100644 index 000000000..37ae0d727 --- /dev/null +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseRotate.java @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + */ + +package repast.simphony.visualization.visualization3D; + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.event.MouseEvent; +import java.util.Iterator; + +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.java3d.WakeupCriterion; +import org.jogamp.java3d.WakeupOnAWTEvent; +import org.jogamp.java3d.WakeupOnBehaviorPost; +import org.jogamp.java3d.utils.behaviors.mouse.MouseBehavior; +import org.jogamp.java3d.utils.behaviors.mouse.MouseBehaviorCallback; +import org.jogamp.vecmath.Matrix4d; +import org.jogamp.vecmath.Vector3d; + +//***** Updated by E. Tatara to work mouse event bit mask in JDK 9+ ***** + +/** + * MouseRotate is a Java3D behavior object that lets users control the + * rotation of an object via a mouse. + *

+ * To use this utility, first create a transform group that this + * rotate behavior will operate on. Then, + *

+ *
+ *   MouseRotate behavior = new MouseRotate();
+ *   behavior.setTransformGroup(objTrans);
+ *   objTrans.addChild(behavior);
+ *   behavior.setSchedulingBounds(bounds);
+ *
+ *
+ * The above code will add the rotate behavior to the transform + * group. The user can rotate any object attached to the objTrans. + */ + +public class MouseRotate extends MouseBehavior { + double x_angle, y_angle; + double x_factor = .03; + double y_factor = .03; + + private MouseBehaviorCallback callback = null; + + /** + * Creates a rotate behavior given the transform group. + * @param transformGroup The transformGroup to operate on. + */ + public MouseRotate(TransformGroup transformGroup) { + super(transformGroup); + } + + /** + * Creates a default mouse rotate behavior. + **/ + public MouseRotate() { + super(0); + } + + /** + * Creates a rotate behavior. + * Note that this behavior still needs a transform + * group to work on (use setTransformGroup(tg)) and + * the transform group must add this behavior. + * @param flags interesting flags (wakeup conditions). + */ + public MouseRotate(int flags) { + super(flags); + } + + /** + * Creates a rotate behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behavior is added to the + * specified Component. A null component can be passed to specify + * the behavior should use listeners. Components can then be added + * to the behavior with the addListener(Component c) method. + * @param c The Component to add the MouseListener + * and MouseMotionListener to. + * @since Java 3D 1.2.1 + */ + public MouseRotate(Component c) { + super(c, 0); + } + + /** + * Creates a rotate behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behaviors is added to + * the specified Component and works on the given TransformGroup. + * A null component can be passed to specify the behavior should use + * listeners. Components can then be added to the behavior with the + * addListener(Component c) method. + * @param c The Component to add the MouseListener and + * MouseMotionListener to. + * @param transformGroup The TransformGroup to operate on. + * @since Java 3D 1.2.1 + */ + public MouseRotate(Component c, TransformGroup transformGroup) { + super(c, transformGroup); + } + + /** + * Creates a rotate behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behavior is added to the + * specified Component. A null component can be passed to specify + * the behavior should use listeners. Components can then be added to + * the behavior with the addListener(Component c) method. + * Note that this behavior still needs a transform + * group to work on (use setTransformGroup(tg)) and the transform + * group must add this behavior. + * @param flags interesting flags (wakeup conditions). + * @since Java 3D 1.2.1 + */ + public MouseRotate(Component c, int flags) { + super(c, flags); + } + + @Override + public void initialize() { + super.initialize(); + x_angle = 0; + y_angle = 0; + if ((flags & INVERT_INPUT) == INVERT_INPUT) { + invert = true; + x_factor *= -1; + y_factor *= -1; + } + } + + /** + * Return the x-axis movement multipler. + **/ + public double getXFactor() { + return x_factor; + } + + /** + * Return the y-axis movement multipler. + **/ + public double getYFactor() { + return y_factor; + } + + + /** + * Set the x-axis amd y-axis movement multipler with factor. + **/ + public void setFactor( double factor) { + x_factor = y_factor = factor; + } + + /** + * Set the x-axis amd y-axis movement multipler with xFactor and yFactor + * respectively. + **/ + public void setFactor( double xFactor, double yFactor) { + x_factor = xFactor; + y_factor = yFactor; + } + + @Override + public void processStimulus (Iterator criteria) { + WakeupCriterion wakeup; + AWTEvent[] events; + MouseEvent evt; + // int id; + // int dx, dy; + + while (criteria.hasNext()) { + wakeup = criteria.next(); + if (wakeup instanceof WakeupOnAWTEvent) { + events = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); + if (events.length > 0) { + evt = (MouseEvent) events[events.length-1]; + doProcess(evt); + } + } + + else if (wakeup instanceof WakeupOnBehaviorPost) { + while (true) { + // access to the queue must be synchronized + synchronized (mouseq) { + if (mouseq.isEmpty()) break; + evt = (MouseEvent)mouseq.remove(0); + // consolidate MOUSE_DRAG events + while ((evt.getID() == MouseEvent.MOUSE_DRAGGED) && + !mouseq.isEmpty() && + (((MouseEvent)mouseq.get(0)).getID() == + MouseEvent.MOUSE_DRAGGED)) { + evt = (MouseEvent)mouseq.remove(0); + } + } + doProcess(evt); + } + } + + } + wakeupOn (mouseCriterion); + } + + void doProcess(MouseEvent evt) { + int id; + int dx, dy; + + processMouseEvent(evt); + + if (((buttonPress)&&((flags & MANUAL_WAKEUP) == 0)) || ((wakeUp)&&((flags & MANUAL_WAKEUP) != 0))) { + id = evt.getID(); + + // JDK9+ requires use of MouseEvent masks for proper Button1 detection + // JDK 8 uses MouseEvent.isMetaDown for detection + // The condition below should work for either event type + + // If Button 1 pressed and not alt key pressed + int button1_mask = MouseEvent.BUTTON1_DOWN_MASK; + int alt_off_mask = MouseEvent.ALT_DOWN_MASK; + boolean do_rotate = false; + + if ((evt.getModifiersEx() & (button1_mask | alt_off_mask)) == button1_mask) { + do_rotate = true; + } + + if ((id == MouseEvent.MOUSE_DRAGGED) && (do_rotate)){ + x = evt.getX(); + y = evt.getY(); + + dx = x - x_last; + dy = y - y_last; + + if (!reset){ + x_angle = dy * y_factor; + y_angle = dx * x_factor; + + transformX.rotX(x_angle); + transformY.rotY(y_angle); + + transformGroup.getTransform(currXform); + + Matrix4d mat = new Matrix4d(); + // Remember old matrix + currXform.get(mat); + + // Translate to origin + currXform.setTranslation(new Vector3d(0.0,0.0,0.0)); + if (invert) { + currXform.mul(currXform, transformX); + currXform.mul(currXform, transformY); + } else { + currXform.mul(transformX, currXform); + currXform.mul(transformY, currXform); + } + + // Set old translation back + Vector3d translation = new + Vector3d(mat.m03, mat.m13, mat.m23); + currXform.setTranslation(translation); + + // Update xform + transformGroup.setTransform(currXform); + + transformChanged( currXform ); + + if (callback!=null) + callback.transformChanged( MouseBehaviorCallback.ROTATE, + currXform ); + } + else { + reset = false; + } + + x_last = x; + y_last = y; + } + else if (id == MouseEvent.MOUSE_PRESSED) { + x_last = evt.getX(); + y_last = evt.getY(); + } + } + } + + /** + * Users can overload this method which is called every time + * the Behavior updates the transform + * + * Default implementation does nothing + */ + public void transformChanged( Transform3D transform ) { + } + + + /** + * The transformChanged method in the callback class will + * be called every time the transform is updated + */ + public void setupCallback( MouseBehaviorCallback callback ) { + this.callback = callback; + } +} diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseTranslate.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseTranslate.java new file mode 100644 index 000000000..314781d7b --- /dev/null +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseTranslate.java @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + */ +package repast.simphony.visualization.visualization3D; + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.event.MouseEvent; +import java.util.Iterator; + +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.java3d.WakeupCriterion; +import org.jogamp.java3d.WakeupOnAWTEvent; +import org.jogamp.java3d.WakeupOnBehaviorPost; +import org.jogamp.java3d.utils.behaviors.mouse.MouseBehavior; +import org.jogamp.java3d.utils.behaviors.mouse.MouseBehaviorCallback; +import org.jogamp.vecmath.Vector3d; + +// ***** Updated by E. Tatara to work mouse event bit mask in JDK 9+ ***** + +/** + * MouseTranslate is a Java3D behavior object that lets users control the + * translation (X, Y) of an object via a mouse drag motion with the third + * mouse button (alt-click on PC). See MouseRotate for similar usage info. + */ + +public class MouseTranslate extends MouseBehavior { + + double x_factor = .02; + double y_factor = .02; + Vector3d translation = new Vector3d(); + + private MouseBehaviorCallback callback = null; + + /** + * Creates a mouse translate behavior given the transform group. + * @param transformGroup The transformGroup to operate on. + */ + public MouseTranslate(TransformGroup transformGroup) { + super(transformGroup); + } + + /** + * Creates a default translate behavior. + */ + public MouseTranslate(){ + super(0); + } + + /** + * Creates a translate behavior. + * Note that this behavior still needs a transform + * group to work on (use setTransformGroup(tg)) and + * the transform group must add this behavior. + * @param flags + */ + public MouseTranslate(int flags) { + super(flags); + } + + /** + * Creates a translate behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behavior is added to the + * specified Component. A null component can be passed to specify + * the behavior should use listeners. Components can then be added + * to the behavior with the addListener(Component c) method. + * @param c The Component to add the MouseListener + * and MouseMotionListener to. + * @since Java 3D 1.2.1 + */ + public MouseTranslate(Component c) { + super(c, 0); + } + + /** + * Creates a translate behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behaviors is added to + * the specified Component and works on the given TransformGroup. + * A null component can be passed to specify the behavior should use + * listeners. Components can then be added to the behavior with the + * addListener(Component c) method. + * @param c The Component to add the MouseListener and + * MouseMotionListener to. + * @param transformGroup The TransformGroup to operate on. + * @since Java 3D 1.2.1 + */ + public MouseTranslate(Component c, TransformGroup transformGroup) { + super(c, transformGroup); + } + + /** + * Creates a translate behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behavior is added to the + * specified Component. A null component can be passed to specify + * the behavior should use listeners. Components can then be added to + * the behavior with the addListener(Component c) method. + * Note that this behavior still needs a transform + * group to work on (use setTransformGroup(tg)) and the transform + * group must add this behavior. + * @param flags interesting flags (wakeup conditions). + * @since Java 3D 1.2.1 + */ + public MouseTranslate(Component c, int flags) { + super(c, flags); + } + + @Override + public void initialize() { + super.initialize(); + if ((flags & INVERT_INPUT) == INVERT_INPUT) { + invert = true; + x_factor *= -1; + y_factor *= -1; + } + } + + /** + * Return the x-axis movement multipler. + **/ + public double getXFactor() { + return x_factor; + } + + /** + * Return the y-axis movement multipler. + **/ + public double getYFactor() { + return y_factor; + } + + /** + * Set the x-axis amd y-axis movement multipler with factor. + **/ + public void setFactor( double factor) { + x_factor = y_factor = factor; + } + + /** + * Set the x-axis amd y-axis movement multipler with xFactor and yFactor + * respectively. + **/ + public void setFactor( double xFactor, double yFactor) { + x_factor = xFactor; + y_factor = yFactor; + } + + @Override + public void processStimulus (Iterator criteria) { + WakeupCriterion wakeup; + AWTEvent[] events; + MouseEvent evt; + // int id; + // int dx, dy; + + while (criteria.hasNext()) { + wakeup = criteria.next(); + + if (wakeup instanceof WakeupOnAWTEvent) { + events = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); + if (events.length > 0) { + evt = (MouseEvent) events[events.length-1]; + doProcess(evt); + } + } + + else if (wakeup instanceof WakeupOnBehaviorPost) { + while (true) { + // access to the queue must be synchronized + synchronized (mouseq) { + if (mouseq.isEmpty()) break; + evt = (MouseEvent)mouseq.remove(0); + // consolodate MOUSE_DRAG events + while ((evt.getID() == MouseEvent.MOUSE_DRAGGED) && + !mouseq.isEmpty() && + (((MouseEvent)mouseq.get(0)).getID() == + MouseEvent.MOUSE_DRAGGED)) { + evt = (MouseEvent)mouseq.remove(0); + } + } + doProcess(evt); + } + } + + } + wakeupOn(mouseCriterion); + } + + void doProcess(MouseEvent evt) { + int id; + int dx, dy; + + processMouseEvent(evt); + + if (((buttonPress)&&((flags & MANUAL_WAKEUP) == 0)) || ((wakeUp)&&((flags & MANUAL_WAKEUP) != 0))){ + id = evt.getID(); + + // JDK9+ requires use of MouseEvent masks for proper Button3 detection + // JDK 8 uses MouseEvent.isMetaDown for Button3 detection + // The condition below should work for either event type + + // If Button 3 pressed + int button3_mask = MouseEvent.BUTTON3_DOWN_MASK; + boolean do_translate = false; + + if ((evt.getModifiersEx() & button3_mask) == button3_mask) { + do_translate = true; + } + if ((id == MouseEvent.MOUSE_DRAGGED) && (do_translate)) { + + x = evt.getX(); + y = evt.getY(); + + dx = x - x_last; + dy = y - y_last; + + if ((!reset) && ((Math.abs(dy) < 50) && (Math.abs(dx) < 50))) { + //System.out.println("dx " + dx + " dy " + dy); + transformGroup.getTransform(currXform); + + translation.x = dx*x_factor; + translation.y = -dy*y_factor; + + transformX.set(translation); + + if (invert) { + currXform.mul(currXform, transformX); + } else { + currXform.mul(transformX, currXform); + } + + transformGroup.setTransform(currXform); + + transformChanged( currXform ); + + if (callback!=null) + callback.transformChanged( MouseBehaviorCallback.TRANSLATE, + currXform ); + + } + else { + reset = false; + } + x_last = x; + y_last = y; + } + else if (id == MouseEvent.MOUSE_PRESSED) { + x_last = evt.getX(); + y_last = evt.getY(); + } + } + } + + /** + * Users can overload this method which is called every time + * the Behavior updates the transform + * + * Default implementation does nothing + */ + public void transformChanged( Transform3D transform ) { + } + + /** + * The transformChanged method in the callback class will + * be called every time the transform is updated + */ + public void setupCallback( MouseBehaviorCallback callback ) { + this.callback = callback; + } +} + diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseZoom.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseZoom.java new file mode 100644 index 000000000..e7c0fe18c --- /dev/null +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/MouseZoom.java @@ -0,0 +1,288 @@ +/* + * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + */ + +package repast.simphony.visualization.visualization3D; + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.event.MouseEvent; +import java.util.Iterator; + +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.java3d.WakeupCriterion; +import org.jogamp.java3d.WakeupOnAWTEvent; +import org.jogamp.java3d.WakeupOnBehaviorPost; +import org.jogamp.java3d.utils.behaviors.mouse.MouseBehavior; +import org.jogamp.java3d.utils.behaviors.mouse.MouseBehaviorCallback; +import org.jogamp.vecmath.Vector3d; + +//***** Updated by E. Tatara to work mouse event bit mask in JDK 9+ ***** + +/** + * MouseZoom is a Java3D behavior object that lets users control the + * Z axis translation of an object via a mouse drag motion with the second + * mouse button. See MouseRotate for similar usage info. + */ + +public class MouseZoom extends MouseBehavior { + + double z_factor = .04; + Vector3d translation = new Vector3d(); + + private MouseBehaviorCallback callback = null; + + /** + * Creates a zoom behavior given the transform group. + * @param transformGroup The transformGroup to operate on. + */ + public MouseZoom(TransformGroup transformGroup) { + super(transformGroup); + } + + /** + * Creates a default mouse zoom behavior. + **/ + public MouseZoom(){ + super(0); + } + + /** + * Creates a zoom behavior. + * Note that this behavior still needs a transform + * group to work on (use setTransformGroup(tg)) and + * the transform group must add this behavior. + * @param flags + */ + public MouseZoom(int flags) { + super(flags); + } + + /** + * Creates a zoom behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behavior is added to the + * specified Component. A null component can be passed to specify + * the behavior should use listeners. Components can then be added + * to the behavior with the addListener(Component c) method. + * @param c The Component to add the MouseListener + * and MouseMotionListener to. + * @since Java 3D 1.2.1 + */ + public MouseZoom(Component c) { + super(c, 0); + } + + /** + * Creates a zoom behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behaviors is added to + * the specified Component and works on the given TransformGroup. + * @param c The Component to add the MouseListener and + * MouseMotionListener to. A null component can be passed to specify + * the behavior should use listeners. Components can then be added + * to the behavior with the addListener(Component c) method. + * @param transformGroup The TransformGroup to operate on. + * @since Java 3D 1.2.1 + */ + public MouseZoom(Component c, TransformGroup transformGroup) { + super(c, transformGroup); + } + + /** + * Creates a zoom behavior that uses AWT listeners and behavior + * posts rather than WakeupOnAWTEvent. The behavior is added to the + * specified Component. A null component can be passed to specify + * the behavior should use listeners. Components can then be added + * to the behavior with the addListener(Component c) method. + * Note that this behavior still needs a transform + * group to work on (use setTransformGroup(tg)) and the transform + * group must add this behavior. + * @param flags interesting flags (wakeup conditions). + * @since Java 3D 1.2.1 + */ + public MouseZoom(Component c, int flags) { + super(c, flags); + } + + @Override + public void initialize() { + super.initialize(); + if ((flags & INVERT_INPUT) == INVERT_INPUT) { + z_factor *= -1; + invert = true; + } + } + + /** + * Return the y-axis movement multipler. + **/ + public double getFactor() { + return z_factor; + } + + /** + * Set the y-axis movement multipler with factor. + **/ + public void setFactor( double factor) { + z_factor = factor; + } + + + @Override + public void processStimulus (Iterator criteria) { + WakeupCriterion wakeup; + AWTEvent[] events; + MouseEvent evt; + // int id; + // int dx, dy; + + while (criteria.hasNext()) { + wakeup = criteria.next(); + if (wakeup instanceof WakeupOnAWTEvent) { + events = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); + if (events.length > 0) { + evt = (MouseEvent) events[events.length-1]; + doProcess(evt); + } + } + + else if (wakeup instanceof WakeupOnBehaviorPost) { + while (true) { + synchronized (mouseq) { + if (mouseq.isEmpty()) break; + evt = (MouseEvent)mouseq.remove(0); + // consolodate MOUSE_DRAG events + while((evt.getID() == MouseEvent.MOUSE_DRAGGED) && + !mouseq.isEmpty() && + (((MouseEvent)mouseq.get(0)).getID() == + MouseEvent.MOUSE_DRAGGED)) { + evt = (MouseEvent)mouseq.remove(0); + } + } + doProcess(evt); + } + } + + } + wakeupOn (mouseCriterion); + } + + void doProcess(MouseEvent evt) { + int id; + int dx, dy; + + processMouseEvent(evt); + + if (((buttonPress)&&((flags & MANUAL_WAKEUP) == 0)) || ((wakeUp)&&((flags & MANUAL_WAKEUP) != 0))){ + id = evt.getID(); + + // JDK9+ requires use of MouseEvent masks for proper button detection + // JDK 8 uses MouseEvent.isMetaDown for Button3 detection + // The condition below should work for either event type + + // If button 1 pressed and alt key pressed + int button1_alt_mask = MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.ALT_DOWN_MASK; + boolean do_zoom = false; + + if ((evt.getModifiersEx() & button1_alt_mask) == button1_alt_mask) { + do_zoom = true; + } + + if ((id == MouseEvent.MOUSE_DRAGGED) && do_zoom){ + + x = evt.getX(); + y = evt.getY(); + + dx = x - x_last; + dy = y - y_last; + + if (!reset){ + transformGroup.getTransform(currXform); + + translation.z = dy*z_factor; + + transformX.set(translation); + + if (invert) { + currXform.mul(currXform, transformX); + } else { + currXform.mul(transformX, currXform); + } + + transformGroup.setTransform(currXform); + + transformChanged( currXform ); + + if (callback!=null) + callback.transformChanged( MouseBehaviorCallback.ZOOM, + currXform ); + + } + else { + reset = false; + } + + x_last = x; + y_last = y; + } + else if (id == MouseEvent.MOUSE_PRESSED) { + x_last = evt.getX(); + y_last = evt.getY(); + } + } + } + + + /** + * Users can overload this method which is called every time + * the Behavior updates the transform + * + * Default implementation does nothing + */ + public void transformChanged( Transform3D transform ) { + } + + /** + * The transformChanged method in the callback class will + * be called every time the transform is updated + */ + public void setupCallback( MouseBehaviorCallback callback ) { + this.callback = callback; + } +} + diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/NullLabel.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/NullLabel.java index 81829dd4d..bb9ac549a 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/NullLabel.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/NullLabel.java @@ -3,9 +3,9 @@ import java.awt.Color; import java.awt.Font; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.Group; -import javax.vecmath.Point3f; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.Group; +import org.jogamp.vecmath.Point3f; import repast.simphony.visualization.visualization3D.style.Style3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ProjectionStyle3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ProjectionStyle3D.java index d5dd3b9c5..d16d860d3 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ProjectionStyle3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ProjectionStyle3D.java @@ -1,8 +1,8 @@ /*CopyrightHere*/ package repast.simphony.visualization.visualization3D; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.TransformGroup; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.TransformGroup; import repast.simphony.visualization.VisualizationProperties; import repast.simphony.space.projection.Projection; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/RepastCanvas3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/RepastCanvas3D.java index da3cf9ee5..1592cb39c 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/RepastCanvas3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/RepastCanvas3D.java @@ -3,7 +3,7 @@ import java.awt.GraphicsConfiguration; import java.util.ArrayList; -import javax.media.j3d.Canvas3D; +import org.jogamp.java3d.Canvas3D; /** * @author Nick Collier diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ShapeFactory.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ShapeFactory.java index 7dcd079af..3e2acda43 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ShapeFactory.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ShapeFactory.java @@ -1,12 +1,12 @@ package repast.simphony.visualization.visualization3D; -import com.sun.j3d.utils.geometry.*; -import com.sun.j3d.utils.picking.PickTool; +import org.jogamp.java3d.utils.geometry.*; +import org.jogamp.java3d.utils.picking.PickTool; -import javax.media.j3d.*; -import javax.vecmath.Color3f; -import javax.vecmath.Color4f; -import javax.vecmath.Point3f; +import org.jogamp.java3d.*; +import org.jogamp.vecmath.Color3f; +import org.jogamp.vecmath.Color4f; +import org.jogamp.vecmath.Point3f; import java.awt.*; /** @@ -178,7 +178,7 @@ public static Shape3D createWireframeSquare(float unitSize, float xdim, float zd lineArray.setCoordinate(i++, new Point3f(xExtent, 0, zExtent)); - Color4f color4f = new Color4f(color); + Color4f color4f = new Color4f(color.getRGBComponents(null)); for (int j = 0; j < i; j++) { lineArray.setColor(j, color4f); @@ -231,7 +231,7 @@ public static Shape3D createWireframeBox(float xdim, float ydim, float zdim, Col lineArray.setCoordinate(i++, new Point3f(xdim, ydim, zdim)); lineArray.setCoordinate(i++, new Point3f(0, ydim, zdim)); - Color3f colors = new Color3f(color); + Color3f colors = new Color3f(color.getRGBColorComponents(null)); for (int j = 0; j < i; j++) { lineArray.setColor(j, colors); @@ -255,7 +255,7 @@ public static Shape3D createGrid(float cellSize, Color color, int... dimensions) float z = cellSize * yDim; int index = 0; // todo update to indexed line array so we don't need a color for each vertex. - Color3f color3f = new Color3f(color); + Color3f color3f = new Color3f(color.getRGBColorComponents(null)); for (int i = 0; i <= xDim; i++) { float x = i * cellSize; lineArray.setCoordinate(index, new Point3f(x, 0, 0)); @@ -288,7 +288,7 @@ public static Shape3D createGrid(float cellSize, Color color, int... dimensions) LineArray lineArray = new LineArray(verts, GeometryArray.COORDINATES | GeometryArray.COLOR_3); - Color3f color3f = new Color3f(color); + Color3f color3f = new Color3f(color.getRGBColorComponents(null)); float zMax = cellSize * zDim; float xMax = cellSize * xDim; int index = 0; @@ -361,7 +361,7 @@ public static Shape3D createAxes(float width, float height, float depth, float m lineArray.setCoordinate(i++, new Point3f(0, 0, 0)); lineArray.setCoordinate(i++, new Point3f(0, 0, depth)); - Color3f colors = new Color3f(color); + Color3f colors = new Color3f(color.getRGBColorComponents(null)); for (int j = 0; j < i; j++) { lineArray.setColor(j, colors); diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Transformer.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Transformer.java index b0a0bc870..356ac15d2 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Transformer.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/Transformer.java @@ -1,11 +1,11 @@ package repast.simphony.visualization.visualization3D; -import javax.media.j3d.Transform3D; -import javax.media.j3d.TransformGroup; -import javax.vecmath.AxisAngle4f; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3d; -import javax.vecmath.Vector3f; +import org.jogamp.java3d.Transform3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.vecmath.AxisAngle4f; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3d; +import org.jogamp.vecmath.Vector3f; /** * @author Nick Collier diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ValueDisplayLayer3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ValueDisplayLayer3D.java index 48a67448e..82c5fc503 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ValueDisplayLayer3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/ValueDisplayLayer3D.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.visualization3D; -import javax.media.j3d.Behavior; +import org.jogamp.java3d.Behavior; import repast.simphony.valueLayer.ValueLayer; import repast.simphony.visualization.visualization3D.style.ValueLayerStyle3D; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3D.java index 47ea14b8e..aeaa674b1 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3D.java @@ -6,14 +6,14 @@ import java.util.Iterator; import java.util.Map; -import javax.media.j3d.BranchGroup; -import javax.media.j3d.Group; -import javax.media.j3d.Node; -import javax.media.j3d.Shape3D; -import javax.media.j3d.TransformGroup; -import javax.vecmath.AxisAngle4f; -import javax.vecmath.Color3f; -import javax.vecmath.Point3f; +import org.jogamp.java3d.BranchGroup; +import org.jogamp.java3d.Group; +import org.jogamp.java3d.Node; +import org.jogamp.java3d.Shape3D; +import org.jogamp.java3d.TransformGroup; +import org.jogamp.vecmath.AxisAngle4f; +import org.jogamp.vecmath.Color3f; +import org.jogamp.vecmath.Point3f; import repast.simphony.visualization.Layout; import repast.simphony.visualization.editedStyle.EditedStyleData; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3DAdderRemover.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3DAdderRemover.java index 7664ea64a..b3f56955f 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3DAdderRemover.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/VisualItem3DAdderRemover.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.visualization3D; -import javax.media.j3d.BranchGroup; +import org.jogamp.java3d.BranchGroup; import java.util.HashSet; import java.util.Set; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/FR3DLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/FR3DLayout.java index 1ab733fe1..a829e7e93 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/FR3DLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/FR3DLayout.java @@ -5,7 +5,7 @@ import java.util.HashSet; import java.util.Iterator; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.Vector3f; import repast.simphony.space.graph.Network; import repast.simphony.space.graph.RepastEdge; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/GEM3DLayout.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/GEM3DLayout.java index 69bea8b41..31371a956 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/GEM3DLayout.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/GEM3DLayout.java @@ -3,8 +3,8 @@ import java.util.Iterator; import java.util.Map; -import javax.vecmath.Point3f; -import javax.vecmath.Vector3f; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3f; import javolution.util.FastMap; import repast.simphony.random.RandomHelper; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/JungRandomVertexLocationDecorator.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/JungRandomVertexLocationDecorator.java index 8af6df371..8865ba65c 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/JungRandomVertexLocationDecorator.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/layout/JungRandomVertexLocationDecorator.java @@ -14,7 +14,7 @@ import java.util.Iterator; import java.util.Map; -import javax.vecmath.Point3d; +import org.jogamp.vecmath.Point3d; import cern.jet.random.engine.DRand; import cern.jet.random.engine.RandomEngine; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultEdgeStyle3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultEdgeStyle3D.java index 6cbbaf33e..c43ccc8db 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultEdgeStyle3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultEdgeStyle3D.java @@ -3,7 +3,7 @@ import java.awt.Color; import java.awt.Font; -import javax.media.j3d.Shape3D; +import org.jogamp.java3d.Shape3D; import repast.simphony.visualization.visualization3D.AppearanceFactory; import repast.simphony.visualization.visualization3D.ShapeFactory; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultStyle3D.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultStyle3D.java index 3921c6fa2..5271ff83d 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultStyle3D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/DefaultStyle3D.java @@ -3,7 +3,7 @@ import java.awt.Color; import java.awt.Font; -import javax.media.j3d.Shape3D; +import org.jogamp.java3d.Shape3D; import repast.simphony.visualization.visualization3D.AppearanceFactory; import repast.simphony.visualization.visualization3D.ShapeFactory; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedAppearance.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedAppearance.java index 0c815adb0..66d267d65 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedAppearance.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedAppearance.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.visualization3D.style; -import javax.media.j3d.Appearance; +import org.jogamp.java3d.Appearance; import repast.simphony.visualization.visualization3D.AppearanceFactory; diff --git a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedBranchGroup.java b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedBranchGroup.java index 567ef701e..962437cff 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedBranchGroup.java +++ b/repast.simphony.visualization/src/repast/simphony/visualization/visualization3D/style/TaggedBranchGroup.java @@ -1,6 +1,6 @@ package repast.simphony.visualization.visualization3D.style; -import javax.media.j3d.BranchGroup; +import org.jogamp.java3d.BranchGroup; /** * @author Nick Collier diff --git a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/ColorMapStyleAdapter.java b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/ColorMapStyleAdapter.java index 1c8fd1b24..ebe60650c 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/ColorMapStyleAdapter.java +++ b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/ColorMapStyleAdapter.java @@ -5,9 +5,10 @@ import java.awt.Color; -import javax.vecmath.Color3f; +import org.jogamp.vecmath.Color3f; import saf.v3d.grid.GridColorMap; +import saf.v3d.util.Utils3D; /** * Adapts a ValueLayerStyle to a saf uil grid color map. @@ -37,6 +38,6 @@ public void getColor(int x, int y, Color3f color) { int tx = x - origin[0]; int ty = y - origin[1]; Color c = style.getColor(tx, ty); - color.set(c); + Utils3D.updateColor(color, c); } } diff --git a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/DisplayOGL2D.java b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/DisplayOGL2D.java index 06410805e..d70fd5577 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/DisplayOGL2D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/DisplayOGL2D.java @@ -16,12 +16,12 @@ import java.util.Map; import java.util.concurrent.locks.Lock; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLAutoDrawable; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.vecmath.Point3f; +import org.jogamp.vecmath.Point3f; import org.apache.commons.lang3.SystemUtils; @@ -55,584 +55,575 @@ * * @author Nick Collier */ -public class DisplayOGL2D extends AbstractDisplay implements CanvasListener, PickListener, - ChangeListener { - - static { - // this seems to fix jogl canvas flicker issues on windows - System.setProperty("sun.awt.noerasebackground", "true"); - } - - protected Runnable updater = new Runnable() { - public void run() { - canvas.update(); - } - }; - - protected JPanel panel; - protected Layout layout; - protected Canvas2D canvas; - protected DisplayData displayData; - - protected Map, StyledDisplayLayerOGL2D> classStyleMap = new HashMap, StyledDisplayLayerOGL2D>(); - protected Map, NetworkLayerOGL2D> networkStyleMap = new HashMap, NetworkLayerOGL2D>(); - protected Map valueLayerStyleMap = new HashMap(); - protected Map> decoratorMap = new HashMap>(); - protected LayoutUpdater layoutUpdater; - protected boolean doRender = false, glInitialized = false, iconified = false; - protected JTabbedPane tabParent = null; - protected Component tabChild = null; - - protected VLayer decoratorLayer = new VLayer(); - - public DisplayOGL2D(DisplayData data, Layout layout) { - this.layout = layout; - - try { - canvas = new Canvas2D(); - } catch (Exception ex) { - // could get here if jogl is not installed - MessageCenter.getMessageCenter(getClass()).error( - "Error initializing OGL 2D display. " - + "JOGL must be installed and computer must support open gl rendering", ex); - } - - Box box = layout.getBoundingBox(); - if (box.getWidth() > 0) { - canvas.setDefaultExtent(box.getWidth(), box.getHeight()); - } - - canvas.addCanvasListener(this); - canvas.addPickListener(this); - canvas.getRoot().addChild(decoratorLayer); - displayData = data; - layoutUpdater = new UpdateLayoutUpdater(layout); - } - - /** - * Gets the lock used to synchronize between update thread and display thread. - * - * @return the lock used to synchronize between update thread and display - * thread. - */ - Lock getRenderLock() { - return canvas.getRenderLock(); - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.visualization.IDisplay#init() - */ - public void init() { - boolean decoAdded = false; - for (Projection proj : displayData.getProjections()) { - proj.addProjectionListener(this); - ProjectionDecorator2D deco = decoratorMap.get(proj.getName()); - if (deco != null) { - deco.init(this, decoratorLayer); - decoAdded = true; - } - } - if (!decoAdded) - canvas.getRoot().removeChild(decoratorLayer); - - for (Object obj : displayData.objects()) { - addObject(obj); - } - } - - /** - * Sets the background color of this display. - * - * @param color - * the new background color - */ - public void setBackgroundColor(Color color) { - canvas.setBackgroundColor(color); - } - - /** - * Gets the background color of this display. - * - * @return the background color. - */ - public Color getBackgroundColor() { - return canvas.getBackgroundColor(); - } - - /* - * (non-Javadoc) - * - * @see - * repast.simphony.visualization.AbstractDisplay#moveObject(java.lang.Object) - */ - @Override - protected void moveObject(Object o) { - layoutUpdater.addTriggerCondition(LayoutUpdater.Condition.MOVED); - } - - /* - * (non-Javadoc) - * - * @see - * repast.simphony.visualization.AbstractDisplay#addObject(java.lang.Object) - */ - @Override - protected void addObject(Object o) { - StyledDisplayLayerOGL2D layer = findLayer(o); - if (layer != null) { - Lock lock = canvas.getRenderLock(); - try { - lock.lock(); - layer.addObject(o); - layoutUpdater.addTriggerCondition(LayoutUpdater.Condition.ADDED); - } finally { - lock.unlock(); - } - } - } - - /* - * (non-Javadoc) - * - * @see - * repast.simphony.visualization.AbstractDisplay#removeObject(java.lang.Object - * ) - */ - @Override - protected void removeObject(Object o) { - StyledDisplayLayerOGL2D layer = findLayer(o); - if (layer != null) { - Lock lock = canvas.getRenderLock(); - try { - lock.lock(); - layer.removeObject(o); - layoutUpdater.addTriggerCondition(LayoutUpdater.Condition.REMOVED); - } finally { - lock.unlock(); - } - } - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.visualization.IDisplay#closed() - */ - public void closed() { - - } - - /* - * (non-Javadoc) - * - * @see - * repast.simphony.visualization.IDisplay#createEditor(javax.swing.JPanel) - */ - public DisplayEditorLifecycle createEditor(JPanel panel) { - return null; - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.visualization.IDisplay#deIconified() - */ - public void deIconified() { - iconified = false; - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.visualization.IDisplay#iconified() - */ - public void iconified() { - iconified = true; - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.visualization.IDisplay#resetHomeView() - */ - public void resetHomeView() { - canvas.resetCamera(); - canvas.centerScene(); - ThreadUtilities.runInEventThread(updater); - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.visualization.IDisplay#getLayout() - */ - public Layout getLayout() { - return layout; - } - - public JPanel getPanel() { - if (panel == null) { - createPanel(); - } - - return panel; - } - - public void createPanel() { - JPanel cpanel = canvas.getPanel(); - panel = new ImageablePanel(new BorderLayout()); - panel.add(cpanel, BorderLayout.CENTER); - - cpanel.addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { - if (glInitialized) { - if (isVisible()) { - // canvas.centerSceneKeepScale(); - canvas.update(); - } - } - } - }); - - cpanel.addPropertyChangeListener("ancestor", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Component child = canvas.getPanel(); - Component parent = child.getParent(); - while (parent != null) { - if (parent instanceof JTabbedPane) { - // if (tabParent != null) - // tabParent.removeChangeListener(DisplayOGL2D.this); - tabParent = (JTabbedPane) parent; - // tabParent.addChangeListener(DisplayOGL2D.this); - tabChild = child; - return; - } - child = parent; - parent = parent.getParent(); - } - - // if (tabParent != null) - // tabParent.removeChangeListener(DisplayOGL2D.this); - tabParent = null; - tabChild = null; - } - }); - } - - public void stateChanged(ChangeEvent evt) { - // System.out.println("tab state changed"); - // this moved to top tab - if (tabParent.getSelectedComponent().equals(tabChild)) { - // System.out.println("updating scene"); - canvas.centerScene(); - canvas.update(); - } - } - - private boolean isVisible() { - if (iconified) - return false; - if (tabParent != null) - return tabParent.getSelectedComponent().equals(tabChild); - - return true; - } - - /* - * (non-Javadoc) - * - * @see - * repast.simphony.visualization.IDisplay#setLayout(repast.simphony.visualization - * .Layout) - */ - public void setLayout(Layout layout) { - this.layout = layout; - layoutUpdater.setLayout(layout); - } - - /* - * (non-Javadoc) - * - * @see - * repast.simphony.visualization.IDisplay#setLayoutFrequency(repast.simphony - * .visualization.IDisplay.LayoutFrequency, int) - */ - public void setLayoutFrequency(LayoutFrequency frequency, int interval) { - if (frequency == LayoutFrequency.AT_UPDATE) { - layoutUpdater = new UpdateLayoutUpdater(layout); - - } else if (frequency == LayoutFrequency.AT_INTERVAL) { - layoutUpdater = new IntervalLayoutUpdater(layout, interval); - - } else if (frequency == LayoutFrequency.ON_NEW) { - layoutUpdater = new AddedRemovedLayoutUpdater(layout); - } else if (frequency == LayoutFrequency.ON_MOVE) { - layoutUpdater = new MovedLayoutUpdater(layout); - } - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.render.Renderer#setPause(boolean) - */ - public void setPause(boolean pause) { - if (pause) { - update(); - render(); - } - ThreadUtilities.runInEventThread(updater); - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.visualization.IDisplay#update() - */ - public void update() { - if (glInitialized && !iconified) { - layoutUpdater.update(); - try { - canvas.getRenderLock().lock(); - - for (ValueLayerDisplayLayer layer : valueLayerStyleMap.values()) { - layer.update(); - } - - for (StyledDisplayLayerOGL2D layer : classStyleMap.values()) { - layer.update(layoutUpdater); - } - - for (NetworkLayerOGL2D layer : networkStyleMap.values()) { - layer.update(layoutUpdater); - } - doRender = true; - } finally { - canvas.getRenderLock().unlock(); - } - } - } - - /* - * (non-Javadoc) - * - * @see repast.simphony.render.Renderer#render() - */ - public void render() { - long ts = System.currentTimeMillis(); - if (doRender && !iconified) { - if (ts - lastRenderTS > FRAME_UPDATE_INTERVAL) { - ThreadUtilities.runInEventThread(updater); - lastRenderTS = ts; - } - doRender = false; - } - } - - public void registerDecorator(ProjectionDecorator2D decorator) { - decoratorMap.put(decorator.getProjection().getName(), decorator); - } - - /** - * Finds the layer associated with this object. This will return the layer - * explicitly associated with the object. If that is not found then this will - * return the first layer associated with the objects parent classes or - * interface. - * - * @param obj - * the object to find the layer for - * - * @return the layer that best matches the object - */ - protected StyledDisplayLayerOGL2D findLayer(Object obj) { - Class objClass = obj.getClass(); - StyledDisplayLayerOGL2D layer = classStyleMap.get(objClass); - if (layer == null) { - // find a parent class or interface - for (Class clazz : classStyleMap.keySet()) { - if (clazz.isAssignableFrom(objClass)) { - layer = classStyleMap.get(clazz); - break; - } - } - } - return layer; - } - - /** - * Register the specified style for the specified class. All objects of that - * class will be styled using that style. - * - * @param clazz - * the class to register the style for - * @param style - * the style to register - */ - public void registerStyle(Class clazz, StyleOGL2D style) { - style.init(canvas.getShapeFactory()); - StyledDisplayLayerOGL2D layer = classStyleMap.get(clazz); - if (layer == null) { - VLayer vLayer = new VLayer(); - canvas.getRoot().addChild(vLayer); - layer = new StyledDisplayLayerOGL2D(style, vLayer); - classStyleMap.put(clazz, layer); - } else { - layer.setStyle(style); - } - } - - /** - * Registers the specified style for the specified network. - * - * @param network - * the network - * @param style - */ - public void registerNetworkStyle(Network network, EdgeStyleOGL2D style) { - NetworkLayerOGL2D layer = networkStyleMap.get(network); - if (layer == null) { - VLayer vLayer = new VLayer(); - canvas.getRoot().addChild(vLayer); - layer = new NetworkLayerOGL2D(network, style, vLayer, this); - networkStyleMap.put(network, layer); - } else { - layer.setStyle(style); - } - } - - /** - * Registers the specified style and layer for display. - * - * @param style - * the styling info for displaying the layer - * @param layer - * the layer to display - */ - public void registerValueLayerStyle(ValueLayer layer, ValueLayerStyleOGL style) { - ValueLayerDisplayLayer vdLayer = valueLayerStyleMap.get(layer); - if (vdLayer == null) { - VLayer vLayer = new VLayer(); - canvas.getRoot().addChild(vLayer); - vdLayer = new ValueLayerDisplayLayer(layer, style, vLayer); - valueLayerStyleMap.put(layer, vdLayer); - } else { - vdLayer.resetLayer(layer, style); - } - } - - /** - * Gets the visual item that represents the specified object in the display. - * This does NOT look for spatials representing RepastEdge objects. - * - * @return the visual item that represents the specified object in the - * display, or null the VSpatial cannot be found. - */ - VSpatial getSpatialForObject(Object obj) { - StyledDisplayLayerOGL2D layer = findLayer(obj); - return layer.getVisualItem(obj); - } - - public void destroy() { - super.destroy(); - canvas.dispose(); - for (Projection proj : displayData.getProjections()) { - proj.removeProjectionListener(this); - } - displayData = null; - } - - // PickListener implementation - /* - * (non-Javadoc) - * - * @see saf.v3d.picking.PickListener#pickPerformed(saf.v3d.picking.PickEvent) - */ - public void pickPerformed(PickEvent evt) { - List probedObjects = new ArrayList(); - for (VSpatial spatial : evt.getPicked()) { - Object obj = spatial.getProperty(AbstractDisplayLayerOGL2D.MODEL_OBJECT_KEY); - if (obj != null) { - // check if is a value layer probe which needs additional processing - if (spatial.getProperty(ValueLayerDisplayLayer.VALUE_LAYER_KEY) != null) { - obj = ((ValueLayerDisplayLayer) spatial - .getProperty(ValueLayerDisplayLayer.VALUE_LAYER_KEY)).getProbedObject(); - } - probedObjects.add(obj); - } - } - - probeSupport.fireProbeEvent(this, probedObjects); - } - - // CanvasListener implementation - - /* - * (non-Javadoc) - * - * @see saf.ui.v3d.CanvasListener#init(javax.media.opengl.GLAutoDrawable, - * saf.ui.v3d.VNode) - */ - public void init(GLAutoDrawable drawable, VRoot root) { - } - - /* - * (non-Javadoc) - * - * @see saf.ui.v3d.CanvasListener#reshape(javax.media.opengl.GLAutoDrawable, - * float, float, saf.ui.v3d.VNode) - */ - public void reshape(GLAutoDrawable drawable, float width, float height, VRoot root) { - glInitialized = true; - update(); - // System.out.printf("width: %f, height: %f%n", width, height); - } - - /* - * (non-Javadoc) - * - * @see saf.ui.v3d.CanvasListener#vSpatialMoved(saf.ui.v3d.VSpatial, - * javax.vecmath.Point3f) - */ - public void vSpatialMoved(VSpatial spatial, Point3f localTrans) { - } - - /* - * (non-Javadoc) - * - * @see saf.ui.v3d.CanvasListener#dispose(javax.media.opengl.GLAutoDrawable) - */ - public void dispose(GLAutoDrawable drawable) { - } - - @SuppressWarnings("serial") - class ImageablePanel extends JPanel implements Imageable { - - public ImageablePanel(LayoutManager layout) { - super(layout); - } - - public BufferedImage getImage() { - try { - getRenderLock().lock(); - if (SystemUtils.IS_OS_WINDOWS) { - return canvas.createImage(); - } else { - BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); - Graphics2D g = bi.createGraphics(); - paint(g); - g.dispose(); - return bi; - } - } finally { - getRenderLock().unlock(); - } - } - } - - public Canvas2D getCanvas(){ - return canvas; - } +public class DisplayOGL2D extends AbstractDisplay implements CanvasListener, PickListener, ChangeListener { + + static { + // this seems to fix jogl canvas flicker issues on windows + System.setProperty("sun.awt.noerasebackground", "true"); + } + + protected Runnable updater = new Runnable() { + public void run() { + canvas.update(); + } + }; + + protected JPanel panel; + protected Layout layout; + protected Canvas2D canvas; + protected DisplayData displayData; + + protected Map, StyledDisplayLayerOGL2D> classStyleMap = new HashMap, StyledDisplayLayerOGL2D>(); + protected Map, NetworkLayerOGL2D> networkStyleMap = new HashMap, NetworkLayerOGL2D>(); + protected Map valueLayerStyleMap = new HashMap(); + protected Map> decoratorMap = new HashMap>(); + protected LayoutUpdater layoutUpdater; + protected boolean doRender = false, glInitialized = false, iconified = false; + protected JTabbedPane tabParent = null; + protected Component tabChild = null; + + protected VLayer decoratorLayer = new VLayer(); + + public DisplayOGL2D(DisplayData data, Layout layout) { + this.layout = layout; + + try { + canvas = new Canvas2D(); + } catch (Exception ex) { + // could get here if jogl is not installed + MessageCenter.getMessageCenter(getClass()).error("Error initializing OGL 2D display. " + + "JOGL must be installed and computer must support open gl rendering", ex); + } + + Box box = layout.getBoundingBox(); + if (box.getWidth() > 0) { + canvas.setDefaultExtent(box.getWidth(), box.getHeight()); + } + + canvas.addCanvasListener(this); + canvas.addPickListener(this); + canvas.getRoot().addChild(decoratorLayer); + displayData = data; + layoutUpdater = new UpdateLayoutUpdater(layout); + } + + /** + * Gets the lock used to synchronize between update thread and display thread. + * + * @return the lock used to synchronize between update thread and display + * thread. + */ + Lock getRenderLock() { + return canvas.getRenderLock(); + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#init() + */ + public void init() { + boolean decoAdded = false; + for (Projection proj : displayData.getProjections()) { + proj.addProjectionListener(this); + ProjectionDecorator2D deco = decoratorMap.get(proj.getName()); + if (deco != null) { + deco.init(this, decoratorLayer); + decoAdded = true; + } + } + if (!decoAdded) + canvas.getRoot().removeChild(decoratorLayer); + + for (Object obj : displayData.objects()) { + addObject(obj); + } + } + + /** + * Sets the background color of this display. + * + * @param color the new background color + */ + public void setBackgroundColor(Color color) { + canvas.setBackgroundColor(color); + } + + /** + * Gets the background color of this display. + * + * @return the background color. + */ + public Color getBackgroundColor() { + return canvas.getBackgroundColor(); + } + + /* + * (non-Javadoc) + * + * @see + * repast.simphony.visualization.AbstractDisplay#moveObject(java.lang.Object) + */ + @Override + protected void moveObject(Object o) { + layoutUpdater.addTriggerCondition(LayoutUpdater.Condition.MOVED); + } + + /* + * (non-Javadoc) + * + * @see + * repast.simphony.visualization.AbstractDisplay#addObject(java.lang.Object) + */ + @Override + protected void addObject(Object o) { + StyledDisplayLayerOGL2D layer = findLayer(o); + if (layer != null) { + Lock lock = canvas.getRenderLock(); + try { + lock.lock(); + layer.addObject(o); + layoutUpdater.addTriggerCondition(LayoutUpdater.Condition.ADDED); + } finally { + lock.unlock(); + } + } + } + + /* + * (non-Javadoc) + * + * @see + * repast.simphony.visualization.AbstractDisplay#removeObject(java.lang.Object ) + */ + @Override + protected void removeObject(Object o) { + StyledDisplayLayerOGL2D layer = findLayer(o); + if (layer != null) { + Lock lock = canvas.getRenderLock(); + try { + lock.lock(); + layer.removeObject(o); + layoutUpdater.addTriggerCondition(LayoutUpdater.Condition.REMOVED); + } finally { + lock.unlock(); + } + } + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#closed() + */ + public void closed() { + + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#createEditor(javax.swing.JPanel) + */ + public DisplayEditorLifecycle createEditor(JPanel panel) { + return null; + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#deIconified() + */ + public void deIconified() { + iconified = false; + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#iconified() + */ + public void iconified() { + iconified = true; + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#resetHomeView() + */ + public void resetHomeView() { + canvas.resetCamera(); + canvas.centerScene(); + ThreadUtilities.runInEventThread(updater); + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#getLayout() + */ + public Layout getLayout() { + return layout; + } + + public JPanel getPanel() { + if (panel == null) { + createPanel(); + } + + return panel; + } + + public void createPanel() { + JPanel cpanel = canvas.getPanel(); + panel = new ImageablePanel(new BorderLayout()); + panel.add(cpanel, BorderLayout.CENTER); + + cpanel.addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + if (glInitialized) { + if (isVisible()) { + // canvas.centerSceneKeepScale(); + int w = e.getComponent().getWidth(); + int h = e.getComponent().getHeight(); + canvas.setSize(w, h); + canvas.update(); + } + } + } + }); + + cpanel.addPropertyChangeListener("ancestor", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + Component child = canvas.getPanel(); + Component parent = child.getParent(); + while (parent != null) { + if (parent instanceof JTabbedPane) { + // if (tabParent != null) + // tabParent.removeChangeListener(DisplayOGL2D.this); + tabParent = (JTabbedPane) parent; + // tabParent.addChangeListener(DisplayOGL2D.this); + tabChild = child; + return; + } + child = parent; + parent = parent.getParent(); + } + + // if (tabParent != null) + // tabParent.removeChangeListener(DisplayOGL2D.this); + tabParent = null; + tabChild = null; + } + }); + } + + public void stateChanged(ChangeEvent evt) { + // System.out.println("tab state changed"); + // this moved to top tab + if (tabParent.getSelectedComponent().equals(tabChild)) { + // System.out.println("updating scene"); + canvas.centerScene(); + canvas.update(); + } + } + + private boolean isVisible() { + if (iconified) + return false; + if (tabParent != null) + return tabParent.getSelectedComponent().equals(tabChild); + + return true; + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#setLayout(repast.simphony. + * visualization .Layout) + */ + public void setLayout(Layout layout) { + this.layout = layout; + layoutUpdater.setLayout(layout); + } + + /* + * (non-Javadoc) + * + * @see + * repast.simphony.visualization.IDisplay#setLayoutFrequency(repast.simphony + * .visualization.IDisplay.LayoutFrequency, int) + */ + public void setLayoutFrequency(LayoutFrequency frequency, int interval) { + if (frequency == LayoutFrequency.AT_UPDATE) { + layoutUpdater = new UpdateLayoutUpdater(layout); + + } else if (frequency == LayoutFrequency.AT_INTERVAL) { + layoutUpdater = new IntervalLayoutUpdater(layout, interval); + + } else if (frequency == LayoutFrequency.ON_NEW) { + layoutUpdater = new AddedRemovedLayoutUpdater(layout); + } else if (frequency == LayoutFrequency.ON_MOVE) { + layoutUpdater = new MovedLayoutUpdater(layout); + } + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.render.Renderer#setPause(boolean) + */ + public void setPause(boolean pause) { + if (pause) { + update(); + render(); + } + ThreadUtilities.runInEventThread(updater); + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.visualization.IDisplay#update() + */ + public void update() { + if (glInitialized && !iconified) { + layoutUpdater.update(); + try { + canvas.getRenderLock().lock(); + + for (ValueLayerDisplayLayer layer : valueLayerStyleMap.values()) { + layer.update(); + } + + for (StyledDisplayLayerOGL2D layer : classStyleMap.values()) { + layer.update(layoutUpdater); + } + + for (NetworkLayerOGL2D layer : networkStyleMap.values()) { + layer.update(layoutUpdater); + } + doRender = true; + } finally { + canvas.getRenderLock().unlock(); + } + } + } + + /* + * (non-Javadoc) + * + * @see repast.simphony.render.Renderer#render() + */ + public void render() { + long ts = System.currentTimeMillis(); + if (doRender && !iconified) { + if (ts - lastRenderTS > FRAME_UPDATE_INTERVAL) { + ThreadUtilities.runInEventThread(updater); + lastRenderTS = ts; + } + doRender = false; + } + } + + public void registerDecorator(ProjectionDecorator2D decorator) { + decoratorMap.put(decorator.getProjection().getName(), decorator); + } + + /** + * Finds the layer associated with this object. This will return the layer + * explicitly associated with the object. If that is not found then this will + * return the first layer associated with the objects parent classes or + * interface. + * + * @param obj the object to find the layer for + * + * @return the layer that best matches the object + */ + protected StyledDisplayLayerOGL2D findLayer(Object obj) { + Class objClass = obj.getClass(); + StyledDisplayLayerOGL2D layer = classStyleMap.get(objClass); + if (layer == null) { + // find a parent class or interface + for (Class clazz : classStyleMap.keySet()) { + if (clazz.isAssignableFrom(objClass)) { + layer = classStyleMap.get(clazz); + break; + } + } + } + return layer; + } + + /** + * Register the specified style for the specified class. All objects of that + * class will be styled using that style. + * + * @param clazz the class to register the style for + * @param style the style to register + */ + public void registerStyle(Class clazz, StyleOGL2D style) { + style.init(canvas.getShapeFactory()); + StyledDisplayLayerOGL2D layer = classStyleMap.get(clazz); + if (layer == null) { + VLayer vLayer = new VLayer(); + canvas.getRoot().addChild(vLayer); + layer = new StyledDisplayLayerOGL2D(style, vLayer); + classStyleMap.put(clazz, layer); + } else { + layer.setStyle(style); + } + } + + /** + * Registers the specified style for the specified network. + * + * @param network the network + * @param style + */ + public void registerNetworkStyle(Network network, EdgeStyleOGL2D style) { + NetworkLayerOGL2D layer = networkStyleMap.get(network); + if (layer == null) { + VLayer vLayer = new VLayer(); + canvas.getRoot().addChild(vLayer); + layer = new NetworkLayerOGL2D(network, style, vLayer, this); + networkStyleMap.put(network, layer); + } else { + layer.setStyle(style); + } + } + + /** + * Registers the specified style and layer for display. + * + * @param style the styling info for displaying the layer + * @param layer the layer to display + */ + public void registerValueLayerStyle(ValueLayer layer, ValueLayerStyleOGL style) { + ValueLayerDisplayLayer vdLayer = valueLayerStyleMap.get(layer); + if (vdLayer == null) { + VLayer vLayer = new VLayer(); + canvas.getRoot().addChild(vLayer); + vdLayer = new ValueLayerDisplayLayer(layer, style, vLayer); + valueLayerStyleMap.put(layer, vdLayer); + } else { + vdLayer.resetLayer(layer, style); + } + } + + /** + * Gets the visual item that represents the specified object in the display. + * This does NOT look for spatials representing RepastEdge objects. + * + * @return the visual item that represents the specified object in the display, + * or null the VSpatial cannot be found. + */ + VSpatial getSpatialForObject(Object obj) { + StyledDisplayLayerOGL2D layer = findLayer(obj); + return layer.getVisualItem(obj); + } + + public void destroy() { + super.destroy(); + canvas.dispose(); + for (Projection proj : displayData.getProjections()) { + proj.removeProjectionListener(this); + } + displayData = null; + } + + // PickListener implementation + /* + * (non-Javadoc) + * + * @see saf.v3d.picking.PickListener#pickPerformed(saf.v3d.picking.PickEvent) + */ + public void pickPerformed(PickEvent evt) { + List probedObjects = new ArrayList(); + for (VSpatial spatial : evt.getPicked()) { + Object obj = spatial.getProperty(AbstractDisplayLayerOGL2D.MODEL_OBJECT_KEY); + if (obj != null) { + // check if is a value layer probe which needs additional processing + if (spatial.getProperty(ValueLayerDisplayLayer.VALUE_LAYER_KEY) != null) { + obj = ((ValueLayerDisplayLayer) spatial.getProperty(ValueLayerDisplayLayer.VALUE_LAYER_KEY)) + .getProbedObject(); + } + probedObjects.add(obj); + } + } + + probeSupport.fireProbeEvent(this, probedObjects); + } + + // CanvasListener implementation + + /* + * (non-Javadoc) + * + * @see saf.ui.v3d.CanvasListener#init(com.jogamp.opengl.GLAutoDrawable, + * saf.ui.v3d.VNode) + */ + public void init(GLAutoDrawable drawable, VRoot root) { + } + + /* + * (non-Javadoc) + * + * @see saf.ui.v3d.CanvasListener#reshape(com.jogamp.opengl.GLAutoDrawable, + * float, float, saf.ui.v3d.VNode) + */ + public void reshape(GLAutoDrawable drawable, float width, float height, VRoot root) { + glInitialized = true; + update(); + // System.out.printf("width: %f, height: %f%n", width, height); + } + + /* + * (non-Javadoc) + * + * @see saf.ui.v3d.CanvasListener#vSpatialMoved(saf.ui.v3d.VSpatial, + * org.jogamp.vecmath.Point3f) + */ + public void vSpatialMoved(VSpatial spatial, Point3f localTrans) { + } + + /* + * (non-Javadoc) + * + * @see saf.ui.v3d.CanvasListener#dispose(com.jogamp.opengl.GLAutoDrawable) + */ + public void dispose(GLAutoDrawable drawable) { + } + + @SuppressWarnings("serial") + class ImageablePanel extends JPanel implements Imageable { + + public ImageablePanel(LayoutManager layout) { + super(layout); + } + + public BufferedImage getImage() { + try { + getRenderLock().lock(); + if (SystemUtils.IS_OS_WINDOWS) { + return canvas.createImage(); + } else { + BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); + Graphics2D g = bi.createGraphics(); + paint(g); + g.dispose(); + return bi; + } + } finally { + getRenderLock().unlock(); + } + } + } + + public Canvas2D getCanvas() { + return canvas; + } } diff --git a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/NetworkLayerOGL2D.java b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/NetworkLayerOGL2D.java index b50574775..d1cb516d5 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/NetworkLayerOGL2D.java +++ b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/NetworkLayerOGL2D.java @@ -102,6 +102,17 @@ public void update(LayoutUpdater updater) { RepastEdge rEdge = (RepastEdge) obj; VSpatial source = display.getSpatialForObject(rEdge.getSource()); VSpatial target = display.getSpatialForObject(rEdge.getTarget()); + + if (source == null) { + System.out.println("NULL SOURCE: " + rEdge.getSource().hashCode()); + System.exit(0); + } + + if (target == null) { + System.out.println("NULL TARGET: " + rEdge.getTarget().hashCode()); + System.exit(0); + } + VEdge2D edge = new VEdge2D(source, target, isDirected); edge.putProperty(MODEL_OBJECT_KEY, obj); objMap.put(rEdge, edge); diff --git a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/SpatialWrapper.java b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/SpatialWrapper.java index 2c6cf42ed..a76ce4d00 100644 --- a/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/SpatialWrapper.java +++ b/repast.simphony.visualization/src/repast/simphony/visualizationOGL2D/SpatialWrapper.java @@ -5,10 +5,10 @@ import java.util.ArrayList; -import javax.media.opengl.GL2; -import javax.vecmath.Point3f; -import javax.vecmath.Quat4f; -import javax.vecmath.Vector3f; +import com.jogamp.opengl.GL2; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Quat4f; +import org.jogamp.vecmath.Vector3f; import saf.v3d.picking.Accumulator; import saf.v3d.picking.BoundingSphere; @@ -53,7 +53,7 @@ public Texture2D getTextureData() { /* * (non-Javadoc) * - * @see saf.v3d.scene.VSpatial#transform(javax.vecmath.Point3f) + * @see saf.v3d.scene.VSpatial#transform(org.jogamp.vecmath.Point3f) */ @Override public Point3f transform(Point3f pt) { @@ -87,7 +87,7 @@ public float getLocalScale() { /* * (non-Javadoc) * - * @see saf.v3d.scene.VSpatial#draw(javax.media.opengl.GL, + * @see saf.v3d.scene.VSpatial#draw(com.jogamp.opengl.GL, * saf.v3d.render.RenderState) */ @Override @@ -134,7 +134,7 @@ public BoundingSphere getLocalBoundingSphere() { * (non-Javadoc) * * @see - * anl.mifs.viz3d.VSpatial#intersects(javax.vecmath.Point3f,anl.mifs.viz3d + * anl.mifs.viz3d.VSpatial#intersects(org.jogamp.vecmath.Point3f,anl.mifs.viz3d * .Accumulator) */ @Override @@ -155,8 +155,8 @@ public void intersects(Point3f point, Accumulator accumulator) { /* * (non-Javadoc) * - * @see anl.mifs.viz3d.VSpatial#intersects(javax.vecmath.Point3f, - * javax.vecmath.Vector3f, anl.mifs.viz3d.Accumulator) + * @see anl.mifs.viz3d.VSpatial#intersects(org.jogamp.vecmath.Point3f, + * org.jogamp.vecmath.Vector3f, anl.mifs.viz3d.Accumulator) */ @Override public void intersects(Point3f rayOrigin, Vector3f rayDirection, Accumulator accumulator) { diff --git a/repast.simphony.weka/META-INF/MANIFEST.MF b/repast.simphony.weka/META-INF/MANIFEST.MF index 9862e93e4..c06237e6f 100644 --- a/repast.simphony.weka/META-INF/MANIFEST.MF +++ b/repast.simphony.weka/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Repast weka Bundle-SymbolicName: repast.simphony.weka -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Require-Bundle: repast.simphony.gui, repast.simphony.data, repast.simphony.core, diff --git a/repast.simphony.weka/licenses/repast-license.txt b/repast.simphony.weka/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/repast.simphony.weka/licenses/repast-license.txt +++ b/repast.simphony.weka/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/repast.simphony.weka/plugin_jpf.xml b/repast.simphony.weka/plugin_jpf.xml index 7113612ae..d39ff5a74 100644 --- a/repast.simphony.weka/plugin_jpf.xml +++ b/repast.simphony.weka/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/saf.core.ui/.classpath b/saf.core.ui/.classpath index ebaf7a3ec..4284173e1 100644 --- a/saf.core.ui/.classpath +++ b/saf.core.ui/.classpath @@ -12,7 +12,7 @@ - + diff --git a/saf.core.ui/META-INF/MANIFEST.MF b/saf.core.ui/META-INF/MANIFEST.MF index 91a32eb12..44c09f07b 100644 --- a/saf.core.ui/META-INF/MANIFEST.MF +++ b/saf.core.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Saf core ui Bundle-SymbolicName: saf.core.ui -Bundle-Version: 2.7.0 +Bundle-Version: 2.8.0 Export-Package: bibliothek.extension.gui.dock, bibliothek.extension.gui.dock.preference, diff --git a/saf.core.ui/licenses/repast-license.txt b/saf.core.ui/licenses/repast-license.txt index 68041a85f..4a40aa649 100644 --- a/saf.core.ui/licenses/repast-license.txt +++ b/saf.core.ui/licenses/repast-license.txt @@ -1,6 +1,6 @@ Repast Simphony - Copyright (c) 2019 Argonne National Laboratory + Copyright (c) 2020 Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with diff --git a/saf.core.ui/plugin_jpf.xml b/saf.core.ui/plugin_jpf.xml index d10918965..6a7fee877 100644 --- a/saf.core.ui/plugin_jpf.xml +++ b/saf.core.ui/plugin_jpf.xml @@ -3,7 +3,7 @@ - + diff --git a/saf.core.ui/saf.core.v3d.jar b/saf.core.ui/saf.core.v3d.jar index a07db610e..e32432d9e 100644 Binary files a/saf.core.ui/saf.core.v3d.jar and b/saf.core.ui/saf.core.v3d.jar differ