int lastId1 = lstIndexs[0]-1;
int lastId2 = sizeLstX - 1;
int firstId2 = sizeLstX - lstIndexs[sizeLstIdexes - 1];
- bool face1open = std::fabs(lstX[0] - lstX[lastId1]) > 0.0001 && std::fabs(lstY[0] - lstY[lastId1]) > 0.0001 && std::fabs(lstZ[0] - lstZ[lastId1]) > 0.0001;
- bool face2open = std::fabs(lstX[firstId2] - lstX[lastId2]) > 0.0001 && std::fabs(lstY[firstId2] - lstY[lastId2]) > 0.0001 && std::fabs(lstZ[firstId2] - lstZ[lastId2]) > 0.0001;
+ bool face1open = std::fabs(lstX[0] - lstX[lastId1]) > 0.0001 || std::fabs(lstY[0] - lstY[lastId1]) > 0.0001 || std::fabs(lstZ[0] - lstZ[lastId1]) > 0.0001;
+ bool face2open = std::fabs(lstX[firstId2] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[firstId2] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[firstId2] - lstZ[lastId2]) > 0.0001;
- bool altFace1open = std::fabs(lstX[0] - lstX[firstId2]) > 0.0001 && std::fabs(lstY[0] - lstY[firstId2]) > 0.0001 && std::fabs(lstZ[0] - lstZ[firstId2]) > 0.0001;
- bool altFace2open = std::fabs(lstX[lastId1] - lstX[lastId2]) > 0.0001 && std::fabs(lstY[lastId1] - lstY[lastId2]) > 0.0001 && std::fabs(lstZ[lastId1] - lstZ[lastId2]) > 0.0001;
+ bool altFace1open = std::fabs(lstX[0] - lstX[firstId2]) > 0.0001 || std::fabs(lstY[0] - lstY[firstId2]) > 0.0001 || std::fabs(lstZ[0] - lstZ[firstId2]) > 0.0001;
+ bool altFace2open = std::fabs(lstX[lastId1] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[lastId1] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[lastId1] - lstZ[lastId2]) > 0.0001;
//false = Open Contour
//true = Closed Contour
if (bbGetInputTool()==10) // Undo
{
bbGetInputMeshManagerModel()->Undo();
- bbSetOutputOut(bbGetInputMeshManagerModel()->GetReferencePoint());
+ std::vector<double> outData = bbGetInputMeshManagerModel()->GetReferencePoint();
+ std::vector<double> refNormal = bbGetInputMeshManagerModel()->GetReferenceNormal();
+ outData.insert(outData.end(), refNormal.begin(), refNormal.end());
+ bbSetOutputOut(outData);
} // if Tool 10 Undo
if (bbGetInputTool()==20) // Redo
{
bbGetInputMeshManagerModel()->Redo();
- bbSetOutputOut(bbGetInputMeshManagerModel()->GetReferencePoint());
+ std::vector<double> outData = bbGetInputMeshManagerModel()->GetReferencePoint();
+ std::vector<double> refNormal = bbGetInputMeshManagerModel()->GetReferenceNormal();
+ outData.insert(outData.end(), refNormal.begin(), refNormal.end());
+ bbSetOutputOut(outData);
} // if Tool 20 Redo
if (bbGetInputTool()==30) // Set
} // if Tool 35 Set memory mode
if(bbGetInputTool() == 37) // Save State Memory Mode
{
- if(bbGetInputDoubleParams().size() == 5){
+ if(bbGetInputDoubleParams().size() == 8){
std::vector<double> point = {bbGetInputDoubleParams()[0], bbGetInputDoubleParams()[1], bbGetInputDoubleParams()[2]};
bbGetInputMeshManagerModel()->SetReferencePoint(point);
+ std::vector<double> normVect = {bbGetInputDoubleParams()[3], bbGetInputDoubleParams()[4], bbGetInputDoubleParams()[5]};
+ bbGetInputMeshManagerModel()->SetReferenceNormal(normVect);
bbGetInputMeshManagerModel()->SaveMemoryMode();
}
}
{
bbGetInputIn()->SetNormalIn(bbGetInputParamVector());
bbGetInputIn()->Process();
- bbGetInputIn()->Execute();
+ //bbGetInputIn()->Execute();
} // if Type == 2
if((bbGetInputType()==3) && (bbGetInputIn()!=NULL) && (bbGetInputParamVector().size() == 3))
{
lastModified = 0;
memoryMode = false;
referencePoint = {0, 0, 0};
+ referenceNormal = {0, 0, 1};
}
MeshManagerModel::~MeshManagerModel()
return referencePoint;
}
+void MeshManagerModel::SetReferenceNormal(std::vector<double> normal)
+{
+ referenceNormal = normal;
+}
+
+std::vector<double> MeshManagerModel::GetReferenceNormal()
+{
+ return referenceNormal;
+}
+
int MeshManagerModel::GetNumberOfMeshes()
{
return _meshes.size();
if(history->UndoSize() > 0)
{
if(memoryMode == false){
- RestoreState(history->Undo(new ManagerState(_meshes, meshId, lastModified, referencePoint)));
+ RestoreState(history->Undo(new ManagerState(_meshes, meshId, lastModified)));
RefreshOutputs(true);
}
else if(history->UndoSize() > 1){
if(history->RedoSize() > 0)
{
if(memoryMode == false){
- RestoreState(history->Redo(new ManagerState(_meshes, meshId, lastModified, referencePoint)));
+ RestoreState(history->Redo(new ManagerState(_meshes, meshId, lastModified)));
RefreshOutputs(true);
}
else{
void MeshManagerModel::Save()
{
- history->Save(new ManagerState(_meshes, meshId, currentMesh, referencePoint));
+ history->Save(new ManagerState(_meshes, meshId, currentMesh));
}
void MeshManagerModel::SaveMemoryMode()
{
std::vector<std::shared_ptr<MeshModel>> savedMesh;
savedMesh.push_back(std::make_shared<MeshModel>(_meshes.at(0).get()));
- history->Save(new ManagerState(savedMesh, meshId, 0, referencePoint));
+ history->Save(new ManagerState(savedMesh, meshId, 0, referencePoint, referenceNormal));
}
else{
printf("PG MeshManagerModel::SaveMemoryMode WARNING Mesh vector has invalid size or memoryMode is not set \n");
_meshes.at(0)->GetMeshBase()->GetPoints()->Modified();
_meshes.at(0)->GetMeshBase()->Modified();
referencePoint = state->GetReferencePoint();
+ referenceNormal = state->referenceNormal;
}else{
printf("PG MeshManagerModel::RestoreStateMemoryMode WARNING Mesh vector has invalid size or state is NULL\n");
}
//
//Manager State
//
-MeshManagerModel::ManagerState::ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedPos, std::vector<double> refPoint)
+MeshManagerModel::ManagerState::ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedPos)
+{
+ savedMeshes = meshesToSave;
+ savedId = meshId;
+ savedModifiedPos = modifiedPos;
+}
+
+MeshManagerModel::ManagerState::ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedPos, std::vector<double> refPoint, std::vector<double> refNormal)
{
savedMeshes = meshesToSave;
savedId = meshId;
savedModifiedPos = modifiedPos;
referencePoint = refPoint;
+ referenceNormal = refNormal;
}
MeshManagerModel::ManagerState::~ManagerState()
void SetReferencePoint(std::vector<double> point);
std::vector<double> GetReferencePoint();
+ void SetReferenceNormal(std::vector<double> normal);
+ std::vector<double> GetReferenceNormal();
void SetMeshBase(vtkPolyData* mesh);
void SetMeshMemoryMode(vtkPolyData* mesh);
int lastModified;
bool memoryMode;
std::vector<double> referencePoint;
+ std::vector<double> referenceNormal;
class ManagerState{
public:
- ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId, std::vector<double> refPoint);
+ ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId);
+ ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId, std::vector<double> refPoint, std::vector<double> refNormal);
~ManagerState();
std::vector<std::shared_ptr<MeshModel>>& GetMeshes();
int GetMeshId();
int GetModifiedPos();
std::vector<double>& GetReferencePoint();
- private:
+
std::vector<std::shared_ptr<MeshModel>> savedMeshes;
int savedModifiedPos;
int savedId;
std::vector<double> referencePoint;
+ std::vector<double> referenceNormal;
};
void Save();