@param Geometry $reference
@param Geometry $culprit

@return CoordinateSystemException
965163
public static function dimensionalityMix(Geometry $reference, Geometry $culprit) : CoordinateSystemException
    {
        return new CoordinateSystemException(sprintf(
            'Dimensionality mix: %s %s cannot contain %s %s.',
            $reference->geometryType(),
            $reference->coordinateSystem()->coordinateName(),
            $culprit->geometryType(),
            $culprit->coordinateSystem()->coordinateName()
        ));
    }
938978
@Override
	public HandlerRegistration addGeometryIndexHighlightBeginHandler(GeometryIndexHighlightBeginHandler handler) {
		return editingService.getEventBus().addHandler(GeometryIndexHighlightBeginHandler.TYPE, handler);
	}
837751
public Geometry execute(Geometry geometry) {
		if (geometry == null) {
			return null;
		}
		if (geometry instanceof LinearRing) {
			if (coordIndex <= 0) {
				coordIndex = 0;
			} else if (coordIndex > geometry.getNumPoints() - 2) {
				coordIndex = geometry.getNumPoints() - 2;
			}
			Coordinate[] coordinates = new Coordinate[geometry.getNumPoints()];
			for (int i = 0; i < coordinates.length; i++) {
				Coordinate coordinate = geometry.getCoordinates()[i];
				if (i == coordIndex) {
					coordinates[i] = new Coordinate(coordinate.getX() + translateX, coordinate.getY() + translateY);
				} else if (i == geometry.getNumPoints() - 1) {
					coordinates[i] = coordinates[0];
				} else {
					coordinates[i] = coordinate;
				}
			}
			return geometry.getGeometryFactory().createLinearRing(coordinates);
		} else if (geometry instanceof LineString) {
			if (coordIndex <= 0) {
				coordIndex = 0;
			} else if (coordIndex > geometry.getNumPoints() - 1) {
				coordIndex = geometry.getNumPoints() - 1;
			}
			Coordinate[] coordinates = new Coordinate[geometry.getNumPoints()];
			for (int i = 0; i < coordinates.length; i++) {
				Coordinate coordinate = geometry.getCoordinates()[i];
				if (i == coordIndex) {
					coordinates[i] = new Coordinate(coordinate.getX() + translateX, coordinate.getY() + translateY);
				} else {
					coordinates[i] = geometry.getCoordinates()[i];
				}
			}
			return geometry.getGeometryFactory().createLineString(coordinates);
		}
		return null;
	}
81102
static protected int isSimplePlanar(/* const */Geometry geometry, /* const */
	SpatialReference spatialReference, boolean bForce,
			ProgressTracker progressTracker) {
		assert (false); // this code is not called yet.
		if (geometry.isEmpty())
			return 1;
		Geometry.Type gt = geometry.getType();
		if (gt == Geometry.Type.Point)
			return 1;
		else if (gt == Geometry.Type.Envelope) {
			Envelope2D env2D = new Envelope2D();
			geometry.queryEnvelope2D(env2D);
			boolean bReturnValue = !env2D.isDegenerate(InternalUtils
					.calculateToleranceFromGeometry(spatialReference, geometry,
							false));
			return bReturnValue ? 1 : 0;
		} else if (Geometry.isSegment(gt.value())) {
			throw GeometryException.GeometryInternalError();
			// return seg.IsSimple(m_tolerance);
		} else if (!Geometry.isMultiVertex(gt.value())) {
			throw GeometryException.GeometryInternalError();// What else?
		}

		double tolerance = InternalUtils.calculateToleranceFromGeometry(
				spatialReference, geometry, false);

		double geomTolerance = 0;
		int isSimple = ((MultiVertexGeometryImpl) geometry._getImpl())
				.getIsSimple(tolerance);
		int knownSimpleResult = bForce ? -1 : isSimple;
		// TODO: need to distinguish KnownSimple between SimpleAsFeature and
		// SimplePlanar. The SimplePlanar implies SimpleAsFeature.
		if (knownSimpleResult != -1)
			return knownSimpleResult;

		if (knownSimpleResult == GeometryXSimple.Weak) {
			assert (tolerance <= geomTolerance);
			tolerance = geomTolerance;// OVERRIDE the tolerance.
		}

		OperatorSimplifyLocalHelper helper = new OperatorSimplifyLocalHelper(
				geometry, spatialReference, knownSimpleResult, progressTracker,
				false);
		knownSimpleResult = helper.isSimplePlanarImpl_();
		((MultiVertexGeometryImpl) geometry._getImpl()).setIsSimple(
				knownSimpleResult, tolerance, false);
		return knownSimpleResult;
	}
