This commit is contained in:
Martin Pernollet 2017-06-24 17:15:40 +02:00
parent 4ab0b21a5c
commit 89ef2db229
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package org.jzy3d.plot3d.primitives;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.IColorMap;
import org.jzy3d.maths.Range;
import org.jzy3d.plot3d.builder.Builder;
import org.jzy3d.plot3d.builder.Mapper;
public class Surface {
public static Shape shape(Mapper f1, Range range, int steps, IColorMap colormap) {
final Shape surface = Builder.buildOrthonormal(f1, range, steps);
surface.setColorMapper(new ColorMapper(colormap, surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
surface.setFaceDisplayed(true);
surface.setWireframeDisplayed(false);
return surface;
}
}

View File

@ -2,7 +2,11 @@ package org.jzy3d.chart;
import org.jzy3d.chart.factories.AWTChartComponentFactory;
import org.jzy3d.chart.factories.IChartComponentFactory;
import org.jzy3d.maths.Dimension;
import org.jzy3d.plot3d.primitives.AbstractDrawable;
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
import org.jzy3d.plot3d.rendering.canvas.Quality;
import org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend;
import org.jzy3d.plot3d.rendering.view.AWTView;
import org.jzy3d.plot3d.rendering.view.Renderer2d;
@ -49,4 +53,19 @@ public class AWTChart extends Chart {
public AWTView getAWTView() {
return (AWTView) view;
}
public AWTColorbarLegend colorbar(AbstractDrawable drawable){
return colorbar(drawable, new Dimension(100, 600), getView().getAxe().getLayout());
}
public AWTColorbarLegend colorbar(AbstractDrawable drawable, IAxeLayout layout){
return colorbar(drawable, new Dimension(100, 600), layout);
}
public AWTColorbarLegend colorbar(AbstractDrawable drawable, Dimension d, IAxeLayout layout){
AWTColorbarLegend cbar = new AWTColorbarLegend(drawable, layout);
cbar.setMinimumSize(d);
drawable.setLegend(cbar);
return cbar;
}
}