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 <[email protected]> 018 */ 019package org.nuxeo.ecm.platform.threed.convert; 020 021import org.apache.commons.io.FilenameUtils; 022import org.nuxeo.ecm.core.api.Blob; 023import org.nuxeo.ecm.core.api.blobholder.BlobHolder; 024import org.nuxeo.ecm.core.api.blobholder.SimpleBlobHolderWithProperties; 025import org.nuxeo.ecm.core.api.impl.blob.FileBlob; 026import org.nuxeo.ecm.platform.commandline.executor.api.CmdParameters; 027import org.nuxeo.ecm.core.convert.api.ConversionException; 028 029import java.io.File; 030import java.io.Serializable; 031import java.util.ArrayList; 032import java.util.HashMap; 033import java.util.List; 034import java.util.Map; 035import java.util.stream.Collectors; 036 037import static org.nuxeo.ecm.platform.threed.convert.Constants.*; 038import static org.nuxeo.ecm.platform.threed.convert.Constants.MAX_TEX_PARAMETER; 039import static org.nuxeo.ecm.platform.threed.convert.Constants.PERC_TEX_PARAMETER; 040 041/** 042 * Level of details converter for 3D document type 043 * 044 * @since 8.4 045 */ 046public class LodsConverter extends BaseBlenderConverter { 047 048 @Override 049 protected Map<String, Blob> getCmdBlobParameters(BlobHolder blobHolder, Map<String, Serializable> parameters) 050 throws ConversionException { 051 return null; 052 } 053 054 @Override 055 protected Map<String, String> getCmdStringParameters(BlobHolder blobHolder, Map<String, Serializable> parameters) 056 throws ConversionException { 057 Map<String, String> cmdStringParams = new HashMap<>(); 058 059 String percPoly = null; 060 if (parameters.containsKey(PERC_POLY_PARAMETER)) { 061 percPoly = (String) parameters.get(PERC_POLY_PARAMETER); 062 } else if (initParameters.containsKey(PERC_POLY_PARAMETER)) { 063 percPoly = initParameters.get(PERC_POLY_PARAMETER); 064 } 065 cmdStringParams.put(PERC_POLY_PARAMETER, percPoly); 066 067 String maxPoly = null; 068 if (parameters.containsKey(MAX_POLY_PARAMETER)) { 069 maxPoly = (String) parameters.get(MAX_POLY_PARAMETER); 070 } else if (initParameters.containsKey(MAX_POLY_PARAMETER)) { 071 maxPoly = initParameters.get(MAX_POLY_PARAMETER); 072 } 073 cmdStringParams.put(MAX_POLY_PARAMETER, maxPoly); 074 075 String percTex = null; 076 if (parameters.containsKey(PERC_TEX_PARAMETER)) { 077 percTex = (String) parameters.get(PERC_TEX_PARAMETER); 078 } else if (initParameters.containsKey(PERC_TEX_PARAMETER)) { 079 percTex = initParameters.get(PERC_TEX_PARAMETER); 080 } 081 cmdStringParams.put(PERC_TEX_PARAMETER, percTex); 082 083 String maxTex = null; 084 if (parameters.containsKey(MAX_TEX_PARAMETER)) { 085 maxTex = (String) parameters.get(MAX_TEX_PARAMETER); 086 } else if (initParameters.containsKey(MAX_TEX_PARAMETER)) { 087 maxTex = initParameters.get(MAX_TEX_PARAMETER); 088 } 089 cmdStringParams.put(MAX_TEX_PARAMETER, maxTex); 090 091 return cmdStringParams; 092 } 093 094}