| package org.eclipse.apogy.addons.sensors.pose.ui.adapters; |
| /******************************************************************************* |
| * 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: |
| * Pierre Allard - initial API and implementation |
| * Regent L'Archeveque |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| |
| import org.eclipse.apogy.addons.sensors.pose.PoseSensor; |
| import org.eclipse.apogy.addons.sensors.pose.PositionSensor; |
| import org.eclipse.apogy.addons.sensors.pose.ui.ApogyAddonsSensorsPoseUIFactory; |
| import org.eclipse.apogy.addons.sensors.pose.ui.PositionSensorPresentation; |
| import org.eclipse.apogy.common.topology.Node; |
| import org.eclipse.apogy.common.topology.ui.NodePresentation; |
| import org.eclipse.apogy.common.topology.ui.NodePresentationAdapter; |
| |
| public class PositionSensorPresentationAdapter implements NodePresentationAdapter { |
| |
| public PositionSensorPresentationAdapter() { |
| } |
| |
| @Override |
| public Class<?> getAdaptedClass() { |
| return PositionSensor.class; |
| } |
| |
| @Override |
| public boolean isAdapterFor(Node obj) { |
| return (obj instanceof PositionSensor) && !(obj instanceof PoseSensor); |
| } |
| |
| @Override |
| public NodePresentation getAdapter(Node obj, Object context) { |
| if (!isAdapterFor(obj)) { |
| throw new IllegalArgumentException(); |
| } |
| |
| PositionSensor vector = (PositionSensor) obj; |
| |
| PositionSensorPresentation presentationNode = ApogyAddonsSensorsPoseUIFactory.eINSTANCE |
| .createPositionSensorPresentation(); |
| presentationNode.setNode(vector); |
| |
| return presentationNode; |
| } |
| } |