X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d.vtk%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fvtk%2Fcommon%2FHoverHighlighter.java;h=7acb3f547adc3ced76f6e0e1932e69fcefbae73b;hb=84132a1d750c45f9161afbd58b78572964e50d26;hp=f80af054dd466c8921d3e9c38cd8dda54879ac73;hpb=289aaab900078ef56efc8779e4b15830e472149e;p=simantics%2F3d.git diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/HoverHighlighter.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/HoverHighlighter.java index f80af054..7acb3f54 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/HoverHighlighter.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/HoverHighlighter.java @@ -1,55 +1,53 @@ -/******************************************************************************* - * 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); - } - -} +/******************************************************************************* + * 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; + +public class HoverHighlighter extends SelectionHighlighter { + + + public HoverHighlighter(VtkView 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); + } + +}