本文整理汇总了Java中org.apache.batik.util.SVGConstants类的典型用法代码示例。如果您正苦于以下问题:Java SVGConstants类的具体用法?Java SVGConstants怎么用?Java SVGConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SVGConstants类属于org.apache.batik.util包,在下文中一共展示了SVGConstants类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: gatherRegionInfo
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
protected void gatherRegionInfo(BridgeContext ctx, Element rgn,
float verticalAlign, List regions) {
for (Node n = rgn.getFirstChild();
n != null; n = n.getNextSibling()) {
if (n.getNodeType() != Node.ELEMENT_NODE) continue;
if (!getNamespaceURI().equals(n.getNamespaceURI())) continue;
Element e = (Element)n;
String ln = n.getLocalName();
if (ln.equals(SVGConstants.SVG_RECT_TAG)) {
UnitProcessor.Context uctx;
uctx = UnitProcessor.createContext(ctx, e);
RegionInfo ri = buildRegion(uctx, e, verticalAlign);
if (ri != null)
regions.add(ri);
}
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:BatikFlowTextElementBridge.java
示例2: isComplex
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
public static boolean isComplex(Element fontElement, BridgeContext ctx) {
NodeList glyphElements = fontElement.getElementsByTagNameNS
(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG);
int numGlyphs = glyphElements.getLength();
for (int i = 0; i < numGlyphs; i++) {
Element glyph = (Element)glyphElements.item(i);
Node child = glyph.getFirstChild();
for (;child != null; child = child.getNextSibling()) {
if (child.getNodeType() != Node.ELEMENT_NODE)
continue;
Element e = (Element)child;
Bridge b = ctx.getBridge(e);
if ((b != null) && (b instanceof GraphicsNodeBridge)) {
return true;
}
}
}
return false;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:SVGFontFamily.java
示例3: registerTags
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* This method should update the BridgeContext with support
* for the tags in this extension. In some rare cases it may
* be necessary to replace existing tag handlers, although this
* is discouraged.
*
* @param ctx The BridgeContext instance to be updated
*/
public void registerTags(BridgeContext ctx) {
// bridges to handle elements in the SVG namespace
super.registerTags(ctx);
// Bridges for SVG 1.2 elements
ctx.putBridge(new SVGFlowRootElementBridge());
ctx.putBridge(new SVGMultiImageElementBridge());
ctx.putBridge(new SVGSolidColorElementBridge());
ctx.putBridge(new SVG12TextElementBridge());
// Bridges for XBL shadow trees and content elements
ctx.putBridge(new XBLShadowTreeElementBridge());
ctx.putBridge(new XBLContentElementBridge());
// Default bridge to handle bindable elements
ctx.setDefaultBridge(new BindableElementBridge());
// Namespaces to avoid for default bridges
ctx.putReservedNamespaceURI(null);
ctx.putReservedNamespaceURI(SVGConstants.SVG_NAMESPACE_URI);
ctx.putReservedNamespaceURI(XBLConstants.XBL_NAMESPACE_URI);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:32,代码来源:SVG12BridgeExtension.java
示例4: isDynamicElement
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Whether the presence of the specified element should cause
* the document to be dynamic. If this element isn't handled
* by this BridgeExtension, just return false.
*
* @param e The element to check.
*/
public boolean isDynamicElement(Element e) {
String ns = e.getNamespaceURI();
if (XBLConstants.XBL_NAMESPACE_URI.equals(ns)) {
return true;
}
if (!SVGConstants.SVG_NAMESPACE_URI.equals(ns)) {
return false;
}
String ln = e.getLocalName();
if (ln.equals(SVGConstants.SVG_SCRIPT_TAG)
|| ln.equals(SVG12Constants.SVG_HANDLER_TAG)
|| ln.startsWith("animate")
|| ln.equals("set")) {
return true;
}
return false;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:25,代码来源:SVG12BridgeExtension.java
示例5: SVGAbstractTranscoder
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
protected SVGAbstractTranscoder() {
userAgent = createUserAgent();
hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI,
SVGConstants.SVG_NAMESPACE_URI);
hints.put(KEY_DOCUMENT_ELEMENT,
SVGConstants.SVG_SVG_TAG);
hints.put(KEY_DOM_IMPLEMENTATION,
SVGDOMImplementation.getDOMImplementation());
hints.put(KEY_MEDIA,
"screen");
hints.put(KEY_DEFAULT_FONT_FAMILY,
DEFAULT_DEFAULT_FONT_FAMILY);
hints.put(KEY_EXECUTE_ONLOAD,
Boolean.FALSE);
hints.put(KEY_ALLOWED_SCRIPT_TYPES,
DEFAULT_ALLOWED_SCRIPT_TYPES);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:19,代码来源:SVGAbstractTranscoder.java
示例6: documentLoadingCompleted
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
NodeEventTarget root
= (NodeEventTarget) e.getSVGDocument().getRootElement();
root.addEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
SVGConstants.SVG_SVGZOOM_EVENT_TYPE,
new EventListener() {
public void handleEvent(Event evt) {
if (!(evt.getTarget() instanceof SVGSVGElement))
return;
// assert(evt.getType() ==
// SVGConstants.SVG_SVGZOOM_EVENT_TYPE);
SVGSVGElement svg = (SVGSVGElement) evt.getTarget();
scaleChange(svg.getCurrentScale());
} // handleEvent()
}, false, null);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:18,代码来源:JSVGScrollPane.java
示例7: getViewBoxRect
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
protected Rectangle2D getViewBoxRect() {
SVGDocument doc = canvas.getSVGDocument();
if (doc == null) return null;
SVGSVGElement el = doc.getRootElement();
if (el == null) return null;
String viewBoxStr = el.getAttributeNS
(null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE);
if (viewBoxStr.length() != 0) {
float[] rect = ViewBox.parseViewBoxAttribute(el, viewBoxStr, null);
return new Rectangle2D.Float(rect[0], rect[1],
rect[2], rect[3]);
}
GraphicsNode gn = canvas.getGraphicsNode();
if (gn == null) return null;
Rectangle2D bounds = gn.getBounds();
if (bounds == null) return null;
return (Rectangle2D) bounds.clone();
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:22,代码来源:JSVGScrollPane.java
示例8: canLoadScriptType
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Returns true if the input scriptType can be loaded in
* this application.
*/
public boolean canLoadScriptType(String scriptType){
if (SVGConstants.SVG_SCRIPT_TYPE_ECMASCRIPT.equals(scriptType)
|| SVGConstants.SVG_SCRIPT_TYPE_APPLICATION_ECMASCRIPT
.equals(scriptType)
|| SVGConstants.SVG_SCRIPT_TYPE_JAVASCRIPT.equals(scriptType)
|| SVGConstants.SVG_SCRIPT_TYPE_APPLICATION_JAVASCRIPT
.equals(scriptType)) {
return preferenceManager.getBoolean
(PreferenceDialog.PREFERENCE_KEY_LOAD_ECMASCRIPT);
} else if (SVGConstants.SVG_SCRIPT_TYPE_JAVA.equals(scriptType)) {
return preferenceManager.getBoolean
(PreferenceDialog.PREFERENCE_KEY_LOAD_JAVA);
} else {
return preferenceManager.getBoolean
(scriptType + UNKNOWN_SCRIPT_TYPE_LOAD_KEY_EXTENSION);
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:22,代码来源:Main.java
示例9: getNamespaceURI
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Looks up for the namespaceURI based on the given prefix. Uses the
* Node.lookupNamespaceURI method, starting from the parent element of
* the element being edited / created.
*
* @param prefix
* The given prefix
* @return namespaceURI or null
*/
private String getNamespaceURI(String prefix) {
String namespaceURI = null;
if (prefix != null) {
if (prefix.equals(SVGConstants.XMLNS_PREFIX)) {
namespaceURI = SVGConstants.XMLNS_NAMESPACE_URI;
} else {
AbstractNode n;
if (mode == EDIT_MODE) {
n = (AbstractNode) previewElement;
namespaceURI = n.lookupNamespaceURI(prefix);
} else if (mode == ADD_NEW_ELEMENT) {
n = (AbstractNode) parentElement;
namespaceURI = n.lookupNamespaceURI(prefix);
}
}
}
return namespaceURI;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:29,代码来源:NodePickerPanel.java
示例10: createElementNS
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Implements the behavior of Document.createElementNS() for this
* DOM implementation.
*/
public Element createElementNS(AbstractDocument document,
String namespaceURI,
String qualifiedName) {
if (SVGConstants.SVG_NAMESPACE_URI.equals(namespaceURI)) {
String name = DOMUtilities.getLocalName(qualifiedName);
ElementFactory ef = (ElementFactory)factories.get(name);
if (ef != null)
return ef.create(DOMUtilities.getPrefix(qualifiedName),
document);
throw document.createDOMException
(DOMException.NOT_FOUND_ERR, "invalid.element",
new Object[] { namespaceURI, qualifiedName });
}
return super.createElementNS(document, namespaceURI, qualifiedName);
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:SVGDOMImplementation.java
示例11: reset
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Resets the value of the associated attribute.
*/
protected void reset() {
try {
changing = true;
valid = true;
String value;
if (baseEnumerationVal ==
SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE) {
value = getValueAsString();
} else if (baseEnumerationVal ==
SVGMarkerElement.SVG_MARKER_ORIENT_AUTO) {
value = SVGConstants.SVG_AUTO_VALUE;
} else {
return;
}
element.setAttributeNS(namespaceURI, localName, value);
} finally {
changing = false;
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:23,代码来源:SVGOMAnimatedMarkerOrientValue.java
示例12: canvasInit
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
public boolean canvasInit(JSVGCanvas canvas) {
DOMImplementation impl =
GenericDOMImplementation.getDOMImplementation();
Document doc = impl.createDocument(SVGConstants.SVG_NAMESPACE_URI,
SVGConstants.SVG_SVG_TAG, null);
Element e = doc.createElementNS(SVGConstants.SVG_NAMESPACE_URI,
SVGConstants.SVG_RECT_TAG);
e.setAttribute("x", "10");
e.setAttribute("y", "10");
e.setAttribute("width", "100");
e.setAttribute("height", "50");
e.setAttribute("fill", "crimson");
doc.getDocumentElement().appendChild(e);
e = doc.createElementNS(SVGConstants.SVG_NAMESPACE_URI,
SVGConstants.SVG_CIRCLE_TAG);
e.setAttribute("cx", "55");
e.setAttribute("cy", "35");
e.setAttribute("r", "30");
e.setAttribute("fill", "gold");
doc.getDocumentElement().appendChild(e);
canvas.setDocument(doc);
return false; // We didn't trigger a load event.
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:26,代码来源:SetSVGDocumentTest.java
示例13: manipulateSVGDocument
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
protected Document manipulateSVGDocument(Document doc) {
Element root = doc.getDocumentElement();
String function;
if ( parameter == null ){
function = onload+"()";
}
else{
function = onload+"("+parameter+")";
}
root.setAttributeNS(null,"onload",function);
Element scriptElement = doc.createElementNS
(SVGConstants.SVG_NAMESPACE_URI,SVGConstants.SVG_SCRIPT_TAG);
scriptElement.setAttributeNS
(XMLConstants.XLINK_NAMESPACE_URI,XMLConstants.XLINK_HREF_QNAME,
script);
root.appendChild(scriptElement);
return doc;
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:SVGTextContentRenderingAccuracyTest.java
示例14: cloneNode
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
@Override
public Node cloneNode(Document doc, Node eold) {
Node enew = null;
if(eold instanceof Element) {
Element e = (Element) eold;
if(e.getTagName().equals(SVGConstants.SVG_IMAGE_TAG)) {
String url = e.getAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE);
ParsedURL urldata = new ParsedURL(url);
if(ThumbnailRegistryEntry.isCompatibleURLStatic(urldata)) {
enew = inlineThumbnail(doc, urldata, eold);
}
else if("file".equals(urldata.getProtocol())) {
enew = inlineExternal(doc, urldata, eold);
}
}
}
if(enew != null) {
return enew;
}
return super.cloneNode(doc, eold);
}
开发者ID:elki-project,项目名称:elki,代码行数:22,代码来源:CloneInlineImages.java
示例15: useMarker
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Use a given marker on the document.
*/
@Override
public Element useMarker(SVGPlot plot, Element parent, double x, double y, int stylenr, double size) {
Element marker = plot.svgCircle(x, y, size * .5);
final String col;
if(stylenr == -1) {
col = dotcolor;
}
else if(stylenr == -2) {
col = greycolor;
}
else {
col = colors.getColor(stylenr);
}
SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + col);
parent.appendChild(marker);
return marker;
}
开发者ID:elki-project,项目名称:elki,代码行数:21,代码来源:CircleMarkers.java
示例16: useMarker
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Use a given marker on the document.
*/
@Override
public Element useMarker(SVGPlot plot, Element parent, double x, double y, int stylenr, double size) {
Element marker = plot.svgRect(x - size * .5, y - size * .5, size, size);
final String col;
if(stylenr == -1) {
col = dotcolor;
}
else if(stylenr == -2) {
col = greycolor;
}
else {
col = colors.getColor(stylenr);
}
SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + col);
parent.appendChild(marker);
return marker;
}
开发者ID:elki-project,项目名称:elki,代码行数:21,代码来源:MinimalMarkers.java
示例17: setupCSSClasses
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Register CSS classes with a {@link CSSClassManager}
*
* @param owner Owner of the CSS classes
* @param manager Manager to register the classes with
* @throws CSSNamingConflict when a name clash occurs
*/
private static void setupCSSClasses(Object owner, CSSClassManager manager, StyleLibrary style) throws CSSNamingConflict {
if(!manager.contains(CSS_AXIS)) {
CSSClass axis = new CSSClass(owner, CSS_AXIS);
axis.setStatement(SVGConstants.CSS_STROKE_PROPERTY, style.getColor(StyleLibrary.AXIS));
axis.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, style.getLineWidth(StyleLibrary.AXIS));
manager.addClass(axis);
}
if(!manager.contains(CSS_AXIS_TICK)) {
CSSClass tick = new CSSClass(owner, CSS_AXIS_TICK);
tick.setStatement(SVGConstants.CSS_STROKE_PROPERTY, style.getColor(StyleLibrary.AXIS_TICK));
tick.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, style.getLineWidth(StyleLibrary.AXIS_TICK));
manager.addClass(tick);
}
if(!manager.contains(CSS_AXIS_LABEL)) {
CSSClass label = new CSSClass(owner, CSS_AXIS_LABEL);
label.setStatement(SVGConstants.CSS_FILL_PROPERTY, style.getTextColor(StyleLibrary.AXIS_LABEL));
label.setStatement(SVGConstants.CSS_FONT_FAMILY_PROPERTY, style.getFontFamily(StyleLibrary.AXIS_LABEL));
label.setStatement(SVGConstants.CSS_FONT_SIZE_PROPERTY, style.getTextSize(StyleLibrary.AXIS_LABEL));
manager.addClass(label);
}
}
开发者ID:elki-project,项目名称:elki,代码行数:29,代码来源:SVGSimpleLinearAxis.java
示例18: cloneNode
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
@Override
public Node cloneNode(Document doc, Node eold) {
// Skip elements with visibility=hidden
if(eold instanceof Element) {
Element eeold = (Element) eold;
String vis = eeold.getAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY);
if(SVGConstants.CSS_HIDDEN_VALUE.equals(vis)) {
return null;
}
}
// Perform clone flat
Node enew = doc.importNode(eold, false);
// Recurse:
for(Node n = eold.getFirstChild(); n != null; n = n.getNextSibling()) {
final Node clone = cloneNode(doc, n);
if (clone != null) {
enew.appendChild(clone);
}
}
return enew;
}
开发者ID:elki-project,项目名称:elki,代码行数:22,代码来源:SVGCloneVisible.java
示例19: fullRedraw
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
@Override
public void fullRedraw() {
setupCanvas();
if(img == null) {
renderImage();
}
CanvasSize canvas = proj.estimateViewport();
String imguri = ThumbnailRegistryEntry.INTERNAL_PREFIX + ThumbnailRegistryEntry.registerImage(img);
Element itag = svgp.svgElement(SVGConstants.SVG_IMAGE_TAG);
SVGUtil.setAtt(itag, SVGConstants.SVG_IMAGE_RENDERING_ATTRIBUTE, SVGConstants.SVG_OPTIMIZE_SPEED_VALUE);
SVGUtil.setAtt(itag, SVGConstants.SVG_X_ATTRIBUTE, canvas.minx);
SVGUtil.setAtt(itag, SVGConstants.SVG_Y_ATTRIBUTE, canvas.miny);
SVGUtil.setAtt(itag, SVGConstants.SVG_WIDTH_ATTRIBUTE, canvas.maxx - canvas.minx);
SVGUtil.setAtt(itag, SVGConstants.SVG_HEIGHT_ATTRIBUTE, canvas.maxy - canvas.miny);
SVGUtil.setAtt(itag, SVGConstants.SVG_STYLE_ATTRIBUTE, SVGConstants.CSS_OPACITY_PROPERTY + ": .5");
itag.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_QNAME, imguri);
layer.appendChild(itag);
}
开发者ID:elki-project,项目名称:elki,代码行数:21,代码来源:DensityEstimationOverlay.java
示例20: svgWaitIcon
import org.apache.batik.util.SVGConstants; //导入依赖的package包/类
/**
* Draw a simple "please wait" icon (in-progress) as placeholder for running
* renderings.
*
* @param document Document.
* @param x Left
* @param y Top
* @param w Width
* @param h Height
* @return New element (currently a {@link SVGConstants#SVG_PATH_TAG})
*/
public static Element svgWaitIcon(Document document, double x, double y, double w, double h) {
Element g = SVGUtil.svgElement(document, SVGConstants.SVG_G_TAG);
setAtt(g, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, "translate(" + x + " " + y + ") scale(" + w + " " + h + ")");
Element thro = SVGUtil.svgElement(document, SVGConstants.SVG_PATH_TAG);
setAtt(thro, SVGConstants.SVG_D_ATTRIBUTE, THROBBER_PATH);
setStyle(thro, THROBBER_STYLE);
Element anim = SVGUtil.svgElement(document, SVGConstants.SVG_ANIMATE_TRANSFORM_TAG);
setAtt(anim, SVGConstants.SVG_ATTRIBUTE_NAME_ATTRIBUTE, SVGConstants.SVG_TRANSFORM_ATTRIBUTE);
setAtt(anim, SVGConstants.SVG_ATTRIBUTE_TYPE_ATTRIBUTE, "XML");
setAtt(anim, SVGConstants.SVG_TYPE_ATTRIBUTE, SVGConstants.SVG_ROTATE_ATTRIBUTE);
setAtt(anim, SVGConstants.SVG_FROM_ATTRIBUTE, "0 .5 .5");
setAtt(anim, SVGConstants.SVG_TO_ATTRIBUTE, "360 .5 .5");
setAtt(anim, SVGConstants.SVG_BEGIN_ATTRIBUTE, fmt(Math.random() * 2) + "s");
setAtt(anim, SVGConstants.SVG_DUR_ATTRIBUTE, "2s");
setAtt(anim, SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE, "indefinite");
setAtt(anim, SVGConstants.SVG_FILL_ATTRIBUTE, "freeze");
thro.appendChild(anim);
g.appendChild(thro);
return g;
}
开发者ID:elki-project,项目名称:elki,代码行数:32,代码来源:SVGUtil.java
注:本文中的org.apache.batik.util.SVGConstants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论