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


Java CubicCurve类代码示例

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


CubicCurve类属于javafx.scene.shape包,在下文中一共展示了CubicCurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIconContent

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
public static Node createIconContent() {
    CubicCurve cubicCurve = new CubicCurve();
    cubicCurve.setStartX(0);
    cubicCurve.setStartY(50);
    cubicCurve.setControlX1(20);
    cubicCurve.setControlY1(0);
    cubicCurve.setControlX2(70);
    cubicCurve.setControlY2(100);
    cubicCurve.setEndX(80);
    cubicCurve.setEndY(50);
    cubicCurve.setStroke(Color.web("#b9c0c5"));
    cubicCurve.setStrokeWidth(5);
    cubicCurve.getStrokeDashArray().addAll(15d,15d);
    cubicCurve.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    cubicCurve.setEffect(effect);
    return cubicCurve;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:CubicCurveSample.java

示例2: createStartingCurve

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
/**
 * Creates the starting Bezier curve and its controls.
 * @return
 */
CubicCurve createStartingCurve() {
	curve = new CubicCurve();
	curve.setStartX(START_X);
	curve.setStartY(START_Y);
	curve.setControlX1(CONTROL_X1);
	curve.setControlY1(CONTROL_Y1);
	curve.setControlX2(CONTROL_X2);
	curve.setControlY2(CONTROL_Y2);
	curve.setEndX(END_X);
	curve.setEndY(END_Y);
	curve.setStroke(Color.CADETBLUE);
	curve.setStrokeWidth(WIDTH);
	curve.setStrokeLineCap(StrokeLineCap.ROUND);
	curve.setFill(Color.CORNSILK.deriveColor(0, SATURATION_FACTOR, 1, OPACITY_FACTOR));
	this.getChildren().add(curve);
	return curve;
}
 
开发者ID:sjain28,项目名称:Game-Engine-Vooga,代码行数:22,代码来源:BezierCurve.java

示例3: getBezierYOffset

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
/** Returns the current bezier offset based on the current start and end positions. */
private static double getBezierYOffset(CubicCurve wire) {
    double distX = Math.abs(wire.getEndX() - wire.getStartX())/3;
    double diffY = wire.getEndY() - wire.getStartY();
    double distY = diffY > 0 ? diffY/2 : Math.max(0, -diffY-10); 
    if (distY < BEZIER_CONTROL_OFFSET) {
        if (distX < BEZIER_CONTROL_OFFSET) {
            // short lines are extra flexible
            return Math.max(1, Math.max(distX, distY));
        } else {
            return BEZIER_CONTROL_OFFSET;
        }
    } else {
        return Math.cbrt(distY / BEZIER_CONTROL_OFFSET) * BEZIER_CONTROL_OFFSET;
    }
}
 
开发者ID:viskell,项目名称:viskell,代码行数:17,代码来源:Connection.java

示例4: convertCubicCurve

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
public static String convertCubicCurve(final CubicCurve CUBIC_CURVE) {
	final StringBuilder fxPath = new StringBuilder();
	fxPath
			.append("M ")
			.append(CUBIC_CURVE.getStartX())
			.append(" ")
			.append(CUBIC_CURVE.getStartY())
			.append(" ")
			.append("C ")
			.append(CUBIC_CURVE.getControlX1())
			.append(" ")
			.append(CUBIC_CURVE.getControlY1())
			.append(" ")
			.append(CUBIC_CURVE.getControlX2())
			.append(" ")
			.append(CUBIC_CURVE.getControlY2())
			.append(" ")
			.append(CUBIC_CURVE.getEndX())
			.append(" ")
			.append(CUBIC_CURVE.getEndY());
	return fxPath.toString();
}
 
开发者ID:stefaneidelloth,项目名称:JavaFxNodeToSvg,代码行数:23,代码来源:ShapeConverter.java

示例5: CubicCurveSample

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
public CubicCurveSample() {
    super(180,90);
    // Create cubicCurve shape
    CubicCurve cubicCurve = new CubicCurve();
    cubicCurve.setStartX(0);
    cubicCurve.setStartY(45);
    cubicCurve.setControlX1(30);
    cubicCurve.setControlY1(10);
    cubicCurve.setControlX2(150);
    cubicCurve.setControlY2(80);
    cubicCurve.setEndX(180);
    cubicCurve.setEndY(45);
    cubicCurve.setStroke(Color.RED);
    cubicCurve.setFill(Color.ROSYBROWN);
    cubicCurve.setStrokeWidth(2d);

    // show the cubicCurve shape;
    getChildren().add(cubicCurve);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Cubic Curve Fill", cubicCurve.fillProperty()),
            new SimplePropertySheet.PropDesc("Cubic Curve Stroke", cubicCurve.strokeProperty()),
            new SimplePropertySheet.PropDesc("Cubic Curve Start X", cubicCurve.startXProperty(), 0d, 170d),
            new SimplePropertySheet.PropDesc("Cubic Curve Start Y", cubicCurve.startYProperty(), 10d, 80d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control X1", cubicCurve.controlX1Property(), 0d, 180d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control Y1", cubicCurve.controlY1Property(), 0d, 90d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control X2", cubicCurve.controlX2Property(), 0d, 180d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control Y2", cubicCurve.controlY2Property(), 0d, 90d),
            new SimplePropertySheet.PropDesc("Cubic Curve End X", cubicCurve.endXProperty(), 10d, 180d),
            new SimplePropertySheet.PropDesc("Cubic Curve End Y", cubicCurve.endYProperty(), 10d, 80d)
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:34,代码来源:CubicCurveSample.java

示例6: updateBezierControlPoints

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
/** Updates the Bezier offset (curviness) according to the current start and end positions. */
protected static void updateBezierControlPoints(CubicCurve wire) {
    double yOffset = getBezierYOffset(wire);
    wire.setControlX1(wire.getStartX());
    wire.setControlY1(wire.getStartY() + yOffset);
    wire.setControlX2(wire.getEndX());
    wire.setControlY2(wire.getEndY() - yOffset);
}
 
开发者ID:viskell,项目名称:viskell,代码行数:9,代码来源:Connection.java

示例7: shapeToSvgString

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
public static String shapeToSvgString(final Shape SHAPE) {
    final StringBuilder fxPath = new StringBuilder();
    if (Line.class.equals(SHAPE.getClass())) {
        fxPath.append(convertLine((Line) SHAPE));
    } else if (Arc.class.equals(SHAPE.getClass())) {
        fxPath.append(convertArc((Arc) SHAPE));
    } else if (QuadCurve.class.equals(SHAPE.getClass())) {
        fxPath.append(convertQuadCurve((QuadCurve) SHAPE));
    } else if (CubicCurve.class.equals(SHAPE.getClass())) {
        fxPath.append(convertCubicCurve((CubicCurve) SHAPE));
    } else if (Rectangle.class.equals(SHAPE.getClass())) {
        fxPath.append(convertRectangle((Rectangle) SHAPE));
    } else if (Circle.class.equals(SHAPE.getClass())) {
        fxPath.append(convertCircle((Circle) SHAPE));
    } else if (Ellipse.class.equals(SHAPE.getClass())) {
        fxPath.append(convertEllipse((Ellipse) SHAPE));
    } else if (Text.class.equals(SHAPE.getClass())) {
        Path path = (Path)(Shape.subtract(SHAPE, new Rectangle(0, 0)));
        fxPath.append(convertPath(path));
    } else if (Path.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPath((Path) SHAPE));
    } else if (Polygon.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPolygon((Polygon) SHAPE));
    } else if (Polyline.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPolyline((Polyline) SHAPE));
    } else if (SVGPath.class.equals(SHAPE.getClass())) {
        fxPath.append(((SVGPath) SHAPE).getContent());
    }
    return fxPath.toString();
}
 
