| package org.eclipse.apogy.addons.sensors.fov.ui.jme3.adapters; |
| /******************************************************************************** |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * Contributors: |
| * Pierre Allard (Pierre.Allard@canada.ca), |
| * Regent L'Archeveque (Regent.Larcheveque@canada.ca), |
| * Sebastien Gemme (Sebastien.Gemme@canada.ca), |
| * Canadian Space Agency (CSA) - Initial API and implementation |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 1.0 which is available at |
| * http://www.eclipse.org/legal/epl-v10.html. |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| ********************************************************************************/ |
| |
| import org.eclipse.apogy.addons.sensors.fov.ui.FieldOfViewEntry3DToolNode; |
| import org.eclipse.apogy.addons.sensors.fov.ui.jme3.scene_objects.FieldOfViewEntry3DToolNodeJME3Object; |
| import org.eclipse.apogy.common.topology.Node; |
| import org.eclipse.apogy.common.topology.ui.jme3.JME3Adapter; |
| import org.eclipse.apogy.common.topology.ui.jme3.JME3RenderEngineDelegate; |
| import org.eclipse.apogy.common.topology.ui.jme3.JME3SceneObject; |
| |
| public class FieldOfViewEntry3DToolNodeJME3Adapter implements JME3Adapter { |
| |
| @Override |
| public boolean isAdapterFor(Node obj) { |
| return obj instanceof FieldOfViewEntry3DToolNode; |
| } |
| |
| @Override |
| public JME3SceneObject getAdapter(Node obj, Object context) { |
| |
| JME3SceneObject sceneObject = null; |
| |
| if (isAdapterFor(obj)) { |
| // Context should be an Application |
| if (!(context instanceof JME3RenderEngineDelegate)) { |
| throw new IllegalArgumentException("Context must be a JME3RenderEngineDelegate."); |
| } |
| |
| sceneObject = new FieldOfViewEntry3DToolNodeJME3Object((FieldOfViewEntry3DToolNode) obj, |
| (JME3RenderEngineDelegate) context); |
| } |
| |
| return sceneObject; |
| } |
| |
| @Override |
| public Class<?> getAdaptedClass() { |
| return FieldOfViewEntry3DToolNode.class; |
| } |
| |
| } |