| package org.eclipse.apogy.addons.sensors.imaging.converters; |
| /******************************************************************************* |
| * 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.imaging.ImageSnapshot; |
| import org.eclipse.apogy.common.converters.IConverter; |
| import org.eclipse.apogy.common.images.AbstractEImage; |
| |
| public class ImageSnapshotToAbstractEImageConverter implements IConverter { |
| |
| @Override |
| public boolean canConvert(Object arg0) { |
| if (arg0 instanceof ImageSnapshot) { |
| return (((ImageSnapshot) arg0).getImage() != null); |
| } |
| return false; |
| } |
| |
| @Override |
| public Object convert(Object arg0) throws Exception { |
| return ((ImageSnapshot) arg0).getImage(); |
| } |
| |
| @Override |
| public Class<?> getInputType() { |
| return ImageSnapshot.class; |
| } |
| |
| @Override |
| public Class<?> getOutputType() { |
| return AbstractEImage.class; |
| } |
| } |