if (bbGetInputTool()==10) // Undo
{
bbGetInputMeshManagerModel()->Undo();
- //printf("EED Warning! MeshManager_tool Undo Not implemented.\n");
+ bbSetOutputOut(bbGetInputMeshManagerModel()->GetReferencePoint());
} // if Tool 10 Undo
if (bbGetInputTool()==20) // Redo
{
bbGetInputMeshManagerModel()->Redo();
- //printf("EED Warning! MeshManager_tool Redo Not implemented.\n");
+ bbSetOutputOut(bbGetInputMeshManagerModel()->GetReferencePoint());
} // if Tool 20 Redo
if (bbGetInputTool()==30) // Set
} // if Tool 35 Set memory mode
if(bbGetInputTool() == 37) // Save State Memory Mode
{
- if(bbGetInputStringParam().length() > 0){
- cout << " MeshManager_tool : MeshManagerModel Executed tool 37" << endl;//bGetInputMeshManagerModel()->Save();
+ if(bbGetInputDoubleParams().size() == 5){
+ std::vector<double> point = {bbGetInputDoubleParams()[0], bbGetInputDoubleParams()[1], bbGetInputDoubleParams()[2]};
+ bbGetInputMeshManagerModel()->SetReferencePoint(point);
bbGetInputMeshManagerModel()->SaveMemoryMode();
- // cout << bbGetInputStringParam() << endl;
}
}
if (bbGetInputTool()==32) // Copy and Set
BBTK_DECLARE_INPUT(MeshManagerModel,MeshManagerModel*);
BBTK_DECLARE_INPUT(Meshes,std::vector<vtkPolyData*>);
BBTK_DECLARE_INPUT(StringParam, std::string);
-// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_DECLARE_INPUT(DoubleParams, std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out,std::vector<double>);
BBTK_PROCESS(Process);
void Process();
//=====
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(MeshManager_tool,Tool,"(default 0) 0:Nothing 10:Undo 20:ReDo 30:Set 32:Copy and Set 35:Set memory mode 40:ResetMeshTemp 50: Set Array of meshes 60:Select mesh by name 70:Delete current mesh",int,"");
+ BBTK_INPUT(MeshManager_tool,Tool,"(default 0) 0:Nothing 10:Undo 20:ReDo 30:Set 32:Copy and Set 35:Set memory mode 37:Save state memory mode 40:ResetMeshTemp 50: Set Array of meshes 60:Select mesh by name 70:Delete current mesh",int,"");
BBTK_INPUT(MeshManager_tool,Mesh,"Mesh",vtkPolyData*,"");
BBTK_INPUT(MeshManager_tool,Meshes,"Input meshes, required for tool 50",std::vector<vtkPolyData*>,"");
BBTK_INPUT(MeshManager_tool,StringParam,"String input",std::string,"");
+ BBTK_INPUT(MeshManager_tool,DoubleParams,"Double Vector input",std::vector<double>,"");
BBTK_INPUT(MeshManager_tool,MeshManagerModel,"Mesh Manager Model",MeshManagerModel*,"");
-// BBTK_OUTPUT(MeshManager_tool,Out,"First output",double,"");
+ BBTK_OUTPUT(MeshManager_tool,Out,"Output",std::vector<double>,"");
+
BBTK_END_DESCRIBE_BLACK_BOX(MeshManager_tool);
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
bbGetInputIn()->Process();
bbGetInputIn()->Execute();
} // if Type == 1
+ if((bbGetInputType()==2) && (bbGetInputIn()!=NULL) && (bbGetInputParamVector().size() == 3))
+ {
+ bbGetInputIn()->SetNormalIn(bbGetInputParamVector());
+ bbGetInputIn()->Process();
+ bbGetInputIn()->Execute();
+ } // if Type == 2
+ if((bbGetInputType()==3) && (bbGetInputIn()!=NULL) && (bbGetInputParamVector().size() == 3))
+ {
+ bbGetInputIn()->SetOrigin(bbGetInputParamVector());
+ bbGetInputIn()->Process();
+ bbGetInputIn()->Execute();
+ } // if Type == 3
}
//=====
BBTK_DECLARE_INPUT(In, creaVtkPlaneWidget* );
BBTK_DECLARE_INPUT(Type, int );
BBTK_DECLARE_INPUT(Param, double );
+ BBTK_DECLARE_INPUT(ParamVector, std::vector<double> );
BBTK_DECLARE_OUTPUT(Out,double);
BBTK_PROCESS(Process);
void Process();
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
BBTK_INPUT(PlaneWidget_Base,In,"Base creaVtkPlaneWidget ", creaVtkPlaneWidget* ,"");
- BBTK_INPUT(PlaneWidget_Base,Type,"(default 0) 0:nothing 1:Move Normal Direction (Param=step) ", int ,"");
+ BBTK_INPUT(PlaneWidget_Base,Type,"(default 0) 0:nothing 1:Move Normal Direction (Param=step) 2:Set Normal (ParamVector=Normal) 3:Set Origin (ParamVector=Origin)", int ,"");
BBTK_INPUT(PlaneWidget_Base,Param,"Type=1 step ", double ,"");
+ BBTK_INPUT(PlaneWidget_Base,ParamVector,"Type=2 Set normal, Type=3 Set origin", std::vector<double> ,"");
// BBTK_OUTPUT(PlaneWidget_Base,Out,"First output",double,"");
BBTK_END_DESCRIBE_BLACK_BOX(PlaneWidget_Base);
//=====
{
if(mesh != NULL)
{
- _meshBase = vtkPolyData::New();//mesh;
+ _meshBase = vtkPolyData::New();
_meshBase->DeepCopy(mesh);
_meshTemp = vtkPolyData::New();
_meshTemp->DeepCopy(_meshBase);
history = new HistoryHandler<ManagerState>(15);
lastModified = 0;
memoryMode = false;
+ referencePoint = {0, 0, 0};
}
MeshManagerModel::~MeshManagerModel()
history->CleanHistory();
}
+void MeshManagerModel::SetReferencePoint(std::vector<double> point)
+{
+ referencePoint = point;
+}
+
+std::vector<double> MeshManagerModel::GetReferencePoint()
+{
+ return referencePoint;
+}
+
int MeshManagerModel::GetNumberOfMeshes()
{
return _meshes.size();
if(history->UndoSize() > 0)
{
if(memoryMode == false){
- RestoreState(history->Undo(new ManagerState(_meshes, meshId, lastModified)));
+ RestoreState(history->Undo(new ManagerState(_meshes, meshId, lastModified, referencePoint)));
RefreshOutputs(true);
}
else if(history->UndoSize() > 1){
if(history->RedoSize() > 0)
{
if(memoryMode == false){
- RestoreState(history->Redo(new ManagerState(_meshes, meshId, lastModified)));
+ RestoreState(history->Redo(new ManagerState(_meshes, meshId, lastModified, referencePoint)));
RefreshOutputs(true);
}
else{
void MeshManagerModel::Save()
{
- history->Save(new ManagerState(_meshes, meshId, currentMesh));
+ history->Save(new ManagerState(_meshes, meshId, currentMesh, referencePoint));
}
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));
+ history->Save(new ManagerState(savedMesh, meshId, 0, referencePoint));
}
else{
printf("PG MeshManagerModel::SaveMemoryMode WARNING Mesh vector has invalid size or memoryMode is not set \n");
_meshes.at(0)->GetMeshBase()->SetPoints(statePoints);
_meshes.at(0)->GetMeshBase()->GetPoints()->Modified();
_meshes.at(0)->GetMeshBase()->Modified();
+ referencePoint = state->GetReferencePoint();
}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)
+MeshManagerModel::ManagerState::ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedPos, std::vector<double> refPoint)
{
savedMeshes = meshesToSave;
savedId = meshId;
savedModifiedPos = modifiedPos;
+ referencePoint = refPoint;
}
MeshManagerModel::ManagerState::~ManagerState()
return savedModifiedPos;
}
+std::vector<double>& MeshManagerModel::ManagerState::GetReferencePoint()
+{
+ return referencePoint;
+}
void ResetHistory();
void ResetAll();
+ void SetReferencePoint(std::vector<double> point);
+ std::vector<double> GetReferencePoint();
+
void SetMeshBase(vtkPolyData* mesh);
void SetMeshMemoryMode(vtkPolyData* mesh);
void MeshMemoryModeOn();
int meshId;
int lastModified;
bool memoryMode;
+ std::vector<double> referencePoint;
class ManagerState{
public:
- 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);
~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;
};
void Save();