当前位置: 首页>>代码示例>>Java>>正文


Java Shape类代码示例

本文整理汇总了Java中org.jzy3d.plot3d.primitives.Shape的典型用法代码示例。如果您正苦于以下问题:Java Shape类的具体用法?Java Shape怎么用?Java Shape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Shape类属于org.jzy3d.plot3d.primitives包,在下文中一共展示了Shape类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:sing-group,项目名称:la-images,代码行数:26,代码来源:ElementDataSurfaceAdapter.java

示例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;
}
 
开发者ID:gsi-upm,项目名称:BARMAS,代码行数:26,代码来源:Plotter.java

示例3: exportShape

import org.jzy3d.plot3d.primitives.Shape; //导入依赖的package包/类
/**
 * Exports a chart to a image file.
 * 
 * @param surface surface of the chart to export.
 * @param is3D whether the surface is 3D or not.
 * @param quality quality of the chart.
 * @param width width of the image generated.
 * @param height height of the image generated.
 * @param chartConfigurer function to configure the chart before exporting
 * it to a file. This function is called after the chart is created and
 * configured as a 2D chart and before the chart is exported to an image
 * file.
 * @param imageFile file where the image will be stored. The extension of
 * this file will determine the format of the image generated.
 * @throws IOException if an error happens while exporting the chart.
 */
public static void exportShape(
	Shape surface, boolean is3D, Quality quality,
	int width, int height,
	Consumer<Chart> chartConfigurer,
	File imageFile
) throws IOException {
	final Chart chart = 
		new Chart(getChartComponentFactory(is3D, width, height), quality);
	chart.getScene().getGraph().add(surface);

       final IAxeLayout axe = chart.getAxeLayout();
       axe.setZAxeLabelDisplayed(true);
       
       final View view = chart.getView();
       view.setViewPositionMode(ViewPositionMode.TOP);
       view.setSquared(true);
       view.getCamera().setViewportMode(ViewportMode.STRETCH_TO_FILL);

       adjustFontSize(view, width, height);

       chartConfigurer.accept(chart);

       chart.screenshot(imageFile);
       
       ImageIO.write(ImageIO.read(imageFile), "png", imageFile);
}
 
开发者ID:sing-group,项目名称:la-images,代码行数:43,代码来源:ShapeExporter.java

示例4: surface

import org.jzy3d.plot3d.primitives.Shape; //导入依赖的package包/类
protected Shape surface() {
    Mapper mapper = new Mapper() {
        public double f(double x, double y) {
            return x * Math.sin(x * y);
        }
    };
    Range range = new Range(-3, 3);
    int steps = 80;
    return surface(mapper, range, steps);
}
 
开发者ID:jzy3d,项目名称:bigpicture,代码行数:11,代码来源:SparkRDDChartBuilder.java

示例5: 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;
}
 
开发者ID:igd-iva,项目名称:colormap-explorer,代码行数:28,代码来源:ColormapShape.java

示例6: toPNG

import org.jzy3d.plot3d.primitives.Shape; //导入依赖的package包/类
@Override
public void toPNG(ElementData data, File file, ElementDataImageConfiguration configuration)
throws IOException {
	ElementData normalizedData = NormalizeElementData.normalize(data);
	
	ElementDataSurfaceAdapter surfaceAdapter = 
			new ElementDataSurfaceAdapter(normalizedData);
	final Shape surface = surfaceAdapter.generateSurface(
		configuration.getInterpolationLevel(),
		configuration.getColorMap(),
		normalizeColorMapRange(getColorMapRange(data, configuration), data),
		configuration.getScaleFunction()
	);
	
	ShapeExporter.exportShape(
		surface,
		configuration.is3D(),
		configuration.getQuality(),
		configuration.getWidth(),
		configuration.getHeight(),
		c -> {
			if (configuration.is3D()) {
				c.setViewMode(DEFAULT_3D_POSITION_MODE);
				c.setViewPoint(configuration.get3DViewPoint());
			} else if (configuration.is2DFreeMode()) {
					c.setViewMode(FREE_2D_POSITION_MODE);
					c.setViewPoint(configuration.get3DViewPoint());
				} else {
					c.setViewMode(DEFAULT_2D_POSITION_MODE);
				}
			c.setAxeDisplayed(configuration.isShowAxes());
			c.getAxeLayout().setTickLineDisplayed(configuration.isShowTickLines());
			c.getAxeLayout().setZAxeLabelDisplayed(configuration.is3D());
			c.getAxeLayout().setZTickLabelDisplayed(configuration.is3D());
			c.getView().setSquared(false);
			ITickRenderer tickRenderer = ElementDataViewConfiguration::formatAxeValue;
			c.getAxeLayout().setXTickRenderer(tickRenderer);
			c.getAxeLayout().setYTickRenderer(tickRenderer);
			c.getAxeLayout().setZTickRenderer( value -> 
				formatAxeValue(value * data.getMaxValue() / configuration.getScale())
			);
			if (configuration.isShowColorBarLegend()) {
				surface.setLegend(new AWTColorbarLegend(surface, c
						.getView().getAxe().getLayout()));
			}
		}, file
	);
}
 
开发者ID:sing-group,项目名称:la-images,代码行数:49,代码来源:DefaultElementDatasetToPngExporter.java

示例7: 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;
}
 
开发者ID:ThomasDaheim,项目名称:GPXEditor,代码行数:49,代码来源:SRTMDataViewer.java

示例8: getShape

import org.jzy3d.plot3d.primitives.Shape; //导入依赖的package包/类
Shape getShape()
{
    return shape;
}
 
开发者ID:igd-iva,项目名称:colormap-explorer,代码行数:5,代码来源:ColormapShape.java

示例9: 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!");
		}
	}
 
开发者ID:nilshoffmann,项目名称:netbeans-jogl2,代码行数:75,代码来源:Jzy3DDemoTopComponent.java


注:本文中的org.jzy3d.plot3d.primitives.Shape类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。