mirror of https://github.com/rusefi/jzy3d-api.git
add series to factory
This commit is contained in:
parent
0cb5123c82
commit
c9b666fab7
|
@ -24,6 +24,10 @@ import org.jzy3d.maths.BoundingBox3d;
|
|||
import org.jzy3d.maths.Coord3d;
|
||||
import org.jzy3d.maths.Rectangle;
|
||||
import org.jzy3d.maths.Utils;
|
||||
import org.jzy3d.plot2d.primitives.LineSerie2d;
|
||||
import org.jzy3d.plot2d.primitives.ScatterPointSerie2d;
|
||||
import org.jzy3d.plot2d.primitives.ScatterSerie2d;
|
||||
import org.jzy3d.plot2d.primitives.Serie2d;
|
||||
import org.jzy3d.plot3d.primitives.axes.AxeBase;
|
||||
import org.jzy3d.plot3d.primitives.axes.IAxe;
|
||||
import org.jzy3d.plot3d.rendering.canvas.CanvasNewtAwt;
|
||||
|
@ -105,6 +109,18 @@ public class ChartComponentFactory implements IChartComponentFactory {
|
|||
public AbstractOrderingStrategy newOrderingStrategy() {
|
||||
return new BarycentreOrderingStrategy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serie2d newSerie(String name, Serie2d.Type type) {
|
||||
if (Serie2d.Type.LINE.equals(type))
|
||||
return new LineSerie2d(name);
|
||||
else if (Serie2d.Type.SCATTER.equals(type))
|
||||
return new ScatterSerie2d(name);
|
||||
else if (Serie2d.Type.SCATTER_POINTS.equals(type))
|
||||
return new ScatterPointSerie2d(name);
|
||||
else
|
||||
throw new IllegalArgumentException("Unsupported serie type " + type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICameraMouseController newMouseController(Chart chart) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
|
|||
import org.jzy3d.maths.BoundingBox3d;
|
||||
import org.jzy3d.maths.Coord3d;
|
||||
import org.jzy3d.maths.Rectangle;
|
||||
import org.jzy3d.plot2d.primitives.Serie2d;
|
||||
import org.jzy3d.plot3d.primitives.axes.IAxe;
|
||||
import org.jzy3d.plot3d.rendering.canvas.ICanvas;
|
||||
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||
|
@ -43,6 +44,8 @@ public interface IChartComponentFactory {
|
|||
public IFrame newFrame(Chart chart, Rectangle bounds, String title);
|
||||
public IViewportLayout newViewportLayout();
|
||||
|
||||
public Serie2d newSerie(String name, Serie2d.Type type);
|
||||
|
||||
public static enum Toolkit {
|
||||
awt, swing, newt, offscreen
|
||||
};
|
||||
|
|
|
@ -74,7 +74,8 @@ public class AxeBox2d extends AxeBox {
|
|||
// doTransform(gl);
|
||||
labelBounds = txt.drawText(gl, glu, cam, axeLabel, labelPosition, Halign.CENTER, Valign.CENTER, color);
|
||||
} else if (isYDisplayed(direction)) {
|
||||
labelBounds = txtRotation.drawText(gl, glu, cam, axeLabel, labelPosition, Halign.CENTER, Valign.CENTER, color);
|
||||
labelBounds = txt.drawText(gl, glu, cam, axeLabel, labelPosition, Halign.CENTER, Valign.CENTER, color);
|
||||
//labelBounds = txtRotation.drawText(gl, glu, cam, axeLabel, labelPosition, Halign.CENTER, Valign.CENTER, color);
|
||||
}
|
||||
if (labelBounds != null)
|
||||
ticksTxtBounds.add(labelBounds);
|
||||
|
@ -86,6 +87,8 @@ public class AxeBox2d extends AxeBox {
|
|||
|
||||
protected RotatedTextBitmapRenderer txtRotation = new RotatedTextBitmapRenderer();
|
||||
|
||||
/* ROTATED TEXT BITMAP RENDERER NOT WORKING PROPERLY */
|
||||
|
||||
public class RotatedTextBitmapRenderer extends TextBitmapRenderer {
|
||||
@Override
|
||||
public BoundingBox3d drawText(GL gl, GLU glu, Camera cam, String text, Coord3d position, Halign halign, Valign valign, Color color, Coord2d screenOffset,
|
||||
|
@ -107,9 +110,10 @@ public class AxeBox2d extends AxeBox {
|
|||
return new BoundingBox3d();
|
||||
}
|
||||
|
||||
// Draws actual string
|
||||
rotateText(gl, posReal);
|
||||
|
||||
// Draws actual string <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
rotateText(gl, posReal); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
// CETTE ROTATION NE MARCHE PAS ET AFFECTE LE BON RENDU QUAND ON UTILISE BOUNDING POLICY!!
|
||||
|
||||
glRasterPos(gl, sceneOffset, Coord3d.ORIGIN);
|
||||
glut.glutBitmapString(font, text);
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Chart2d extends AWTChart {
|
|||
public Serie2d getSerie(String name, Serie2d.Type type) {
|
||||
Serie2d serie = null;
|
||||
if (!series.keySet().contains(name)) {
|
||||
serie = newSerie(name, type, serie);
|
||||
serie = factory.newSerie(name, type);
|
||||
addDrawable(serie.getDrawable());
|
||||
} else {
|
||||
serie = series.get(name);
|
||||
|
@ -81,18 +81,6 @@ public class Chart2d extends AWTChart {
|
|||
return serie;
|
||||
}
|
||||
|
||||
public Serie2d newSerie(String name, Serie2d.Type type, Serie2d serie) {
|
||||
if (Serie2d.Type.LINE.equals(type))
|
||||
serie = new LineSerie2d(name);
|
||||
else if (Serie2d.Type.SCATTER.equals(type))
|
||||
serie = new ScatterSerie2d(name);
|
||||
else if (Serie2d.Type.SCATTER_POINTS.equals(type))
|
||||
serie = new ScatterPointSerie2d(name);
|
||||
else
|
||||
throw new IllegalArgumentException("Unsupported serie type " + type);
|
||||
return serie;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
public Chart2d(IChartComponentFactory factory, Quality quality, String windowingToolkit, GLCapabilities capabilities) {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package org.jzy3d.maths;
|
||||
|
||||
import org.jzy3d.maths.BoundingBox3d;
|
||||
|
||||
public interface IBoundingPolicy {
|
||||
public abstract BoundingBox3d apply(BoundingBox3d box);
|
||||
}
|
|
@ -1085,9 +1085,9 @@ public class AxeBox implements IAxe {
|
|||
|
||||
protected boolean quadIsHidden[];
|
||||
|
||||
protected static final int AXE_X = 0;
|
||||
protected static final int AXE_Y = 1;
|
||||
protected static final int AXE_Z = 2;
|
||||
public static final int AXE_X = 0;
|
||||
public static final int AXE_Y = 1;
|
||||
public static final int AXE_Z = 2;
|
||||
|
||||
protected List<AxeAnnotation> annotations = new ArrayList<AxeAnnotation>();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue