001/*
002 * (C) Copyright 2006-2016 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Tiago Cardoso <tcardoso@nuxeo.com>
018 */
019package org.nuxeo.ecm.platform.threed.convert;
020
021import org.nuxeo.ecm.core.api.Blob;
022import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
023import org.nuxeo.ecm.core.convert.api.ConversionException;
024import org.nuxeo.ecm.core.convert.extension.ExternalConverter;
025
026import java.io.Serializable;
027import java.util.HashMap;
028import java.util.Map;
029
030import static org.nuxeo.ecm.platform.threed.convert.Constants.DIMENSIONS_PARAMETER;
031
032/**
033 * Render converter 3D document type to PNG
034 *
035 * @since 8.4
036 */
037public class RenderConverter extends BaseBlenderConverter implements ExternalConverter {
038
039    @Override
040    protected Map<String, Blob> getCmdBlobParameters(BlobHolder blobHolder, Map<String, Serializable> parameters)
041            throws ConversionException {
042        return null;
043    }
044
045    @Override
046    protected Map<String, String> getCmdStringParameters(BlobHolder blobHolder, Map<String, Serializable> parameters)
047            throws ConversionException {
048        Map<String, String> cmdStringParams = new HashMap<>();
049        String dimensions = null;
050        if (parameters.containsKey(DIMENSIONS_PARAMETER)) {
051            dimensions = (String) parameters.get(DIMENSIONS_PARAMETER);
052        } else if (initParameters.containsKey(DIMENSIONS_PARAMETER)) {
053            dimensions = initParameters.get(DIMENSIONS_PARAMETER);
054        }
055        cmdStringParams.put(DIMENSIONS_PARAMETER, dimensions);
056        return cmdStringParams;
057    }
058
059}