Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

ImageRepository.h
00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
00002 //
00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
00004 // and considered a trade secret as defined under civil and criminal statutes.
00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
00006 // unauthorized use or misappropriation of its trade secrets.  Use of this information
00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
00009 
00010 #pragma once
00011 
00012 #include "TextureWriter.h"
00013 
00014 #include <hc.h>
00015 
00016 #include <slapi/model/image.h>
00017 #include <slapi/model/face.h>
00018 
00019 #include <map>
00020 #include <string>
00021 #include <cstdint>
00022 
00023 class HIOUtilityMagick;
00024 
00025 class ImageRepository
00026 {
00027 public:
00028     ImageRepository(HC_KEY includeSegmentKey, TextureWriter& textureWriter);
00029 
00030     bool ImportAllTextureImages();
00031 
00032     bool GetImageInfo(SUImageRef& image, HC_KEY& key, std::string& name);
00033     bool GetImageInfo(int32_t textureId, HC_KEY& key, std::string& name);
00034 
00035 private:
00036     ImageRepository(const ImageRepository&);
00037     ImageRepository& operator=(const ImageRepository&);
00038 
00039     bool LoadTextureFile(HIOUtilityMagick& hioMagick, const std::string& directory, int32_t textureId);
00040     void AssignNameToImage(HC_KEY imageKey, std::string& imageName);
00041 
00042 private:
00043     HC_KEY m_imagesSegmentKey;
00044 
00045     TextureWriter& m_textureWriter;
00046 
00047     struct ImageInfo {
00048         ImageInfo() { }
00049 
00050         ImageInfo(HC_KEY k, const std::string& n)
00051             : key(k), name(n) { }
00052 
00053         HC_KEY      key;
00054         std::string name;
00055     };
00056 
00057     std::map<int32_t, ImageInfo> m_imagesMap;
00058 };