/******************************************************************************* * 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.IG3DNode; import org.simantics.g3d.scenegraph.NodeHighlighter; import org.simantics.g3d.scenegraph.NodeHighlighter.HighlightEventType; import vtk.vtkPanel; public class HoverHighlighter extends SelectionHighlighter { public HoverHighlighter(vtkPanel panel, VTKNodeMap nodeMap) { super(panel, nodeMap); } protected void highlight(ISelection s) { highlight(s, HighlightEventType.Hover, HighlightEventType.ClearHover); } protected void hilight(IG3DNode 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); } } protected void setDefaultColor(IG3DNode node) { double color[] = new double[]{0,0,0}; setColor(node, true, color); } protected void setSelectedColor(IG3DNode node) { double color[] = new double[]{1,0,1}; setColor(node, true, color); } }