本文整理汇总了PHP中Rectangle::Dump方法的典型用法代码示例。如果您正苦于以下问题:PHP Rectangle::Dump方法的具体用法?PHP Rectangle::Dump怎么用?PHP Rectangle::Dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rectangle
的用法示例。
在下文中一共展示了Rectangle::Dump方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quantumLayoutParams
function quantumLayoutParams(&$sizes, &$box, &$growWide)
{
global $debug;
global $offset_y;
if ($debug) {
echo '<ul>';
echo '<li>';
$offset_y += 100;
}
$boxes = array();
$pivotIndex = $this->computePivotIndex($sizes);
$pivotSize = $sizes[$pivotIndex];
$boxAR = $box->aspectRatio();
//echo "pivotIndex=$pivotIndex";
//echo '<br/>';
if (count($sizes) == 1) {
$boxes[] = $box;
if ($debug) {
echo "Stop 1: box = \n";
$box->Dump();
echo '<br/>';
}
}
if (count($sizes) == 2) {
$ratio = $sizes[0] / ($sizes[0] + $sizes[1]);
if ($growWide) {
$dim1 = $this->computeTableLayout($sizes[0], $boxAR * $ratio);
$dim2 = $this->computeTableLayout($sizes[1], $boxAR * $ratio);
$h = max($dim1[1], $dim2[1]);
//echo "h=$h<br/>";
$dim2 = $this->computeTableLayoutGivenHeight($sizes[1], $h);
$boxes[0] = new Rectangle($box->x, $box->y, $dim1[0], $h);
$boxes[1] = new Rectangle($box->x + $dim1[0], $box->y, $dim2[0], $dim2[1]);
} else {
$dim1 = $this->computeTableLayout($sizes[0], $boxAR / $ratio);
$dim2 = $this->computeTableLayout($sizes[1], $boxAR / (1 - $ratio));
$w = max($dim1[0], $dim2[0]);
//echo "w=$w<br/>";
$dim2 = $this->computeTableLayoutGivenWidth($sizes[1], $w);
$boxes[0] = new Rectangle($box->x, $box->y, $w, $dim1[1]);
$boxes[1] = new Rectangle($box->x, $box->y + $dim1[1], $dim2[0], $dim2[1]);
}
if ($debug) {
echo "Stop 2: box[0] = ";
$boxes[0]->Dump();
echo '<br />';
echo " Stop 2: box[1] = ";
$boxes[1]->Dump();
echo '<br/>';
echo 'Return ' . __LINE__ . '';
echo '<br/>';
}
return $boxes;
}
// More than 2
$box2 = NULL;
$r1 = NULL;
$l1 = array();
$l2 = array();
$l3 = array();
// First compute R1
if ($pivotIndex > 0) {
$l1 = array_slice($sizes, 0, $pivotIndex);
$l1Size = $this->computeSize($l1);
$b2Size = $this->computeSizeBetween($sizes, $pivotIndex, count($sizes) - 1);
if ($growWide) {
$dim1 = $this->computeTableLayoutGivenHeight($l1Size, $box->h);
$dim2 = $this->computeTableLayoutGivenHeight($b2Size, $box->h);
$r1 = new Rectangle($box->x, $box->y, $dim1[0], $dim1[1]);
$box2 = new Rectangle($box->x + $dim1[0], $box->y, $dim2[0], $dim2[1]);
} else {
$dim1 = $this->computeTableLayoutGivenWidth($l1Size, $box->w);
$dim2 = $this->computeTableLayoutGivenWidth($b2Size, $box->w);
$r1 = new Rectangle($box->x, $box->y, $dim1[0], $dim1[1]);
$box2 = new Rectangle($box->x, $box->y + $dim1[1], $dim2[0], $dim2[1]);
}
} else {
$box2 = new Rectangle($box->x, $box->y, $box->w, $box->h);
}
// Recurse on R1 to compute better box2
if ($debug) {
echo "<b>Recurse on R1 to get better box2</b><br />";
}
if (count($l1) != 0) {
if (count($l1) > 1) {
$r1AR = $r1->aspectRatio();
if ($r1AR == 1) {
$newGrowWidth = $growWide;
} else {
$newGrowWidth = $r1AR >= 1 ? true : false;
}
$l1boxes = $this->quantumLayoutParams($l1, $r1, $newGrowWide);
} else {
$l1boxes[0] = $r1;
}
$l1FinalBox = $this->computeUnion($l1boxes);
if ($growWide) {
$box2->h = $r1->h;
} else {
$box2->w = $r1->w;
//.........这里部分代码省略.........