La classe "\fire\gear\projection\ProjectionsManager" consente di gestire le proiesioni e di creare le proiezioni e i proiettori.
Source code:
include("fxcore.php");
$projectionsManager = \fire\gear\projection\ProjectionsManager::instance();
echo "projections manager: " . $projectionsManager->toString() . "\n";
$projector = $projectionsManager->createProjector(4326, 3003);
$sourceProjection = $projectionsManager->createProjection(4326);
echo "source projection name: " . $sourceProjection->toString() . "\n";
echo "source projection srid: " . $sourceProjection->getSrid() . "\n";
echo "source projection text type: " . $sourceProjection->getTextType() . "\n";
echo "source projection text: " . $sourceProjection->getText() . "\n";
$destinationProjection = $projectionsManager->createProjection(3003);
echo "destination projection name: " . $destinationProjection->toString() . "\n";
echo "destination projection srid: " . $destinationProjection->getSrid() . "\n";
echo "destination projection text type: " . $destinationProjection->getTextType() . "\n";
echo "destination projection text: " . $destinationProjection->getText() . "\n";
$x = 11.03889;
$y = 43.8271569;
$z = 0;
$coordinate = new \fire\gear\geom\Coordinate($x, $y);
echo "before projection ...\n";
echo "coordinate x: " . $coordinate->getX() . "\n";
echo "coordinate y: " . $coordinate->getY() . "\n";
echo "coordinate z: " . $coordinate->getZ() . "\n";
$projector->project($coordinate);
echo "after projection ...\n";
echo "coordinate x: " . $coordinate->getX() . "\n";
echo "coordinate y: " . $coordinate->getY() . "\n";
echo "coordinate z: " . $coordinate->getZ() . "\n";
$coordinate = new \fire\gear\geom\Coordinate($x, $y, $z);
echo "before projection ...\n";
echo "coordinate x: " . $coordinate->getX() . "\n";
echo "coordinate y: " . $coordinate->getY() . "\n";
echo "coordinate z: " . $coordinate->getZ() . "\n";
$projector->project($coordinate);
echo "after projection ...\n";
echo "coordinate x: " . $coordinate->getX() . "\n";
echo "coordinate y: " . $coordinate->getY() . "\n";
echo "coordinate z: " . $coordinate->getZ() . "\n";