コード例 #1
0
/*!
   \brief BBMovementVisualizer::renderV
 */
void BBMovementVisualizer::renderV()
{
    if ( m_movementAnalyzer->dataAvailable() )
    {
        mp_window->makeContextCurrent();
        mp_boundingBoxLowerBody->setVisible( true );
        BoundingBox* boundingBox = dynamic_cast<BoundingBox*>( m_movementAnalyzer->getLatestBoudingGeomerty().data() );
        if ( boundingBox )
        {
            mp_boundingBoxLowerBody->setPosition( boundingBox->x(),
                                                  boundingBox->y(),
                                                  boundingBox->z() );
            mp_boundingBoxLowerBody->setScale( boundingBox->width(),
                                               boundingBox->height(),
                                               boundingBox->depth() );
        }
    }
    else
    {
        mp_boundingBoxLowerBody->setVisible( false );
    }

}
コード例 #2
0
ファイル: LabelsRenderer.cpp プロジェクト: anlambert/tulipjs
static BoundingBox labelBoundingBoxForNode(Graph *graph, node n) {
  IntegerProperty *viewShape = graph->getProperty<IntegerProperty>("viewShape");
  LayoutProperty *viewLayout = graph->getProperty<LayoutProperty>("viewLayout");
  SizeProperty *viewSize = graph->getProperty<SizeProperty>("viewSize");
  BoundingBox renderingBox;
  GlyphsManager::getGlyph(viewShape->getNodeValue(n))->getTextBoundingBox(renderingBox);
  const Coord &pos = viewLayout->getNodeValue(n);
  const Size &size = viewSize->getNodeValue(n) * Size(renderingBox.width(), renderingBox.height(), renderingBox.depth());
  return BoundingBox(pos - size/2.f, pos + size/2.f);
}