/******************************************************************************* * Copyright (c) 2012, 2013 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.g3d.vtk.common; import org.eclipse.jface.viewers.ISelection; import org.simantics.g3d.scenegraph.NodeHighlighter; import org.simantics.g3d.scenegraph.NodeHighlighter.HighlightEventType; import org.simantics.g3d.scenegraph.base.INode; public class HoverHighlighter extends SelectionHighlighter { public HoverHighlighter(VtkView panel, VTKNodeMap nodeMap) { super(panel, nodeMap); } @Override protected void highlight(ISelection s) { highlight(s, HighlightEventType.Hover, HighlightEventType.ClearHover); } @Override protected void hilight(INode node, HighlightEventType type) { if (node instanceof NodeHighlighter) { ((NodeHighlighter)node).highlight(type); return; } if (type == HighlightEventType.Hover) { setSelectedColor(node); } else if (type == HighlightEventType.ClearHover) { setDefaultColor(node); } } @Override protected void setDefaultColor(INode node) { double color[] = new double[]{0,0,0}; setColor(node, true, color); } @Override protected void setSelectedColor(INode node) { double color[] = new double[]{1,0,1}; setColor(node, true, color); } }