blob: f1ba10faed75f9c0cb6a428bb93494aad0780539 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* 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:
<<<<<<< HEAD
* Pierre Allard - initial API and implementation
*
=======
* Pierre Allard - initial API and implementation
*
>>>>>>> refs/heads/eclipse_pa
* SPDX-License-Identifier: EPL-1.0
*******************************************************************************/
package org.eclipse.apogy.core.environment.earth.surface.ui.jme3.adapters;
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;
import org.eclipse.apogy.core.environment.earth.surface.EarthSkyNode;
import org.eclipse.apogy.core.environment.earth.surface.ui.jme3.scene_objects.EarthSkyNodeJME3Object;
public class EarthSkyNodeJME3Adapter implements JME3Adapter {
@Override
public boolean isAdapterFor(Node obj) {
return obj instanceof EarthSkyNode;
}
@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 EarthSkyNodeJME3Object((EarthSkyNode) obj, (JME3RenderEngineDelegate) context);
}
return sceneObject;
}
@Override
public Class<?> getAdaptedClass() {
return EarthSkyNode.class;
}
}