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


Java CubicCurve2D.setCurve方法代码示例

本文整理汇总了Java中java.awt.geom.CubicCurve2D.setCurve方法的典型用法代码示例。如果您正苦于以下问题:Java CubicCurve2D.setCurve方法的具体用法?Java CubicCurve2D.setCurve怎么用?Java CubicCurve2D.setCurve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.CubicCurve2D的用法示例。


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

示例1: getRegiaoDocumento

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public Shape getRegiaoDocumento() {
    if (Regiao == null) {
        final int v1 = getHeight() / 3;
        final int h1 = getWidth() / 2;
        final int repo = v1 / 3;
        final int L = getLeft();
        final int T = getTop();
        final int TH = T + getHeight() - repo;
        final int LW = L + getWidth();
        CubicCurve2D c = new CubicCurve2D.Double();
        c.setCurve(L, TH, L + h1, TH + v1, LW - h1, TH - v1, LW, TH);
        GeneralPath pa = new GeneralPath();

        pa.moveTo(LW, TH);
        pa.lineTo(LW, T);
        pa.lineTo(L, T);
        pa.lineTo(L, TH);
        pa.append(c, true);
        Regiao = pa;
        final int ptToMove = 3;
        this.reposicionePonto[ptToMove] = new Point(0, -repo);
        ptsToMove[ptToMove] = 1;
    }
    return Regiao;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:26,代码来源:LivreBase.java

示例2: getRegiao

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
@Override
public Shape getRegiao() {
    if (Regiao == null) {
        final int v1 = getHeight() / 3;
        final int h1 = getWidth() / 2;
        final int repo = v1 / 3;
        final int L = getLeft();
        final int T = getTop();
        final int TH = T + getHeight() - repo;
        final int LW = L + getWidth();
        CubicCurve2D c = new CubicCurve2D.Double();
        c.setCurve(L, TH, L + h1, TH + v1, LW - h1, TH - v1, LW, TH);
        GeneralPath pa = new GeneralPath();

        pa.moveTo(LW, TH);
        pa.lineTo(LW, T);
        pa.lineTo(L, T);
        pa.lineTo(L, TH);
        pa.append(c, true);
        Regiao = pa;
        setReposicionePontoAbaixo(new Point(0, -repo));        
        ptsToMove[ptToMove] = 1;
    }
    return Regiao;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:26,代码来源:FluxDocumento.java

示例3: subdivide

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
private static void subdivide(CubicCurve2D src, CubicCurve2D left, CubicCurve2D right, final double coef) {
	final double coef1 = coef;
	final double coef2 = 1 - coef;
	final double centerxA = src.getCtrlX1() * coef1 + src.getCtrlX2() * coef2;
	final double centeryA = src.getCtrlY1() * coef1 + src.getCtrlY2() * coef2;

	final double x1 = src.getX1();
	final double y1 = src.getY1();
	final double x2 = src.getX2();
	final double y2 = src.getY2();
	final double ctrlx1 = x1 * coef1 + src.getCtrlX1() * coef1;
	final double ctrly1 = y1 * coef1 + src.getCtrlY1() * coef1;
	final double ctrlx2 = x2 * coef1 + src.getCtrlX2() * coef1;
	final double ctrly2 = y2 * coef1 + src.getCtrlY2() * coef1;

	final double ctrlx12 = ctrlx1 * coef1 + centerxA * coef1;
	final double ctrly12 = ctrly1 * coef1 + centeryA * coef1;
	final double ctrlx21 = ctrlx2 * coef1 + centerxA * coef1;
	final double ctrly21 = ctrly2 * coef1 + centeryA * coef1;
	final double centerxB = ctrlx12 * coef1 + ctrlx21 * coef1;
	final double centeryB = ctrly12 * coef1 + ctrly21 * coef1;
	left.setCurve(x1, y1, ctrlx1, ctrly1, ctrlx12, ctrly12, centerxB, centeryB);
	right.setCurve(centerxB, centeryB, ctrlx21, ctrly21, ctrlx2, ctrly2, x2, y2);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:25,代码来源:BezierUtils.java

示例4: runTest

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public void runTest(Object ctx, int numReps) {
    FillCubics.Context cctx = (FillCubics.Context) ctx;
    int size = cctx.size;
    // Note: 2x2 ends up hitting exactly 1 pixel...
    if (size < 2) size = 2;
    int x = cctx.initX;
    int y = cctx.initY;
    int cpoffset = (int) (size/relYmax/2);
    CubicCurve2D curve = cctx.curve;
    Graphics2D g2d = (Graphics2D) cctx.graphics;
    g2d.translate(cctx.orgX, cctx.orgY);
    Color rCArray[] = cctx.colorlist;
    int ci = cctx.colorindex;
    do {
        curve.setCurve(x, y+size/2.0,
                       x+size/2.0, y+size/2.0-cpoffset,
                       x+size/2.0, y+size/2.0+cpoffset,
                       x+size, y+size/2.0);

        if (rCArray != null) {
            g2d.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
        }
        g2d.fill(curve);
        if ((x -= 3) < 0) x += cctx.maxX;
        if ((y -= 1) < 0) y += cctx.maxY;
    } while (--numReps > 0);
    cctx.colorindex = ci;
    g2d.translate(-cctx.orgX, -cctx.orgY);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:RenderTests.java

示例5: getRegiaoNota

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public Shape getRegiaoNota() {
    if (Regiao == null) {
        final int v1 = getHeight() / 3;
        final int h1 = getWidth() / 2;
        final int repo = v1 / 3;
        final int L = getLeft();
        final int T = getTop();
        final int TH = T + getHeight() - repo;
        final int LW = L + getWidth();
        CubicCurve2D c = new CubicCurve2D.Double();
        c.setCurve(LW, TH, LW - h1, TH - v1, L + h1, TH + v1, L, TH);
        CubicCurve2D c2 = new CubicCurve2D.Double();
        int v2 = v1 / 3;
        c2.setCurve(L, T + v2, L + h1, T + v1 + v2, LW - h1, T - v1 + v2, LW, T + v2);

        GeneralPath pa = new GeneralPath();
        pa.setWindingRule(GeneralPath.WIND_EVEN_ODD);
        pa.append(c2, true);
        pa.lineTo(LW, TH);
        pa.append(c, true);
        pa.lineTo(L,  T + v2);
        pa.closePath();

        Regiao = pa;
        int ptToMove = 3;
        this.reposicionePonto[ptToMove] = new Point(0, -repo);
        ptsToMove[ptToMove] = 1;
        ptToMove = 1;
        this.reposicionePonto[ptToMove] = new Point(0, repo);
        ptsToMove[ptToMove] = 1;
    }
    return Regiao;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:34,代码来源:LivreBase.java

示例6: getRegiao

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
@Override
public Shape getRegiao() {
    if (Regiao == null) {
        final int v1 = getHeight() / 3;
        final int h1 = getWidth() / 2;
        final int repo = v1 / 3;
        final int L = getLeft();
        final int T = getTop();
        final int TH = T + getHeight() - repo;
        final int LW = L + getWidth();

        CubicCurve2D c = new CubicCurve2D.Double();
        c.setCurve(LW, TH, LW - h1, TH - v1, L + h1, TH + v1, L, TH);
        CubicCurve2D c2 = new CubicCurve2D.Double();
        int v2 = v1 / 3;
        c2.setCurve(L, T + v2, L + h1, T + v1 + v2, LW - h1, T - v1 + v2, LW, T + v2);

        GeneralPath pa = new GeneralPath();
        pa.setWindingRule(GeneralPath.WIND_EVEN_ODD);
        pa.append(c2, true);
        pa.lineTo(LW, TH);
        pa.append(c, true);
        pa.lineTo(L,  T + v2);
        pa.closePath();
        
        Regiao = pa;
        int ptToMove = 3;
        this.reposicionePonto[ptToMove] = new Point(0, -repo);
        ptsToMove[ptToMove] = 1;
        ptToMove = 1;
        this.reposicionePonto[ptToMove] = new Point(0, repo);
        ptsToMove[ptToMove] = 1;
    }
    return Regiao;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:36,代码来源:FluxNota.java

示例7: getPartialCurve

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
private CubicCurve2D getPartialCurve(double tStart, double tEnd) {
    CubicCurve2D fullCurve = new CubicCurve2D.Double();
    fullCurve.setCurve(connectionInfo.getFirstCenter(), cp1.getPosition(), cp2.getPosition(), connectionInfo.getSecondCenter());

    CurveSplitResult firstSplit = Geometry.splitCubicCurve(fullCurve, tStart);
    CurveSplitResult secondSplit = Geometry.splitCubicCurve(firstSplit.curve2, (tEnd - tStart) / (1 - tStart));

    return secondSplit.curve1;
}
 
开发者ID:workcraft,项目名称:workcraft,代码行数:10,代码来源:Bezier.java

示例8: paintEdges

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
protected void paintEdges(Graphics g, Tree parent) {
	if (!getTree().isLeaf(parent)) {
           BasicStroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
                   BasicStroke.JOIN_ROUND);
           ((Graphics2D)g).setStroke(stroke);

		Rectangle2D.Double parentBounds = getBoundsOfNode(parent);
		double x1 = parentBounds.getCenterX();
		double y1 = parentBounds.getMaxY();
		for (Tree child : getTree().getChildren(parent)) {
			Rectangle2D.Double childBounds = getBoundsOfNode(child);
			double x2 = childBounds.getCenterX();
			double y2 = childBounds.getMinY();
			if (getUseCurvedEdges()) {
				CubicCurve2D c = new CubicCurve2D.Double();
				double ctrlx1 = x1;
				double ctrly1 = (y1+y2)/2;
				double ctrlx2 = x2;
				double ctrly2 = y1;
				c.setCurve(x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2);
				((Graphics2D) g).draw(c);
			} else {
				g.drawLine((int) x1, (int) y1,
						   (int) x2, (int) y2);
			}
			paintEdges(g, child);
		}
	}
}
 
开发者ID:antlr,项目名称:codebuff,代码行数:30,代码来源:TreeViewer.java

示例9: draw

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
@Override
public void draw(Graphics g) {
    Graphics2D g2d = (Graphics2D)g;
    CubicCurve2D c = new CubicCurve2D.Double();
    c.setCurve(
            (int)start.getX(), (int)start.getY(),
            (int)cp1.getX(), (int)cp1.getY(),
            (int)cp2.getX(), (int)cp2.getY(),
            (int)end.getX(), (int)end.getY());
    g2d.setColor(Color.magenta);
    g2d.draw(c);
}
 
开发者ID:TW2,项目名称:dotREVO,代码行数:13,代码来源:Bezier.java

示例10: drawConcentric

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public void drawConcentric(Graphics g) {
    Graphics2D g2d = (Graphics2D)g;
    CubicCurve2D c = new CubicCurve2D.Double();
    c.setCurve(
            (int)start.getX(), (int)start.getY(),
            (int)cp1.getX(), (int)cp1.getY(),
            (int)cp2.getX(), (int)cp2.getY(),
            (int)end.getX(), (int)end.getY());
    g2d.setColor(Color.black);
    g2d.draw(c);
}
 
开发者ID:TW2,项目名称:dotREVO,代码行数:12,代码来源:Bezier.java

示例11: getRegiaoVDocumentos

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public Shape getRegiaoVDocumentos() {
    if (Regiao == null) {
        final int v1 = getHeight() / 3;
        final int h1 = getWidth() / 2;
        final int repo = v1 / 3;
        final int L = getLeft();
        int recuo = h1 / 8;
        final int T = getTop() + recuo;
        final int TH = T + getHeight() - repo - recuo;
        final int LW = L + getWidth() - recuo;
        CubicCurve2D c = new CubicCurve2D.Double();
        c.setCurve(L, TH, L + h1, TH + v1, LW - h1, TH - v1, LW, TH);
        GeneralPath pa = new GeneralPath();
        pa.setWindingRule(GeneralPath.WIND_EVEN_ODD);

        pa.moveTo(LW, TH);
        pa.lineTo(LW, T);
        pa.lineTo(L, T);
        pa.lineTo(L, TH);
        pa.append(c, false);

        int tam = recuo / 2;

        pa.moveTo(L + tam, T);
        pa.lineTo(L + tam, T - tam);
        pa.lineTo(LW + tam, T - tam);
        pa.lineTo(LW + tam, TH - tam);
        pa.lineTo(LW, TH - tam);
        pa.lineTo(LW, T);
        pa.lineTo(L + tam, T);

        tam = recuo;

        pa.moveTo(L + tam, T - (tam / 2));
        pa.lineTo(L + tam, T - tam);
        pa.lineTo(LW + tam, T - tam);
        pa.lineTo(LW + tam, TH - tam);
        pa.lineTo(LW + (tam / 2), TH - tam);
        pa.lineTo(LW + (tam / 2), T - (tam / 2));
        pa.lineTo(L + tam, T - (tam / 2));

        pa.closePath();

        Regiao = pa;
        final int ptToMove = 3;
        this.reposicionePonto[ptToMove] = new Point(-tam / 2, -repo);
        ptsToMove[ptToMove] = 1;
    }
    return Regiao;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:51,代码来源:LivreBase.java

示例12: getRegiao

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
@Override
public Shape getRegiao() {
    if (Regiao == null) {
        final int v1 = getHeight() / 3;
        final int h1 = getWidth() / 2;
        final int repo = v1 / 3;
        final int L = getLeft();
        int recuo = h1/8;
        final int T = getTop() + recuo;
        final int TH = T + getHeight() - repo -recuo;
        final int LW = L + getWidth() -recuo;
        CubicCurve2D c = new CubicCurve2D.Double();
        c.setCurve(L, TH, L + h1, TH + v1, LW - h1, TH - v1, LW, TH);
        GeneralPath pa = new GeneralPath();
        pa.setWindingRule(GeneralPath.WIND_EVEN_ODD);
        
        pa.moveTo(LW, TH);
        pa.lineTo(LW, T);
        pa.lineTo(L, T);
        pa.lineTo(L, TH);
        pa.append(c, false);
        
        int tam = recuo /2;
        
        pa.moveTo(L + tam, T);
        pa.lineTo(L + tam, T - tam);
        pa.lineTo(LW + tam, T - tam);
        pa.lineTo(LW + tam, TH - tam);
        pa.lineTo(LW, TH -tam);
        pa.lineTo(LW, T);
        pa.lineTo(L + tam, T);

        tam = recuo;
        
        pa.moveTo(L + tam, T - (tam/2));
        pa.lineTo(L + tam, T - tam);
        pa.lineTo(LW + tam, T - tam);
        pa.lineTo(LW + tam, TH - tam);
        pa.lineTo(LW + (tam/2), TH -tam);
        pa.lineTo(LW + (tam/2), T -(tam/2));
        pa.lineTo(L + tam, T - (tam/2));
        
        pa.closePath();
        
        Regiao = pa;
        this.reposicionePonto[ptToMove] = new Point(-tam/2, -repo);
        ptsToMove[ptToMove] = 1;
    }
    return Regiao;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:51,代码来源:FluxVDocumentos.java

示例13: drawLeftLabel

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
/**
 * Draws a section label on the left side of the pie chart.
 *
 * @param g2  the graphics device.
 * @param state  the state.
 * @param record  the label record.
 */
protected void drawLeftLabel(Graphics2D g2, PiePlotState state,
                             PieLabelRecord record) {

    double anchorX = state.getLinkArea().getMinX();
    double targetX = anchorX - record.getGap();
    double targetY = record.getAllocatedY();

    if (this.labelLinksVisible) {
        double theta = record.getAngle();
        double linkX = state.getPieCenterX() + Math.cos(theta)
                * state.getPieWRadius() * record.getLinkPercent();
        double linkY = state.getPieCenterY() - Math.sin(theta)
                * state.getPieHRadius() * record.getLinkPercent();
        double elbowX = state.getPieCenterX() + Math.cos(theta)
                * state.getLinkArea().getWidth() / 2.0;
        double elbowY = state.getPieCenterY() - Math.sin(theta)
                * state.getLinkArea().getHeight() / 2.0;
        double anchorY = elbowY;
        g2.setPaint(this.labelLinkPaint);
        g2.setStroke(this.labelLinkStroke);
        PieLabelLinkStyle style = getLabelLinkStyle();
        if (style.equals(PieLabelLinkStyle.STANDARD)) {
            g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
        }
        else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {
            QuadCurve2D q = new QuadCurve2D.Float();
            q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);
            g2.draw(q);
            g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));
        }
        else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {
            CubicCurve2D c = new CubicCurve2D .Float();
            c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,
                    linkX, linkY);
            g2.draw(c);
        }
    }
    TextBox tb = record.getLabel();
    tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT);

}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:51,代码来源:PiePlot.java

示例14: drawRightLabel

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
/**
 * Draws a section label on the right side of the pie chart.
 *
 * @param g2  the graphics device.
 * @param state  the state.
 * @param record  the label record.
 */
protected void drawRightLabel(Graphics2D g2, PiePlotState state,
                              PieLabelRecord record) {

    double anchorX = state.getLinkArea().getMaxX();
    double targetX = anchorX + record.getGap();
    double targetY = record.getAllocatedY();

    if (this.labelLinksVisible) {
        double theta = record.getAngle();
        double linkX = state.getPieCenterX() + Math.cos(theta)
                * state.getPieWRadius() * record.getLinkPercent();
        double linkY = state.getPieCenterY() - Math.sin(theta)
                * state.getPieHRadius() * record.getLinkPercent();
        double elbowX = state.getPieCenterX() + Math.cos(theta)
                * state.getLinkArea().getWidth() / 2.0;
        double elbowY = state.getPieCenterY() - Math.sin(theta)
                * state.getLinkArea().getHeight() / 2.0;
        double anchorY = elbowY;
        g2.setPaint(this.labelLinkPaint);
        g2.setStroke(this.labelLinkStroke);
        PieLabelLinkStyle style = getLabelLinkStyle();
        if (style.equals(PieLabelLinkStyle.STANDARD)) {
            g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
        }
        else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {
            QuadCurve2D q = new QuadCurve2D.Float();
            q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);
            g2.draw(q);
            g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));
        }
        else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {
            CubicCurve2D c = new CubicCurve2D .Float();
            c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,
                    linkX, linkY);
            g2.draw(c);
        }
    }

    TextBox tb = record.getLabel();
    tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.LEFT);

}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:52,代码来源:PiePlot.java

示例15: getReverseLine

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
/**
 * Get a reversed version of the line that represents this layer line.
 * This is useful when creating 2D shapes from these layer lines.
 * @return
 */
public Shape getReverseLine() {
	CubicCurve2D reversedLine = new CubicCurve2D.Double();
	reversedLine.setCurve(_rightmostPoint, _controlPoint2, _controlPoint1, _leftmostPoint);
	return reversedLine;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:Stratum.java


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