mirror of https://github.com/rusefi/jzy3d-api.git
fixed mvn building nothing for many projects
This commit is contained in:
parent
16b4850e0a
commit
2c983d4b72
|
@ -58,7 +58,6 @@
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<!-- <testSourceDirectory>src/tests</testSourceDirectory> -->
|
<!-- <testSourceDirectory>src/tests</testSourceDirectory> -->
|
||||||
<pluginManagement><!-- using it to have m2e being able to run add-source -->
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
@ -81,15 +80,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.0</version><!--$NO-MVN-MAN-VER$ -->
|
|
||||||
<configuration>
|
|
||||||
<source>1.6</source>
|
|
||||||
<target>1.6</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
@ -123,9 +114,11 @@
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
|
||||||
|
|
||||||
<!-- <plugins>
|
|
||||||
|
<!-- using it to have m2e being able to run add-source -->
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
@ -147,7 +140,17 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins> -->
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.0</version><!--$NO-MVN-MAN-VER$ -->
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,208 @@
|
||||||
|
package org.jzy3d.chart.factories;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.media.opengl.GLCapabilities;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.jzy3d.bridge.IFrame;
|
||||||
|
import org.jzy3d.bridge.awt.FrameAWT;
|
||||||
|
import org.jzy3d.bridge.swing.FrameSwing;
|
||||||
|
import org.jzy3d.chart.AWTChart;
|
||||||
|
import org.jzy3d.chart.Chart;
|
||||||
|
import org.jzy3d.chart.controllers.keyboard.camera.ICameraKeyController;
|
||||||
|
import org.jzy3d.chart.controllers.keyboard.camera.NewtCameraKeyController;
|
||||||
|
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController;
|
||||||
|
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController.IScreenshotEventListener;
|
||||||
|
import org.jzy3d.chart.controllers.keyboard.screenshot.NewtScreenshotKeyController;
|
||||||
|
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
|
||||||
|
import org.jzy3d.chart.controllers.mouse.camera.NewtCameraMouseController;
|
||||||
|
import org.jzy3d.maths.BoundingBox3d;
|
||||||
|
import org.jzy3d.maths.Dimension;
|
||||||
|
import org.jzy3d.maths.Rectangle;
|
||||||
|
import org.jzy3d.maths.Utils;
|
||||||
|
import org.jzy3d.plot3d.primitives.axes.AxeBox;
|
||||||
|
import org.jzy3d.plot3d.primitives.axes.IAxe;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.CanvasAWT;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.CanvasNewtAwt;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.CanvasSwing;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.ICanvas;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.OffscreenCanvas;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||||
|
import org.jzy3d.plot3d.rendering.scene.Scene;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.AWTRenderer3d;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.AWTView;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.Renderer3d;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.View;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.layout.ColorbarViewportLayout;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.layout.IViewportLayout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Still using some AWT components
|
||||||
|
*
|
||||||
|
* @author martin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NewtChartComponentFactory extends ChartComponentFactory {
|
||||||
|
|
||||||
|
public static Chart chart() {
|
||||||
|
return chart(Quality.Intermediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(Quality quality) {
|
||||||
|
NewtChartComponentFactory f = new NewtChartComponentFactory();
|
||||||
|
return f.newChart(quality, Toolkit.newt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(String toolkit) {
|
||||||
|
NewtChartComponentFactory f = new NewtChartComponentFactory();
|
||||||
|
return f.newChart(Chart.DEFAULT_QUALITY, toolkit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(Quality quality, Toolkit toolkit) {
|
||||||
|
NewtChartComponentFactory f = new NewtChartComponentFactory();
|
||||||
|
return f.newChart(quality, toolkit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(Quality quality, String toolkit) {
|
||||||
|
NewtChartComponentFactory f = new NewtChartComponentFactory();
|
||||||
|
return f.newChart(quality, toolkit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Chart newChart(IChartComponentFactory factory, Quality quality, String toolkit) {
|
||||||
|
return new AWTChart(factory, quality, toolkit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAxe newAxe(BoundingBox3d box, View view) {
|
||||||
|
AxeBox axe = new AxeBox(box);
|
||||||
|
axe.setView(view);
|
||||||
|
return axe;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IViewportLayout newViewportLayout() {
|
||||||
|
return new ColorbarViewportLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The AWTView support Java2d defined components (tooltips, background
|
||||||
|
* images)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public View newView(Scene scene, ICanvas canvas, Quality quality) {
|
||||||
|
return new AWTView(getFactory(), scene, canvas, quality);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Provide AWT Texture loading for screenshots */
|
||||||
|
@Override
|
||||||
|
public Renderer3d newRenderer(View view, boolean traceGL, boolean debugGL) {
|
||||||
|
return new AWTRenderer3d(view, traceGL, debugGL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** bypass reflection used in super implementation */
|
||||||
|
@Override
|
||||||
|
protected IFrame newFrameSwing(Chart chart, Rectangle bounds, String title) {
|
||||||
|
return new FrameSwing(chart, bounds, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** bypass reflection used in super implementation */
|
||||||
|
@Override
|
||||||
|
protected IFrame newFrameAWT(Chart chart, Rectangle bounds, String title, String message) {
|
||||||
|
return new FrameAWT(chart, bounds, title, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICanvas newCanvas(IChartComponentFactory factory, Scene scene, Quality quality, String windowingToolkit, GLCapabilities capabilities) {
|
||||||
|
boolean traceGL = false;
|
||||||
|
boolean debugGL = false;
|
||||||
|
Toolkit chartType = getToolkit(windowingToolkit);
|
||||||
|
switch (chartType) {
|
||||||
|
case awt:
|
||||||
|
throw new IllegalArgumentException("Can't ask for an AWT chart type in Newt Factory.");
|
||||||
|
case swing:
|
||||||
|
throw new IllegalArgumentException("Can't ask for an Swing chart type in Newt Factory.");
|
||||||
|
case newt:
|
||||||
|
return new CanvasNewtAwt(factory, scene, quality, capabilities, traceGL, debugGL);
|
||||||
|
case offscreen:
|
||||||
|
Dimension dimension = getCanvasDimension(windowingToolkit);
|
||||||
|
return new OffscreenCanvas(factory, scene, quality, capabilities, dimension.width, dimension.height, traceGL, debugGL);
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("unknown chart type:" + chartType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** bypass reflection used in super implementation */
|
||||||
|
@Override
|
||||||
|
protected ICanvas newCanvasAWT(IChartComponentFactory chartComponentFactory, Scene scene, Quality quality, GLCapabilities capabilities, boolean traceGL, boolean debugGL) {
|
||||||
|
throw new IllegalArgumentException("Can't ask for an AWT chart type in Newt Factory.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** bypass reflection used in super implementation */
|
||||||
|
@Override
|
||||||
|
protected ICanvas newCanvasSwing(IChartComponentFactory chartComponentFactory, Scene scene, Quality quality, GLCapabilities capabilities, boolean traceGL, boolean debugGL) {
|
||||||
|
throw new IllegalArgumentException("Can't ask for an Swing chart type in Newt Factory.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChartComponentFactory getFactory() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JFrame newFrame(JPanel panel) {
|
||||||
|
try {
|
||||||
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore failure to set default look en feel;
|
||||||
|
}
|
||||||
|
JFrame frame = new JFrame();
|
||||||
|
frame.add(panel);
|
||||||
|
frame.pack();
|
||||||
|
frame.setVisible(true);
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICameraMouseController newMouseController(Chart chart) {
|
||||||
|
return new NewtCameraMouseController(chart);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IScreenshotKeyController newScreenshotKeyController(Chart chart) {
|
||||||
|
// trigger screenshot on 's' letter
|
||||||
|
String file = SCREENSHOT_FOLDER + "capture-" + Utils.dat2str(new Date(), "yyyy-MM-dd-HH-mm-ss") + ".png";
|
||||||
|
IScreenshotKeyController screenshot;
|
||||||
|
|
||||||
|
screenshot = new NewtScreenshotKeyController(chart, file);
|
||||||
|
screenshot.addListener(new IScreenshotEventListener() {
|
||||||
|
@Override
|
||||||
|
public void failedScreenshot(String file, Exception e) {
|
||||||
|
System.out.println("Failed to save screenshot:");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doneScreenshot(String file) {
|
||||||
|
System.out.println("Screenshot: " + file);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return screenshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICameraKeyController newKeyController(Chart chart) {
|
||||||
|
return new NewtCameraKeyController(chart);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFrame newFrame(Chart chart, Rectangle bounds, String title) {
|
||||||
|
return newFrameAWT(chart, bounds, title, null);
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,8 +19,10 @@ import org.jzy3d.chart.controllers.keyboard.camera.NewtCameraKeyController;
|
||||||
import org.jzy3d.chart.controllers.keyboard.screenshot.AWTScreenshotKeyController;
|
import org.jzy3d.chart.controllers.keyboard.screenshot.AWTScreenshotKeyController;
|
||||||
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController;
|
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController;
|
||||||
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController.IScreenshotEventListener;
|
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController.IScreenshotEventListener;
|
||||||
|
import org.jzy3d.chart.controllers.keyboard.screenshot.NewtScreenshotKeyController;
|
||||||
import org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController;
|
import org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController;
|
||||||
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
|
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
|
||||||
|
import org.jzy3d.chart.controllers.mouse.camera.NewtCameraMouseController;
|
||||||
import org.jzy3d.maths.BoundingBox3d;
|
import org.jzy3d.maths.BoundingBox3d;
|
||||||
import org.jzy3d.maths.Dimension;
|
import org.jzy3d.maths.Dimension;
|
||||||
import org.jzy3d.maths.Rectangle;
|
import org.jzy3d.maths.Rectangle;
|
||||||
|
@ -166,7 +168,10 @@ public class AWTChartComponentFactory extends ChartComponentFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICameraMouseController newMouseController(Chart chart) {
|
public ICameraMouseController newMouseController(Chart chart) {
|
||||||
|
if (!chart.getWindowingToolkit().equals("newt"))
|
||||||
return new AWTCameraMouseController(chart);
|
return new AWTCameraMouseController(chart);
|
||||||
|
else
|
||||||
|
return new NewtCameraMouseController(chart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -175,7 +180,11 @@ public class AWTChartComponentFactory extends ChartComponentFactory {
|
||||||
String file = SCREENSHOT_FOLDER + "capture-" + Utils.dat2str(new Date(), "yyyy-MM-dd-HH-mm-ss") + ".png";
|
String file = SCREENSHOT_FOLDER + "capture-" + Utils.dat2str(new Date(), "yyyy-MM-dd-HH-mm-ss") + ".png";
|
||||||
IScreenshotKeyController screenshot;
|
IScreenshotKeyController screenshot;
|
||||||
|
|
||||||
|
if (!chart.getWindowingToolkit().equals("newt"))
|
||||||
screenshot = new AWTScreenshotKeyController(chart, file);
|
screenshot = new AWTScreenshotKeyController(chart, file);
|
||||||
|
else
|
||||||
|
screenshot = new NewtScreenshotKeyController(chart, file);
|
||||||
|
|
||||||
screenshot.addListener(new IScreenshotEventListener() {
|
screenshot.addListener(new IScreenshotEventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void failedScreenshot(String file, Exception e) {
|
public void failedScreenshot(String file, Exception e) {
|
||||||
|
@ -203,22 +212,21 @@ public class AWTChartComponentFactory extends ChartComponentFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFrame newFrame(Chart chart, Rectangle bounds, String title) {
|
public IFrame newFrame(Chart chart, Rectangle bounds, String title) {
|
||||||
/*Object canvas = chart.getCanvas();
|
/*
|
||||||
|
* Object canvas = chart.getCanvas();
|
||||||
if (canvas.getClass().getName().equals("org.jzy3d.plot3d.rendering.canvas.CanvasAWT"))
|
*
|
||||||
return newFrameAWT(chart, bounds, title, null);
|
* if (canvas.getClass().getName().equals(
|
||||||
// FrameSWT works as well
|
* "org.jzy3d.plot3d.rendering.canvas.CanvasAWT")) return
|
||||||
else if (canvas instanceof CanvasNewtAwt)
|
* newFrameAWT(chart, bounds, title, null); // FrameSWT works as well
|
||||||
return newFrameAWT(chart, bounds, title, "[Newt]");
|
* else if (canvas instanceof CanvasNewtAwt) return newFrameAWT(chart,
|
||||||
// FrameSWT works as well
|
* bounds, title, "[Newt]"); // FrameSWT works as well else if
|
||||||
else if (canvas.getClass().getName().equals("org.jzy3d.plot3d.rendering.canvas.CanvasSwing"))
|
* (canvas.getClass
|
||||||
return newFrameSwing(chart, bounds, title);
|
* ().getName().equals("org.jzy3d.plot3d.rendering.canvas.CanvasSwing"))
|
||||||
else {
|
* return newFrameSwing(chart, bounds, title); else { String m =
|
||||||
String m = "No default frame could be found for the given Chart canvas: " + canvas.getClass();
|
* "No default frame could be found for the given Chart canvas: " +
|
||||||
System.err.println(m);
|
* canvas.getClass(); System.err.println(m); return null; // throw new
|
||||||
return null;
|
* RuntimeException(m); }
|
||||||
// throw new RuntimeException(m);
|
*/
|
||||||
}*/
|
|
||||||
return newFrameAWT(chart, bounds, title, null);
|
return newFrameAWT(chart, bounds, title, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue