Ejemplo n.º 1
0
 /**
  * get() is an alias of point()
  */
 public function testSetGet()
 {
     $point = new pointObj();
     $point->setXY(5, 5);
     $this->assertEquals(0, $this->line->set(1, $point));
     $this->assertInstanceOf('pointObj', $replacedPoint = $this->line->get(1));
     $this->assertEquals(5, $replacedPoint->x);
 }
Ejemplo n.º 2
0
 public function testDistanceToLine()
 {
     $startLine = new pointObj();
     $startLine->setXY(11, 15);
     $endLine = new pointObj();
     $endLine->setXY(43, 67);
     $this->assertEquals(1.0, $this->point->distanceToLine($startLine, $endLine));
     $startLine->setXY(10, 15);
     $this->assertEquals(0, $this->point->distanceToLine($startLine, $endLine));
 }
Ejemplo n.º 3
0
 public function testdistanceToPoint()
 {
     $point = new pointObj();
     $point->setXY(5, 8);
     $line = new lineObj();
     $line->addXY(0, 0);
     $line->addXY(6, 8);
     $this->assertTrue(is_nan($this->shape->distanceToPoint($point)));
     $this->shape->add($line);
     $this->assertEquals(1.0, $this->shape->distanceToPoint($point));
 }
Ejemplo n.º 4
0
    $oMap->setsize(256, 256);
    $oMap->setExtent($poPoint1->x, $poPoint1->y, $poPoint2->x, $poPoint2->y);
    $oMap->getlayer(0)->set("status", MS_DEFAULT);
    $oMap->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
    $layer0->setProjection($projDefault["proj4"]);
    //
    //se o layer foi marcado para corte altera os parametros para ampliar o mapa
    //antes de gerar a imagem
    //
    if ($cortePixels > 0) {
        //$oMap->prepareImage();
        $escalaInicial = $oMap->scaledenom;
        $extensaoInicial = $oMap->extent;
        $wh = 256 + $cortePixels * 2;
        $oMap->setsize($wh, $wh);
        $ponto = new pointObj();
        $ponto->setxy($wh / 2, $wh / 2);
        $oMap->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial);
    }
    $img = $oMap->draw();
    if ($img->imagepath == "") {
        exit;
    }
    if ($cache == true) {
        salvaCacheImagem($cachedir, $nomeMapfileTmp, "/googlemaps/{$layer0->name}/{$z}/{$x}/{$y}");
    }
    renderNocacheTms();
}
if (strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic") {
    $l = $oMap->getlayer(0);
    if ($req->getValueByName("LAYER") == "") {