@return string

@throws GeometryIOException
975822
public function getNextWord() : string
    {
        $token = $this->nextToken();

        if ($token === null) {
            throw new GeometryIOException("Expected word but encountered end of stream");
        }
        if ($token[0] !== static::T_WORD) {
            throw new GeometryIOException("Expected word but encountered '" . $token[1] . "'");
        }

        return $token[1];
    }
102039
@NonNull
  public String toJson() {
    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(GeometryAdapterFactory.create())
      .registerTypeAdapter(BoundingBox.class, new BoundingBoxTypeAdapter())
      .registerTypeAdapterFactory(GeocodingAdapterFactory.create())
      .create();
    return gson.toJson(this, GeocodingResponse.class);
  }
591993
private function read(int $words, int $wordLength) : string
    {
        $length = $words * $wordLength;

        if ($this->position + $length > $this->length) {
            throw GeometryIOException::invalidWKB('unexpected end of stream');
        }

        if ($length === 1) {
            return $this->wkb[$this->position++];
        }

        if ($this->invert) {
            $data = '';

            for ($i = 0; $i < $words; $i++) {
                $data .= strrev(substr($this->wkb, $this->position + $i * $wordLength, $wordLength));
            }
        } else {
            $data = substr($this->wkb, $this->position, $length);
        }

        $this->position += $length;

        return $data;
    }
768725
protected function buildFacetPart()
    {
        if (!$this->sqlParts['facet']) {
            return '';
        }

        $facetParts = array();
        foreach ($this->sqlParts['facet'] as $facet) {
            $facetExpressions = array();
            foreach ($facet['facet'] as $key => $facetExpr) {
                if (is_int($key)) {
                    $facetExpressions[] = $facetExpr;
                } else {
                    $facetExpressions[] = $key.' AS '.$facetExpr;
                }
            }
            $facetPart = 'FACET '.implode(', ', $facetExpressions);
            if ($facet['by']) {
                $facetPart .= ' BY '.$facet['by'];
            }
            if ($facet['order']) {
                $facetPart .= ' ORDER BY '.$facet['order'].$this->getDirection($facet['order'], $facet['direction']);
            }
            if ($facet['limit']) {
                $facetPart .= ' LIMIT '.(int) $facet['skip'].', '.(int) $facet['limit'];
            }

            $facetParts[] = $facetPart;
        }

        return ' '.implode(' ', $facetParts);
    }
1185164
public function toString() : string
    {
        $string = "solid " . $this->getSolidName() . "\n";

        $count = $this->getFacetNormalCount();

        for ($i = 0; $i < $count; $i++) {
            $string .= $this->getFacetNormal($i)->toString() . "\n";
        }

        $string .= "endsolid";

        return $string;
    }
1224731
public function matchCloser() : void
    {
        $token = $this->nextToken();

        if ($token === null) {
            throw new GeometryIOException("Expected ')' but encountered end of stream");
        }
        if ($token[1] !== ')') {
            throw new GeometryIOException("Expected ')' but encountered '" . $token[1] . "'");
        }
    }
617454
function createGeo() {
    $cnt = count( $this->geo );
    if( 0 >= $cnt )
      return;
    $attributes = $this->_createParams( $this->geo['params'] );
    $content    = null;
    $content   .= number_format( (float) $this->geo['value']['latitude'], 6, '.', '');
    $content   .= ';';
    $content   .= number_format( (float) $this->geo['value']['longitude'], 6, '.', '');
    return $this->_createElement( 'GEO', $attributes, $content );
  }
1273496
public function coordinateName() : string
    {
        $name = 'XY';

        if ($this->hasZ) {
            $name .= 'Z';
        }

        if ($this->hasM) {
            $name .= 'M';
        }

        return $name;
    }
1029738
public StyleRow getStyle(GeometryType geometryType) {

		StyleRow styleRow = null;

		if (geometryType != null && !styles.isEmpty()) {
			List<GeometryType> geometryTypes = GeometryUtils
					.parentHierarchy(geometryType);
			geometryTypes.add(0, geometryType);
			for (GeometryType type : geometryTypes) {
				styleRow = styles.get(type);
				if (styleRow != null) {
					break;
				}
			}
		}

		if (styleRow == null) {
			styleRow = defaultStyle;
		}

		if (styleRow == null && geometryType == null && styles.size() == 1) {
			styleRow = styles.values().iterator().next();
		}

		return styleRow;
	}
