mirror of
https://github.com/13hannes11/archive.git
synced 2024-09-03 21:50:58 +02:00
added all past projects
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- 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="Wettewerb_Foto" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Wettewerb_Foto.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Wettewerb_Foto-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
@@ -0,0 +1,4 @@
|
||||
#Sun, 06 Oct 2013 13:35:51 +0200
|
||||
|
||||
|
||||
C\:\\Users\\Hannes\\Documents\\NetBeansProjects\\Wettewerb_Foto=
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="export" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="unknownImage" alignment="0" pref="194" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="JaktuellLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="addImageButton" pref="194" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="11" max="32767" attributes="0"/>
|
||||
<Component id="JaktuellLabel" min="-2" pref="9" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="addImageButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="118" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" pref="9" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="unknownImage" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="export" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="jList1">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jList1ValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="addImageButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Lade Bilder für Camera 1"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addImageButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Unbekanntes Bild: "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="unknownImage">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Lade unbekanntes Bild"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="unknownImageActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="export">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Ergebnis exportieren"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exportActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="JaktuellLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Anzahl der Bilder:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
Binary file not shown.
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
========================
|
||||
BUILD OUTPUT DESCRIPTION
|
||||
========================
|
||||
|
||||
When you build an Java application project that has a main class, the IDE
|
||||
automatically copies all of the JAR
|
||||
files on the projects classpath to your projects dist/lib folder. The IDE
|
||||
also adds each of the JAR files to the Class-Path element in the application
|
||||
JAR files manifest file (MANIFEST.MF).
|
||||
|
||||
To run the project from the command line, go to the dist folder and
|
||||
type the following:
|
||||
|
||||
java -jar "Wettewerb_Foto.jar"
|
||||
|
||||
To distribute this project, zip up the dist folder (including the lib folder)
|
||||
and distribute the ZIP file.
|
||||
|
||||
Notes:
|
||||
|
||||
* If two JAR files on the project classpath have the same name, only the first
|
||||
JAR file is copied to the lib folder.
|
||||
* Only JAR files are copied to the lib folder.
|
||||
If the classpath contains other types of files or folders, these files (folders)
|
||||
are not copied.
|
||||
* If a library on the projects classpath also has a Class-Path element
|
||||
specified in the manifest,the content of the Class-Path element has to be on
|
||||
the projects runtime path.
|
||||
* To set a main class in a standard Java project, right-click the project node
|
||||
in the Projects window and choose Properties. Then click Run and enter the
|
||||
class name in the Main Class field. Alternatively, you can manually type the
|
||||
class name in the manifest Main-Class element.
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=e926f622
|
||||
build.xml.script.CRC32=e6e43631
|
||||
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=e926f622
|
||||
nbproject/build-impl.xml.script.CRC32=352f8b06
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Users\\Hannes\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group/>
|
||||
</open-files>
|
||||
</project-private>
|
||||
@@ -0,0 +1,71 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Wettewerb_Foto.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.7
|
||||
javac.target=1.7
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=wettewerb_foto.MainWindow
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Wettewerb_Foto</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,50 @@
|
||||
package wettewerb_foto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Camera {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private ArrayList<Image> images = new ArrayList();
|
||||
public Camera(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int countImages() {
|
||||
return getImages().size();
|
||||
}
|
||||
|
||||
public String writeLine() {
|
||||
String s = "";
|
||||
short i = 0;
|
||||
for (Image image : images) {
|
||||
s = s + this.name + " " + this.id + i + ";";
|
||||
s = s + image.getAbstand() + ";";
|
||||
s = s + image.getStreuung() + ";";
|
||||
s = s + System.getProperty("line.separator");
|
||||
i++;
|
||||
}
|
||||
s = s.replace(".", ",");
|
||||
return s;
|
||||
}
|
||||
|
||||
public void AddImage(String path) {
|
||||
Image tmp = new Image();
|
||||
|
||||
|
||||
tmp.Load(path);
|
||||
System.out.println(this.name + this.id + " loaded a new Image");
|
||||
getImages().add(tmp);
|
||||
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return name + " " + id;
|
||||
}
|
||||
public ArrayList<Image> getImages() {
|
||||
return images;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package wettewerb_foto;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Image {
|
||||
|
||||
private int width = 0, height = 0;
|
||||
private double abstand, streuung;
|
||||
|
||||
//Streuung
|
||||
private void sigmaDist(double durchschnitt, ArrayList<Pixel> pMap) {
|
||||
double s = 0;
|
||||
for (int i = 0; i < pMap.size() - width; i++) {
|
||||
Pixel p = pMap.get(i);
|
||||
Pixel q = pMap.get(i + width);
|
||||
s = s + ((pixelDist(p, q) - durchschnitt) *
|
||||
(pixelDist(p, q) - durchschnitt));
|
||||
}
|
||||
streuung = Math.sqrt(s / (pMap.size() - width));
|
||||
}
|
||||
|
||||
private double pixelDist(Pixel p, Pixel q) {
|
||||
double d = Math.sqrt((p.r - q.r) * (p.r - q.r)
|
||||
+ (p.g - q.g) * (p.g - q.g)
|
||||
+ (p.b - q.b) * (p.b - q.b));
|
||||
return d;
|
||||
}
|
||||
|
||||
private void avgDist(ArrayList<Pixel> pMap) {
|
||||
double d = 0;
|
||||
for (int i = 0; i < pMap.size() - width; i++) {
|
||||
d = d + pixelDist(pMap.get(i), pMap.get(i + width));
|
||||
}
|
||||
abstand = d / (pMap.size() - width);
|
||||
}
|
||||
|
||||
private void compute(ArrayList<Pixel> pMap) {
|
||||
int size = pMap.size();
|
||||
avgDist(pMap);
|
||||
sigmaDist(abstand, pMap);
|
||||
//System.out.println(getAbstand());
|
||||
}
|
||||
//Lädt Image und gibt Farbspektrum zurück (um speicherplatz zu sparen)
|
||||
|
||||
public void Load(String path) {
|
||||
ArrayList<Pixel> pixelMap = new ArrayList();
|
||||
int i = 0;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
br = new BufferedReader(new FileReader(path));
|
||||
|
||||
if (readHeader(br)) {
|
||||
while (br.ready()) {
|
||||
short r = (short) readInt(br);
|
||||
short g = (short) readInt(br);
|
||||
short b = (short) readInt(br);
|
||||
if (r >= 0 && g >= 0 && b >= 0) {
|
||||
pixelMap.add(new Pixel(i, r, g, b));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
compute(pixelMap);
|
||||
//return pixelMap;
|
||||
}
|
||||
|
||||
private boolean readHeader(BufferedReader br) {
|
||||
try {
|
||||
char c1 = (char) br.read();
|
||||
char c2 = (char) br.read();
|
||||
if (c1 == 'P' && c2 == '3') {
|
||||
width = readInt(br);
|
||||
height = readInt(br);
|
||||
int maxVal = readInt(br);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private static char readNonwhiteChar(BufferedReader bf) throws IOException {
|
||||
char c;
|
||||
|
||||
do {
|
||||
c = (char) bf.read();
|
||||
} while (c == ' ' || c == '\t' || c == '\n' || c == '\r');
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
private int readInt(BufferedReader br) throws IOException {
|
||||
char c;
|
||||
int i;
|
||||
|
||||
c = readNonwhiteChar(br);
|
||||
i = 0;
|
||||
do {
|
||||
i = i * 10 + c - '0';
|
||||
c = (char) br.read();
|
||||
} while (c >= '0' && c <= '9');
|
||||
return i;
|
||||
}
|
||||
/**
|
||||
* @return the abstand
|
||||
*/
|
||||
public double getAbstand() {
|
||||
return abstand;
|
||||
}
|
||||
/**
|
||||
* @return the streuung
|
||||
*/
|
||||
public double getStreuung() {
|
||||
return streuung;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="export" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="unknownImage" alignment="0" pref="194" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="JaktuellLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="addImageButton" pref="194" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="11" max="32767" attributes="0"/>
|
||||
<Component id="JaktuellLabel" min="-2" pref="9" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="addImageButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="118" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" pref="9" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="unknownImage" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="export" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="jList1">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jList1ValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="addImageButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Lade Bilder für Camera 1"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addImageButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Unbekanntes Bild: "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="unknownImage">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Lade unbekanntes Bild"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="unknownImageActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="export">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Ergebnis exportieren"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exportActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="JaktuellLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Anzahl der Bilder:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,287 @@
|
||||
package wettewerb_foto;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.AbstractListModel;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.ListModel;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Hannes
|
||||
*/
|
||||
public class MainWindow extends javax.swing.JFrame {
|
||||
|
||||
static ArrayList<Camera> cam = new ArrayList();
|
||||
Camera uCam;
|
||||
|
||||
/**
|
||||
* Creates new form MainWindow
|
||||
*/
|
||||
public MainWindow() {
|
||||
initComponents();
|
||||
|
||||
|
||||
uCam = new Camera(0, "Unbekannt");
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
cam.add(new Camera(i, "Kamera"));
|
||||
}
|
||||
ListModel lm = new AbstractListModel() {
|
||||
@Override
|
||||
public int getSize() {
|
||||
return cam.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int i) {
|
||||
return cam.get(i);
|
||||
}
|
||||
};
|
||||
jList1.setModel(lm);
|
||||
jList1.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jList1 = new javax.swing.JList();
|
||||
addImageButton = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
unknownImage = new javax.swing.JButton();
|
||||
export = new javax.swing.JButton();
|
||||
JaktuellLabel = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
||||
jList1ValueChanged(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane1.setViewportView(jList1);
|
||||
|
||||
addImageButton.setText("Lade Bilder für Camera 1");
|
||||
addImageButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
addImageButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel1.setText("Unbekanntes Bild: ");
|
||||
|
||||
unknownImage.setText("Lade unbekanntes Bild");
|
||||
unknownImage.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
unknownImageActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
export.setText("Ergebnis exportieren");
|
||||
export.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
exportActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
JaktuellLabel.setText("Anzahl der Bilder:");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel1)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(export, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(unknownImage, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(JaktuellLabel)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(addImageButton, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 11, Short.MAX_VALUE)
|
||||
.addComponent(JaktuellLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(addImageButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(unknownImage)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(export, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void addImageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addImageButtonActionPerformed
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
|
||||
FileNameExtensionFilter ppmFileFilter = new FileNameExtensionFilter("multiple selection recommended (*.ppm)", "ppm");
|
||||
fc.setFileFilter(ppmFileFilter);
|
||||
|
||||
//Allow Multiplefiles
|
||||
fc.setMultiSelectionEnabled(true);
|
||||
|
||||
int returnVal = fc.showOpenDialog(this);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File[] tmpFiles = fc.getSelectedFiles();
|
||||
for (int i = 0; i < tmpFiles.length; i++) {
|
||||
cam.get(jList1.getSelectedIndex()).AddImage(tmpFiles[i].getAbsolutePath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
changeInfo();
|
||||
}//GEN-LAST:event_addImageButtonActionPerformed
|
||||
|
||||
private void unknownImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unknownImageActionPerformed
|
||||
uCam = new Camera(0, "Unbekannt");
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
FileNameExtensionFilter ppmFileFilter = new FileNameExtensionFilter("PPM Images (*.ppm)", "ppm");
|
||||
fc.setFileFilter(ppmFileFilter);
|
||||
|
||||
|
||||
int returnVal = fc.showOpenDialog(this);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File tmpFile = fc.getSelectedFile();
|
||||
uCam.AddImage(tmpFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
jLabel1.setText("Unbekanntes Bild: " + uCam.countImages());
|
||||
}//GEN-LAST:event_unknownImageActionPerformed
|
||||
|
||||
private void exportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportActionPerformed
|
||||
//Open FileSaveDialo
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
FileNameExtensionFilter ppmFileFilter = new FileNameExtensionFilter("Save as csv (*.csv)", "csv");
|
||||
fc.setFileFilter(ppmFileFilter);
|
||||
int returnVal = fc.showSaveDialog(this);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
try {
|
||||
//File Saving
|
||||
File tmpFile = fc.getSelectedFile();
|
||||
createCSV(tmpFile.getParent(), tmpFile.getName() + ".csv");
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_exportActionPerformed
|
||||
|
||||
private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged
|
||||
changeInfo();
|
||||
}//GEN-LAST:event_jList1ValueChanged
|
||||
public void createCSV(String path, String filename) throws IOException {
|
||||
File file = new File(path, filename);
|
||||
if (!file.isFile() && !file.createNewFile()) {
|
||||
throw new IOException("Error creating new file: " + file.getAbsolutePath());
|
||||
}
|
||||
try {
|
||||
FileWriter writer = new FileWriter(path + "\\" + filename);
|
||||
|
||||
writer.append("Foto;Durchschnittlicher Abstand; Streuung" + System.getProperty("line.separator"));
|
||||
|
||||
for (int i = 0; i < cam.size(); i++) {
|
||||
writeLine(writer, cam.get(i));
|
||||
}
|
||||
|
||||
writeLine(writer, uCam);
|
||||
|
||||
|
||||
System.out.println("Written Data to File");
|
||||
|
||||
//generate whatever data you want
|
||||
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static FileWriter writeLine(FileWriter writer, Camera camera) throws IOException {
|
||||
writer.append(camera.writeLine());
|
||||
return writer;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new MainWindow().setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel JaktuellLabel;
|
||||
private javax.swing.JButton addImageButton;
|
||||
private javax.swing.JButton export;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JList jList1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JButton unknownImage;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private void changeInfo() {
|
||||
Camera c = cam.get(jList1.getSelectedIndex());
|
||||
JaktuellLabel.setText("Anzahl der Bilder: " + c.countImages());
|
||||
addImageButton.setText("Lade Bilder für " + c);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package wettewerb_foto;
|
||||
|
||||
public class Pixel {
|
||||
short r,g,b;
|
||||
public Pixel(int id,short R, short G, short B)
|
||||
{
|
||||
r = R;
|
||||
g = G;
|
||||
b = B;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user