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.service;
020
021import org.nuxeo.ecm.core.api.DocumentModel;
022import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
023import org.nuxeo.ecm.platform.threed.ThreeD;
024import org.nuxeo.ecm.platform.threed.ThreeDBatchProgress;
025import org.nuxeo.ecm.platform.threed.TransmissionThreeD;
026
027import java.util.Collection;
028
029/**
030 * Service to asynchronously launch and monitor 3D format conversions (including lod) and rendering.
031 *
032 * @since 8.4
033 */
034public interface ThreeDService {
035
036    /**
037     * Launch all the registered automatic lod transmission version and thumbnail render on the given {@code doc}.
038     *
039     * @param doc the 3D document to be converted
040     */
041    void launchBatchConversion(DocumentModel doc);
042
043    /**
044     * Batch convert the {@code originalThreed} to all needed blobs (lod transmission formats and thumbnail render)
045     *
046     * @param originalThreed the 3d to convert
047     * @return a {@code BlobHolder} object of the converted assets.
048     */
049    BlobHolder batchConvert(ThreeD originalThreed);
050
051    /**
052     * Clears data model for render views and transmission formats.
053     */
054    void cleanBatchData(DocumentModel doc);
055
056    /**
057     * Batch convert the Collada {@code colladaThreeD} to glTF
058     *
059     * @param colladaThreeD the 3d to convert
060     * @return a {@code TransmissionThreeD} object of in glTF.
061     */
062    TransmissionThreeD convertColladaToglTF(TransmissionThreeD colladaThreeD);
063
064    /**
065     * Returns the available registered render views on a 3D content.
066     */
067    Collection<RenderView> getAvailableRenderViews();
068
069    /**
070     * Returns the automatic registered render views on a 3D content.
071     */
072    Collection<RenderView> getAutomaticRenderViews();
073
074    /**
075     * Returns the available registered automatic LODs on a 3D content.
076     */
077    Collection<AutomaticLOD> getAvailableLODs();
078
079    /**
080     * Returns the automatic registered automatic LODs on a 3D content.
081     */
082    Collection<AutomaticLOD> getAutomaticLODs();
083
084    /**
085     * Returns the available registered Automatic LOD by id.
086     */
087    AutomaticLOD getAutomaticLOD(String id);
088
089    /**
090     * Returns the available registered render views by id.
091     */
092    RenderView getRenderView(String id);
093
094    /**
095     * Returns the available registered render views by azimuth and zenith (the combination is always unique).
096     */
097    RenderView getRenderView(Integer azimuth, Integer Zenith);
098
099    /**
100     * Get the batch processing progress
101     *
102     * @param repositoryName
103     * @param docId of the document being processed
104     * @return a {@link ThreeDBatchProgress} with status (queued, running, unknown) and a message of the running state
105     */
106    ThreeDBatchProgress getBatchProgress(String repositoryName, String docId);
107}