Square::Square( vect3d &pCenter, vect3d &pNormal, vect3d &pHeadVec, float nWidth, float nHeight, float fReflR, float fRefrR, float fRefrK, float fEmitR) :PrimaryObject(fReflR, fRefrR, fRefrK, fEmitR) { vecCopy(_vCenter, pCenter); vecCopy(_vNormal, pNormal); vecCopy(_vWidthVec, pHeadVec); _nWidth = nWidth; _nHeight = nHeight; vecScale(_vWidthVec, nHeight/2, _v2WidthVec); vect3d v2HeightVec; cross_product(_vWidthVec, _vNormal, v2HeightVec); normalize(v2HeightVec); vecScale(v2HeightVec, nWidth/2, _v2HeightVec); a = _vNormal[0]; b = _vNormal[1]; c = _vNormal[2]; d = (-1) * (a * _vCenter[0] + b * _vCenter[1] + c * _vCenter[2]); updateBBox(); }
void HeatmapGui::on_mRadiusFieldUnitCombo_currentIndexChanged( int index ) { Q_UNUSED( index ); updateBBox(); // DebugMsg to avoid index not used warning QgsDebugMsg( QString( "Unit index set to %1" ).arg( index ) ); }
//------------------------------------------------------------------------------ bool SimSmoke::onAdd() { if (!Parent::onAdd()) return false; // don't know shape size yet, fake it for now bbox.fMin.set(-1,-1,-1); bbox.fMax.set(1,1,1); if (!faceCam && !followCam) image.transform.identity(); image.transform.p = pos; image.transform.flags |= TMat3F::Matrix_HasTranslation; // will keep this flag setting updateBBox(image.transform.p); // calculate the rotation image.setAxisSpin(smokeRand.getFloat((float)M_2PI)); // add to timer set addToSet(SimTimerSetId); // add to container db so we get render query SimContainer *root = NULL; root = findObject(manager, SimRootContainerId,root); root->addObject(this); // when to quit? prevAnimTime = manager->getCurrentTime(); // measure smoke duration from here smokeOut += prevAnimTime; return true; }
// get bbox of shape const CBBox2D & CQIllustratorShape:: getBBox() const { updateBBox(); return bbox_; }
Sphere::Sphere(float fRadius, vect3d &pCenterPos, float fReflR, float fRefrR, float fRefrK, float fEmitR) :PrimaryObject(fReflR, fRefrR, fRefrK, fEmitR) , _fRad(fRadius) { _ctr[0] = pCenterPos[0]; _ctr[1] = pCenterPos[1]; _ctr[2] = pCenterPos[2]; updateBBox(); }
void HeatmapGui::on_mInputLayerCombo_currentIndexChanged( int index ) { Q_UNUSED( index ); // Set initial value for radius field based on layer's extent mBufferSizeLineEdit->setText( QString::number( estimateRadius() ) ); updateBBox(); QgsDebugMsg( QString( "Input vector index changed to %1" ).arg( index ) ); }
void SimFire::finishAddToManager() { if (onObj) deleteNotify(onObj); // don't know shape size yet, fake it for now bbox.fMin.set(-1,-1,-1); bbox.fMax.set(1,1,1); if (!faceCam && !followCam) image.transform.identity(); Point3F & p = image.transform.p; image.transform.flags |= TMat3F::Matrix_HasTranslation; // will keep this flag setting getPosition(p); updateBBox(p); updateBox = false; fireHeight = 0; // set fire start and end time prevAnimTime = manager->getCurrentTime(); fireOut += prevAnimTime; // set next smoke time if (producesSmoke) nextSmokeTime = smokeToSmoke*.5f + prevAnimTime; // add to timer set addToSet(SimTimerSetId); // add to container db so we get render query SimContainer *root = NULL; root = findObject(manager, SimRootContainerId,root); root->addObject(this); // start sound if there is one if (soundID != -1) hSound = Sfx::Manager::PlayAt( manager, soundID, TMat3F(EulerF(0, 0, 0), p), Point3F(0, 0, 0)); // prepare the light if (lightRange > 0.0f && SimFire::DynamicLighting) { glow.setType(TS::Light::LightPoint); glow.setIntensity(lightColor); glow.setRange(lightRange); glow.setPosition(p); addToSet(SimLightSetId); } }
bool SimSmoke::onSimTimerEvent(const SimTimerEvent *event) { if ((float)manager->getCurrentTime()>smokeOut) { deleteObject(); return true; } // update position of smoke (all is in world-space coords) Point3F dv = vel; dv *= (float) (event->timerInterval); image.transform.p += dv; updateBBox(image.transform.p); return true; }
void HeatmapGui::on_mAdvancedGroupBox_toggled( bool enabled ) { if ( enabled ) { // if there are no layers point layers then show error dialog and toggle if ( mInputLayerCombo->count() == 0 ) { QMessageBox::information( nullptr, tr( "No valid layers found!" ), tr( "Advanced options cannot be enabled." ) ); mAdvancedGroupBox->setChecked( false ); return; } updateBBox(); mDecayLineEdit->setEnabled(( Heatmap::KernelShape )( mKernelShapeCombo->itemData( mKernelShapeCombo->currentIndex() ).toInt() ) == Heatmap::Triangular ); } }
//------------------------------------------------------------------------------ bool SimFire::onSimTimerEvent(const SimTimerEvent *) { // get current time float now = manager->getCurrentTime(); // check if the time is up if (now>fireOut) { manager->deleteObject(this); return true; } if (onObj || updateBox) { // update position of fire Point3F & p = image.transform.p; getPosition(p); updateBBox(p); updateBox = false; } // produces a smoke puff? if (now>nextSmokeTime && renderedYet) { SimSmoke * smoke = new SimSmoke(smokeShapeTag,smokeTransShapeTag,smokeOut); Point3F p = image.transform.p; p += smokeOffset; p.z += fireHeight; smoke->setPosition(p); smoke->setVelocity(smokeVel); smoke->setFaceCam(); manager->addObject(smoke); if (inHardware) nextSmokeTime = now + smokeToSmoke; else nextSmokeTime = now + SMOKE_ISI_SW_MULTIPLIER * smokeToSmoke; } return true; }
/// /// class Triangle /// Triangle::Triangle( float vVertices[3][3], float *facetNormal, float fReflR, float fRefrR, float fRefrK, float fEmitR) : PrimaryObject(fReflR, fRefrR, fRefrK, fEmitR) , _bSmooth(false) , _bHasVNorm(false) { assert(vVertices && facetNormal); for(int i = 0; i < 3; i ++) { _vertices[i][0] = vVertices[i][0]; _vertices[i][1] = vVertices[i][1]; _vertices[i][2] = vVertices[i][2]; _normal[i] = facetNormal[i]; _vnormal[i][0] = 0; _vnormal[i][1] = 0; _vnormal[i][2] = 0; } updateBBox(); }
void Mesh::computeTempRendererData() { // In order to keep things running quickly, we pre-compute many // element properties to speed up drawing at the expenses of memory. // Element bounding box (xmin, xmax and friends) mBBoxes = new BBox[mElems.count()]; int E4Qcount = elementCountForType(Element::E4Q); mE4Qtmp = new E4Qtmp[E4Qcount]; mE4QtmpIndex = new int[mElems.count()]; memset(mE4QtmpIndex, -1, sizeof(int)*mElems.count()); int e4qIndex = 0; int i = 0; for (Mesh::Elements::const_iterator it = mElems.constBegin(); it != mElems.constEnd(); ++it, ++i) { if (it->isDummy()) continue; const Element& elem = *it; updateBBox(mBBoxes[i], elem, mNodes.constData()); if (elem.eType() == Element::E4Q) { // cache some temporary data for faster rendering mE4QtmpIndex[i] = e4qIndex; E4Qtmp& e4q = mE4Qtmp[e4qIndex]; E4Q_computeMapping(elem, e4q, mNodes.constData(), *mE4Qnorm); e4qIndex++; } } }
bool InspectorIH::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& /*aa*/ ) { const osgSDL::SDLEventAdapter* p_eventAdapter = dynamic_cast< const osgSDL::SDLEventAdapter* >( &ea ); assert( p_eventAdapter && "invalid event adapter received" ); unsigned int eventType = p_eventAdapter->getEventType(); int key = p_eventAdapter->getSDLKey(); const SDL_Event& sdlevent = p_eventAdapter->getSDLEvent(); if ( eventType == osgGA::GUIEventAdapter::FRAME ) return false; // terminate application on Escape if ( key == SDLK_ESCAPE ) yaf3d::Application::get()->stop(); // toggle info dialog rendering if ( ( key == SDLK_SPACE ) && ( eventType == osgGA::GUIEventAdapter::KEYDOWN ) ) { _infoEnabled = !_infoEnabled; getUserObject()->enableInfoWindow( _infoEnabled ); } // enable / disable picking mode if ( ( key == SDLK_RCTRL ) || ( key == SDLK_LCTRL ) ) { if ( eventType == osgGA::GUIEventAdapter::KEYDOWN ) _pickingEnabled = true; else if ( eventType == osgGA::GUIEventAdapter::KEYUP ) _pickingEnabled = false; } // pick an object if ( _pickingEnabled ) { if ( sdlevent.button.button == SDL_BUTTON_LEFT && eventType == osgGA::GUIEventAdapter::PUSH ) { float x = sdlevent.motion.x, y = sdlevent.motion.y; x = 2.0f * ( x * _iscreenWidth ) - 1.0f; y = 2.0f * ( y * _iscreenHeight ) - 1.0f; // picked something? if ( pick( x, -y ) ) { InspectorIH::PickResults* res = getPickResults(); osgUtil::Hit* p_hit = res->_p_hit; osg::Drawable* p_drawable = res->_p_drawable; // evaluate the node path of picked drawable and extract drawable's node name and location ( in world space ) osg::NodePath& nodepath = p_hit->getNodePath(); std::string nodename; if ( nodepath.size() ) { osg::MatrixTransform* p_mtNode = NULL; osg::NodePath::iterator p_nbeg = nodepath.end(), p_nend = nodepath.begin(); p_nbeg--; for ( ; p_nbeg != p_nend; --p_nbeg ) { osg::MatrixTransform* p_mt = dynamic_cast< osg::MatrixTransform* >( *p_nbeg ); osg::Group* p_grp = dynamic_cast< osg::Group* >( *p_nbeg ); if ( !nodename.length() ) { if ( p_mt ) { nodename = p_mt->getName(); if ( !p_mtNode ) // we need only the first embedding transform node p_mtNode = p_mt; } else if ( p_grp ) { nodename = p_grp->getName(); } } else break; } // update the bbox and get its dimensions const osg::Matrix* p_mat = p_hit->getMatrix(); osg::Vec3f pos = p_mat->getTrans(); osg::Vec3f dims( updateBBox( p_drawable, *p_mat, p_mtNode ? true : false ) ); // get primitive count of selected drawable const osg::Geometry* p_geom = p_drawable->asGeometry(); unsigned int prims = p_geom->getNumPrimitiveSets(); // format and set the output text std::ostringstream str; str << "name " << nodename << std::endl; str << "position " << pos.x() << " " << pos.y() << " " << pos.z() << std::endl; str << "primitives " << prims << std::endl; str << "dimensions " << dims.x() << " " << dims.y() << " " << dims.z() << std::endl; CEGUI::String text( str.str() ); getUserObject()->setPickerOutputText( text ); } } } } // don't check for movement keys when locked if ( _lockMovement ) return false; EnCamera* p_camera = getUserObject()->_p_cameraEntity; float& speed = getUserObject()->_speed; float& dt = getUserObject()->_deltaTime; osg::Vec3f pos; if ( eventType == osgGA::GUIEventAdapter::KEYDOWN ) { if ( key == SDLK_w ) _moveForward = true; else if ( key == SDLK_s ) _moveBackward = true; else if ( key == SDLK_a ) _moveLeft = true; else if ( key == SDLK_d ) _moveRight = true; } else if ( eventType == osgGA::GUIEventAdapter::KEYUP ) { if ( key == SDLK_w ) _moveForward = false; else if ( key == SDLK_s ) _moveBackward = false; else if ( key == SDLK_a ) _moveLeft = false; else if ( key == SDLK_d ) _moveRight = false; } if ( _moveForward ) pos._v[ 1 ] += speed * dt; else if ( _moveBackward ) pos._v[ 1 ] -= speed * dt; if ( _moveLeft ) pos._v[ 0 ] -= speed * dt; else if ( _moveRight ) pos._v[ 0 ] += speed * dt; // enable the camera rotation on dragging right mouse button if ( sdlevent.button.button == SDL_BUTTON_RIGHT ) { if ( eventType == osgGA::GUIEventAdapter::PUSH ) _rotationEnabled = true; else if ( eventType == osgGA::GUIEventAdapter::RELEASE ) _rotationEnabled = false; } // adjust pitch and yaw if ( ( eventType == osgGA::GUIEventAdapter::DRAG ) && _rotationEnabled ) { // skip events which come in when we warp the mouse pointer to middle of app window ( see below ) if ( ( sdlevent.motion.x == _screenMiddleX ) && ( sdlevent.motion.y == _screenMiddleY ) ) return false; static float lastxrel = 0; static float lastyrel = 0; float xrel = float( sdlevent.motion.xrel ) * dt; float yrel = float( sdlevent.motion.yrel ) * dt; // smooth the view change avoiding hart camera rotations _yaw += ( xrel + lastxrel ) * 0.1f; _pitch += ( yrel + lastyrel ) * 0.1f; lastxrel = xrel; lastyrel = yrel; // set new camera orientation p_camera->setLocalPitchYaw( -_pitch, -_yaw ); // reset mouse position in order to avoid leaving the app window yaf3d::Application::get()->getViewer()->requestWarpPointer( _screenMiddleX, _screenMiddleY ); } // update camera position if ( _moveForward || _moveBackward || _moveLeft || _moveRight ) { pos = p_camera->getLocalRotation() * pos; p_camera->setCameraPosition( pos + p_camera->getCameraPosition() ); } return false; }
Cube::Cube( float fLen, float fWidth, float fHeight, vect3d &pCenterPos, vect3d &pVerticalVec, vect3d &pHorizonVec, float fReflR, float fRefrR, float fRefrK, float fEmitR) :PrimaryObject(fReflR, fRefrR, fRefrK, fEmitR) { assert( (fLen > 0) && (fWidth > 0) && (fHeight > 0) ); /// /// Since there's no ObjObject in GPU, and I want to make primaryObj id the same as the /// GPU primaryObj array index, I do this. This should not impact the current functional /// code. /// nCurrObj --; _fLength = fLen; _fWidth = fWidth; _fHeight = fHeight; vecCopy(_vCenterPos, pCenterPos); vecCopy(_verticalVec, pVerticalVec); vecCopy(_horizonVec, pHorizonVec); vect3d tmpVec, tmpPoint; // Top square vecScale(_verticalVec, _fHeight / 2.0, tmpVec); point2point(_vCenterPos, tmpVec, tmpPoint); _vs[0] = new Square(tmpPoint, _verticalVec, _horizonVec, _fLength, _fWidth); //_vs[0]->setColor(c1,c1,c1, c1, 0.5); vecScale(_verticalVec, (-1)*_fHeight / 2.0, tmpVec); point2point(_vCenterPos, tmpVec, tmpPoint); vecScale(_verticalVec, -1, tmpVec); _vs[1] = new Square(tmpPoint, tmpVec, _horizonVec, _fLength, _fWidth); //_vs[1]->setColor(c1,c1,c1, c1,0.5); // Left square vect3d vLeftNormalVec; cross_product(_horizonVec, _verticalVec, vLeftNormalVec); normalize(vLeftNormalVec); vecScale(vLeftNormalVec, _fLength / 2.0, tmpVec); point2point(_vCenterPos, tmpVec, tmpPoint); _vs[2] = new Square(tmpPoint, vLeftNormalVec, _horizonVec, _fHeight, _fWidth); //_vs[2]->setColor(c2,c2,c2, c2,0.5); vecScale(vLeftNormalVec, (-1)*_fLength / 2.0, tmpVec); point2point(_vCenterPos, tmpVec, tmpPoint); vecScale(vLeftNormalVec, -1, tmpVec); _vs[3] = new Square(tmpPoint, tmpVec, _horizonVec, _fHeight, _fWidth); //_vs[3]->setColor(c2,c2,c2, c2,0.5); // Right square vecScale(_horizonVec, _fWidth / 2.0, tmpVec); point2point(_vCenterPos, tmpVec, tmpPoint); _vs[4] = new Square(tmpPoint, _horizonVec, _verticalVec, _fLength, _fHeight); //_vs[4]->setColor(c3,c3,c3, c3,0.5); vecScale(_horizonVec, (-1)*_fWidth / 2.0, tmpVec); point2point(_vCenterPos, tmpVec, tmpPoint); vecScale(_horizonVec, -1, tmpVec); _vs[5] = new Square(tmpPoint, tmpVec, _verticalVec, _fLength, _fHeight); //_vs[5]->setColor(c3,c3,c3, c3,0.5); updateBBox(); }
void rePTerrainRenderable::columns( int val ) { _columns = val; updateBBox(); }
void rePTerrainRenderable::rows( int val ) { _rows = val; updateBBox(); }
bool Mesh::reprojectMesh() { // if source or destination CRS is empty, that implies we do not reproject anything if (mSrcProj4.isEmpty() || mDestProj4.isEmpty()) { setNoProjection(); return true; } projPJ projSrc = pj_init_plus(mSrcProj4.toAscii().data()); if (!projSrc) { qDebug("Crayfish: source proj4 string is not valid! (%s)", pj_strerrno(pj_errno)); setNoProjection(); return false; } projPJ projDst = pj_init_plus(mDestProj4.toAscii().data()); if (!projDst) { pj_free(projSrc); qDebug("Crayfish: source proj4 string is not valid! (%s)", pj_strerrno(pj_errno)); setNoProjection(); return false; } mProjection = true; if (mProjNodes == 0) mProjNodes = new Node[mNodes.count()]; memcpy(mProjNodes, mNodes.constData(), sizeof(Node)*mNodes.count()); if (pj_is_latlong(projSrc)) { // convert source from degrees to radians for (int i = 0; i < mNodes.count(); ++i) { mProjNodes[i].x *= DEG2RAD; mProjNodes[i].y *= DEG2RAD; } } int res = pj_transform(projSrc, projDst, mNodes.count(), 3, &mProjNodes->x, &mProjNodes->y, NULL); if (res != 0) { qDebug("Crayfish: reprojection failed (%s)", pj_strerrno(res)); setNoProjection(); return false; } if (pj_is_latlong(projDst)) { // convert source from degrees to radians for (int i = 0; i < mNodes.count(); ++i) { mProjNodes[i].x *= RAD2DEG; mProjNodes[i].y *= RAD2DEG; } } pj_free(projSrc); pj_free(projDst); mProjExtent = computeMeshExtent(true); mE4Qnorm->init(mProjExtent); if (mProjBBoxes == 0) mProjBBoxes = new BBox[mElems.count()]; for (int i = 0; i < mElems.count(); ++i) { const Element& elem = mElems[i]; updateBBox(mProjBBoxes[i], elem, mProjNodes); if (elem.eType() == Element::E4Q) { int e4qIndex = mE4QtmpIndex[i]; E4Q_computeMapping(elem, mE4Qtmp[e4qIndex], mProjNodes, *mE4Qnorm); // update interpolation coefficients } } return true; }
void rePTerrainRenderable::size( reVec2 val ) { _size = val; updateBBox(); }
void HeatmapGui::on_mBufferUnitCombo_currentIndexChanged( int index ) { Q_UNUSED( index ); QgsDebugMsg( QString( "Unit index set to %1" ).arg( index ) ); updateBBox(); }
void Animation::pushFrame(AnimationFrame *pFrame) { m_frames.push_back(pFrame); updateBBox(pFrame->size(), pFrame->m_alignPoint); }
HeatmapGui::HeatmapGui( QWidget* parent, Qt::WindowFlags fl, QMap<QString, QVariant>* temporarySettings ) : QDialog( parent, fl ) , mRows( 500 ) { setupUi( this ); QgsDebugMsg( QString( "Creating Heatmap Dialog" ) ); blockAllSignals( true ); mKernelShapeCombo->addItem( tr( "Quartic (biweight)" ), Heatmap::Quartic ); mKernelShapeCombo->addItem( tr( "Triangular" ), Heatmap::Triangular ); mKernelShapeCombo->addItem( tr( "Uniform" ), Heatmap::Uniform ); mKernelShapeCombo->addItem( tr( "Triweight" ), Heatmap::Triweight ); mKernelShapeCombo->addItem( tr( "Epanechnikov" ), Heatmap::Epanechnikov ); mOutputValuesComboBox->addItem( tr( "Raw values" ), Heatmap::Raw ); mOutputValuesComboBox->addItem( tr( "Scaled by kernel size" ), Heatmap::Scaled ); mHeatmapSessionSettings = temporarySettings; // Adding point layers to the inputLayerCombo QString lastUsedLayer = mHeatmapSessionSettings->value( QString( "lastInputLayer" ) ).toString(); bool usingLastInputLayer = false; mInputLayerCombo->setFilters( QgsMapLayerProxyModel::PointLayer ); QgsMapLayer* defaultLayer = QgsMapLayerRegistry::instance()->mapLayer( lastUsedLayer ); if ( defaultLayer ) { mInputLayerCombo->setLayer( defaultLayer ); usingLastInputLayer = true; } mRadiusFieldCombo->setFilters( QgsFieldProxyModel::Numeric ); mWeightFieldCombo->setFilters( QgsFieldProxyModel::Numeric ); connect( mInputLayerCombo, SIGNAL( layerChanged( QgsMapLayer* ) ), mRadiusFieldCombo, SLOT( setLayer( QgsMapLayer* ) ) ); connect( mInputLayerCombo, SIGNAL( layerChanged( QgsMapLayer* ) ), mWeightFieldCombo, SLOT( setLayer( QgsMapLayer* ) ) ); mRadiusFieldCombo->setLayer( mInputLayerCombo->currentLayer() ); mWeightFieldCombo->setLayer( mInputLayerCombo->currentLayer() ); // Adding GDAL drivers with CREATE to mFormatCombo int myTiffIndex = -1; int myIndex = -1; GDALAllRegister(); int nDrivers = GDALGetDriverCount(); for ( int i = 0; i < nDrivers; i += 1 ) { GDALDriverH nthDriver = GDALGetDriver( i ); char **driverMetadata = GDALGetMetadata( nthDriver, nullptr ); // Only formats which allow creation of Float32 data types are valid if ( CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) && QString( GDALGetMetadataItem( nthDriver, GDAL_DMD_CREATIONDATATYPES, nullptr ) ).contains( "Float32" ) ) { ++myIndex; QString myLongName = GDALGetMetadataItem( nthDriver, GDAL_DMD_LONGNAME, nullptr ); // Add LongName text, shortname variant; GetDescription actually gets the shortname mFormatCombo->addItem( myLongName, QVariant( GDALGetDescription( nthDriver ) ) ); // Add the drivers and their extensions to a map for filename correction mExtensionMap.insert( GDALGetDescription( nthDriver ), GDALGetMetadataItem( nthDriver, GDAL_DMD_EXTENSION, nullptr ) ); if ( myLongName == "GeoTIFF" ) { myTiffIndex = myIndex; } } } //Restore choice of output format from last run QSettings s; int defaultFormatIndex = s.value( "/Heatmap/lastFormat", myTiffIndex ).toInt(); mFormatCombo->setCurrentIndex( defaultFormatIndex ); restoreSettings( usingLastInputLayer ); updateBBox(); updateSize(); mAddToCanvas->setChecked( s.value( "/Heatmap/addToCanvas", true ).toBool() ); blockAllSignals( false ); //finally set right the ok button enableOrDisableOkButton(); }
void Npc::Update() { updateBBox(); m_anim->Update(scene->input.getFrameTime().asSeconds()); }
void HeatmapGui::on_mRadiusFieldCombo_currentIndexChanged( int index ) { Q_UNUSED( index ); updateBBox(); QgsDebugMsg( QString( "Radius Field index changed to %1" ).arg( index ) ); }
void ChatLine::layout(qreal w, QPointF scenePos) { width = w; bbox.setTopLeft(scenePos); qreal fixedWidth = (content.size()-1) * columnSpacing; qreal varWidth = 0.0; // used for normalisation for (int i = 0; i < static_cast<int>(format.size()); ++i) { if (format[i].policy == ColumnFormat::FixedSize) fixedWidth += format[i].size; else varWidth += format[i].size; } if (varWidth == 0.0) varWidth = 1.0; qreal leftover = qMax(0.0, width - fixedWidth); qreal maxVOffset = 0.0; qreal xOffset = 0.0; qreal xPos[content.size()]; for (int i = 0; i < static_cast<int>(content.size()); ++i) { // calculate the effective width of the current column qreal width; if (format[i].policy == ColumnFormat::FixedSize) width = format[i].size; else width = format[i].size / varWidth * leftover; // set the width of the current column content[i]->setWidth(width); // calculate horizontal alignment qreal xAlign = 0.0; switch(format[i].hAlign) { case ColumnFormat::Right: xAlign = width - content[i]->boundingRect().width(); break; case ColumnFormat::Center: xAlign = (width - content[i]->boundingRect().width()) / 2.0; break; default: break; } // reposition xPos[i] = scenePos.x() + xOffset + xAlign; xOffset += width + columnSpacing; maxVOffset = qMax(maxVOffset, content[i]->getAscent()); } for (int i = 0; i < static_cast<int>(content.size()); ++i) { // calculate vertical alignment // vertical alignment may depend on width, so we do it in a second pass qreal yOffset = maxVOffset - content[i]->getAscent(); // reposition content[i]->setPos(xPos[i], scenePos.y() + yOffset); } updateBBox(); }
void HeatmapGui::on_mBufferSizeLineEdit_editingFinished() { updateBBox(); }