Show
Ignore:
Timestamp:
09/19/14 12:35:23 (12 days ago)
Author:
robert
Message:

Moved widgets from VolumeEditorWidget? to TransferFunctionWidget?, and widget utilities into WidgetUtils?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgSim/ScalarBar.cpp

    r14047 r14059  
    135135    else 
    136136    { 
    137         matrix = osg::Matrix::rotate(osg::DegreesToRadians(90.0f),0.0f,0.0f,-1.0f) * osg::Matrix::translate(_position); 
     137        matrix = osg::Matrix::rotate(osg::DegreesToRadians(90.0f),0.0f,0.0f,1.0f) * osg::Matrix::translate(_position); 
    138138    } 
    139139 
     
    207207    float labelIncr = (_numLabels>0) ? (_stc->getMax()-_stc->getMin())/(_numLabels-1) : 0.0f; 
    208208    float labelxIncr = (_numLabels>0) ? (_width)/(_numLabels-1) : 0.0f; 
    209     const float labely = arOffset + characterSize*CHARACTER_OFFSET_FACTOR; 
     209    const float labelStickStartY = _orientation==HORIZONTAL ? arOffset : 0; 
     210    const float labelY = labelStickStartY + 
     211        (_orientation==HORIZONTAL ?  characterSize : -characterSize) * CHARACTER_OFFSET_FACTOR; 
     212 
    210213 
    211214    for(i=0; i<_numLabels; ++i) 
     
    218221        text->setText(_sp->printScalar(_stc->getMin()+(i*labelIncr))); 
    219222 
    220         text->setPosition(osg::Vec3((i*labelxIncr), labely, 0.0f)*matrix); 
     223        text->setPosition(osg::Vec3((i*labelxIncr), labelY, 0.0f)*matrix); 
    221224        text->setAlignment( (_orientation==HORIZONTAL) ? osgText::Text::CENTER_BASE_LINE : osgText::Text::LEFT_CENTER); 
    222225 
     
    241244        if ( _orientation==HORIZONTAL ) 
    242245        { 
    243             const float titleY = (_numLabels>0) ? labely + characterSize : labely; 
     246            const float titleY = (_numLabels>0) ? labelY + characterSize : labelY; 
    244247            titlePos = osg::Vec3((_width/2.0f), titleY, 0.0f); 
    245248        } 
    246249        else 
    247250        { 
    248             titlePos = osg::Vec3( 0, arOffset/2, 0 ); 
     251            titlePos = osg::Vec3(_width+characterSize*0.5, arOffset*0.5, 0 ); 
    249252        } 
    250  
    251         float titleY = (_numLabels>0) ? labely + characterSize : labely; 
    252253 
    253254        // Position the title at the middle of the bar above any labels. 
     
    280281    for(i=0; i<_numLabels; ++i) 
    281282    { 
    282         const osg::Vec3 p1(osg::Vec3((i*labelxIncr), arOffset, 0.0f)*matrix); 
    283         const osg::Vec3 p2(osg::Vec3((i*labelxIncr), labely, 0.0f)*matrix); 
     283        const osg::Vec3 p1(osg::Vec3((i*labelxIncr), labelStickStartY, 0.0f)*matrix); 
     284        const osg::Vec3 p2(osg::Vec3((i*labelxIncr), labelY, 0.0f)*matrix); 
    284285        annotVertices->push_back( p1 ); 
    285286        annotVertices->push_back( p2 );