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


Java SVGOMPathElement类代码示例

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


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

示例1: visit

import org.apache.batik.dom.svg.SVGOMPathElement; //导入依赖的package包/类
public void visit(Node node, int depth, JavaFXPathElementHandler pa) {
    NodeList nl = node.getChildNodes();

    for (int i = 0; i < nl.getLength(); ++i) {
        Node elt = (Node) nl.item(i);
        
        if (elt instanceof SVGOMPathElement) {
            NamedNodeMap nnm = elt.getAttributes();
            PathParser pp = new PathParser();
            pp.setPathHandler(pa);
            pa.setId( nnm.getNamedItem("id").getNodeValue() );
            pp.parse(nnm.getNamedItem("d").getTextContent());
        }
        visit(elt, depth + 1, pa);
    }
}
 
开发者ID:vennekamp,项目名称:SVGPath2Text,代码行数:17,代码来源:PathParser_SVG2Int.java

示例2: createPath

import org.apache.batik.dom.svg.SVGOMPathElement; //导入依赖的package包/类
SVGOMPathElement createPath() {
	return (SVGOMPathElement) createElement(SVG_PATH_TAG);
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:4,代码来源:SVGGraphController.java

示例3: ExtractedLetterById

import org.apache.batik.dom.svg.SVGOMPathElement; //导入依赖的package包/类
private static void ExtractedLetterById(BridgeContext ctx, GVTBuilder builder) {
        String oldID = "";
        for (Map.Entry<String, MySVGwordPath> aMySVGwordPath
                : MySVGwordPath.getAllWordsByIDs().entrySet()) {

            if (!oldID.equals(aMySVGwordPath.getKey())) {
                System.out.print(aMySVGwordPath.getKey() + "\t\t");
                oldID = aMySVGwordPath.getKey();

                System.out.print(aMySVGwordPath.getValue().getMyTextContent());
            }
            SVGOMPathElement svgElement
                    = (SVGOMPathElement) myRootSVGElement.getElementById(aMySVGwordPath.getKey());
            if (svgElement != null) {
                gnElement = ctx.getGraphicsNode(svgElement);
                // svgElement.setAttributeNS(null, "fill",  strColor4Done[0]);
                // System.err.println(svgElement.getNodeName());
                Element txtElem = doc.createElementNS(svgNS, "text");
                //  xml:space="preserve" font-family="Comic Sans MS" fill="#008000" 
                // font-weight="normal" font-style="normal" font-size="7px"
                txtElem.setAttributeNS(null, "xml:space", "preserve");
                txtElem.setAttributeNS(null, "font-family", "Comic Sans MS");
                txtElem.setAttributeNS(null, "font-size", "7px");

                txtElem.setTextContent(aMySVGwordPath.getValue().getMyTextContent());
                String attrFill = svgElement.getAttributeNS(null, "fill");
                if ( !attrFill.isEmpty() ) {
                    txtElem.setAttributeNS(null, "fill", attrFill);
                }
                txtElem.setAttributeNS(null, "id", aMySVGwordPath.getKey() + "TEXT");
                svgElement.setAttributeNS(null, "fill", strColor4Done[0]);
                txtElem.setAttributeNS(null, "x", String.valueOf(gnElement.getBounds().getX()));
                txtElem.setAttributeNS(null, "y", String.valueOf(gnElement.getBounds().getY()
                        + gnElement.getBounds().getHeight()));
                gntxtElem = builder.build(ctx, txtElem);
                // transform="rotate(30 20,40)"

                double deltaX = gnElement.getBounds().getX() - gntxtElem.getBounds().getX();
                double deltaY = gnElement.getBounds().getY() - gntxtElem.getBounds().getY();
//                System.out.print("\tOrgHeight: \t" + gnElement.getBounds().getHeight() );
//                System.out.print("\tOrgWidth: \t" + gnElement.getBounds().getWidth());
                txtElem.setAttributeNS(null, "x", String.valueOf(gnElement.getBounds().getX() + deltaX));
                txtElem.setAttributeNS(null, "y", String.valueOf(gnElement.getBounds().getY()
                        + gnElement.getBounds().getHeight() + deltaY));
//                System.out.print("\tNeuHeight: \t" + gntxtElem.getBounds().getHeight() );
//                System.out.println("\tNeuWidth: \t" +gntxtElem.getBounds().getWidth());
                // Leerzeichen einfügen
                if (gnElement.getBounds().getWidth() - gntxtElem.getBounds().getWidth() > 2) {
                    aMySVGwordPath.getValue().addMyAdditionalSpace();
                    txtElem.setTextContent(aMySVGwordPath.getValue().getMyTextContent());
                }
                // Element in den DOM einfügen
                myRootSVGElement.appendChild(txtElem);
//                svgElement.getParentNode().removeChild(svgElement);
//                svgRoot.appendChild(svgElement);
                // Rotation einfügen
                System.out.println("\tMyAngle(): \t"
                        + aMySVGwordPath.getValue().getMyAngle()
                        + "\tMyDistance(): \t"
                        + aMySVGwordPath.getValue().getMyDistance());
                
                if (0 != aMySVGwordPath.getValue().getMyAngle()) {
                    txtElem.setAttributeNS(svgNS, "transform", "rotate("
                            + aMySVGwordPath.getValue().getMyAngle()
                            + ", " + gnElement.getBounds().getCenterX()
                            + ", " + gnElement.getBounds().getCenterY() + ")");
//                    System.err.println("...gnElement");
//                    getMyBBoxManual(gnElement, gnElement.getTransform());
//                    System.err.println("...gntxtElem");
//                    getMyBBoxManual(gntxtElem, gntxtElem.getTransform());
                }
//                System.out.println();
//                svgElement.getParentNode().removeChild(svgElement);
            }
        }
    }
 
开发者ID:vennekamp,项目名称:SVGPath2Text,代码行数:77,代码来源:ExtraktLettersFromPath.java

示例4: getPathElement

import org.apache.batik.dom.svg.SVGOMPathElement; //导入依赖的package包/类
/**
 * Returns the path.
 * 
 * @return the path
 */
public SVGOMPathElement getPathElement() {
	return path;
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:9,代码来源:SVGGraphEdge.java


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