package cactusServer.models; import java.io.IOException; import java.util.HashMap; import org.ntlab.radishforandroidstudio.framework.model3D.Model3D; import org.ntlab.radishforandroidstudio.framework.model3D.ModelFactory; import org.ntlab.radishforandroidstudio.framework.model3D.ModelFileFormatException; public class ObjectModelManager { private static ObjectModelManager theInstance = null; private HashMap<Integer, Model3D> model = new HashMap<>(); private ObjectModelManager() { try { setObject(0, ModelFactory.loadModel(getClass().getResource("../../cube-binary.stl").getPath())); setObject(1, ModelFactory.loadModel(getClass().getResource("../../cube-binary.stl").getPath())); } catch (IOException | ModelFileFormatException e) { e.printStackTrace(); } } public static ObjectModelManager getInstance() { if (theInstance == null) { theInstance = new ObjectModelManager(); } return theInstance; } public void setObject(int key, Model3D loadModel) { model.put(key, loadModel); } public Model3D getObject(int objectID) { return model.get(objectID); } public int getObjectModelCount() { return model.size(); } }