예제 #1
0
 /**
  * @see http://php.net/manual/en/jsonserializable.jsonserialize.php
  */
 public function jsonSerialize()
 {
     $json = parent::jsonSerialize();
     $json['geometry'] = isset($this->geometry) ? $this->geometry->jsonSerialize() : null;
     $json['properties'] = isset($this->properties) ? $this->properties : null;
     // Ensure empty associative arrays are encoded as JSON objects
     if ($json['properties'] === array()) {
         $json['properties'] = new \stdClass();
     }
     if (isset($this->id)) {
         $json['id'] = $this->id;
     }
     return $json;
 }
예제 #2
0
 /**
  * Selects documents with geospatial data that exists entirely within a specified shape.
  *
  * @link http://docs.mongodb.org/manual/reference/operator/query/geoWithin/
  * @param string $field
  * @param Geometry $geometry
  * @return \Sokil\Mongo\Expression
  */
 public function within($field, Geometry $geometry)
 {
     $this->where($field, array('$geoWithin' => array('$geometry' => $geometry->jsonSerialize())));
     return $this;
 }
예제 #3
0
파일: Inspector.php 프로젝트: kitbs/vinfo
 public function rotate(Geometry $geometry, $angle = 90)
 {
     $matrix = new Matrix([[cos($angle), sin($angle)], [-sin($angle), cos($angle)]]);
     $geometryMatrix = new Matrix($geometry->getCoordinates());
 }