La classe "\fire\gear\projection\Projector" consente di creare e gestire un proiettore.
Source code:
include("fxcore.php");
$sourceProjection = new \fire\gear\projection\Projection(4326, 1, "+proj=longlat +datum=WGS84 +no_defs");
echo "source projection name: " . $sourceProjection->toString() . "\n";
$sourceProjectionClass = new \fire\Clazz($sourceProjection);
echo "source projection class name: " . $sourceProjectionClass->getName() . "\n";
echo "source projection srid: " . $sourceProjection->getSrid() . "\n";
echo "source projection text type: " . $sourceProjection->getTextType() . "\n";
echo "source projection text: " . $sourceProjection->getText() . "\n";
$destinationProjection = new \fire\gear\projection\Projection(3003, 1, "+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +units=m +no_defs");
echo "destination projection name: " . $destinationProjection->toString() . "\n";
$destinationProjectionClass = new \fire\Clazz($destinationProjection);
echo "destination projection class name: " . $destinationProjectionClass->getName() . "\n";
echo "destination projection srid: " . $destinationProjection->getSrid() . "\n";
echo "destination projection text type: " . $destinationProjection->getTextType() . "\n";
echo "destination projection text: " . $destinationProjection->getText() . "\n";
$projector = new \fire\gear\projection\Projector($sourceProjection, $destinationProjection);
echo "projector source projection srid: " . $projector->getSourceProjection()->getSrid() . "\n";
echo "projector destination projection srid: " . $projector->getDestinationProjection()->getSrid() . "\n";
$x = new \fire\Double();
$y = new \fire\Double();
$z = new \fire\Double();
$x->assign(11.03889);
$y->assign(43.8271569);
$z->assign(0);
echo "before projection ...\n";
echo "x: " . $x->value() . "\n";
echo "y: " . $y->value() . "\n";
echo "z: " . $z->value() . "\n";
$projector->project($x, $y, $z);
echo "after projection ...\n";
echo "x: " . $x->value() . "\n";
echo "y: " . $y->value() . "\n";
echo "z: " . $z->value() . "\n";
$envelope = new \fire\gear\geom\Envelope(6.63087, 18.52069, 35.49291, 47.09096, 4326);
echo "envelope: " . $envelope->toString() . "\n";
$projector->project($envelope);
echo "envelope: " . $envelope->toString() . "\n";