Commit 5b4cc61c authored by Raphael Cojocaru's avatar Raphael Cojocaru
Browse files

Added functionality for Update button. Now, the AltvsTime widget will...

Added functionality for Update button. Now, the AltvsTime widget will recompute all the graphs points when the Update button is pressed.
parent 8bf445ee
......@@ -973,12 +973,43 @@ void AltVsTime::slotUpdateDateLoc() {
//update pList entry
pList.replace( i, o );
KPlotObject *po = new KPlotObject( Qt::white, KPlotObject::Lines, 3 );
for ( double h=-12.0; h<=12.0; h+=0.5 ) {
po->addPoint( h, findAltitude( o, h ) );
// We are creating a new data set (time, altitude) for the new date:
QVector<double> time_dataSet, altitude_dataSet;
double point_altitudeValue, point_timeValue;
// compute the new graph values:
// time range: 24h
int offset = 3;
for ( double h=-12.0, i=0; h<=12.0; h+=0.25, i++ ) {
point_altitudeValue = findAltitude(o, h);
altitude_dataSet.push_back(point_altitudeValue);
if(point_altitudeValue > maxAlt)
maxAlt = point_altitudeValue;
if(point_altitudeValue < minAlt)
minAlt = point_altitudeValue;
point_timeValue = i*900 + 43200;
time_dataSet.push_back(point_timeValue);
}
// TODO:
// avtUI->View->replacePlotObject( i, po );
// Replace graph data set:
avtUI->View->graph(i)->setData(time_dataSet, altitude_dataSet);
// Go into initial state: without Zoom/Pan
avtUI->View->xAxis->setRange(43200, 129600);
avtUI->View->xAxis2->setRange(61200, 147600);
// Center the altitude axis in 0 value:
if(abs(minAlt) > maxAlt)
maxAlt = abs(minAlt) ;
else
minAlt = -maxAlt;
avtUI->View->yAxis->setRange(minAlt - offset, maxAlt + offset);
// Update background coordonates:
background->topLeft->setCoords(avtUI->View->xAxis->range().lower,avtUI->View->yAxis->range().upper);
background->bottomRight->setCoords(avtUI->View->xAxis->range().upper, avtUI->View->yAxis->range().lower);
// Redraw the plot:
avtUI->View->replot();
//restore original position
if ( o->isSolarSystem() ) {
......@@ -990,11 +1021,43 @@ void AltVsTime::slotUpdateDateLoc() {
} else { //assume unfound object is a custom object
pList.at(i)->updateCoordsNow( num ); //precess to desired epoch
KPlotObject *po = new KPlotObject( Qt::white, KPlotObject::Lines, 3 );
for ( double h=-12.0; h<=12.0; h+=0.5 ) {
po->addPoint( h, findAltitude( pList.at(i), h ) );
// We are creating a new data set (time, altitude) for the new date:
QVector<double> time_dataSet, altitude_dataSet;
double point_altitudeValue, point_timeValue;
// compute the new graph values:
// time range: 24h
int offset = 3;
for ( double h=-12.0, i=0; h<=12.0; h+=0.25, i++ ) {
point_altitudeValue = findAltitude(pList.at(i), h);
altitude_dataSet.push_back(point_altitudeValue);
if(point_altitudeValue > maxAlt)
maxAlt = point_altitudeValue;
if(point_altitudeValue < minAlt)
minAlt = point_altitudeValue;
point_timeValue = i*900 + 43200;
time_dataSet.push_back(point_timeValue);
}
// avtUI->View->replacePlotObject( i, po );
// Replace graph data set:
avtUI->View->graph(i)->setData(time_dataSet, altitude_dataSet);
// Go into initial state: without Zoom/Pan
avtUI->View->xAxis->setRange(43200, 129600);
avtUI->View->xAxis2->setRange(61200, 147600);
// Center the altitude axis in 0 value:
if(abs(minAlt) > maxAlt)
maxAlt = abs(minAlt) ;
else
minAlt = -maxAlt;
avtUI->View->yAxis->setRange(minAlt - offset, maxAlt + offset);
// Update background coordonates:
background->topLeft->setCoords(avtUI->View->xAxis->range().lower,avtUI->View->yAxis->range().upper);
background->bottomRight->setCoords(avtUI->View->xAxis->range().upper, avtUI->View->yAxis->range().lower);
// Redraw the plot:
avtUI->View->replot();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment