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

Java SVGElement类代码示例

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

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



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

示例1: getDescription

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * Returns the content of the 'desc' child of the given element.
 */
public static String getDescription(SVGElement elt) {
    String result = "";
    boolean preserve = false;
    Node n = elt.getFirstChild();
    if (n != null && n.getNodeType() == Node.ELEMENT_NODE) {
        String name =
            (n.getPrefix() == null) ? n.getNodeName() : n.getLocalName();
        if (name.equals(SVG_DESC_TAG)) {
            preserve = ((SVGLangSpace)n).getXMLspace().equals
                (SVG_PRESERVE_VALUE);
            for (n = n.getFirstChild();
                 n != null;
                 n = n.getNextSibling()) {
                if (n.getNodeType() == Node.TEXT_NODE) {
                    result += n.getNodeValue();
                }
            }
        }
    }
    return (preserve)
        ? XMLSupport.preserveXMLSpace(result)
        : XMLSupport.defaultXMLSpace(result);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:27,代码来源:SVGUtilities.java


示例2: getRelativeCoordinates

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * Get the relative coordinates of a point within the coordinate system of a
 * particular SVG Element.
 *
 * @param evt Event, needs to be a DOMMouseEvent
 * @param reference SVG Element the coordinate system is used of
 * @return Array containing the X and Y values
 */
public static double[] getRelativeCoordinates(Event evt, Element reference) {
  if(evt instanceof DOMMouseEvent && reference instanceof SVGLocatable && reference instanceof SVGElement) {
    // Get the screen (pixel!) coordinates
    DOMMouseEvent gnme = (DOMMouseEvent) evt;
    SVGMatrix mat = ((SVGLocatable) reference).getScreenCTM();
    SVGMatrix imat = mat.inverse();
    SVGPoint cPt = ((SVGElement) reference).getOwnerSVGElement().createSVGPoint();
    cPt.setX(gnme.getClientX());
    cPt.setY(gnme.getClientY());
    // Have Batik transform the screen (pixel!) coordinates into SVG element
    // coordinates
    cPt = cPt.matrixTransform(imat);

    return new double[] { cPt.getX(), cPt.getY() };
  }
  return null;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:26,代码来源:BatikUtil.java


示例3: layoutSVGDocument

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
private void layoutSVGDocument(Rectangle bounds) {
	animateBounds = createAnimationElement(this, SVG_ANIMATE_TAG,
			SVG_VIEW_BOX_ATTRIBUTE, null);
	updateManager = null;
	datalinkMap.clear();

	Graph graph = getGraph();
	if (graph instanceof SVGGraph) {
		SVGGraph svgGraph = (SVGGraph) graph;
		SVGSVGElement svgElement = getSVGDocument().getRootElement();
		SVGElement graphElement = svgGraph.getSVGElement();
		svgElement.appendChild(graphElement);

		setBounds(layoutGraph(graph, bounds));

		edgeLine = EdgeLine.createAndAdd(getSVGDocument(), this);
	}
	drawingDiagram = true;
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:20,代码来源:SVGGraphController.java


示例4: setGraph

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
@Override
public void setGraph(Graph graph) {
	super.setGraph(graph);
	if (graph instanceof SVGGraph) {
		SVGGraph svgGraph = (SVGGraph) graph;
		final SVGElement graphElement = svgGraph.getSVGElement();
		if (isExpanded())
			graphController.updateSVGDocument(new Runnable() {
				@Override
				public void run() {
					mainGroup.replaceChild(expandedElement, graphElement);
				}
			});
		expandedElement = graphElement;
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:17,代码来源:SVGGraphNode.java


示例5: getBorderScreenPosition

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
public Rectangle2D.Float getBorderScreenPosition() {
	Rectangle2D.Float rect = getBorder();
	SVGElement eleBorder = getElement(SvgElementType.Border);

	SVGMatrix matrix = ((SVGLocatable) eleBorder).getScreenCTM();
	SVGPoint leftTopCoordinatePoint = new SVGOMPoint(rect.x, rect.y);
	SVGPoint leftTopScreenPoint = leftTopCoordinatePoint
			.matrixTransform(matrix);

	SVGPoint rightBottomCoordinatePoint = new SVGOMPoint(rect.x
			+ rect.width, rect.y + rect.height);
	SVGPoint rightBottomScreenPoint = rightBottomCoordinatePoint
			.matrixTransform(matrix);

	Rectangle2D.Float result = new Rectangle2D.Float(
			leftTopScreenPoint.getX(), leftTopScreenPoint.getY(),
			rightBottomScreenPoint.getX() - leftTopScreenPoint.getX(),
			rightBottomScreenPoint.getY() - leftTopScreenPoint.getY());

	return result;
}
 
开发者ID:jackhatedance,项目名称:visual-programming,代码行数:22,代码来源:SvgObject.java


示例6: invokeScriptEvent

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
public void invokeScriptEvent(String eventName) {

		SVGElement eventElement = getElement(SvgElementType.Event);

		if (eventElement != null) {
			eventElement.setTextContent(eventName);

			DocumentEvent de = (DocumentEvent) doc;
			MutationEvent ev = (MutationEvent) de.createEvent("MutationEvents");
			ev.initMutationEvent("DOMCharacterDataModified", true, // canBubbleArg
					false, // cancelableArg
					null, // relatedNodeArg
					null, // prevValueArg
					null, // newValueArg
					null, // attrNameArg
					ev.ADDITION);
			EventTarget t = (EventTarget) eventElement;
			t.dispatchEvent(ev);
		}
	}
 
开发者ID:jackhatedance,项目名称:visual-programming,代码行数:21,代码来源:SvgObject.java


示例7: changeColorOfElement

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * Adds a new fill color to all given elements.
 *
 * @param color The replacement color
 * @param document The document in which to replace the color
 * @param elementName The name of an XML element for which to replace the color
 */
private static void changeColorOfElement (final Color color, final SVGDocument document, final String elementName)
{
    final NodeList nodes = document.getElementsByTagName (elementName);
    for (int i = 0; i < nodes.getLength (); i++)
    {
        if (nodes.item (i) instanceof SVGElement)
        {
            final SVGElement element = (SVGElement) nodes.item (i);
            element.setAttribute ("fill", toText (color));
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:SVGImage.java


示例8: getIntersectionList

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link
 * SVGSVGElement#getIntersectionList(SVGRect,SVGElement)}.
 */
public NodeList getIntersectionList(SVGRect rect,
                                    SVGElement referenceElement) {
    SVGSVGContext ctx = (SVGSVGContext)getSVGContext();
    List list = ctx.getIntersectionList(rect, referenceElement);
    return new ListNodeList(list);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:11,代码来源:SVGOMSVGElement.java


示例9: getEnclosureList

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link
 * SVGSVGElement#getEnclosureList(SVGRect,SVGElement)}.
 */
public NodeList getEnclosureList(SVGRect rect,
                                 SVGElement referenceElement) {
    SVGSVGContext ctx = (SVGSVGContext)getSVGContext();
    List list = ctx.getEnclosureList(rect, referenceElement);
    return new ListNodeList(list);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:11,代码来源:SVGOMSVGElement.java


示例10: getNearestViewportElement

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * To implement {@link
 * org.w3c.dom.svg.SVGLocatable#getNearestViewportElement()}.
 */
public static SVGElement getNearestViewportElement(Element e) {
    Element elt = e;
    while (elt != null) {
        elt = SVGCSSEngine.getParentCSSStylableElement(elt);
        if (elt instanceof SVGFitToViewBox) {
            break;
        }
    }
    return (SVGElement)elt;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:15,代码来源:SVGLocatableSupport.java


示例11: getFarthestViewportElement

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * To implement {@link
 * org.w3c.dom.svg.SVGLocatable#getFarthestViewportElement()}.
 */
public static SVGElement getFarthestViewportElement(Element elt) {
    Element rootSVG = elt.getOwnerDocument().getDocumentElement();
    if (elt == rootSVG) {
        return null;
    }
    return (SVGElement) rootSVG;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:12,代码来源:SVGLocatableSupport.java


示例12: getTransformToElement

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * To implement {@link
 * org.w3c.dom.svg.SVGLocatable#getTransformToElement(SVGElement)}.
 */
public static SVGMatrix getTransformToElement(Element elt,
                                              SVGElement element)
    throws SVGException {
    final SVGOMElement currentElt = (SVGOMElement)elt;
    final SVGOMElement targetElt = (SVGOMElement)element;
    return new AbstractSVGMatrix() {
            protected AffineTransform getAffineTransform() {
                AffineTransform cat = 
                    currentElt.getSVGContext().getGlobalTransform();
                if (cat == null) {
                    cat = new AffineTransform();
                }
                AffineTransform tat = 
                    targetElt.getSVGContext().getGlobalTransform();
                if (tat == null) {
                    tat = new AffineTransform();
                }
                AffineTransform at = new AffineTransform(cat);
                try {
                    at.preConcatenate(tat.createInverse());
                    return at;
                } catch (NoninvertibleTransformException ex) {
                    throw currentElt.createSVGException
                        (SVGException.SVG_MATRIX_NOT_INVERTABLE,
                         "noninvertiblematrix",
                         null);
                }
            }
        };
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:35,代码来源:SVGLocatableSupport.java


示例13: getViewportElement

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link SVGElement#getViewportElement()}.
 */
public SVGElement getViewportElement() {
    for (Element e = CSSEngine.getParentCSSStylableElement(this);
         e != null;
         e = CSSEngine.getParentCSSStylableElement(e)) {
        if (e instanceof SVGFitToViewBox) {
            return (SVGElement)e;
        }
    }
    return null;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:14,代码来源:SVGOMElement.java


示例14: handleXML

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/** {@inheritDoc} */
public void handleXML(RendererContext context,
            org.w3c.dom.Document doc, String ns) throws Exception {
    if (getNamespace().equals(ns)) {
        if (!(doc instanceof SVGDocument)) {
            DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
            doc = DOMUtilities.deepCloneDocument(doc, impl);
        }
        SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
        SVGDocument targetDoc = (SVGDocument)context.getProperty(SVG_DOCUMENT);
        SVGElement currentPageG = (SVGElement)context.getProperty(SVG_PAGE_G);
        Element view = targetDoc.createElementNS(getNamespace(), "svg");
        Node newsvg = targetDoc.importNode(svg, true);
        //view.setAttributeNS(null, "viewBox", "0 0 ");
        int xpos = ((Integer)context.getProperty(XPOS)).intValue();
        int ypos = ((Integer)context.getProperty(YPOS)).intValue();
        view.setAttributeNS(null, "x", "" + xpos / 1000f);
        view.setAttributeNS(null, "y", "" + ypos / 1000f);

        // this fixes a problem where the xmlns is repeated sometimes
        Element ele = (Element) newsvg;
        ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
                           getNamespace());
        if (ele.hasAttributeNS(null, "xmlns")) {
            ele.removeAttributeNS(null, "xmlns");
        }

        view.appendChild(newsvg);
        currentPageG.appendChild(view);
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:32,代码来源:SVGSVGHandler.java


示例15: SvgTransformBox

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
public SvgTransformBox(Document doc, SVGOMGElement objectElement) {
	this.doc = doc;
	this.objectElement = objectElement;

	borderElement = (SVGOMRectElement) doc
			.getElementById("transform-border");

	leftTopArrow = (SVGElement) doc
			.getElementById("transform-lefttoparrow");
	topArrow = (SVGElement) doc.getElementById("transform-toparrow");
	rightTopArrow = (SVGElement) doc
			.getElementById("transform-righttoparrow");
	rightArrow = (SVGElement) doc.getElementById("transform-rightarrow");
	rightBottomArrow = (SVGElement) doc
			.getElementById("transform-rightbottomarrow");
	bottomArrow = (SVGElement) doc.getElementById("transform-bottomarrow");
	leftBottomArrow = (SVGElement) doc
			.getElementById("transform-leftbottomarrow");
	leftArrow = (SVGElement) doc.getElementById("transform-leftarrow");

	rightBottomArrowSelected = false;

	visible = false;

	addMouseListener((EventTarget) rightBottomArrow);

}
 
开发者ID:jackhatedance,项目名称:visual-programming,代码行数:28,代码来源:SvgTransformBox.java


示例16: getTransformToElement

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link
 * org.w3c.dom.svg.SVGLocatable#getTransformToElement(SVGElement)}.
 */
public SVGMatrix getTransformToElement(SVGElement element)
    throws SVGException {
    return SVGLocatableSupport.getTransformToElement(this, element);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:9,代码来源:GraphicsExtensionElement.java


示例17: checkIntersection

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link
 * SVGSVGElement#checkIntersection(SVGElement,SVGRect)}.
 */
public boolean checkIntersection(SVGElement element, SVGRect rect) {
    SVGSVGContext ctx = (SVGSVGContext)getSVGContext();
    return ctx.checkIntersection(element, rect);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:9,代码来源:SVGOMSVGElement.java


示例18: checkEnclosure

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link
 * SVGSVGElement#checkEnclosure(SVGElement,SVGRect)}.
 */
public boolean checkEnclosure(SVGElement element, SVGRect rect) {
    SVGSVGContext ctx = (SVGSVGContext)getSVGContext();
    return ctx.checkEnclosure(element, rect);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:9,代码来源:SVGOMSVGElement.java


示例19: getTargetElement

import org.w3c.dom.svg.SVGElement; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link SVGAnimationElement#getTargetElement()}.
 */
public SVGElement getTargetElement() {
    return ((SVGAnimationContext) getSVGContext()).getTargetElement();
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:7,代码来源:SVGOMAnimationElement.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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