本文整理汇总了C++中setDimensions函数的典型用法代码示例。如果您正苦于以下问题:C++ setDimensions函数的具体用法?C++ setDimensions怎么用?C++ setDimensions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setDimensions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setImage
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);
}
示例2: MACRO_WIDGET_H
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);
}
示例3: _verts
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);
}
示例4: getline
/*!
* 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 ;
};
示例5: getDimensions
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));
}
}
}
示例6: setDimensions
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);
}
}
示例7: setElementType
/*!
* 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 ;
};
示例8: assert
// 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 );
}
示例9: while
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);
}
示例10: DataReaderException
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));
}
示例11: dimensions_
Grid::Grid(const IntVector& dimensions)
: dimensions_(0),
offsets_(0),
size_(0)
{
setDimensions(dimensions);
}
示例12: setDimensions
//------------------------------------------------
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);
}
示例13: GPUFilter
GPURGB2YUVFilter::GPURGB2YUVFilter(const IntPoint& size)
: GPUFilter(SHADERID, false, false)
{
ObjectCounter::get()->incRef(&typeid(*this));
setDimensions(size);
}
示例14: setDimensions
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);
}
示例15: getType
void CButton::Initialize()
{
image_state = getType();
setImage("button", image_state);
UpdateImage();
setDimensions(_img->w, _img->h);
}