PageRenderTime 49ms CodeModel.GetById 33ms app.highlight 11ms RepoModel.GetById 2ms app.codeStats 0ms

/extensions/org/mt4jx/input/inputProcessors/componentProcessors/Group3DProcessorNew/GroupVisualizations/BlinkingEmissionActivateVisualizationAction.java

http://mt4j.googlecode.com/
Java | 53 lines | 45 code | 8 blank | 0 comment | 4 complexity | ae002fdc6be66ca73bcd77f6f982eab9 MD5 | raw file
 1package org.mt4jx.input.inputProcessors.componentProcessors.Group3DProcessorNew.GroupVisualizations;
 2
 3import org.mt4j.components.MTComponent;
 4import org.mt4j.components.visibleComponents.shapes.mesh.MTTriangleMesh;
 5import org.mt4j.input.inputProcessors.IGestureEventListener;
 6import org.mt4j.input.inputProcessors.MTGestureEvent;
 7import org.mt4j.input.inputProcessors.componentProcessors.tapProcessor.TapEvent;
 8import org.mt4jx.input.inputProcessors.componentProcessors.Group3DProcessorNew.Cluster;
 9import org.mt4jx.input.inputProcessors.componentProcessors.Group3DProcessorNew.IVisualizeMethodProvider;
10
11public class BlinkingEmissionActivateVisualizationAction implements IGestureEventListener {
12
13	private Cluster cluster;
14	
15	private IVisualizeMethodProvider methodProvider;
16	
17	public BlinkingEmissionActivateVisualizationAction(Cluster cluster,IVisualizeMethodProvider methodProvider)
18	{
19		this.cluster = cluster;
20		this.methodProvider = methodProvider;
21		this.cluster.setVisualizeProvider(null);
22	}
23	public boolean processGestureEvent(MTGestureEvent ge) {
24		if(ge instanceof TapEvent)
25		{
26			TapEvent tapEv = (TapEvent)ge;
27			switch(tapEv.getId())
28			{
29			case TapEvent.GESTURE_STARTED:
30				cluster.setVisualizeProvider(methodProvider);
31				break;
32			case TapEvent.GESTURE_ENDED:
33				for(MTComponent groups : cluster.getChildren())
34				{
35					
36					for(MTComponent comp : groups.getChildren())
37					{
38						MTTriangleMesh mesh = (MTTriangleMesh)comp;
39						if(comp instanceof MTTriangleMesh)
40						{
41							mesh.getMaterial().setEmission(new float[]{0.f,0.f,0.f});
42												
43						}
44					}
45				}
46				cluster.setVisualizeProvider(null);
47				break;
48			}
49		}
50		return false;
51	}
52
53}