本文整理汇总了C++中TileLayer::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ TileLayer::rotate方法的具体用法?C++ TileLayer::rotate怎么用?C++ TileLayer::rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileLayer
的用法示例。
在下文中一共展示了TileLayer::rotate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rotated
/**
* Returns a new stamp where all variations have been rotated in the given
* \a direction.
*/
TileStamp TileStamp::rotated(RotateDirection direction) const
{
TileStamp rotated(*this);
rotated.d.detach();
for (const TileStampVariation &variation : rotated.variations()) {
const QRect mapRect(QPoint(), variation.map->size());
QSize rotatedSize;
for (auto layer : variation.map->tileLayers()) {
TileLayer *tileLayer = static_cast<TileLayer*>(layer);
// Synchronize tile layer size to map size (assumes map contains all layers)
if (tileLayer->rect() != mapRect) {
tileLayer->resize(mapRect.size(), tileLayer->position());
tileLayer->setPosition(0, 0);
}
if (variation.map->orientation() == Map::Hexagonal)
tileLayer->rotateHexagonal(direction, variation.map);
else
tileLayer->rotate(direction);
rotatedSize = tileLayer->size();
}
variation.map->setWidth(rotatedSize.width());
variation.map->setHeight(rotatedSize.height());
}
return rotated;
}
示例2: rotated
/**
* Returns a new stamp where all variations have been rotated in the given
* \a direction.
*/
TileStamp TileStamp::rotated(RotateDirection direction) const
{
TileStamp rotated(*this);
rotated.d.detach();
foreach (const TileStampVariation &variation, rotated.variations()) {
TileLayer *layer = static_cast<TileLayer*>(variation.map->layerAt(0));
layer->rotate(direction);
variation.map->setWidth(layer->width());
variation.map->setHeight(layer->height());
}
return rotated;
}
示例3: rotated
/**
* Returns a new stamp where all variations have been rotated in the given
* \a direction.
*/
TileStamp TileStamp::rotated(RotateDirection direction) const
{
TileStamp rotated(*this);
rotated.d.detach();
for (const TileStampVariation &variation : rotated.variations()) {
TileLayer *layer = variation.tileLayer();
if (variation.map->orientation() == Map::Hexagonal)
layer->rotateHexagonal(direction, variation.map);
else
layer->rotate(direction);
variation.map->setWidth(layer->width());
variation.map->setHeight(layer->height());
}
return rotated;
}