Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F211425
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/Engines/Builder/Map/OctocubeBuilder.php b/Engines/Builder/Map/OctocubeBuilder.php
index 1cbb8d2..70afefb 100644
--- a/Engines/Builder/Map/OctocubeBuilder.php
+++ b/Engines/Builder/Map/OctocubeBuilder.php
@@ -1,60 +1,62 @@
<?php
namespace Zed\Engines\Builder\Map;
use Hypership\Geo\Octocube;
use Hypership\Geo\Point3D;
use GeoLocation;
class OctocubeBuilder {
private Point3D $localLocation;
+ const HYPERSHIP_CORE_LOCATION = "B00001002";
+
public function __construct (GeoLocation $location) {
$this->localLocation = Point3D::fromString($location->local);
}
private function getSector () : int {
return Octocube::getSectorFromPoint3D($this->localLocation);
}
/**
* Gets SQL RLIKE pattern for the specified sector
*
* @return string a SQL clause like "([0-9]+, -[0,9]+, [0,9]+)"
*/
public function getRlikePattern() : string {
$sector = $this->getSector();
if ($sector == 0) {
return "(0, 0, 0)";
}
$vector = Octocube::getBaseVector($sector);
//x
if ($vector[0] == 1) {
$query = "([0-9]+, ";
} else {
$query = "(-[0-9]+, ";
}
//y
if ($vector[1] == 1) {
$query .= "[0-9]+, ";
} else {
$query .= "-[0-9]+, ";
}
//z
$query .= $this->localLocation->z . ")";
return $query;
}
static public function canBuildAt($location) : bool {
- return $location->global == 'B00001002';
+ return $location->global === self::HYPERSHIP_CORE_LOCATION;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 23, 11:09 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21202
Default Alt Text
(1 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment