00001 //###################################################################### 00002 // 00003 // GraspIt! 00004 // Copyright (C) 2002-2009 Columbia University in the City of New York. 00005 // All rights reserved. 00006 // 00007 // GraspIt! is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // GraspIt! is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with GraspIt!. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // Author(s): Corey Goldfeder 00021 // 00022 // $Id: model.h,v 1.14 2010/08/10 17:24:56 cmatei Exp $ 00023 // 00024 //###################################################################### 00025 00030 #ifndef DB_PLANNER_MODEL_H 00031 #define DB_PLANNER_MODEL_H 00032 00033 #include <string> 00034 #include <vector> 00035 #include <set> 00036 using std::string; 00037 using std::set; 00038 00039 namespace db_planner { 00040 00042 00045 class Model { 00046 private: 00048 int model_id_; 00050 string model_name_, geometry_path_, thumbnail_path_; 00052 double scale_, rescale_factor_; 00054 set<string> tags_; 00056 std::vector<double> vertices_; 00058 std::vector<int> triangles_; 00059 public: 00060 virtual ~Model(){} 00062 const string& ModelName() const { return model_name_; } 00063 const string& ThumbnailPath() const { return thumbnail_path_; } 00064 const string& GeometryPath() const { return geometry_path_; } 00065 double Scale() const { return scale_; } 00066 double RescaleFactor() const { return rescale_factor_; } 00067 int ModelId() const { return model_id_;} 00068 void SetModelId(int id) {model_id_ = id;} 00069 const set<string>& Tags() { return tags_; } 00070 void SetModelName(const string& model_name) { model_name_ = model_name; } 00071 void SetThumbnailPath(const string& thumbnail_path) { 00072 thumbnail_path_ = thumbnail_path; 00073 } 00074 void SetGeometryPath(const string& geometry_path) { 00075 geometry_path_ = geometry_path; 00076 } 00077 void SetScale(const double scale) { scale_ = scale; } 00078 void SetRescaleFactor(const double rescale_factor) { 00079 rescale_factor_ = rescale_factor; 00080 } 00081 template <class Iterator> 00082 void SetTags(const Iterator& start, const Iterator& end) { 00083 tags_.clear(); 00084 tags_.insert(start, end); 00085 } 00086 void SetGeometry(const std::vector<double> &vertices, const std::vector<int> &triangles) { 00087 vertices_ = vertices; 00088 triangles_ = triangles; 00089 } 00090 const std::vector<double>& GetVertices() const {return vertices_;} 00091 const std::vector<int>& GetTriangles() const {return triangles_;} 00092 }; 00093 00094 00096 00099 class ModelAllocator { 00100 public: 00102 virtual Model* Get() const = 0; 00103 virtual ~ModelAllocator() {}; 00104 }; 00105 00106 00107 } // end namespace db_planner 00108 00109 #endif // DB_PLANNER_MODEL_H