开发者ID:Simego,项目名称:FXImgurUploader,代码行数:31,代码来源:ShapeConverter.java

示例8: convertCubicCurve

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
public static String convertCubicCurve(final CubicCurve CUBIC_CURVE) {
    final StringBuilder fxPath = new StringBuilder();
    fxPath.append("M ").append(CUBIC_CURVE.getStartX()).append(" ").append(CUBIC_CURVE.getStartY()).append(" ")
          .append("C ").append(CUBIC_CURVE.getControlX1()).append(" ").append(CUBIC_CURVE.getControlY1()).append(" ")
          .append(CUBIC_CURVE.getControlX2()).append(" ").append(CUBIC_CURVE.getControlY2()).append(" ")
          .append(CUBIC_CURVE.getEndX()).append(" ").append(CUBIC_CURVE.getEndY());
    return fxPath.toString();
}
 
开发者ID:Simego,项目名称:FXImgurUploader,代码行数:9,代码来源:ShapeConverter.java

示例9: testGetCubicCurveAdjuster

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
@Test
public void testGetCubicCurveAdjuster() {
	Adjuster adjuster = Adjuster.getAdjuster(CubicCurve.class);
	
	assertThat(adjuster, is(instanceOf(CubicCurveAdjuster.class)));
	assertThat(adjuster.getNodeClass(), is(sameInstance(CubicCurve.class)));
}
 
