Changeset 3639


Ignore:
Timestamp:
Apr 27, 2013 3:37:55 PM (11 years ago)
Author:
ldelgass
Message:

Fixes for new scalar bar in VTK head (currently disabled by define until we
update the runtime)

File:
1 edited

Legend:

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

    r3621 r3639  
    4545#include "ColorMap.h"
    4646#include "Trace.h"
     47
     48//#define NEW_SCALAR_BAR
    4749
    4850#define MSECS_ELAPSED(t1, t2) \
     
    19261928    // Set viewport-relative width/height/pos
    19271929    if (title.empty() && numLabels == 0) {
    1928         _scalarBarActor->SetPosition(0, 0);
     1930#ifdef NEW_SCALAR_BAR
     1931        _scalarBarActor->SetBarRatio(1);
     1932#endif
    19291933        if (width > height) {
    19301934            // horizontal
     1935#ifdef NEW_SCALAR_BAR
     1936            _scalarBarActor->SetDisplayPosition(0, 0);
     1937            _scalarBarActor->GetPosition2Coordinate()->SetCoordinateSystemToDisplay();
     1938            _scalarBarActor->GetPosition2Coordinate()->SetValue(width+4, height);
     1939#else
     1940            _scalarBarActor->SetPosition(0, 0);
    19311941            _scalarBarActor->SetHeight((((double)height+1.5)/((double)height))/0.4); // VTK: floor(actorHeight * .4)
    19321942            _scalarBarActor->SetWidth(1); // VTK: actorWidth
     1943#endif
    19331944        } else {
    19341945            // vertical
     1946#ifdef NEW_SCALAR_BAR
     1947            _scalarBarActor->SetDisplayPosition(0, -4);
     1948            _scalarBarActor->GetPosition2Coordinate()->SetCoordinateSystemToDisplay();
     1949            _scalarBarActor->GetPosition2Coordinate()->SetValue(width+1, height+5);
     1950#else
     1951            _scalarBarActor->SetPosition(0, 0);
    19351952            _scalarBarActor->SetHeight((((double)height+1.5)/((double)height))/0.86); // VTK: floor(actorHeight * .86)
    19361953            _scalarBarActor->SetWidth(((double)(width+5))/((double)width)); // VTK: actorWidth - 4 pixels
     1954#endif
    19371955        }
    19381956    } else {
     1957#ifdef NEW_SCALAR_BAR
     1958        _scalarBarActor->SetBarRatio(0.375);
     1959        _scalarBarActor->SetDisplayPosition(0, 0);
     1960        _scalarBarActor->GetPosition2Coordinate()->SetCoordinateSystemToDisplay();
     1961        _scalarBarActor->GetPosition2Coordinate()->SetValue(width, height);
     1962#else
    19391963        if (width > height) {
    19401964            // horizontal
     
    19481972            _scalarBarActor->SetWidth(0.8);
    19491973        }
     1974#endif
    19501975    }
    19511976
     
    20832108        _scalarBarActor->SetTitle("");
    20842109    }
     2110
     2111    double color[3];
     2112    color[0] = 1 - _bgColor[0];
     2113    color[1] = 1 - _bgColor[1];
     2114    color[2] = 1 - _bgColor[2];
     2115
     2116    _scalarBarActor->GetTitleTextProperty()->SetColor(color);
     2117    _scalarBarActor->GetTitleTextProperty()->BoldOff();
    20852118    _scalarBarActor->GetTitleTextProperty()->ItalicOff();
     2119    _scalarBarActor->GetTitleTextProperty()->ShadowOff();
    20862120    _scalarBarActor->SetNumberOfLabels(numLabels);
     2121    _scalarBarActor->GetLabelTextProperty()->SetColor(color);
    20872122    _scalarBarActor->GetLabelTextProperty()->BoldOff();
    20882123    _scalarBarActor->GetLabelTextProperty()->ItalicOff();
    20892124    _scalarBarActor->GetLabelTextProperty()->ShadowOff();
     2125#ifdef NEW_SCALAR_BAR
     2126    if (title.empty() && numLabels == 0) {
     2127        _scalarBarActor->DrawAnnotationsOff();
     2128        _scalarBarActor->SetAnnotationLeaderPadding(0);
     2129        _scalarBarActor->SetTextPad(0);
     2130    } else {
     2131        _scalarBarActor->DrawAnnotationsOn();
     2132        _scalarBarActor->SetAnnotationLeaderPadding(8);
     2133        _scalarBarActor->SetTextPad(1);
     2134    }
     2135#endif
    20902136
    20912137    _legendRenderWindow->Render();
     
    26152661            focalDepth = viewFocus[2];
    26162662
    2617             computeDisplayToWorld(( x * 2. + 1.) * _windowWidth / 2.0,
    2618                                   ( y * 2. + 1.) * _windowHeight / 2.0,
     2663            computeDisplayToWorld((x * 2. + 1.) * (double)_windowWidth / 2.0,
     2664                                  (y * 2. + 1.) * (double)_windowHeight / 2.0,
    26192665                                  focalDepth,
    26202666                                  newPickPoint);
    26212667
    2622             computeDisplayToWorld(_windowWidth / 2.0,
    2623                                   _windowHeight / 2.0,
     2668            computeDisplayToWorld((double)_windowWidth / 2.0,
     2669                                  (double)_windowHeight / 2.0,
    26242670                                  focalDepth,
    26252671                                  oldPickPoint);
Note: See TracChangeset for help on using the changeset viewer.