From c522b906a9ac783e35355b0e8600fd61a1189e1b Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 20 Mar 2014 21:25:58 +0000 Subject: [PATCH] display time step --- contrib/mobile/README.txt | 5 +++-- contrib/mobile/drawContext.cpp | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/contrib/mobile/README.txt b/contrib/mobile/README.txt index b5c7ea0d35..7d13d3d479 100644 --- a/contrib/mobile/README.txt +++ b/contrib/mobile/README.txt @@ -2,7 +2,7 @@ iOS: Version: 1.0.0 -SKU: org.geuz.Onelab +SKU: 20140320 Description: @@ -25,8 +25,9 @@ cmake -DCMAKE_PREFIX_PATH="$HOME/src/gmsh/contrib/mobile/frameworks;$HOME/src/ge make xcodeProject open Onelab/Onelab.xcodeproj +In short, if all the frameworks are installed in ./frameworks_simulator: + cd ./build_simulator cmake -DCMAKE_PREFIX_PATH="$HOME/src/gmsh/contrib/mobile/frameworks_simulator;$HOME/src/getdp" .. make xcodeProject open Onelab/Onelab.xcodeproj - diff --git a/contrib/mobile/drawContext.cpp b/contrib/mobile/drawContext.cpp index 3dadac97eb..00400ddacf 100644 --- a/contrib/mobile/drawContext.cpp +++ b/contrib/mobile/drawContext.cpp @@ -371,7 +371,8 @@ void drawContext::drawScale() PView *p = PView::list[i]; PViewOptions *opt = p->getOptions(); if(!opt->visible) continue; - + PViewData *data = p->getData(); + double width = (this->_right -this->_left) / 2.; double height = (this->_top - this->_bottom) / 10.; double dh = height / 5; @@ -463,13 +464,26 @@ void drawContext::drawScale() glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); - drawString lbl(p->getData()->getName().c_str(), 20); + char label[1024]; + int nt = data->getNumTimeSteps(); + if((opt->showTime == 1 && nt > 1) || opt->showTime == 2){ + char tmp[256]; + sprintf(tmp, opt->format.c_str(), data->getTime(opt->timeStep)); + sprintf(label, "%s (%s)", data->getName().c_str(), tmp); + } + else if((opt->showTime == 3 && nt > 1) || opt->showTime == 4){ + sprintf(label, "%s (%d/%d)", data->getName().c_str(), opt->timeStep, + data->getNumTimeSteps() - 1); + } + else{ + sprintf(label, "%s", data->getName().c_str()); + } + drawString lbl(label, 20); lbl.draw(xmin+width/2, ymin+ 2.5*dh, 0., _width/(_right-_left), _height/(_top-_bottom)); - drawString val(p->getData()->getName().c_str(), 14); + drawString val(data->getName().c_str(), 14); for(int i = 0; i < 3; i++) { double v = opt->getScaleValue(i, 3, opt->tmpMin, opt->tmpMax); - char label[1024]; sprintf(label, opt->format.c_str(), v); val.setText(label); val.draw(xmin+i*width/2, ymin+ 1.5*dh, 0., _width/(_right-_left), _height/(_top-_bottom)); -- GitLab