700899
private void updateGeometry(Geometry geometry, GeometryIndex index, boolean bringToFront)
			throws GeometryIndexNotFoundException {
		// Some initialization:
		String identifier = baseName + "." + editingService.getIndexService().format(index);
		boolean marked = editingService.getIndexStateService().isMarkedForDeletion(index);

		// Find current and previous parent groups:
		Composite parentGroup = groups.get(identifier.substring(0, identifier.lastIndexOf('.')) + ".geometries");

		// Find the correct style:
		ShapeStyle style = new ShapeStyle();
		if (marked) {
			style = styleService.getBackgroundMarkedForDeletionStyle();
		}

		// Draw the inner ring:
		org.geomajas.gwt.client.spatial.geometry.Geometry transformed = mapWidget.getMapModel().getMapView()
				.getWorldViewTransformer()
				.worldToPan(GeometryConverter.toGwt(editingService.getIndexService().getGeometry(geometry, index)));
		if (transformed instanceof LinearRing) {
			Polygon polygon = mapWidget.getMapModel().getGeometryFactory()
					.createPolygon((LinearRing) transformed, null);
			mapWidget.getVectorContext().drawPolygon(parentGroup, identifier + ".background", polygon, style);
		}
	}
1026257
public static Geometry getGeometryN(Geometry geometry, Integer n) throws SQLException {
        if (geometry == null) {
            return null;
        }
        if (n >= 1 && n <= geometry.getNumGeometries()) {
            return geometry.getGeometryN(n - 1);
        } else {
            throw new SQLException(OUT_OF_BOUNDS_ERR_MESSAGE);
        }
    }
1185695
public function dieOnCircularReference(&$stk, Project $p = null)
    {
        if ($this->checked) {
            return;
        }

        // elements can contain strings, FileSets, Reference, etc.
        foreach ($this->elements as $o) {
            if ($o instanceof Reference) {
                $o = $o->getReferencedObject($p);
            }

            if ($o instanceof DataType) {
                if (in_array($o, $stk, true)) {
                    throw $this->circularReference();
                } else {
                    $stk[] = $o;
                    $o->dieOnCircularReference($stk, $p);
                    array_pop($stk);
                }
            }
        }

        $this->checked = true;
    }
68170
private void refineReferenceVector() {
		referenceVector = new Vector3d(Y_AXIS);
		if (rotationGroup.getPointGroup().startsWith("C")) {
			referenceVector = getReferenceAxisCylicWithSubunitAlignment();
		} else if (rotationGroup.getPointGroup().startsWith("D")) {
			referenceVector = getReferenceAxisDihedralWithSubunitAlignment();
		}

		referenceVector = orthogonalize(principalRotationVector, referenceVector);
	}
868648
private void checkCircularReference(final BeanId... references) {
        for (BeanId beanId : references) {
            if (getId().equals(beanId)) {
                throw CFG310_CIRCULAR_REF(getId(), getId());
            }
        }
    }
447522
@Override
	public HandlerRegistration addGeometryIndexSnappingBeginHandler(GeometryIndexSnappingBeginHandler handler) {
		return editingService.getEventBus().addHandler(GeometryIndexSnappingBeginHandler.TYPE, handler);
	}
275885
private void setGeometryTypeConstraints() throws SQLException {
        String finalGeometryType = GeoJsonField.GEOMETRY;
        if (finalGeometryTypes.size() == 1) {
            finalGeometryType = (String) finalGeometryTypes.iterator().next();
        }        
        if(isH2){
             finalGeometryType = GeoJsonField.GEOMETRY;//workaround for H2
             connection.createStatement().execute(String.format("ALTER TABLE %s ALTER COLUMN the_geom %s", tableLocation.toString(), finalGeometryType));        
        }
        else{
            connection.createStatement().execute(String.format("ALTER TABLE %s ALTER COLUMN the_geom SET DATA TYPE geometry(%s,%d)", tableLocation.toString(), finalGeometryType, parsedSRID));
        }
    }
