Execute the operation! When the geometry is not a Polygon, null is returned.
965323
public Geometry execute(Geometry geometry) {
		if (geometry instanceof Polygon) {
			Polygon polygon = (Polygon) geometry;
			if (geometry.isEmpty()) {
				return null;
			} else {
				LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing() + 1];
				int count = 0;
				for (int n = 0; n < interiorRings.length; n++) {
					if (n == index) {
						interiorRings[n] = ring;
					} else {
						interiorRings[n] = polygon.getInteriorRingN(count);
					}
				}
				return geometry.getGeometryFactory().createPolygon(polygon.getExteriorRing(), interiorRings);
			}
		}
		return null;
	}
980181
@Override
	public Geometry next() {
		Geometry geometry;
		if ((geometry = m_inputGeometryCursor.next()) != null)// if (geometry =
																// m_inputGeometryCursor->Next())
		{
			m_index = m_inputGeometryCursor.getGeometryID();
			if ((m_progressTracker != null)
					&& !(m_progressTracker.progress(-1, -1)))
				throw new RuntimeException("user_canceled");
			return simplify(geometry);
		}
		return null;
	}
1276833
private void insert(Geometry geom, GeometryIndex index, Geometry child) throws GeometryIndexNotFoundException {
		if (index.hasChild() && geom.getGeometries() != null && geom.getGeometries().length > index.getValue()) {
			insert(geom.getGeometries()[index.getValue()], index.getChild(), child);
		} else if (checkType(geom, child)) {
			if (geom.getGeometries() == null && index.getValue() == 0) {
				geom.setGeometries(new Geometry[] { child });
			} else if (geom.getGeometries() == null || index.getValue() < 0
					|| index.getValue() > geom.getGeometries().length) {
				throw new GeometryIndexNotFoundException("Geometry index out of bounds.");
			} else {
				Geometry[] result = new Geometry[geom.getGeometries().length + 1];
				int count = 0;
				for (int i = 0; i < result.length; i++) {
					if (i == index.getValue()) {
						result[i] = child;
					} else {
						result[i] = geom.getGeometries()[count];
						count++;
					}
				}
				geom.setGeometries(result);
			}
		} else {
			throw new GeometryIndexNotFoundException("Cannot insert geometry at the requested location.");
		}
	}
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);
        }
    }
970659
public static Geometry removePoint(Geometry geometry, Polygon polygon) throws SQLException {
        if(geometry == null){
            return null;
        }
        GeometryEditor localGeometryEditor = new GeometryEditor();
        PolygonDeleteVertexOperation localBoxDeleteVertexOperation = new PolygonDeleteVertexOperation(geometry.getFactory(), new PreparedPolygon(polygon));
        Geometry localGeometry = localGeometryEditor.edit(geometry, localBoxDeleteVertexOperation);
        if (localGeometry.isEmpty()) {
            return null;
        }
        return localGeometry;            
    }
521746
static boolean isSimple(Geometry geometry, SpatialReference spatialReference) {
		OperatorSimplify op = (OperatorSimplify) factory
				.getOperator(Operator.Type.Simplify);
		boolean result = op.isSimpleAsFeature(geometry, spatialReference, null);
		return result;
	}
1365925
public void geometryUpdate(Geometry oldGeometry, Geometry newGeometry) {
		if (oldGeometry != null) {
			geometries.remove(oldGeometry);
		}
		if (newGeometry != null) {
			geometries.add(newGeometry);
		}

		if (geometries.size() == 0) {
			searchGeometry = null;
			updateGeometryOnMap();

		} else if (geometries.size() == 1) {
			searchGeometry = geometries.get(0);
			updateGeometryOnMap();

		} else {
			 SearchCommService.mergeGeometries(geometries, new DataCallback<Geometry>() {
				public void execute(Geometry result) {
					searchGeometry = result;
					updateGeometryOnMap();
				}
			});
		}
	}
