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;
020
021import java.io.Serializable;
022import java.util.HashMap;
023import java.util.Map;
024
025/**
026 * Object containing info about a 3D content
027 *
028 * @since 8.4
029 */
030public class ThreeDInfo {
031
032    private static final long serialVersionUID = 1L;
033
034    public static final String NON_MANIFOLD_VERTICES = "non_manifold_vertices";
035
036    public static final String NON_MANIFOLD_EDGES = "non_manifold_edges";
037
038    public static final String NON_MANIFOLD_POLYGONS = "non_manifold_polygons";
039
040    public static final String VERTICES = "vertices";
041
042    public static final String EDGES = "edges";
043
044    public static final String POLYGONS = "polygons";
045
046    public static final String POSITION_X = "position_x";
047
048    public static final String POSITION_Y = "position_y";
049
050    public static final String POSITION_Z = "position_z";
051
052    public static final String DIMENSION_X = "dimension_x";
053
054    public static final String DIMENSION_Y = "dimension_y";
055
056    public static final String DIMENSION_Z = "dimension_z";
057
058    public static final String TEXTURES_SIZE = "textures_size";
059
060    public static final String TEXTURES_MAX_DIMENSION = "textures_max_dimension";
061
062    public static final String GEOMETRY_LOD_SUCCESS = "geometry_lod_success";
063
064    public static final String TEXTURE_LOD_SUCCESS = "texture_lod_success";
065
066    public final Long nonManifoldVertices;
067
068    public final Long nonManifoldEdges;
069
070    public final Long nonManifoldPolygons;
071
072    public final Long vertices;
073
074    public final Long edges;
075
076    public final Long polygons;
077
078    public final Double positionX;
079
080    public final Double positionY;
081
082    public final Double positionZ;
083
084    public final Double dimensionX;
085
086    public final Double dimensionY;
087
088    public final Double dimensionZ;
089
090    public final Long texturesSize;
091
092    public final String texturesMaxDimension;
093
094    public final Boolean geometryLodSuccess;
095
096    public final Boolean textureLodSuccess;
097
098    public ThreeDInfo(Map<String, Serializable> map) {
099        nonManifoldVertices = (Long) map.get(NON_MANIFOLD_VERTICES);
100        nonManifoldEdges = (Long) map.get(NON_MANIFOLD_EDGES);
101        nonManifoldPolygons = (Long) map.get(NON_MANIFOLD_POLYGONS);
102        vertices = (Long) map.get(VERTICES);
103        edges = (Long) map.get(EDGES);
104        polygons = (Long) map.get(POLYGONS);
105        positionX = (Double) map.get(POSITION_X);
106        positionY = (Double) map.get(POSITION_Y);
107        positionZ = (Double) map.get(POSITION_Z);
108        dimensionX = (Double) map.get(DIMENSION_X);
109        dimensionY = (Double) map.get(DIMENSION_Y);
110        dimensionZ = (Double) map.get(DIMENSION_Z);
111        texturesSize = (Long) map.get(TEXTURES_SIZE);
112        texturesMaxDimension = (String) map.get(TEXTURES_MAX_DIMENSION);
113        geometryLodSuccess = (Boolean) map.get(GEOMETRY_LOD_SUCCESS);
114        textureLodSuccess = (Boolean) map.get(TEXTURE_LOD_SUCCESS);
115    }
116
117    public Map<String, Serializable> toMap() {
118        Map<String, Serializable> map = new HashMap<>();
119        map.put(NON_MANIFOLD_VERTICES, nonManifoldVertices);
120        map.put(NON_MANIFOLD_EDGES, nonManifoldEdges);
121        map.put(NON_MANIFOLD_POLYGONS, nonManifoldPolygons);
122        map.put(VERTICES, vertices);
123        map.put(EDGES, edges);
124        map.put(POLYGONS, polygons);
125        map.put(POSITION_X, positionX);
126        map.put(POSITION_Y, positionY);
127        map.put(POSITION_Z, positionZ);
128        map.put(DIMENSION_X, dimensionX);
129        map.put(DIMENSION_Y, dimensionY);
130        map.put(DIMENSION_Z, dimensionZ);
131        map.put(TEXTURES_SIZE, texturesSize);
132        map.put(TEXTURES_MAX_DIMENSION, texturesMaxDimension);
133        map.put(GEOMETRY_LOD_SUCCESS, geometryLodSuccess);
134        map.put(TEXTURE_LOD_SUCCESS, textureLodSuccess);
135        return map;
136    }
137
138    public Long getNonManifoldVertices() {
139        return nonManifoldVertices;
140    }
141
142    public Long getNonManifoldEdges() {
143        return nonManifoldEdges;
144    }
145
146    public Long getNonManifoldPolygons() {
147        return nonManifoldPolygons;
148    }
149
150    public Long getVertices() {
151        return vertices;
152    }
153
154    public Long getEdges() {
155        return edges;
156    }
157
158    public Long getPolygons() {
159        return polygons;
160    }
161
162    public Double getPositionX() {
163        return positionX;
164    }
165
166    public Double getPositionY() {
167        return positionY;
168    }
169
170    public Double getPositionZ() {
171        return positionZ;
172    }
173
174    public Double getDimensionX() {
175        return dimensionX;
176    }
177
178    public Double getDimensionY() {
179        return dimensionY;
180    }
181
182    public Double getDimensionZ() {
183        return dimensionZ;
184    }
185
186    public Long getTexturesSize() {
187        return texturesSize;
188    }
189
190    public String getTexturesMaxDimension() {
191        return texturesMaxDimension;
192    }
193
194    public Boolean getGeometryLodSuccess() {
195        return geometryLodSuccess;
196    }
197
198    public Boolean getTextureLodSuccess() {
199        return textureLodSuccess;
200    }
201}