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