00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 00027 #ifndef __FORM_CTRL_SHAPE_H_ 00028 #define __FORM_CTRL_SHAPE_H_ 00029 00030 #ifdef MIP_HOST_APPLE 00031 #include <applePatch.h> 00032 #endif 00033 00034 #include <vector> 00035 #include <list> 00036 #include <map> 00037 #include <set> 00038 #include <baselib.h> 00039 00040 using namespace std; 00041 using namespace MipBaselib; 00042 00044 /* @{ */ 00045 00049 class FormCtrlShape{ 00050 private: 00051 typedef map<int,Position3D > BasePoss; 00052 00053 00054 bool _useSpecificMembers; /*use specific members*/ 00055 00056 list <int> _specificMembers; /*list of the specific memb*/ 00057 list <int> _leftSpecificMembers; /*list of the specific memb which have no positon assigned yet*/ 00058 int _unlimMemberCounter; /*counter for non specific members*/ 00059 00060 set < pair <unsigned int,unsigned int > >_bannedIdPairs; 00061 00062 protected: 00063 00064 BasePoss _basePoss; 00065 00066 Decimal _scaleFactor; 00067 00068 void _banIdPair(unsigned i,unsigned j); 00069 bool _idPairIsBanned(unsigned i,unsigned j); 00070 00071 void _setSpecificMembers(list <int> members); 00072 00073 void _addPosition(Position3D pos); 00074 00075 public: 00076 00077 FormCtrlShape(){ 00078 _scaleFactor = 1.0; 00079 _useSpecificMembers = false; 00080 _unlimMemberCounter = 0; 00081 } 00082 00083 FormCtrlShape(const FormCtrlShape& p); 00084 00085 FormCtrlShape& operator=(const FormCtrlShape& rhs); 00086 00087 Decimal getDistance(unsigned int i,unsigned int j); 00088 00089 // Position3D getRelPosition(unsigned int i,unsigned int j); 00090 00091 Position3D getCentroid(); 00092 00093 Position3D getCentroidRelPos(unsigned int i); 00094 00095 void setScaleFactor(Decimal scale); 00096 00097 Decimal getScaleFactor(); 00098 }; 00099 00100 00104 class FormCtrlRettangleSh : public FormCtrlShape{ 00105 00106 public: 00107 00108 FormCtrlRettangleSh(Decimal e1,Decimal e2); 00109 }; 00110 00111 00115 class FormCtrlRegularPolySh : public FormCtrlShape{ 00116 00117 public: 00118 00119 FormCtrlRegularPolySh(Decimal radius,unsigned int order); 00120 }; 00121 00122 00126 class FormCtrlPyramidSh : public FormCtrlShape{ 00127 00128 public: 00129 00130 FormCtrlPyramidSh(Decimal base,Decimal height); 00131 }; 00132 00133 00137 class FormCtrlDoublePyrSh : public FormCtrlPyramidSh{ 00138 00139 public: 00140 00141 FormCtrlDoublePyrSh(Decimal base,Decimal height); 00142 }; 00143 00144 00148 class FormCtrlTetraSh : public FormCtrlRegularPolySh{ 00149 00150 public: 00151 00152 FormCtrlTetraSh(Decimal edge); 00153 }; 00154 00155 00159 class FormCtrlCubeSh : public FormCtrlShape{ 00160 00161 public: 00162 00163 FormCtrlCubeSh(Decimal edge); 00164 }; 00165 00166 00170 class FormCtrlCubeSoftSh : public FormCtrlCubeSh{ 00171 00172 public: 00173 00174 FormCtrlCubeSoftSh(Decimal edge); 00175 }; 00176 00177 #endif 00178 00179 00180 /* @} */ 00181 00182 00183 00184