//====================================================================== //====================================================================== NvUIGraphic::NvUIGraphic(NvUITexture *uiTex, float dstw/*==0*/, float dsth/*==0*/) { StaticInit(); PrivateInit(); m_tex = uiTex; m_tex->AddRef(); if (dstw!=0) SetDimensions(dstw, dsth); else SetDimensions((float)m_tex->GetWidth(), (float)m_tex->GetHeight()); }
vtkSmartPointer<vtkUniformGrid> FlowAnalysis::vtkMakeGrid(){ auto grid=vtkSmartPointer<vtkUniformGrid>::New(); Vector3r cellSize3=Vector3r::Constant(cellSize); // if data are in cells, we need extra items along each axes, and shift the origin by half-cell down if(cellData) { grid->SetDimensions((boxCells+Vector3i::Ones()).eval().data()); Vector3r origin=(box.min()-.5*cellSize3); grid->SetOrigin(origin.data()); } else { grid->SetDimensions(boxCells.data()); grid->SetOrigin(box.min().data()); } grid->SetSpacing(cellSize,cellSize,cellSize); return grid; }
void KVASGroup::SetDimensions() { //Set dimensions of group according to dimensions of all its telescopes. KVTelescope* tel, *tel1; TIter next(GetTelescopes()); tel = (KVTelescope*) next(); if (!tel) return; tel1 = (KVTelescope*) next(); if (!tel1) return; SetDimensions(tel, tel1); while ((tel = (KVTelescope*) next())) { SetDimensions(this, tel); } }
status_t SeqManageRosterWindow::SetConfiguration(const BMessage* config) { ArpASSERT(config); status_t err = SetDimensions(config, this); if (err != B_OK) return err; /* Set the columns */ BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(TABLE_STR) ); if (table) { BMessage colMsg; for (int32 k = 0; config->FindMessage("column", k, &colMsg) == B_OK; k++) { const char* colName; float colW; bool colVis; if (colMsg.FindString("name", &colName) == B_OK && colMsg.FindFloat("width", &colW) == B_OK && colMsg.FindBool("visible", &colVis) == B_OK) { BColumn* col = col_named(colName, table); if (col) { col->SetWidth(colW); col->SetVisible(colVis); } } } } return B_OK; }
template <typename T> void ListWidget<T>::UpdateDimensions() { Vector2n Dimensions; for (auto & Entry : m_List) { Dimensions.X() = std::max<sint32>(Dimensions.X(), Concept::GetDimensions(Entry).X()); Dimensions.Y() += Concept::GetDimensions(Entry).Y(); } // TEST if (!m_TypingModule.GetString().empty()) { for (auto & Pointer : GetGestureRecognizer().GetConnected()) { if (Pointer::VirtualCategory::POINTING == Pointer->GetVirtualCategory()) { Dimensions.X() = std::max<sint32>(Dimensions.X(), static_cast<sint32>(m_TypingModule.GetString().length() * charWidth)); Dimensions.Y() += 1 * lineHeight; break; } } } Vector2n MinDimensions(3 * charWidth, lineHeight); Dimensions.X() = std::max<sint32>(Dimensions.X(), MinDimensions.X()); Dimensions.Y() = std::max<sint32>(Dimensions.Y(), MinDimensions.Y()); SetDimensions(Dimensions); }
/*M+M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M+++M Method: COBall::CImpIBall::Reset Summary: The Reset member method of the IBall interface implementation. Called by outside clients of a COBall object to reset the virtual ball. It is restored to the upper left corner. Args: RECT* pNewRect, Pointer to a RECT structure. Tells the COBall the bounding rectangle within which the ball can move. short nBallSize, The size of the ball in pixels. nBallSize == Width == Height meaning that a circle is assumed. Modifies: ... Returns: void M---M---M---M---M---M---M---M---M---M---M---M---M---M---M---M---M---M---M-M*/ STDMETHODIMP COBall::CImpIBall::Reset( RECT* pNewRect, short nBallSize) { HRESULT hr = E_FAIL; int nDim, xDirection, yDirection; if (OwnThis()) { // Find the thread who is executing this and remember its color. FindThread(); m_xSkew = m_ySkew = BALL_MOVE_SKEW; m_WinRect.left = pNewRect->left; m_WinRect.top = pNewRect->top; m_WinRect.right = pNewRect->right; m_WinRect.bottom = pNewRect->bottom; nDim = nBallSize ? nBallSize : max(5, m_WinRect.right / 13); SetDimensions(nDim, nDim); SetPosition(0, 0); xDirection = ((lRandom() % m_xSkew) + m_xSkew); yDirection = ((lRandom() % m_ySkew) + m_ySkew); SetDirection(xDirection, yDirection); hr = NOERROR; UnOwnThis(); } return hr; }
status_t SeqPhrasePropertyWindow::SetConfiguration(const BMessage* config) { ArpASSERT(config); status_t err = SetDimensions(config, this); if (err != B_OK) return err; return B_OK; }
void ListedTextItems::ClearEntries() { Rect oldrect = GetBoundingRect(); _items.Clear(); OnItemsClear(); SetDimensions( GetWidth(), GetH() ); }
dgSphere::dgSphere (const dgQuaternion &quat, const dgVector &position, const dgVector& dim) :dgMatrix(quat, position) { SetDimensions (dim.m_x, dim.m_y, dim.m_z); HACD_ASSERT (0); // planeTest = FrontTest; }
dgSphere::dgSphere(const dgMatrix &matrix, const dgVector& dim) :dgMatrix(matrix) { SetDimensions (dim.m_x, dim.m_y, dim.m_z); // HACD_ASSERT (0); // planeTest = FrontTest; }
//PLAYER CONSTRUCTOR/////////////////////////////////////////////////////////////////////////////////////////////////////// Player::Player(void) { m_x = 0; //positions player at provided parameters m_y = 0; SetDimensions(16, 16); SetVelocity(2.0f, 2.0f); //sets the velocity for the player Star.MoveTo(-10, -10); Star.SetDimensions(6, 6); Star.SetVelocity(0, 0); throw_time = 0; //ready to throw a throwing star health = 750; //starts at full health key = false; //does not begin with a key dead = false; //defaults to alive LoadBitMapsandMasks(); //load all the bitmaps and masks for the player animations bitmap = animations[0]; //set display bitmap to first bitmap of animation clr = 0; //clr variable defaulted to 0 - points to green eyed animations steps = 1; bitmask = masks[0]; //set display mask to first mask Initialise(); }
bool Simbox::setArea(const NRLib::Volume * volume, int nx, int ny, std::string & errText, bool scale) { double scale_value = 1.0; if (scale == true) //SGRI scale_value = 1000; double x0 = volume->GetXMin()*scale_value; double y0 = volume->GetYMin()*scale_value; double lx = volume->GetLX()*scale_value; double ly = volume->GetLY()*scale_value; double rot = volume->GetAngle(); double dx = lx/static_cast<double>(nx); double dy = ly/static_cast<double>(ny); try { SetDimensions(x0,y0,lx,ly); } catch (NRLib::Exception & e) { errText += "Could not set x0, y0, lx, and ly.\n"; errText += e.what(); return true; // Failed } try { SetAngle(rot); } catch (NRLib::Exception & e) { errText += "Could not set rotation angle.\n"; errText += e.what(); return true; // Failed } cosrot_ = cos(rot); sinrot_ = sin(rot); dx_ = dx; dy_ = dy; nx_ = static_cast<int>(0.5+lx/dx_); ny_ = static_cast<int>(0.5+ly/dy_); // In case IL/XL information is not available, we fall back // on the following base case values ... inLine0_ = -0.5; crossLine0_ = -0.5; ilStepX_ = cosrot_/dx_; ilStepY_ = sinrot_/dx_; xlStepX_ = -sinrot_/dy_; xlStepY_ = cosrot_/dy_; if(status_ == EMPTY) status_ = NODEPTH; else if(status_ == NOAREA) status_ = BOXOK; return false; // OK }
void dgSphere::SetDimensions(const dgFloat32 vertex[], dgInt32 strideInBytes, const dgInt32 triangles[], dgInt32 indexCount, const dgMatrix *basis) { dgVector eigen; dgVector scaleVector(dgFloat32(1.0f), dgFloat32(1.0f), dgFloat32(1.0f), dgFloat32(0.0f)); if (indexCount < 3) { return; } dgInt32 stride = dgInt32(strideInBytes / sizeof(dgFloat32)); if (!basis) { InternalSphere::Statistics(*this, eigen, scaleVector, vertex, triangles, indexCount, stride); dgInt32 k = 0; for (dgInt32 i = 0; i < 3; i++) { if (k >= 6) { break; } for (dgInt32 j = i + 1; j < 3; j++) { dgFloat32 aspect = InternalSphere::AspectRatio(eigen[i], eigen[j]); if (aspect > dgFloat32(0.9f)) { scaleVector[i] *= dgFloat32(2.0f); InternalSphere::Statistics(*this, eigen, scaleVector, vertex, triangles, indexCount, stride); k++; i = -1; break; } } } } else { *this = *basis; } dgVector min; dgVector max; InternalSphere::BoundingBox(*this, vertex, stride, triangles, indexCount, min, max); dgVector massCenter(max + min); massCenter = massCenter.Scale(dgFloat32(0.5f)); m_posit = TransformVector(massCenter); dgVector dim(max - min); dim = dim.Scale(dgFloat32(0.5f)); SetDimensions(dim.m_x, dim.m_y, dim.m_z); }
// ============================================================================ // ============================================================================ bool Vista2DRectangle::Init( float fPosX, float fPosY, float fWidth, float fHeight, unsigned char nRed, unsigned char nGreen, unsigned char nBlue) { bool success = SetPosition( fPosX, fPosY ); success &= SetDimensions( fWidth, fHeight ); success &= SetColor( nRed, nGreen, nBlue ); m_bIsInitialized = success; return success; }
void OgreSprite::SetScale(double x, double y) { m_scalex = (Ogre::Real)x; m_scaley = (Ogre::Real)y; SetDimensions(m_width, m_height); //m_overlay->setScale(x, y); }
static void XawScrollbarResize(Widget gw) { /* ForgetGravity has taken care of background, but thumb may * have to move as a result of the new size. */ SetDimensions((ScrollbarWidget)gw); XawScrollbarRedisplay(gw, NULL, NULL); }
//====================================================================== //====================================================================== NvUIGraphic::NvUIGraphic(const std::string& texname, float dstw/*==0*/, float dsth/*==0*/) { StaticInit(); PrivateInit(); LoadTexture(texname); if (dstw!=0) SetDimensions(dstw, dsth); }
void CFileSaveAsGraphicDlg::SetDimensions (PBOX *pbAll, PBOX *pbSell, int LogPixX, int LogPixY) { CPoint pa, ps; pa = PboxToScreen (pbAll, LogPixX, LogPixY); ps = PboxToScreen (pbSell, LogPixX, LogPixY); SetDimensions (&pa, &ps); }
void CBoard::Set(CSolitaireLayout& objLayout) { SetDimensions(objLayout.GetWidth(), objLayout.GetHeight(), objLayout.GetDepth()); for (unsigned int i = 0; i < objLayout.Size(); i++) { m_pBoard[i] = objLayout.m_pBoard[i]; } }
void ListedTextItems::Remove(int id) { if (!_items.Empty() && id>-1 && id<_items.Size() ) { _items.Remove(id); OnItemRemove(id); SetDimensions( GetWidth(), GetH() ); } }
//====================================================================== //====================================================================== NvUIGraphic::NvUIGraphic(uint32_t texId, bool alpha, uint32_t srcw, uint32_t srch, float dstw/*==0*/, float dsth/*==0*/) { StaticInit(); PrivateInit(); SetTextureID(texId, alpha, srcw, srch); if (dstw!=0) SetDimensions(dstw, dsth); }
void CEditorPanel::Layout() { float flWidth = glgui::CRootPanel::Get()->GetWidth(); float flHeight = glgui::CRootPanel::Get()->GetHeight(); float flMenuBarBottom = glgui::CRootPanel::Get()->GetMenuBar()->GetBottom(); float flCurrLeft = 20; float flCurrTop = flMenuBarBottom + 10; SetDimensions(flCurrLeft, flCurrTop, 200, flHeight-30-flMenuBarBottom); m_hEntities->SetPos(10, 10); m_hEntities->SetSize(GetWidth() - 20, 200); m_hEntities->ClearTree(); CLevel* pLevel = LevelEditor()->GetLevel(); if (pLevel) { auto& aEntities = pLevel->GetEntityData(); for (size_t i = 0; i < aEntities.size(); i++) { auto& oEntity = aEntities[i]; tstring sName = oEntity.GetParameterValue("Name"); tstring sModel = oEntity.GetParameterValue("Model"); if (sName.length()) m_hEntities->AddNode(oEntity.GetClass() + ": " + sName); else if (sModel.length()) m_hEntities->AddNode(oEntity.GetClass() + " (" + GetFilename(sModel) + ")"); else m_hEntities->AddNode(oEntity.GetClass()); } } m_hObjectTitle->SetPos(0, 220); m_hObjectTitle->SetSize(GetWidth(), 25); float flTempMargin = 5; m_hSlider->Layout_AlignTop(m_hObjectTitle, flTempMargin); m_hSlider->Layout_FullWidth(flTempMargin); m_hSlider->SetBottom(GetHeight() - flTempMargin); flTempMargin = 2; m_hPropertiesPanel->Layout_AlignTop(nullptr, flTempMargin); m_hPropertiesPanel->Layout_FullWidth(flTempMargin); LayoutEntity(); BaseClass::Layout(); }
bool Simbox::setArea(const SegyGeometry * geometry, std::string & errText) { double x0 = geometry->GetX0(); double y0 = geometry->GetY0(); double lx = geometry->Getlx(); double ly = geometry->Getly(); double rot = geometry->GetAngle(); double dx = geometry->GetDx(); double dy = geometry->GetDy(); try { SetDimensions(x0,y0,lx,ly); } catch (NRLib::Exception & e) { errText += "Could not set x0, y0, lx, and ly.\n"; errText += e.what(); return true; // Failed } try { SetAngle(rot); } catch (NRLib::Exception & e) { errText += "Could not set rotation angle.\n"; errText += e.what(); return true; // Failed } cosrot_ = cos(rot); sinrot_ = sin(rot); dx_ = dx; dy_ = dy; nx_ = static_cast<int>(0.5+lx/dx_); ny_ = static_cast<int>(0.5+ly/dy_); // In case IL/XL information is not available, we fall back // on the following base case values ... inLine0_ = -0.5; crossLine0_ = -0.5; ilStepX_ = cosrot_/dx_; ilStepY_ = sinrot_/dx_; xlStepX_ = -sinrot_/dy_; xlStepY_ = cosrot_/dy_; if(status_ == EMPTY) status_ = NODEPTH; else if(status_ == NOAREA) status_ = BOXOK; return false; // OK }
CBoard& CBoard::operator=(const CBoard & brd) { SetDimensions(brd.m_nWidth, brd.m_nHeight, brd.m_nDepth); for (unsigned int i = 0; i < Size(); i++) { m_pBoard[i] = brd.m_pBoard[i]; } return *this; }
Image<T> &Image<T>::operator=(const Image<T> &iImageObject) { long iRows, iColumns; iImageObject.GetDimensions(iRows, iColumns); if(SetDimensions(iRows, iColumns)) { memcpy(m_buffer, iImageObject.GetBuffer(), iRows*iColumns*sizeof(T)); } //Update(); m_rangeUpToDate = false; return *this; }
void dgSphere::SetDimensions ( const dgFloat32 vertex[], dgInt32 strideInBytes, dgInt32 count, const dgMatrix *basis) { dgInt32 i; dgInt32 j; dgInt32 k; dgInt32 stride; dgFloat32 aspect; dgVector eigen; dgVector scaleVector (1.0f, 1.0f, 1.0f, 0.0f); stride = dgInt32 (strideInBytes / sizeof (dgFloat32)); if (!basis) { InternalSphere::Statistics (*this, eigen, scaleVector, vertex, count, stride); k = 0; for (i = 0; i < 3; i ++) { if (k >= 6) { break; } for (j = i + 1; j < 3; j ++) { aspect = InternalSphere::AspectRatio (eigen[i], eigen[j]); if (aspect > 0.9) { scaleVector[i] *= 2.0f; InternalSphere::Statistics (*this, eigen, scaleVector, vertex, count, stride); k ++; i = -1; break; } } } } else { *this = *basis; } dgVector min; dgVector max; InternalSphere::BoundingBox (*this, vertex, count, stride, min, max); dgVector massCenter (max + min); massCenter = massCenter.Scale (0.5); m_posit = TransformVector (massCenter); dgVector dim (max - min); dim = dim.Scale (0.5f); SetDimensions (dim.m_x + InternalSphere::SPHERE_TOL, dim.m_y + InternalSphere::SPHERE_TOL, dim.m_z + InternalSphere::SPHERE_TOL); }
RollerWidget::RollerWidget( const RefImage &ref_image, int range ) { _range = range; _value = 0; _offset = 0; _currentValue = 0; _rollSpeed = 1.0; _rollDir = 1.0; _sp_image = dynamic_cast<ImageBase*>( ref_image.get().Copy().Release() ); SetDimensions( _sp_image->GetWidth(), _sp_image->GetHeight()/(_range+1) ); Tie2Signal( OnIdle, this, &RollerWidget::Tick ); }
bool ImageBMPFile::LoadWindowsBitmap (uint8* iBuffer, size_t iSize) { SetDimensions (BIWIDTH(iBuffer), BIHEIGHT(iBuffer)); const int bmp_size = Width * Height; uint8 *iPtr = iBuffer + BFOFFBITS(iBuffer); // No alpha for BMP... at least not always Format &= ~CS_IMGFMT_ALPHA; // The last scanline in BMP corresponds to the top line in the image int buffer_y = Width * (Height - 1); bool blip = false; if (BITCOUNT(iBuffer) == _16Color) { uint8 *buffer = new uint8 [bmp_size]; csRGBpixel *palette = new csRGBpixel [16]; csRGBpixel *pwork = palette; uint8 *inpal = BIPALETTE(iBuffer); int scanlinewidth = 4 * ((Width+6) / 8); int color; for (color = 0; color < 16; color++, pwork++) { // Whacky BMP palette is in BGR order. pwork->blue = *inpal++; pwork->green = *inpal++; pwork->red = *inpal++; inpal++; // Skip unused byte. } if (BICOMP(iBuffer) == BI_RGB) { // Read the pixels from "top" to "bottom" while (iPtr < iBuffer + iSize && buffer_y >= 0) { uint8 *bufptr = buffer + buffer_y; for (int x = 0; x < Width; x++) { if (x & 0x1) { *bufptr++ = (*(iPtr + (x >> 1))) & 0xf; } else { *bufptr++ = (*(iPtr + (x >> 1))) >> 4; } } iPtr += scanlinewidth; buffer_y -= Width; } /* endwhile */
Label::Label(Renderer* pRenderer, unsigned int GUIFont, const std::string &label, Colour colour) : Component(pRenderer), m_GUIFont(GUIFont), m_colour(colour) { SetText(label); SetVerticalAlignment(eVerticalAlignment_Center); SetHorizontalAlignment(eHorizontalAlignment_Left); // Set default dimensions SetDimensions(0, 0, 1, 1); m_outline = false; }
Image<T>::Image(long iRows/*=0 in*/, long iColumns/*=0 in*/) { m_numOfBits = 8*sizeof(T); SetDimensions(iRows, iColumns); m_type = kPgDataObjectTypeImage; m_rangeUpToDate = false; PGCore::PixelBase<T> tPixel; m_minValue = tPixel.GetMinValue();// 0 m_maxValue = tPixel.GetMinValue();// 0 }