开发者ID:yumix,项目名称:javafx-dpi-scaling,代码行数:8,代码来源:AdjusterTest.java

示例10: setupLine

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
/**
 * setupLine. This method is invoked whenever a line is being
 * created. Both the coordinates and the event are set here.
 * @return Returns the line created.
 */
public CubicCurve setupLine()
{
    /* Appropriate circle. */
    Circle io = (nodeBoxSource == null) ? nodeBoxTarget.getNode().getInput()
            : nodeBoxSource.getNode().getOutput();

    /* Calculate the coordinates. */
    Coordinates coordinates = new Coordinates();
    Bounds bounds = io.localToScene( io.getBoundsInLocal() );
    coordinates.setX( (bounds.getMinX() + (bounds.getWidth()  / 2)) - 50 );
    coordinates.setY(  bounds.getMinY() + (bounds.getHeight() / 2)       );

    /* Create the line and setup the properties. */
    line = new CubicCurve();
    line.setFill(Color.TRANSPARENT);
    line.setStartX   ( coordinates.getX() );
    line.setStartY   ( coordinates.getY() );
    line.setControlX1( coordinates.getX() );
    line.setControlX2( coordinates.getX() );
    line.setControlY1( coordinates.getY() );
    line.setControlY2( coordinates.getY() );
    line.setEndX     ( coordinates.getX() );
    line.setEndY     ( coordinates.getY() );
    line.setStroke(Color.GREENYELLOW);
    line.setStrokeWidth(2);

    /*
     * Setup the mouse move event for the line, note
     * that we are using the workspace to handle the
     * event, since we need track the workspace.
     */
    filter = new EventHandler<MouseEvent>() {
        private Edge.IO io = Edge.this.lastConnection;

        @Override
        public void handle(MouseEvent event) {
            /* There's a line being created. */
            if (NodeBoxController.connAcc){
                double diff = Math.abs (Edge.this.line.getEndX() - Edge.this.line.getStartX());
                diff = (diff * 0.4);

                if (io.equals(IO.Input))
                    diff *= -1;

                Edge.this.line.setControlX1( Edge.this.line.getStartX() + diff );
                Edge.this.line.setControlY1( Edge.this.line.getStartY() );
                Edge.this.line.setControlX2( Edge.this.line.getEndX  () - diff );
                Edge.this.line.setControlY2( Edge.this.line.getEndY  () );

                Edge.this.line.setEndX( event.getX() );
                Edge.this.line.setEndY( event.getY() );
            }

            /* Consume event. */
            event.consume();
        }
    };

    /* Adds the event filter. */
    MainController.getInstance().getCurrentWorkspace().addEventFilter(MouseEvent.MOUSE_MOVED, filter);
    return line;
}
 
