[FEM] post object: some whitespace and style fixes
all made by MSVC
This commit is contained in:
@@ -64,9 +64,9 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemPostObject, Gui::ViewProviderDocumentObje
|
||||
|
||||
ViewProviderFemPostObject::ViewProviderFemPostObject() : m_blockPropertyChanges(false)
|
||||
{
|
||||
//initialize the properties
|
||||
ADD_PROPERTY_TYPE(Field,((long)0), "Coloring", App::Prop_None, "Select the field used for calculating the color");
|
||||
ADD_PROPERTY_TYPE(VectorMode,((long)0), "Coloring", App::Prop_None, "Select what to show for a vector field");
|
||||
//initialize the properties
|
||||
ADD_PROPERTY_TYPE(Field, ((long)0), "Coloring", App::Prop_None, "Select the field used for calculating the color");
|
||||
ADD_PROPERTY_TYPE(VectorMode, ((long)0), "Coloring", App::Prop_None, "Select what to show for a vector field");
|
||||
ADD_PROPERTY(Transparency, (0));
|
||||
ADD_PROPERTY(Scale, (1.0));
|
||||
|
||||
@@ -113,7 +113,7 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() : m_blockPropertyChanges(
|
||||
m_colorBar->ref();
|
||||
|
||||
//create the vtk algorithms we use for visualisation
|
||||
m_outline = vtkSmartPointer<vtkOutlineCornerFilter>::New();
|
||||
m_outline = vtkSmartPointer<vtkOutlineCornerFilter>::New();
|
||||
m_points = vtkSmartPointer<vtkVertexGlyphFilter>::New();
|
||||
m_pointsSurface = vtkSmartPointer<vtkVertexGlyphFilter>::New();
|
||||
m_surface = vtkSmartPointer<vtkGeometryFilter>::New();
|
||||
@@ -150,7 +150,7 @@ ViewProviderFemPostObject::~ViewProviderFemPostObject()
|
||||
m_colorRoot->unref();
|
||||
}
|
||||
|
||||
void ViewProviderFemPostObject::attach(App::DocumentObject *pcObj)
|
||||
void ViewProviderFemPostObject::attach(App::DocumentObject* pcObj)
|
||||
{
|
||||
ViewProviderDocumentObject::attach(pcObj);
|
||||
|
||||
@@ -165,8 +165,8 @@ void ViewProviderFemPostObject::attach(App::DocumentObject *pcObj)
|
||||
m_seperator->addChild(m_faces);
|
||||
|
||||
// Check for an already existing color bar
|
||||
Gui::SoFCColorBar* pcBar = ((Gui::SoFCColorBar*)findFrontRootOfType( Gui::SoFCColorBar::getClassTypeId() ));
|
||||
if ( pcBar ) {
|
||||
Gui::SoFCColorBar* pcBar = ((Gui::SoFCColorBar*)findFrontRootOfType(Gui::SoFCColorBar::getClassTypeId()));
|
||||
if (pcBar) {
|
||||
float fMin = m_colorBar->getMinValue();
|
||||
float fMax = m_colorBar->getMaxValue();
|
||||
|
||||
@@ -197,24 +197,24 @@ SoSeparator* ViewProviderFemPostObject::getFrontRoot(void) const {
|
||||
|
||||
void ViewProviderFemPostObject::setDisplayMode(const char* ModeName)
|
||||
{
|
||||
if (strcmp("Outline",ModeName)==0)
|
||||
if (strcmp("Outline", ModeName) == 0)
|
||||
m_currentAlgorithm = m_outline;
|
||||
else if (strcmp("Surface with Edges",ModeName)==0)
|
||||
else if (strcmp("Surface with Edges", ModeName) == 0)
|
||||
m_currentAlgorithm = m_surfaceEdges;
|
||||
else if (strcmp("Surface",ModeName)==0)
|
||||
else if (strcmp("Surface", ModeName) == 0)
|
||||
m_currentAlgorithm = m_surface;
|
||||
else if (strcmp("Wireframe",ModeName)==0)
|
||||
else if (strcmp("Wireframe", ModeName) == 0)
|
||||
m_currentAlgorithm = m_wireframe;
|
||||
else if (strcmp("Wireframe (surface only)",ModeName)==0)
|
||||
else if (strcmp("Wireframe (surface only)", ModeName) == 0)
|
||||
m_currentAlgorithm = m_wireframeSurface;
|
||||
else if (strcmp("Nodes",ModeName)==0)
|
||||
else if (strcmp("Nodes", ModeName) == 0)
|
||||
m_currentAlgorithm = m_points;
|
||||
else if (strcmp("Nodes (surface only)",ModeName)==0)
|
||||
else if (strcmp("Nodes (surface only)", ModeName) == 0)
|
||||
m_currentAlgorithm = m_pointsSurface;
|
||||
|
||||
updateVtk();
|
||||
|
||||
ViewProviderDocumentObject::setDisplayMode( ModeName );
|
||||
ViewProviderDocumentObject::setDisplayMode(ModeName);
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderFemPostObject::getDisplayModes(void) const
|
||||
@@ -232,7 +232,7 @@ std::vector<std::string> ViewProviderFemPostObject::getDisplayModes(void) const
|
||||
|
||||
void ViewProviderFemPostObject::updateVtk() {
|
||||
|
||||
if(!setupPipeline())
|
||||
if (!setupPipeline())
|
||||
return;
|
||||
|
||||
m_currentAlgorithm->Update();
|
||||
@@ -247,21 +247,21 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
|
||||
//coloring
|
||||
std::string val;
|
||||
if(Field.getEnums() && Field.getValue() >= 0)
|
||||
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) {
|
||||
std::string FieldName = point->GetArrayName(i);
|
||||
if (FieldName != "Texture Coordinates")
|
||||
colorArrays.push_back(FieldName);
|
||||
}
|
||||
|
||||
vtkCellData* cell = poly->GetCellData();
|
||||
for(int i=0; i<cell->GetNumberOfArrays(); ++i)
|
||||
for (int i = 0; i < cell->GetNumberOfArrays(); ++i)
|
||||
colorArrays.push_back(cell->GetArrayName(i));
|
||||
|
||||
App::Enumeration empty;
|
||||
@@ -270,32 +270,32 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
Field.setValue(m_coloringEnum);
|
||||
|
||||
std::vector<std::string>::iterator it = std::find(colorArrays.begin(), colorArrays.end(), val);
|
||||
if(!val.empty() && it != colorArrays.end())
|
||||
if (!val.empty() && it != colorArrays.end())
|
||||
Field.setValue(val.c_str());
|
||||
|
||||
Field.purgeTouched();
|
||||
|
||||
//Vector mode
|
||||
if(VectorMode.getEnums() && VectorMode.getValue() >= 0)
|
||||
if (VectorMode.getEnums() && VectorMode.getValue() >= 0)
|
||||
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();
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkDataArray* data = pd->GetPointData()->GetArray(array);
|
||||
|
||||
if(data->GetNumberOfComponents() == 1)
|
||||
if (data->GetNumberOfComponents() == 1)
|
||||
colorArrays.push_back("Not a vector");
|
||||
else {
|
||||
colorArrays.push_back("Magnitude");
|
||||
if(data->GetNumberOfComponents() >= 2) {
|
||||
if (data->GetNumberOfComponents() >= 2) {
|
||||
colorArrays.push_back("X");
|
||||
colorArrays.push_back("Y");
|
||||
}
|
||||
if(data->GetNumberOfComponents() >= 3)
|
||||
if (data->GetNumberOfComponents() >= 3)
|
||||
colorArrays.push_back("Z");
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void ViewProviderFemPostObject::updateProperties() {
|
||||
VectorMode.setValue(m_vectorEnum);
|
||||
|
||||
it = std::find(colorArrays.begin(), colorArrays.end(), val);
|
||||
if(!val.empty() && it != colorArrays.end())
|
||||
if (!val.empty() && it != colorArrays.end())
|
||||
VectorMode.setValue(val.c_str());
|
||||
|
||||
m_blockPropertyChanges = false;
|
||||
@@ -315,11 +315,11 @@ void ViewProviderFemPostObject::update3D() {
|
||||
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
|
||||
vtkPointData *pntData;
|
||||
vtkPoints *points;
|
||||
vtkDataArray *normals = nullptr;
|
||||
vtkDataArray *tcoords = nullptr;
|
||||
vtkCellArray *cells;
|
||||
vtkPointData* pntData;
|
||||
vtkPoints* points;
|
||||
vtkDataArray* normals = nullptr;
|
||||
vtkDataArray* tcoords = nullptr;
|
||||
vtkCellArray* cells;
|
||||
vtkIdType npts = 0;
|
||||
vtkIdTypePtr indx = nullptr;
|
||||
|
||||
@@ -340,7 +340,7 @@ void ViewProviderFemPostObject::update3D() {
|
||||
m_faces->coordIndex.startEditing();
|
||||
int soidx = 0;
|
||||
cells = pd->GetPolys();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_faces->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
@@ -355,35 +355,34 @@ void ViewProviderFemPostObject::update3D() {
|
||||
else
|
||||
m_faces->coordIndex.setNum(0);
|
||||
|
||||
|
||||
// write out tstrips if any
|
||||
if (pd->GetNumberOfStrips() > 0) {
|
||||
if (pd->GetNumberOfStrips() > 0) {
|
||||
|
||||
int soidx = 0;
|
||||
cells = pd->GetStrips();
|
||||
m_triangleStrips->coordIndex.startEditing();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
int soidx = 0;
|
||||
cells = pd->GetStrips();
|
||||
m_triangleStrips->coordIndex.startEditing();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, -1);
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.setNum(soidx);
|
||||
m_triangleStrips->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_triangleStrips->coordIndex.setNum(0);
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.set1Value(soidx, -1);
|
||||
++soidx;
|
||||
}
|
||||
m_triangleStrips->coordIndex.setNum(soidx);
|
||||
m_triangleStrips->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_triangleStrips->coordIndex.setNum(0);
|
||||
|
||||
// write out lines if any
|
||||
if (pd->GetNumberOfLines() > 0) {
|
||||
// write out lines if any
|
||||
if (pd->GetNumberOfLines() > 0) {
|
||||
|
||||
int soidx = 0;
|
||||
cells = pd->GetLines();
|
||||
m_lines->coordIndex.startEditing();
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
for (int i = 0; i < npts; i++) {
|
||||
m_lines->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
|
||||
++soidx;
|
||||
@@ -393,34 +392,34 @@ void ViewProviderFemPostObject::update3D() {
|
||||
}
|
||||
m_lines->coordIndex.setNum(soidx);
|
||||
m_lines->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_lines->coordIndex.setNum(0);
|
||||
}
|
||||
else
|
||||
m_lines->coordIndex.setNum(0);
|
||||
|
||||
// write out verts if any
|
||||
if (pd->GetNumberOfVerts() > 0){
|
||||
// write out verts if any
|
||||
if (pd->GetNumberOfVerts() > 0) {
|
||||
|
||||
int soidx = 0;
|
||||
cells = pd->GetVerts();
|
||||
m_markers->coordIndex.startEditing();
|
||||
m_markers->coordIndex.setNum(pd->GetNumberOfVerts());
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
|
||||
for (cells->InitTraversal(); cells->GetNextCell(npts, indx); ) {
|
||||
m_markers->coordIndex.set1Value(soidx, static_cast<int>(indx[0]));
|
||||
++soidx;
|
||||
}
|
||||
m_markers->coordIndex.finishEditing();
|
||||
}
|
||||
else
|
||||
m_markers->coordIndex.setNum(0);
|
||||
}
|
||||
else
|
||||
m_markers->coordIndex.setNum(0);
|
||||
}
|
||||
|
||||
void ViewProviderFemPostObject::WritePointData(vtkPoints* points, vtkDataArray* normals, vtkDataArray* tcoords) {
|
||||
|
||||
Q_UNUSED(tcoords)
|
||||
double *p;
|
||||
Q_UNUSED(tcoords);
|
||||
double* p;
|
||||
int i;
|
||||
|
||||
if(!points)
|
||||
if (!points)
|
||||
return;
|
||||
|
||||
// if the object contains "Elmer" but no scale has been set, we set it to 1000.0
|
||||
@@ -457,12 +456,12 @@ void ViewProviderFemPostObject::WritePointData(vtkPoints* points, vtkDataArray*
|
||||
|
||||
void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
|
||||
if(!setupPipeline())
|
||||
if (!setupPipeline())
|
||||
return;
|
||||
|
||||
if(Field.getEnumVector().empty() || Field.getValue() == 0) {
|
||||
if (Field.getEnumVector().empty() || Field.getValue() == 0) {
|
||||
|
||||
m_material->diffuseColor.setValue(SbColor(0.8,0.8,0.8));
|
||||
m_material->diffuseColor.setValue(SbColor(0.8, 0.8, 0.8));
|
||||
m_material->transparency.setValue(0.);
|
||||
m_materialBinding->value = SoMaterialBinding::OVERALL;
|
||||
m_materialBinding->touch();
|
||||
@@ -471,11 +470,11 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
|
||||
|
||||
int array = Field.getValue() - 1; //0 is none
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkPolyData* pd = m_currentAlgorithm->GetOutput();
|
||||
vtkDataArray* data = pd->GetPointData()->GetArray(array);
|
||||
|
||||
int component = VectorMode.getValue() - 1; //0 is either "Not a vector" or magnitude, for -1 is correct for magnitude. x y and z are one number too high
|
||||
if(strcmp(VectorMode.getValueAsString(), "Not a vector")==0)
|
||||
if (strcmp(VectorMode.getValueAsString(), "Not a vector") == 0)
|
||||
component = 0;
|
||||
|
||||
//build the lookuptable
|
||||
@@ -490,11 +489,11 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) {
|
||||
for (int i = 0; i < pd->GetNumberOfPoints(); i++) {
|
||||
|
||||
double value = 0;
|
||||
if(component >= 0)
|
||||
if (component >= 0)
|
||||
value = data->GetComponent(i, component);
|
||||
else {
|
||||
for(int j=0; j<data->GetNumberOfComponents(); ++j)
|
||||
value += std::pow(data->GetComponent(i, j),2);
|
||||
for (int j = 0; j < data->GetNumberOfComponents(); ++j)
|
||||
value += std::pow(data->GetComponent(i, j), 2);
|
||||
|
||||
value = std::sqrt(value);
|
||||
}
|
||||
@@ -514,7 +513,7 @@ void ViewProviderFemPostObject::WriteTransparency() {
|
||||
|
||||
void ViewProviderFemPostObject::updateData(const App::Property* p) {
|
||||
|
||||
if( strcmp(p->getName(), "Data") == 0 ) {
|
||||
if (strcmp(p->getName(), "Data") == 0) {
|
||||
updateVtk();
|
||||
}
|
||||
}
|
||||
@@ -523,10 +522,9 @@ bool ViewProviderFemPostObject::setupPipeline() {
|
||||
|
||||
vtkDataObject* data = static_cast<Fem::FemPostObject*>(getObject())->Data.getValue();
|
||||
|
||||
if(!data)
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
|
||||
m_outline->SetInputData(data);
|
||||
m_surface->SetInputData(data);
|
||||
m_wireframe->SetInputData(data);
|
||||
@@ -576,10 +574,10 @@ bool ViewProviderFemPostObject::doubleClicked(void) {
|
||||
|
||||
bool ViewProviderFemPostObject::setEdit(int ModNum) {
|
||||
|
||||
if (ModNum == ViewProvider::Default || ModNum == 1 ) {
|
||||
if (ModNum == ViewProvider::Default || ModNum == 1) {
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgPost *postDlg = qobject_cast<TaskDlgPost*>(dlg);
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
TaskDlgPost* postDlg = qobject_cast<TaskDlgPost*>(dlg);
|
||||
if (postDlg && postDlg->getView() != this)
|
||||
postDlg = nullptr; // another pad left open its task panel
|
||||
if (dlg && !postDlg) {
|
||||
|
||||
Reference in New Issue
Block a user