Changeset 3138 for trunk/packages


Ignore:
Timestamp:
Aug 8, 2012 10:13:25 AM (12 years ago)
Author:
ldelgass
Message:

Add vtk renderer method to collect unscaled graphics object bounds.

Location:
trunk/packages/vizservers/vtkvis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp

    r3136 r3138  
    22982298        if ((!onlyVisible || itr->second->getVisibility()) &&
    22992299            itr->second->getProp() != NULL)
    2300             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2300            mergeBounds(bounds, bounds, itr->second->getBounds());
    23012301    }
    23022302    for (Contour3DHashmap::iterator itr = _contour3Ds.begin();
     
    23042304        if ((!onlyVisible || itr->second->getVisibility()) &&
    23052305            itr->second->getProp() != NULL)
    2306             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2306            mergeBounds(bounds, bounds, itr->second->getBounds());
    23072307    }
    23082308    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     
    23102310        if ((!onlyVisible || itr->second->getVisibility()) &&
    23112311            itr->second->getProp() != NULL)
    2312             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2312            mergeBounds(bounds, bounds, itr->second->getBounds());
    23132313    }
    23142314    for (GlyphsHashmap::iterator itr = _glyphs.begin();
     
    23162316        if ((!onlyVisible || itr->second->getVisibility()) &&
    23172317            itr->second->getProp() != NULL)
    2318             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2318            mergeBounds(bounds, bounds, itr->second->getBounds());
    23192319    }
    23202320    for (HeightMapHashmap::iterator itr = _heightMaps.begin();
     
    23222322        if ((!onlyVisible || itr->second->getVisibility()) &&
    23232323            itr->second->getProp() != NULL)
    2324             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2324            mergeBounds(bounds, bounds, itr->second->getBounds());
    23252325    }
    23262326    for (LICHashmap::iterator itr = _lics.begin();
     
    23282328        if ((!onlyVisible || itr->second->getVisibility()) &&
    23292329            itr->second->getProp() != NULL)
    2330             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2330            mergeBounds(bounds, bounds, itr->second->getBounds());
    23312331    }
    23322332    for (MoleculeHashmap::iterator itr = _molecules.begin();
     
    23342334        if ((!onlyVisible || itr->second->getVisibility()) &&
    23352335            itr->second->getProp() != NULL)
    2336             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2336            mergeBounds(bounds, bounds, itr->second->getBounds());
    23372337    }
    23382338    for (PolyDataHashmap::iterator itr = _polyDatas.begin();
     
    23402340        if ((!onlyVisible || itr->second->getVisibility()) &&
    23412341            itr->second->getProp() != NULL)
    2342             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2342            mergeBounds(bounds, bounds, itr->second->getBounds());
    23432343    }
    23442344    for (PseudoColorHashmap::iterator itr = _pseudoColors.begin();
     
    23462346        if ((!onlyVisible || itr->second->getVisibility()) &&
    23472347            itr->second->getProp() != NULL)
    2348             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2348            mergeBounds(bounds, bounds, itr->second->getBounds());
    23492349    }
    23502350    for (StreamlinesHashmap::iterator itr = _streamlines.begin();
     
    23522352        if ((!onlyVisible || itr->second->getVisibility()) &&
    23532353            itr->second->getProp() != NULL)
    2354             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2354            mergeBounds(bounds, bounds, itr->second->getBounds());
    23552355    }
    23562356    for (VolumeHashmap::iterator itr = _volumes.begin();
     
    23582358        if ((!onlyVisible || itr->second->getVisibility()) &&
    23592359            itr->second->getProp() != NULL)
    2360             mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2360            mergeBounds(bounds, bounds, itr->second->getBounds());
    23612361    }
    23622362    for (WarpHashmap::iterator itr = _warps.begin();
     
    23642364        if ((!onlyVisible || itr->second->getVisibility()) &&
    23652365            itr->second->getProp() != NULL)
     2366            mergeBounds(bounds, bounds, itr->second->getBounds());
     2367    }
     2368
     2369    for (int i = 0; i < 6; i += 2) {
     2370        if (bounds[i+1] < bounds[i]) {
     2371            bounds[i] = -0.5;
     2372            bounds[i+1] = 0.5;
     2373        }
     2374    }
     2375
     2376    int numDims = 0;
     2377    if (bounds[0] != bounds[1])
     2378        numDims++;
     2379    if (bounds[2] != bounds[3])
     2380        numDims++;
     2381    if (bounds[4] != bounds[5])
     2382        numDims++;
     2383
     2384    if (numDims == 0) {
     2385        bounds[0] -= .5;
     2386        bounds[1] += .5;
     2387        bounds[2] -= .5;
     2388        bounds[3] += .5;
     2389    }
     2390
     2391    TRACE("Bounds: %g %g %g %g %g %g",
     2392          bounds[0],
     2393          bounds[1],
     2394          bounds[2],
     2395          bounds[3],
     2396          bounds[4],
     2397          bounds[5]);
     2398}
     2399
     2400/**
     2401 * \brief Collect bounds of all graphics objects
     2402 *
     2403 * \param[out] bounds Bounds of all scene objects
     2404 * \param[in] onlyVisible Only collect bounds of visible objects
     2405 */
     2406void Renderer::collectUnscaledBounds(double *bounds, bool onlyVisible)
     2407{
     2408    bounds[0] = DBL_MAX;
     2409    bounds[1] = -DBL_MAX;
     2410    bounds[2] = DBL_MAX;
     2411    bounds[3] = -DBL_MAX;
     2412    bounds[4] = DBL_MAX;
     2413    bounds[5] = -DBL_MAX;
     2414
     2415    for (DataSetHashmap::iterator itr = _dataSets.begin();
     2416             itr != _dataSets.end(); ++itr) {
     2417        if ((!onlyVisible || itr->second->getVisibility()) &&
     2418            itr->second->getProp() != NULL)
    23662419            mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     2420    }
     2421    for (Contour2DHashmap::iterator itr = _contour2Ds.begin();
     2422             itr != _contour2Ds.end(); ++itr) {
     2423        if ((!onlyVisible || itr->second->getVisibility()) &&
     2424            itr->second->getProp() != NULL)
     2425            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2426    }
     2427    for (Contour3DHashmap::iterator itr = _contour3Ds.begin();
     2428             itr != _contour3Ds.end(); ++itr) {
     2429        if ((!onlyVisible || itr->second->getVisibility()) &&
     2430            itr->second->getProp() != NULL)
     2431            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2432    }
     2433    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     2434             itr != _cutplanes.end(); ++itr) {
     2435        if ((!onlyVisible || itr->second->getVisibility()) &&
     2436            itr->second->getProp() != NULL)
     2437            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2438    }
     2439    for (GlyphsHashmap::iterator itr = _glyphs.begin();
     2440             itr != _glyphs.end(); ++itr) {
     2441        if ((!onlyVisible || itr->second->getVisibility()) &&
     2442            itr->second->getProp() != NULL)
     2443            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2444    }
     2445    for (HeightMapHashmap::iterator itr = _heightMaps.begin();
     2446             itr != _heightMaps.end(); ++itr) {
     2447        if ((!onlyVisible || itr->second->getVisibility()) &&
     2448            itr->second->getProp() != NULL)
     2449            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2450    }
     2451    for (LICHashmap::iterator itr = _lics.begin();
     2452             itr != _lics.end(); ++itr) {
     2453        if ((!onlyVisible || itr->second->getVisibility()) &&
     2454            itr->second->getProp() != NULL)
     2455            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2456    }
     2457    for (MoleculeHashmap::iterator itr = _molecules.begin();
     2458             itr != _molecules.end(); ++itr) {
     2459        if ((!onlyVisible || itr->second->getVisibility()) &&
     2460            itr->second->getProp() != NULL)
     2461            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2462    }
     2463    for (PolyDataHashmap::iterator itr = _polyDatas.begin();
     2464             itr != _polyDatas.end(); ++itr) {
     2465        if ((!onlyVisible || itr->second->getVisibility()) &&
     2466            itr->second->getProp() != NULL)
     2467            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2468    }
     2469    for (PseudoColorHashmap::iterator itr = _pseudoColors.begin();
     2470             itr != _pseudoColors.end(); ++itr) {
     2471        if ((!onlyVisible || itr->second->getVisibility()) &&
     2472            itr->second->getProp() != NULL)
     2473            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2474    }
     2475    for (StreamlinesHashmap::iterator itr = _streamlines.begin();
     2476             itr != _streamlines.end(); ++itr) {
     2477        if ((!onlyVisible || itr->second->getVisibility()) &&
     2478            itr->second->getProp() != NULL)
     2479            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2480    }
     2481    for (VolumeHashmap::iterator itr = _volumes.begin();
     2482             itr != _volumes.end(); ++itr) {
     2483        if ((!onlyVisible || itr->second->getVisibility()) &&
     2484            itr->second->getProp() != NULL)
     2485            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
     2486    }
     2487    for (WarpHashmap::iterator itr = _warps.begin();
     2488             itr != _warps.end(); ++itr) {
     2489        if ((!onlyVisible || itr->second->getVisibility()) &&
     2490            itr->second->getProp() != NULL)
     2491            mergeBounds(bounds, bounds, itr->second->getUnscaledBounds());
    23672492    }
    23682493
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.h

    r3134 r3138  
    554554    void collectBounds(double *bounds, bool onlyVisible);
    555555
     556    void collectUnscaledBounds(double *bounds, bool onlyVisible);
     557
    556558    void collectDataRanges();
    557559
Note: See TracChangeset for help on using the changeset viewer.