本文整理汇总了Java中org.apache.batik.dom.svg.SVGDOMImplementation类的典型用法代码示例。如果您正苦于以下问题:Java SVGDOMImplementation类的具体用法?Java SVGDOMImplementation怎么用?Java SVGDOMImplementation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SVGDOMImplementation类属于org.apache.batik.dom.svg包,在下文中一共展示了SVGDOMImplementation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fullExportToStream
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
@Override
public void fullExportToStream(ERDesignerGraph aGraph, OutputStream aStream) throws IOException {
Object[] cells = aGraph.getRoots();
Rectangle2D bounds = aGraph.toScreen(aGraph.getCellBounds(cells));
if (bounds != null) {
DOMImplementation theDomImpl = SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
Document theDocument = theDomImpl.createDocument(svgNS, "svg", null);
SVGGraphics2D theSvgGenerator = new SVGGraphics2D(theDocument);
theSvgGenerator.translate(-bounds.getX() + 10, -bounds.getY() + 0);
RepaintManager theRepaintManager = RepaintManager.currentManager(aGraph);
theRepaintManager.setDoubleBufferingEnabled(false);
boolean theDoubleBuffered = aGraph.isDoubleBuffered();
// Disable double buffering to allow Batik to render svg elements
// instead of images
aGraph.setDoubleBuffered(false);
aGraph.paint(theSvgGenerator);
aGraph.setDoubleBuffered(theDoubleBuffered);
Writer theWriter = new OutputStreamWriter(aStream, PlatformConfig.getXMLEncoding());
theSvgGenerator.stream(theWriter, false);
theRepaintManager.setDoubleBufferingEnabled(true);
theWriter.flush();
theWriter.close();
}
}
示例2: getMajorTick
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns a major tick element based on the input parameters.
*
* @param yearPosition
* @param height
* @return majorTick
*/
public Element getMajorTick(int yearPosition, int height) {
String strokeWidth = Double.toString(App.prefs.getIntPref(PrefKey.CHART_VERTICAL_GUIDE_WEIGHT, 1)
* FireChartUtil.pixelsToYears(parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element majorTick = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
majorTick.setAttributeNS(null, "x1", Integer.toString(yearPosition));
majorTick.setAttributeNS(null, "x2", Integer.toString(yearPosition));
majorTick.setAttributeNS(null, "y1", Integer.toString(height - (2 * TICK_HEIGHT)));
majorTick.setAttributeNS(null, "y2", Integer.toString(height - (TICK_HEIGHT)));
majorTick.setAttributeNS(null, "stroke-width", strokeWidth);
majorTick.setAttributeNS(null, "stroke-dasharray", LineStyle.SOLID.getCode());
majorTick.setAttributeNS(null, "stroke", FireChartUtil.colorToHexString(Color.BLACK));
return majorTick;
}
示例3: getMinorTick
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns a minor tick element based on the input parameters.
*
* @param yearPosition
* @param height
* @return minorTick
*/
public Element getMinorTick(int yearPosition, int height) {
String strokeWidth = Double.toString(App.prefs.getIntPref(PrefKey.CHART_VERTICAL_GUIDE_WEIGHT, 1)
* FireChartUtil.pixelsToYears(parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element minorTick = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
minorTick.setAttributeNS(null, "x1", Integer.toString(yearPosition));
minorTick.setAttributeNS(null, "x2", Integer.toString(yearPosition));
minorTick.setAttributeNS(null, "y1", Integer.toString(height - (2 * TICK_HEIGHT)));
minorTick.setAttributeNS(null, "y2", Double.toString(height - (1.5 * TICK_HEIGHT)));
minorTick.setAttributeNS(null, "stroke-width", strokeWidth);
minorTick.setAttributeNS(null, "stroke-dasharray", LineStyle.SOLID.getCode());
minorTick.setAttributeNS(null, "stroke", FireChartUtil.colorToHexString(Color.BLACK));
return minorTick;
}
示例4: getHighlightLine
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns a highlight line element based on the input parameters.
*
* @param yearPosition
* @param height
* @return highlightLine
*/
public Element getHighlightLine(int yearPosition, int height) {
String strokeWidth = Double.toString(App.prefs.getIntPref(PrefKey.CHART_HIGHLIGHT_YEARS_WEIGHT, 1)
* FireChartUtil.pixelsToYears(parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
String strokeDashArray = App.prefs.getLineStylePref(PrefKey.CHART_HIGHLIGHT_YEAR_STYLE, LineStyle.SOLID).getCode();
String stroke = FireChartUtil.colorToHexString(App.prefs.getColorPref(PrefKey.CHART_HIGHLIGHT_YEARS_COLOR, Color.YELLOW));
Element highlightLine = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
highlightLine.setAttributeNS(null, "x1", Integer.toString(yearPosition));
highlightLine.setAttributeNS(null, "x2", Integer.toString(yearPosition));
highlightLine.setAttributeNS(null, "y1", "0");
highlightLine.setAttributeNS(null, "y2", Double.toString(height - (2 * TICK_HEIGHT)));
highlightLine.setAttributeNS(null, "stroke-width", strokeWidth);
highlightLine.setAttributeNS(null, "stroke-dasharray", strokeDashArray);
highlightLine.setAttributeNS(null, "stroke", stroke);
return highlightLine;
}
示例5: getVerticalGuide
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns a highlight line element based on the input parameters.
*
* @param yearPosition
* @param vertGuidesOffsetAmount
* @param height
* @return verticalGuide
*/
public Element getVerticalGuide(int yearPosition, int vertGuidesOffsetAmount, int height) {
String strokeWidth = Double.toString(App.prefs.getIntPref(PrefKey.CHART_VERTICAL_GUIDE_WEIGHT, 1)
* FireChartUtil.pixelsToYears(parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
String strokeDashArray = App.prefs.getLineStylePref(PrefKey.CHART_VERTICAL_GUIDE_STYLE, LineStyle.SOLID).getCode();
String stroke = FireChartUtil.colorToHexString(App.prefs.getColorPref(PrefKey.CHART_VERTICAL_GUIDE_COLOR, Color.BLACK));
Element verticalGuide = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
verticalGuide.setAttributeNS(null, "x1", Integer.toString(yearPosition));
verticalGuide.setAttributeNS(null, "x2", Integer.toString(yearPosition));
verticalGuide.setAttributeNS(null, "y1", Integer.toString(vertGuidesOffsetAmount));
verticalGuide.setAttributeNS(null, "y2", Double.toString(height - (2 * TICK_HEIGHT)));
verticalGuide.setAttributeNS(null, "stroke-width", strokeWidth);
verticalGuide.setAttributeNS(null, "stroke-dasharray", strokeDashArray);
verticalGuide.setAttributeNS(null, "stroke", stroke);
return verticalGuide;
}
示例6: getBorderLine3
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns one part of the rectangular box which surrounds the composite plot.
*
* @param chartHeight
* @return borderLine3
*/
public Element getBorderLine3(double chartHeight) {
String strokeWidth = Double
.toString(FireChartUtil.pixelsToYears(1, parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element borderLine3 = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
borderLine3.setAttributeNS(null, "x1", Integer.toString(parent.getFirstChartYear()));
borderLine3.setAttributeNS(null, "x2", Integer.toString(parent.getFirstChartYear()));
borderLine3.setAttributeNS(null, "y1", "0");
borderLine3.setAttributeNS(null, "y2", Double.toString(chartHeight));
borderLine3.setAttributeNS(null, "stroke-width", strokeWidth);
borderLine3.setAttributeNS(null, "stroke", "black");
borderLine3.setAttributeNS(null, "stroke-linecap", "butt");
return borderLine3;
}
示例7: getBorderLine4
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns one part of the rectangular box which surrounds the composite plot.
*
* @param chartHeight
* @return borderLine4
*/
public Element getBorderLine4(double chartHeight) {
String strokeWidth = Double
.toString(FireChartUtil.pixelsToYears(1, parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element borderLine4 = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
borderLine4.setAttributeNS(null, "x1", Integer.toString(parent.getLastChartYear()));
borderLine4.setAttributeNS(null, "x2", Integer.toString(parent.getLastChartYear()));
borderLine4.setAttributeNS(null, "y1", "0");
borderLine4.setAttributeNS(null, "y2", Double.toString(chartHeight));
borderLine4.setAttributeNS(null, "stroke-width", strokeWidth);
borderLine4.setAttributeNS(null, "stroke", "black");
borderLine4.setAttributeNS(null, "stroke-linecap", "butt");
return borderLine4;
}
示例8: getCompositeLabelTextElement
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns a composite label text element based on the input parameters.
*
* @return compositeLabelTextElement
*/
public Element getCompositeLabelTextElement() {
String fontSize = Integer.toString(App.prefs.getIntPref(PrefKey.CHART_COMPOSITE_PLOT_LABEL_FONT_SIZE, 10));
Text compositeLabelText = parent.getSVGDocument()
.createTextNode(App.prefs.getPref(PrefKey.CHART_COMPOSITE_LABEL_TEXT, "Composite"));
Element compositeLabelTextElement = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "text");
compositeLabelTextElement.setAttributeNS(null, "x", "0");
compositeLabelTextElement.setAttributeNS(null, "y", "0");
compositeLabelTextElement.setAttributeNS(null, "font-family", App.prefs.getPref(PrefKey.CHART_FONT_FAMILY, "Verdana"));
compositeLabelTextElement.setAttributeNS(null, "font-size", fontSize);
compositeLabelTextElement.appendChild(compositeLabelText);
return compositeLabelTextElement;
}
示例9: getEventLine
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns an event line element based on the input parameters.
*
* @param yearPosition
* @param chartHeight
* @return eventLine
*/
public Element getEventLine(int yearPosition, double chartHeight) {
String strokeWidth = Double
.toString(FireChartUtil.pixelsToYears(1, parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element eventLine = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
eventLine.setAttributeNS(null, "x1", Integer.toString(yearPosition));
eventLine.setAttributeNS(null, "x2", Integer.toString(yearPosition));
eventLine.setAttributeNS(null, "y1", "0");
eventLine.setAttributeNS(null, "y2", Double.toString(chartHeight));
eventLine.setAttributeNS(null, "stroke-width", strokeWidth);
eventLine.setAttributeNS(null, "stroke", "black");
return eventLine;
}
示例10: getSeriesNameTextElement
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns a series name text element based on the input parameters.
*
* @param seriesSVG
* @param fontSize
* @return seriesNameTextElement
*/
public Element getSeriesNameTextElement(FHSeriesSVG seriesSVG, int fontSize) {
Text seriesNameText = parent.getSVGDocument().createTextNode(seriesSVG.getTitle());
Element seriesNameTextElement = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "text");
seriesNameTextElement.setAttribute("id", "series_label_" + seriesSVG.getTitle());
seriesNameTextElement.setAttribute("x", Double.toString(parent.getChartWidth() + 10));
seriesNameTextElement.setAttribute("y", Integer.toString((FireChartSVG.SERIES_HEIGHT / 2)));
seriesNameTextElement.setAttribute("font-family", App.prefs.getPref(PrefKey.CHART_FONT_FAMILY, "Verdana"));
seriesNameTextElement.setAttribute("font-size", +fontSize + "");
seriesNameTextElement.setAttribute("fill", FireChartUtil.colorToHexString(seriesSVG.getLabelColor()));
seriesNameTextElement.appendChild(seriesNameText);
return seriesNameTextElement;
}
示例11: getInnerYearPithMarker
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns an inner-year pith marker based on the input pith value, height, and color.
*
* @param hasPith
* @param height
* @param color
* @return innerYearPithMarker
*/
public Element getInnerYearPithMarker(boolean hasPith, int height, Color color) {
if (hasPith)
{
Element pithMarker = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "rect");
pithMarker.setAttributeNS(null, "x", "0");
pithMarker.setAttributeNS(null, "y", Integer.toString(-height / 2));
pithMarker.setAttributeNS(null, "width", "1");
pithMarker.setAttributeNS(null, "height", Integer.toString(height));
pithMarker.setAttributeNS(null, "fill", FireChartUtil.colorToHexString(color));
pithMarker.setAttributeNS(null, "stroke", FireChartUtil.colorToHexString(color));
return pithMarker;
}
else
{
Element noPithMarker = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "polygon");
noPithMarker.setAttributeNS(null, "points", "-2,0.5 5,-5 2,0.5");
noPithMarker.setAttributeNS(null, "fill", FireChartUtil.colorToHexString(color));
noPithMarker.setAttributeNS(null, "stroke", FireChartUtil.colorToHexString(color));
return noPithMarker;
}
}
示例12: getOuterYearBarkMarker
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns an outer-year bark marker based on the input bark value, height, and color.
*
* @param hasBark
* @param height
* @param color
* @return outerYearBarkMarker
*/
public Element getOuterYearBarkMarker(boolean hasBark, int height, Color color) {
if (hasBark)
{
Element barkMarker = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "rect");
barkMarker.setAttributeNS(null, "x", "0");
barkMarker.setAttributeNS(null, "y", Integer.toString(-height / 2));
barkMarker.setAttributeNS(null, "width", "1");
barkMarker.setAttributeNS(null, "height", Integer.toString(height));
barkMarker.setAttributeNS(null, "fill", FireChartUtil.colorToHexString(color));
barkMarker.setAttributeNS(null, "stroke", FireChartUtil.colorToHexString(color));
return barkMarker;
}
else
{
Element noBarkMarker = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "polygon");
noBarkMarker.setAttributeNS(null, "points", "2,0.5 -5,-5 -2,0.5");
noBarkMarker.setAttributeNS(null, "fill", FireChartUtil.colorToHexString(color));
noBarkMarker.setAttributeNS(null, "stroke", FireChartUtil.colorToHexString(color));
return noBarkMarker;
}
}
示例13: getBorderLine1
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns one part of the rectangular box which surrounds the percent scarred plot.
*
* @return borderLine1
*/
public Element getBorderLine1() {
String strokeWidth = Double
.toString(FireChartUtil.pixelsToYears(1, parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element borderLine1 = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
borderLine1.setAttributeNS(null, "x1", "0");
borderLine1.setAttributeNS(null, "y1", "0");
borderLine1.setAttributeNS(null, "x2", "0");
borderLine1.setAttributeNS(null, "y2", "100");
borderLine1.setAttributeNS(null, "stroke-width", strokeWidth);
borderLine1.setAttributeNS(null, "stroke", "black");
borderLine1.setAttributeNS(null, "stroke-linecap", "butt");
return borderLine1;
}
示例14: getBorderLine3
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns one part of the rectangular box which surrounds the percent scarred plot.
*
* @return borderLine3
*/
public Element getBorderLine3() {
String strokeWidth = Double
.toString(FireChartUtil.pixelsToYears(1, parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element borderLine3 = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
borderLine3.setAttributeNS(null, "x1", Integer.toString(parent.getLastChartYear() - parent.getFirstChartYear()));
borderLine3.setAttributeNS(null, "y1", "100");
borderLine3.setAttributeNS(null, "x2", Integer.toString(parent.getLastChartYear() - parent.getFirstChartYear()));
borderLine3.setAttributeNS(null, "y2", "0");
borderLine3.setAttributeNS(null, "stroke-width", strokeWidth);
borderLine3.setAttributeNS(null, "stroke", "black");
borderLine3.setAttributeNS(null, "stroke-linecap", "butt");
return borderLine3;
}
示例15: getVerticalLine
import org.apache.batik.dom.svg.SVGDOMImplementation; //导入依赖的package包/类
/**
* Returns a vertical line to be used in the percent scarred plot.
*
* @param xPosition
* @param y2Position
* @return verticalLine
*/
public Element getVerticalLine(int xPosition, double y2Position) {
String strokeWidth = Double
.toString(FireChartUtil.pixelsToYears(1, parent.getChartWidth(), parent.getFirstChartYear(), parent.getLastChartYear()));
Element verticalLine = parent.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "line");
verticalLine.setAttributeNS(null, "x1", Integer.toString(xPosition));
verticalLine.setAttributeNS(null, "y1", "0");
verticalLine.setAttributeNS(null, "x2", Integer.toString(xPosition));
verticalLine.setAttributeNS(null, "y2", Double.toString(y2Position));
verticalLine.setAttributeNS(null, "stroke", "black");
verticalLine.setAttributeNS(null, "stroke-width", strokeWidth);
return verticalLine;
}