本文整理汇总了Java中org.jzy3d.plot3d.primitives.Shape.setColorMapper方法的典型用法代码示例。如果您正苦于以下问题:Java Shape.setColorMapper方法的具体用法?Java Shape.setColorMapper怎么用?Java Shape.setColorMapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jzy3d.plot3d.primitives.Shape
的用法示例。
在下文中一共展示了Shape.setColorMapper方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSurface
import org.jzy3d.plot3d.primitives.Shape; //导入方法依赖的package包/类
/**
* Generates a {@code Shape} to represent the data using the specified {@code interpolationLevel} and {@code colormap}.
*
* @param interpolationLevel an integer specifying the interpolation level to use.
* @param colorMap an {@code IColorMap} to configure the surface.
* @param colorMapRange a {@code Range} to create the surface color mapper.
* @param scale a {@code DoubleFunction<Double>} to scale the data.
* @return a new {@code Shape} with the surface for this data.
*/
public Shape generateSurface(int interpolationLevel, IColorMap colorMap,
Range colorMapRange, DoubleFunction<Double> scale
) {
final List<Coord3d> coords = dataToCoord3d(
scale(
scale,
interpolate(data, interpolationLevel)
)
);
final Shape surface = Builder.buildDelaunay(coords);
surface.setColorMapper(new ColorMapper(colorMap, colorMapRange));
surface.setFaceDisplayed(true);
surface.setWireframeDisplayed(false);
return surface;
}
示例2: getDelaunayChart
import org.jzy3d.plot3d.primitives.Shape; //导入方法依赖的package包/类
/**
* @param coordinates
* @return
*/
public Chart getDelaunayChart(List<Coord3d> coordinates) {
// Create the object to represent the function over the given range.
Shape surface = Builder.buildDelaunay(coordinates);
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(),
surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1,
0.75f)));
surface.setFaceDisplayed(true);
surface.setWireframeDisplayed(true);
AWTColorbarLegend legend = new AWTColorbarLegend(surface, new AxeBoxLayout());
surface.setLegend(legend);
// Create a chart
Chart chart = new Chart(this.factory, Quality.Nicest, "awt", Settings.getInstance()
.getGLCapabilities());
chart.setAxeDisplayed(true);
chart.getScene().getGraph().add(surface);
return chart;
}
示例3: createShape
import org.jzy3d.plot3d.primitives.Shape; //导入方法依赖的package包/类
private Shape createShape()
{
List<Polygon> polygons = new ArrayList<Polygon>();
for (int sx = 0; sx < stepsX; sx++)
{
for (int sy = 0; sy < stepsY; sy++)
{
polygons.add(createPolygon(sx, sy));
}
}
final Shape shp = new Shape(polygons);
ColorMapper colorMapper = new ColorMapper()
{
@Override
public org.jzy3d.colors.Color getColor(Coord3d c)
{
float rgb[] = cubeCoordinatesToRgbColorComponents.apply(new float[] { c.x, c.y, c.z });
return new org.jzy3d.colors.Color(rgb[0], rgb[1], rgb[2]);
}
};
shp.setColorMapper(colorMapper);
shp.setFaceDisplayed(true);
shp.setWireframeDisplayed(true);
shp.setWireframeColor(org.jzy3d.colors.Color.GRAY);
return shp;
}
示例4: getChartFromSRTMData
import org.jzy3d.plot3d.primitives.Shape; //导入方法依赖的package包/类
private AWTChart getChartFromSRTMData(final JavaFXChartFactory factory, final String toolkit, final SRTMData srtmData) {
// -------------------------------
// Define a function to plot
final Mapper mapper = new Mapper() {
@Override
public double f(double x, double y) {
final float height = Math.max(0f, srtmData.getValues()[(int) x][(int) y]);
return height;
}
};
// we don't want to plot the full set, only 1/10 of it
final int dataCount = srtmData.getKey().getValue().getDataCount();
final int steps = dataCount / 10;
// Define range and precision for the function to plot
final Range lonrange = new Range(0f, 1f*(dataCount-1));
final Range latrange = new Range(1f*(dataCount-1), 0f);
final OrthonormalGrid grid = new OrthonormalGrid(lonrange, steps, latrange, steps);
// Create the object to represent the function over the given range.
final Shape surface = Builder.buildOrthonormal(grid, mapper);
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
surface.setFaceDisplayed(true);
surface.setWireframeDisplayed(false);
// -------------------------------
// Create a chart
Quality quality = Quality.Nicest;
quality.setSmoothPolygon(true);
//quality.setAnimated(true);
// let factory bind mouse and keyboard controllers to JavaFX node
final AWTChart chart = (AWTChart) factory.newChart(quality, toolkit);
chart.getScene().getGraph().add(surface);
// and now for some beautifying
final String name = srtmData.getKey().getKey();
final String lat = name.substring(0, 3);
final String lon = name.substring(3, 7);
chart.getAxeLayout().setXAxeLabel( lat );
chart.getAxeLayout().setYAxeLabel( lon );
chart.getAxeLayout().setZAxeLabel( "m" );
chart.setViewMode(ViewPositionMode.FREE);
chart.setViewPoint(new Coord3d(0.05f, 1.1f, 4000f));
return chart;
}
示例5: createChart
import org.jzy3d.plot3d.primitives.Shape; //导入方法依赖的package包/类
private void createChart() {
if (chartCreated.compareAndSet(false, true)) {
System.out.println("Creating chart!");
Runnable worker = new Runnable() {
@Override
public void run() {
ProgressHandle ph = ProgressHandleFactory.createHandle("Opening Jzy3D View!");
ph.start();
ph.switchToIndeterminate();
try {
AWTChartComponentFactory accf = new AWTChartComponentFactory();
final Chart chart = accf.newChart(Quality.Advanced, Toolkit.newt.name());
chart.getView().setMaximized(true);
canvas = (CanvasNewtAwt) chart.getCanvas();
final CameraThreadController ctc = new CameraThreadController(chart);
//signature change in latest upstream jogl causes java.lang.NoSuchMethodError: com.jogamp.newt.event.MouseEvent.getClickCount()I
// NewtCameraMouseController camMouse = new NewtCameraMouseController(chart);
WorkaroundNewtCameraMouseController camMouse = new WorkaroundNewtCameraMouseController(chart);
// Create a surface drawing that function
// Define a function to plot
Mapper mapper = new Mapper() {
public double f(double x, double y) {
return 10 * Math.sin(x / 10) * Math.cos(y / 20) * x;
}
};
// Define range and precision for the function to plot
Range range = new Range(-150, 150);
int steps = 50;
Shape surface = Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper);
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
surface.setFaceDisplayed(true);
surface.setWireframeDisplayed(false);
surface.setWireframeColor(Color.BLACK);
chart.getScene().getGraph().add(surface, true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setChart(chart);
canvas.setMinimumSize(getMinimumSize());
canvas.setMaximumSize(getMaximumSize());
canvas.setPreferredSize(getPreferredSize());
add(canvas, BorderLayout.CENTER);
setCameraThreadController(ctc);
if (toggleAnimation.isSelected()) {
ctc.start();
}
//need to update complete component tree
invalidate();
getTopLevelAncestor().invalidate();
getTopLevelAncestor().revalidate();
}
});
} finally {
ph.finish();
}
}
};
Task t = RequestProcessor.getDefault().post(worker);
t.addTaskListener(new TaskListener() {
@Override
public void taskFinished(Task task) {
if (task.isFinished()) {
requestAttention(true);
}
}
});
} else {
System.out.println("Chart already created!");
}
}