本文整理汇总了C++中Axis::SetRange方法的典型用法代码示例。如果您正苦于以下问题:C++ Axis::SetRange方法的具体用法?C++ Axis::SetRange怎么用?C++ Axis::SetRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::SetRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZoomAt
//screen-to-space, done for 2D for now
void SpaceND::ZoomAt(double rx, double ry, double xfactor, double yfactor)
{
DPRINTF("ZoomAt\n");
Axis *xaxis;
Axis *yaxis;
xaxis = m_axes[0];//let x be 1st dimension
yaxis = m_axes[1];//let y be 2nd dimension
double offs, range, x, y;
range = xaxis->GetRange();
offs = xaxis->GetOffset();
x = offs + range * rx;
if (xaxis->GetCommonScale() != NULL)
{
if (xaxis->GetCommonScale()->IsInRange(range * xfactor))
{
xaxis->SetOffset(x - (x - offs) * xfactor);
xaxis->SetRange(range * xfactor);
xaxis->PropagateToCommonScale();
}
}
else
{
xaxis->SetOffset(x - (x - offs) * xfactor);
xaxis->SetRange(range * xfactor);
xaxis->PropagateToCommonScale();
}
range = yaxis->GetRange();
offs = yaxis->GetOffset();
y = offs + range * ry;
if (yaxis->GetCommonScale() != NULL)
{
if (yaxis->GetCommonScale()->IsInRange(range * yfactor))
{
yaxis->SetOffset(y - (y - offs) * yfactor);
yaxis->SetRange(range * yfactor);
yaxis->PropagateToCommonScale();
}
}
else
{
yaxis->SetOffset(y - (y - offs) * yfactor);
yaxis->SetRange(range * yfactor);
yaxis->PropagateToCommonScale();
}
}
示例2: ZoomSelection
void SpaceND::ZoomSelection(double start_rx, double start_ry, double end_rx, double end_ry)
{
DPRINTF("SpaceND::ZoomSelection\n");
Axis *xaxis;
Axis *yaxis;
xaxis = m_axes[AXIS_X]; //let x be 1st dimension
yaxis = m_axes[AXIS_Y]; //let y be 2nd dimension
double temp;
temp = start_rx;
if (start_rx > end_rx)
{
start_rx = end_rx;
end_rx = temp;
}
temp = start_ry;
if (start_ry > end_ry)
{
start_ry = end_ry;
end_ry = temp;
}
//TO DO: need to review this code
if (xaxis != NULL)
{
//xaxis->SetOffset(m_pan_start_at_vx - xaxis->GetRange() * (rx - m_pan_start_at_rx));
xaxis->SetOffset(xaxis->GetOffset() + xaxis->GetRange() * start_rx);
xaxis->SetRange(xaxis->GetRange() * (end_rx - start_rx));
xaxis->PropagateToCommonScale();
}
if (yaxis != NULL)
{
//yaxis->SetOffset(m_pan_start_at_vy - yaxis->GetRange() * (ry - m_pan_start_at_ry));
yaxis->SetOffset(yaxis->GetOffset() + yaxis->GetRange() * start_ry);
yaxis->SetRange(yaxis->GetRange() * (end_ry - start_ry));
yaxis->PropagateToCommonScale();
}
}