00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "g-map-vertex.hh"
00026 #include "controler-gmap.hh"
00027 #include <cassert>
00028
00029 using namespace GMap3d;
00030
00031 bool CControlerGMap::materializeBarycenter()
00032 {
00033 if (canApplyOperation(COperation(OPERATION_MATERIALIZE,
00034 SUB_OPERATION_MATERIALIZE_BARYCENTER, -1)))
00035 {
00036 undoRedoPreSave();
00037 FMap->materializeBarycenter(getSelectionMark());
00038 undoRedoPostSaveOk();
00039
00040 setModelChanged();
00041 setMessage("Barycentre matérialisé");
00042 return true;
00043 }
00044
00045 return false;
00046 }
00047
00048 bool CControlerGMap::materializeAxe()
00049 {
00050 if (canApplyOperation(COperation(OPERATION_MATERIALIZE,
00051 SUB_OPERATION_MATERIALIZE_AXE, -1)))
00052 {
00053 CDart *d1, *d2;
00054
00055 if (FMap->getMarkedCells(ORBIT_VERTEX, getSelectionMark(),
00056 getLastSelectedDart(), &d2,&d1) != 2)
00057 {
00058 setMessage("Sélection incohérente");
00059 return false;
00060 }
00061
00062 undoRedoPreSave();
00063 CDart * d= FMap->materializeAxe(d1,d2);
00064 undoRedoPostSaveOk();
00065 unmarkAllCurrentSelectionLevel();
00066 FMap->markOrbit(d,ORBIT_EDGE, getSelectionMark());
00067 selectDart(d);
00068
00069 setModelChanged();
00070 setMessage("Axe matérialisé");
00071 return true;
00072 }
00073 return false;
00074 }
00075
00076 bool CControlerGMap::materializePlane()
00077 {
00078 if (canApplyOperation(COperation(OPERATION_MATERIALIZE,
00079 SUB_OPERATION_MATERIALIZE_PLANE, -1)))
00080 {
00081 CDart *d1, *d2, *d3;
00082
00083 if (FMap->getMarkedCells(ORBIT_VERTEX, getSelectionMark(),
00084 getLastSelectedDart(), &d3,&d2,&d1) != 3)
00085 {
00086 setMessage("Sélection incohérente");
00087 return false;
00088 }
00089
00090 undoRedoPreSave();
00091 CDart * d= FMap->materializePlane(d1,d2,d3);
00092 undoRedoPostSaveOk();
00093 unmarkAllCurrentSelectionLevel();
00094 FMap->markOrbit(d,ORBIT_FACE, getSelectionMark());
00095 selectDart(d);
00096
00097 setModelChanged();
00098 setMessage("Plan matérialisé");
00099 return true;
00100 }
00101 return false;
00102 }
00103
00104 bool CControlerGMap::materializeNormalVector()
00105 {
00106 if (canApplyOperation(COperation(OPERATION_MATERIALIZE,
00107 SUB_OPERATION_MATERIALIZE_NORMAL_VECTOR, -1)))
00108 {
00109 CDart * last = getLastSelectedDart();
00110
00111 if (last==NULL ||
00112 FMap->getMarkedCells(ORBIT_FACE, getSelectionMark()) != 1 ||
00113 FMap->getNbPolylineVertices(last) < 3)
00114 {
00115 setMessage("Sélection incohérente");
00116 return false;
00117 }
00118
00119 undoRedoPreSave();
00120 CDart * d= FMap->materializeNormalVector(last);
00121 undoRedoPostSaveOk();
00122 unmarkAllCurrentSelectionLevel();
00123 FMap->markOrbit(d,ORBIT_EDGE, getSelectionMark());
00124 selectDart(d);
00125
00126 setModelChanged();
00127 setMessage("Vecteur normal matérialisé");
00128 return true;
00129 }
00130 return false;
00131 }
00132
00133 bool CControlerGMap::materializeOrthoPlane()
00134 {
00135 if (canApplyOperation(COperation(OPERATION_MATERIALIZE,
00136 SUB_OPERATION_MATERIALIZE_ORTHO_PLANE, -1)))
00137 {
00138 CDart *d1, *d2;
00139
00140 CDart * last = getLastSelectedDart();
00141
00142 if (last==NULL ||
00143 FMap->getMarkedCells(ORBIT_VERTEX, getSelectionMark(),
00144 last, &d2, &d1) != 2)
00145 {
00146 setMessage("Sélection incohérente");
00147 return false;
00148 }
00149
00150 undoRedoPreSave();
00151 CDart * d= FMap->materializeNormalPlane(d1,d2);
00152 undoRedoPostSaveOk();
00153 unmarkAllCurrentSelectionLevel();
00154 FMap->markOrbit(d,ORBIT_FACE, getSelectionMark());
00155 selectDart(d);
00156
00157 setModelChanged();
00158 setMessage("Plan normal matérialisé");
00159 return true;
00160 }
00161 return false;
00162 }
00163
00164 bool CControlerGMap::materializeReferential()
00165 {
00166 if (canApplyOperation(COperation(OPERATION_MATERIALIZE,
00167 SUB_OPERATION_MATERIALIZE_REFERENTIAL, -1)))
00168 {
00169 undoRedoPreSave();
00170 FMap->materializeReferential();
00171 undoRedoPostSaveOk();
00172
00173 setModelChanged();
00174 setMessage("Référentiel matérialisé");
00175 return false;
00176 }
00177 return false;
00178 }
00179