开发者ID:Theldus,项目名称:PSE,代码行数:68,代码来源:Edge.java

示例11: getXControls

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
/**
 * Returns the relevant X controls for a Cubic Curve.
 */
@Override
public Double[] getXControls() {
	return new Double[] {((CubicCurve) myShape).getStartX(), ((CubicCurve) myShape).getControlX1(), ((CubicCurve) myShape).getControlX2(), ((CubicCurve) myShape).getEndX()};
}
 
开发者ID:sjain28,项目名称:Game-Engine-Vooga,代码行数:8,代码来源:CubicCurvePath.java

示例12: getYControls

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
/**
 * Returns the relevant Y controls for a Cubic Curve.
 */
@Override
public Double[] getYControls() {
	return new Double[] {((CubicCurve) myShape).getStartY(), ((CubicCurve) myShape).getControlY1(), ((CubicCurve) myShape).getControlY2(), ((CubicCurve) myShape).getEndY()};
}
 
开发者ID:sjain28,项目名称:Game-Engine-Vooga,代码行数:8,代码来源:CubicCurvePath.java

示例13: setType

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
public void setType (DragIconType type) {
	
	mType = type;
	
	getStyleClass().clear();
	getStyleClass().add("dragicon");
	
	//added because the cubic curve will persist into other icons
	if (this.getChildren().size() > 0)
		getChildren().clear();
	
	switch (mType) {
	
	case cubic_curve:
		getStyleClass().add("icon-yellow");
		
		Pane  pane = new Pane();
		
		pane.setPrefWidth(64.0);
		pane.setPrefHeight(64.0);
		//pane.getStyleClass().add("icon-blue");
		pane.setLayoutX(0.0);
		pane.setLayoutY(0.0);
		
		CubicCurve curve = new CubicCurve();
		
		curve.setStartX(10.0);
		curve.setStartY(20.0);
		curve.setEndX(54.0);
		curve.setEndY(44.0);
		curve.setControlX1(64.0);
		curve.setControlY1(20.0);
		curve.setControlX2(0.0);
		curve.setControlY2(44.0);
		curve.getStyleClass().add("cubic-icon");
		
		pane.getChildren().add(curve);
		
		//r//oot_pane.
		getChildren().add(pane);
		
	break;
	
	case blue:
		getStyleClass().add("icon-blue");
	break;

	case red:
		getStyleClass().add("icon-red");			
	break;

	case green:
		getStyleClass().add("icon-green");
	break;

	case grey:
		getStyleClass().add("icon-grey");
	break;

	case purple:
		getStyleClass().add("icon-purple");
	break;

	case yellow:
		getStyleClass().add("icon-yellow");
	break;

	case black:
		getStyleClass().add("icon-black");
	break;
	
	default:
	break;
	}
}
 
开发者ID:graffy76,项目名称:java_fx_node_link_demo,代码行数:76,代码来源:DragIcon.java

示例14: lengthSquared

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
protected static double lengthSquared(CubicCurve wire) {
    double diffX = wire.getStartX() - wire.getEndX();
    double diffY = wire.getStartY() - wire.getEndY();
    return diffX*diffX + diffY*diffY;
}
 
开发者ID:viskell,项目名称:viskell,代码行数:6,代码来源:Connection.java

示例15: getNodeClass

import javafx.scene.shape.CubicCurve; //导入依赖的package包/类
@Override
public Class<? extends Node> getNodeClass() {
	return CubicCurve.class;
}
 
开发者ID:yumix,项目名称:javafx-dpi-scaling,代码行数:5,代码来源:CubicCurveAdjuster.java


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