1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g3d.vtk.common;
14 import org.eclipse.jface.viewers.ISelection;
15 import org.simantics.g3d.scenegraph.IG3DNode;
16 import org.simantics.g3d.scenegraph.NodeHighlighter;
17 import org.simantics.g3d.scenegraph.NodeHighlighter.HighlightEventType;
19 public class HoverHighlighter extends SelectionHighlighter {
22 public HoverHighlighter(VtkView panel, VTKNodeMap nodeMap) {
23 super(panel, nodeMap);
27 protected void highlight(ISelection s) {
28 highlight(s, HighlightEventType.Hover, HighlightEventType.ClearHover);
31 protected void hilight(IG3DNode node, HighlightEventType type) {
32 if (node instanceof NodeHighlighter) {
33 ((NodeHighlighter)node).highlight(type);
36 if (type == HighlightEventType.Hover) {
37 setSelectedColor(node);
38 } else if (type == HighlightEventType.ClearHover) {
39 setDefaultColor(node);
43 protected void setDefaultColor(IG3DNode node) {
44 double color[] = new double[]{0,0,0};
45 setColor(node, true, color);
48 protected void setSelectedColor(IG3DNode node) {
49 double color[] = new double[]{1,0,1};
50 setColor(node, true, color);