1254632
public function toNQuads()
    {
        $string = '"'.$this->encodeStringLitralForNQuads($this->getValue()).'"';

        if ($this->getLanguage() !== null) {
            $string .= '@'.$this->getLanguage();
        } elseif ($this->getDatatype() !== null) {
            $string .= '^^<'.$this->getDatatype().'>';
        }

        return $string;
    }
49175
@Override
	public Geometry toDto(com.vividsolutions.jts.geom.Geometry geometry) throws GeomajasException {
		if (geometry == null) {
			return null;
		}
		try {
			return GeometryConverterService.fromJts(geometry);
		} catch (JtsConversionException jce) {
			throw new GeomajasException(jce, ExceptionCode.CANNOT_CONVERT_GEOMETRY, geometry.getClass().getName());
		}
	}
719511
public static String toGML(Geometry geom) {
        if (geom == null) {
            return null;
        }
        int srid = geom.getSRID();
        GMLWriter gmlw = new GMLWriter();
        if (srid != -1 || srid != 0) {
            gmlw.setSrsName("EPSG:" + geom.getSRID());
        }
        return gmlw.write(geom);
    }
1189206
public function jsonSerialize()
    {
        $position = [$this->getLng(), $this->getLat()];
        if($this->is3d()) $position[] = $this->getAlt();
        return new \GeoJson\Geometry\Point($position);
    }
364247
public function readByteOrder() : void
    {
        $byteOrder = $this->readUnsignedChar();

        if ($byteOrder !== WKBTools::BIG_ENDIAN && $byteOrder !== WKBTools::LITTLE_ENDIAN) {
            throw GeometryIOException::invalidWKB('unknown byte order: ' . $byteOrder);
        }

        $this->invert = ($byteOrder !== $this->machineByteOrder);
    }
1322701
@Override
	public String drawAxes() {
		StringBuilder s = new StringBuilder();
//		Point3d centroid = helixAxisAligner.getCentroid();
//		System.out.println("Centroid: " + helixAxisAligner.getCentroid());
//		Point3d centroid = helixAxisAligner.getGeometricCenter();
		Point3d centroid = helixAxisAligner.calcCenterOfRotation();
//		System.out.println("Geometric center: " + centroid);
		AxisAngle4d axisAngle = helixAxisAligner.getHelixLayers().getByLowestAngle().getAxisAngle();
		Vector3d axis = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z);

		s.append("draw axesHelical");
		s.append(name);
		s.append(0);
		s.append(" ");
		s.append("line");
		Point3d v1 = new Point3d(axis);
		v1.scale(AXIS_SCALE_FACTOR*(helixAxisAligner.getDimension().y + SIDE_CHAIN_EXTENSION));
		Point3d v2 = new Point3d(v1);
		v2.negate();
		v1.add(centroid);
		v2.add(centroid);
		s.append(getJmolPoint(v1));
		s.append(getJmolPoint(v2));
		s.append("width 1.0 ");
		s.append(" color red");
		s.append(" off;");
		return s.toString();
	}
516242
function getImgTag($geometry = null,$options = array()){
		$options += array(
			"alt" => "",
			"attrs" => array()
		);

		$this->setGeometry($geometry);
		$url = $this->getUrl();

		$attrs = $options["attrs"];
		$attrs += array(
			"src" => $url,
			"alt" => $options["alt"]
		);

		if($w = $this->getWidth()){ $attrs["width"] = $w; }
		if($h = $this->getHeight()){ $attrs["height"] = $h; }

		$_attrs = array();
		foreach($attrs as $k => $v){
			$_attrs[] = $v===true ? htmlspecialchars($k) : htmlspecialchars($k).'="'.htmlspecialchars($v).'"';
		}

		return '<img '.join(" ",$_attrs).' />';
	}
635094
public static int getGeometryTypeFromGeometry(Geometry geometry) {
        Integer sfsGeomCode = GEOM_TYPE_TO_SFS_CODE.get(geometry.getGeometryType().toLowerCase());
        if(sfsGeomCode == null) {
            return GeometryTypeCodes.GEOMETRY;
        } else {
            return sfsGeomCode;
        }
    }