void CTerrain::Initialize() { listter.push_back(this); nangle = 0; setImage("item", type); density = true; if(_img != NULL) setDimensions(_img->w, _img->h); else setDimensions(0, 0); }
void Widget::addHeight(point_type h) { if(_coordMode == CM_ABSOLUTE) setDimensions( -1.0f, -1.0f, -1.0f, MACRO_WIDGET_H(_verts()) + h ); else setDimensions(-1.0f, -1.0f, -1.0f, _relCoords[3] + h); }
void Widget::addOrigin(point_type x, point_type y) { if(_coordMode == CM_ABSOLUTE) { PointArray* verts = _verts(); setDimensions( MACRO_WIDGET_X(verts) + x, MACRO_WIDGET_Y(verts) + y ); } else setDimensions(_relCoords[0] + x, _relCoords[1] + y); }
/*! * Reads meta data of VTU file (grid size, data fields, codex, position of data within file). * Calls setDimension. */ void VTKUnstructuredGrid::readMetaData( ){ std::fstream str; std::string line, temp; std::fstream::pos_type position; str.open( fh.getPath( ), std::ios::in ) ; getline( str, line); while( ! bitpit::utils::keywordInString( line, "<VTKFile")){ getline(str, line); }; if( bitpit::utils::getAfterKeyword( line, "header_type", '\"', temp) ){ setHeaderType( temp) ; }; while( ! bitpit::utils::keywordInString( line, "<Piece")){ getline(str, line); }; bitpit::utils::getAfterKeyword( line, "NumberOfPoints", '\"', temp) ; bitpit::utils::convertString( temp, nr_points ); bitpit::utils::getAfterKeyword( line, "NumberOfCells", '\"', temp) ; bitpit::utils::convertString( temp, nr_cells ); position = str.tellg() ; readDataHeader( str ) ; for( auto &field : geometry ){ str.seekg( position) ; if( ! readDataArray( str, *field ) ) { std::cout << field->getName() << " DataArray not found" << std::endl ; }; }; str.close() ; if( homogeneousType == VTKElementType::UNDEFINED) { setDimensions( nr_cells, nr_points, calcSizeConnectivity() ) ; } else { setDimensions( nr_cells, nr_points ) ; }; return ; };
void LightEntityItem::setIsSpotlight(bool value) { if (value != _isSpotlight) { _isSpotlight = value; if (_isSpotlight) { const float length = getDimensions().z; const float width = length * glm::sin(glm::radians(_cutoff)); setDimensions(glm::vec3(width, width, length)); } else { float maxDimension = glm::max(getDimensions().x, getDimensions().y, getDimensions().z); setDimensions(glm::vec3(maxDimension, maxDimension, maxDimension)); } } }
void Widget::addSize(point_type w, point_type h) { if(_coordMode == CM_ABSOLUTE) { PointArray* verts = _verts(); setDimensions( -1.0f, -1.0f, MACRO_WIDGET_W(verts) + w, MACRO_WIDGET_H(verts) + h ); } else setDimensions(-1.0f, -1.0f, _relCoords[2] + w, _relCoords[3] + h); }
void Label::setFontDefinition(const FontDefinition& textDefinition) { _systemFont = textDefinition._fontName; _systemFontSize = textDefinition._fontSize; _hAlignment = textDefinition._alignment; _vAlignment = textDefinition._vertAlignment; setDimensions(textDefinition._dimensions.width, textDefinition._dimensions.height); Color4B textColor = Color4B(textDefinition._fontFillColor); textColor.a = textDefinition._fontAlpha; setTextColor(textColor); #if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) if (textDefinition._stroke._strokeEnabled) { CCLOGERROR("Currently only supported on iOS and Android!"); } _outlineSize = 0.f; #else if (textDefinition._stroke._strokeEnabled && textDefinition._stroke._strokeSize > 0.f) { Color4B outlineColor = Color4B(textDefinition._stroke._strokeColor); outlineColor.a = textDefinition._stroke._strokeAlpha; enableOutline(outlineColor, textDefinition._stroke._strokeSize); } #endif if (textDefinition._shadow._shadowEnabled) { enableShadow(Color4B(0, 0, 0, 255 * textDefinition._shadow._shadowOpacity), textDefinition._shadow._shadowOffset, textDefinition._shadow._shadowBlur); } }
/*! * sets the size of the unstructured grid for a homogenous grid. * @param[in] ncells_ number of cells * @param[in] npoints_ number of points * @param[in] type_ typeof element in grid */ void VTKUnstructuredGrid::setDimensions( uint64_t ncells_, uint64_t npoints_, VTKElementType type_ ){ setElementType( type_ ); setDimensions( ncells_, npoints_ ); return ; };
// set the identity matrix of dimension n void Matrix::setIdentityMatrix( int n ) { assert( n > 0 ); setDimensions( n, n ); setZero(); for ( int i = 0; i < n; i++ ) setElement( i, i, 1.0 ); }
void Text::setText(std::string text){ myText = text; int n = 0; std::vector<std::string> textLines; std::string substring = text; while(n != std::string::npos){ n = substring.find('\n', 0); textLines.push_back(substring.substr(0, n)); substring = substring.substr(n + 1, std::string::npos); } numLines = textLines.size(); image.clear(); for(unsigned int i = 0; i < textLines.size(); i++) image.push_back(TTF_RenderText_Blended(font, textLines.at(i).c_str(), color)); int wtemp, w = 0; for(unsigned int i = 0; i < textLines.size(); i++){ TTF_SizeText(this->font, textLines.at(i).c_str(), &wtemp, NULL); if(wtemp > w) w = wtemp; } int h = 10; lineSkip = TTF_FontLineSkip(font); h = (textLines.size() - 1) * lineSkip + h; setDimensions(w, h); }
void CImgLayerRAMLoader::updateRepresentation(std::shared_ptr<DataRepresentation> dest) const { auto layerDst = std::static_pointer_cast<LayerRAM>(dest); if (layerDisk_->getDimensions() != layerDst->getDimensions()) { layerDst->setDimensions(layerDisk_->getDimensions()); } uvec2 dimensions = layerDisk_->getDimensions(); DataFormatId formatId = DataFormatId::NotSpecialized; std::string filePath = layerDisk_->getSourceFile(); if (!filesystem::fileExists(filePath)) { std::string newPath = filesystem::addBasePath(filePath); if (filesystem::fileExists(newPath)) { filePath = newPath; } else { throw DataReaderException("Error could not find input file: " + filePath, IvwContext); } } if (dimensions != uvec2(0)) { // Load and rescale to input dimensions CImgUtils::loadLayerData(layerDst->getData(), filePath, dimensions, formatId, true); } else { // Load to original dimensions CImgUtils::loadLayerData(layerDst->getData(), filePath, dimensions, formatId, false); layerDisk_->setDimensions(dimensions); } layerDisk_->updateDataFormat(DataFormatBase::get(formatId)); }
Grid::Grid(const IntVector& dimensions) : dimensions_(0), offsets_(0), size_(0) { setDimensions(dimensions); }
//------------------------------------------------ void guiTypeMultiToggle::setup(string multiToggleName, string xmlNameIn, int defaultBox, vector <string> boxNames){ bNames = boxNames; value.addValue( (int)defaultBox, 0, bNames.size()-1); name = multiToggleName; xmlName = xmlNameIn; float lineHeight = 0; for(unsigned int i = 0; i < bNames.size(); i++){ float lineWidth = boxSpacing + boxSize + displayText.stringWidth(bNames[i]); if( lineWidth > hitArea.width ){ hitArea.width += lineWidth-hitArea.width; boundingBox.width += lineWidth-hitArea.width; } lineHeight += displayText.stringHeight(bNames[i]); } if(lineHeight > hitArea.height){ hitArea.height += lineHeight-hitArea.height; boundingBox.height += lineHeight-hitArea.height; } setDimensions(180, bNames.size()*(guiTypeMultiToggle::boxSize + guiTypeMultiToggle::boxSpacing) + 2); }
GPURGB2YUVFilter::GPURGB2YUVFilter(const IntPoint& size) : GPUFilter(SHADERID, false, false) { ObjectCounter::get()->incRef(&typeid(*this)); setDimensions(size); }
bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Size& dimensions, TextHAlignment alignment, const std::string& fontName, float fontSize) { setDimensions(dimensions.width, dimensions.height); setAlignment(alignment, TextVAlignment::CENTER); return initWithPlaceHolder(placeholder, fontName, fontSize); }
void CButton::Initialize() { image_state = getType(); setImage("button", image_state); UpdateImage(); setDimensions(_img->w, _img->h); }
void ChangePhoneBox::EnterCode::prepare() { setTitle(langFactory(lng_change_phone_title)); auto descriptionText = lng_change_phone_code_description(lt_phone, textcmdStartSemibold() + App::formatPhone(_phone) + textcmdStopSemibold()); auto description = object_ptr<Ui::FlatLabel>(this, descriptionText, Ui::FlatLabel::InitType::Rich, st::changePhoneLabel); description->moveToLeft(st::boxPadding.left(), 0); auto phoneValue = QString(); _code.create(this, st::defaultInputField, langFactory(lng_change_phone_code_title), phoneValue); _code->setAutoSubmit(_codeLength, [=] { submit(); }); _code->setChangedCallback([=] { hideError(); }); _code->resize(st::boxWidth - 2 * st::boxPadding.left(), _code->height()); _code->moveToLeft(st::boxPadding.left(), description->bottomNoMargins()); connect(_code, &Ui::InputField::submitted, [=] { submit(); }); setDimensions(st::boxWidth, countHeight()); if (_callTimeout > 0) { _call.setStatus({ SentCodeCall::State::Waiting, _callTimeout }); updateCall(); } addButton(langFactory(lng_change_phone_new_submit), [=] { submit(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); }); }
void BitmapSequence::loadDir(string inDir){ dir.listDir( inDir ); dir.sort(); if( !dir.size() ){ cout << "BitmapSequence::loadDir::no files in:" << inDir << "\n"; } else{ int numFiles = dir.size(); for (int i = 0 ; i < numFiles; i++ ){ string curFile = dir.getPath( i ); ofImage* curImage = new ofImage(); bool loaded = false; try { loaded = curImage->loadImage( curFile ); } catch ( std::exception& e ) { cout << "BitmapSequence::loadDir::Error trying to load image from:" << inDir<< "\n"; } if ( loaded ){ images.push_back(curImage); } else{ delete curImage;//since we called new, we have to explicitly destroy } } totalFrames = images.size(); //cout <<"BitmapSequence::loadDir::filesLoaded:" << totalFrames << "\n"; } setDimensions(); }
GPUBlurFilter::GPUBlurFilter(const IntPoint& size, PixelFormat pfSrc, PixelFormat pfDest, float stdDev, bool bClipBorders, bool bStandalone, bool bUseFloatKernel) : GPUFilter(pfSrc, pfDest, bStandalone, SHADERID_HORIZ, 2), m_bClipBorders(bClipBorders), m_bUseFloatKernel(bUseFloatKernel) { ObjectCounter::get()->incRef(&typeid(*this)); GLContext::getCurrent()->ensureFullShaders("GPUBlurFilter"); #ifndef AVG_ENABLE_EGL if (!m_bClipBorders) { //TODO: TO_BORDER DOES NOT EXIST IN GLESV2 m_WrapMode = WrapMode(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER); } #endif setDimensions(size, stdDev); GLContextManager* pCM = GLContextManager::get(); pCM->createShader(SHADERID_VERT); setStdDev(stdDev); m_pHorizWidthParam = pCM->createShaderParam<float>(SHADERID_HORIZ, "u_Width"); m_pHorizRadiusParam = pCM->createShaderParam<int>(SHADERID_HORIZ, "u_Radius"); m_pHorizTextureParam = pCM->createShaderParam<int>(SHADERID_HORIZ, "u_Texture"); m_pHorizKernelTexParam = pCM->createShaderParam<int>(SHADERID_HORIZ, "u_KernelTex"); m_pVertWidthParam = pCM->createShaderParam<float>(SHADERID_VERT, "u_Width"); m_pVertRadiusParam = pCM->createShaderParam<int>(SHADERID_VERT, "u_Radius"); m_pVertTextureParam = pCM->createShaderParam<int>(SHADERID_VERT, "u_Texture"); m_pVertKernelTexParam = pCM->createShaderParam<int>(SHADERID_VERT, "u_KernelTex"); }
Label* Label::create(const std::string& text, const std::string& fontName, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */) { auto ret = new Label(nullptr,hAlignment,vAlignment); if (ret) { do { if (FileUtils::getInstance()->isFileExist(fontName)) { TTFConfig ttfConfig(fontName.c_str(),fontSize,GlyphCollection::DYNAMIC); if (ret->setTTFConfig(ttfConfig)) { break; } } FontDefinition fontDef; fontDef._fontName = fontName; fontDef._fontSize = fontSize; fontDef._dimensions = dimensions; fontDef._alignment = hAlignment; fontDef._vertAlignment = vAlignment; ret->setFontDefinition(fontDef); } while (0); ret->setDimensions(dimensions.width,dimensions.height); ret->setString(text); ret->autorelease(); } return ret; }
// Constructor with parameters deskInfo::deskInfo(elementList *element, unsigned int rows, unsigned int columns, unsigned int maxLineLength, string helpText) { setElementList(element); setDimensions(rows, columns); setMaxLineLength(maxLineLength); setDrawContinous(false); setHelpText(helpText); }
void ConfirmPhoneBox::prepare() { _about.create(this, st::confirmPhoneAboutLabel); TextWithEntities aboutText; auto formattedPhone = App::formatPhone(_phone); aboutText.text = lng_confirm_phone_about(lt_phone, formattedPhone); auto phonePosition = aboutText.text.indexOf(formattedPhone); if (phonePosition >= 0) { aboutText.entities.push_back(EntityInText(EntityInTextBold, phonePosition, formattedPhone.size())); } _about->setMarkedText(aboutText); _code.create(this, st::confirmPhoneCodeField, lang(lng_code_ph)); setTitle(lang(lng_confirm_phone_title)); addButton(lang(lng_confirm_phone_send), [this] { onSendCode(); }); addButton(lang(lng_cancel), [this] { closeBox(); }); setDimensions(st::boxWidth, st::usernamePadding.top() + _code->height() + st::usernameSkip + _about->height() + st::usernameSkip); connect(_code, SIGNAL(changed()), this, SLOT(onCodeChanged())); connect(_code, SIGNAL(submitted(bool)), this, SLOT(onSendCode())); connect(_callTimer, SIGNAL(timeout()), this, SLOT(onCallStatusTimer())); showChildren(); }
// Parameterless constructor deskInfo::deskInfo() { setDimensions(0, 0); setMaxLineLength(0); setMenuLines(0); setDrawContinous(false); setHelpText('\0'); }
void DBConsole::init() { //Init Vars firstTimeMillis = getSystemCurrTimeMillis(); //Init KeyStates for(int p = 0; p < (sizeof(currKeyStates)/sizeof(bool)); p++) { currKeyStates[p] = false; } // Init Arrays for (int x = 0; x < BUFFER_W; x++) { for (int y = 0; y < BUFFER_H; y++) { buffer[x][y] = ' '; display[x][y] = ' '; } } // Hide Cursor showConsoleCursor(false); // Set Size setDimensions(BUFFER_W, BUFFER_H); //Show Console if (! SHOWCONSOLE) { hideConsole(); } }
void LightEntityItem::setIsSpotlight(bool value) { if (value != _isSpotlight) { _isSpotlight = value; glm::vec3 dimensions = getDimensions(); if (_isSpotlight) { const float length = dimensions.z; const float width = length * glm::sin(glm::radians(_cutoff)); setDimensions(glm::vec3(width, width, length)); } else { float maxDimension = glm::compMax(dimensions); setDimensions(glm::vec3(maxDimension, maxDimension, maxDimension)); } _lightPropertiesChanged = true; } }
void Volume3DOverlay::setProperties(const QVariantMap& properties) { Base3DOverlay::setProperties(properties); auto dimensions = properties["dimensions"]; // if "dimensions" property was not there, check to see if they included aliases: scale, size if (!dimensions.isValid()) { dimensions = properties["scale"]; if (!dimensions.isValid()) { dimensions = properties["size"]; } } if (dimensions.isValid()) { glm::vec3 scale = vec3FromVariant(dimensions); // don't allow a zero or negative dimension component to reach the renderTransform const float MIN_DIMENSION = 0.0001f; if (scale.x < MIN_DIMENSION) { scale.x = MIN_DIMENSION; } if (scale.y < MIN_DIMENSION) { scale.y = MIN_DIMENSION; } if (scale.z < MIN_DIMENSION) { scale.z = MIN_DIMENSION; } setDimensions(scale); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void GenericExample::readFilterParameters(AbstractFilterParametersReader* reader, int index) { /* FILTER_WIDGETCODEGEN_AUTO_GENERATED_CODE BEGIN*/ reader->openFilterGroup(this, index); setStlFilePrefix( reader->readValue("StlFilePrefix", getStlFilePrefix()) ); setMaxIterations( reader->readValue("MaxIterations", getMaxIterations()) ); setMisorientationTolerance( reader->readValue("MisorientationTolerance", getMisorientationTolerance()) ); setInputFile( reader->readValue("InputFile", getInputFile()) ); setInputPath( reader->readValue("InputPath", getInputPath()) ); setOutputFile( reader->readValue("OutputFile", getOutputFile()) ); setOutputPath( reader->readValue("OutputPath", getOutputPath()) ); setWriteAlignmentShifts( reader->readValue("WriteAlignmentShifts", getWriteAlignmentShifts()) ); setConversionType( reader->readValue("ConversionType", getConversionType()) ); setDimensions( reader->readValue("Dimensions", getDimensions()) ); setOrigin( reader->readValue("Origin", getOrigin()) ); setCrystalSymmetryRotations( reader->readValue("CrystalSymmetryRotations", getCrystalSymmetryRotations()) ); setSelectedVoxelCellArrayName( reader->readValue("SelectedVoxelCellArrayName", getSelectedVoxelCellArrayName()) ); setSelectedVoxelFieldArrayName( reader->readValue("SelectedVoxelFieldArrayName", getSelectedVoxelFieldArrayName()) ); setSelectedVoxelEnsembleArrayName( reader->readValue("SelectedVoxelEnsembleArrayName", getSelectedVoxelEnsembleArrayName()) ); setSelectedSurfaceMeshPointArrayName( reader->readValue("SelectedSurfaceMeshPointArrayName", getSelectedSurfaceMeshPointArrayName()) ); setSelectedSurfaceMeshFaceArrayName( reader->readValue("SelectedSurfaceMeshFaceArrayName", getSelectedSurfaceMeshFaceArrayName()) ); setSelectedSurfaceMeshEdgeArrayName( reader->readValue("SelectedSurfaceMeshEdgeArrayName", getSelectedSurfaceMeshEdgeArrayName()) ); setSelectedSolidMeshPointArrayName( reader->readValue("SelectedSolidMeshPointArrayName", getSelectedSolidMeshPointArrayName()) ); setSelectedSolidMeshFaceArrayName( reader->readValue("SelectedSolidMeshFaceArrayName", getSelectedSolidMeshFaceArrayName()) ); setSelectedSolidMeshEdgeArrayName( reader->readValue("SelectedSolidMeshEdgeArrayName", getSelectedSolidMeshEdgeArrayName()) ); setStrVector( reader->readValue("StrVector", getStrVector() ) ); reader->closeFilterGroup(); }
//------------------------------------------------ void guiTypeButtonSlider::setup(string buttonSliderName, string xmlName, float panelWidth, float panelHeight, float defaultVal, float min, float max, bool isInt){ /* slider setup */ slider = new guiTypeSlider(); slider->setup(buttonSliderName, xmlName, defaultVal, min, max); value.addValue(defaultVal, min, max); slider->setDimensions(180, 10); if(isInt){ slider->setTypeInt(); }else{ slider->setTypeFloat(); } slider->setFont(displayText.ourFont); /* left button setup */ leftButton = new guiTypeMinusButton(); leftButton->setup(buttonSliderName+string("1"), xmlName+string("1"), false); leftButton->setDimensions(10, 10); leftButton->setTypeBool(); leftButton->setShowText(false); /* right button setup */ rightButton = new guiTypePlusButton(); rightButton->setup(buttonSliderName+string("2"), xmlName+string("2"), false); rightButton->setDimensions(10, 10); rightButton->setTypeBool(); rightButton->setShowText(false); name = buttonSliderName; setDimensions(panelWidth, panelHeight); }
void PeerListBox::prepare() { setContent(setInnerWidget( object_ptr<PeerListContent>( this, _controller.get(), st::peerListBox), st::boxLayerScroll)); content()->resizeToWidth(st::boxWideWidth); _controller->setDelegate(this); setDimensions(st::boxWideWidth, st::boxMaxListHeight); if (_select) { _select->finishAnimating(); Ui::SendPendingMoveResizeEvents(_select); _scrollBottomFixed = true; onScrollToY(0); } content()->scrollToRequests( ) | rpl::start_with_next([this](Ui::ScrollToRequest request) { onScrollToY(request.ymin, request.ymax); }, lifetime()); if (_init) { _init(this); } }
// set the diagonal matrix void Matrix::setDiagonalMatrix( const vector< double >& diag ) { int n = diag.size(); setDimensions( n, n ); setZero(); for ( int i = 0; i < n; i++ ) setElement( i, i, diag[ i ] ); }