当前位置: 首页>>代码示例>>PHP>>正文


PHP Point::move方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:67,代码来源:Label.class.php

示例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());
 }
开发者ID:Laxman-SM,项目名称:iron_worker_examples,代码行数:20,代码来源:PointTest.php

示例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));
     }
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:66,代码来源:Label.class.php

示例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";
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:31,代码来源:memory_model_and_handle_types.php

示例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));
 }
开发者ID:MapsMD,项目名称:mediawikiMaps,代码行数:9,代码来源:PointTest.php

示例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;
         }
     }
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:56,代码来源:Mark.class.php

示例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;
         }
     }
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:41,代码来源:Mark.class.php

示例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
开发者ID:mfsousa,项目名称:php-langspec,代码行数:31,代码来源:member_selection_operator.php

示例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;
 }
开发者ID:MapsMD,项目名称:mediawikiMaps,代码行数:33,代码来源:BaseMapService.php


注:本文中的Point::move方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。