From 363db6897d9a9466340ed498e492cf8b226c78c5 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 14 Jul 2010 13:38:19 +0000 Subject: [PATCH] force view type now also ok for trajectories and non-vertex-arrayed glyphs --- Fltk/optionWindow.cpp | 2 +- Graphics/drawPost.cpp | 15 +++++++++++++-- Post/PViewVertexArrays.cpp | 12 ++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index a785ff7e5c..a9be807059 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -2838,7 +2838,7 @@ optionWindow::optionWindow(int deltaFontSize) int w = W / 9; view.value[70 + i] = new Fl_Value_Input (L + 3 * WB + IW + i * w, 2 * WB + 10 * BH, w, BH); - view.value[70 + i]->minimum(0); + view.value[70 + i]->minimum(-1); view.value[70 + i]->maximum(9); view.value[70 + i]->step(1); view.value[70 + i]->callback(view_options_ok_cb); diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp index 7c249f9115..201ba341b4 100644 --- a/Graphics/drawPost.cpp +++ b/Graphics/drawPost.cpp @@ -257,9 +257,20 @@ static void drawGlyphs(drawContext *ctx, PView *p) int numNodes = data->getNumNodes(opt->timeStep, ent, i); for(int j = 0; j < numNodes; j++){ data->getNode(opt->timeStep, ent, i, j, xyz[j][0], xyz[j][1], xyz[j][2]); - for(int k = 0; k < numComp; k++) - data->getValue(opt->timeStep, ent, i, j, k, val[j][k]); + if(opt->forceNumComponents){ + for(int k = 0; k < opt->forceNumComponents; k++){ + int comp = opt->componentMap[k]; + if(comp >= 0 && comp < numComp) + data->getValue(opt->timeStep, ent, i, j, comp, val[j][k]); + else + val[j][k] = 0.; + } + } + else + for(int k = 0; k < numComp; k++) + data->getValue(opt->timeStep, ent, i, j, k, val[j][k]); } + if(opt->forceNumComponents) numComp = opt->forceNumComponents; changeCoordinates(p, ent, i, numNodes, type, numComp, xyz, val); if(!isElementVisible(opt, dim, numNodes, xyz)) continue; if(opt->intervalsType == PViewOptions::Numeric) diff --git a/Post/PViewVertexArrays.cpp b/Post/PViewVertexArrays.cpp index 401ae4d184..f19f3f1626 100644 --- a/Post/PViewVertexArrays.cpp +++ b/Post/PViewVertexArrays.cpp @@ -860,11 +860,15 @@ static void addVectorElement(PView *p, int ient, int iele, int numNodes, // add point trajectories if(!pre && numNodes == 1 && opt->timeStep > 0 && opt->lineWidth){ for(int ts = 0; ts < opt->timeStep; ts++){ - double xyz0[3], dxyz[3][2]; + int numComp = data->getNumComponents(ts, ient, iele); + double xyz0[3], dxyz[3][2] = {{0., 0.}, {0., 0.}, {0., 0.}}; + data->getNode(ts, ient, iele, 0, xyz0[0], xyz0[1], xyz0[2]); for(int j = 0; j < 3; j++){ - data->getNode(ts, ient, iele, 0, xyz0[0], xyz0[1], xyz0[2]); - data->getValue(ts, ient, iele, 0, j, dxyz[j][0]); - data->getValue(ts + 1, ient, iele, 0, j, dxyz[j][1]); + int comp = opt->forceNumComponents ? opt->componentMap[j] : j; + if(comp >= 0 && comp < numComp){ + data->getValue(ts, ient, iele, 0, comp, dxyz[j][0]); + data->getValue(ts + 1, ient, iele, 0, comp, dxyz[j][1]); + } } unsigned int col[2]; double norm[2]; -- GitLab