use of de.lmu.ifi.dbs.elki.visualization.batikutil.CSSHoverClass in project elki by elki-project.
the class OverviewPlot method initializePlot.
/**
* Initialize the SVG plot.
*/
private void initializePlot() {
plot = new VisualizationPlot();
{
// Add a background element:
CSSClass cls = new CSSClass(this, "background");
final String bgcol = context.getStyleLibrary().getBackgroundColor(StyleLibrary.PAGE);
cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, bgcol);
plot.addCSSClassOrLogError(cls);
Element background = plot.svgElement(SVGConstants.SVG_RECT_TAG);
background.setAttribute(SVGConstants.SVG_X_ATTRIBUTE, "0");
background.setAttribute(SVGConstants.SVG_Y_ATTRIBUTE, "0");
background.setAttribute(SVGConstants.SVG_WIDTH_ATTRIBUTE, "100%");
background.setAttribute(SVGConstants.SVG_HEIGHT_ATTRIBUTE, "100%");
SVGUtil.setCSSClass(background, cls.getName());
// Don't export a white background:
if ("white".equals(bgcol)) {
background.setAttribute(SVGPlot.NO_EXPORT_ATTRIBUTE, SVGPlot.NO_EXPORT_ATTRIBUTE);
}
plot.getRoot().appendChild(background);
}
{
// setup the hover CSS classes.
selcss = new CSSClass(this, "s");
if (DEBUG_LAYOUT) {
selcss.setStatement(SVGConstants.CSS_STROKE_PROPERTY, SVGConstants.CSS_RED_VALUE);
selcss.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, .00001 * StyleLibrary.SCALE);
selcss.setStatement(SVGConstants.CSS_STROKE_OPACITY_PROPERTY, "0.5");
}
selcss.setStatement(SVGConstants.CSS_FILL_PROPERTY, SVGConstants.CSS_RED_VALUE);
selcss.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, "0");
selcss.setStatement(SVGConstants.CSS_CURSOR_PROPERTY, SVGConstants.CSS_POINTER_VALUE);
plot.addCSSClassOrLogError(selcss);
CSSClass hovcss = new CSSClass(this, "h");
hovcss.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, "0.25");
plot.addCSSClassOrLogError(hovcss);
// Hover listener.
hoverer = new CSSHoverClass(hovcss.getName(), null, true);
}
// Disable Batik default interactions (zoom, rotate, etc.)
if (single) {
plot.setDisableInteractions(true);
}
SVGEffects.addShadowFilter(plot);
SVGEffects.addLightGradient(plot);
}
Aggregations