本文整理汇总了C++中std::shared_ptr::ApplyVisitor方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::ApplyVisitor方法的具体用法?C++ shared_ptr::ApplyVisitor怎么用?C++ shared_ptr::ApplyVisitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::ApplyVisitor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: linksVisitor
void touchmind::print::XPSPrint::_PrintNodes(const std::shared_ptr<touchmind::model::node::NodeModel> &node)
{
PrintChildrenLinksVisitor linksVisitor(this);
node->ApplyVisitor(linksVisitor);
PrintNodeVisitor printNodeVisitor(this);
node->ApplyVisitor(printNodeVisitor);
}
示例2: visitor
void touchmind::converter::NodeModelToTextConverter::ToText(
const std::shared_ptr<touchmind::model::node::NodeModel> &node, std::wstring &text) {
std::wostringstream stream;
ConvertToTextTreeVisitor visitor(stream);
node->ApplyVisitor(visitor, true);
text = stream.str();
}
示例3: if
void touchmind::print::XPSGeometryBuilder::CalculateTransformMatrix(
const XPS_SIZE &pageSize,
const XPSPRINT_MARGIN &xpsMargin,
std::shared_ptr<touchmind::model::node::NodeModel> node,
OUT XPS_MATRIX &xpsMatrix,
OUT FLOAT &scale)
{
touchmind::layout::TreeRectVisitor treeRectVisitor;
node->ApplyVisitor(treeRectVisitor);
FLOAT width_p = pageSize.width - xpsMargin.left - xpsMargin.right;
FLOAT height_p = pageSize.height - xpsMargin.top - xpsMargin.bottom;
FLOAT width_m = treeRectVisitor.treeRect.x2 - treeRectVisitor.treeRect.x1;
FLOAT height_m = treeRectVisitor.treeRect.y2 - treeRectVisitor.treeRect.y1;
D2D1_MATRIX_3X2_F translationMatrix;
D2D1_MATRIX_3X2_F scaleMatrix;
FLOAT rx = width_p / width_m;
FLOAT ry = height_p / height_m;
FLOAT cx = treeRectVisitor.treeRect.x1 + width_m / 2.0f;
FLOAT cy = treeRectVisitor.treeRect.y1 + height_m / 2.0f;
if (rx >= 1.0f && ry >= 1.0f) {
translationMatrix = D2D1::Matrix3x2F::Translation(
width_p / 2.0f + xpsMargin.left - cx,
height_p / 2.0f + xpsMargin.top - cy );
scale = 1.0f;
} else if (rx < ry) {
translationMatrix = D2D1::Matrix3x2F::Translation(
width_p / 2.0f + xpsMargin.left - cx * rx,
height_p / 2.0f + xpsMargin.top - cy * rx );
scale = rx;
} else {
translationMatrix = D2D1::Matrix3x2F::Translation(
width_p / 2.0f + xpsMargin.left - cx * ry,
height_p / 2.0f + xpsMargin.top - cy * ry );
scale = ry;
}
scaleMatrix = D2D1::Matrix3x2F::Scale(scale, scale, D2D1::Point2F(0.0f, 0.0f));
D2D1_MATRIX_3X2_F matrix = scaleMatrix * translationMatrix;
xpsMatrix.m11 = matrix._11;
xpsMatrix.m12 = matrix._12;
xpsMatrix.m21 = matrix._21;
xpsMatrix.m22 = matrix._22;
xpsMatrix.m31 = matrix._31;
xpsMatrix.m32 = matrix._32;
}