FEM: code formating: remove trailing white spaces
This commit is contained in:
@@ -167,11 +167,11 @@ private:
|
||||
}
|
||||
|
||||
Base::FileInfo file(EncodedName.c_str());
|
||||
|
||||
|
||||
try {
|
||||
std::auto_ptr<FemMesh> mesh(new FemMesh);
|
||||
mesh->read(EncodedName.c_str());
|
||||
|
||||
|
||||
FemMeshObject *pcFeature = static_cast<FemMeshObject *>
|
||||
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
|
||||
pcFeature->Label.setValue(file.fileNamePure().c_str());
|
||||
@@ -182,20 +182,20 @@ private:
|
||||
catch(Base::Exception& e) {
|
||||
#ifdef FC_USE_VTK
|
||||
if( FemPostPipeline::canRead(file) ) {
|
||||
|
||||
|
||||
FemPostPipeline *pcFeature = static_cast<FemPostPipeline *>
|
||||
(pcDoc->addObject("Fem::FemPostPipeline", file.fileNamePure().c_str()));
|
||||
|
||||
|
||||
pcFeature->Label.setValue(file.fileNamePure().c_str());
|
||||
pcFeature->read(file);
|
||||
pcFeature->touch();
|
||||
pcDoc->recomputeFeature(pcFeature);
|
||||
}
|
||||
else
|
||||
else
|
||||
throw e;
|
||||
#else
|
||||
throw e;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return Py::None();
|
||||
|
||||
@@ -34,7 +34,7 @@ set(Fem_LIBS
|
||||
SMDS
|
||||
SMESHDS
|
||||
)
|
||||
|
||||
|
||||
if(BUILD_FEM_NETGEN)
|
||||
set(Fem_LIBS
|
||||
${Fem_LIBS}
|
||||
@@ -209,11 +209,11 @@ SET(FemConstraints_SRCS
|
||||
FemConstraintPlaneRotation.cpp
|
||||
FemConstraintPlaneRotation.h
|
||||
FemConstraintContact.cpp
|
||||
FemConstraintContact.h
|
||||
FemConstraintContact.h
|
||||
)
|
||||
SOURCE_GROUP("Constraints" FILES ${FemConstraints_SRCS})
|
||||
|
||||
if(BUILD_FEM_VTK)
|
||||
if(BUILD_FEM_VTK)
|
||||
SET(FemPost_SRCS
|
||||
PropertyPostDataObject.h
|
||||
PropertyPostDataObject.cpp
|
||||
|
||||
@@ -42,10 +42,10 @@ PROPERTY_SOURCE(Fem::ConstraintContact, Fem::Constraint);
|
||||
ConstraintContact::ConstraintContact()
|
||||
{
|
||||
/*Note: Initialise parameters here*/
|
||||
ADD_PROPERTY(Slope,(0.0));
|
||||
ADD_PROPERTY(Slope,(0.0));
|
||||
ADD_PROPERTY(Friction,(0.0));
|
||||
/* */
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(Points,(Base::Vector3d()),"ConstraintContact",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
"Points where symbols are drawn");
|
||||
ADD_PROPERTY_TYPE(Normals,(Base::Vector3d()),"ConstraintContact",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
|
||||
@@ -36,20 +36,20 @@ class AppFemExport ConstraintContact : public Fem::Constraint
|
||||
public:
|
||||
/// Constructor
|
||||
ConstraintContact(void);
|
||||
|
||||
|
||||
// Read-only (calculated values). These trigger changes in the ViewProvider
|
||||
App::PropertyVectorList Points;
|
||||
App::PropertyVectorList Normals;
|
||||
|
||||
|
||||
/*Note*/
|
||||
//Constraint parameters
|
||||
/******
|
||||
* Add the constraint parameters here, the variables or data
|
||||
* that needs to be eventually send over to the calculix input file.
|
||||
* Add the constraint parameters here, the variables or data
|
||||
* that needs to be eventually send over to the calculix input file.
|
||||
* This is only the definitions of the variables
|
||||
******/
|
||||
//ex.
|
||||
App::PropertyFloat Slope;
|
||||
App::PropertyFloat Slope;
|
||||
App::PropertyFloat Friction;
|
||||
|
||||
//etc
|
||||
|
||||
@@ -43,10 +43,10 @@ PROPERTY_SOURCE(Fem::ConstraintHeatflux, Fem::Constraint);
|
||||
|
||||
ConstraintHeatflux::ConstraintHeatflux()
|
||||
{
|
||||
ADD_PROPERTY(AmbientTemp,(0.0));
|
||||
/*ADD_PROPERTY(FaceTemp,(0.0));*/
|
||||
ADD_PROPERTY(FilmCoef,(0.0));
|
||||
|
||||
ADD_PROPERTY(AmbientTemp,(0.0));
|
||||
/*ADD_PROPERTY(FaceTemp,(0.0));*/
|
||||
ADD_PROPERTY(FilmCoef,(0.0));
|
||||
|
||||
ADD_PROPERTY_TYPE(Points,(Base::Vector3d()),"ConstraintHeatflux",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
"Points where symbols are drawn");
|
||||
ADD_PROPERTY_TYPE(Normals,(Base::Vector3d()),"ConstraintHeatflux",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
|
||||
@@ -44,8 +44,8 @@ PROPERTY_SOURCE(Fem::ConstraintInitialTemperature, Fem::Constraint);
|
||||
|
||||
ConstraintInitialTemperature::ConstraintInitialTemperature()
|
||||
{
|
||||
ADD_PROPERTY(initialTemperature,(300.0));
|
||||
|
||||
ADD_PROPERTY(initialTemperature,(300.0));
|
||||
|
||||
ADD_PROPERTY_TYPE(Points,(Base::Vector3d()),"ConstraintInitialTemperature",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
"Points where symbols are drawn");
|
||||
ADD_PROPERTY_TYPE(Normals,(Base::Vector3d()),"ConstraintInitialTemperature",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
|
||||
@@ -39,14 +39,14 @@ class AppFemExport ConstraintInitialTemperature : public Fem::Constraint
|
||||
public:
|
||||
/// Constructor
|
||||
ConstraintInitialTemperature(void);
|
||||
|
||||
|
||||
// Read-only (calculated values). These trigger changes in the ViewProvider
|
||||
App::PropertyVectorList Points;
|
||||
App::PropertyVectorList Normals;
|
||||
|
||||
//Temperature parameters
|
||||
App::PropertyFloat initialTemperature;
|
||||
|
||||
App::PropertyFloat initialTemperature;
|
||||
|
||||
|
||||
/// recalculate the object
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
@@ -41,7 +41,7 @@ PROPERTY_SOURCE(Fem::ConstraintPlaneRotation, Fem::Constraint);
|
||||
|
||||
ConstraintPlaneRotation::ConstraintPlaneRotation()
|
||||
{
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(Points,(Base::Vector3d()),"ConstraintPlaneRotation",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
"Points where symbols are drawn");
|
||||
ADD_PROPERTY_TYPE(Normals,(Base::Vector3d()),"ConstraintPlaneRotation",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
|
||||
@@ -36,11 +36,11 @@ class AppFemExport ConstraintPlaneRotation : public Fem::Constraint
|
||||
public:
|
||||
/// Constructor
|
||||
ConstraintPlaneRotation(void);
|
||||
|
||||
|
||||
// Read-only (calculated values). These trigger changes in the ViewProvider
|
||||
App::PropertyVectorList Points;
|
||||
App::PropertyVectorList Normals;
|
||||
|
||||
|
||||
|
||||
/// recalculate the object
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
@@ -44,8 +44,8 @@ PROPERTY_SOURCE(Fem::ConstraintTemperature, Fem::Constraint);
|
||||
|
||||
ConstraintTemperature::ConstraintTemperature()
|
||||
{
|
||||
ADD_PROPERTY(Temperature,(300.0));
|
||||
|
||||
ADD_PROPERTY(Temperature,(300.0));
|
||||
|
||||
ADD_PROPERTY_TYPE(Points,(Base::Vector3d()),"ConstraintTemperature",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
"Points where symbols are drawn");
|
||||
ADD_PROPERTY_TYPE(Normals,(Base::Vector3d()),"ConstraintTemperature",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||
|
||||
@@ -39,14 +39,14 @@ class AppFemExport ConstraintTemperature : public Fem::Constraint
|
||||
public:
|
||||
/// Constructor
|
||||
ConstraintTemperature(void);
|
||||
|
||||
|
||||
// Read-only (calculated values). These trigger changes in the ViewProvider
|
||||
App::PropertyVectorList Points;
|
||||
App::PropertyVectorList Normals;
|
||||
|
||||
//Temperature parameters
|
||||
App::PropertyFloat Temperature;
|
||||
|
||||
App::PropertyFloat Temperature;
|
||||
|
||||
|
||||
/// recalculate the object
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
@@ -91,7 +91,7 @@ FemMesh::FemMesh()
|
||||
}
|
||||
|
||||
FemMesh::FemMesh(const FemMesh& mesh)
|
||||
{
|
||||
{
|
||||
myMesh = getGenerator()->CreateMesh(StatCount++,false);
|
||||
copyMeshData(mesh);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ void FemMesh::copyMeshData(const FemMesh& mesh)
|
||||
_Mtrx = mesh._Mtrx;
|
||||
|
||||
SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS();
|
||||
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = mesh.myMesh->GetMeshDS()->nodesIterator();
|
||||
for (;aNodeIter->more();) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
@@ -454,7 +454,7 @@ std::list<int> FemMesh::getFacesByFace(const TopoDS_Face &face) const
|
||||
// For curved faces it is possible that a volume contributes more than one face
|
||||
if (element_face_nodes.size() == static_cast<std::size_t>(numNodes)) {
|
||||
result.push_back(face->GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.sort();
|
||||
|
||||
@@ -47,7 +47,7 @@ FemPostFilter::FemPostFilter()
|
||||
|
||||
FemPostFilter::~FemPostFilter()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FemPostFilter::addFilterPipeline(const FemPostFilter::FilterPipeline& p, std::string name) {
|
||||
@@ -59,20 +59,20 @@ FemPostFilter::FilterPipeline& FemPostFilter::getFilterPipeline(std::string name
|
||||
}
|
||||
|
||||
void FemPostFilter::setActiveFilterPipeline(std::string name) {
|
||||
|
||||
|
||||
if(m_activePipeline != name && isValid()) {
|
||||
m_activePipeline = name;
|
||||
}
|
||||
}
|
||||
|
||||
DocumentObjectExecReturn* FemPostFilter::execute(void) {
|
||||
|
||||
|
||||
if(!m_pipelines.empty() && !m_activePipeline.empty()) {
|
||||
|
||||
|
||||
FemPostFilter::FilterPipeline& pipe = m_pipelines[m_activePipeline];
|
||||
pipe.source->SetInputDataObject(getInputData());
|
||||
pipe.target->Update();
|
||||
|
||||
|
||||
Data.setValue(pipe.target->GetOutputDataObject(0));
|
||||
}
|
||||
return StdReturn;
|
||||
@@ -87,14 +87,14 @@ vtkDataObject* FemPostFilter::getInputData() {
|
||||
//get the pipeline and use the pipelinedata
|
||||
std::vector<App::DocumentObject*> objs = getDocument()->getObjectsOfType(FemPostPipeline::getClassTypeId());
|
||||
for(std::vector<App::DocumentObject*>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
|
||||
|
||||
if(static_cast<FemPostPipeline*>(*it)->holdsPostObject(this)) {
|
||||
|
||||
|
||||
return static_cast<FemPostObject*>(*it)->Data.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -104,15 +104,15 @@ PROPERTY_SOURCE(Fem::FemPostClipFilter, Fem::FemPostFilter)
|
||||
FemPostClipFilter::FemPostClipFilter(void) : FemPostFilter() {
|
||||
|
||||
ADD_PROPERTY_TYPE(Function, (0), "Clip", App::Prop_None, "The function object which defines the clip regions");
|
||||
ADD_PROPERTY_TYPE(InsideOut, (false), "Clip", App::Prop_None, "Invert the clip direction");
|
||||
ADD_PROPERTY_TYPE(CutCells, (false), "Clip", App::Prop_None, "Decides if cells are cuttet and interpolated or if the cells are kept as a whole");
|
||||
|
||||
FilterPipeline clip;
|
||||
ADD_PROPERTY_TYPE(InsideOut, (false), "Clip", App::Prop_None, "Invert the clip direction");
|
||||
ADD_PROPERTY_TYPE(CutCells, (false), "Clip", App::Prop_None, "Decides if cells are cuttet and interpolated or if the cells are kept as a whole");
|
||||
|
||||
FilterPipeline clip;
|
||||
m_clipper = vtkSmartPointer<vtkTableBasedClipDataSet>::New();
|
||||
clip.source = m_clipper;
|
||||
clip.target = m_clipper;
|
||||
addFilterPipeline(clip, "clip");
|
||||
|
||||
|
||||
FilterPipeline extr;
|
||||
m_extractor = vtkSmartPointer<vtkExtractGeometry>::New();
|
||||
extr.source = m_extractor;
|
||||
@@ -120,7 +120,7 @@ FemPostClipFilter::FemPostClipFilter(void) : FemPostFilter() {
|
||||
addFilterPipeline(extr, "extract");
|
||||
|
||||
m_extractor->SetExtractInside(0);
|
||||
setActiveFilterPipeline("extract");
|
||||
setActiveFilterPipeline("extract");
|
||||
}
|
||||
|
||||
FemPostClipFilter::~FemPostClipFilter() {
|
||||
@@ -130,44 +130,44 @@ FemPostClipFilter::~FemPostClipFilter() {
|
||||
void FemPostClipFilter::onChanged(const Property* prop) {
|
||||
|
||||
if(prop == &Function) {
|
||||
|
||||
|
||||
if(Function.getValue() && Function.getValue()->isDerivedFrom(FemPostFunction::getClassTypeId())) {
|
||||
m_clipper->SetClipFunction(static_cast<FemPostFunction*>(Function.getValue())->getImplicitFunction());
|
||||
m_extractor->SetImplicitFunction(static_cast<FemPostFunction*>(Function.getValue())->getImplicitFunction());
|
||||
}
|
||||
}
|
||||
else if(prop == &InsideOut) {
|
||||
|
||||
|
||||
m_clipper->SetInsideOut(InsideOut.getValue());
|
||||
m_extractor->SetExtractInside( (InsideOut.getValue()) ? 1 : 0 );
|
||||
m_extractor->SetExtractInside( (InsideOut.getValue()) ? 1 : 0 );
|
||||
}
|
||||
else if(prop == &CutCells) {
|
||||
|
||||
if(!CutCells.getValue())
|
||||
|
||||
if(!CutCells.getValue())
|
||||
setActiveFilterPipeline("extract");
|
||||
else
|
||||
else
|
||||
setActiveFilterPipeline("clip");
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Fem::FemPostFilter::onChanged(prop);
|
||||
}
|
||||
|
||||
short int FemPostClipFilter::mustExecute(void) const {
|
||||
|
||||
|
||||
if(Function.isTouched() ||
|
||||
InsideOut.isTouched() ||
|
||||
CutCells.isTouched()) {
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else return App::DocumentObject::mustExecute();
|
||||
}
|
||||
|
||||
DocumentObjectExecReturn* FemPostClipFilter::execute(void) {
|
||||
|
||||
|
||||
if(!m_extractor->GetImplicitFunction())
|
||||
return StdReturn;
|
||||
|
||||
|
||||
return Fem::FemPostFilter::execute();
|
||||
}
|
||||
|
||||
@@ -179,37 +179,37 @@ FemPostScalarClipFilter::FemPostScalarClipFilter(void) : FemPostFilter() {
|
||||
|
||||
ADD_PROPERTY_TYPE(Value, (0), "Clip", App::Prop_None, "The scalar value used to clip the selected field");
|
||||
ADD_PROPERTY_TYPE(Scalars, (long(0)), "Clip", App::Prop_None, "The field used to clip");
|
||||
ADD_PROPERTY_TYPE(InsideOut, (false), "Clip", App::Prop_None, "Invert the clip direction");
|
||||
|
||||
ADD_PROPERTY_TYPE(InsideOut, (false), "Clip", App::Prop_None, "Invert the clip direction");
|
||||
|
||||
Value.setConstraints(&m_constraints);
|
||||
|
||||
FilterPipeline clip;
|
||||
|
||||
FilterPipeline clip;
|
||||
m_clipper = vtkSmartPointer<vtkTableBasedClipDataSet>::New();
|
||||
clip.source = m_clipper;
|
||||
clip.target = m_clipper;
|
||||
addFilterPipeline(clip, "clip");
|
||||
setActiveFilterPipeline("clip");
|
||||
setActiveFilterPipeline("clip");
|
||||
}
|
||||
|
||||
FemPostScalarClipFilter::~FemPostScalarClipFilter() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
DocumentObjectExecReturn* FemPostScalarClipFilter::execute(void) {
|
||||
|
||||
|
||||
std::string val;
|
||||
if(m_scalarFields.getEnums() && Scalars.getValue() >= 0)
|
||||
val = Scalars.getValueAsString();
|
||||
|
||||
|
||||
std::vector<std::string> array;
|
||||
|
||||
|
||||
vtkSmartPointer<vtkDataObject> data = getInputData();
|
||||
if(!data || !data->IsA("vtkDataSet"))
|
||||
return StdReturn;
|
||||
|
||||
vtkDataSet* dset = vtkDataSet::SafeDownCast(data);
|
||||
|
||||
vtkDataSet* dset = vtkDataSet::SafeDownCast(data);
|
||||
vtkPointData* pd = dset->GetPointData();
|
||||
|
||||
|
||||
for(int i=0; i<pd->GetNumberOfArrays(); ++i) {
|
||||
if(pd->GetArray(i)->GetNumberOfComponents()==1)
|
||||
array.push_back(pd->GetArrayName(i));
|
||||
@@ -219,39 +219,39 @@ DocumentObjectExecReturn* FemPostScalarClipFilter::execute(void) {
|
||||
Scalars.setValue(empty);
|
||||
m_scalarFields.setEnums(array);
|
||||
Scalars.setValue(m_scalarFields);
|
||||
|
||||
|
||||
std::vector<std::string>::iterator it = std::find(array.begin(), array.end(), val);
|
||||
if(!val.empty() && it != array.end())
|
||||
Scalars.setValue(val.c_str());
|
||||
|
||||
|
||||
//recalculate the filter
|
||||
return Fem::FemPostFilter::execute();
|
||||
}
|
||||
|
||||
|
||||
void FemPostScalarClipFilter::onChanged(const Property* prop) {
|
||||
|
||||
|
||||
if(prop == &Value) {
|
||||
m_clipper->SetValue(Value.getValue());
|
||||
m_clipper->SetValue(Value.getValue());
|
||||
}
|
||||
else if(prop == &InsideOut) {
|
||||
m_clipper->SetInsideOut(InsideOut.getValue());
|
||||
}
|
||||
else if(prop == &Scalars && (Scalars.getValue() >= 0)) {
|
||||
m_clipper->SetInputArrayToProcess(0, 0, 0,
|
||||
m_clipper->SetInputArrayToProcess(0, 0, 0,
|
||||
vtkDataObject::FIELD_ASSOCIATION_POINTS, Scalars.getValueAsString() );
|
||||
setConstraintForField();
|
||||
}
|
||||
|
||||
|
||||
Fem::FemPostFilter::onChanged(prop);
|
||||
}
|
||||
|
||||
short int FemPostScalarClipFilter::mustExecute(void) const {
|
||||
|
||||
|
||||
if(Value.isTouched() ||
|
||||
InsideOut.isTouched() ||
|
||||
Scalars.isTouched()) {
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else return App::DocumentObject::mustExecute();
|
||||
@@ -262,9 +262,9 @@ void FemPostScalarClipFilter::setConstraintForField() {
|
||||
vtkSmartPointer<vtkDataObject> data = getInputData();
|
||||
if(!data || !data->IsA("vtkDataSet"))
|
||||
return;
|
||||
|
||||
|
||||
vtkDataSet* dset = vtkDataSet::SafeDownCast(data);
|
||||
|
||||
|
||||
vtkDataArray* pdata = dset->GetPointData()->GetArray(Scalars.getValueAsString());
|
||||
double p[2];
|
||||
pdata->GetRange(p);
|
||||
@@ -280,13 +280,13 @@ FemPostWarpVectorFilter::FemPostWarpVectorFilter(void): FemPostFilter() {
|
||||
|
||||
ADD_PROPERTY_TYPE(Factor, (0), "Warp", App::Prop_None, "The factor by which the vector is added to the node positions");
|
||||
ADD_PROPERTY_TYPE(Vector, (long(0)), "Warp", App::Prop_None, "The field added to the node position");
|
||||
|
||||
FilterPipeline warp;
|
||||
|
||||
FilterPipeline warp;
|
||||
m_warp = vtkSmartPointer<vtkWarpVector>::New();
|
||||
warp.source = m_warp;
|
||||
warp.target = m_warp;
|
||||
addFilterPipeline(warp, "warp");
|
||||
setActiveFilterPipeline("warp");
|
||||
setActiveFilterPipeline("warp");
|
||||
}
|
||||
|
||||
FemPostWarpVectorFilter::~FemPostWarpVectorFilter() {
|
||||
@@ -295,20 +295,20 @@ FemPostWarpVectorFilter::~FemPostWarpVectorFilter() {
|
||||
|
||||
|
||||
DocumentObjectExecReturn* FemPostWarpVectorFilter::execute(void) {
|
||||
|
||||
|
||||
std::string val;
|
||||
if(m_vectorFields.getEnums() && Vector.getValue() >= 0)
|
||||
val = Vector.getValueAsString();
|
||||
|
||||
|
||||
std::vector<std::string> array;
|
||||
|
||||
|
||||
vtkSmartPointer<vtkDataObject> data = getInputData();
|
||||
if(!data || !data->IsA("vtkDataSet"))
|
||||
return StdReturn;
|
||||
|
||||
vtkDataSet* dset = vtkDataSet::SafeDownCast(data);
|
||||
|
||||
vtkDataSet* dset = vtkDataSet::SafeDownCast(data);
|
||||
vtkPointData* pd = dset->GetPointData();
|
||||
|
||||
|
||||
for(int i=0; i<pd->GetNumberOfArrays(); ++i) {
|
||||
if(pd->GetArray(i)->GetNumberOfComponents()==3)
|
||||
array.push_back(pd->GetArrayName(i));
|
||||
@@ -318,34 +318,34 @@ DocumentObjectExecReturn* FemPostWarpVectorFilter::execute(void) {
|
||||
Vector.setValue(empty);
|
||||
m_vectorFields.setEnums(array);
|
||||
Vector.setValue(m_vectorFields);
|
||||
|
||||
|
||||
std::vector<std::string>::iterator it = std::find(array.begin(), array.end(), val);
|
||||
if(!val.empty() && it != array.end())
|
||||
Vector.setValue(val.c_str());
|
||||
|
||||
|
||||
//recalculate the filter
|
||||
return Fem::FemPostFilter::execute();
|
||||
}
|
||||
|
||||
|
||||
void FemPostWarpVectorFilter::onChanged(const Property* prop) {
|
||||
|
||||
|
||||
if(prop == &Factor) {
|
||||
m_warp->SetScaleFactor(Factor.getValue());
|
||||
m_warp->SetScaleFactor(Factor.getValue());
|
||||
}
|
||||
else if(prop == &Vector && (Vector.getValue() >= 0)) {
|
||||
m_warp->SetInputArrayToProcess(0, 0, 0,
|
||||
m_warp->SetInputArrayToProcess(0, 0, 0,
|
||||
vtkDataObject::FIELD_ASSOCIATION_POINTS, Vector.getValueAsString() );
|
||||
}
|
||||
|
||||
|
||||
Fem::FemPostFilter::onChanged(prop);
|
||||
}
|
||||
|
||||
short int FemPostWarpVectorFilter::mustExecute(void) const {
|
||||
|
||||
|
||||
if(Factor.isTouched() ||
|
||||
Vector.isTouched()) {
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else return App::DocumentObject::mustExecute();
|
||||
@@ -357,13 +357,13 @@ PROPERTY_SOURCE(Fem::FemPostCutFilter, Fem::FemPostFilter)
|
||||
FemPostCutFilter::FemPostCutFilter(void) : FemPostFilter() {
|
||||
|
||||
ADD_PROPERTY_TYPE(Function, (0), "Cut", App::Prop_None, "The function object which defines the clip cut function");
|
||||
|
||||
FilterPipeline clip;
|
||||
|
||||
FilterPipeline clip;
|
||||
m_cutter = vtkSmartPointer<vtkCutter>::New();
|
||||
clip.source = m_cutter;
|
||||
clip.target = m_cutter;
|
||||
addFilterPipeline(clip, "cut");
|
||||
setActiveFilterPipeline("cut");
|
||||
setActiveFilterPipeline("cut");
|
||||
}
|
||||
|
||||
FemPostCutFilter::~FemPostCutFilter() {
|
||||
@@ -373,29 +373,29 @@ FemPostCutFilter::~FemPostCutFilter() {
|
||||
void FemPostCutFilter::onChanged(const Property* prop) {
|
||||
|
||||
if(prop == &Function) {
|
||||
|
||||
|
||||
if(Function.getValue() && Function.getValue()->isDerivedFrom(FemPostFunction::getClassTypeId())) {
|
||||
m_cutter->SetCutFunction(static_cast<FemPostFunction*>(Function.getValue())->getImplicitFunction());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Fem::FemPostFilter::onChanged(prop);
|
||||
}
|
||||
|
||||
short int FemPostCutFilter::mustExecute(void) const {
|
||||
|
||||
|
||||
if(Function.isTouched()) {
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else return App::DocumentObject::mustExecute();
|
||||
}
|
||||
|
||||
DocumentObjectExecReturn* FemPostCutFilter::execute(void) {
|
||||
|
||||
|
||||
if(!m_cutter->GetCutFunction())
|
||||
return StdReturn;
|
||||
|
||||
|
||||
return Fem::FemPostFilter::execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,129 +47,129 @@ public:
|
||||
/// Constructor
|
||||
FemPostFilter(void);
|
||||
virtual ~FemPostFilter();
|
||||
|
||||
|
||||
App::PropertyLink Input;
|
||||
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
vtkDataObject* getInputData();
|
||||
|
||||
|
||||
//pipeline handling for derived filter
|
||||
struct FilterPipeline {
|
||||
vtkSmartPointer<vtkAlgorithm> source, target;
|
||||
std::vector<vtkSmartPointer<vtkAlgorithm> > algorithmStorage;
|
||||
};
|
||||
|
||||
|
||||
void addFilterPipeline(const FilterPipeline& p, std::string name);
|
||||
void setActiveFilterPipeline(std::string name);
|
||||
FilterPipeline& getFilterPipeline(std::string name);
|
||||
FilterPipeline& getFilterPipeline(std::string name);
|
||||
private:
|
||||
//handling of multiple pipelines which can be the filter
|
||||
//handling of multiple pipelines which can be the filter
|
||||
std::map<std::string, FilterPipeline> m_pipelines;
|
||||
std::string m_activePipeline;
|
||||
};
|
||||
|
||||
class AppFemExport FemPostClipFilter : public FemPostFilter {
|
||||
|
||||
|
||||
PROPERTY_HEADER(Fem::FemPostClipFilter);
|
||||
|
||||
|
||||
public:
|
||||
FemPostClipFilter(void);
|
||||
FemPostClipFilter(void);
|
||||
virtual ~FemPostClipFilter();
|
||||
|
||||
|
||||
App::PropertyLink Function;
|
||||
App::PropertyBool InsideOut;
|
||||
App::PropertyBool CutCells;
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostClip";
|
||||
}
|
||||
virtual short int mustExecute(void) const;
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
vtkSmartPointer<vtkTableBasedClipDataSet> m_clipper;
|
||||
vtkSmartPointer<vtkExtractGeometry> m_extractor;
|
||||
};
|
||||
|
||||
|
||||
class AppFemExport FemPostScalarClipFilter : public FemPostFilter {
|
||||
|
||||
|
||||
PROPERTY_HEADER(Fem::FemPostScalarClipFilter);
|
||||
|
||||
|
||||
public:
|
||||
FemPostScalarClipFilter(void);
|
||||
FemPostScalarClipFilter(void);
|
||||
virtual ~FemPostScalarClipFilter();
|
||||
|
||||
App::PropertyBool InsideOut;
|
||||
App::PropertyFloatConstraint Value;
|
||||
App::PropertyEnumeration Scalars;
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostScalarClip";
|
||||
}
|
||||
virtual short int mustExecute(void) const;
|
||||
|
||||
|
||||
protected:
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
void setConstraintForField();
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
vtkSmartPointer<vtkTableBasedClipDataSet> m_clipper;
|
||||
App::Enumeration m_scalarFields;
|
||||
App::PropertyFloatConstraint::Constraints m_constraints;
|
||||
};
|
||||
|
||||
class AppFemExport FemPostWarpVectorFilter : public FemPostFilter {
|
||||
|
||||
|
||||
PROPERTY_HEADER(Fem::FemPostWarpVectorFilter);
|
||||
|
||||
|
||||
public:
|
||||
FemPostWarpVectorFilter(void);
|
||||
FemPostWarpVectorFilter(void);
|
||||
virtual ~FemPostWarpVectorFilter();
|
||||
|
||||
App::PropertyFloat Factor;
|
||||
App::PropertyEnumeration Vector;
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostWarpVector";
|
||||
}
|
||||
virtual short int mustExecute(void) const;
|
||||
|
||||
|
||||
protected:
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
vtkSmartPointer<vtkWarpVector> m_warp;
|
||||
App::Enumeration m_vectorFields;
|
||||
};
|
||||
|
||||
class AppFemExport FemPostCutFilter : public FemPostFilter {
|
||||
|
||||
|
||||
PROPERTY_HEADER(Fem::FemPostCutFilter);
|
||||
|
||||
|
||||
public:
|
||||
FemPostCutFilter(void);
|
||||
FemPostCutFilter(void);
|
||||
virtual ~FemPostCutFilter();
|
||||
|
||||
App::PropertyLink Function;
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostCut";
|
||||
}
|
||||
virtual short int mustExecute(void) const;
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
vtkSmartPointer<vtkCutter> m_cutter;
|
||||
};
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ FemPostFunction::~FemPostFunction()
|
||||
}
|
||||
|
||||
DocumentObjectExecReturn* FemPostFunction::execute(void) {
|
||||
|
||||
|
||||
return DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ FemPostPlaneFunction::FemPostPlaneFunction(void): FemPostFunction() {
|
||||
|
||||
ADD_PROPERTY(Origin,(Base::Vector3d(0.0,0.0,0.0)));
|
||||
ADD_PROPERTY(Normal,(Base::Vector3d(0.0,0.0,1.0)));
|
||||
|
||||
|
||||
m_plane = vtkSmartPointer<vtkPlane>::New();
|
||||
m_implicit = m_plane;
|
||||
|
||||
|
||||
m_plane->SetOrigin(0., 0., 0.);
|
||||
m_plane->SetNormal(0., 0., 1.);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ FemPostPlaneFunction::~FemPostPlaneFunction() {
|
||||
}
|
||||
|
||||
void FemPostPlaneFunction::onChanged(const Property* prop) {
|
||||
|
||||
|
||||
if(prop == &Origin) {
|
||||
const Base::Vector3d& vec = Origin.getValue();
|
||||
m_plane->SetOrigin(vec[0], vec[1], vec[2]);
|
||||
@@ -92,7 +92,7 @@ void FemPostPlaneFunction::onChanged(const Property* prop) {
|
||||
const Base::Vector3d& vec = Normal.getValue();
|
||||
m_plane->SetNormal(vec[0], vec[1], vec[2]);
|
||||
}
|
||||
|
||||
|
||||
Fem::FemPostFunction::onChanged(prop);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ FemPostSphereFunction::FemPostSphereFunction(void): FemPostFunction() {
|
||||
|
||||
ADD_PROPERTY(Radius,(5));
|
||||
ADD_PROPERTY(Center,(Base::Vector3d(1.0,0.0,0.0)));
|
||||
|
||||
|
||||
m_sphere = vtkSmartPointer<vtkSphere>::New();
|
||||
m_implicit = m_sphere;
|
||||
|
||||
@@ -126,6 +126,6 @@ void FemPostSphereFunction::onChanged(const Property* prop) {
|
||||
else if(prop == &Radius) {
|
||||
m_sphere->SetRadius(Radius.getValue());
|
||||
}
|
||||
|
||||
|
||||
Fem::FemPostFunction::onChanged(prop);
|
||||
}
|
||||
|
||||
@@ -44,18 +44,18 @@ public:
|
||||
/// Constructor
|
||||
FemPostFunction(void);
|
||||
virtual ~FemPostFunction();
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostFunction";
|
||||
}
|
||||
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
|
||||
//bound box handling
|
||||
void setBoundingBox(vtkBoundingBox b) {m_boundingBox = b;};
|
||||
|
||||
|
||||
//get the algorithm or the data
|
||||
vtkSmartPointer<vtkImplicitFunction> getImplicitFunction() {return m_implicit;};
|
||||
vtkSmartPointer<vtkImplicitFunction> getImplicitFunction() {return m_implicit;};
|
||||
|
||||
protected:
|
||||
vtkSmartPointer<vtkImplicitFunction> m_implicit;
|
||||
@@ -65,17 +65,17 @@ protected:
|
||||
class AppFemExport FemPostFunctionProvider : public App::DocumentObject {
|
||||
|
||||
PROPERTY_HEADER(Fem::FemPostFunctionProvider);
|
||||
|
||||
|
||||
public:
|
||||
FemPostFunctionProvider(void);
|
||||
virtual ~FemPostFunctionProvider();
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostFunctionProvider";
|
||||
}
|
||||
|
||||
|
||||
App::PropertyLinkList Functions;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
};
|
||||
@@ -83,49 +83,49 @@ protected:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class AppFemExport FemPostPlaneFunction : public FemPostFunction
|
||||
class AppFemExport FemPostPlaneFunction : public FemPostFunction
|
||||
{
|
||||
PROPERTY_HEADER(Fem::FemPostPlaneFunction);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
FemPostPlaneFunction(void);
|
||||
virtual ~FemPostPlaneFunction();
|
||||
|
||||
|
||||
App::PropertyVector Normal;
|
||||
App::PropertyVectorDistance Origin;
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostPlaneFunction";
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
|
||||
vtkSmartPointer<vtkPlane> m_plane;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class AppFemExport FemPostSphereFunction : public FemPostFunction
|
||||
class AppFemExport FemPostSphereFunction : public FemPostFunction
|
||||
{
|
||||
PROPERTY_HEADER(Fem::FemPostSphereFunction);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
FemPostSphereFunction(void);
|
||||
virtual ~FemPostSphereFunction();
|
||||
|
||||
|
||||
App::PropertyDistance Radius;
|
||||
App::PropertyVectorDistance Center;
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostSphereFunction";
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
|
||||
vtkSmartPointer<vtkSphere> m_sphere;
|
||||
};
|
||||
|
||||
|
||||
@@ -52,11 +52,11 @@ FemPostObject::~FemPostObject()
|
||||
vtkBoundingBox FemPostObject::getBoundingBox() {
|
||||
|
||||
vtkBoundingBox box;
|
||||
|
||||
|
||||
if(Data.getValue() && Data.getValue()->IsA("vtkDataSet"))
|
||||
box.AddBounds(vtkDataSet::SafeDownCast(Data.getValue())->GetBounds());
|
||||
|
||||
|
||||
//TODO: add calculation of multiblock and Multipiece datasets
|
||||
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ public:
|
||||
/// Constructor
|
||||
FemPostObject(void);
|
||||
virtual ~FemPostObject();
|
||||
|
||||
|
||||
Fem::PropertyPostDataObject Data;
|
||||
|
||||
|
||||
vtkBoundingBox getBoundingBox();
|
||||
};
|
||||
|
||||
|
||||
@@ -65,9 +65,9 @@ FemPostPipeline::FemPostPipeline()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Filter, (0), "Pipeline", App::Prop_None, "The filter used in in this pipeline");
|
||||
ADD_PROPERTY_TYPE(Functions, (0), "Pipeline", App::Prop_Hidden, "The function provider which groups all pipeline functions");
|
||||
ADD_PROPERTY_TYPE(Mode,(long(0)), "Pipeline", App::Prop_None, "Selects the pipeline data transition mode. In serial every filter"
|
||||
ADD_PROPERTY_TYPE(Mode,(long(0)), "Pipeline", App::Prop_None, "Selects the pipeline data transition mode. In serial every filter"
|
||||
"gets the output of the previous one as input, in parrallel every"
|
||||
"filter gets the pipelien source as input.");
|
||||
"filter gets the pipelien source as input.");
|
||||
Mode.setEnums(ModeEnums);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ short FemPostPipeline::mustExecute(void) const
|
||||
{
|
||||
if(Mode.isTouched())
|
||||
return 1;
|
||||
|
||||
|
||||
return FemPostFilter::mustExecute();
|
||||
}
|
||||
|
||||
@@ -88,33 +88,33 @@ DocumentObjectExecReturn* FemPostPipeline::execute(void) {
|
||||
//if we are the toplevel pipeline our data object is not created by filters, we are the main source!
|
||||
if(!Input.getValue())
|
||||
return StdReturn;
|
||||
|
||||
|
||||
//now if we are a filter than our data object is created by the filter we hold
|
||||
|
||||
|
||||
//if we are in serial mode we just copy over the data of the last filter,
|
||||
//but if we are in parallel we need to combine all filter results
|
||||
if(Mode.getValue() == 0) {
|
||||
|
||||
|
||||
//serial
|
||||
Data.setValue(getLastPostObject()->Data.getValue());
|
||||
}
|
||||
else {
|
||||
|
||||
//parallel. go through all filters and append the result
|
||||
|
||||
//parallel. go through all filters and append the result
|
||||
const std::vector<App::DocumentObject*>& filters = Filter.getValues();
|
||||
std::vector<App::DocumentObject*>::const_iterator it = filters.begin();
|
||||
|
||||
|
||||
vtkSmartPointer<vtkAppendFilter> append = vtkSmartPointer<vtkAppendFilter>::New();
|
||||
for(;it != filters.end(); ++it) {
|
||||
|
||||
|
||||
append->AddInputDataObject(static_cast<FemPostObject*>(*it)->Data.getValue());
|
||||
}
|
||||
|
||||
|
||||
append->Update();
|
||||
Data.setValue(append->GetOutputDataObject(0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return Fem::FemPostObject::execute();
|
||||
}
|
||||
|
||||
@@ -128,17 +128,17 @@ bool FemPostPipeline::canRead(Base::FileInfo File) {
|
||||
File.hasExtension("vtu") ||
|
||||
File.hasExtension("vti"))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void FemPostPipeline::read(Base::FileInfo File) {
|
||||
|
||||
|
||||
// checking on the file
|
||||
if (!File.isReadable())
|
||||
throw Base::Exception("File to load not existing or not readable");
|
||||
|
||||
if (File.hasExtension("vtu"))
|
||||
|
||||
if (File.hasExtension("vtu"))
|
||||
readXMLFile<vtkXMLUnstructuredGridReader>(File.filePath());
|
||||
else if (File.hasExtension("vtp"))
|
||||
readXMLFile<vtkXMLPolyDataReader>(File.filePath());
|
||||
@@ -149,7 +149,7 @@ void FemPostPipeline::read(Base::FileInfo File) {
|
||||
else if (File.hasExtension("vti"))
|
||||
readXMLFile<vtkXMLImageDataReader>(File.filePath());
|
||||
else if (File.hasExtension("vtk"))
|
||||
readXMLFile<vtkDataSetReader>(File.filePath());
|
||||
readXMLFile<vtkDataSetReader>(File.filePath());
|
||||
else
|
||||
throw Base::Exception("Unknown extension");
|
||||
}
|
||||
@@ -161,34 +161,34 @@ void FemPostPipeline::read(Base::FileInfo File) {
|
||||
// // ref counter is set to 1
|
||||
// PythonObject = Py::Object(new DocumentObjectPy(this),true);
|
||||
// }
|
||||
// return Py::new_reference_to(PythonObject);
|
||||
// return Py::new_reference_to(PythonObject);
|
||||
// }
|
||||
|
||||
void FemPostPipeline::onChanged(const Property* prop)
|
||||
{
|
||||
if(prop == &Filter || prop == &Mode) {
|
||||
|
||||
|
||||
//we check if all connections are right and add new ones if needed
|
||||
std::vector<App::DocumentObject*> objs = Filter.getValues();
|
||||
|
||||
|
||||
if(objs.empty())
|
||||
return;
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*>::iterator it = objs.begin();
|
||||
FemPostFilter* filter = static_cast<FemPostFilter*>(*it);
|
||||
|
||||
|
||||
//If we have a Input we need to ensure our filters are connected correctly
|
||||
if(Input.getValue()) {
|
||||
|
||||
|
||||
//the first filter is always connected to the input
|
||||
if(filter->Input.getValue() != Input.getValue())
|
||||
filter->Input.setValue(Input.getValue());
|
||||
|
||||
|
||||
//all the others need to be connected to the previous filter or the source, dependend on the mode
|
||||
++it;
|
||||
for(; it != objs.end(); ++it) {
|
||||
FemPostFilter* nextFilter = static_cast<FemPostFilter*>(*it);
|
||||
|
||||
|
||||
if(Mode.getValue() == 0) { //serial mode
|
||||
if( nextFilter->Input.getValue() != filter)
|
||||
nextFilter->Input.setValue(filter);
|
||||
@@ -197,7 +197,7 @@ void FemPostPipeline::onChanged(const Property* prop)
|
||||
if( nextFilter->Input.getValue() != Input.getValue())
|
||||
nextFilter->Input.setValue(Input.getValue());
|
||||
}
|
||||
|
||||
|
||||
filter = nextFilter;
|
||||
};
|
||||
}
|
||||
@@ -206,12 +206,12 @@ void FemPostPipeline::onChanged(const Property* prop)
|
||||
//the first filter must always grab the data
|
||||
if(filter->Input.getValue() != NULL)
|
||||
filter->Input.setValue(NULL);
|
||||
|
||||
|
||||
//all the others need to be connected to the previous filter or grab the data, dependend on mode
|
||||
++it;
|
||||
for(; it != objs.end(); ++it) {
|
||||
FemPostFilter* nextFilter = static_cast<FemPostFilter*>(*it);
|
||||
|
||||
|
||||
if(Mode.getValue() == 0) { //serial mode
|
||||
if( nextFilter->Input.getValue() != filter)
|
||||
nextFilter->Input.setValue(filter);
|
||||
@@ -220,12 +220,12 @@ void FemPostPipeline::onChanged(const Property* prop)
|
||||
if( nextFilter->Input.getValue() != NULL)
|
||||
nextFilter->Input.setValue(NULL);
|
||||
}
|
||||
|
||||
|
||||
filter = nextFilter;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
App::GeoFeature::onChanged(prop);
|
||||
|
||||
}
|
||||
@@ -234,7 +234,7 @@ FemPostObject* FemPostPipeline::getLastPostObject() {
|
||||
|
||||
if(Filter.getValues().empty())
|
||||
return this;
|
||||
|
||||
|
||||
return static_cast<FemPostObject*>(Filter.getValues().back());
|
||||
}
|
||||
|
||||
@@ -242,53 +242,53 @@ bool FemPostPipeline::holdsPostObject(FemPostObject* obj) {
|
||||
|
||||
std::vector<App::DocumentObject*>::const_iterator it = Filter.getValues().begin();
|
||||
for(; it != Filter.getValues().end(); ++it) {
|
||||
|
||||
|
||||
if(*it == obj)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void FemPostPipeline::load(FemResultObject* res) {
|
||||
|
||||
vtkSmartPointer<vtkUnstructuredGrid> grid = vtkSmartPointer<vtkUnstructuredGrid>::New();
|
||||
|
||||
|
||||
//first copy the mesh over
|
||||
//########################
|
||||
|
||||
|
||||
if(!res->Mesh.getValue() || !res->Mesh.getValue()->isDerivedFrom(Fem::FemMeshObject::getClassTypeId()))
|
||||
return;
|
||||
|
||||
const FemMesh& mesh = static_cast<FemMeshObject*>(res->Mesh.getValue())->FemMesh.getValue();
|
||||
|
||||
const FemMesh& mesh = static_cast<FemMeshObject*>(res->Mesh.getValue())->FemMesh.getValue();
|
||||
SMESH_Mesh* smesh = const_cast<SMESH_Mesh*>(mesh.getSMesh());
|
||||
SMESHDS_Mesh* meshDS = smesh->GetMeshDS();
|
||||
const SMDS_MeshInfo& info = meshDS->GetMeshInfo();
|
||||
|
||||
|
||||
//start with the nodes
|
||||
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
|
||||
SMDS_NodeIteratorPtr aNodeIter = meshDS->nodesIterator();
|
||||
|
||||
|
||||
points->SetNumberOfPoints(info.NbNodes());
|
||||
for(; aNodeIter->more(); ) {
|
||||
const SMDS_MeshNode* node = aNodeIter->next();
|
||||
float coords[3] = {float(node->X()), float(node->Y()), float(node->Z())};
|
||||
points->SetPoint(node->GetID()-1, coords);
|
||||
points->SetPoint(node->GetID()-1, coords);
|
||||
}
|
||||
grid->SetPoints(points);
|
||||
|
||||
|
||||
//start with 2d elements
|
||||
vtkSmartPointer<vtkCellArray> triangleArray = vtkSmartPointer<vtkCellArray>::New();
|
||||
vtkSmartPointer<vtkCellArray> quadTriangleArray = vtkSmartPointer<vtkCellArray>::New();
|
||||
vtkSmartPointer<vtkCellArray> quadArray = vtkSmartPointer<vtkCellArray>::New();
|
||||
|
||||
|
||||
SMDS_FaceIteratorPtr aFaceIter = meshDS->facesIterator();
|
||||
for (;aFaceIter->more();) {
|
||||
const SMDS_MeshFace* aFace = aFaceIter->next();
|
||||
|
||||
//triangle
|
||||
if(aFace->NbNodes() == 3) {
|
||||
vtkSmartPointer<vtkTriangle> tria = vtkSmartPointer<vtkTriangle>::New();
|
||||
vtkSmartPointer<vtkTriangle> tria = vtkSmartPointer<vtkTriangle>::New();
|
||||
tria->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID()-1);
|
||||
tria->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID()-1);
|
||||
tria->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID()-1);
|
||||
@@ -297,7 +297,7 @@ void FemPostPipeline::load(FemResultObject* res) {
|
||||
}
|
||||
//quad
|
||||
else if(aFace->NbNodes() == 4) {
|
||||
vtkSmartPointer<vtkQuad> quad = vtkSmartPointer<vtkQuad>::New();
|
||||
vtkSmartPointer<vtkQuad> quad = vtkSmartPointer<vtkQuad>::New();
|
||||
quad->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID()-1);
|
||||
quad->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID()-1);
|
||||
quad->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID()-1);
|
||||
@@ -305,7 +305,7 @@ void FemPostPipeline::load(FemResultObject* res) {
|
||||
quadArray->InsertNextCell(quad);
|
||||
}
|
||||
else if (aFace->NbNodes() == 6) {
|
||||
vtkSmartPointer<vtkQuadraticTriangle> tria = vtkSmartPointer<vtkQuadraticTriangle>::New();
|
||||
vtkSmartPointer<vtkQuadraticTriangle> tria = vtkSmartPointer<vtkQuadraticTriangle>::New();
|
||||
tria->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID()-1);
|
||||
tria->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID()-1);
|
||||
tria->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID()-1);
|
||||
@@ -317,25 +317,25 @@ void FemPostPipeline::load(FemResultObject* res) {
|
||||
}
|
||||
if(triangleArray->GetNumberOfCells()>0)
|
||||
grid->SetCells(VTK_TRIANGLE, triangleArray);
|
||||
|
||||
|
||||
if(quadArray->GetNumberOfCells()>0)
|
||||
grid->SetCells(VTK_QUAD, quadArray);
|
||||
|
||||
|
||||
if(quadTriangleArray->GetNumberOfCells()>0)
|
||||
grid->SetCells(VTK_QUADRATIC_TRIANGLE, quadTriangleArray);
|
||||
|
||||
|
||||
//now all volumes
|
||||
|
||||
|
||||
//now all volumes
|
||||
vtkSmartPointer<vtkCellArray> tetraArray = vtkSmartPointer<vtkCellArray>::New();
|
||||
vtkSmartPointer<vtkCellArray> quadTetraArray = vtkSmartPointer<vtkCellArray>::New();
|
||||
|
||||
|
||||
SMDS_VolumeIteratorPtr aVolIter = meshDS->volumesIterator();
|
||||
for (;aVolIter->more();) {
|
||||
const SMDS_MeshVolume* aVol = aVolIter->next();
|
||||
|
||||
//tetrahedra
|
||||
if(aVol->NbNodes() == 4) {
|
||||
vtkSmartPointer<vtkTetra> tetra = vtkSmartPointer<vtkTetra>::New();
|
||||
vtkSmartPointer<vtkTetra> tetra = vtkSmartPointer<vtkTetra>::New();
|
||||
tetra->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID()-1);
|
||||
tetra->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID()-1);
|
||||
tetra->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID()-1);
|
||||
@@ -345,8 +345,8 @@ void FemPostPipeline::load(FemResultObject* res) {
|
||||
}
|
||||
//quadratic tetrahedra
|
||||
else if( aVol->NbNodes() == 10) {
|
||||
|
||||
vtkSmartPointer<vtkQuadraticTetra> tetra = vtkSmartPointer<vtkQuadraticTetra>::New();
|
||||
|
||||
vtkSmartPointer<vtkQuadraticTetra> tetra = vtkSmartPointer<vtkQuadraticTetra>::New();
|
||||
tetra->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID()-1);
|
||||
tetra->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID()-1);
|
||||
tetra->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID()-1);
|
||||
@@ -357,29 +357,29 @@ void FemPostPipeline::load(FemResultObject* res) {
|
||||
tetra->GetPointIds()->SetId(7, aVol->GetNode(7)->GetID()-1);
|
||||
tetra->GetPointIds()->SetId(8, aVol->GetNode(8)->GetID()-1);
|
||||
tetra->GetPointIds()->SetId(9, aVol->GetNode(9)->GetID()-1);
|
||||
|
||||
|
||||
quadTetraArray->InsertNextCell(tetra);
|
||||
}
|
||||
}
|
||||
if(tetraArray->GetNumberOfCells()>0)
|
||||
grid->SetCells(VTK_TETRA, tetraArray);
|
||||
|
||||
|
||||
if(quadTetraArray->GetNumberOfCells()>0)
|
||||
grid->SetCells(VTK_QUADRATIC_TETRA, quadTetraArray);
|
||||
|
||||
|
||||
|
||||
|
||||
//Now copy the point data over
|
||||
//############################
|
||||
|
||||
|
||||
if(!res->StressValues.getValues().empty()) {
|
||||
const std::vector<double>& vec = res->StressValues.getValues();
|
||||
vtkSmartPointer<vtkDoubleArray> data = vtkSmartPointer<vtkDoubleArray>::New();
|
||||
data->SetNumberOfValues(vec.size());
|
||||
data->SetName("Von Mises stress");
|
||||
|
||||
|
||||
for(size_t i=0; i<vec.size(); ++i)
|
||||
data->SetValue(i, vec[i]);
|
||||
|
||||
|
||||
grid->GetPointData()->AddArray(data);
|
||||
}
|
||||
|
||||
@@ -424,26 +424,26 @@ void FemPostPipeline::load(FemResultObject* res) {
|
||||
vtkSmartPointer<vtkDoubleArray> data = vtkSmartPointer<vtkDoubleArray>::New();
|
||||
data->SetNumberOfValues(vec.size());
|
||||
data->SetName("Temperature");
|
||||
|
||||
|
||||
for(size_t i=0; i<vec.size(); ++i)
|
||||
data->SetValue(i, vec[i]);
|
||||
|
||||
|
||||
grid->GetPointData()->AddArray(data);
|
||||
}
|
||||
|
||||
|
||||
if(!res->StressValues.getValues().empty()) {
|
||||
const std::vector<Base::Vector3d>& vec = res->DisplacementVectors.getValues();
|
||||
vtkSmartPointer<vtkDoubleArray> data = vtkSmartPointer<vtkDoubleArray>::New();
|
||||
data->SetNumberOfComponents(3);
|
||||
data->SetName("Displacement");
|
||||
|
||||
|
||||
for(std::vector<Base::Vector3d>::const_iterator it=vec.begin(); it!=vec.end(); ++it) {
|
||||
double tuple[] = {it->x, it->y, it->z};
|
||||
data->InsertNextTuple(tuple);
|
||||
}
|
||||
|
||||
|
||||
grid->GetPointData()->AddArray(data);
|
||||
}
|
||||
|
||||
|
||||
Data.setValue(grid);
|
||||
}
|
||||
|
||||
@@ -43,38 +43,38 @@ public:
|
||||
/// Constructor
|
||||
FemPostPipeline(void);
|
||||
virtual ~FemPostPipeline();
|
||||
|
||||
|
||||
App::PropertyLinkList Filter;
|
||||
App::PropertyLink Functions;
|
||||
App::PropertyEnumeration Mode;
|
||||
|
||||
|
||||
short mustExecute(void) const;
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
//PyObject* getPyObject();
|
||||
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemPostPipeline";
|
||||
}
|
||||
|
||||
|
||||
//load data from files
|
||||
static bool canRead(Base::FileInfo file);
|
||||
void read(Base::FileInfo file);
|
||||
|
||||
|
||||
//load from results
|
||||
void load(FemResultObject* res);
|
||||
|
||||
|
||||
//Pipeline handling
|
||||
FemPostObject* getLastPostObject();
|
||||
bool holdsPostObject(FemPostObject* obj);
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
|
||||
private:
|
||||
static const char* ModeEnums[];
|
||||
|
||||
|
||||
template<class TReader> void readXMLFile(std::string file) {
|
||||
|
||||
|
||||
vtkSmartPointer<TReader> reader = vtkSmartPointer<TReader>::New();
|
||||
reader->SetFileName(file.c_str());
|
||||
reader->Update();
|
||||
|
||||
@@ -65,18 +65,18 @@ PropertyPostDataObject::~PropertyPostDataObject()
|
||||
void PropertyPostDataObject::setValue(const vtkSmartPointer<vtkDataObject>& ds)
|
||||
{
|
||||
aboutToSetValue();
|
||||
|
||||
|
||||
if(ds) {
|
||||
createDataObjectByExternalType(ds);
|
||||
createDataObjectByExternalType(ds);
|
||||
m_dataObject->DeepCopy(ds);
|
||||
}
|
||||
else
|
||||
else
|
||||
m_dataObject = NULL;
|
||||
|
||||
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
const vtkSmartPointer<vtkDataObject>& PropertyPostDataObject::getValue(void)const
|
||||
const vtkSmartPointer<vtkDataObject>& PropertyPostDataObject::getValue(void)const
|
||||
{
|
||||
return m_dataObject;
|
||||
}
|
||||
@@ -92,10 +92,10 @@ bool PropertyPostDataObject::isDataSet() {
|
||||
}
|
||||
|
||||
int PropertyPostDataObject::getDataType() {
|
||||
|
||||
|
||||
if(!m_dataObject)
|
||||
return -1;
|
||||
|
||||
|
||||
return m_dataObject->GetDataObjectType();
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ App::Property *PropertyPostDataObject::Copy(void) const
|
||||
{
|
||||
PropertyPostDataObject *prop = new PropertyPostDataObject();
|
||||
if (m_dataObject) {
|
||||
|
||||
prop->createDataObjectByExternalType(m_dataObject);
|
||||
|
||||
prop->createDataObjectByExternalType(m_dataObject);
|
||||
prop->m_dataObject->DeepCopy(m_dataObject);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ App::Property *PropertyPostDataObject::Copy(void) const
|
||||
void PropertyPostDataObject::createDataObjectByExternalType(vtkSmartPointer< vtkDataObject > ex) {
|
||||
|
||||
switch( ex->GetDataObjectType() ) {
|
||||
|
||||
|
||||
case VTK_POLY_DATA:
|
||||
m_dataObject = vtkSmartPointer<vtkPolyData>::New();
|
||||
break;
|
||||
@@ -188,9 +188,9 @@ void PropertyPostDataObject::Save (Base::Writer &writer) const
|
||||
std::string extension;
|
||||
if(!m_dataObject)
|
||||
return;
|
||||
|
||||
|
||||
switch( m_dataObject->GetDataObjectType() ) {
|
||||
|
||||
|
||||
case VTK_POLY_DATA:
|
||||
extension = "vtp";
|
||||
break;
|
||||
@@ -219,10 +219,10 @@ void PropertyPostDataObject::Save (Base::Writer &writer) const
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
if(!writer.isForceXML()) {
|
||||
std::string file = "Data." + extension;
|
||||
writer.Stream() << writer.ind() << "<Data file=\""
|
||||
writer.Stream() << writer.ind() << "<Data file=\""
|
||||
<< writer.addFile(file.c_str(), this)
|
||||
<< "\"/>" << std::endl;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ void PropertyPostDataObject::Restore(Base::XMLReader &reader)
|
||||
reader.readElement("Data");
|
||||
if(!reader.hasAttribute("file"))
|
||||
return;
|
||||
|
||||
|
||||
std::string file (reader.getAttribute("file") );
|
||||
|
||||
if (!file.empty()) {
|
||||
@@ -248,17 +248,17 @@ void PropertyPostDataObject::SaveDocFile (Base::Writer &writer) const
|
||||
// can be checked when reading in the data.
|
||||
if (!m_dataObject)
|
||||
return;
|
||||
|
||||
|
||||
// create a temporary file and copy the content to the zip stream
|
||||
// once the tmp. filename is known use always the same because otherwise
|
||||
// we may run into some problems on the Linux platform
|
||||
static Base::FileInfo fi(App::Application::getTempFileName());
|
||||
|
||||
|
||||
vtkSmartPointer<vtkXMLDataSetWriter> xmlWriter = vtkSmartPointer<vtkXMLDataSetWriter>::New();
|
||||
xmlWriter->SetInputDataObject(m_dataObject);
|
||||
xmlWriter->SetFileName(fi.filePath().c_str());
|
||||
xmlWriter->SetDataModeToBinary();
|
||||
|
||||
|
||||
if ( xmlWriter->Write() != 1 ) {
|
||||
// Note: Do NOT throw an exception here because if the tmp. file could
|
||||
// not be created we should not abort.
|
||||
@@ -267,7 +267,7 @@ void PropertyPostDataObject::SaveDocFile (Base::Writer &writer) const
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n",
|
||||
Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n",
|
||||
obj->Label.getValue(),fi.filePath().c_str());
|
||||
}
|
||||
else {
|
||||
@@ -281,7 +281,7 @@ void PropertyPostDataObject::SaveDocFile (Base::Writer &writer) const
|
||||
|
||||
Base::ifstream file(fi, std::ios::in | std::ios::binary);
|
||||
if (file){
|
||||
unsigned long ulSize = 0;
|
||||
unsigned long ulSize = 0;
|
||||
std::streambuf* buf = file.rdbuf();
|
||||
if (buf) {
|
||||
unsigned long ulCurr;
|
||||
@@ -309,7 +309,7 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader &reader)
|
||||
|
||||
// read in the ASCII file and write back to the file stream
|
||||
Base::ofstream file(fi, std::ios::out | std::ios::binary);
|
||||
unsigned long ulSize = 0;
|
||||
unsigned long ulSize = 0;
|
||||
if (reader) {
|
||||
std::streambuf* buf = file.rdbuf();
|
||||
reader >> buf;
|
||||
@@ -321,7 +321,7 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader &reader)
|
||||
// Read the data from the temp file
|
||||
if (ulSize > 0) {
|
||||
std::string extension = xml.extension();
|
||||
|
||||
|
||||
//TODO: read in of composite data structures need to be coded, including replace of "GetOutputAsDataSet()"
|
||||
vtkSmartPointer<vtkXMLReader> xmlReader;
|
||||
if(extension == "vtp")
|
||||
@@ -334,10 +334,10 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader &reader)
|
||||
xmlReader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
|
||||
else if (extension == "vti")
|
||||
xmlReader = vtkSmartPointer<vtkXMLImageDataReader>::New();
|
||||
|
||||
|
||||
xmlReader->SetFileName(fi.filePath().c_str());
|
||||
xmlReader->Update();
|
||||
|
||||
|
||||
if (!xmlReader->GetOutputAsDataSet()) {
|
||||
// Note: Do NOT throw an exception here because if the tmp. created file could
|
||||
// not be read it's NOT an indication for an invalid input stream 'reader'.
|
||||
@@ -346,7 +346,7 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader &reader)
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n",
|
||||
Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n",
|
||||
fi.filePath().c_str(),obj->Label.getValue());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
const vtkSmartPointer<vtkDataObject>& getValue(void) const;
|
||||
/// check if we hold a dataset or a dataobject (which would mean a composite data structure)
|
||||
bool isDataSet();
|
||||
bool isComposite();
|
||||
bool isComposite();
|
||||
int getDataType();
|
||||
//@}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ if(BUILD_FEM_VTK)
|
||||
endif(BUILD_FEM_VTK)
|
||||
|
||||
include(${VTK_USE_FILE})
|
||||
|
||||
|
||||
add_subdirectory(App)
|
||||
|
||||
if(BUILD_GUI)
|
||||
|
||||
@@ -69,20 +69,20 @@ set(FemGui_MOC_HDRS
|
||||
TaskFemConstraintHeatflux.h
|
||||
TaskFemConstraintInitialTemperature.h
|
||||
TaskFemConstraintPlaneRotation.h
|
||||
TaskFemConstraintContact.h
|
||||
TaskFemConstraintContact.h
|
||||
TaskTetParameter.h
|
||||
TaskAnalysisInfo.h
|
||||
TaskDriver.h
|
||||
TaskDlgAnalysis.h
|
||||
TaskDlgMeshShapeNetgen.h
|
||||
)
|
||||
if(BUILD_FEM_VTK)
|
||||
if(BUILD_FEM_VTK)
|
||||
set(FemGui_MOC_HDRS
|
||||
${FemGui_MOC_HDRS}
|
||||
TaskPostBoxes.h
|
||||
ViewProviderFemPostFunction.h
|
||||
)
|
||||
endif(BUILD_FEM_VTK)
|
||||
endif(BUILD_FEM_VTK)
|
||||
fc_wrap_cpp(FemGui_MOC_SRCS ${FemGui_MOC_HDRS})
|
||||
SOURCE_GROUP("Moc" FILES ${FemGui_MOC_SRCS})
|
||||
|
||||
@@ -241,7 +241,7 @@ SET(FemGui_SRCS_TaskBoxes
|
||||
TaskTetParameter.cpp
|
||||
TaskTetParameter.h
|
||||
)
|
||||
if(BUILD_FEM_VTK)
|
||||
if(BUILD_FEM_VTK)
|
||||
SET(FemGui_SRCS_TaskBoxes
|
||||
${FemGui_SRCS_TaskBoxes}
|
||||
PlaneWidget.ui
|
||||
@@ -254,7 +254,7 @@ if(BUILD_FEM_VTK)
|
||||
TaskPostBoxes.h
|
||||
TaskPostBoxes.cpp
|
||||
)
|
||||
endif(BUILD_FEM_VTK)
|
||||
endif(BUILD_FEM_VTK)
|
||||
SOURCE_GROUP("Task_Boxes" FILES ${FemGui_SRCS_TaskBoxes})
|
||||
|
||||
SET(FemGui_SRCS_TaskDlg
|
||||
@@ -285,7 +285,7 @@ SET(FemGui_SRCS_Module
|
||||
)
|
||||
SOURCE_GROUP("Module" FILES ${FemGui_SRCS_Module})
|
||||
|
||||
if(BUILD_FEM_VTK)
|
||||
if(BUILD_FEM_VTK)
|
||||
SET(FemGui_SRCS_Post
|
||||
ViewProviderFemPostObject.h
|
||||
ViewProviderFemPostObject.cpp
|
||||
|
||||
@@ -992,7 +992,7 @@ void setupFilter(Gui::Command* cmd, std::string Name) {
|
||||
std::string FeatName = cmd->getUniqueObjectName(Name.c_str());
|
||||
|
||||
cmd->openCommand("Create filter");
|
||||
cmd->doCommand(Gui::Command::Doc,"App.activeDocument().addObject('Fem::FemPost%sFilter','%s')", Name.c_str(), FeatName.c_str());
|
||||
cmd->doCommand(Gui::Command::Doc,"App.activeDocument().addObject('Fem::FemPost%sFilter','%s')", Name.c_str(), FeatName.c_str());
|
||||
cmd->doCommand(Gui::Command::Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument());
|
||||
cmd->doCommand(Gui::Command::Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
|
||||
cmd->doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument());
|
||||
@@ -1151,12 +1151,12 @@ void CmdFemPostFunctions::activated(int iMsg)
|
||||
doCommand(Doc,"App.ActiveDocument.%s.Functions = App.ActiveDocument.%s", pipeline->getNameInDocument(), FuncName.c_str());
|
||||
provider = static_cast<Fem::FemPostFunctionProvider*>(getDocument()->getObject(FuncName.c_str()));
|
||||
}
|
||||
else
|
||||
else
|
||||
provider = static_cast<Fem::FemPostFunctionProvider*>(pipeline->Functions.getValue());
|
||||
|
||||
//build the object
|
||||
std::string FeatName = getUniqueObjectName(name.c_str());
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPost%sFunction','%s')", name.c_str(), FeatName.c_str());
|
||||
std::string FeatName = getUniqueObjectName(name.c_str());
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPost%sFunction','%s')", name.c_str(), FeatName.c_str());
|
||||
doCommand(Doc,"__list__ = App.ActiveDocument.%s.Functions", provider->getNameInDocument());
|
||||
doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
|
||||
doCommand(Doc,"App.ActiveDocument.%s.Functions = __list__", provider->getNameInDocument());
|
||||
@@ -1169,7 +1169,7 @@ void CmdFemPostFunctions::activated(int iMsg)
|
||||
box.GetCenter(center);
|
||||
|
||||
if (iMsg==0)
|
||||
doCommand(Doc,"App.ActiveDocument.%s.Origin = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0],
|
||||
doCommand(Doc,"App.ActiveDocument.%s.Origin = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0],
|
||||
center[1], center[2]);
|
||||
else if (iMsg==1) {
|
||||
doCommand(Doc,"App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0],
|
||||
@@ -1269,7 +1269,7 @@ void CmdFemPostApllyChanges::activated(int iMsg)
|
||||
{
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem");
|
||||
|
||||
if (iMsg == 1)
|
||||
if (iMsg == 1)
|
||||
hGrp->SetBool("PostAutoRecompute", true);
|
||||
else
|
||||
hGrp->SetBool("PostAutoRecompute", false);
|
||||
@@ -1318,9 +1318,9 @@ void CmdFemPostPipelineFromResult::activated(int iMsg)
|
||||
std::string FeatName = getUniqueObjectName("Pipeline");
|
||||
|
||||
openCommand("Create pipeline from result");
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostPipeline','%s')",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostPipeline','%s')",FeatName.c_str());
|
||||
|
||||
//TODO: use python function call for this
|
||||
//TODO: use python function call for this
|
||||
static_cast<Fem::FemPostPipeline*>(getDocument()->getObject(FeatName.c_str()))->load(result);
|
||||
|
||||
this->updateActive();
|
||||
|
||||
@@ -60,7 +60,7 @@ using namespace Gui;
|
||||
|
||||
TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintContact *ConstraintView,QWidget *parent)
|
||||
: TaskFemConstraint(ConstraintView, parent, "fem-constraint-contact")
|
||||
{
|
||||
{
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskFemConstraintContact();
|
||||
ui->setupUi(proxy);
|
||||
@@ -68,56 +68,56 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont
|
||||
|
||||
QAction* actionSlave = new QAction(tr("Delete"), ui->lw_referencesSlave);
|
||||
actionSlave->connect(actionSlave, SIGNAL(triggered()), this, SLOT(onReferenceDeletedSlave()));
|
||||
|
||||
|
||||
QAction* actionMaster = new QAction(tr("Delete"), ui->lw_referencesMaster);
|
||||
actionMaster->connect(actionMaster, SIGNAL(triggered()), this, SLOT(onReferenceDeletedMaster()));
|
||||
|
||||
|
||||
ui->lw_referencesSlave->addAction(actionSlave);
|
||||
ui->lw_referencesSlave->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
|
||||
connect(ui->lw_referencesSlave, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_referencesMaster->addAction(actionMaster);
|
||||
ui->lw_referencesMaster->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
|
||||
connect(ui->lw_referencesMaster, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
/* Note: */
|
||||
// Get the feature data
|
||||
Fem::ConstraintContact* pcConstraint = static_cast<Fem::ConstraintContact*>(ConstraintView->getObject());
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
double S = pcConstraint->Slope.getValue();
|
||||
double F = pcConstraint->Friction.getValue();
|
||||
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->spSlope->setMinimum(1.0);
|
||||
ui->spSlope->setValue(S);
|
||||
ui->spFriction->setValue(F);
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
ui->lw_referencesMaster->clear();
|
||||
ui->lw_referencesSlave->clear();
|
||||
if (Objects.size() > 0){
|
||||
for (std::size_t i = 1; i < Objects.size(); i++) {
|
||||
ui->lw_referencesMaster->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
}
|
||||
|
||||
|
||||
for (std::size_t i = 0; i < (Objects.size()-1); i++) {
|
||||
ui->lw_referencesSlave->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Selection buttons
|
||||
connect(ui->btnAddSlave, SIGNAL(clicked()), this, SLOT(addToSelectionSlave()));
|
||||
connect(ui->btnRemoveSlave, SIGNAL(clicked()), this, SLOT(removeFromSelectionSlave()));
|
||||
|
||||
|
||||
connect(ui->btnAddMaster, SIGNAL(clicked()), this, SLOT(addToSelectionMaster()));
|
||||
connect(ui->btnRemoveMaster, SIGNAL(clicked()), this, SLOT(removeFromSelectionMaster()));
|
||||
|
||||
@@ -145,38 +145,38 @@ void TaskFemConstraintContact::updateUI()
|
||||
|
||||
void TaskFemConstraintContact::addToSelectionSlave()
|
||||
{
|
||||
int rows = ui->lw_referencesSlave->model()->rowCount();
|
||||
int rows = ui->lw_referencesSlave->model()->rowCount();
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx();//gets vector of selected objects of active document
|
||||
if (rows==1){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one master face and one slave face for a contact constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.size()==0){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((rows==0) && (selection.size()>=2)){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one slave face for a contact constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Fem::ConstraintContact* pcConstraint = static_cast<Fem::ConstraintContact*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
if (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
if (subNames.size()!=1){
|
||||
if (subNames.size()!=1){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one slave face for a contact constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
@@ -186,7 +186,7 @@ void TaskFemConstraintContact::addToSelectionSlave()
|
||||
if (subNames[subIt].substr(0,4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
itr = std::find(++itr,SubElements.end(),subNames[subIt]))
|
||||
@@ -204,7 +204,7 @@ void TaskFemConstraintContact::addToSelectionSlave()
|
||||
connect(ui->lw_referencesSlave, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Update UI
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
@@ -228,10 +228,10 @@ void TaskFemConstraintContact::removeFromSelectionSlave()
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
@@ -243,7 +243,7 @@ void TaskFemConstraintContact::removeFromSelectionSlave()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort(itemsToDel.begin(),itemsToDel.end());
|
||||
while (itemsToDel.size()>0){
|
||||
Objects.erase(Objects.begin()+itemsToDel.back());
|
||||
@@ -253,49 +253,49 @@ void TaskFemConstraintContact::removeFromSelectionSlave()
|
||||
//Update UI
|
||||
disconnect(ui->lw_referencesSlave, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_referencesSlave->clear();
|
||||
connect(ui->lw_referencesSlave, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void TaskFemConstraintContact::addToSelectionMaster()
|
||||
{
|
||||
int rows = ui->lw_referencesMaster->model()->rowCount();
|
||||
int rows = ui->lw_referencesMaster->model()->rowCount();
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx();//gets vector of selected objects of active document
|
||||
if (rows==1){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one master face and one slave face for a contact constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.size()==0){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((rows==0) && (selection.size()>=2)){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one master for a contact constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Fem::ConstraintContact* pcConstraint = static_cast<Fem::ConstraintContact*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
if (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
if (subNames.size()!=1){
|
||||
if (subNames.size()!=1){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one master face for a contact constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
@@ -305,7 +305,7 @@ void TaskFemConstraintContact::addToSelectionMaster()
|
||||
if (subNames[subIt].substr(0,4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
itr = std::find(++itr,SubElements.end(),subNames[subIt]))
|
||||
@@ -323,7 +323,7 @@ void TaskFemConstraintContact::addToSelectionMaster()
|
||||
connect(ui->lw_referencesMaster, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Update UI
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
@@ -347,10 +347,10 @@ void TaskFemConstraintContact::removeFromSelectionMaster()
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
@@ -362,7 +362,7 @@ void TaskFemConstraintContact::removeFromSelectionMaster()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort(itemsToDel.begin(),itemsToDel.end());
|
||||
while (itemsToDel.size()>0){
|
||||
Objects.erase(Objects.begin()+itemsToDel.back());
|
||||
@@ -372,18 +372,18 @@ void TaskFemConstraintContact::removeFromSelectionMaster()
|
||||
//Update UI
|
||||
disconnect(ui->lw_referencesMaster, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_referencesMaster->clear();
|
||||
connect(ui->lw_referencesMaster, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void TaskFemConstraintContact::setSelection(QListWidgetItem* item){
|
||||
std::string docName=ConstraintView->getObject()->getDocument()->getName();
|
||||
|
||||
|
||||
std::string s = item->text().toStdString();
|
||||
std::string delimiter = ":";
|
||||
|
||||
@@ -394,7 +394,7 @@ void TaskFemConstraintContact::setSelection(QListWidgetItem* item){
|
||||
objName = s.substr(0, pos);
|
||||
s.erase(0, pos + delimiter.length());
|
||||
subName=s;
|
||||
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0);
|
||||
}
|
||||
@@ -414,7 +414,7 @@ const std::string TaskFemConstraintContact::getReferences() const
|
||||
for (int r = 0; r < rowsSlave; r++) {
|
||||
items.push_back(ui->lw_referencesSlave->item(r)->text().toStdString());
|
||||
}
|
||||
|
||||
|
||||
int rowsMaster = ui->lw_referencesMaster->model()->rowCount();
|
||||
for (int r = 0; r < rowsMaster; r++) {
|
||||
items.push_back(ui->lw_referencesMaster->item(r)->text().toStdString());
|
||||
@@ -465,9 +465,9 @@ bool TaskDlgFemConstraintContact::accept()
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Slope = %f",
|
||||
name.c_str(), parameterContact->get_Slope());
|
||||
name.c_str(), parameterContact->get_Slope());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Friction = %f",
|
||||
name.c_str(), parameterContact->get_Friction());
|
||||
name.c_str(), parameterContact->get_Friction());
|
||||
std::string scale = parameterContact->getScale(); //OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Scale = %s", name.c_str(), scale.c_str()); //OvG: implement modified scale
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
//void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
void updateUI();
|
||||
Ui_TaskFemConstraintContact* ui;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class TaskDlgFemConstraintContact : public TaskDlgFemConstraint
|
||||
|
||||
@@ -67,21 +67,21 @@ TaskFemConstraintFixed::TaskFemConstraintFixed(ViewProviderFemConstraintFixed *C
|
||||
action->connect(action, SIGNAL(triggered()), this, SLOT(onReferenceDeleted()));
|
||||
ui->lw_references->addAction(action);
|
||||
ui->lw_references->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
/* Note: */
|
||||
// Get the feature data
|
||||
Fem::ConstraintFixed* pcConstraint = static_cast<Fem::ConstraintFixed*>(ConstraintView->getObject());
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
// Fill data into dialog elements
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
@@ -89,7 +89,7 @@ TaskFemConstraintFixed::TaskFemConstraintFixed(ViewProviderFemConstraintFixed *C
|
||||
if (Objects.size() > 0) {
|
||||
ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
|
||||
|
||||
//Selection buttons
|
||||
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
|
||||
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
|
||||
@@ -112,7 +112,7 @@ void TaskFemConstraintFixed::updateUI()
|
||||
}
|
||||
|
||||
void TaskFemConstraintFixed::addToSelection()
|
||||
{
|
||||
{
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document
|
||||
if (selection.size()==0){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
|
||||
@@ -190,10 +190,10 @@ void TaskFemConstraintFixed::removeFromSelection()
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
@@ -205,7 +205,7 @@ void TaskFemConstraintFixed::removeFromSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort(itemsToDel.begin(),itemsToDel.end());
|
||||
while (itemsToDel.size()>0){
|
||||
Objects.erase(Objects.begin()+itemsToDel.back());
|
||||
@@ -215,21 +215,21 @@ void TaskFemConstraintFixed::removeFromSelection()
|
||||
//Update UI
|
||||
disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (unsigned int j=0;j<Objects.size();j++){
|
||||
ui->lw_references->addItem(makeRefText(Objects[j], SubElements[j]));
|
||||
}
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void TaskFemConstraintFixed::setSelection(QListWidgetItem* item){
|
||||
std::string docName=ConstraintView->getObject()->getDocument()->getName();
|
||||
|
||||
|
||||
std::string s = item->text().toStdString();
|
||||
std::string delimiter = ":";
|
||||
|
||||
@@ -240,7 +240,7 @@ void TaskFemConstraintFixed::setSelection(QListWidgetItem* item){
|
||||
objName = s.substr(0, pos);
|
||||
s.erase(0, pos + delimiter.length());
|
||||
subName=s;
|
||||
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ void TaskDlgFemConstraintFixed::open()
|
||||
bool TaskDlgFemConstraintFixed::accept()
|
||||
{
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
const TaskFemConstraintFixed* parameters = static_cast<const TaskFemConstraintFixed*>(parameter);
|
||||
const TaskFemConstraintFixed* parameters = static_cast<const TaskFemConstraintFixed*>(parameter);
|
||||
std::string scale = parameters->getScale(); //OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Scale = %s", name.c_str(), scale.c_str()); //OvG: implement modified scale
|
||||
return TaskDlgFemConstraint::accept();
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
private Q_SLOTS:
|
||||
void onReferenceDeleted(void);
|
||||
|
||||
|
||||
void addToSelection();
|
||||
void removeFromSelection();
|
||||
void setSelection(QListWidgetItem* item);
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
//void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
void updateUI();
|
||||
Ui_TaskFemConstraintFixed* ui;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class TaskDlgFemConstraintFixed : public TaskDlgFemConstraint
|
||||
|
||||
@@ -92,12 +92,12 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(ViewProviderFemConstraintHe
|
||||
ui->if_ambienttemp->setMaximum(FLOAT_MAX);
|
||||
Base::Quantity t = Base::Quantity(pcConstraint->AmbientTemp.getValue(), Base::Unit::Temperature);
|
||||
ui->if_ambienttemp->setValue(t);
|
||||
|
||||
|
||||
ui->if_filmcoef->setMinimum(0);
|
||||
ui->if_filmcoef->setMaximum(FLOAT_MAX);
|
||||
Base::Quantity f = Base::Quantity(pcConstraint->FilmCoef.getValue(), Base::Unit::ThermalTransferCoefficient);
|
||||
ui->if_filmcoef->setValue(f);
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
@@ -105,7 +105,7 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(ViewProviderFemConstraintHe
|
||||
if (Objects.size() > 0) {
|
||||
ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
|
||||
|
||||
//Selection buttons
|
||||
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
|
||||
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
|
||||
@@ -116,8 +116,8 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(ViewProviderFemConstraintHe
|
||||
ui->lw_references->blockSignals(false);
|
||||
ui->btnAdd->blockSignals(false);
|
||||
ui->btnRemove->blockSignals(false);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
updateUI();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ void TaskFemConstraintHeatflux::addToSelection()
|
||||
Fem::ConstraintHeatflux* pcConstraint = static_cast<Fem::ConstraintHeatflux*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
if (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
@@ -230,7 +230,7 @@ void TaskFemConstraintHeatflux::removeFromSelection()
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
|
||||
if (subNames.size()>0){
|
||||
@@ -244,9 +244,9 @@ void TaskFemConstraintHeatflux::removeFromSelection()
|
||||
else{
|
||||
//fix me, if an object is selected completely, getSelectionEx does not return any SubElements
|
||||
}
|
||||
|
||||
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
@@ -258,7 +258,7 @@ void TaskFemConstraintHeatflux::removeFromSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort(itemsToDel.begin(),itemsToDel.end());
|
||||
while (itemsToDel.size()>0){
|
||||
Objects.erase(Objects.begin()+itemsToDel.back());
|
||||
@@ -268,14 +268,14 @@ void TaskFemConstraintHeatflux::removeFromSelection()
|
||||
//Update UI
|
||||
disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (unsigned int j=0;j<Objects.size();j++){
|
||||
ui->lw_references->addItem(makeRefText(Objects[j], SubElements[j]));
|
||||
}
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
}
|
||||
@@ -283,7 +283,7 @@ void TaskFemConstraintHeatflux::removeFromSelection()
|
||||
|
||||
void TaskFemConstraintHeatflux::setSelection(QListWidgetItem* item){
|
||||
std::string docName=ConstraintView->getObject()->getDocument()->getName();
|
||||
|
||||
|
||||
std::string s = item->text().toStdString();
|
||||
std::string delimiter = ":";
|
||||
|
||||
@@ -294,7 +294,7 @@ void TaskFemConstraintHeatflux::setSelection(QListWidgetItem* item){
|
||||
objName = s.substr(0, pos);
|
||||
s.erase(0, pos + delimiter.length());
|
||||
subName=s;
|
||||
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0);
|
||||
}
|
||||
@@ -317,7 +317,7 @@ double TaskFemConstraintHeatflux::getAmbientTemp(void) const
|
||||
{
|
||||
Base::Quantity temperature = ui->if_ambienttemp->getQuantity();
|
||||
double temperature_in_kelvin = temperature.getValueAs(Base::Quantity::Kelvin);
|
||||
return temperature_in_kelvin;
|
||||
return temperature_in_kelvin;
|
||||
}
|
||||
|
||||
double TaskFemConstraintHeatflux::getFilmCoef(void) const
|
||||
@@ -370,15 +370,15 @@ bool TaskDlgFemConstraintHeatflux::accept()
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
const TaskFemConstraintHeatflux* parameterHeatflux = static_cast<const TaskFemConstraintHeatflux*>(parameter);
|
||||
std::string scale = "1";
|
||||
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.AmbientTemp = %f",
|
||||
name.c_str(), parameterHeatflux->getAmbientTemp());
|
||||
/*Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.FaceTemp = %f",
|
||||
name.c_str(), parameterHeatflux->getFaceTemp());*/
|
||||
name.c_str(), parameterHeatflux->getFaceTemp());*/
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.FilmCoef = %f",
|
||||
name.c_str(), parameterHeatflux->getFilmCoef());
|
||||
|
||||
name.c_str(), parameterHeatflux->getFilmCoef());
|
||||
|
||||
scale = parameterHeatflux->getScale(); //OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(), scale.c_str()); //OvG: implement modified scale
|
||||
|
||||
@@ -60,7 +60,7 @@ private Q_SLOTS:
|
||||
void onAmbientTempChanged(double val);
|
||||
/*void onFaceTempChanged(double val);*/
|
||||
void onFilmCoefChanged(double val);
|
||||
|
||||
|
||||
void addToSelection();
|
||||
void removeFromSelection();
|
||||
void setSelection(QListWidgetItem* item);
|
||||
|
||||
@@ -65,14 +65,14 @@ TaskFemConstraintInitialTemperature::TaskFemConstraintInitialTemperature(ViewPro
|
||||
ui = new Ui_TaskFemConstraintInitialTemperature();
|
||||
ui->setupUi(proxy);
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
// Get the feature data
|
||||
Fem::ConstraintInitialTemperature* pcConstraint = static_cast<Fem::ConstraintInitialTemperature*>(ConstraintView->getObject());
|
||||
Fem::ConstraintInitialTemperature* pcConstraint = static_cast<Fem::ConstraintInitialTemperature*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->if_temperature->setMinimum(0);
|
||||
ui->if_temperature->setMaximum(FLOAT_MAX);
|
||||
@@ -127,7 +127,7 @@ bool TaskDlgFemConstraintInitialTemperature::accept()
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.initialTemperature = %f",
|
||||
name.c_str(), parameterTemperature->get_temperature());
|
||||
|
||||
|
||||
std::string scale = parameterTemperature->getScale(); //OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Scale = %s", name.c_str(), scale.c_str()); //OvG: implement modified scale
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
//void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
void updateUI();
|
||||
Ui_TaskFemConstraintInitialTemperature* ui;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class TaskDlgFemConstraintInitialTemperature : public TaskDlgFemConstraint
|
||||
|
||||
@@ -77,21 +77,21 @@ TaskFemConstraintPlaneRotation::TaskFemConstraintPlaneRotation(ViewProviderFemCo
|
||||
action->connect(action, SIGNAL(triggered()), this, SLOT(onReferenceDeleted()));
|
||||
ui->lw_references->addAction(action);
|
||||
ui->lw_references->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
/* Note: */
|
||||
// Get the feature data
|
||||
Fem::ConstraintPlaneRotation* pcConstraint = static_cast<Fem::ConstraintPlaneRotation*>(ConstraintView->getObject());
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
// Fill data into dialog elements
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
@@ -99,7 +99,7 @@ TaskFemConstraintPlaneRotation::TaskFemConstraintPlaneRotation(ViewProviderFemCo
|
||||
if (Objects.size() > 0) {
|
||||
ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
|
||||
|
||||
//Selection buttons
|
||||
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
|
||||
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
|
||||
@@ -123,33 +123,33 @@ void TaskFemConstraintPlaneRotation::updateUI()
|
||||
|
||||
void TaskFemConstraintPlaneRotation::addToSelection()
|
||||
{
|
||||
int rows = ui->lw_references->model()->rowCount();
|
||||
int rows = ui->lw_references->model()->rowCount();
|
||||
if (rows==1){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one face can be selected for a plane rotation constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document
|
||||
if (selection.size()==0){
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Fem::ConstraintPlaneRotation* pcConstraint = static_cast<Fem::ConstraintPlaneRotation*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
if (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
if (subNames.size()==1){
|
||||
|
||||
if (subNames.size()==1){
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
bool addMe=true;
|
||||
if ((subNames[subIt].substr(0,4) != "Face")) {
|
||||
@@ -187,7 +187,7 @@ void TaskFemConstraintPlaneRotation::addToSelection()
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one face can be selected for a plane rotation constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Update UI
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
@@ -212,10 +212,10 @@ void TaskFemConstraintPlaneRotation::removeFromSelection()
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
@@ -227,7 +227,7 @@ void TaskFemConstraintPlaneRotation::removeFromSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort(itemsToDel.begin(),itemsToDel.end());
|
||||
while (itemsToDel.size()>0){
|
||||
Objects.erase(Objects.begin()+itemsToDel.back());
|
||||
@@ -237,21 +237,21 @@ void TaskFemConstraintPlaneRotation::removeFromSelection()
|
||||
//Update UI
|
||||
disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (unsigned int j=0;j<Objects.size();j++){
|
||||
ui->lw_references->addItem(makeRefText(Objects[j], SubElements[j]));
|
||||
}
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void TaskFemConstraintPlaneRotation::setSelection(QListWidgetItem* item){
|
||||
std::string docName=ConstraintView->getObject()->getDocument()->getName();
|
||||
|
||||
|
||||
std::string s = item->text().toStdString();
|
||||
std::string delimiter = ":";
|
||||
|
||||
@@ -262,7 +262,7 @@ void TaskFemConstraintPlaneRotation::setSelection(QListWidgetItem* item){
|
||||
objName = s.substr(0, pos);
|
||||
s.erase(0, pos + delimiter.length());
|
||||
subName=s;
|
||||
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0);
|
||||
}
|
||||
@@ -314,7 +314,7 @@ void TaskDlgFemConstraintPlaneRotation::open()
|
||||
bool TaskDlgFemConstraintPlaneRotation::accept()
|
||||
{
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
const TaskFemConstraintPlaneRotation* parameters = static_cast<const TaskFemConstraintPlaneRotation*>(parameter);
|
||||
const TaskFemConstraintPlaneRotation* parameters = static_cast<const TaskFemConstraintPlaneRotation*>(parameter);
|
||||
std::string scale = parameters->getScale(); //OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Scale = %s", name.c_str(), scale.c_str()); //OvG: implement modified scale
|
||||
return TaskDlgFemConstraint::accept();
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
private Q_SLOTS:
|
||||
void onReferenceDeleted(void);
|
||||
|
||||
|
||||
void addToSelection();
|
||||
void removeFromSelection();
|
||||
void setSelection(QListWidgetItem* item);
|
||||
@@ -66,7 +66,7 @@ private:
|
||||
//void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
void updateUI();
|
||||
Ui_TaskFemConstraintPlaneRotation* ui;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class TaskDlgFemConstraintPlaneRotation : public TaskDlgFemConstraint
|
||||
|
||||
@@ -68,28 +68,28 @@ TaskFemConstraintPressure::TaskFemConstraintPressure(ViewProviderFemConstraintPr
|
||||
action->connect(action, SIGNAL(triggered()), this, SLOT(onReferenceDeleted()));
|
||||
ui->lw_references->addAction(action);
|
||||
ui->lw_references->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
/* Note: */
|
||||
// Get the feature data
|
||||
Fem::ConstraintPressure* pcConstraint = static_cast<Fem::ConstraintPressure*>(ConstraintView->getObject());
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->if_pressure->setMinimum(0);
|
||||
ui->if_pressure->setMaximum(FLOAT_MAX);
|
||||
Base::Quantity p = Base::Quantity(1000 * (pcConstraint->Pressure.getValue()), Base::Unit::Stress);
|
||||
ui->if_pressure->setValue(p);
|
||||
ui->if_pressure->setValue(p);
|
||||
bool reversed = pcConstraint->Reversed.getValue();
|
||||
ui->checkBoxReverse->setChecked(reversed);
|
||||
ui->checkBoxReverse->setChecked(reversed);
|
||||
/* */
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
@@ -97,7 +97,7 @@ TaskFemConstraintPressure::TaskFemConstraintPressure(ViewProviderFemConstraintPr
|
||||
if (Objects.size() > 0) {
|
||||
ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
|
||||
|
||||
//Selection buttons
|
||||
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
|
||||
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
|
||||
@@ -130,23 +130,23 @@ void TaskFemConstraintPressure::addToSelection()
|
||||
Fem::ConstraintPressure* pcConstraint = static_cast<Fem::ConstraintPressure*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
if (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
bool addMe=true;
|
||||
if (subNames[subIt].substr(0,4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
itr = std::find(++itr,SubElements.end(),subNames[subIt]))
|
||||
@@ -188,10 +188,10 @@ void TaskFemConstraintPressure::removeFromSelection()
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
@@ -203,7 +203,7 @@ void TaskFemConstraintPressure::removeFromSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort(itemsToDel.begin(),itemsToDel.end());
|
||||
while (itemsToDel.size()>0){
|
||||
Objects.erase(Objects.begin()+itemsToDel.back());
|
||||
@@ -213,21 +213,21 @@ void TaskFemConstraintPressure::removeFromSelection()
|
||||
//Update UI
|
||||
disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (unsigned int j=0;j<Objects.size();j++){
|
||||
ui->lw_references->addItem(makeRefText(Objects[j], SubElements[j]));
|
||||
}
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void TaskFemConstraintPressure::setSelection(QListWidgetItem* item){
|
||||
std::string docName=ConstraintView->getObject()->getDocument()->getName();
|
||||
|
||||
|
||||
std::string s = item->text().toStdString();
|
||||
std::string delimiter = ":";
|
||||
|
||||
@@ -238,7 +238,7 @@ void TaskFemConstraintPressure::setSelection(QListWidgetItem* item){
|
||||
objName = s.substr(0, pos);
|
||||
s.erase(0, pos + delimiter.length());
|
||||
subName=s;
|
||||
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0);
|
||||
}
|
||||
@@ -310,7 +310,7 @@ bool TaskDlgFemConstraintPressure::accept()
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Pressure = %f",
|
||||
name.c_str(), parameterPressure->get_Pressure());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %s",
|
||||
name.c_str(), parameterPressure->get_Reverse() ? "True" : "False");
|
||||
name.c_str(), parameterPressure->get_Reverse() ? "True" : "False");
|
||||
std::string scale = parameterPressure->getScale(); //OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Scale = %s", name.c_str(), scale.c_str()); //OvG: implement modified scale
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
private Q_SLOTS:
|
||||
void onReferenceDeleted(void);
|
||||
|
||||
|
||||
void addToSelection();
|
||||
void removeFromSelection();
|
||||
void setSelection(QListWidgetItem* item);
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
//void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
void updateUI();
|
||||
Ui_TaskFemConstraintPressure* ui;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class TaskDlgFemConstraintPressure : public TaskDlgFemConstraint
|
||||
|
||||
@@ -70,24 +70,24 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature(ViewProviderFemConstr
|
||||
action->connect(action, SIGNAL(triggered()), this, SLOT(onReferenceDeleted()));
|
||||
ui->lw_references->addAction(action);
|
||||
ui->lw_references->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
// Get the feature data
|
||||
Fem::ConstraintTemperature* pcConstraint = static_cast<Fem::ConstraintTemperature*>(ConstraintView->getObject());
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->if_temperature->setMinimum(0);
|
||||
ui->if_temperature->setMaximum(FLOAT_MAX);
|
||||
Base::Quantity t = Base::Quantity(pcConstraint->Temperature.getValue(), Base::Unit::Temperature);
|
||||
ui->if_temperature->setValue(t);
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
@@ -95,7 +95,7 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature(ViewProviderFemConstr
|
||||
if (Objects.size() > 0) {
|
||||
ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
|
||||
|
||||
//Selection buttons
|
||||
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
|
||||
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
|
||||
@@ -128,13 +128,13 @@ void TaskFemConstraintTemperature::addToSelection()
|
||||
Fem::ConstraintTemperature* pcConstraint = static_cast<Fem::ConstraintTemperature*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
if (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
@@ -180,10 +180,10 @@ void TaskFemConstraintTemperature::removeFromSelection()
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> subNames=it->getSubNames();
|
||||
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
|
||||
|
||||
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
|
||||
itr!= SubElements.end();
|
||||
@@ -195,7 +195,7 @@ void TaskFemConstraintTemperature::removeFromSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort(itemsToDel.begin(),itemsToDel.end());
|
||||
while (itemsToDel.size()>0){
|
||||
Objects.erase(Objects.begin()+itemsToDel.back());
|
||||
@@ -205,21 +205,21 @@ void TaskFemConstraintTemperature::removeFromSelection()
|
||||
//Update UI
|
||||
disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (unsigned int j=0;j<Objects.size();j++){
|
||||
ui->lw_references->addItem(makeRefText(Objects[j], SubElements[j]));
|
||||
}
|
||||
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
|
||||
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void TaskFemConstraintTemperature::setSelection(QListWidgetItem* item){
|
||||
std::string docName=ConstraintView->getObject()->getDocument()->getName();
|
||||
|
||||
|
||||
std::string s = item->text().toStdString();
|
||||
std::string delimiter = ":";
|
||||
|
||||
@@ -230,7 +230,7 @@ void TaskFemConstraintTemperature::setSelection(QListWidgetItem* item){
|
||||
objName = s.substr(0, pos);
|
||||
s.erase(0, pos + delimiter.length());
|
||||
subName=s;
|
||||
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ const std::string TaskFemConstraintTemperature::getReferences() const
|
||||
double TaskFemConstraintTemperature::get_temperature() const{
|
||||
Base::Quantity temperature = ui->if_temperature->getQuantity();
|
||||
double temperature_in_kelvin = temperature.getValueAs(Base::Quantity::Kelvin);
|
||||
return temperature_in_kelvin;
|
||||
return temperature_in_kelvin;
|
||||
}
|
||||
|
||||
void TaskFemConstraintTemperature::changeEvent(QEvent *e)
|
||||
@@ -299,7 +299,7 @@ bool TaskDlgFemConstraintTemperature::accept()
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Temperature = %f",
|
||||
name.c_str(), parameterTemperature->get_temperature());
|
||||
|
||||
|
||||
std::string scale = parameterTemperature->getScale(); //OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Scale = %s", name.c_str(), scale.c_str()); //OvG: implement modified scale
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
private Q_SLOTS:
|
||||
void onReferenceDeleted(void);
|
||||
|
||||
|
||||
void addToSelection();
|
||||
void removeFromSelection();
|
||||
void setSelection(QListWidgetItem* item);
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
//void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
void updateUI();
|
||||
Ui_TaskFemConstraintTemperature* ui;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class TaskDlgFemConstraintTemperature : public TaskDlgFemConstraint
|
||||
|
||||
@@ -66,15 +66,15 @@ TaskDlgPost::~TaskDlgPost()
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButtons TaskDlgPost::getStandardButtons(void) const {
|
||||
|
||||
|
||||
//check if we only have gui task boxes
|
||||
bool guionly = true;
|
||||
for(std::vector<TaskPostBox*>::const_iterator it = m_boxes.begin(); it != m_boxes.end(); ++it)
|
||||
guionly = guionly && (*it)->isGuiTaskOnly();
|
||||
|
||||
|
||||
if(!guionly)
|
||||
return QDialogButtonBox::Apply|QDialogButtonBox::Ok|QDialogButtonBox::Cancel;
|
||||
else
|
||||
else
|
||||
return QDialogButtonBox::Ok;
|
||||
}
|
||||
|
||||
@@ -120,12 +120,12 @@ bool TaskDlgPost::reject()
|
||||
// roll back the done things
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TaskDlgPost::modifyStandardButtons(QDialogButtonBox* box) {
|
||||
|
||||
|
||||
if(box->button(QDialogButtonBox::Apply))
|
||||
box->button(QDialogButtonBox::Apply)->setDefault(true);
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void TaskDlgPost::modifyStandardButtons(QDialogButtonBox* box) {
|
||||
|
||||
//############################################################################################
|
||||
|
||||
TaskPostBox::TaskPostBox(Gui::ViewProviderDocumentObject* view, const QPixmap &icon, const QString &title, QWidget* parent)
|
||||
TaskPostBox::TaskPostBox(Gui::ViewProviderDocumentObject* view, const QPixmap &icon, const QString &title, QWidget* parent)
|
||||
: TaskBox(icon, title, true, parent) {
|
||||
|
||||
m_view = view;
|
||||
@@ -151,7 +151,7 @@ bool TaskPostBox::autoApply() {
|
||||
}
|
||||
|
||||
void TaskPostBox::recompute() {
|
||||
|
||||
|
||||
if(autoApply())
|
||||
App::GetApplication().getActiveDocument()->recompute();
|
||||
}
|
||||
@@ -161,9 +161,9 @@ void TaskPostBox::updateEnumerationList(App::PropertyEnumeration& prop, QComboBo
|
||||
box->clear();
|
||||
QStringList list;
|
||||
std::vector<std::string> vec = prop.getEnumVector();
|
||||
for(std::vector<std::string>::iterator it = vec.begin(); it != vec.end(); ++it )
|
||||
for(std::vector<std::string>::iterator it = vec.begin(); it != vec.end(); ++it )
|
||||
list.push_back(QString::fromStdString(*it));
|
||||
|
||||
|
||||
box->insertItems(0, list);
|
||||
box->setCurrentIndex(prop.getValue());
|
||||
}
|
||||
@@ -180,7 +180,7 @@ TaskPostDisplay::TaskPostDisplay(Gui::ViewProviderDocumentObject* view, QWidget
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
|
||||
//update all fields
|
||||
updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->DisplayMode, ui->Representation);
|
||||
updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->Field, ui->Field);
|
||||
@@ -200,13 +200,13 @@ void TaskPostDisplay::on_Representation_activated(int i) {
|
||||
}
|
||||
|
||||
void TaskPostDisplay::on_Field_activated(int i) {
|
||||
|
||||
|
||||
getTypedView<ViewProviderFemPostObject>()->Field.setValue(i);
|
||||
updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->VectorMode, ui->VectorMode);
|
||||
}
|
||||
|
||||
void TaskPostDisplay::on_VectorMode_activated(int i) {
|
||||
|
||||
|
||||
getTypedView<ViewProviderFemPostObject>()->VectorMode.setValue(i);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ void TaskPostDisplay::applyPythonCode() {
|
||||
TaskPostFunction::TaskPostFunction(ViewProviderDocumentObject* view, QWidget* parent): TaskPostBox(view, Gui::BitmapFactory().pixmap("fem-fem-mesh-create-node-by-poly"), tr("Implicit function"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostFunction::getClassTypeId()));
|
||||
|
||||
|
||||
//we load the views widget
|
||||
FunctionWidget* w = getTypedView<ViewProviderFemPostFunction>()->createControlWidget();
|
||||
w->setParent(this);
|
||||
@@ -245,31 +245,31 @@ void TaskPostFunction::applyPythonCode() {
|
||||
|
||||
TaskPostClip::TaskPostClip(ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent)
|
||||
: TaskPostBox(view,Gui::BitmapFactory().pixmap("fem-fem-mesh-create-node-by-poly"), tr("Choose implicit function"), parent) {
|
||||
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostClip::getClassTypeId()));
|
||||
assert(function);
|
||||
|
||||
|
||||
fwidget = NULL;
|
||||
|
||||
|
||||
//we load the views widget
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskPostClip();
|
||||
ui->setupUi(proxy);
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
|
||||
//the layout for the container widget
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
ui->Container->setLayout(layout);
|
||||
|
||||
|
||||
//fill up the combo box with possible functions
|
||||
collectImplicitFunctions();
|
||||
|
||||
|
||||
//add the function creation command
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
rcCmdMgr.getCommandByName("Fem_PostCreateFunctions")->getAction()->addTo(ui->CreateButton);
|
||||
ui->CreateButton->setPopupMode(QToolButton::InstantPopup);
|
||||
|
||||
|
||||
//load the default values
|
||||
ui->CutCells->setChecked(static_cast<Fem::FemPostClipFilter*>(getObject())->CutCells.getValue());
|
||||
ui->InsideOut->setChecked(static_cast<Fem::FemPostClipFilter*>(getObject())->InsideOut.getValue());
|
||||
@@ -289,16 +289,16 @@ void TaskPostClip::collectImplicitFunctions() {
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
|
||||
ui->FunctionBox->clear();
|
||||
QStringList items;
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
for(std::size_t i=0; i<funcs.size(); ++i)
|
||||
items.push_back(QString::fromLatin1(funcs[i]->getNameInDocument()));
|
||||
|
||||
|
||||
ui->FunctionBox->addItems(items);
|
||||
}
|
||||
}
|
||||
@@ -311,34 +311,34 @@ void TaskPostClip::on_CreateButton_triggered(QAction* a) {
|
||||
}
|
||||
|
||||
void TaskPostClip::on_FunctionBox_currentIndexChanged(int idx) {
|
||||
|
||||
|
||||
//set the correct property
|
||||
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
if(idx>=0)
|
||||
static_cast<Fem::FemPostClipFilter*>(getObject())->Function.setValue(funcs[idx]);
|
||||
else
|
||||
else
|
||||
static_cast<Fem::FemPostClipFilter*>(getObject())->Function.setValue(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//load the correct view
|
||||
Fem::FemPostFunction* fobj = static_cast<Fem::FemPostFunction*>(
|
||||
static_cast<Fem::FemPostClipFilter*>(getObject())->Function.getValue());
|
||||
Gui::ViewProvider* view = NULL;
|
||||
if(fobj)
|
||||
view = Gui::Application::Instance->activeDocument()->getViewProvider(fobj);
|
||||
|
||||
|
||||
if(fwidget)
|
||||
fwidget->deleteLater();
|
||||
|
||||
|
||||
if(view) {
|
||||
fwidget = static_cast<FemGui::ViewProviderFemPostFunction*>(view)->createControlWidget();
|
||||
fwidget->setParent(ui->Container);
|
||||
@@ -366,26 +366,26 @@ TaskPostScalarClip::TaskPostScalarClip(ViewProviderDocumentObject* view, QWidget
|
||||
TaskPostBox(view, Gui::BitmapFactory().pixmap("fem-fem-mesh-create-node-by-poly"), tr("Clip options"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostScalarClip::getClassTypeId()));
|
||||
|
||||
|
||||
//we load the views widget
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskPostScalarClip();
|
||||
ui->setupUi(proxy);
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
//load the default values
|
||||
updateEnumerationList(getTypedObject<Fem::FemPostScalarClipFilter>()->Scalars, ui->Scalar);
|
||||
ui->InsideOut->setChecked(static_cast<Fem::FemPostScalarClipFilter*>(getObject())->InsideOut.getValue());
|
||||
|
||||
App::PropertyFloatConstraint& value = static_cast<Fem::FemPostScalarClipFilter*>(getObject())->Value;
|
||||
//don't forget to sync the slider
|
||||
//don't forget to sync the slider
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( value.getValue());
|
||||
ui->Value->blockSignals(false);
|
||||
//don't forget to sync the slider
|
||||
//don't forget to sync the slider
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( value.getConstraints()->UpperBound * (1-double(value.getValue())/100.)
|
||||
ui->Value->setValue( value.getConstraints()->UpperBound * (1-double(value.getValue())/100.)
|
||||
+ double(value.getValue())/100.*value.getConstraints()->UpperBound);
|
||||
ui->Value->blockSignals(false);
|
||||
}
|
||||
@@ -402,19 +402,19 @@ void TaskPostScalarClip::on_Scalar_currentIndexChanged(int idx) {
|
||||
|
||||
static_cast<Fem::FemPostScalarClipFilter*>(getObject())->Scalars.setValue(idx);
|
||||
recompute();
|
||||
|
||||
|
||||
//update constraints and values
|
||||
App::PropertyFloatConstraint& value = static_cast<Fem::FemPostScalarClipFilter*>(getObject())->Value;
|
||||
ui->Maximum->setText(QString::number(value.getConstraints()->UpperBound));
|
||||
ui->Minimum->setText(QString::number(value.getConstraints()->LowerBound));
|
||||
|
||||
//don't forget to sync the slider
|
||||
ui->Minimum->setText(QString::number(value.getConstraints()->LowerBound));
|
||||
|
||||
//don't forget to sync the slider
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( value.getValue());
|
||||
ui->Value->blockSignals(false);
|
||||
//don't forget to sync the slider
|
||||
//don't forget to sync the slider
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( value.getConstraints()->UpperBound * (1-double(value.getValue())/100.)
|
||||
ui->Value->setValue( value.getConstraints()->UpperBound * (1-double(value.getValue())/100.)
|
||||
+ double(value.getValue())/100.*value.getConstraints()->UpperBound);
|
||||
ui->Value->blockSignals(false);
|
||||
}
|
||||
@@ -426,8 +426,8 @@ void TaskPostScalarClip::on_Slider_valueChanged(int v) {
|
||||
|
||||
value.setValue(val);
|
||||
recompute();
|
||||
|
||||
//don't forget to sync the spinbox
|
||||
|
||||
//don't forget to sync the spinbox
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( val );
|
||||
ui->Value->blockSignals(false);
|
||||
@@ -438,8 +438,8 @@ void TaskPostScalarClip::on_Value_valueChanged(double v) {
|
||||
App::PropertyFloatConstraint& value = static_cast<Fem::FemPostScalarClipFilter*>(getObject())->Value;
|
||||
value.setValue(v);
|
||||
recompute();
|
||||
|
||||
//don't forget to sync the slider
|
||||
|
||||
//don't forget to sync the slider
|
||||
ui->Slider->blockSignals(true);
|
||||
ui->Slider->setValue(int(((v- value.getConstraints()->LowerBound)/(value.getConstraints()->UpperBound - value.getConstraints()->LowerBound))*100.));
|
||||
ui->Slider->blockSignals(false);
|
||||
@@ -458,23 +458,23 @@ TaskPostWarpVector::TaskPostWarpVector(ViewProviderDocumentObject* view, QWidget
|
||||
TaskPostBox(view, Gui::BitmapFactory().pixmap("fem-fem-mesh-create-node-by-poly"), tr("Clip options"), parent) {
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostWarpVector::getClassTypeId()));
|
||||
|
||||
|
||||
//we load the views widget
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskPostWarpVector();
|
||||
ui->setupUi(proxy);
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
//load the default values
|
||||
updateEnumerationList(getTypedObject<Fem::FemPostWarpVectorFilter>()->Vector, ui->Vector);
|
||||
|
||||
|
||||
double value = static_cast<Fem::FemPostWarpVectorFilter*>(getObject())->Factor.getValue();
|
||||
//don't forget to sync the slider
|
||||
//don't forget to sync the slider
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( value);
|
||||
ui->Value->blockSignals(false);
|
||||
//don't forget to sync the slider
|
||||
//don't forget to sync the slider
|
||||
ui->Max->blockSignals(true);
|
||||
ui->Max->setValue( value==0 ? 1 : value * 10.);
|
||||
ui->Max->blockSignals(false);
|
||||
@@ -505,8 +505,8 @@ void TaskPostWarpVector::on_Slider_valueChanged(int v) {
|
||||
double val = ui->Min->value() + (ui->Max->value()-ui->Min->value())/100.*v;
|
||||
static_cast<Fem::FemPostWarpVectorFilter*>(getObject())->Factor.setValue(val);
|
||||
recompute();
|
||||
|
||||
//don't forget to sync the spinbox
|
||||
|
||||
//don't forget to sync the spinbox
|
||||
ui->Value->blockSignals(true);
|
||||
ui->Value->setValue( val );
|
||||
ui->Value->blockSignals(false);
|
||||
@@ -516,8 +516,8 @@ void TaskPostWarpVector::on_Value_valueChanged(double v) {
|
||||
|
||||
static_cast<Fem::FemPostWarpVectorFilter*>(getObject())->Factor.setValue(v);
|
||||
recompute();
|
||||
|
||||
//don't forget to sync the slider
|
||||
|
||||
//don't forget to sync the slider
|
||||
ui->Slider->blockSignals(true);
|
||||
ui->Slider->setValue(int((v - ui->Min->value()) / (ui->Max->value() - ui->Min->value())*100.));
|
||||
ui->Slider->blockSignals(false);
|
||||
@@ -541,26 +541,26 @@ void TaskPostWarpVector::on_Min_valueChanged(double v) {
|
||||
|
||||
TaskPostCut::TaskPostCut(ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent)
|
||||
: TaskPostBox(view,Gui::BitmapFactory().pixmap("fem-fem-mesh-create-node-by-poly"), tr("Choose implicit function"), parent) {
|
||||
|
||||
|
||||
assert(view->isDerivedFrom(ViewProviderFemPostCut::getClassTypeId()));
|
||||
assert(function);
|
||||
|
||||
|
||||
fwidget = NULL;
|
||||
|
||||
|
||||
//we load the views widget
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskPostCut();
|
||||
ui->setupUi(proxy);
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
|
||||
//the layout for the container widget
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
ui->Container->setLayout(layout);
|
||||
|
||||
|
||||
//fill up the combo box with possible functions
|
||||
collectImplicitFunctions();
|
||||
|
||||
|
||||
//add the function creation command
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
rcCmdMgr.getCommandByName("Fem_PostCreateFunctions")->getAction()->addTo(ui->CreateButton);
|
||||
@@ -581,16 +581,16 @@ void TaskPostCut::collectImplicitFunctions() {
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
|
||||
ui->FunctionBox->clear();
|
||||
QStringList items;
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
for(std::size_t i=0; i<funcs.size(); ++i)
|
||||
items.push_back(QString::fromLatin1(funcs[i]->getNameInDocument()));
|
||||
|
||||
|
||||
ui->FunctionBox->addItems(items);
|
||||
}
|
||||
}
|
||||
@@ -603,34 +603,34 @@ void TaskPostCut::on_CreateButton_triggered(QAction* a) {
|
||||
}
|
||||
|
||||
void TaskPostCut::on_FunctionBox_currentIndexChanged(int idx) {
|
||||
|
||||
|
||||
//set the correct property
|
||||
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||
if (!pipelines.empty()) {
|
||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||
if(pipeline->Functions.getValue() &&
|
||||
if(pipeline->Functions.getValue() &&
|
||||
pipeline->Functions.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||
|
||||
|
||||
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||
pipeline->Functions.getValue())->Functions.getValues();
|
||||
if(idx>=0)
|
||||
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.setValue(funcs[idx]);
|
||||
else
|
||||
else
|
||||
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.setValue(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//load the correct view
|
||||
Fem::FemPostFunction* fobj = static_cast<Fem::FemPostFunction*>(
|
||||
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.getValue());
|
||||
Gui::ViewProvider* view = NULL;
|
||||
if(fobj)
|
||||
view = Gui::Application::Instance->activeDocument()->getViewProvider(fobj);
|
||||
|
||||
|
||||
if(fwidget)
|
||||
fwidget->deleteLater();
|
||||
|
||||
|
||||
if(view) {
|
||||
fwidget = static_cast<FemGui::ViewProviderFemPostFunction*>(view)->createControlWidget();
|
||||
fwidget->setParent(ui->Container);
|
||||
|
||||
@@ -39,19 +39,19 @@ class Ui_TaskPostWarpVector;
|
||||
class Ui_TaskPostCut;
|
||||
|
||||
|
||||
namespace FemGui {
|
||||
namespace FemGui {
|
||||
|
||||
class TaskPostBox : public Gui::TaskView::TaskBox {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
TaskPostBox(Gui::ViewProviderDocumentObject* view, const QPixmap &icon, const QString &title, QWidget *parent = 0);
|
||||
~TaskPostBox();
|
||||
|
||||
virtual void applyPythonCode() = 0;
|
||||
|
||||
virtual void applyPythonCode() = 0;
|
||||
virtual bool isGuiTaskOnly() {return false;}; //return true if only gui properties are manipulated
|
||||
|
||||
|
||||
protected:
|
||||
App::DocumentObject* getObject() {return m_object;};
|
||||
template<typename T>
|
||||
@@ -59,10 +59,10 @@ protected:
|
||||
Gui::ViewProviderDocumentObject* getView() {return m_view;};
|
||||
template<typename T>
|
||||
T* getTypedView() {return static_cast<T*>(m_view);};
|
||||
|
||||
|
||||
bool autoApply();
|
||||
void recompute();
|
||||
|
||||
|
||||
static void updateEnumerationList(App::PropertyEnumeration&, QComboBox* box);
|
||||
|
||||
private:
|
||||
@@ -92,12 +92,12 @@ public:
|
||||
virtual bool accept();
|
||||
/// is called by the framework if the dialog is rejected (Cancel)
|
||||
virtual bool reject();
|
||||
/// is called by the framework if the user presses the help button
|
||||
/// is called by the framework if the user presses the help button
|
||||
virtual bool isAllowedAlterDocument(void) const
|
||||
{ return false; }
|
||||
virtual void modifyStandardButtons(QDialogButtonBox*);
|
||||
|
||||
/// returns for Close and Help button
|
||||
/// returns for Close and Help button
|
||||
virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const;
|
||||
|
||||
protected:
|
||||
@@ -116,48 +116,48 @@ public:
|
||||
|
||||
virtual void applyPythonCode();
|
||||
virtual bool isGuiTaskOnly() {return true;};
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_Representation_activated(int i);
|
||||
void on_Field_activated(int i);
|
||||
void on_VectorMode_activated(int i);
|
||||
void on_Transparency_valueChanged(int i);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
Ui_TaskPostDisplay* ui;
|
||||
};
|
||||
|
||||
class TaskPostFunction : public TaskPostBox {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
TaskPostFunction(Gui::ViewProviderDocumentObject* view, QWidget* parent = 0);
|
||||
virtual ~TaskPostFunction();
|
||||
|
||||
|
||||
virtual void applyPythonCode();
|
||||
};
|
||||
|
||||
class TaskPostClip : public TaskPostBox {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
TaskPostClip(Gui::ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent = 0);
|
||||
virtual ~TaskPostClip();
|
||||
|
||||
|
||||
virtual void applyPythonCode();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_CreateButton_triggered(QAction* a);
|
||||
void on_FunctionBox_currentIndexChanged(int idx);
|
||||
void on_InsideOut_toggled(bool val);
|
||||
void on_CutCells_toggled(bool val);
|
||||
|
||||
|
||||
private:
|
||||
void collectImplicitFunctions();
|
||||
|
||||
|
||||
App::PropertyLink* m_functionProperty;
|
||||
QWidget* proxy;
|
||||
Ui_TaskPostClip* ui;
|
||||
@@ -165,43 +165,43 @@ private:
|
||||
};
|
||||
|
||||
class TaskPostScalarClip : public TaskPostBox {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
TaskPostScalarClip(Gui::ViewProviderDocumentObject* view, QWidget* parent = 0);
|
||||
virtual ~TaskPostScalarClip();
|
||||
|
||||
|
||||
virtual void applyPythonCode();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_Slider_valueChanged(int v);
|
||||
void on_Value_valueChanged(double v);
|
||||
void on_Scalar_currentIndexChanged(int idx);
|
||||
void on_InsideOut_toggled(bool val);
|
||||
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
Ui_TaskPostScalarClip* ui;
|
||||
};
|
||||
|
||||
class TaskPostWarpVector : public TaskPostBox {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
TaskPostWarpVector(Gui::ViewProviderDocumentObject* view, QWidget* parent = 0);
|
||||
virtual ~TaskPostWarpVector();
|
||||
|
||||
|
||||
virtual void applyPythonCode();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_Slider_valueChanged(int v);
|
||||
void on_Value_valueChanged(double v);
|
||||
void on_Max_valueChanged(double v);
|
||||
void on_Min_valueChanged(double v);
|
||||
void on_Vector_currentIndexChanged(int idx);
|
||||
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
Ui_TaskPostWarpVector* ui;
|
||||
@@ -210,22 +210,22 @@ private:
|
||||
|
||||
|
||||
class TaskPostCut : public TaskPostBox {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
TaskPostCut(Gui::ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent = 0);
|
||||
virtual ~TaskPostCut();
|
||||
|
||||
|
||||
virtual void applyPythonCode();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_CreateButton_triggered(QAction* a);
|
||||
void on_FunctionBox_currentIndexChanged(int idx);
|
||||
|
||||
|
||||
private:
|
||||
void collectImplicitFunctions();
|
||||
|
||||
|
||||
App::PropertyLink* m_functionProperty;
|
||||
QWidget* proxy;
|
||||
Ui_TaskPostCut* ui;
|
||||
|
||||
@@ -111,7 +111,7 @@ void ViewProviderFemConstraintContact::updateData(const App::Property* prop)
|
||||
float scaledlength = LENGTH * pcConstraint->Scale.getValue(); //OvG: Calculate scaled values once only
|
||||
float scaledheight = HEIGHT * pcConstraint->Scale.getValue();
|
||||
float scaledwidth = WIDTH * pcConstraint->Scale.getValue();
|
||||
|
||||
|
||||
if (strcmp(prop->getName(),"Points") == 0) {
|
||||
const std::vector<Base::Vector3d>& points = pcConstraint->Points.getValues();
|
||||
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals.getValues();
|
||||
@@ -126,28 +126,28 @@ void ViewProviderFemConstraintContact::updateData(const App::Property* prop)
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
|
||||
///Visual indication
|
||||
//define separator
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
|
||||
|
||||
//first move to correct postion
|
||||
SoTranslation* trans = new SoTranslation();
|
||||
SbVec3f newPos=base+scaledheight*dir*0.12;
|
||||
trans->translation.setValue(newPos);
|
||||
sep->addChild(trans);
|
||||
|
||||
|
||||
//adjust orientation
|
||||
SoRotation* rot = new SoRotation();
|
||||
rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir));
|
||||
sep->addChild(rot);
|
||||
|
||||
|
||||
//define color of shape
|
||||
SoMaterial* myMaterial = new SoMaterial;
|
||||
myMaterial->diffuseColor.set1Value(0,SbColor(1,1,1));//RGB
|
||||
//myMaterial->diffuseColor.set1Value(1,SbColor(0,0,1));//possible to adjust sides separately
|
||||
sep->addChild(myMaterial);
|
||||
|
||||
|
||||
//draw a cube
|
||||
SoCube* cbe = new SoCube();
|
||||
cbe->depth.setValue(scaledlength*0.5);
|
||||
@@ -159,7 +159,7 @@ void ViewProviderFemConstraintContact::updateData(const App::Property* prop)
|
||||
trans2->translation.setValue(SbVec3f(0,0,0));
|
||||
sep->addChild(trans2);
|
||||
|
||||
|
||||
|
||||
pShapeSep->addChild(sep);
|
||||
n++;
|
||||
}
|
||||
|
||||
@@ -125,29 +125,29 @@ void ViewProviderFemConstraintHeatflux::updateData(const App::Property* prop)
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
|
||||
///Temperature indication
|
||||
//define separator
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
|
||||
|
||||
///draw a temp gauge,with sphere and a cylinder
|
||||
//first move to correct postion
|
||||
SoTranslation* trans = new SoTranslation();
|
||||
SbVec3f newPos=base+scaledradius*dir*0.7;
|
||||
trans->translation.setValue(newPos);
|
||||
sep->addChild(trans);
|
||||
|
||||
|
||||
//adjust orientation
|
||||
SoRotation* rot = new SoRotation();
|
||||
rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir));
|
||||
sep->addChild(rot);
|
||||
|
||||
|
||||
//define color of shape
|
||||
SoMaterial* myMaterial = new SoMaterial;
|
||||
myMaterial->diffuseColor.set1Value(0,SbColor(0.65,0.1,0.25));//RGB
|
||||
//myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides separately
|
||||
sep->addChild(myMaterial);
|
||||
|
||||
|
||||
//draw a sphere
|
||||
SoSphere* sph = new SoSphere();
|
||||
sph->radius.setValue(scaledradius*0.75);
|
||||
@@ -183,9 +183,9 @@ void ViewProviderFemConstraintHeatflux::updateData(const App::Property* prop)
|
||||
cyl3->height.setValue(scaledheight*0.05);
|
||||
cyl3->radius.setValue(scaledradius*1);
|
||||
sep->addChild(cyl3);
|
||||
|
||||
|
||||
pShapeSep->addChild(sep);
|
||||
|
||||
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,36 +124,36 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
|
||||
/* Note:
|
||||
* This next part draws a temperature gauge in 3D to indicate the constraint visually.
|
||||
* This serves as an example. Change or remove as needs be.
|
||||
* This serves as an example. Change or remove as needs be.
|
||||
* It is possible to draw almost any basic 3D shape. See inventor's documentation
|
||||
* This gets drawn at every point.
|
||||
* */
|
||||
|
||||
|
||||
///Visual indication
|
||||
//define separator
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
|
||||
|
||||
///draw a temp gauge,with sphere and a cylinder
|
||||
//first move to correct postion
|
||||
SoTranslation* trans = new SoTranslation();
|
||||
SbVec3f newPos=base+scaledradius*dir*0.08;
|
||||
trans->translation.setValue(newPos);
|
||||
sep->addChild(trans);
|
||||
|
||||
|
||||
//adjust orientation
|
||||
SoRotation* rot = new SoRotation();
|
||||
rot->rotation.setValue(SbRotation(SbVec3f(1,0,0),dir));
|
||||
sep->addChild(rot);
|
||||
|
||||
|
||||
//define color of shape
|
||||
SoMaterial* myMaterial = new SoMaterial;
|
||||
myMaterial->diffuseColor.set1Value(0,SbColor(0,1,0));//RGB
|
||||
//myMaterial->diffuseColor.set1Value(1,SbColor(0,0,1));//possible to adjust sides separately
|
||||
sep->addChild(myMaterial);
|
||||
|
||||
|
||||
//draw a sphere
|
||||
//SoSphere* sph = new SoSphere();
|
||||
//sph->radius.setValue(scaledradius*0.75);
|
||||
@@ -180,9 +180,9 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
|
||||
//cyl2->height.setValue(scaledheight*0.25);
|
||||
//cyl2->radius.setValue(scaledradius*0.375);
|
||||
//sep->addChild(cyl2);
|
||||
|
||||
|
||||
pShapeSep->addChild(sep);
|
||||
|
||||
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,29 +124,29 @@ void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop)
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
|
||||
///Temperature indication
|
||||
//define separator
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
|
||||
|
||||
///draw a temp gauge,with sphere and a cylinder
|
||||
//first move to correct postion
|
||||
SoTranslation* trans = new SoTranslation();
|
||||
SbVec3f newPos=base+scaledradius*dir*0.7;
|
||||
trans->translation.setValue(newPos);
|
||||
sep->addChild(trans);
|
||||
|
||||
|
||||
//adjust orientation
|
||||
SoRotation* rot = new SoRotation();
|
||||
rot->rotation.setValue(SbRotation(SbVec3f(0,1,0),dir));
|
||||
sep->addChild(rot);
|
||||
|
||||
|
||||
//define color of shape
|
||||
SoMaterial* myMaterial = new SoMaterial;
|
||||
myMaterial->diffuseColor.set1Value(0,SbColor(1,0,0));//RGB
|
||||
//myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides separately
|
||||
sep->addChild(myMaterial);
|
||||
|
||||
|
||||
//draw a sphere
|
||||
SoSphere* sph = new SoSphere();
|
||||
sph->radius.setValue(scaledradius*0.75);
|
||||
@@ -173,9 +173,9 @@ void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop)
|
||||
cyl2->height.setValue(scaledheight*0.25);
|
||||
cyl2->radius.setValue(scaledradius*0.375);
|
||||
sep->addChild(cyl2);
|
||||
|
||||
|
||||
pShapeSep->addChild(sep);
|
||||
|
||||
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ ViewProviderFemPostClip::~ViewProviderFemPostClip() {
|
||||
}
|
||||
|
||||
void ViewProviderFemPostClip::setupTaskDialog(TaskDlgPost* dlg) {
|
||||
|
||||
|
||||
//add the function box
|
||||
dlg->appendBox(new TaskPostClip(dlg->getView(),
|
||||
dlg->appendBox(new TaskPostClip(dlg->getView(),
|
||||
&static_cast<Fem::FemPostClipFilter*>(dlg->getView()->getObject())->Function));
|
||||
|
||||
|
||||
//add the display options
|
||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||
}
|
||||
@@ -64,10 +64,10 @@ ViewProviderFemPostScalarClip::~ViewProviderFemPostScalarClip() {
|
||||
}
|
||||
|
||||
void ViewProviderFemPostScalarClip::setupTaskDialog(TaskDlgPost* dlg) {
|
||||
|
||||
|
||||
//add the function box
|
||||
dlg->appendBox(new TaskPostScalarClip(dlg->getView()));
|
||||
|
||||
|
||||
//add the display options
|
||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||
}
|
||||
@@ -84,10 +84,10 @@ ViewProviderFemPostWarpVector::~ViewProviderFemPostWarpVector() {
|
||||
}
|
||||
|
||||
void ViewProviderFemPostWarpVector::setupTaskDialog(TaskDlgPost* dlg) {
|
||||
|
||||
|
||||
//add the function box
|
||||
dlg->appendBox(new TaskPostWarpVector(dlg->getView()));
|
||||
|
||||
|
||||
//add the display options
|
||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||
}
|
||||
@@ -105,11 +105,11 @@ ViewProviderFemPostCut::~ViewProviderFemPostCut() {
|
||||
}
|
||||
|
||||
void ViewProviderFemPostCut::setupTaskDialog(TaskDlgPost* dlg) {
|
||||
|
||||
|
||||
//add the function box
|
||||
dlg->appendBox(new TaskPostCut(dlg->getView(),
|
||||
dlg->appendBox(new TaskPostCut(dlg->getView(),
|
||||
&static_cast<Fem::FemPostCutFilter*>(dlg->getView()->getObject())->Function));
|
||||
|
||||
|
||||
//add the display options
|
||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ public:
|
||||
/// constructor.
|
||||
ViewProviderFemPostClip();
|
||||
~ViewProviderFemPostClip();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
};
|
||||
|
||||
class FemGuiExport ViewProviderFemPostScalarClip : public ViewProviderFemPostObject {
|
||||
@@ -50,9 +50,9 @@ public:
|
||||
/// constructor.
|
||||
ViewProviderFemPostScalarClip();
|
||||
~ViewProviderFemPostScalarClip();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
};
|
||||
|
||||
class FemGuiExport ViewProviderFemPostWarpVector : public ViewProviderFemPostObject {
|
||||
@@ -63,9 +63,9 @@ public:
|
||||
/// constructor.
|
||||
ViewProviderFemPostWarpVector();
|
||||
~ViewProviderFemPostWarpVector();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
};
|
||||
|
||||
class FemGuiExport ViewProviderFemPostCut : public ViewProviderFemPostObject {
|
||||
@@ -76,12 +76,12 @@ public:
|
||||
/// constructor.
|
||||
ViewProviderFemPostCut();
|
||||
~ViewProviderFemPostCut();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
};
|
||||
|
||||
} //namespace FemGui
|
||||
|
||||
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTFILTER_H
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTFILTER_H
|
||||
|
||||
@@ -93,7 +93,7 @@ ViewProviderFemPostFunctionProvider::~ViewProviderFemPostFunctionProvider() {
|
||||
}
|
||||
|
||||
std::vector< App::DocumentObject* > ViewProviderFemPostFunctionProvider::claimChildren(void) const {
|
||||
|
||||
|
||||
return static_cast<Fem::FemPostFunctionProvider*>(getObject())->Functions.getValues();
|
||||
}
|
||||
|
||||
@@ -103,15 +103,15 @@ std::vector< App::DocumentObject* > ViewProviderFemPostFunctionProvider::claimCh
|
||||
|
||||
void ViewProviderFemPostFunctionProvider::onChanged(const App::Property* prop) {
|
||||
Gui::ViewProviderDocumentObject::onChanged(prop);
|
||||
|
||||
|
||||
updateSize();
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop) {
|
||||
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||
|
||||
|
||||
if(strcmp(prop->getName(), "Functions") == 0) {
|
||||
updateSize();
|
||||
updateSize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ void ViewProviderFemPostFunctionProvider::updateSize() {
|
||||
|
||||
std::vector< App::DocumentObject* > vec = claimChildren();
|
||||
for(std::vector< App::DocumentObject* >::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
|
||||
|
||||
if(!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId()))
|
||||
continue;
|
||||
|
||||
|
||||
ViewProviderFemPostFunction* vp = static_cast<FemGui::ViewProviderFemPostFunction*>(Gui::Application::Instance->getViewProvider(*it));
|
||||
vp->AutoScaleFactorX.setValue(SizeX.getValue());
|
||||
vp->AutoScaleFactorY.setValue(SizeY.getValue());
|
||||
@@ -136,7 +136,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemPostFunction, Gui::ViewProviderDocumentOb
|
||||
|
||||
ViewProviderFemPostFunction::ViewProviderFemPostFunction() : m_autoscale(false), m_isDragging(false)
|
||||
{
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(AutoScaleFactorX, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor");
|
||||
ADD_PROPERTY_TYPE(AutoScaleFactorY, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor");
|
||||
ADD_PROPERTY_TYPE(AutoScaleFactorZ, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor");
|
||||
@@ -146,7 +146,7 @@ ViewProviderFemPostFunction::ViewProviderFemPostFunction() : m_autoscale(false),
|
||||
|
||||
m_transform = new SoTransform();
|
||||
m_transform->ref();
|
||||
|
||||
|
||||
m_scale = new SoScale();
|
||||
m_scale->ref();
|
||||
m_scale->scaleFactor = SbVec3f(1,1,1);
|
||||
@@ -163,25 +163,25 @@ ViewProviderFemPostFunction::~ViewProviderFemPostFunction()
|
||||
void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj)
|
||||
{
|
||||
ViewProviderDocumentObject::attach(pcObj);
|
||||
|
||||
// setup the graph for editing the function unit geometry
|
||||
|
||||
// setup the graph for editing the function unit geometry
|
||||
SoMaterial* color = new SoMaterial();
|
||||
color->diffuseColor.setValue(0,0,1);
|
||||
color->transparency.setValue(0.5);
|
||||
|
||||
|
||||
m_transform = new SoTransform;
|
||||
|
||||
|
||||
m_manip = setupManipulator();
|
||||
m_manip->ref();
|
||||
|
||||
|
||||
SoSeparator* pcEditNode = new SoSeparator();
|
||||
|
||||
|
||||
pcEditNode->addChild(color);
|
||||
pcEditNode->addChild(m_transform);
|
||||
pcEditNode->addChild(m_geometrySeperator);
|
||||
|
||||
pcEditNode->addChild(m_geometrySeperator);
|
||||
|
||||
m_geometrySeperator->insertChild(m_scale, 0);
|
||||
|
||||
|
||||
// Now we replace the SoTransform node by a manipulator
|
||||
// Note: Even SoCenterballManip inherits from SoTransform
|
||||
// we cannot use it directly (in above code) because the
|
||||
@@ -200,7 +200,7 @@ void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj)
|
||||
dragger->addFinishCallback(dragFinishCallback, this);
|
||||
dragger->addMotionCallback(dragMotionCallback, this);
|
||||
}
|
||||
|
||||
|
||||
addDisplayMaskMode(pcEditNode, "Default");
|
||||
setDisplayMaskMode("Default");
|
||||
}
|
||||
@@ -213,7 +213,7 @@ bool ViewProviderFemPostFunction::doubleClicked(void) {
|
||||
|
||||
SoTransformManip* ViewProviderFemPostFunction::setupManipulator() {
|
||||
|
||||
return new SoCenterballManip;
|
||||
return new SoCenterballManip;
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ void ViewProviderFemPostFunction::dragStartCallback(void *data, SoDragger *)
|
||||
// This is called when a manipulator is about to manipulating
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Edit Mirror");
|
||||
reinterpret_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = true;
|
||||
|
||||
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem");
|
||||
that->m_autoRecompute = hGrp->GetBool("PostAutoRecompute", false);
|
||||
@@ -239,11 +239,11 @@ void ViewProviderFemPostFunction::dragFinishCallback(void *data, SoDragger *)
|
||||
{
|
||||
// This is called when a manipulator has done manipulating
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
|
||||
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
if(that->m_autoRecompute)
|
||||
if(that->m_autoRecompute)
|
||||
that->getObject()->getDocument()->recompute();
|
||||
|
||||
|
||||
reinterpret_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = false;
|
||||
}
|
||||
|
||||
@@ -251,15 +251,15 @@ void ViewProviderFemPostFunction::dragMotionCallback(void *data, SoDragger *drag
|
||||
{
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
that->draggerUpdate(drag);
|
||||
|
||||
if(that->m_autoRecompute)
|
||||
|
||||
if(that->m_autoRecompute)
|
||||
that->getObject()->getDocument()->recompute();
|
||||
}
|
||||
|
||||
|
||||
bool ViewProviderFemPostFunction::setEdit(int ModNum) {
|
||||
|
||||
|
||||
|
||||
|
||||
if (ModNum == ViewProvider::Default || ModNum == 1 ) {
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
@@ -296,7 +296,7 @@ bool ViewProviderFemPostFunction::setEdit(int ModNum) {
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::unsetEdit(int ModNum) {
|
||||
|
||||
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
@@ -307,9 +307,9 @@ void ViewProviderFemPostFunction::unsetEdit(int ModNum) {
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::onChanged(const App::Property* prop) {
|
||||
|
||||
|
||||
Gui::ViewProviderDocumentObject::onChanged(prop);
|
||||
|
||||
|
||||
if(m_autoscale)
|
||||
m_scale->scaleFactor = SbVec3f(AutoScaleFactorX.getValue(), AutoScaleFactorY.getValue(), AutoScaleFactorZ.getValue());
|
||||
}
|
||||
@@ -323,9 +323,9 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemPostPlaneFunction, FemGui::ViewProviderFe
|
||||
ViewProviderFemPostPlaneFunction::ViewProviderFemPostPlaneFunction() {
|
||||
|
||||
sPixmap = "fem-plane";
|
||||
|
||||
|
||||
setAutoScale(true);
|
||||
|
||||
|
||||
//setup the visualisation geometry
|
||||
SoCoordinate3* points = new SoCoordinate3();
|
||||
points->point.setNum(4);
|
||||
@@ -347,16 +347,16 @@ void ViewProviderFemPostPlaneFunction::draggerUpdate(SoDragger* m) {
|
||||
|
||||
Fem::FemPostPlaneFunction* func = static_cast<Fem::FemPostPlaneFunction*>(getObject());
|
||||
SoCenterballDragger* dragger = static_cast<SoCenterballDragger*>(m);
|
||||
|
||||
|
||||
// the new axis of the plane
|
||||
SbRotation rot, scaleDir;
|
||||
const SbVec3f& center = dragger->center.getValue();
|
||||
|
||||
|
||||
SbVec3f norm(0,0,1);
|
||||
dragger->rotation.getValue().multVec(norm,norm);
|
||||
func->Origin.setValue(center[0], center[1], center[2]);
|
||||
func->Normal.setValue(norm[0],norm[1],norm[2]);
|
||||
|
||||
|
||||
SbVec3f t = static_cast<SoCenterballManip*>(getManipulator())->translation.getValue();
|
||||
SbVec3f rt, irt;
|
||||
dragger->rotation.getValue().multVec(t,rt);
|
||||
@@ -364,17 +364,17 @@ void ViewProviderFemPostPlaneFunction::draggerUpdate(SoDragger* m) {
|
||||
}
|
||||
|
||||
void ViewProviderFemPostPlaneFunction::updateData(const App::Property* p) {
|
||||
|
||||
|
||||
Fem::FemPostPlaneFunction* func = static_cast<Fem::FemPostPlaneFunction*>(getObject());
|
||||
|
||||
|
||||
if(!isDragging() && (p == &func->Origin || p == &func->Normal)) {
|
||||
|
||||
|
||||
Base::Vector3d trans = func->Origin.getValue();
|
||||
Base::Vector3d norm = func->Normal.getValue();
|
||||
|
||||
|
||||
norm = norm / norm.Length();
|
||||
SbRotation rot(SbVec3f(0.,0.,1.), SbVec3f(norm.x, norm.y, norm.z));
|
||||
|
||||
|
||||
SbMatrix t, translate;
|
||||
t.setRotate(rot);
|
||||
translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z));
|
||||
@@ -394,7 +394,7 @@ PlaneWidget::PlaneWidget() {
|
||||
|
||||
ui = new Ui_PlaneWidget();
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
connect(ui->originX, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double)));
|
||||
connect(ui->originY, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double)));
|
||||
connect(ui->originZ, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double)));
|
||||
@@ -413,7 +413,7 @@ void PlaneWidget::applyPythonCode() {
|
||||
}
|
||||
|
||||
void PlaneWidget::setViewProvider(ViewProviderFemPostFunction* view) {
|
||||
|
||||
|
||||
FemGui::FunctionWidget::setViewProvider(view);
|
||||
onChange(static_cast<Fem::FemPostPlaneFunction*>(getObject())->Normal);
|
||||
onChange(static_cast<Fem::FemPostPlaneFunction*>(getObject())->Origin);
|
||||
@@ -462,30 +462,30 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemPostSphereFunction, FemGui::ViewProviderF
|
||||
ViewProviderFemPostSphereFunction::ViewProviderFemPostSphereFunction() {
|
||||
|
||||
sPixmap = "fem-sphere";
|
||||
|
||||
|
||||
setAutoScale(false);
|
||||
|
||||
|
||||
//setup the visualisation geometry
|
||||
SoCoordinate3* points = new SoCoordinate3();
|
||||
points->point.setNum(2*84);
|
||||
int idx = 0;
|
||||
for(int i=0; i<4; i++) {
|
||||
for(int i=0; i<4; i++) {
|
||||
for(int j=0; j<21; j++) {
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(2*M_PI/20*j) * std::cos(M_PI/4*i),
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(2*M_PI/20*j) * std::cos(M_PI/4*i),
|
||||
std::sin(2*M_PI/20*j) * std::sin(M_PI/4*i),
|
||||
std::cos(2*M_PI/20*j) ));
|
||||
std::cos(2*M_PI/20*j) ));
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
for(int i=0; i<4; i++) {
|
||||
for(int i=0; i<4; i++) {
|
||||
for(int j=0; j<21; j++) {
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(M_PI/4*i) * std::cos(2*M_PI/20*j),
|
||||
points->point.set1Value(idx, SbVec3f(std::sin(M_PI/4*i) * std::cos(2*M_PI/20*j),
|
||||
std::sin(M_PI/4*i) * std::sin(2*M_PI/20*j),
|
||||
std::cos(M_PI/4*i) ));
|
||||
std::cos(M_PI/4*i) ));
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SoLineSet* line = new SoLineSet();
|
||||
getGeometryNode()->addChild(points);
|
||||
getGeometryNode()->addChild(line);
|
||||
@@ -508,7 +508,7 @@ SoTransformManip* ViewProviderFemPostSphereFunction::setupManipulator() {
|
||||
manip->getDragger()->setPart("extruder4Active", new SoSeparator);
|
||||
manip->getDragger()->setPart("extruder5Active", new SoSeparator);
|
||||
manip->getDragger()->setPart("extruder6Active", new SoSeparator);
|
||||
|
||||
|
||||
return manip;
|
||||
}
|
||||
|
||||
@@ -517,25 +517,25 @@ void ViewProviderFemPostSphereFunction::draggerUpdate(SoDragger* m) {
|
||||
|
||||
Fem::FemPostSphereFunction* func = static_cast<Fem::FemPostSphereFunction*>(getObject());
|
||||
SoHandleBoxDragger* dragger = static_cast<SoHandleBoxDragger*>(m);
|
||||
|
||||
|
||||
// the new axis of the plane
|
||||
SbRotation rot, scaleDir;
|
||||
const SbVec3f& center = dragger->translation.getValue();
|
||||
|
||||
|
||||
SbVec3f norm(0,0,1);
|
||||
func->Center.setValue(center[0], center[1], center[2]);
|
||||
func->Radius.setValue(dragger->scaleFactor.getValue()[0]);
|
||||
}
|
||||
|
||||
void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) {
|
||||
|
||||
|
||||
Fem::FemPostSphereFunction* func = static_cast<Fem::FemPostSphereFunction*>(getObject());
|
||||
|
||||
|
||||
if(!isDragging() && (p == &func->Center || p == &func->Radius)) {
|
||||
|
||||
|
||||
Base::Vector3d trans = func->Center.getValue();
|
||||
double radius = func->Radius.getValue();
|
||||
|
||||
|
||||
SbMatrix t, translate;
|
||||
t.setScale(radius);
|
||||
translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z));
|
||||
@@ -556,7 +556,7 @@ SphereWidget::SphereWidget() {
|
||||
|
||||
ui = new Ui_SphereWidget();
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
connect(ui->centerX, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
|
||||
connect(ui->centerY, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
|
||||
connect(ui->centerZ, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
|
||||
@@ -572,7 +572,7 @@ void SphereWidget::applyPythonCode() {
|
||||
}
|
||||
|
||||
void SphereWidget::setViewProvider(ViewProviderFemPostFunction* view) {
|
||||
|
||||
|
||||
FemGui::FunctionWidget::setViewProvider(view);
|
||||
onChange(static_cast<Fem::FemPostSphereFunction*>(getObject())->Center);
|
||||
onChange(static_cast<Fem::FemPostSphereFunction*>(getObject())->Radius);
|
||||
@@ -609,4 +609,4 @@ void SphereWidget::radiusChanged(double val) {
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_ViewProviderFemPostFunction.cpp"
|
||||
#include "moc_ViewProviderFemPostFunction.cpp"
|
||||
|
||||
@@ -65,52 +65,52 @@ namespace FemGui
|
||||
{
|
||||
|
||||
class ViewProviderFemPostFunction;
|
||||
|
||||
|
||||
class FemGuiExport FunctionWidget : public QWidget {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
FunctionWidget() {};
|
||||
virtual ~FunctionWidget() {};
|
||||
|
||||
|
||||
virtual void applyPythonCode() = 0;
|
||||
virtual void setViewProvider(ViewProviderFemPostFunction* view);
|
||||
void onObjectsChanged(const App::DocumentObject& obj, const App::Property&);
|
||||
|
||||
void onObjectsChanged(const App::DocumentObject& obj, const App::Property&);
|
||||
|
||||
protected:
|
||||
ViewProviderFemPostFunction* getView() {return m_view;};
|
||||
Fem::FemPostFunction* getObject(){return m_object;};
|
||||
|
||||
|
||||
bool blockObjectUpdates() {return m_block;};
|
||||
void setBlockObjectUpdates(bool val) {m_block = val;};
|
||||
|
||||
void setBlockObjectUpdates(bool val) {m_block = val;};
|
||||
|
||||
virtual void onChange(const App::Property& p) = 0;
|
||||
|
||||
|
||||
private:
|
||||
bool m_block;
|
||||
ViewProviderFemPostFunction* m_view;
|
||||
Fem::FemPostFunction* m_object;
|
||||
boost::signalslib::scoped_connection m_connection;
|
||||
boost::signalslib::scoped_connection m_connection;
|
||||
};
|
||||
|
||||
|
||||
class FemGuiExport ViewProviderFemPostFunctionProvider : public Gui::ViewProviderDocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(FemGui::ViewProviderFemPostFunction);
|
||||
|
||||
public:
|
||||
public:
|
||||
ViewProviderFemPostFunctionProvider();
|
||||
virtual ~ViewProviderFemPostFunctionProvider();
|
||||
|
||||
App::PropertyFloat SizeX;
|
||||
App::PropertyFloat SizeY;
|
||||
App::PropertyFloat SizeZ;
|
||||
|
||||
|
||||
protected:
|
||||
virtual std::vector< App::DocumentObject* > claimChildren(void) const;
|
||||
virtual std::vector< App::DocumentObject* > claimChildren3D(void) const;
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
virtual void updateData(const App::Property*);
|
||||
|
||||
|
||||
void updateSize();
|
||||
};
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
/// constructor.
|
||||
ViewProviderFemPostFunction();
|
||||
~ViewProviderFemPostFunction();
|
||||
|
||||
|
||||
App::PropertyFloat AutoScaleFactorX;
|
||||
App::PropertyFloat AutoScaleFactorY;
|
||||
App::PropertyFloat AutoScaleFactorZ;
|
||||
@@ -130,33 +130,33 @@ public:
|
||||
void attach(App::DocumentObject *pcObject);
|
||||
bool doubleClicked(void);
|
||||
std::vector<std::string> getDisplayModes() const;
|
||||
|
||||
//creates the widget used in the task dalogs, either for the function itself or for
|
||||
|
||||
//creates the widget used in the task dalogs, either for the function itself or for
|
||||
//the fiter using it
|
||||
virtual FunctionWidget* createControlWidget() {return NULL;};
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual bool setEdit(int ModNum);
|
||||
virtual void unsetEdit(int ModNum);
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
|
||||
void setAutoScale(bool value) {m_autoscale = value;};
|
||||
bool autoScale() {return m_autoscale;};
|
||||
|
||||
|
||||
bool isDragging() {return m_isDragging;};
|
||||
|
||||
|
||||
virtual SoTransformManip* setupManipulator();
|
||||
virtual void draggerUpdate(SoDragger* m) {};
|
||||
SoTransformManip* getManipulator() {return m_manip;};
|
||||
SoSeparator* getGeometryNode() {return m_geometrySeperator;};
|
||||
SoScale* getScaleNode() {return m_scale;};
|
||||
SoTransform* getTransformNode() {return m_transform;};
|
||||
|
||||
|
||||
private:
|
||||
static void dragStartCallback(void * data, SoDragger * d);
|
||||
static void dragFinishCallback(void * data, SoDragger * d);
|
||||
static void dragMotionCallback(void * data, SoDragger * d);
|
||||
|
||||
|
||||
SoSeparator* m_geometrySeperator;
|
||||
SoTransformManip* m_manip;
|
||||
SoScale* m_scale;
|
||||
@@ -167,7 +167,7 @@ private:
|
||||
//###############################################################################################
|
||||
|
||||
class FemGuiExport PlaneWidget : public FunctionWidget {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
PlaneWidget();
|
||||
@@ -180,21 +180,21 @@ public:
|
||||
private Q_SLOTS:
|
||||
void originChanged(double val);
|
||||
void normalChanged(double val);
|
||||
|
||||
|
||||
private:
|
||||
Ui_PlaneWidget* ui;
|
||||
};
|
||||
|
||||
class FemGuiExport ViewProviderFemPostPlaneFunction : public ViewProviderFemPostFunction {
|
||||
|
||||
|
||||
PROPERTY_HEADER(FemGui::ViewProviderFemPostPlaneFunction);
|
||||
|
||||
|
||||
public:
|
||||
ViewProviderFemPostPlaneFunction();
|
||||
ViewProviderFemPostPlaneFunction();
|
||||
virtual ~ViewProviderFemPostPlaneFunction();
|
||||
|
||||
|
||||
virtual FunctionWidget* createControlWidget();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void draggerUpdate(SoDragger* mat);
|
||||
virtual void updateData(const App::Property*);
|
||||
@@ -203,7 +203,7 @@ protected:
|
||||
//###############################################################################################
|
||||
|
||||
class FemGuiExport SphereWidget : public FunctionWidget {
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
SphereWidget();
|
||||
@@ -216,22 +216,22 @@ public:
|
||||
private Q_SLOTS:
|
||||
void centerChanged(double val);
|
||||
void radiusChanged(double val);
|
||||
|
||||
|
||||
private:
|
||||
Ui_SphereWidget* ui;
|
||||
};
|
||||
|
||||
class FemGuiExport ViewProviderFemPostSphereFunction : public ViewProviderFemPostFunction {
|
||||
|
||||
|
||||
PROPERTY_HEADER(FemGui::ViewProviderFemPostSphereFunction);
|
||||
|
||||
|
||||
public:
|
||||
ViewProviderFemPostSphereFunction();
|
||||
ViewProviderFemPostSphereFunction();
|
||||
virtual ~ViewProviderFemPostSphereFunction();
|
||||
|
||||
|
||||
virtual SoTransformManip* setupManipulator();
|
||||
virtual FunctionWidget* createControlWidget();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void draggerUpdate(SoDragger* mat);
|
||||
virtual void updateData(const App::Property*);
|
||||
@@ -240,4 +240,4 @@ protected:
|
||||
} //namespace FemGui
|
||||
|
||||
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTFUNCTION_H
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTFUNCTION_H
|
||||
|
||||
@@ -75,7 +75,7 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() : m_blockPropertyChanges(
|
||||
m_coordinates = new SoCoordinate3();
|
||||
m_coordinates->ref();
|
||||
m_materialBinding = new SoMaterialBinding();
|
||||
m_materialBinding->ref();
|
||||
m_materialBinding->ref();
|
||||
m_material = new SoMaterial();
|
||||
m_material->ref();
|
||||
m_normalBinding = new SoNormalBinding();
|
||||
@@ -100,7 +100,7 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() : m_blockPropertyChanges(
|
||||
// simple color bar
|
||||
m_colorRoot = new SoSeparator();
|
||||
m_colorRoot->ref();
|
||||
m_colorStyle = new SoDrawStyle();
|
||||
m_colorStyle = new SoDrawStyle();
|
||||
m_colorStyle->ref();
|
||||
m_colorRoot->addChild(m_colorStyle);
|
||||
m_colorBar = new Gui::SoFCColorBar;
|
||||
@@ -127,7 +127,7 @@ ViewProviderFemPostObject::~ViewProviderFemPostObject()
|
||||
{
|
||||
m_shapeHints->unref();
|
||||
m_coordinates->unref();
|
||||
m_materialBinding->unref();
|
||||
m_materialBinding->unref();
|
||||
m_drawStyle->unref();
|
||||
m_normalBinding->unref();
|
||||
m_normals->unref();
|
||||
@@ -175,11 +175,11 @@ void ViewProviderFemPostObject::attach(App::DocumentObject *pcObj)
|
||||
|
||||
m_colorRoot->addChild(m_colorBar);
|
||||
|
||||
//all
|
||||
//all
|
||||
addDisplayMaskMode(m_seperator, "Default");
|
||||
setDisplayMaskMode("Default");
|
||||
|
||||
setupPipeline();
|
||||
|
||||
setupPipeline();
|
||||
}
|
||||
|
||||
SoSeparator* ViewProviderFemPostObject::getFrontRoot(void) const {
|
||||
@@ -227,7 +227,7 @@ void ViewProviderFemPostObject::update() {
|
||||
|
||||
if(!setupPipeline())
|
||||
return;
|
||||
|
||||
|
||||
m_currentAlgorithm->Update();
|
||||
updateProperties();
|
||||
update3D();
|
||||
@@ -236,18 +236,18 @@ void ViewProviderFemPostObject::update() {
|
||||
void ViewProviderFemPostObject::updateProperties() {
|
||||
|
||||
m_blockPropertyChanges = true;
|
||||
vtkPolyData* poly = m_currentAlgorithm->GetOutput();
|
||||
vtkPolyData* poly = m_currentAlgorithm->GetOutput();
|
||||
|
||||
//coloring
|
||||
std::string val;
|
||||
if(Field.getEnums() && Field.getValue() >= 0)
|
||||
val = Field.getValueAsString();
|
||||
|
||||
|
||||
std::vector<std::string> colorArrays;
|
||||
colorArrays.push_back("None");
|
||||
|
||||
|
||||
vtkPointData* point = poly->GetPointData();
|
||||
for(int i=0; i<point->GetNumberOfArrays(); ++i)
|
||||
for(int i=0; i<point->GetNumberOfArrays(); ++i)
|
||||
colorArrays.push_back(point->GetArrayName(i));
|
||||
|
||||
vtkCellData* cell = poly->GetCellData();
|
||||
@@ -270,11 +270,11 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
val = VectorMode.getValueAsString();
|
||||
|
||||
colorArrays.clear();
|
||||
if(Field.getValue() == 0)
|
||||
if(Field.getValue() == 0)
|
||||
colorArrays.push_back("Not a vector");
|
||||
else {
|
||||
int array = Field.getValue() - 1; //0 is none
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
int array = Field.getValue() - 1; //0 is none
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkDataArray* data = pd->GetPointData()->GetArray(array);
|
||||
|
||||
if(data->GetNumberOfComponents() == 1)
|
||||
@@ -292,7 +292,7 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
|
||||
VectorMode.setValue(empty);
|
||||
m_vectorEnum.setEnums(colorArrays);
|
||||
VectorMode.setValue(m_vectorEnum);
|
||||
VectorMode.setValue(m_vectorEnum);
|
||||
|
||||
it = std::find(colorArrays.begin(), colorArrays.end(), val);
|
||||
if(!val.empty() && it != colorArrays.end())
|
||||
@@ -303,7 +303,7 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
|
||||
void ViewProviderFemPostObject::update3D() {
|
||||
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
|
||||
vtkPointData *pntData;
|
||||
vtkPoints *points;
|
||||
@@ -312,7 +312,7 @@ void ViewProviderFemPostObject::update3D() {
|
||||
vtkCellArray *cells;
|
||||
vtkIdType npts = 0;
|
||||
vtkIdType *indx = 0;
|
||||
|
||||
|
||||
points = pd->GetPoints();
|
||||
pntData = pd->GetPointData();
|
||||
normals = pntData->GetNormals();
|
||||
@@ -359,7 +359,7 @@ void ViewProviderFemPostObject::update3D() {
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, -1);
|
||||
++soidx;
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.setNum(soidx);
|
||||
m_triangleStrips->coordIndex.finishEditing();
|
||||
@@ -379,12 +379,12 @@ void ViewProviderFemPostObject::update3D() {
|
||||
++soidx;
|
||||
}
|
||||
m_lines->coordIndex.set1Value(soidx, -1);
|
||||
++soidx;
|
||||
++soidx;
|
||||
}
|
||||
m_lines->coordIndex.setNum(soidx);
|
||||
m_lines->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
else
|
||||
m_lines->coordIndex.setNum(0);
|
||||
|
||||
// write out verts if any
|
||||
@@ -447,7 +447,7 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
m_material->diffuseColor.setValue(SbColor(0.8,0.8,0.8));
|
||||
m_material->transparency.setValue(0.);
|
||||
m_materialBinding->value = SoMaterialBinding::OVERALL;
|
||||
m_materialBinding->touch();
|
||||
m_materialBinding->touch();
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -485,7 +485,7 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
}
|
||||
m_material->diffuseColor.finishEditing();
|
||||
m_materialBinding->value = SoMaterialBinding::PER_VERTEX_INDEXED;
|
||||
m_materialBinding->touch();
|
||||
m_materialBinding->touch();
|
||||
}
|
||||
|
||||
void ViewProviderFemPostObject::WriteTransperency() {
|
||||
@@ -530,7 +530,7 @@ void ViewProviderFemPostObject::onChanged(const App::Property* prop) {
|
||||
updateProperties();
|
||||
WriteColorData(ResetColorBarRange);
|
||||
WriteTransperency();
|
||||
}
|
||||
}
|
||||
else if(prop == &VectorMode && setupPipeline()) {
|
||||
WriteColorData(ResetColorBarRange);
|
||||
WriteTransperency();
|
||||
|
||||
@@ -52,9 +52,9 @@ class SoIndexedFaceSet;
|
||||
class SoIndexedLineSet;
|
||||
class SoIndexedMarkerSet;
|
||||
class SoCoordinate3;
|
||||
class SoDrawStyle;
|
||||
class SoIndexedFaceSet;
|
||||
class SoIndexedLineSet;
|
||||
class SoDrawStyle;
|
||||
class SoIndexedFaceSet;
|
||||
class SoIndexedLineSet;
|
||||
class SoIndexedTriangleStripSet;
|
||||
|
||||
namespace Gui {
|
||||
@@ -66,7 +66,7 @@ namespace FemGui
|
||||
|
||||
class TaskDlgPost;
|
||||
|
||||
class FemGuiExport ViewProviderFemPostObject : public Gui::ViewProviderDocumentObject,
|
||||
class FemGuiExport ViewProviderFemPostObject : public Gui::ViewProviderDocumentObject,
|
||||
public Base::Observer<int>
|
||||
{
|
||||
PROPERTY_HEADER(FemGui::ViewProviderFemPostObject);
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
|
||||
/// destructor.
|
||||
~ViewProviderFemPostObject();
|
||||
|
||||
|
||||
App::PropertyEnumeration Field;
|
||||
App::PropertyEnumeration VectorMode;
|
||||
App::PropertyPercent Transperency;
|
||||
@@ -87,24 +87,24 @@ public:
|
||||
std::vector<std::string> getDisplayModes() const;
|
||||
void updateData(const App::Property*);
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
|
||||
//edit handling
|
||||
virtual bool doubleClicked(void);
|
||||
virtual bool setEdit(int ModNum);
|
||||
virtual void unsetEdit(int ModNum);
|
||||
|
||||
|
||||
virtual void hide(void);
|
||||
virtual void show(void);
|
||||
|
||||
|
||||
virtual SoSeparator* getFrontRoot(void) const;
|
||||
|
||||
|
||||
//observer for the color bar
|
||||
virtual void OnChange(Base::Subject< int >& rCaller, int rcReason);
|
||||
|
||||
|
||||
/** @name Selection handling
|
||||
* This group of methodes do the selection handling.
|
||||
* Here you can define how the selection for your ViewProvider
|
||||
* works.
|
||||
* works.
|
||||
*/
|
||||
//@{
|
||||
// /// indicates if the ViewProvider use the new Selection model
|
||||
@@ -116,15 +116,15 @@ public:
|
||||
// virtual std::vector<Base::Vector3d> getSelectionShape(const char* Element) const;
|
||||
// //@}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||
bool setupPipeline();
|
||||
void update();
|
||||
|
||||
|
||||
SoCoordinate3* m_coordinates;
|
||||
SoIndexedPointSet* m_markers;
|
||||
SoIndexedLineSet* m_lines;
|
||||
SoIndexedFaceSet* m_faces;
|
||||
SoIndexedFaceSet* m_faces;
|
||||
SoIndexedTriangleStripSet* m_triangleStrips;
|
||||
SoMaterial* m_material;
|
||||
SoMaterialBinding* m_materialBinding;
|
||||
@@ -143,7 +143,7 @@ protected:
|
||||
vtkSmartPointer<vtkOutlineCornerFilter> m_outline;
|
||||
vtkSmartPointer<vtkExtractEdges> m_wireframe, m_wireframeSurface;
|
||||
vtkSmartPointer<vtkVertexGlyphFilter> m_points, m_pointsSurface;
|
||||
|
||||
|
||||
private:
|
||||
void updateProperties();
|
||||
void update3D();
|
||||
@@ -151,12 +151,12 @@ private:
|
||||
vtkDataArray *tcoords);
|
||||
void WriteColorData(bool ResetColorBarRange);
|
||||
void WriteTransperency();
|
||||
|
||||
App::Enumeration m_coloringEnum, m_vectorEnum;
|
||||
|
||||
App::Enumeration m_coloringEnum, m_vectorEnum;
|
||||
bool m_blockPropertyChanges;
|
||||
};
|
||||
|
||||
} //namespace FemGui
|
||||
|
||||
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTOBJECT_H
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTOBJECT_H
|
||||
|
||||
@@ -46,11 +46,11 @@ std::vector< App::DocumentObject* > ViewProviderFemPostPipeline::claimChildren(v
|
||||
|
||||
Fem::FemPostPipeline* pipeline = static_cast<Fem::FemPostPipeline*>(getObject());
|
||||
std::vector<App::DocumentObject*> children;
|
||||
|
||||
|
||||
if(pipeline->Functions.getValue())
|
||||
children.push_back(pipeline->Functions.getValue());
|
||||
|
||||
children.insert(children.end(), pipeline->Filter.getValues().begin(), pipeline->Filter.getValues().end());
|
||||
|
||||
children.insert(children.end(), pipeline->Filter.getValues().begin(), pipeline->Filter.getValues().end());
|
||||
return children;
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ std::vector< App::DocumentObject* > ViewProviderFemPostPipeline::claimChildren3D
|
||||
|
||||
void ViewProviderFemPostPipeline::updateData(const App::Property* prop) {
|
||||
FemGui::ViewProviderFemPostObject::onChanged(prop);
|
||||
|
||||
|
||||
if(strcmp(prop->getName(), "Function") == 0) {
|
||||
updateFunctionSize();
|
||||
updateFunctionSize();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,17 +72,17 @@ void ViewProviderFemPostPipeline::updateFunctionSize() {
|
||||
|
||||
//we need to get the bounding box and set the function provider size
|
||||
Fem::FemPostPipeline* obj = static_cast<Fem::FemPostPipeline*>(getObject());
|
||||
|
||||
|
||||
if(!obj->Functions.getValue() || !obj->Functions.getValue()->isDerivedFrom(Fem::FemPostFunctionProvider::getClassTypeId()))
|
||||
return;
|
||||
|
||||
//get the functtion provider
|
||||
|
||||
//get the functtion provider
|
||||
FemGui::ViewProviderFemPostFunctionProvider* vp = static_cast<FemGui::ViewProviderFemPostFunctionProvider*>(
|
||||
Gui::Application::Instance->getViewProvider(obj->Functions.getValue()));
|
||||
|
||||
|
||||
if(obj->Data.getValue() && obj->Data.getValue()->IsA("vtkDataSet")) {
|
||||
vtkBoundingBox box = obj->getBoundingBox();
|
||||
|
||||
|
||||
vp->SizeX.setValue(box.GetLength(0)*1.2);
|
||||
vp->SizeY.setValue(box.GetLength(1)*1.2);
|
||||
vp->SizeZ.setValue(box.GetLength(2)*1.2);
|
||||
|
||||
@@ -37,11 +37,11 @@ public:
|
||||
/// constructor.
|
||||
ViewProviderFemPostPipeline();
|
||||
~ViewProviderFemPostPipeline();
|
||||
|
||||
|
||||
virtual std::vector< App::DocumentObject* > claimChildren(void) const;
|
||||
virtual std::vector< App::DocumentObject* > claimChildren3D(void) const;
|
||||
virtual void updateData(const App::Property* prop);
|
||||
|
||||
|
||||
protected:
|
||||
void updateFunctionSize();
|
||||
|
||||
@@ -50,4 +50,4 @@ protected:
|
||||
} //namespace FemGui
|
||||
|
||||
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTPIPELINE_H
|
||||
#endif // FEM_VIEWPROVIDERFEMPOSTPIPELINE_H
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
// shows solid in the tree
|
||||
virtual bool isShow(void) const
|
||||
{ return true; }
|
||||
|
||||
|
||||
bool doubleClicked(void);
|
||||
};
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "Separator"
|
||||
<< "Fem_PurgeResults"
|
||||
<< "Fem_ShowResult";
|
||||
|
||||
|
||||
#ifdef FC_USE_VTK
|
||||
Gui::ToolBarItem* post = new Gui::ToolBarItem(root);
|
||||
post->setCommand("Post Processing");
|
||||
@@ -101,7 +101,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "Separator"
|
||||
<< "Fem_PostCreateFunctions";
|
||||
#endif
|
||||
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user