From cea6336f011484356f2d4294d45849f3c398e2e7 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Sun, 8 Jul 2018 01:31:20 +0300 Subject: [PATCH] Code cleanup. Copyright update. --- pom.xml | 2 +- sixth-3d-demos.iml | 42 +++++++++++++++++++ .../sixth/e3d/examples/GraphDemo.java | 2 +- .../sixth/e3d/examples/OctreeDemo.java | 7 ++-- .../sixth/e3d/examples/PointCloudDemo.java | 2 +- .../e3d/examples/RainingNumbersDemo.java | 2 +- ...GridSpace.java => RandomPolygonsDemo.java} | 4 +- .../sixth/e3d/examples/SphereDemo.java | 2 +- .../sixth/e3d/examples/TextEditorDemo.java | 2 +- .../sixth/e3d/examples/launcher/Main.java | 6 +-- .../e3d/examples/launcher/MenuPanel.java | 25 +++++++---- .../sixth/e3d/examples/life/Star.java | 2 +- .../sixth/e3d/examples/package-info.java | 2 +- 13 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 sixth-3d-demos.iml rename src/main/java/eu/svjatoslav/sixth/e3d/examples/{GridSpace.java => RandomPolygonsDemo.java} (96%) diff --git a/pom.xml b/pom.xml index d58b8b2..63a3c6a 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ eu.svjatoslav sixth-3d - 1.1 + 1.2-SNAPSHOT diff --git a/sixth-3d-demos.iml b/sixth-3d-demos.iml new file mode 100644 index 0000000..e5c814c --- /dev/null +++ b/sixth-3d-demos.iml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java index 2bbd237..7bcaed7 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java index c26245f..0865ee7 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License @@ -27,7 +27,6 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas.TextC import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Grid3D; import java.awt.event.KeyEvent; -import java.io.IOException; import java.util.Vector; public class OctreeDemo extends WorldNavigationTracker { @@ -40,7 +39,7 @@ public class OctreeDemo extends WorldNavigationTracker { private ShapeCollection shapeCollection; private ViewContext context; - public static void main(final String[] args) throws IOException { + public static void main(final String[] args) { new OctreeDemo().init(); } @@ -88,7 +87,7 @@ public class OctreeDemo extends WorldNavigationTracker { } } - private void init() throws IOException { + private void init() { final ViewFrame viewFrame = new ViewFrame(); context = viewFrame.getView().getContext(); diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java index d92a9d1..71b2855 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java index a077cb9..ea44ca6 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/GridSpace.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java similarity index 96% rename from src/main/java/eu/svjatoslav/sixth/e3d/examples/GridSpace.java rename to src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java index 5e9b53b..3640e4b 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/GridSpace.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License @@ -16,7 +16,7 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance; import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.solidpolygon.SolidPolygon; import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Grid3D; -class GridSpace { +public class RandomPolygonsDemo { private static void addRandomPolygon(final ShapeCollection geometryCollection) { final Point3D polygonLocation = getRandomPoint(1000); diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/SphereDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/SphereDemo.java index 9a9b706..22b9dee 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/SphereDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/SphereDemo.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java index 6f5d4d2..9f56342 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/Main.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/Main.java index 512f30c..6d0f1a8 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/Main.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/Main.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License @@ -18,12 +18,8 @@ class Main extends javax.swing.JFrame { private Main() { super(); initGUI(); - } - /** - * Auto-generated main method to display this JFrame - */ public static void main(final String[] args) { SwingUtilities.invokeLater(() -> { final Main inst = new Main(); diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java index 10178e3..30c7ee3 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License @@ -17,8 +17,7 @@ import java.io.IOException; class MenuPanel extends JPanel { private static final long serialVersionUID = 2012721856427052560L; - public MenuPanel() { - + MenuPanel() { final GroupLayout groupLayout = new GroupLayout(this); GroupLayout.SequentialGroup sequentialGroup = groupLayout.createSequentialGroup(); sequentialGroup.addComponent(new JLabel("Choose an example to launch:")); @@ -29,10 +28,11 @@ class MenuPanel extends JPanel { sequentialGroup.addComponent(new JButton(new ShowSinusMap())); sequentialGroup.addComponent(new JButton(new ShowTextEditors())); sequentialGroup.addComponent(new JButton(new ShowGameOfLife())); + sequentialGroup.addComponent(new JButton(new ShowRandomPolygons())); } private class ShowTextEditors extends AbstractAction { - public ShowTextEditors() { + ShowTextEditors() { putValue(NAME, "Text editors"); } @@ -94,6 +94,17 @@ class MenuPanel extends JPanel { } } + private class ShowRandomPolygons extends AbstractAction { + public ShowRandomPolygons() { + putValue(NAME, "Random polygons"); + } + + @Override + public void actionPerformed(final ActionEvent e) { + RandomPolygonsDemo.main(null); + } + } + private class ShowOctree extends AbstractAction { public ShowOctree() { putValue(NAME, "Volumetric Octree"); @@ -101,11 +112,7 @@ class MenuPanel extends JPanel { @Override public void actionPerformed(final ActionEvent e) { - try { - OctreeDemo.main(null); - } catch (final IOException e1) { - e1.printStackTrace(); - } + OctreeDemo.main(null); } } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java index 81e7198..693c21d 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java @@ -7,7 +7,7 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.GlowingPoint; import java.util.ArrayList; import java.util.List; -public class Star extends GlowingPoint{ +public class Star extends GlowingPoint { public static final int STAR_SIZE = 10; public static final int UNIQUE_STARS_COUNT = 30; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/package-info.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/package-info.java index 4946f36..7e9a3b3 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/package-info.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/package-info.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License -- 2.20.1