本文整理汇总了PHP中Point::move方法的典型用法代码示例。如果您正苦于以下问题:PHP Point::move方法的具体用法?PHP Point::move怎么用?PHP Point::move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::move方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawSpecial
/**
* Draw the label
*
* @param awDrawer $drawer
* @param awPoint $p Label center
* @param int $key Text position in the array of texts (default to zero)
*/
public function drawSpecial(awDrawer $drawer, awPoint $p, $key = 0, $theText)
{
$theTextAW = new awText($theText);
if ($key % $this->interval !== 0) {
return;
}
// Hide all labels
if ($this->hide) {
return;
}
// Key is hidden
if (array_key_exists($key, $this->hideKey)) {
return;
}
// Hide first label
if ($key === 0 and $this->hideFirst) {
return;
}
// Hide last label
if ($key === count($this->texts) - 1 and $this->hideLast) {
return;
}
$text = $theTextAW;
if ($text !== NULL) {
// Value must be hidden
if (in_array($text->getText(), $this->hideValue)) {
return;
}
$x = $p->x;
$y = $p->y;
// Get padding
list($left, $right, $top, $bottom) = $text->getPadding();
$font = $text->getFont();
$width = $font->getTextWidth($text);
$height = $font->getTextHeight($text);
switch ($this->hAlign) {
case awLabel::RIGHT:
$x -= $width + $right;
break;
case awLabel::CENTER:
$x -= ($width - $left + $right) / 2;
break;
case awLabel::LEFT:
$x += $left;
break;
}
switch ($this->vAlign) {
case awLabel::TOP:
$y -= $height + $bottom;
break;
case awLabel::MIDDLE:
$y -= ($height - $top + $bottom) / 2;
break;
case awLabel::BOTTOM:
$y += $top;
break;
}
$drawer->string($theTextAW, $this->move->move($x, $y));
}
}
示例2: testShouldMoveByGivenAmount
/**
* @covers Imagine\Image\Point::getX
* @covers Imagine\Image\Point::getY
* @covers Imagine\Image\Point::move
*
* @dataProvider getMoves
*
* @param integer $x
* @param integer $y
* @param integer $move
* @param integer $x1
* @param integer $y1
*/
public function testShouldMoveByGivenAmount($x, $y, $move, $x1, $y1)
{
$point = new Point($x, $y);
$shift = $point->move($move);
$this->assertEquals($x1, $shift->getX());
$this->assertEquals($y1, $shift->getY());
}
示例3: draw
/**
* Draw the label
*
* @param $driver
* @param $p Label center
* @param int $key Text position in the array of texts (default to zero)
*/
function draw($driver, $p, $key = 0)
{
if ($key % $this->interval !== 0) {
return;
}
// Hide all labels
if ($this->hide) {
return;
}
// Key is hidden
if (array_key_exists($key, $this->hideKey)) {
return;
}
// Hide first label
if ($key === 0 and $this->hideFirst) {
return;
}
// Hide last label
if ($key === count($this->texts) - 1 and $this->hideLast) {
return;
}
$text = $this->getText($key);
if ($text !== NULL) {
// Value must be hidden
if (in_array($text->getText(), $this->hideValue)) {
return;
}
$x = $p->x;
$y = $p->y;
// Get padding
list($left, $right, $top, $bottom) = $text->getPadding();
// $font = $text->getFont();
$width = $driver->getTextWidth($text);
$height = $driver->getTextHeight($text);
switch ($this->hAlign) {
case LABEL_RIGHT:
$x -= $width + $right;
break;
case LABEL_CENTER:
$x -= ($width - $left + $right) / 2;
break;
case LABEL_LEFT:
$x += $left;
break;
}
switch ($this->vAlign) {
case LABEL_TOP:
$y -= $height + $bottom;
break;
case LABEL_MIDDLE:
$y -= ($height - $top + $bottom) / 2;
break;
case LABEL_BOTTOM:
$y += $top;
break;
}
$driver->string($text, $this->move->move($x, $y));
}
}
示例4: Point
// remove only alias from third point, so destructor runs
unset($b);
// remove only alias from first point, so destructor runs
unset($d);
// remove only alias from second point, so destructor runs
echo "Done\n";
//*/
///*
echo "----------------- byRef assignment of handle types ----------------------\n";
$a = new Point(1, 3);
// create first new point, and make $a an alias to it
echo "After '\$a = new Point(1, 3)', \$a is {$a}\n";
$c =& $a;
// make $c forever alias whatever $a aliases
echo "After '\$c =& \$a', \$c is {$c}, and \$a is {$a}\n";
$a->move(4, 6);
// moving $a also moves $c
echo "After '\$a->move(4, 6)', \$c is {$c}, and \$a is {$a}\n";
$a = new Point(2, 1);
// remove $a's alias from first point
// create second new point, and make $a an alias to it
// As $c aliases whatever $a aliases, $c's old alias to the first
// point is also removed, allowing the destructor to run.
// $c's new alias is to the new point
echo "After '\$a = new Point(2, 1)', \$c is {$c}, and \$a is {$a}\n";
unset($a);
// remove one alias from second point
echo "After 'unset(\$a)', \$c is {$c}\n";
unset($c);
// remove second (and final) alias from second point, so destructor runs
echo "Done\n";
示例5: testMove
/**
* @covers MultiMaps\Point::move
* @covers MultiMaps\Point::getData
*/
public function testMove()
{
$this->object->move(12345, -67890);
$this->assertEquals($this->object->getData(), array('lat' => 123.11108317216, 'lon' => 322.11643133104));
}
示例6: draw
/**
* Draw the mark
*
* @param $driver
* @param $point Mark center
*/
function draw($driver, $point)
{
// Hide marks ?
if ($this->hide) {
return;
}
// Check if we can print marks
if ($this->type !== NULL) {
$this->driver = $driver;
$realPoint = $this->move->move($point->x, $point->y);
switch ($this->type) {
case MARK_CIRCLE:
$this->drawCircle($realPoint);
break;
case MARK_SQUARE:
$this->drawSquare($realPoint);
break;
case MARK_TRIANGLE:
$this->drawTriangle($realPoint);
break;
case MARK_INVERTED_TRIANGLE:
$this->drawTriangle($realPoint, TRUE);
break;
case MARK_RHOMBUS:
$this->drawRhombus($realPoint);
break;
case MARK_CROSS:
$this->drawCross($realPoint);
break;
case MARK_PLUS:
$this->drawCross($realPoint, TRUE);
break;
case MARK_IMAGE:
$this->drawImage($realPoint);
break;
case MARK_STAR:
$this->changeType('star');
$this->draw($driver, $point);
break;
case MARK_PAPERCLIP:
$this->changeType('paperclip');
$this->draw($driver, $point);
break;
case MARK_BOOK:
$this->changeType('book');
$this->draw($driver, $point);
break;
}
}
}
示例7: draw
/**
* Draw the mark
*
* @param awDrawer $drawer
* @param awPoint $point Mark center
*/
public function draw(awDrawer $drawer, awPoint $point)
{
// Hide marks ?
if ($this->hide) {
return;
}
// Check if we can print marks
if ($this->type !== NULL) {
$this->drawer = $drawer;
$realPoint = $this->move->move($point->x, $point->y);
switch ($this->type) {
case awMark::CIRCLE:
$this->drawCircle($realPoint);
break;
case awMark::SQUARE:
$this->drawSquare($realPoint);
break;
case awMark::IMAGE:
$this->drawImage($realPoint);
break;
case awMark::STAR:
$this->changeType('star');
$this->draw($drawer, $point);
break;
case awMark::PAPERCLIP:
$this->changeType('paperclip');
$this->draw($drawer, $point);
break;
case awMark::BOOK:
$this->changeType('book');
$this->draw($drawer, $point);
break;
}
}
}
示例8: __toString
public function __toString()
{
return '(' . $this->x . ',' . $this->y . ')';
}
public $piProp = 555;
public static function psf()
{
return 123;
}
public static $psProp = 999;
const MYPI = 3.14159;
}
$p1 = new Point();
echo "\$p1 is >{$p1}<\n";
///*
$p1->move(3, 9);
echo "\$p1 is >{$p1}<\n";
$n = "move";
$p1->{$n}(-2, 4);
echo "\$p1 is >{$p1}<\n";
$p1->color = "red";
// turned into $p1->__set("color", "red");
var_dump($p1);
$c = $p1->color;
// turned into $c = $p1->__get("color");
var_dump($c);
//*/
var_dump($p1->piProp);
// okay to access instance property via instance
var_dump($p1->psf());
// okay to access static method via instance
示例9: addElementCircle
/**
* Add circle to map
* @param string $value
* @return boolean
*/
public function addElementCircle($value)
{
$return = true;
$stringscircle = explode($GLOBALS['egMultiMaps_SeparatorItems'], $value);
foreach ($stringscircle as $circlevalue) {
if (trim($circlevalue) == '') {
continue;
}
$circle = new Circle();
if (!$circle->parse($circlevalue, $this->classname)) {
$return = false;
$this->errormessages = array_merge($this->errormessages, $circle->getErrorMessages());
}
if (!$circle->isValid()) {
continue;
}
$this->circles[] = $circle;
$circlescount = count($circle->pos);
for ($index = 0; $index < $circlescount; $index++) {
$ne = new Point($circle->pos[$index]->lat, $circle->pos[$index]->lon);
$sw = new Point($circle->pos[$index]->lat, $circle->pos[$index]->lon);
$ne->move($circle->radiuses[$index], $circle->radiuses[$index]);
$sw->move(-$circle->radiuses[$index], -$circle->radiuses[$index]);
$this->elementsBounds->extend(array($ne, $sw));
}
}
return $return;
}