1157455
function(geometry) {
        if (this.externalProjection && this.internalProjection) {
            geometry = geometry.clone();
            geometry.transform(this.internalProjection, 
                               this.externalProjection);
        }    
        var className = geometry.CLASS_NAME;
        var type = className.substring(className.lastIndexOf(".") + 1);
        var builder = this.buildGeometry[type.toLowerCase()];
        return builder.apply(this, [geometry]);
    }
434081
@Nullable
  static FillOptions fromFeature(@NonNull Feature feature) {
    if (feature.geometry() == null) {
      throw new RuntimeException("geometry field is required");
    }
    if (!(feature.geometry() instanceof Polygon)) {      return null;
    }

    FillOptions options = new FillOptions();
    options.geometry = (Polygon) feature.geometry();
    if (feature.hasProperty(PROPERTY_FILL_OPACITY)) {
      options.fillOpacity = feature.getProperty(PROPERTY_FILL_OPACITY).getAsFloat();
    }
    if (feature.hasProperty(PROPERTY_FILL_COLOR)) {
      options.fillColor = feature.getProperty(PROPERTY_FILL_COLOR).getAsString();
    }
    if (feature.hasProperty(PROPERTY_FILL_OUTLINE_COLOR)) {
      options.fillOutlineColor = feature.getProperty(PROPERTY_FILL_OUTLINE_COLOR).getAsString();
    }
    if (feature.hasProperty(PROPERTY_FILL_PATTERN)) {
      options.fillPattern = feature.getProperty(PROPERTY_FILL_PATTERN).getAsString();
    }
    if (feature.hasProperty(PROPERTY_IS_DRAGGABLE)) {
      options.isDraggable = feature.getProperty(PROPERTY_IS_DRAGGABLE).getAsBoolean();
    }
    return options;
  }
163716
@Override
    protected CudaContext invoke(BroadcastOp op) {
        processAsGridOp(op, op.getDimension());

        return null;
    }
677746
function(geometry) {
        var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
        if (!this.extract[type]) {
            return null;
        }
        if (this.internalProjection && this.externalProjection) {
            geometry = geometry.clone();
            geometry.transform(this.internalProjection, this.externalProjection);
        }                       
        var wktType = type == 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
        var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
        return data;
    }
442252
public static Boolean geomEquals(Geometry a, Geometry b) {
        if(a==null || b==null) {
            return null;
        }
        return a.equals(b);
    }
1175763
public boolean intersects(Geometry geometry) {
		if (geometry == null || isEmpty() || geometry.isEmpty()) {
			return false;
		}

		if (geometry.getNumGeometries() > 1) {
			for (int n = 0; n < geometry.getNumGeometries(); n++) {
				if (intersects(geometry.getGeometryN(n))) {
					return true;
				}
			}
		} else {
			final Coordinate[] coords = geometry.getCoordinates();
			if (coords.length > 1 && coordinates.length > 1) {
				for (int i = 0; i < coordinates.length - 1; i++) {
					for (int j = 0; j < coords.length - 1; j++) {
						if (Mathlib.lineIntersects(coordinates[i], coordinates[i + 1], coords[j], coords[j + 1])) {
							return true;
						}
					}
					if (Mathlib.touches(geometry, coordinates[i])) {
						return true;
					}
				}
			} else {
				// TODO implement me
			}
		}

		return false;
	}
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;
					}
				});
			}
		}
	}
1150693
public static void toKMLGeometry(Geometry geom, StringBuilder sb) throws SQLException {
        toKMLGeometry(geom, ExtrudeMode.NONE, AltitudeMode.NONE, sb);
    }
130135
function() {
            if (!CSG.Polygon.verticesConvex(this.vertices, this.plane.normal)) {
                CSG.Polygon.verticesConvex(this.vertices, this.plane.normal);
                throw new Error("Not convex!");
            }
        }
1294258
function(geometry) {
        var className = geometry.CLASS_NAME;
        var type = className.substring(className.lastIndexOf(".") + 1);
        var builder = this.buildGeometry[type.toLowerCase()];
        var node = null;
        if(builder) {
            node = builder.apply(this, [geometry]);
        }
        return node;
    }