• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Text2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: makeText

import com.sun.j3d.utils.geometry.Text2D; //导入依赖的package包/类
private TransformGroup makeText(Vector3d vertex, String text) {
	Text2D message = new Text2D(text, white, "SansSerif", 36, Font.BOLD);
	// 36 point bold Sans Serif

	TransformGroup tg = new TransformGroup();
	Transform3D t3d = new Transform3D();
	t3d.setTranslation(vertex);
	tg.setTransform(t3d);
	tg.addChild(message);
	return tg;
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:12,代码来源:CheckerFloor.java


示例2: genText

import com.sun.j3d.utils.geometry.Text2D; //导入依赖的package包/类
private Node genText(TextShape t, Color c){
	//Color c = new Color(255-c.getRed(), 255-c.getGreen(), 255-c.getBlue());
	Shape3D text3D = new Text2D(t.text, new Color3f(c),"Arial",48, Font.BOLD );

	enablePicking(text3D);
	pickMap.put(text3D, t);

	TransformGroup subTg = new TransformGroup();
	subTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	Billboard billboard = new Billboard(subTg);
	billboard.setSchedulingBounds( bounds );
	subTg.addChild( billboard );

	TransformGroup tg = new TransformGroup();
	tg.addChild(subTg);
	subTg.addChild(text3D);
	tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	//shapeTransforms.put(t, tg);

	BranchGroup ret = new BranchGroup();
	ret.addChild(tg);
	ret.setCapability(BranchGroup.ALLOW_DETACH);
	ret.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
	shapeTransforms.put(t, ret);
	updateTextTransforms(t);
	return ret;
}
 
开发者ID:DIKU-Steiner,项目名称:ProGAL,代码行数:28,代码来源:J3DScene.java


示例3: IcosahedralLabels

import com.sun.j3d.utils.geometry.Text2D; //导入依赖的package包/类
public IcosahedralLabels() {
    // <editor-fold defaultstate="collapsed">
    setCapability(BranchGroup.ALLOW_DETACH);
    Color3f minusColor = new Color3f(1.0f, 0.0f, 0.0f);
    Color3f plusColor = new Color3f(0.0f, 0.0f, 1.0f);
    AlgebraicField field = new PentagonField();
    IcosahedralSymmetry symm = new IcosahedralSymmetry(field, "temp");
    // we use black for index numbers, but turqouise for location of the text
    Direction indexOrbit = symm.getDirection("black");
    Direction locationOrbit = symm.getDirection("turquoise");
    for (Axis axis : indexOrbit) {
        boolean negative = axis.getSense() == Symmetry.MINUS;
        Color3f numColor = negative ? minusColor : plusColor;
        AlgebraicVector v = locationOrbit.getAxis(axis.normal().toRealVector()).normal();
        RealVector location = v.toRealVector().scale( 11f );
        String label = (negative ? "-" : "") + axis.getOrientation();
        Text2D text2D = new Text2D(label, numColor, "Helvetica", 120, negative ? Font.PLAIN : Font.BOLD);
        text2D.setRectangleScaleFactor(0.02f);
        text2D.getGeometry().setCapability(Geometry.ALLOW_INTERSECT);
        OrientedShape3D os3D = new OrientedShape3D();
        os3D.setGeometry(text2D.getGeometry());
        os3D.setAppearance(text2D.getAppearance());
        os3D.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT);
        Transform3D move = new Transform3D();
        move.setTranslation(new Vector3d(location.x, location.y, location.z));
        TransformGroup tg = new TransformGroup(move);
        tg.addChild(os3D);
        addChild(tg);
    }
    // </editor-fold>
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:32,代码来源:Java3dSceneGraph.java


示例4: makeText

import com.sun.j3d.utils.geometry.Text2D; //导入依赖的package包/类
private TransformGroup makeText(Vector3d vertex, String text) {
  Text2D message = new Text2D(text, white, "SansSerif", 36, Font.BOLD);
  // 36 point bold Sans Serif

  TransformGroup tg = new TransformGroup();
  Transform3D t3d = new Transform3D();
  t3d.setTranslation(vertex);
  tg.setTransform(t3d);
  tg.addChild(message);
  return tg;
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:12,代码来源:CheckerFloor.java


示例5: writeLabel

import com.sun.j3d.utils.geometry.Text2D; //导入依赖的package包/类
/**
 * Used to write a text next to the sphere representing a body
 * @param i the body identification
 * @param label the text to write
 */
private void writeLabel(int i, String label, double diameter) {
    labels[i].removeAllChildren();

    if (label.compareTo("") != 0) {
        // Creating
        BranchGroup bg = new BranchGroup();
        bg.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
        bg.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
        bg.setCapability(BranchGroup.ALLOW_DETACH);

        // Translating & scaling
        TransformGroup labelGroup = new TransformGroup();
        Transform3D scaling = new Transform3D();
        scaling.setTranslation(new Vector3d(0.01 + ((0.005 * diameter) / MASS_RATIO),
            0.01 + ((0.005 * diameter) / MASS_RATIO), 0.0));
        //scaling.setTranslation(new Vector3d(0.15,0.15,0.0));
        scaling.setScale(0.5);
        labelGroup.setTransform(scaling);

        // Assembling and creating the text2D
        labelGroup.addChild(new Text2D(label, new Color3f(1.0f, 1.0f, 1.0f), "Arial", 14, Font.PLAIN));
        bg.addChild(labelGroup);
        bg.compile();

        labels[i].addChild(bg);
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:33,代码来源:NBody3DFrame.java


示例6: makeText

import com.sun.j3d.utils.geometry.Text2D; //导入依赖的package包/类
private TransformGroup makeText(Vector3d vertex, String text) {
     // 36 point bold Sans Serif
  Text2D message = new Text2D(text, white, "SansSerif", 36, Font.BOLD );
  Appearance app = message.getAppearance();
  PolygonAttributes pa = app.getPolygonAttributes();
  if (pa == null) {
    pa = new PolygonAttributes();
  }
  pa.setCullFace(PolygonAttributes.CULL_NONE);
  app.setPolygonAttributes(pa);

  TransformGroup tg = new TransformGroup();
  Transform3D t3d = new Transform3D();
  t3d.setTranslation(vertex);
  tg.setTransform(t3d);
  tg.addChild(message);
  return tg;
}
 
开发者ID:motoq,项目名称:vse,代码行数:19,代码来源:CartesianGrid.java


示例7: FrameLabels

import com.sun.j3d.utils.geometry.Text2D; //导入依赖的package包/类
public FrameLabels() {
    // <editor-fold defaultstate="collapsed">
    setCapability(BranchGroup.ALLOW_DETACH);
    LineArray frameEdges = new LineArray(24, LineArray.COORDINATES | LineArray.COLOR_3);
    int nextEdge = 0;
    addChild(new Shape3D(frameEdges));
    String[] labels = {"-", "0", "+"};
    Color3f frameColor = new Color3f(0.9f, 1.0f, 0.0f);
    float scale = 30f;
    for (int x = -1; x < 2; x++) {
        for (int y = -1; y < 2; y++) {
            for (int z = -1; z < 2; z++) {
                if (x != 0 || y != 0 || z != 0) {
                    int parity = (x + y + z) % 2;
                    String label = labels[x + 1] + labels[y + 1] + labels[z + 1];
                    Text2D text2D = new Text2D(label, frameColor, "Helvetica", 72, Font.PLAIN);
                    text2D.setRectangleScaleFactor(0.02f);
                    text2D.getGeometry().setCapability(Geometry.ALLOW_INTERSECT);
                    OrientedShape3D os3D = new OrientedShape3D();
                    os3D.setGeometry(text2D.getGeometry());
                    os3D.setAppearance(text2D.getAppearance());
                    os3D.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT);
                    Transform3D move = new Transform3D();
                    move.setTranslation(new Vector3d(scale * x, scale * y, scale * z));
                    TransformGroup tg = new TransformGroup(move);
                    tg.addChild(os3D);
                    addChild(tg);

                    if (parity == 0) {
                        // odd parity means this is an edge center, so let's render the edge of the cube
                        int zeroCoord = (x == 0) ? 0 : ((y == 0) ? 1 : 2);
                        float[] start = {scale * x, scale * y, scale * z};
                        float[] end = {scale * x, scale * y, scale * z};
                        start[zeroCoord] = scale;
                        end[zeroCoord] = -scale;

                        frameEdges.setCoordinate(nextEdge, new Point3f(start));
                        frameEdges.setColor(nextEdge++, frameColor);
                        frameEdges.setCoordinate(nextEdge, new Point3f(end));
                        frameEdges.setColor(nextEdge++, frameColor);
                    }
                }
            }
        }
    }
    // </editor-fold>
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:48,代码来源:Java3dSceneGraph.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TileEntityHopper类代码示例发布时间:2022-05-23
下一篇:
Java FlinkKafkaProducer09类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap