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