示例#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());
 }