summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-03-09 05:39:28 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-03-09 05:39:28 -0500
commit42ff123fea0f9fb8ed0c40ce2c3e21b64ff4bbf0 (patch)
tree7a3f3dcba9552aad91e627ed1e47ff93e6e616dd
parent51eefb8b38bd5aa13f7940368317c481dfe7dde4 (diff)
Clean up extensions.
Renaming, code de-duplication
-rw-r--r--extensions/ExampleSquareTrackerExtension/Square.pdf (renamed from extensions/camera/SquareTracker/Square.pdf)bin79845 -> 79845 bytes
-rw-r--r--extensions/ExampleSquareTrackerExtension/build.xml (renamed from extensions/camera/WPICameraExtension/build.xml)6
l---------extensions/ExampleSquareTrackerExtension/lib/SmartDashboard.jar1
l---------extensions/ExampleSquareTrackerExtension/lib/WPIJavaCV.jar1
l---------extensions/ExampleSquareTrackerExtension/lib/WPIJavaCVVideoExtension.jar1
l---------extensions/ExampleSquareTrackerExtension/lib/javacpp.jar1
l---------extensions/ExampleSquareTrackerExtension/lib/javacv-windows-x86.jar1
l---------extensions/ExampleSquareTrackerExtension/lib/javacv.jar1
-rw-r--r--extensions/ExampleSquareTrackerExtension/manifest.mf (renamed from extensions/camera/SquareTracker/manifest.mf)0
-rw-r--r--extensions/ExampleSquareTrackerExtension/nbproject/build-impl.xml (renamed from extensions/camera/SquareTracker/nbproject/build-impl.xml)734
-rw-r--r--extensions/ExampleSquareTrackerExtension/nbproject/genfiles.properties (renamed from extensions/camera/SquareTracker/nbproject/genfiles.properties)0
-rw-r--r--extensions/ExampleSquareTrackerExtension/nbproject/private/config.properties (renamed from extensions/camera/SquareTracker/nbproject/private/config.properties)0
-rw-r--r--extensions/ExampleSquareTrackerExtension/nbproject/private/private.properties (renamed from extensions/camera/SquareTracker/nbproject/private/private.properties)0
-rw-r--r--extensions/ExampleSquareTrackerExtension/nbproject/private/private.xml (renamed from extensions/camera/SquareTracker/nbproject/private/private.xml)0
-rw-r--r--extensions/ExampleSquareTrackerExtension/nbproject/project.properties (renamed from extensions/camera/SquareTracker/nbproject/project.properties)30
-rw-r--r--extensions/ExampleSquareTrackerExtension/nbproject/project.xml (renamed from extensions/camera/SquareTracker/nbproject/project.xml)2
-rw-r--r--extensions/ExampleSquareTrackerExtension/src/edu/wpi/first/smartdashboard/extensions/squaretracker/Square.pdfbin0 -> 79845 bytes
-rw-r--r--extensions/ExampleSquareTrackerExtension/src/edu/wpi/first/smartdashboard/extensions/squaretracker/SquareTrackerExtension.java (renamed from extensions/camera/SquareTracker/src/edu/wpi/first/wpilibj/examples/SquareTrackerExtension.java)15
-rw-r--r--extensions/WPIJavaCVVideoExtension/build.xml (renamed from extensions/camera/SquareTracker/build.xml)6
l---------extensions/WPIJavaCVVideoExtension/lib/SmartDashboard.jar1
l---------extensions/WPIJavaCVVideoExtension/lib/WPIJavaCV.jar1
l---------extensions/WPIJavaCVVideoExtension/lib/javacpp.jar1
l---------extensions/WPIJavaCVVideoExtension/lib/javacv-windows-x86.jar1
l---------extensions/WPIJavaCVVideoExtension/lib/javacv.jar1
-rw-r--r--extensions/WPIJavaCVVideoExtension/manifest.mf (renamed from extensions/camera/WPICameraExtension/manifest.mf)0
-rw-r--r--extensions/WPIJavaCVVideoExtension/nbproject/build-impl.xml (renamed from extensions/camera/WPICameraExtension/nbproject/build-impl.xml)10
-rw-r--r--extensions/WPIJavaCVVideoExtension/nbproject/genfiles.properties (renamed from extensions/camera/WPICameraExtension/nbproject/genfiles.properties)0
-rw-r--r--extensions/WPIJavaCVVideoExtension/nbproject/private/config.properties (renamed from extensions/camera/WPICameraExtension/nbproject/private/config.properties)0
-rw-r--r--extensions/WPIJavaCVVideoExtension/nbproject/private/private.properties (renamed from extensions/camera/WPICameraExtension/nbproject/private/private.properties)0
-rw-r--r--extensions/WPIJavaCVVideoExtension/nbproject/private/private.xml (renamed from extensions/camera/WPICameraExtension/nbproject/private/private.xml)0
-rw-r--r--extensions/WPIJavaCVVideoExtension/nbproject/project.properties (renamed from extensions/camera/WPICameraExtension/nbproject/project.properties)4
-rw-r--r--extensions/WPIJavaCVVideoExtension/nbproject/project.xml (renamed from extensions/camera/WPICameraExtension/nbproject/project.xml)2
-rw-r--r--extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/AbstractVideoExtension.java (renamed from extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/VideoStreamExtension.java)48
-rw-r--r--extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/AxisCameraExtension.java51
-rw-r--r--extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/LaptopCameraExtension.java39
-rw-r--r--extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/Video.java13
-rw-r--r--extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/VideoURLExtension.java50
-rw-r--r--extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/VideoStreamViewerExtension.java129
-rw-r--r--extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPICameraExtension.java169
-rw-r--r--extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPIFFmpegVideoViewer.java133
-rw-r--r--extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPILaptopCameraExtension.java148
41 files changed, 816 insertions, 784 deletions
diff --git a/extensions/camera/SquareTracker/Square.pdf b/extensions/ExampleSquareTrackerExtension/Square.pdf
index 23cb55e..23cb55e 100644
--- a/extensions/camera/SquareTracker/Square.pdf
+++ b/extensions/ExampleSquareTrackerExtension/Square.pdf
Binary files differ
diff --git a/extensions/camera/WPICameraExtension/build.xml b/extensions/ExampleSquareTrackerExtension/build.xml
index 5ca1581..ec4a616 100644
--- a/extensions/camera/WPICameraExtension/build.xml
+++ b/extensions/ExampleSquareTrackerExtension/build.xml
@@ -7,8 +7,8 @@
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
-<project name="WPICameraExtension" default="default" basedir=".">
- <description>Builds, tests, and runs the project WPICameraExtension.</description>
+<project name="ExampleSquareTrackerExtension" default="default" basedir=".">
+ <description>Builds, tests, and runs the project ExampleSquareTrackerExtension.</description>
<import file="nbproject/build-impl.xml"/>
<!--
@@ -59,7 +59,7 @@
An example of overriding the target for project execution could look like this:
- <target name="run" depends="WPICameraExtension-impl.jar">
+ <target name="run" depends="ExampleSquareTrackerExtension-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
diff --git a/extensions/ExampleSquareTrackerExtension/lib/SmartDashboard.jar b/extensions/ExampleSquareTrackerExtension/lib/SmartDashboard.jar
new file mode 120000
index 0000000..5e4bb39
--- /dev/null
+++ b/extensions/ExampleSquareTrackerExtension/lib/SmartDashboard.jar
@@ -0,0 +1 @@
+../../../../wpilib/tools/SmartDashboard.jar \ No newline at end of file
diff --git a/extensions/ExampleSquareTrackerExtension/lib/WPIJavaCV.jar b/extensions/ExampleSquareTrackerExtension/lib/WPIJavaCV.jar
new file mode 120000
index 0000000..8e0d6df
--- /dev/null
+++ b/extensions/ExampleSquareTrackerExtension/lib/WPIJavaCV.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/dist/WPIJavaCV.jar \ No newline at end of file
diff --git a/extensions/ExampleSquareTrackerExtension/lib/WPIJavaCVVideoExtension.jar b/extensions/ExampleSquareTrackerExtension/lib/WPIJavaCVVideoExtension.jar
new file mode 120000
index 0000000..a8bc1b6
--- /dev/null
+++ b/extensions/ExampleSquareTrackerExtension/lib/WPIJavaCVVideoExtension.jar
@@ -0,0 +1 @@
+../../WPIJavaCVVideoExtension/dist/WPIJavaCVVideoExtension.jar \ No newline at end of file
diff --git a/extensions/ExampleSquareTrackerExtension/lib/javacpp.jar b/extensions/ExampleSquareTrackerExtension/lib/javacpp.jar
new file mode 120000
index 0000000..b13cc4d
--- /dev/null
+++ b/extensions/ExampleSquareTrackerExtension/lib/javacpp.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/lib/javacpp.jar \ No newline at end of file
diff --git a/extensions/ExampleSquareTrackerExtension/lib/javacv-windows-x86.jar b/extensions/ExampleSquareTrackerExtension/lib/javacv-windows-x86.jar
new file mode 120000
index 0000000..438dd95
--- /dev/null
+++ b/extensions/ExampleSquareTrackerExtension/lib/javacv-windows-x86.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/lib/javacv-windows-x86.jar \ No newline at end of file
diff --git a/extensions/ExampleSquareTrackerExtension/lib/javacv.jar b/extensions/ExampleSquareTrackerExtension/lib/javacv.jar
new file mode 120000
index 0000000..06ad26d
--- /dev/null
+++ b/extensions/ExampleSquareTrackerExtension/lib/javacv.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/lib/javacv.jar \ No newline at end of file
diff --git a/extensions/camera/SquareTracker/manifest.mf b/extensions/ExampleSquareTrackerExtension/manifest.mf
index 1574df4..1574df4 100644
--- a/extensions/camera/SquareTracker/manifest.mf
+++ b/extensions/ExampleSquareTrackerExtension/manifest.mf
diff --git a/extensions/camera/SquareTracker/nbproject/build-impl.xml b/extensions/ExampleSquareTrackerExtension/nbproject/build-impl.xml
index 99dd2f9..5a9f0e1 100644
--- a/extensions/camera/SquareTracker/nbproject/build-impl.xml
+++ b/extensions/ExampleSquareTrackerExtension/nbproject/build-impl.xml
@@ -12,18 +12,18 @@ is divided into following sections:
- execution
- debugging
- javadoc
- - junit compilation
- - junit execution
- - junit debugging
+ - test compilation
+ - test execution
+ - test debugging
- applet
- cleanup
-->
-<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="SquareTrackerExtension-impl">
- <fail message="Please build using Ant 1.7.1 or higher.">
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="ExampleSquareTrackerExtension-impl">
+ <fail message="Please build using Ant 1.8.0 or higher.">
<condition>
<not>
- <antversion atleast="1.7.1"/>
+ <antversion atleast="1.8.0"/>
</not>
</condition>
</fail>
@@ -55,7 +55,14 @@ is divided into following sections:
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<available file="${manifest.file}" property="manifest.available"/>
- <available file="${application.splash}" property="splashscreen.available"/>
+ <condition property="splashscreen.available">
+ <and>
+ <not>
+ <equals arg1="${application.splash}" arg2="" trim="true"/>
+ </not>
+ <available file="${application.splash}"/>
+ </and>
+ </condition>
<condition property="main.class.available">
<and>
<isset property="main.class"/>
@@ -70,8 +77,14 @@ is divided into following sections:
<isset property="main.class.available"/>
</and>
</condition>
+ <condition property="do.archive">
+ <not>
+ <istrue value="${jar.archive.disabled}"/>
+ </not>
+ </condition>
<condition property="do.mkdist">
<and>
+ <isset property="do.archive"/>
<isset property="libs.CopyLibs.classpath"/>
<not>
<istrue value="${mkdist.disabled}"/>
@@ -84,41 +97,42 @@ is divided into following sections:
<isset property="do.mkdist"/>
</and>
</condition>
- <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
- <and>
- <istrue value="${manifest.available+main.class+mkdist.available}"/>
- <istrue value="${splashscreen.available}"/>
- </and>
- </condition>
- <condition property="do.archive">
- <not>
- <istrue value="${jar.archive.disabled}"/>
- </not>
- </condition>
<condition property="do.archive+manifest.available">
<and>
<isset property="manifest.available"/>
<istrue value="${do.archive}"/>
</and>
</condition>
- <condition property="do.archive+manifest.available+main.class">
+ <condition property="do.archive+main.class.available">
<and>
- <istrue value="${manifest.available+main.class}"/>
+ <isset property="main.class.available"/>
<istrue value="${do.archive}"/>
</and>
</condition>
- <condition property="do.archive+manifest.available+main.class+mkdist.available">
+ <condition property="do.archive+splashscreen.available">
<and>
- <istrue value="${manifest.available+main.class+mkdist.available}"/>
+ <isset property="splashscreen.available"/>
<istrue value="${do.archive}"/>
</and>
</condition>
- <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
+ <condition property="do.archive+manifest.available+main.class">
<and>
- <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
+ <istrue value="${manifest.available+main.class}"/>
<istrue value="${do.archive}"/>
</and>
</condition>
+ <condition property="manifest.available-mkdist.available">
+ <or>
+ <istrue value="${manifest.available}"/>
+ <isset property="do.mkdist"/>
+ </or>
+ </condition>
+ <condition property="manifest.available+main.class-mkdist.available">
+ <or>
+ <istrue value="${manifest.available+main.class}"/>
+ <isset property="do.mkdist"/>
+ </or>
+ </condition>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
@@ -142,6 +156,7 @@ is divided into following sections:
</and>
</condition>
<property name="run.jvmargs" value=""/>
+ <property name="run.jvmargs.ide" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
@@ -173,9 +188,40 @@ is divided into following sections:
<condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
<length length="0" string="${endorsed.classpath}" when="greater"/>
</condition>
- <property name="javac.fork" value="false"/>
+ <condition else="false" property="jdkBug6558476">
+ <and>
+ <matches pattern="1\.[56]" string="${java.specification.version}"/>
+ <not>
+ <os family="unix"/>
+ </not>
+ </and>
+ </condition>
+ <property name="javac.fork" value="${jdkBug6558476}"/>
<property name="jar.index" value="false"/>
+ <property name="jar.index.metainf" value="${jar.index}"/>
+ <property name="copylibs.rebase" value="true"/>
<available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
+ <condition property="junit.available">
+ <or>
+ <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
+ <available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
+ </or>
+ </condition>
+ <condition property="testng.available">
+ <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
+ </condition>
+ <condition property="junit+testng.available">
+ <and>
+ <istrue value="${junit.available}"/>
+ <istrue value="${testng.available}"/>
+ </and>
+ </condition>
+ <condition else="testng" property="testng.mode" value="mixed">
+ <istrue value="${junit+testng.available}"/>
+ </condition>
+ <condition else="" property="testng.debug.mode" value="-mixed">
+ <istrue value="${junit+testng.available}"/>
+ </condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
@@ -302,37 +348,368 @@ is divided into following sections:
<delete>
<files includesfile="${javac.includesfile.binary}"/>
</delete>
- <delete file="${javac.includesfile.binary}"/>
+ <delete>
+ <fileset file="${javac.includesfile.binary}"/>
+ </delete>
</sequential>
</macrodef>
</target>
- <target name="-init-macrodef-junit">
+ <target if="${junit.available}" name="-init-macrodef-junit-init">
+ <condition else="false" property="nb.junit.batch" value="true">
+ <and>
+ <istrue value="${junit.available}"/>
+ <not>
+ <isset property="test.method"/>
+ </not>
+ </and>
+ </condition>
+ <condition else="false" property="nb.junit.single" value="true">
+ <and>
+ <istrue value="${junit.available}"/>
+ <isset property="test.method"/>
+ </and>
+ </condition>
+ </target>
+ <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
<sequential>
- <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
+ <property name="junit.forkmode" value="perTest"/>
+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
+ <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg value="-ea"/>
+ <customize/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property name="junit.forkmode" value="perTest"/>
+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
- <classpath>
- <path path="${run.test.classpath}"/>
- </classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
- <jvmarg line="${run.jvmargs}"/>
+ <jvmarg value="-ea"/>
+ <customize/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
+ <target if="${testng.available}" name="-init-macrodef-testng">
+ <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
+ <isset property="test.method"/>
+ </condition>
+ <union id="test.set">
+ <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
+ </union>
+ <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
+ <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="ExampleSquareTrackerExtension" testname="TestNG tests" workingDir="${work.dir}">
+ <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
+ <propertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </propertyset>
+ <customize/>
+ </testng>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-test-impl">
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element implicit="true" name="customize" optional="true"/>
+ <sequential>
+ <echo>No tests executed.</echo>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element implicit="true" name="customize" optional="true"/>
+ <sequential>
+ <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize/>
+ </j2seproject3:junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element implicit="true" name="customize" optional="true"/>
+ <sequential>
+ <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize/>
+ </j2seproject3:testng>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
+ <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <sequential>
+ <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
+ </customize>
+ </j2seproject3:test-impl>
+ </sequential>
+ </macrodef>
+ </target>
+ <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
+ <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property name="junit.forkmode" value="perTest"/>
+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
+ <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg value="-ea"/>
+ <jvmarg line="${debug-args-line}"/>
+ <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
+ <customize/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
+ <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property name="junit.forkmode" value="perTest"/>
+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
+ </batchtest>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg value="-ea"/>
+ <jvmarg line="${debug-args-line}"/>
+ <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
+ <customize/>
</junit>
</sequential>
</macrodef>
</target>
+ <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
+ <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element implicit="true" name="customize" optional="true"/>
+ <sequential>
+ <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize/>
+ </j2seproject3:junit-debug>
+ </sequential>
+ </macrodef>
+ </target>
+ <target if="${testng.available}" name="-init-macrodef-testng-debug">
+ <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <element name="customize2" optional="true"/>
+ <sequential>
+ <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
+ <isset property="test.method"/>
+ </condition>
+ <condition else="-suitename ExampleSquareTrackerExtension -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
+ <matches pattern=".*\.xml" string="@{testClass}"/>
+ </condition>
+ <delete dir="${build.test.results.dir}" quiet="true"/>
+ <mkdir dir="${build.test.results.dir}"/>
+ <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
+ <customize>
+ <customize2/>
+ <jvmarg value="-ea"/>
+ <arg line="${testng.debug.mode}"/>
+ <arg line="-d ${build.test.results.dir}"/>
+ <arg line="-listener org.testng.reporters.VerboseReporter"/>
+ <arg line="${testng.cmd.args}"/>
+ </customize>
+ </j2seproject3:debug>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
+ <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <element implicit="true" name="customize2" optional="true"/>
+ <sequential>
+ <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
+ <customize2/>
+ </j2seproject3:testng-debug>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <sequential>
+ <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
+ </customize>
+ </j2seproject3:test-debug-impl>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <sequential>
+ <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
+ <customize2>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ </customize2>
+ </j2seproject3:testng-debug-impl>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
+ <!--
+ pre NB7.2 profiling section; consider it deprecated
+ -->
+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
+ <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
+ <macrodef name="resolve">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{name}" value="${env.@{value}}"/>
+ </sequential>
+ </macrodef>
+ <macrodef name="profile">
+ <attribute default="${main.class}" name="classname"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property environment="env"/>
+ <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
+ <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+ <arg line="${application.args}"/>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
+ <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
+ <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
+ </target>
+ <!--
+ end of pre NB7.2 profiling section
+ -->
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
@@ -390,6 +767,7 @@ is divided into following sections:
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
<jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
@@ -406,6 +784,7 @@ is divided into following sections:
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${run.classpath}" name="classpath"/>
+ <attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
@@ -413,6 +792,7 @@ is divided into following sections:
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
<jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
@@ -427,6 +807,7 @@ is divided into following sections:
</target>
<target name="-init-macrodef-copylibs">
<macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${manifest.file}" name="manifest"/>
<element name="customize" optional="true"/>
<sequential>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
@@ -438,11 +819,14 @@ is divided into following sections:
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
+ <filtermapper>
+ <replacestring from=" " to="%20"/>
+ </filtermapper>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
- <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
+ <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
@@ -483,7 +867,7 @@ is divided into following sections:
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
<property name="ap.cmd.line.internal" value=""/>
</target>
- <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
<!--
===================
COMPILATION SECTION
@@ -494,7 +878,7 @@ is divided into following sections:
<delete file="${built-jar.properties}" quiet="true"/>
</target>
<target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
- <echo level="warn" message="Cycle detected: SquareTrackerExtension was already built"/>
+ <echo level="warn" message="Cycle detected: ExampleSquareTrackerExtension was already built"/>
</target>
<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
<mkdir dir="${build.dir}"/>
@@ -504,34 +888,6 @@ is divided into following sections:
<propertyfile file="${built-jar.properties}">
<entry key="${basedir}" value=""/>
</propertyfile>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-jar.properties}"/>
- <param location="${project.NetworkTable_Client}" name="call.subproject"/>
- <param location="${project.NetworkTable_Client}/build.xml" name="call.script"/>
- <param name="call.target" value="jar"/>
- <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
- </antcall>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-jar.properties}"/>
- <param location="${project.SmartDashboard}" name="call.subproject"/>
- <param location="${project.SmartDashboard}/nbbuild.xml" name="call.script"/>
- <param name="call.target" value="jar"/>
- <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
- </antcall>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-jar.properties}"/>
- <param location="${project.WPICameraExtension}" name="call.subproject"/>
- <param location="${project.WPICameraExtension}/build.xml" name="call.script"/>
- <param name="call.target" value="jar"/>
- <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
- </antcall>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-jar.properties}"/>
- <param location="${project.WPIJavaCV}" name="call.subproject"/>
- <param location="${project.WPIJavaCV}/build.xml" name="call.script"/>
- <param name="call.target" value="jar"/>
- <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
- </antcall>
</target>
<target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
<target depends="init" name="-check-automatic-build">
@@ -599,10 +955,10 @@ is divided into following sections:
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
+ <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
<j2seproject1:jar/>
</target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
+ <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
<j2seproject1:jar manifest="${manifest.file}"/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
@@ -618,37 +974,46 @@ is divided into following sections:
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
- <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+ <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+ </target>
+ <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">
+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
+ <touch file="${tmp.manifest.file}" verbose="false"/>
+ </target>
+ <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest">
+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
+ <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
</target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
+ <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main">
+ <manifest file="${tmp.manifest.file}" mode="update">
+ <attribute name="Main-Class" value="${main.class}"/>
+ </manifest>
+ </target>
+ <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen">
<basename file="${application.splash}" property="splashscreen.basename"/>
<mkdir dir="${build.classes.dir}/META-INF"/>
<copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
- <j2seproject3:copylibs>
- <customize>
- <attribute name="Main-Class" value="${main.class}"/>
- <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
- </customize>
- </j2seproject3:copylibs>
- <echo>To run this application from the command line without Ant, try:</echo>
- <property location="${dist.jar}" name="dist.jar.resolved"/>
- <echo>java -jar "${dist.jar.resolved}"</echo>
+ <manifest file="${tmp.manifest.file}" mode="update">
+ <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
+ </manifest>
</target>
- <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
- <j2seproject3:copylibs>
- <customize>
- <attribute name="Main-Class" value="${main.class}"/>
- </customize>
- </j2seproject3:copylibs>
- <echo>To run this application from the command line without Ant, try:</echo>
+ <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack">
+ <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
+ <echo level="info">To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
- <echo>java -jar "${dist.jar.resolved}"</echo>
+ <echo level="info">java -jar "${dist.jar.resolved}"</echo>
</target>
+ <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">
+ <delete>
+ <fileset file="${tmp.manifest.file}"/>
+ </delete>
+ </target>
+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/>
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
- <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
+ <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
<!--
=================
EXECUTION SECTION
@@ -714,22 +1079,131 @@ is divided into following sections:
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
+ =================
+ PROFILING SECTION
+ =================
+ -->
+ <!--
+ pre NB7.2 profiler integration
+ -->
+ <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <profile/>
+ </target>
+ <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
+ <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <profile classname="${profile.class}"/>
+ </target>
+ <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <profile classname="sun.applet.AppletViewer">
+ <customize>
+ <arg value="${applet.url}"/>
+ </customize>
+ </profile>
+ </target>
+ <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <test name="${profile.class}"/>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+ <!--
+ end of pre NB72 profiling section
+ -->
+ <target if="netbeans.home" name="-profile-check">
+ <condition property="profiler.configured">
+ <or>
+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
+ </or>
+ </condition>
+ </target>
+ <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
+ <startprofiler/>
+ <antcall target="run"/>
+ </target>
+ <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <startprofiler/>
+ <antcall target="run-single"/>
+ </target>
+ <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
+ <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+ <startprofiler/>
+ <antcall target="test-single"/>
+ </target>
+ <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <startprofiler/>
+ <antcal target="run-test-with-main"/>
+ </target>
+ <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+ <startprofiler/>
+ <antcall target="run-applet"/>
+ </target>
+ <!--
===============
JAVADOC SECTION
===============
-->
<target depends="init" if="have.sources" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
+ <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
+ <and>
+ <isset property="endorsed.classpath.cmd.line.arg"/>
+ <not>
+ <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
+ </not>
+ </and>
+ </condition>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
- <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+ <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/*.java"/>
+ <exclude name="*.java"/>
</fileset>
+ <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
</javadoc>
<copy todir="${dist.javadoc.dir}">
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
@@ -746,7 +1220,7 @@ is divided into following sections:
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
- JUNIT COMPILATION SECTION
+ TEST COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
@@ -759,7 +1233,7 @@ is divided into following sections:
<target if="do.depend.true" name="-compile-test-depend">
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
</target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
+ <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -774,7 +1248,7 @@ is divided into following sections:
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
+ <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
@@ -789,14 +1263,14 @@ is divided into following sections:
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
- JUNIT EXECUTION SECTION
+ TEST EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
- <j2seproject3:junit testincludes="**/*Test.java"/>
+ <j2seproject3:test testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
@@ -809,39 +1283,40 @@ is divided into following sections:
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
- <j2seproject3:junit excludes="" includes="${test.includes}"/>
+ <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
+ <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
+ <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
+ </target>
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+ </target>
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
<!--
=======================
- JUNIT DEBUGGING SECTION
+ TEST DEBUGGING SECTION
=======================
-->
- <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
- <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
- <delete file="${test.report.file}"/>
- <mkdir dir="${build.test.results.dir}"/>
- <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
- <customize>
- <syspropertyset>
- <propertyref prefix="test-sys-prop."/>
- <mapper from="test-sys-prop.*" to="*" type="glob"/>
- </syspropertyset>
- <arg value="${test.class}"/>
- <arg value="showoutput=true"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
- </customize>
- </j2seproject3:debug>
+ <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
+ </target>
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
+ <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
+ <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
@@ -883,7 +1358,7 @@ is divided into following sections:
<delete file="${built-clean.properties}" quiet="true"/>
</target>
<target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
- <echo level="warn" message="Cycle detected: SquareTrackerExtension was already built"/>
+ <echo level="warn" message="Cycle detected: ExampleSquareTrackerExtension was already built"/>
</target>
<target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
<mkdir dir="${build.dir}"/>
@@ -893,34 +1368,6 @@ is divided into following sections:
<propertyfile file="${built-clean.properties}">
<entry key="${basedir}" value=""/>
</propertyfile>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-clean.properties}"/>
- <param location="${project.NetworkTable_Client}" name="call.subproject"/>
- <param location="${project.NetworkTable_Client}/build.xml" name="call.script"/>
- <param name="call.target" value="clean"/>
- <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
- </antcall>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-clean.properties}"/>
- <param location="${project.SmartDashboard}" name="call.subproject"/>
- <param location="${project.SmartDashboard}/nbbuild.xml" name="call.script"/>
- <param name="call.target" value="clean"/>
- <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
- </antcall>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-clean.properties}"/>
- <param location="${project.WPICameraExtension}" name="call.subproject"/>
- <param location="${project.WPICameraExtension}/build.xml" name="call.script"/>
- <param name="call.target" value="clean"/>
- <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
- </antcall>
- <antcall target="-maybe-call-dep">
- <param name="call.built.properties" value="${built-clean.properties}"/>
- <param location="${project.WPIJavaCV}" name="call.subproject"/>
- <param location="${project.WPIJavaCV}/build.xml" name="call.script"/>
- <param name="call.target" value="clean"/>
- <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
- </antcall>
</target>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
@@ -934,9 +1381,12 @@ is divided into following sections:
<target name="-check-call-dep">
<property file="${call.built.properties}" prefix="already.built."/>
<condition property="should.call.dep">
- <not>
- <isset property="already.built.${call.subproject}"/>
- </not>
+ <and>
+ <not>
+ <isset property="already.built.${call.subproject}"/>
+ </not>
+ <available file="${call.script}"/>
+ </and>
</condition>
</target>
<target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
diff --git a/extensions/camera/SquareTracker/nbproject/genfiles.properties b/extensions/ExampleSquareTrackerExtension/nbproject/genfiles.properties
index b58eb40..b58eb40 100644
--- a/extensions/camera/SquareTracker/nbproject/genfiles.properties
+++ b/extensions/ExampleSquareTrackerExtension/nbproject/genfiles.properties
diff --git a/extensions/camera/SquareTracker/nbproject/private/config.properties b/extensions/ExampleSquareTrackerExtension/nbproject/private/config.properties
index e69de29..e69de29 100644
--- a/extensions/camera/SquareTracker/nbproject/private/config.properties
+++ b/extensions/ExampleSquareTrackerExtension/nbproject/private/config.properties
diff --git a/extensions/camera/SquareTracker/nbproject/private/private.properties b/extensions/ExampleSquareTrackerExtension/nbproject/private/private.properties
index 7b67f1f..7b67f1f 100644
--- a/extensions/camera/SquareTracker/nbproject/private/private.properties
+++ b/extensions/ExampleSquareTrackerExtension/nbproject/private/private.properties
diff --git a/extensions/camera/SquareTracker/nbproject/private/private.xml b/extensions/ExampleSquareTrackerExtension/nbproject/private/private.xml
index cc2c0e5..cc2c0e5 100644
--- a/extensions/camera/SquareTracker/nbproject/private/private.xml
+++ b/extensions/ExampleSquareTrackerExtension/nbproject/private/private.xml
diff --git a/extensions/camera/SquareTracker/nbproject/project.properties b/extensions/ExampleSquareTrackerExtension/nbproject/project.properties
index c9b6617..59422cf 100644
--- a/extensions/camera/SquareTracker/nbproject/project.properties
+++ b/extensions/ExampleSquareTrackerExtension/nbproject/project.properties
@@ -2,7 +2,7 @@ annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=SquareTrackerExtension
+application.title=ExampleSquareTrackerExtension
application.vendor=Greg
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
@@ -22,20 +22,24 @@ debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
-dist.jar=${dist.dir}/SquareTrackerExtension.jar
+dist.jar=${dist.dir}/ExampleSquareTrackerExtension.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
-file.reference.javacpp.jar=../../../WPIJavaCV/lib/javacpp.jar
-file.reference.javacv-windows-x86.jar=../../../WPIJavaCV/lib/javacv-windows-x86.jar
-file.reference.javacv.jar=../../../WPIJavaCV/lib/javacv.jar
+file.reference.javacpp.jar=lib/javacpp.jar
+file.reference.javacv-windows-x86.jar=lib/javacv-windows-x86.jar
+file.reference.javacv.jar=lib/javacv.jar
+file.reference.NetworkTable_Client.jar=lib/NetworkTable_Client.jar
+file.reference.SmartDashboard.jar=lib/SmartDashboard.jar
+file.reference.WPIJavaCVVideoExtension.jar=lib/WPIJavaCVVideoExtension.jar
+file.reference.WPIJavaCV.jar=lib/WPIJavaCV.jar
includes=**
jar.compress=false
javac.classpath=\
- ${reference.WPIJavaCV.jar}:\
- ${reference.WPICameraExtension.jar}:\
- ${reference.SmartDashboard.jar}:\
- ${reference.NetworkTable_Client.jar}:\
+ ${file.reference.WPIJavaCV.jar}:\
+ ${file.reference.WPIJavaCVVideoExtension.jar}:\
+ ${file.reference.SmartDashboard.jar}:\
+ ${file.reference.NetworkTable_Client.jar}:\
${file.reference.javacpp.jar}:\
${file.reference.javacv-windows-x86.jar}:\
${file.reference.javacv.jar}
@@ -68,14 +72,6 @@ main.class=squaretrackerextension.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
-project.NetworkTable_Client=../../../NetworkTable/Client/Java/trunk
-project.SmartDashboard=../../../smartdashboard
-project.WPICameraExtension=../WPICameraExtension
-project.WPIJavaCV=../../../WPIJavaCV
-reference.NetworkTable_Client.jar=${project.NetworkTable_Client}/dist/NetworkTable_Client.jar
-reference.SmartDashboard.jar=${project.SmartDashboard}/dist/SmartDashboard.jar
-reference.WPICameraExtension.jar=${project.WPICameraExtension}/dist/WPICameraExtension.jar
-reference.WPIJavaCV.jar=${project.WPIJavaCV}/dist/WPIJavaCV.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
diff --git a/extensions/camera/SquareTracker/nbproject/project.xml b/extensions/ExampleSquareTrackerExtension/nbproject/project.xml
index a69eeae..ead182e 100644
--- a/extensions/camera/SquareTracker/nbproject/project.xml
+++ b/extensions/ExampleSquareTrackerExtension/nbproject/project.xml
@@ -3,7 +3,7 @@
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
- <name>SquareTrackerExtension</name>
+ <name>ExampleSquareTrackerExtension</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
diff --git a/extensions/ExampleSquareTrackerExtension/src/edu/wpi/first/smartdashboard/extensions/squaretracker/Square.pdf b/extensions/ExampleSquareTrackerExtension/src/edu/wpi/first/smartdashboard/extensions/squaretracker/Square.pdf
new file mode 100644
index 0000000..23cb55e
--- /dev/null
+++ b/extensions/ExampleSquareTrackerExtension/src/edu/wpi/first/smartdashboard/extensions/squaretracker/Square.pdf
Binary files differ
diff --git a/extensions/camera/SquareTracker/src/edu/wpi/first/wpilibj/examples/SquareTrackerExtension.java b/extensions/ExampleSquareTrackerExtension/src/edu/wpi/first/smartdashboard/extensions/squaretracker/SquareTrackerExtension.java
index e5886a2..a9361d3 100644
--- a/extensions/camera/SquareTracker/src/edu/wpi/first/wpilibj/examples/SquareTrackerExtension.java
+++ b/extensions/ExampleSquareTrackerExtension/src/edu/wpi/first/smartdashboard/extensions/squaretracker/SquareTrackerExtension.java
@@ -1,6 +1,6 @@
-package edu.wpi.first.wpilibj.examples;
+package edu.wpi.first.smartdashboard.extensions.squaretracker;
-import edu.wpi.first.smartdashboard.camera.WPILaptopCameraExtension;
+import edu.wpi.first.smartdashboard.extensions.wpijavacvvideo.LaptopCameraExtension;
import edu.wpi.first.smartdashboard.robot.Robot;
import edu.wpi.first.wpijavacv.WPIBinaryImage;
import edu.wpi.first.wpijavacv.WPIColor;
@@ -16,9 +16,10 @@ import java.util.ArrayList;
*
* @author Greg Granito
*/
-public class SquareTrackerExtension extends WPILaptopCameraExtension {
+public class SquareTrackerExtension extends LaptopCameraExtension {
public static final String NAME = "Laptop Camera Square Tracker";
+ /* Uses the table to send information from the DS to the robot */
NetworkTable table = NetworkTable.getTable("camera");
WPIColor targetColor = new WPIColor(255, 0, 0);
@@ -64,9 +65,9 @@ public class SquareTrackerExtension extends WPILaptopCameraExtension {
if(p == q) continue;
int pCenterX = (p.getX() + (p.getWidth()/2));
-
+
int qCenterX = q.getX() + (q.getWidth()/2);
-
+
int pCenterY = (p.getY() + (p.getHeight()/2));
int qCenterY = q.getY() + (q.getHeight()/2);
@@ -93,9 +94,9 @@ public class SquareTrackerExtension extends WPILaptopCameraExtension {
if(square != null){
double x = square.getX() + (square.getWidth()/2);
x = (2 * (x/rawImage.getWidth())) - 1;
-
+
double area = ((double)squareArea) / ((double)(rawImage.getWidth() * rawImage.getHeight()));
-
+
synchronized(table) {
table.beginTransaction();
table.putBoolean("found", true);
diff --git a/extensions/camera/SquareTracker/build.xml b/extensions/WPIJavaCVVideoExtension/build.xml
index 90c2964..27d6203 100644
--- a/extensions/camera/SquareTracker/build.xml
+++ b/extensions/WPIJavaCVVideoExtension/build.xml
@@ -7,8 +7,8 @@
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
-<project name="SquareTrackerExtension" default="default" basedir=".">
- <description>Builds, tests, and runs the project SquareTrackerExtension.</description>
+<project name="WPIJavaCVVideoExtension" default="default" basedir=".">
+ <description>Builds, tests, and runs the project WPIJavaCVVideoExtension.</description>
<import file="nbproject/build-impl.xml"/>
<!--
@@ -59,7 +59,7 @@
An example of overriding the target for project execution could look like this:
- <target name="run" depends="SquareTrackerExtension-impl.jar">
+ <target name="run" depends="WPIJavaCVVideoExtension-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
diff --git a/extensions/WPIJavaCVVideoExtension/lib/SmartDashboard.jar b/extensions/WPIJavaCVVideoExtension/lib/SmartDashboard.jar
new file mode 120000
index 0000000..5e4bb39
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/lib/SmartDashboard.jar
@@ -0,0 +1 @@
+../../../../wpilib/tools/SmartDashboard.jar \ No newline at end of file
diff --git a/extensions/WPIJavaCVVideoExtension/lib/WPIJavaCV.jar b/extensions/WPIJavaCVVideoExtension/lib/WPIJavaCV.jar
new file mode 120000
index 0000000..8e0d6df
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/lib/WPIJavaCV.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/dist/WPIJavaCV.jar \ No newline at end of file
diff --git a/extensions/WPIJavaCVVideoExtension/lib/javacpp.jar b/extensions/WPIJavaCVVideoExtension/lib/javacpp.jar
new file mode 120000
index 0000000..b13cc4d
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/lib/javacpp.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/lib/javacpp.jar \ No newline at end of file
diff --git a/extensions/WPIJavaCVVideoExtension/lib/javacv-windows-x86.jar b/extensions/WPIJavaCVVideoExtension/lib/javacv-windows-x86.jar
new file mode 120000
index 0000000..438dd95
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/lib/javacv-windows-x86.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/lib/javacv-windows-x86.jar \ No newline at end of file
diff --git a/extensions/WPIJavaCVVideoExtension/lib/javacv.jar b/extensions/WPIJavaCVVideoExtension/lib/javacv.jar
new file mode 120000
index 0000000..06ad26d
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/lib/javacv.jar
@@ -0,0 +1 @@
+../../../WPIJavaCV/lib/javacv.jar \ No newline at end of file
diff --git a/extensions/camera/WPICameraExtension/manifest.mf b/extensions/WPIJavaCVVideoExtension/manifest.mf
index 1574df4..1574df4 100644
--- a/extensions/camera/WPICameraExtension/manifest.mf
+++ b/extensions/WPIJavaCVVideoExtension/manifest.mf
diff --git a/extensions/camera/WPICameraExtension/nbproject/build-impl.xml b/extensions/WPIJavaCVVideoExtension/nbproject/build-impl.xml
index ea6d3b7..e46d053 100644
--- a/extensions/camera/WPICameraExtension/nbproject/build-impl.xml
+++ b/extensions/WPIJavaCVVideoExtension/nbproject/build-impl.xml
@@ -19,7 +19,7 @@ is divided into following sections:
- cleanup
-->
-<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="WPICameraExtension-impl">
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="WPIJavaCVVideoExtension-impl">
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>
<not>
@@ -438,7 +438,7 @@ is divided into following sections:
</fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
- <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="WPICameraExtension" testname="TestNG tests" workingDir="${work.dir}">
+ <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="WPIJavaCVVideoExtension" testname="TestNG tests" workingDir="${work.dir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset>
<propertyref prefix="test-sys-prop."/>
@@ -586,7 +586,7 @@ is divided into following sections:
<condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
<isset property="test.method"/>
</condition>
- <condition else="-suitename WPICameraExtension -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
+ <condition else="-suitename WPIJavaCVVideoExtension -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
<matches pattern=".*\.xml" string="@{testClass}"/>
</condition>
<delete dir="${build.test.results.dir}" quiet="true"/>
@@ -878,7 +878,7 @@ is divided into following sections:
<delete file="${built-jar.properties}" quiet="true"/>
</target>
<target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
- <echo level="warn" message="Cycle detected: WPICameraExtension was already built"/>
+ <echo level="warn" message="Cycle detected: WPIJavaCVVideoExtension was already built"/>
</target>
<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
<mkdir dir="${build.dir}"/>
@@ -1358,7 +1358,7 @@ is divided into following sections:
<delete file="${built-clean.properties}" quiet="true"/>
</target>
<target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
- <echo level="warn" message="Cycle detected: WPICameraExtension was already built"/>
+ <echo level="warn" message="Cycle detected: WPIJavaCVVideoExtension was already built"/>
</target>
<target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
<mkdir dir="${build.dir}"/>
diff --git a/extensions/camera/WPICameraExtension/nbproject/genfiles.properties b/extensions/WPIJavaCVVideoExtension/nbproject/genfiles.properties
index 35733b3..35733b3 100644
--- a/extensions/camera/WPICameraExtension/nbproject/genfiles.properties
+++ b/extensions/WPIJavaCVVideoExtension/nbproject/genfiles.properties
diff --git a/extensions/camera/WPICameraExtension/nbproject/private/config.properties b/extensions/WPIJavaCVVideoExtension/nbproject/private/config.properties
index e69de29..e69de29 100644
--- a/extensions/camera/WPICameraExtension/nbproject/private/config.properties
+++ b/extensions/WPIJavaCVVideoExtension/nbproject/private/config.properties
diff --git a/extensions/camera/WPICameraExtension/nbproject/private/private.properties b/extensions/WPIJavaCVVideoExtension/nbproject/private/private.properties
index bb21662..bb21662 100644
--- a/extensions/camera/WPICameraExtension/nbproject/private/private.properties
+++ b/extensions/WPIJavaCVVideoExtension/nbproject/private/private.properties
diff --git a/extensions/camera/WPICameraExtension/nbproject/private/private.xml b/extensions/WPIJavaCVVideoExtension/nbproject/private/private.xml
index cc2c0e5..cc2c0e5 100644
--- a/extensions/camera/WPICameraExtension/nbproject/private/private.xml
+++ b/extensions/WPIJavaCVVideoExtension/nbproject/private/private.xml
diff --git a/extensions/camera/WPICameraExtension/nbproject/project.properties b/extensions/WPIJavaCVVideoExtension/nbproject/project.properties
index 5cfab74..7459bfb 100644
--- a/extensions/camera/WPICameraExtension/nbproject/project.properties
+++ b/extensions/WPIJavaCVVideoExtension/nbproject/project.properties
@@ -3,7 +3,7 @@ annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=WPICameraExtension
+application.title=WPIJavaCVVideoExtension
application.vendor=Greg
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
@@ -23,7 +23,7 @@ debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
-dist.jar=${dist.dir}/WPICameraExtension.jar
+dist.jar=${dist.dir}/WPIJavaCVVideoExtension.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
diff --git a/extensions/camera/WPICameraExtension/nbproject/project.xml b/extensions/WPIJavaCVVideoExtension/nbproject/project.xml
index 41107a0..32fd950 100644
--- a/extensions/camera/WPICameraExtension/nbproject/project.xml
+++ b/extensions/WPIJavaCVVideoExtension/nbproject/project.xml
@@ -3,7 +3,7 @@
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
- <name>WPICameraExtension</name>
+ <name>WPIJavaCVVideoExtension</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
diff --git a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/VideoStreamExtension.java b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/AbstractVideoExtension.java
index 6937b86..9324232 100644
--- a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/VideoStreamExtension.java
+++ b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/AbstractVideoExtension.java
@@ -1,9 +1,6 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package edu.wpi.first.smartdashboard.camera;
+package edu.wpi.first.smartdashboard.extensions.wpijavacvvideo;
+import edu.wpi.first.smartdashboard.gui.DashboardPrefs;
import edu.wpi.first.smartdashboard.gui.StaticWidget;
import edu.wpi.first.smartdashboard.properties.Property;
import edu.wpi.first.smartdashboard.properties.StringProperty;
@@ -17,12 +14,17 @@ import java.awt.Graphics;
import java.awt.image.BufferedImage;
/**
+ * An extension that displays a video.
*
* @author Greg Granito
+ * @author Luke Shumaker
*/
-public class VideoStreamExtension extends StaticWidget {
+public abstract class AbstractVideoExtension extends StaticWidget {
+ public static final String NAME = null;
+ protected static final long errorBackoff = -1;
+ abstract protected Video getVideo();
+ abstract protected boolean isVideoProperty(Property property);
- public static final String NAME = "Video Stream";
private boolean connected = false;
public class GCThread extends Thread {
@@ -51,35 +53,34 @@ public class VideoStreamExtension extends StaticWidget {
boolean destroyed = false;
public BGThread() {
- super("Video Stream Background");
+ super(NAME+" Background");
}
@Override
public void run() {
WPIImage image;
while (!destroyed) {
- if (cam == null) {
- cam = new WPIFFmpegVideo(pathProperty.getSaveValue());
+ if (vid == null) {
+ vid = getVideo();
}
try {
- image = cam.getNewImage(5.0);
+ image = vid.getImage();
if (image instanceof WPIColorImage) {
drawnImage = processImage((WPIColorImage) image).getBufferedImage();
- repaint();
-
} else if (image instanceof WPIGrayscaleImage) {
drawnImage = processImage((WPIGrayscaleImage) image).getBufferedImage();
- repaint();
}
+
+ repaint();
} catch (final Exception e) {
e.printStackTrace();
- cam.dispose();
- cam = null;
+ vid.dispose();
+ vid = null;
drawnImage = null;
repaint();
try {
- Thread.sleep(2000);
+ Thread.sleep(errorBackoff);
} catch (InterruptedException ex) {
}
}
@@ -93,11 +94,10 @@ public class VideoStreamExtension extends StaticWidget {
}
}
private boolean resized = false;
- private WPIFFmpegVideo cam;
+ private Video vid;
private BufferedImage drawnImage;
private BGThread bgThread = new BGThread();
private GCThread gcThread = new GCThread();
- public final StringProperty pathProperty = new StringProperty(this, "Video Path", "http://localhost:8080/something");
@Override
public void init() {
@@ -110,12 +110,12 @@ public class VideoStreamExtension extends StaticWidget {
@Override
public void propertyChanged(Property property) {
- if (property == pathProperty) {
- if (cam != null) {
- cam.dispose();
+ if (isVideoProperty(property)) {
+ if (vid != null) {
+ vid.dispose();
}
try {
- cam = new WPIFFmpegVideo(pathProperty.getSaveValue());
+ vid = getVideo();
} catch (Exception e) {
e.printStackTrace();
drawnImage = null;
@@ -131,7 +131,7 @@ public class VideoStreamExtension extends StaticWidget {
public void disconnect() {
bgThread.destroy();
gcThread.destroy();
- if(cam != null) cam.dispose();
+ if(vid != null) vid.dispose();
super.disconnect();
}
diff --git a/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/AxisCameraExtension.java b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/AxisCameraExtension.java
new file mode 100644
index 0000000..6851dfc
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/AxisCameraExtension.java
@@ -0,0 +1,51 @@
+package edu.wpi.first.smartdashboard.extensions.wpijavacvvideo;
+
+import edu.wpi.first.smartdashboard.gui.DashboardPrefs;
+import edu.wpi.first.smartdashboard.properties.IPAddressProperty;
+import edu.wpi.first.smartdashboard.properties.Property;
+import edu.wpi.first.wpijavacv.WPICamera;
+import edu.wpi.first.wpijavacv.WPIImage;
+
+/**
+ * Exactly like VideoURLExtension, except it forces the Stream URL
+ * to be of the form "http://${IP_address}/mjpg/video.mjpg" and only
+ * lets the user configure the IP address.
+ *
+ * @author Greg Granito
+ */
+public class AxisCameraExtension extends AbstractVideoExtension {
+ public static final String NAME = "Axis Camera";
+ protected static final long errorBackoff = 2000;
+
+ @Override
+ protected Video getVideo() {
+ return new Camera(new WPICamera(ipProperty.getSaveValue()), 5.0);
+ }
+
+ @Override
+ protected boolean isVideoProperty(Property property) {
+ return property == ipProperty;
+ }
+
+ public final IPAddressProperty ipProperty = new IPAddressProperty(this, "Axis Camera IP Address", defaultIPaddress());
+
+ private final int[] defaultIPaddress() {
+ final int team = DashboardPrefs.getInstance().team.getValue();
+ return new int[]{10, team / 100, team % 100, 11};
+ }
+
+ public class Camera implements Video {
+ private final WPICamera vid;
+ private final double timeout;
+ public Camera(WPICamera vid, double timeout){
+ this.vid = vid;
+ this.timeout = timeout;
+ }
+ public WPIImage getImage() throws Exception {
+ return vid.getNewImage(timeout);
+ }
+ public void dispose() {
+ vid.dispose();
+ }
+ }
+}
diff --git a/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/LaptopCameraExtension.java b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/LaptopCameraExtension.java
new file mode 100644
index 0000000..03fa943
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/LaptopCameraExtension.java
@@ -0,0 +1,39 @@
+package edu.wpi.first.smartdashboard.extensions.wpijavacvvideo;
+
+import edu.wpi.first.smartdashboard.properties.Property;
+import edu.wpi.first.wpijavacv.WPIImage;
+import edu.wpi.first.wpijavacv.WPILaptopCamera;
+
+/**
+ * An extension that displays the laptop built-in camera.
+ *
+ * @author Greg Granito
+ * @author Luke Shumaker
+ */
+public class LaptopCameraExtension extends AbstractVideoExtension {
+ public static final String NAME = "Laptop Camera";
+ protected static final long errorBackoff = 500;
+
+ @Override
+ protected Video getVideo() {
+ return new Camera(new WPILaptopCamera());
+ }
+
+ @Override
+ protected boolean isVideoProperty(Property property) {
+ return false;
+ }
+
+ public class Camera implements Video {
+ private final WPILaptopCamera vid;
+ public Camera(WPILaptopCamera vid){
+ this.vid = vid;
+ }
+ public WPIImage getImage() {
+ return vid.getCurrentFrame();
+ }
+ public void dispose() {
+ vid.dispose();
+ }
+ }
+}
diff --git a/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/Video.java b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/Video.java
new file mode 100644
index 0000000..8187701
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/Video.java
@@ -0,0 +1,13 @@
+package edu.wpi.first.smartdashboard.extensions.wpijavacvvideo;
+
+import edu.wpi.first.wpijavacv.WPIImage;
+
+/**
+ * The basics of what you need out of a video source.
+ *
+ * @author Luke Shumaker
+ */
+public interface Video {
+ public WPIImage getImage() throws Exception;
+ public void dispose();
+}
diff --git a/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/VideoURLExtension.java b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/VideoURLExtension.java
new file mode 100644
index 0000000..bbe4d6b
--- /dev/null
+++ b/extensions/WPIJavaCVVideoExtension/src/edu/wpi/first/smartdashboard/extensions/wpijavacvvideo/VideoURLExtension.java
@@ -0,0 +1,50 @@
+package edu.wpi.first.smartdashboard.extensions.wpijavacvvideo;
+
+import edu.wpi.first.smartdashboard.gui.DashboardPrefs;
+import edu.wpi.first.smartdashboard.properties.Property;
+import edu.wpi.first.smartdashboard.properties.StringProperty;
+import edu.wpi.first.wpijavacv.WPIFFmpegVideo;
+import edu.wpi.first.wpijavacv.WPIImage;
+
+/**
+ * An extension that takes a video stream URL and displays the video.
+ *
+ * @author Greg Granito
+ * @author Luke Shumaker
+ */
+public class VideoURLExtension extends AbstractVideoExtension {
+ public static final String NAME = "Video URL Stream";
+ protected static final long errorBackoff = 2000;
+
+ @Override
+ protected Video getVideo() {
+ return new Camera(new WPIFFmpegVideo(pathProperty.getSaveValue()), 5.0);
+ }
+
+ @Override
+ protected boolean isVideoProperty(Property property) {
+ return property == pathProperty;
+ }
+
+ public final StringProperty pathProperty = new StringProperty(this, "Video Path", defaultVideoPath());
+
+ private static String defaultVideoPath() {
+ final int team = DashboardPrefs.getInstance().team.getValue();
+ return "http://10." + (team / 100) + "." + (team % 100) + ".11/mjpg/video.mjpg";
+ }
+
+ public class Camera implements Video {
+ private final WPIFFmpegVideo vid;
+ private final double timeout;
+ public Camera(WPIFFmpegVideo vid, double timeout){
+ this.vid = vid;
+ this.timeout = timeout;
+ }
+ public WPIImage getImage() throws Exception {
+ return vid.getNewImage(timeout);
+ }
+ public void dispose() {
+ vid.dispose();
+ }
+ }
+}
diff --git a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/VideoStreamViewerExtension.java b/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/VideoStreamViewerExtension.java
deleted file mode 100644
index 86f55cc..0000000
--- a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/VideoStreamViewerExtension.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package edu.wpi.first.smartdashboard.camera;
-
-import edu.wpi.first.smartdashboard.gui.DashboardPrefs;
-import edu.wpi.first.smartdashboard.gui.StaticWidget;
-import edu.wpi.first.smartdashboard.properties.Property;
-import edu.wpi.first.smartdashboard.properties.StringProperty;
-import edu.wpi.first.wpijavacv.WPIColorImage;
-import edu.wpi.first.wpijavacv.WPIFFmpegVideo;
-import edu.wpi.first.wpijavacv.WPIGrayscaleImage;
-import edu.wpi.first.wpijavacv.WPIImage;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-
-/**
- *
- * @author Greg Granito
- */
-public class VideoStreamViewerExtension extends StaticWidget {
-
- public static final String NAME = "Video Stream Viewer";
- private boolean connected = false;
-
- public class BGThread extends Thread {
-
- boolean destroyed = false;
-
- public BGThread() {
- super("Video Stream Background");
- }
-
- @Override
- public void run() {
- WPIImage image;
- while (!destroyed) {
- if (cam == null) {
- cam = new WPIFFmpegVideoViewer(pathProperty.getSaveValue());
- }
- try {
- drawnImage = cam.getNewImage(5.0);
- repaint();
-
- } catch (final Exception e) {
- e.printStackTrace();
- cam.dispose();
- cam = null;
- drawnImage = null;
- repaint();
- try {
- Thread.sleep(2000);
- } catch (InterruptedException ex) {
- }
- }
- }
-
- }
-
- @Override
- public void destroy() {
- destroyed = true;
- }
- }
- private boolean resized = false;
- private WPIFFmpegVideoViewer cam;
- private BufferedImage drawnImage;
- private BGThread bgThread = new BGThread();
- private final int team = DashboardPrefs.getInstance().team.getValue();
- public final StringProperty pathProperty = new StringProperty(this, "Video Path", "http://10." + (team / 100) + "." + (team % 100) + ".11/mjpg/video.mjpg");
-
- @Override
- public void init() {
- setPreferredSize(new Dimension(100, 100));
- bgThread.start();
- revalidate();
- repaint();
- }
-
- @Override
- public void propertyChanged(Property property) {
- if (property == pathProperty) {
- if (cam != null) {
- cam.dispose();
- }
- try {
- cam = new WPIFFmpegVideoViewer(pathProperty.getSaveValue());
- } catch (Exception e) {
- e.printStackTrace();
- drawnImage = null;
- setPreferredSize(new Dimension(100, 100));
- revalidate();
- repaint();
- }
- }
-
- }
-
- @Override
- public void disconnect() {
- bgThread.destroy();
- if(cam != null) cam.dispose();
- super.disconnect();
- }
-
- @Override
- protected void paintComponent(Graphics g) {
- if (drawnImage != null) {
- if (!resized) {
- setPreferredSize(new Dimension(drawnImage.getWidth(), drawnImage.getHeight()));
- revalidate();
- }
- int width = getBounds().width;
- int height = getBounds().height;
- double scale = Math.min((double) width / (double) drawnImage.getWidth(), (double) height / (double) drawnImage.getHeight());
- g.drawImage(drawnImage, (int) (width - (scale * drawnImage.getWidth())) / 2, (int) (height - (scale * drawnImage.getHeight())) / 2,
- (int) ((width + scale * drawnImage.getWidth()) / 2), (int) (height + scale * drawnImage.getHeight()) / 2,
- 0, 0, drawnImage.getWidth(), drawnImage.getHeight(), null);
- } else {
- g.setColor(Color.PINK);
- g.fillRect(0, 0, getBounds().width, getBounds().height);
- g.setColor(Color.BLACK);
- g.drawString("NO CONNECTION", 10, 10);
- }
- }
-}
diff --git a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPICameraExtension.java b/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPICameraExtension.java
deleted file mode 100644
index d10d633..0000000
--- a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPICameraExtension.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package edu.wpi.first.smartdashboard.camera;
-
-import edu.wpi.first.smartdashboard.gui.DashboardFrame;
-import edu.wpi.first.smartdashboard.gui.DashboardPrefs;
-import edu.wpi.first.smartdashboard.gui.StaticWidget;
-import edu.wpi.first.smartdashboard.properties.IPAddressProperty;
-import edu.wpi.first.smartdashboard.properties.Property;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-import javax.swing.SwingUtilities;
-import edu.wpi.first.wpijavacv.WPICamera;
-import edu.wpi.first.wpijavacv.WPIColorImage;
-import edu.wpi.first.wpijavacv.WPIGrayscaleImage;
-import edu.wpi.first.wpijavacv.WPIImage;
-
-/**
- *
- * @author Greg Granito
- */
-public class WPICameraExtension extends StaticWidget {
-
- public static final String NAME = "Camera";
- private boolean connected = false;
-
- public class GCThread extends Thread {
-
- boolean destroyed = false;
-
- @Override
- public void run() {
- while (!destroyed) {
- try {
- Thread.sleep(10000);
- } catch (InterruptedException ex) {
- }
- System.gc();
- }
- }
-
- public void destroy() {
- destroyed = true;
- interrupt();
- }
- }
-
- public class BGThread extends Thread {
-
- boolean destroyed = false;
-
- public BGThread() {
- super("Camera Background");
- }
-
- @Override
- public void run() {
- WPIImage image;
- while (!destroyed) {
- if (cam == null) {
- cam = new WPICamera(ipProperty.getSaveValue());
- }
- try {
- image = cam.getNewImage(5.0);
-
- if (image instanceof WPIColorImage) {
- drawnImage = processImage((WPIColorImage) image).getBufferedImage();
- repaint();
-
- } else if (image instanceof WPIGrayscaleImage) {
- drawnImage = processImage((WPIGrayscaleImage) image).getBufferedImage();
- repaint();
- }
- } catch (final Exception e) {
- e.printStackTrace();
- cam.dispose();
- cam = null;
- drawnImage = null;
- repaint();
- try {
- Thread.sleep(2000);
- } catch (InterruptedException ex) {
- }
- }
- }
-
- }
-
- @Override
- public void destroy() {
- destroyed = true;
- }
- }
- private boolean resized = false;
- private WPICamera cam;
- private BufferedImage drawnImage;
- private BGThread bgThread = new BGThread();
- private GCThread gcThread = new GCThread();
- public final IPAddressProperty ipProperty = new IPAddressProperty(this, "Camera IP Address", new int[]{10, (DashboardPrefs.getInstance().team.getValue() / 100), (DashboardPrefs.getInstance().team.getValue() % 100), 11});
-
- @Override
- public void init() {
- setPreferredSize(new Dimension(100, 100));
- bgThread.start();
- gcThread.start();
- revalidate();
- repaint();
- }
-
- @Override
- public void propertyChanged(Property property) {
- if (property == ipProperty) {
- if (cam != null) {
- cam.dispose();
- }
- try {
- cam = new WPICamera(ipProperty.getSaveValue());
- } catch (Exception e) {
- e.printStackTrace();
- drawnImage = null;
- setPreferredSize(new Dimension(100, 100));
- revalidate();
- repaint();
- }
- }
-
- }
-
- @Override
- public void disconnect() {
- bgThread.destroy();
- gcThread.destroy();
- if(cam != null) cam.dispose();
- super.disconnect();
- }
-
- @Override
- protected void paintComponent(Graphics g) {
- if (drawnImage != null) {
- if (!resized) {
- setPreferredSize(new Dimension(drawnImage.getWidth(), drawnImage.getHeight()));
- revalidate();
- }
- int width = getBounds().width;
- int height = getBounds().height;
- double scale = Math.min((double) width / (double) drawnImage.getWidth(), (double) height / (double) drawnImage.getHeight());
- g.drawImage(drawnImage, (int) (width - (scale * drawnImage.getWidth())) / 2, (int) (height - (scale * drawnImage.getHeight())) / 2,
- (int) ((width + scale * drawnImage.getWidth()) / 2), (int) (height + scale * drawnImage.getHeight()) / 2,
- 0, 0, drawnImage.getWidth(), drawnImage.getHeight(), null);
- } else {
- g.setColor(Color.PINK);
- g.fillRect(0, 0, getBounds().width, getBounds().height);
- g.setColor(Color.BLACK);
- g.drawString("NO CONNECTION", 10, 10);
- }
- }
-
- public WPIImage processImage(WPIColorImage rawImage) {
- return rawImage;
- }
-
- public WPIImage processImage(WPIGrayscaleImage rawImage) {
- return rawImage;
- }
-}
diff --git a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPIFFmpegVideoViewer.java b/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPIFFmpegVideoViewer.java
deleted file mode 100644
index b8a149d..0000000
--- a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPIFFmpegVideoViewer.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package edu.wpi.first.smartdashboard.camera;
-
-import com.googlecode.javacv.FFmpegFrameGrabber;
-import static com.googlecode.javacv.cpp.opencv_core.*;
-import com.googlecode.javacv.cpp.opencv_core.IplImage;
-import edu.wpi.first.wpijavacv.WPIDisposable;
-import edu.wpi.first.wpijavacv.WPIImage;
-import java.awt.image.BufferedImage;
-
-/**
- * A class used to gather images from the robot's camera.
- * @author Joe Grinstead and Greg Granito
- */
-public class WPIFFmpegVideoViewer extends WPIDisposable {
-
- private FFmpegFrameGrabber grabber;
- private IplImage image;
- private boolean readImage = true;
- private boolean badConnection = false;
- private final Object imageLock = new Object();
- private final Object grabberLock = new Object();
-
- public WPIFFmpegVideoViewer(final String path) {
- new Thread() {
-
- @Override
- public void run() {
- grabber = new FFmpegFrameGrabber(path);
- grabber.setFrameRate(1.0);
- try {
- grabber.start();
-
- while (!isDisposed()) {
- try {
- IplImage newest;
- synchronized (grabberLock) {
- if (isDisposed()) {
- return;
- }
- newest = grabber.grab();
- }
- if (isNull(newest)) {
- synchronized (imageLock) {
- badConnection = true;
- imageLock.notify();
- }
- return;
- } else {
- synchronized (imageLock) {
- if (image == null) {
- image = cvCreateImage(newest.cvSize(), newest.depth(), newest.nChannels());
- }
- cvCopy(newest, image);
- readImage = false;
- badConnection = false;
- imageLock.notify();
- }
- }
- } catch (Exception ex) {
- synchronized (imageLock) {
- badConnection = true;
- imageLock.notify();
- }
- ex.printStackTrace();
- return;
- }
- try {
- Thread.sleep(20);
- } catch (InterruptedException ex) {
- }
- }
- } catch (Exception ex) {
- synchronized (imageLock) {
- badConnection = true;
- imageLock.notify();
- }
- ex.printStackTrace();
- }
- }
- }.start();
- }
-
- public BufferedImage getNewImage(double timeout) throws BadConnectionException {
- validateDisposed();
-
- synchronized (imageLock) {
- readImage = true;
- while (readImage && !badConnection) {
- try {
- badConnection = true;
- imageLock.wait((long) (timeout * 1000));
- } catch (InterruptedException ex) {
- }
- }
- readImage = true;
-
-
- if (badConnection) {
- throw new BadConnectionException();
- } else if (image == null) {
- return null;
- } else {
- return image.getBufferedImage();
- }
- }
- }
-
- @Override
- protected void disposed() {
- try {
- synchronized (imageLock) {
- if (!isNull(image)) {
- image.release();
- }
- image = null;
- }
- } catch (Exception ex) {
- }
- }
-
- /**
- * An exception that occurs when the camera can not be reached.
- * @author Greg Granito
- */
- public static class BadConnectionException extends Exception {
- }
-
- @Override
- protected void finalize() throws Throwable {
- grabber.stop();
- super.finalize();
- }
-}
diff --git a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPILaptopCameraExtension.java b/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPILaptopCameraExtension.java
deleted file mode 100644
index 32e17cc..0000000
--- a/extensions/camera/WPICameraExtension/src/edu/wpi/first/smartdashboard/camera/WPILaptopCameraExtension.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package edu.wpi.first.smartdashboard.camera;
-
-import edu.wpi.first.smartdashboard.gui.DashboardFrame;
-import edu.wpi.first.smartdashboard.gui.StaticWidget;
-import edu.wpi.first.smartdashboard.properties.Property;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-import javax.swing.SwingUtilities;
-import edu.wpi.first.wpijavacv.WPIColorImage;
-import edu.wpi.first.wpijavacv.WPIGrayscaleImage;
-import edu.wpi.first.wpijavacv.WPIImage;
-import edu.wpi.first.wpijavacv.WPILaptopCamera;
-
-/**
- * An extension that gets images from a webcam on the computer.
- * @author Greg Granito
- */
-public class WPILaptopCameraExtension extends StaticWidget {
-
- public static final String NAME = "Laptop Camera";
- private boolean connected = false;
-
- public class GCThread extends Thread {
-
- boolean destroyed = false;
-
- @Override
- public void run() {
- while (!destroyed) {
- try {
- Thread.sleep(10000);
- } catch (InterruptedException ex) {
- }
- System.gc();
- }
- }
-
- public void destroy() {
- destroyed = true;
- interrupt();
- }
- }
-
- public class BGThread extends Thread {
-
- boolean destroyed = false;
-
- public BGThread() {
- super("Camera Background");
- }
-
- @Override
- public void run() {
- WPIImage image;
- while (!destroyed) {
- if (cam == null) {
- cam = new WPILaptopCamera();
- }
- try {
- image = cam.getCurrentFrame();
-
- if (image instanceof WPIColorImage) {
- drawnImage = processImage((WPIColorImage) image).getBufferedImage();
- repaint();
- } else if (image instanceof WPIGrayscaleImage) {
- drawnImage = processImage((WPIGrayscaleImage) image).getBufferedImage();
- repaint();
- }
- } catch (final Exception e) {
- drawnImage = null;
- repaint();
- try {
- Thread.sleep(500);
- } catch (InterruptedException ex) {
- }
- }
- }
-
- }
-
- @Override
- public void destroy() {
- destroyed = true;
- }
- }
- private boolean resized = false;
- private WPILaptopCamera cam;
- private BufferedImage drawnImage;
- private BGThread bgThread = new BGThread();
- private GCThread gcThread = new GCThread();
-
- @Override
- public void init() {
- setPreferredSize(new Dimension(100, 100));
- bgThread.start();
- gcThread.start();
- revalidate();
- repaint();
- }
-
- @Override
- public void propertyChanged(Property property) {
-
- }
-
- @Override
- public void disconnect() {
- bgThread.destroy();
- gcThread.destroy();
- cam.dispose();
- super.disconnect();
- }
-
- @Override
- protected void paintComponent(Graphics g) {
- if (drawnImage != null) {
- if (!resized) {
- setPreferredSize(new Dimension(drawnImage.getWidth(), drawnImage.getHeight()));
- revalidate();
- }
- int width = getBounds().width;
- int height = getBounds().height;
- double scale = Math.min((double) width / (double) drawnImage.getWidth(), (double) height / (double) drawnImage.getHeight());
- g.drawImage(drawnImage, (int) (width - (scale * drawnImage.getWidth())) / 2, (int) (height - (scale * drawnImage.getHeight())) / 2,
- (int) ((width + scale * drawnImage.getWidth()) / 2), (int) (height + scale * drawnImage.getHeight()) / 2,
- 0, 0, drawnImage.getWidth(), drawnImage.getHeight(), null);
- } else {
- g.setColor(Color.PINK);
- g.fillRect(0, 0, getBounds().width, getBounds().height);
- g.setColor(Color.BLACK);
- g.drawString("NO CONNECTION", 10, 10);
- }
- }
-
- public WPIImage processImage(WPIColorImage rawImage) {
- return rawImage;
- }
-
- public WPIImage processImage(WPIGrayscaleImage rawImage) {
- return rawImage;
- }
-}