Ignore:
Timestamp:
Sep 18, 2013, 5:51:50 AM (6 years ago)
Author:
ldelgass
Message:

First pass at loading VTK vector data for flows in nanovis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/nanovis.cpp

    r3900 r3935  
    619619}
    620620
     621/**
     622 * \brief Called when new volumes are added to update ranges
     623 */
    621624void
    622625NanoVis::setVolumeRanges()
     
    644647}
    645648
     649/**
     650 * \brief Called when new heightmaps are added to update ranges
     651 */
    646652void
    647653NanoVis::setHeightmapRanges()
     
    676682NanoVis::collectBounds(bool onlyVisible)
    677683{
    678     if (Flow::updatePending) {
    679         mapFlows();
    680     }
    681 
    682684    sceneBounds.makeEmpty();
    683685
     
    706708    }
    707709
    708     {
     710    for (FlowHashmap::iterator itr = flowTable.begin();
     711         itr != flowTable.end(); ++itr) {
     712        Flow *flow = itr->second;
     713
    709714        BBox bbox;
    710         getFlowBounds(bbox.min, bbox.max, onlyVisible);
     715        flow->getBounds(bbox.min, bbox.max, onlyVisible);
    711716        sceneBounds.extend(bbox);
    712717    }
     
    812817}
    813818
     819/**
     820 * \brief Called when new flows are added to update ranges
     821 */
    814822bool
    815 NanoVis::mapFlows()
     823NanoVis::setFlowRanges()
    816824{
    817825    TRACE("Enter");
     
    827835         itr != flowTable.end(); ++itr) {
    828836        Flow *flow = itr->second;
    829         double min, max;
    830837        if (!flow->isDataLoaded()) {
    831838            continue;
    832839        }
    833         Rappture::Unirect3d *data = flow->data();
    834         min = data->magMin();
    835         max = data->magMax();
    836         if (min < Flow::magMin) {
    837             Flow::magMin = min;
     840        double range[2];
     841        flow->getVectorRange(range);
     842        if (range[0] < Flow::magMin) {
     843            Flow::magMin = range[0];
    838844        }
    839         if (max > Flow::magMax) {
    840             Flow::magMax = max;
     845        if (range[1] > Flow::magMax) {
     846            Flow::magMax = range[1];
    841847        }
    842848    }
     
    856862            flow->initializeParticles();
    857863        }
    858         if (!flow->scaleVectorField()) {
    859             return false;
    860         }
    861864    }
    862865
    863866    Flow::updatePending = false;
    864867    return true;
    865 }
    866 
    867 void
    868 NanoVis::getFlowBounds(Vector3f& min,
    869                        Vector3f& max,
    870                        bool onlyVisible)
    871 {
    872     TRACE("Enter");
    873 
    874     BBox allBounds;
    875     for (FlowHashmap::iterator itr = flowTable.begin();
    876          itr != flowTable.end(); ++itr) {
    877         BBox bbox;
    878         itr->second->getBounds(bbox.min, bbox.max, onlyVisible);
    879         allBounds.extend(bbox);
    880     }
    881 
    882     min = allBounds.min;
    883     max = allBounds.max;
    884868}
    885869
     
    928912
    929913    if (Flow::updatePending) {
    930         mapFlows();
     914        setFlowRanges();
    931915    }
    932916    if (HeightMap::updatePending) {
Note: See TracChangeset for help on using the changeset viewer.