971520
protected function resolveExternal(
        UriInterface $referenceUri,
        Value\ReferenceValue $reference
    ) {
        try {
            $value = $this->reader()->read(
                $this->uriFactory()->create(
                    $referenceUri->toString()
                ),
                $reference->mimeType()
            );
        } catch (ReadException $e) {
            throw new Exception\UndefinedReferenceException(
                $reference,
                $this->currentBaseUri(),
                $e
            );
        }

        $this->pushScopeMap(
            $this->scopeMapFactory()->create($referenceUri, $value)
        );
        $value = $value->accept($this);
        $this->popScopeMap();

        $referencePointer = $this->pointerFactory()->createFromUri(
            $referenceUri
        );
        if ($referencePointer->hasAtoms()) {
            $value = $this->pointerResolver()->resolve(
                $referencePointer,
                $value
            );

            if (null === $value) {
                throw new Exception\UndefinedReferenceException(
                    $reference,
                    $this->currentBaseUri()
                );
            }
        }

        return $value;
    }
940522
def crc(self):
        
        # first CRC the points in every entity
        target = caching.crc32(bytes().join(e._bytes()
                                            for e in self.entities))
        # add the CRC for the vertices
        target ^= self.vertices.crc()
        return target
43158
private void addGeometry(Geometry geom) throws IllegalArgumentException {
        if(!geom.isValid()) {
            throw new IllegalArgumentException("Provided geometry is not valid !");
        }
        if(geom instanceof GeometryCollection) {
            Map<TriangulationPoint, Integer> pts = new HashMap<TriangulationPoint, Integer>(geom.getNumPoints());
            List<Integer> segments = new ArrayList<Integer>(pts.size());
            AtomicInteger pointsCount = new AtomicInteger(0);
            PointHandler pointHandler = new PointHandler(this, pts, pointsCount);
            LineStringHandler lineStringHandler = new LineStringHandler(this, pts, pointsCount, segments);
            for(int geomId = 0; geomId < geom.getNumGeometries(); geomId++) {
                addSimpleGeometry(geom.getGeometryN(geomId), pointHandler, lineStringHandler);
            }
            int[] index = new int[segments.size()];
            for(int i = 0; i < index.length; i++) {
                index[i] = segments.get(i);
            }
            // Construct final points array by reversing key,value of hash map
            TriangulationPoint[] ptsArray = new TriangulationPoint[pointsCount.get()];
            for(Map.Entry<TriangulationPoint, Integer> entry : pts.entrySet()) {
                ptsArray[entry.getValue()] = entry.getKey();
            }
            pts.clear();
            convertedInput = new ConstrainedPointSet(Arrays.asList(ptsArray), index);
        } else {
            addGeometry(geom.getFactory().createGeometryCollection(new Geometry[]{geom}));
        }
    }
1091481
def ensure_geo_reference(origin):
    

    if isinstance(origin, Geo_reference):
        geo_ref = origin
    elif origin is None:
        geo_ref = None
    else:
        geo_ref = apply(Geo_reference, origin)

    return geo_ref
429294
@Api
	public void setGeometry(List<Geometry> geometries) {
		if (geometries.size() == 0) {
			Notify.info(messages.geometricSearchWidgetSelectionSearchNothingSelected());
		} else {
			Integer buffer = (Integer) spiBuffer.getValue();
			if (buffer != 0) {
				SearchCommService.mergeAndBufferGeometries(geometries, buffer, new DataCallback<Geometry[]>() {
					public void execute(Geometry[] result) {
						updateGeometry(geometry, result[1]);
						geometry = result[1];
					}
				});
			} else {
				SearchCommService.mergeGeometries(geometries, new DataCallback<Geometry>() {
					public void execute(Geometry result) {
						updateGeometry(geometry, result);
						geometry = result;
					}
				});
			}
		}
	}
980430
public function setReference($reference = null)
    {
        $reference === null && $reference = PaymentHelper::generateReference($this->getTransactionId());
        $this->params['reference'] = $reference;
        return $this;
    }