org.geotools
diff --git a/extensions/adapters/vector/src/main/java/org/geotools/process/function/DistributedRenderProcessUtils.java b/extensions/adapters/vector/src/main/java/org/geotools/process/function/DistributedRenderProcessUtils.java
deleted file mode 100644
index 6ba6f10f079..00000000000
--- a/extensions/adapters/vector/src/main/java/org/geotools/process/function/DistributedRenderProcessUtils.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.geotools.process.function;
-
-import java.util.Collections;
-import java.util.Map;
-import org.geotools.api.data.Parameter;
-import org.geotools.feature.NameImpl;
-import org.geotools.filter.LiteralExpressionImpl;
-import org.geotools.process.ProcessFactory;
-import org.geotools.process.Processors;
-import org.geotools.process.RenderingProcess;
-import org.geotools.process.factory.AnnotatedBeanProcessFactory;
-import org.geotools.text.Text;
-import org.locationtech.geowave.adapter.vector.plugin.InternalProcessFactory;
-import org.locationtech.geowave.adapter.vector.render.InternalDistributedRenderProcess;
-import org.geotools.api.feature.type.Name;
-import org.geotools.api.filter.expression.Expression;
-
-public class DistributedRenderProcessUtils {
- private static Expression SINGLETON_RENDER_PROCESS = null;
-
- public static Expression getRenderingProcess() {
- if (SINGLETON_RENDER_PROCESS == null) {
- final ProcessFactory processFactory =
- new AnnotatedBeanProcessFactory(
- Text.text("Internal GeoWave Process Factory"),
- "internal",
- InternalDistributedRenderProcess.class);
- final Name processName = new NameImpl("internal", "InternalDistributedRender");
- final RenderingProcess process = (RenderingProcess) processFactory.create(processName);
- final Map> parameters = processFactory.getParameterInfo(processName);
- final InternalProcessFactory factory = new InternalProcessFactory();
- // this is kinda a hack, but the only way to instantiate a process
- // is
- // for it to have a registered process factory, so temporarily
- // register
- // the process factory
- Processors.addProcessFactory(factory);
-
- SINGLETON_RENDER_PROCESS =
- new RenderingProcessFunction(
- processName,
- Collections.singletonList(
- new ParameterFunction(
- null,
- Collections.singletonList(new LiteralExpressionImpl("data")))),
- parameters,
- process,
- null);
- Processors.removeProcessFactory(factory);
- }
- return SINGLETON_RENDER_PROCESS;
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/geotools/renderer/lite/DistributedRenderer.java b/extensions/adapters/vector/src/main/java/org/geotools/renderer/lite/DistributedRenderer.java
deleted file mode 100644
index 627cdec345a..00000000000
--- a/extensions/adapters/vector/src/main/java/org/geotools/renderer/lite/DistributedRenderer.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.geotools.renderer.lite;
-
-import java.awt.Composite;
-import java.awt.Graphics2D;
-import java.awt.image.BufferedImage;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.BlockingQueue;
-import org.apache.commons.lang3.tuple.Pair;
-import org.geotools.process.function.ProcessFunction;
-import org.locationtech.geowave.adapter.vector.plugin.DistributedRenderProcess;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderOptions;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderResult;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderResult.CompositeGroupResult;
-import org.locationtech.geowave.adapter.vector.render.PersistableComposite;
-import org.locationtech.geowave.adapter.vector.render.PersistableRenderedImage;
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-
-public class DistributedRenderer extends StreamingRenderer {
- private final DistributedRenderOptions options;
- protected DistributedRenderingBlockingQueue renderQueue;
-
- public DistributedRenderer(final DistributedRenderOptions options) {
- this.options = options;
- }
-
- @Override
- List> classifyByFeatureProduction(
- final List lfts) {
- // strip off a distributed rendering render transform because that is
- // what is currently being processed
- final List> retVal = super.classifyByFeatureProduction(lfts);
- for (final List featureTypeStyles : retVal) {
- final LiteFeatureTypeStyle transformLfts = featureTypeStyles.get(0);
- // there doesn't seem to be an easy way to check if its a
- // distributed render transform so for now let's just not allow
- // other rendering transformations when distributed rendering is
- // employed and strip all transformations
- if (transformLfts.transformation instanceof ProcessFunction) {
- if ((((ProcessFunction) transformLfts.transformation).getName() != null)
- && ((ProcessFunction) transformLfts.transformation).getName().equals(
- DistributedRenderProcess.PROCESS_NAME)) {
- transformLfts.transformation = null;
- }
- }
- }
- return retVal;
- }
-
- @Override
- public void setRendererHints(final Map hints) {
- hints.put("maxFiltersToSendToDatastore", options.getMaxFilters());
-
- hints.put(StreamingRenderer.LINE_WIDTH_OPTIMIZATION_KEY, options.isOptimizeLineWidth());
- super.setRendererHints(hints);
- }
-
- @Override
- protected BlockingQueue getRequestsQueue() {
- renderQueue = new DistributedRenderingBlockingQueue(10000);
- return renderQueue;
- }
-
- public DistributedRenderResult getResult(final BufferedImage parentImage) {
- return renderQueue.getResult(parentImage);
- }
-
- public class DistributedRenderingBlockingQueue extends RenderingBlockingQueue {
- private static final long serialVersionUID = -1014302908773318665L;
- private final Map>> compositeGroupGraphicsToStyleGraphicsMapping =
- new LinkedHashMap<>();
- private final Map compositeGroupGraphicsToCompositeMapping =
- new HashMap<>();
-
- public DistributedRenderingBlockingQueue(final int capacity) {
- super(capacity);
- }
-
- @Override
- public void put(final RenderingRequest e) throws InterruptedException {
- // for merge requests just collect the graphics objects and
- // associated composites
- if (e instanceof MergeLayersRequest) {
- final List lftsList = ((MergeLayersRequest) e).lfts;
- final List> styleGraphics = new ArrayList<>();
- final Graphics2D parentGraphics = ((MergeLayersRequest) e).graphics;
- for (final LiteFeatureTypeStyle lfts : lftsList) {
- if ((lfts.graphics instanceof DelayedBackbufferGraphic)
- && (lfts.graphics != parentGraphics)) {
- final DelayedBackbufferGraphic styleGraphic = (DelayedBackbufferGraphic) lfts.graphics;
- if (styleGraphic.image != null) {
- styleGraphics.add(Pair.of(styleGraphic.image, lfts.composite));
- continue;
- }
- }
- // if no style graphic was added, add a null value as a
- // placeholder in the list
- styleGraphics.add(null);
- }
- compositeGroupGraphicsToStyleGraphicsMapping.put(parentGraphics, styleGraphics);
- } else if (e instanceof MargeCompositingGroupRequest) {
- compositeGroupGraphicsToCompositeMapping.put(
- ((MargeCompositingGroupRequest) e).compositingGroup.graphics,
- ((MargeCompositingGroupRequest) e).compositingGroup.composite);
- } else {
- super.put(e);
- }
- }
-
- public DistributedRenderResult getResult(final BufferedImage parentImage) {
- final List compositeGroups = new ArrayList<>();
- for (final Entry>> e : compositeGroupGraphicsToStyleGraphicsMapping.entrySet()) {
- final Graphics2D compositeGroupGraphic = e.getKey();
- final List> orderedStyles =
- Lists.transform(
- e.getValue(),
- new Function, Pair>() {
-
- @Override
- public Pair apply(
- final Pair input) {
- if (input == null) {
- return null;
- }
- return Pair.of(
- new PersistableRenderedImage(input.getKey()),
- input.getValue() == null ? null
- : new PersistableComposite(input.getValue()));
- }
- });
- if (compositeGroupGraphic instanceof DelayedBackbufferGraphic) {
- final Composite compositeGroupComposite =
- compositeGroupGraphicsToCompositeMapping.get(compositeGroupGraphic);
- // because mergelayers wasn't writing to the composite
- // image, their won't be an image to persist
- final PersistableComposite persistableCGC =
- compositeGroupComposite == null ? null
- : new PersistableComposite(compositeGroupComposite);
- compositeGroups.add(new CompositeGroupResult(persistableCGC, orderedStyles));
- } else {
- // it must be the parent image
- compositeGroups.add(new CompositeGroupResult(null, orderedStyles));
- }
- }
-
- return new DistributedRenderResult(
- new PersistableRenderedImage(parentImage),
- compositeGroups);
- }
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/FeatureAdapterPersistableRegistry.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/FeatureAdapterPersistableRegistry.java
index d7413e04097..ed24ce4285f 100644
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/FeatureAdapterPersistableRegistry.java
+++ b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/FeatureAdapterPersistableRegistry.java
@@ -16,12 +16,6 @@
import org.locationtech.geowave.adapter.vector.ingest.GeometrySimpOptionProvider;
import org.locationtech.geowave.adapter.vector.ingest.TypeNameOptionProvider;
import org.locationtech.geowave.adapter.vector.query.aggregation.VectorCountAggregation;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderAggregation;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderOptions;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderResult;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderResult.CompositeGroupResult;
-import org.locationtech.geowave.adapter.vector.render.PersistableComposite;
-import org.locationtech.geowave.adapter.vector.render.PersistableRenderedImage;
import org.locationtech.geowave.adapter.vector.util.SimpleFeatureUserDataConfigurationSet;
import org.locationtech.geowave.core.index.persist.InternalPersistableRegistry;
import org.locationtech.geowave.core.index.persist.PersistableRegistrySpi;
@@ -41,13 +35,9 @@ public PersistableIdAndConstructor[] getSupportedPersistables() {
new PersistableIdAndConstructor((short) 505, FeatureSerializationOptionProvider::new),
new PersistableIdAndConstructor((short) 506, TypeNameOptionProvider::new),
// 507-508 are available
- new PersistableIdAndConstructor((short) 509, DistributedRenderOptions::new),
- new PersistableIdAndConstructor((short) 510, CompositeGroupResult::new),
- new PersistableIdAndConstructor((short) 511, DistributedRenderResult::new),
- new PersistableIdAndConstructor((short) 512, PersistableComposite::new),
- new PersistableIdAndConstructor((short) 513, PersistableRenderedImage::new),
+ // 509-513 are retired: distributed rendering's classes, removed in 3.0
// 514-520 is available
- new PersistableIdAndConstructor((short) 521, DistributedRenderAggregation::new),
+ // 521 is retired: distributed rendering's aggregation, removed in 3.0
new PersistableIdAndConstructor((short) 522, SimpleFeatureUserDataConfigurationSet::new),
// 523 is used by core-geotime
// 524-526 are legacy classes (pre 2.0)
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/DistributedRenderProcess.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/DistributedRenderProcess.java
deleted file mode 100644
index 9e05d647cb3..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/DistributedRenderProcess.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.plugin;
-
-import org.geotools.api.data.Query;
-import org.geotools.data.simple.SimpleFeatureCollection;
-import org.geotools.process.ProcessException;
-import org.geotools.process.factory.DescribeParameter;
-import org.geotools.process.factory.DescribeProcess;
-import org.geotools.process.factory.DescribeResult;
-import org.geotools.util.factory.Hints;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderOptions;
-import org.geotools.api.coverage.grid.GridGeometry;
-
-/**
- * This class can be used as a GeoTools Render Transform ('geowave:DistributedRender') within an SLD
- * on any layer that uses the GeoWave Data Store. An example SLD is provided
- * (example-slds/DistributedRender.sld).
- */
-@DescribeProcess(
- title = "DistributedRender",
- description = "This process will enable GeoWave to render WMS requests within the server and then this will be responsible for compositing the result client-side.")
-public class DistributedRenderProcess {
- public static final String PROCESS_NAME = "geowave:DistributedRender";
-
- public static final Hints.Key OPTIONS = new Hints.Key(DistributedRenderOptions.class);
-
- @DescribeResult(
- name = "result",
- description = "This is just a pass-through, the key is to provide enough information within invertQuery to perform a map to screen transform")
- public SimpleFeatureCollection execute(
- @DescribeParameter(
- name = "data",
- description = "Feature collection containing the rendered image") final SimpleFeatureCollection features)
- throws ProcessException {
- // this is a pass through, only used so that legend rendering works
- // appropriately
-
- // InternalDistributedRenderProcess is what actually can be used as a
- // render transformation to perform distributed rendering, within WMS
- // map request callbacks this transformation will be replaced with
- // InternalDistributedRenderProcess
-
- // therefore all other calls outside of WMS map requests, such as
- // requesting the legend will behave as expected
-
- return features;
- }
-
- public Query invertQuery(final Query targetQuery, final GridGeometry targetGridGeometry)
- throws ProcessException {
- return targetQuery;
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureCollection.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureCollection.java
index 5a5de93a3b9..719105ee92e 100644
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureCollection.java
+++ b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureCollection.java
@@ -15,10 +15,7 @@
import org.geotools.api.data.Query;
import org.geotools.data.store.DataFeatureCollection;
import org.geotools.feature.FeatureIterator;
-import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.geometry.jts.ReferencedEnvelope;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderOptions;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderResult;
import org.locationtech.geowave.core.geotime.store.query.TemporalConstraintsSet;
import org.locationtech.geowave.core.geotime.store.statistics.BoundingBoxStatistic;
import org.locationtech.geowave.core.geotime.store.statistics.BoundingBoxStatistic.BoundingBoxValue;
@@ -44,19 +41,17 @@
* This class is a helper for the GeoWave GeoTools data store. It represents a collection of feature
* data by encapsulating a GeoWave reader and a query object in order to open the appropriate cursor
* to iterate over data. It uses Keys within the Query hints to determine whether to perform special
- * purpose queries such as decimation or distributed rendering.
+ * purpose queries such as decimation.
*/
public class GeoWaveFeatureCollection extends DataFeatureCollection {
private static final Logger LOGGER = LoggerFactory.getLogger(GeoWaveFeatureCollection.class);
private final GeoWaveFeatureReader reader;
private CloseableIterator featureCursor;
private final Query query;
- private static SimpleFeatureType distributedRenderFeatureType;
public GeoWaveFeatureCollection(final GeoWaveFeatureReader reader, final Query query) {
this.reader = reader;
- this.query =
- validateQuery(GeoWaveFeatureCollection.getSchema(reader, query).getTypeName(), query);
+ this.query = validateQuery(reader.getComponents().getFeatureType().getTypeName(), query);
}
@Override
@@ -130,42 +125,9 @@ public ReferencedEnvelope getBounds() {
@Override
public SimpleFeatureType getSchema() {
- if (isDistributedRenderQuery()) {
- return getDistributedRenderFeatureType();
- }
return reader.getFeatureType();
}
- public static synchronized SimpleFeatureType getDistributedRenderFeatureType() {
- if (distributedRenderFeatureType == null) {
- distributedRenderFeatureType = createDistributedRenderFeatureType();
- }
- return distributedRenderFeatureType;
- }
-
- private static SimpleFeatureType createDistributedRenderFeatureType() {
- final SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
- typeBuilder.setName("distributed_render");
- typeBuilder.add("result", DistributedRenderResult.class);
- typeBuilder.add("options", DistributedRenderOptions.class);
- return typeBuilder.buildFeatureType();
- }
-
- protected boolean isDistributedRenderQuery() {
- return GeoWaveFeatureCollection.isDistributedRenderQuery(query);
- }
-
- protected static final boolean isDistributedRenderQuery(final Query query) {
- return query.getHints().containsKey(DistributedRenderProcess.OPTIONS);
- }
-
- private static SimpleFeatureType getSchema(final GeoWaveFeatureReader reader, final Query query) {
- if (GeoWaveFeatureCollection.isDistributedRenderQuery(query)) {
- return getDistributedRenderFeatureType();
- }
- return reader.getComponents().getFeatureType();
- }
-
protected QueryConstraints getQueryConstraints() throws TransformException, FactoryException {
final ReferencedEnvelope referencedEnvelope = getEnvelope(query);
final Geometry jtsBounds;
@@ -212,13 +174,6 @@ private Iterator openIterator(final QueryConstraints constraints)
featureCursor = reader.getNoData();
} else if (query.getFilter() == Filter.EXCLUDE) {
featureCursor = reader.getNoData();
- } else if (isDistributedRenderQuery()) {
- featureCursor =
- reader.renderData(
- constraints.jtsBounds,
- constraints.timeBounds,
- constraints.limit,
- (DistributedRenderOptions) query.getHints().get(DistributedRenderProcess.OPTIONS));
} else if (query.getHints().containsKey(SubsampleProcess.OUTPUT_WIDTH)
&& query.getHints().containsKey(SubsampleProcess.OUTPUT_HEIGHT)
&& query.getHints().containsKey(SubsampleProcess.OUTPUT_BBOX)) {
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureReader.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureReader.java
index ad824858262..b82d48c7fa8 100644
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureReader.java
+++ b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveFeatureReader.java
@@ -20,7 +20,6 @@
import java.util.Set;
import org.geotools.api.data.FeatureReader;
import org.geotools.api.data.Query;
-import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.filter.AttributeExpressionImpl;
import org.geotools.filter.FidFilterImpl;
import org.geotools.filter.spatial.BBOXImpl;
@@ -30,9 +29,6 @@
import org.geotools.renderer.lite.RendererUtilities;
import org.locationtech.geowave.adapter.vector.plugin.transaction.GeoWaveTransaction;
import org.locationtech.geowave.adapter.vector.plugin.transaction.StatisticsCache;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderAggregation;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderOptions;
-import org.locationtech.geowave.adapter.vector.render.DistributedRenderResult;
import org.locationtech.geowave.adapter.vector.util.QueryIndexHelper;
import org.locationtech.geowave.core.geotime.index.SpatialIndexFilter;
import org.locationtech.geowave.core.geotime.index.dimension.SimpleTimeDefinition;
@@ -471,47 +467,6 @@ public CloseableIterator query(
}
}
- private class RenderQueryIssuer extends BaseIssuer implements QueryIssuer {
- final DistributedRenderOptions renderOptions;
-
- public RenderQueryIssuer(final Integer limit, final DistributedRenderOptions renderOptions) {
- super(limit);
- this.renderOptions = renderOptions;
- }
-
- @Override
- public CloseableIterator query(
- final Index index,
- final BasicQueryByClass query,
- final boolean spatialOnly) {
- final VectorAggregationQueryBuilder bldr =
- (VectorAggregationQueryBuilder) VectorAggregationQueryBuilder.newBuilder().setAuthorizations(
- transaction.composeAuthorizations());
- if (index != null) {
- bldr.indexName(index.getName());
- }
- bldr.aggregate(
- components.getAdapter().getTypeName(),
- new DistributedRenderAggregation(renderOptions)).constraints(
- createQueryConstraints(index, query, spatialOnly));
- final DistributedRenderResult result = components.getDataStore().aggregate(bldr.build());
- return new CloseableIterator.Wrapper<>(
- Iterators.singletonIterator(
- SimpleFeatureBuilder.build(
- GeoWaveFeatureCollection.getDistributedRenderFeatureType(),
- new Object[] {result, renderOptions},
- "render")));
- }
- }
-
- public CloseableIterator renderData(
- final Geometry jtsBounds,
- final TemporalConstraintsSet timeBounds,
- final Integer limit,
- final DistributedRenderOptions renderOptions) {
- return issueQuery(jtsBounds, timeBounds, new RenderQueryIssuer(limit, renderOptions));
- }
-
public CloseableIterator getData(
final Geometry jtsBounds,
final TemporalConstraintsSet timeBounds,
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveGSProcessFactory.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveGSProcessFactory.java
index 9ea2db5339c..a84f9da0a6a 100644
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveGSProcessFactory.java
+++ b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/GeoWaveGSProcessFactory.java
@@ -19,10 +19,6 @@
public class GeoWaveGSProcessFactory extends AnnotatedBeanProcessFactory {
public GeoWaveGSProcessFactory() {
- super(
- Text.text("GeoWave Process Factory"),
- "geowave",
- SubsampleProcess.class,
- DistributedRenderProcess.class);
+ super(Text.text("GeoWave Process Factory"), "geowave", SubsampleProcess.class);
}
}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/InternalProcessFactory.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/InternalProcessFactory.java
deleted file mode 100644
index 8023ff8387a..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/InternalProcessFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.plugin;
-
-import org.geotools.process.factory.AnnotatedBeanProcessFactory;
-import org.geotools.text.Text;
-import org.locationtech.geowave.adapter.vector.render.InternalDistributedRenderProcess;
-
-public class InternalProcessFactory extends AnnotatedBeanProcessFactory {
-
- public InternalProcessFactory() {
- super(
- Text.text("Internal GeoWave Process Factory"),
- "internal",
- InternalDistributedRenderProcess.class);
- }
-
- @Override
- public boolean isAvailable() {
- return true;
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/SubsampleProcess.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/SubsampleProcess.java
index 0ec8ee39914..5a7b43bba90 100644
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/SubsampleProcess.java
+++ b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/plugin/SubsampleProcess.java
@@ -27,7 +27,7 @@
*/
@DescribeProcess(
title = "SubsampleAtScreenResolution",
- description = "This process will enable GeoWave to subsample WMS requests based on pixel resolution to not oversample data. This will efficiently render overlapping point geometry that would otherwise be hidden but it assumes an opaque style and does not take transparency into account. It will use the centroid for other geometry types than point which can produce visual artifacts - distributed rendering is an alternative approach to efficiently render lines and polygons")
+ description = "This process will enable GeoWave to subsample WMS requests based on pixel resolution to not oversample data. This will efficiently render overlapping point geometry that would otherwise be hidden but it assumes an opaque style and does not take transparency into account. It will use the centroid for other geometry types than point, which can produce visual artifacts.")
public class SubsampleProcess {
public static final Hints.Key SUBSAMPLE_ENABLED = new Hints.Key(Boolean.class);
public static final Hints.Key PIXEL_SIZE = new Hints.Key(Double.class);
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/AsyncQueueFeatureCollection.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/AsyncQueueFeatureCollection.java
deleted file mode 100644
index a1afa2cdf4d..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/AsyncQueueFeatureCollection.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- *
See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import org.geotools.data.simple.SimpleFeatureIterator;
-import org.geotools.feature.collection.BaseSimpleFeatureCollection;
-import org.geotools.feature.collection.DelegateSimpleFeatureIterator;
-import org.geotools.api.feature.simple.SimpleFeature;
-import org.geotools.api.feature.simple.SimpleFeatureType;
-import com.oath.cyclops.async.adapters.Queue;
-
-public class AsyncQueueFeatureCollection extends BaseSimpleFeatureCollection {
- private final Queue asyncQueue;
-
- public AsyncQueueFeatureCollection(
- final SimpleFeatureType type,
- final Queue asyncQueue) {
- super(type);
- this.asyncQueue = asyncQueue;
- }
-
- @Override
- public SimpleFeatureIterator features() {
- return new DelegateSimpleFeatureIterator(asyncQueue.stream().iterator());
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderAggregation.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderAggregation.java
deleted file mode 100644
index 28d4403a228..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderAggregation.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import java.awt.geom.Point2D;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.geoserver.wms.DefaultWebMapService;
-import org.geoserver.wms.GetMapRequest;
-import org.geoserver.wms.ScaleComputationMethod;
-import org.geoserver.wms.WMSMapContent;
-import org.geotools.map.FeatureLayer;
-import org.geotools.map.MapViewport;
-import org.locationtech.geowave.core.store.api.Aggregation;
-import org.locationtech.geowave.core.store.api.DataTypeAdapter;
-import org.geotools.api.feature.simple.SimpleFeature;
-import org.geotools.api.feature.simple.SimpleFeatureType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.oath.cyclops.async.adapters.Queue;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-public class DistributedRenderAggregation implements
- Aggregation {
- private static final Logger LOGGER = LoggerFactory.getLogger(DistributedRenderAggregation.class);
- private DistributedRenderMapOutputFormat currentRenderer;
- private DistributedRenderResult currentResult;
- // use a cyclops-react queue to feed simple features asynchronously while a
- // render thread consumes the features
- private Queue queue;
- private CompletableFuture asyncRenderer;
- private DistributedRenderOptions options;
-
- public DistributedRenderAggregation() {}
-
- public DistributedRenderAggregation(final DistributedRenderOptions options) {
- this.options = options;
- }
-
- @Override
- public DistributedRenderOptions getParameters() {
- return options;
- }
-
- @Override
- public void setParameters(final DistributedRenderOptions options) {
- this.options = options;
- }
-
- @SuppressFBWarnings(
- value = "NP_NONNULL_PARAM_VIOLATION",
- justification = "This usage requires null params and is tested to work.")
- private void initRenderer(final SimpleFeatureType type) {
- currentRenderer = new DistributedRenderMapOutputFormat(options);
- final WMSMapContent mapContent = new WMSMapContent();
- final GetMapRequest request = new GetMapRequest();
- mapContent.setBgColor(options.getBgColor());
- request.setBgColor(options.getBgColor());
- mapContent.setPalette(options.getPalette());
- request.setPalette(options.getPalette());
- mapContent.setAngle(options.getAngle());
- request.setAngle(options.getAngle());
- mapContent.setBuffer(options.getBuffer());
- request.setBuffer(options.getBuffer());
- mapContent.setMapWidth(options.getMapWidth());
- request.setWidth(options.getMapWidth());
- mapContent.setMapHeight(options.getMapHeight());
- request.setHeight(options.getMapHeight());
- mapContent.setTransparent(options.isTransparent());
- request.setTransparent(options.isTransparent());
- mapContent.setViewport(new MapViewport(options.getEnvelope()));
- request.setBbox(options.getEnvelope());
- request.setInterpolations(options.getInterpolations());
- final Map formatOptions = new HashMap<>();
- formatOptions.put("antialias", options.getAntialias());
- formatOptions.put("timeout", options.getMaxRenderTime());
- formatOptions.put("kmplacemark", Boolean.valueOf(options.isKmlPlacemark()));
- // this sets a static variable, but its the only method available
- // (multiple geoserver clients with different settings hitting the same
- // distributed backend, may conflict on these settings)
-
- // we get around this by overriding these settings on the renderHints
- // object within DistributedRenderer so it is no longer using these
- // static settings, but these static properties must be set to avoid
- // NPEs
- System.setProperty("OPTIMIZE_LINE_WIDTH", Boolean.toString(options.isOptimizeLineWidth()));
- System.setProperty("MAX_FILTER_RULES", Integer.toString(options.getMaxFilters()));
- System.setProperty(
- "USE_GLOBAL_RENDERING_POOL",
- Boolean.toString(DistributedRenderOptions.isUseGlobalRenderPool()));
- new DefaultWebMapService(null).setApplicationContext(null);
- request.setFormatOptions(formatOptions);
- request.setWidth(options.getMapWidth());
- request.setHeight(options.getMapHeight());
- request.setTiled(options.isMetatile());
- request.setScaleMethod(
- options.isRenderScaleMethodAccurate() ? ScaleComputationMethod.Accurate
- : ScaleComputationMethod.OGC);
-
- if (options.isMetatile()) {
- // it doesn't matter what this is, as long as its not null, we are
- // just ensuring proper transparency usage based on meta-tiling
- // rules
- request.setTilesOrigin(new Point2D.Double());
- }
- mapContent.setRequest(request);
- queue = new Queue<>();
- mapContent.addLayer(
- new FeatureLayer(new AsyncQueueFeatureCollection(type, queue), options.getStyle()));
- // produce map in a separate thread...
- asyncRenderer = CompletableFuture.supplyAsync(() -> {
- currentRenderer.produceMap(mapContent).dispose();
- return currentRenderer.getDistributedRenderResult();
- });
- }
-
- @Override
- public DistributedRenderResult getResult() {
- if ((queue != null) && (asyncRenderer != null)) {
- queue.close();
- DistributedRenderResult result = null;
- // may not need to do this, waiting on map production may be
- // sufficient
- try {
- if (options.getMaxRenderTime() > 0) {
- result = asyncRenderer.get(options.getMaxRenderTime(), TimeUnit.SECONDS);
-
- } else {
- result = asyncRenderer.get();
- }
- } catch (InterruptedException | ExecutionException | TimeoutException e) {
- LOGGER.warn("Unable to get distributed render result", e);
- }
- currentResult = result;
- clearRenderer();
- }
- return currentResult;
- }
-
- @Override
- public void clearResult() {
- stopRenderer();
- clearRenderer();
- currentResult = null;
- }
-
- public void stopRenderer() {
- if (currentRenderer != null) {
- currentRenderer.stopRendering();
- }
- if (asyncRenderer != null) {
- asyncRenderer.cancel(true);
- }
- }
-
- public void clearRenderer() {
- queue = null;
- currentRenderer = null;
- asyncRenderer = null;
- }
-
- private synchronized void ensureOpen(final SimpleFeatureType type) {
- if (currentRenderer == null) {
- initRenderer(type);
- }
- }
-
- @Override
- public void aggregate(final DataTypeAdapter adapter, final SimpleFeature entry) {
- ensureOpen(entry.getFeatureType());
- queue.add(entry);
- }
-
- @Override
- public byte[] resultToBinary(final DistributedRenderResult result) {
- return result.toBinary();
- }
-
- @Override
- public DistributedRenderResult resultFromBinary(final byte[] binary) {
- final DistributedRenderResult result = new DistributedRenderResult();
- result.fromBinary(binary);
- return result;
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderCallback.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderCallback.java
deleted file mode 100644
index 1e718a04e53..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderCallback.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import org.geoserver.wms.GetMapCallbackAdapter;
-import org.geoserver.wms.WMS;
-import org.geoserver.wms.WMSMapContent;
-import org.geotools.factory.CommonFactoryFinder;
-import org.geotools.map.FeatureLayer;
-import org.geotools.map.Layer;
-import org.geotools.process.Processors;
-import org.geotools.process.function.DistributedRenderProcessUtils;
-import org.geotools.process.function.ProcessFunction;
-import org.geotools.api.style.FeatureTypeStyle;
-import org.geotools.api.style.RasterSymbolizer;
-import org.geotools.api.style.Rule;
-import org.geotools.api.style.Style;
-import org.geotools.api.style.StyleFactory;
-import org.geotools.styling.visitor.DuplicatingStyleVisitor;
-import org.locationtech.geowave.adapter.vector.plugin.DistributedRenderProcess;
-import org.locationtech.geowave.adapter.vector.plugin.InternalProcessFactory;
-import org.geotools.api.filter.expression.Expression;
-
-/**
- * The purpose of this callback is completely to get the layer Style accessible from the query, in
- * particular making the style available to either the FeatureReader or to a RenderingTransformation
- */
-public class DistributedRenderCallback extends GetMapCallbackAdapter {
- private final WMS wms;
-
- public DistributedRenderCallback(final WMS wms) {
- this.wms = wms;
- }
-
- @Override
- public Layer beforeLayer(final WMSMapContent mapContent, final Layer layer) {
- // sanity check the style
- if ((layer instanceof FeatureLayer)
- && (layer.getStyle() != null)
- && (layer.getStyle().featureTypeStyles() != null)
- && !layer.getStyle().featureTypeStyles().isEmpty()) {
-
- final Style layerStyle = layer.getStyle();
- final FeatureTypeStyle style = layerStyle.featureTypeStyles().get(0);
- // check if their is a DistributedRender rendering
- // transformation
- if ((style instanceof ProcessFunction)
- && (style.getTransformation() != null)
- && (((ProcessFunction) style.getTransformation()).getName() != null)
- && ((ProcessFunction) style.getTransformation()).getName().equals(
- DistributedRenderProcess.PROCESS_NAME)) {
- // if their is a DistributedRender transformation, we need
- // to provide more information that can only be found
- final DuplicatingStyleVisitor cloner = new DuplicatingStyleVisitor();
- layerStyle.accept(cloner);
- layer.getQuery().getHints().put(
- DistributedRenderProcess.OPTIONS,
- new DistributedRenderOptions(wms, mapContent, layerStyle));
- // now that the options with the distributed render style
- // have been set the original style will be used with
- // distributed rendering
-
- // now, replace the style with a direct raster symbolizer,
- // so the GridCoverage result of the distributed rendering
- // process is directly rendered to the map in place of the
- // original style
-
- final Style directRasterStyle = (Style) cloner.getCopy();
- directRasterStyle.featureTypeStyles().clear();
- Processors.addProcessFactory(new InternalProcessFactory());
- directRasterStyle.featureTypeStyles().add(
- getDirectRasterStyle(
- layer.getFeatureSource().getSchema().getGeometryDescriptor().getLocalName(),
- DistributedRenderProcessUtils.getRenderingProcess()));
- ((FeatureLayer) layer).setStyle(directRasterStyle);
- }
- }
- return layer;
- }
-
- private static FeatureTypeStyle getDirectRasterStyle(
- final String geometryPropertyName,
- final Expression transformation) {
- final StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
- final FeatureTypeStyle style = styleFactory.createFeatureTypeStyle();
- final Rule rule = styleFactory.createRule();
- rule.setName("Distributed Render - Direct Raster");
-
- final RasterSymbolizer symbolizer = styleFactory.createRasterSymbolizer();
- symbolizer.setGeometryPropertyName(geometryPropertyName);
- rule.symbolizers().add(symbolizer);
- style.rules().add(rule);
- style.setTransformation(transformation);
- return style;
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderMapOutputFormat.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderMapOutputFormat.java
deleted file mode 100644
index fbc0dc64871..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderMapOutputFormat.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- *
See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import java.awt.image.BufferedImage;
-import java.awt.image.IndexColorModel;
-import java.awt.image.RenderedImage;
-import org.geoserver.wms.map.RenderedImageMapOutputFormat;
-import org.geotools.renderer.lite.DistributedRenderer;
-import org.geotools.renderer.lite.StreamingRenderer;
-
-public class DistributedRenderMapOutputFormat extends RenderedImageMapOutputFormat {
- private final DistributedRenderOptions options;
- private DistributedRenderer currentRenderer;
- private BufferedImage currentImage;
-
- public DistributedRenderMapOutputFormat(final DistributedRenderOptions options) {
- super(new DistributedRenderWMSFacade(options));
- this.options = options;
- }
-
- @Override
- protected StreamingRenderer buildRenderer() {
- currentRenderer = new DistributedRenderer(options);
- return currentRenderer;
- }
-
- public void stopRendering() {
- if (currentRenderer != null) {
- currentRenderer.stopRendering();
- }
- }
-
- @Override
- protected RenderedImage prepareImage(
- final int width,
- final int height,
- final IndexColorModel palette,
- final boolean transparent) {
- currentImage = (BufferedImage) super.prepareImage(width, height, palette, transparent);
- return currentImage;
- }
-
- public DistributedRenderResult getDistributedRenderResult() {
- return currentRenderer.getResult(currentImage);
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderOptions.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderOptions.java
deleted file mode 100644
index 2a0c2b6bf56..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderOptions.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- *
See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import java.awt.Color;
-import java.awt.image.IndexColorModel;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.imagen.Interpolation;
-import org.eclipse.imagen.InterpolationNearest;
-import javax.xml.transform.TransformerException;
-import org.geoserver.wms.DefaultWebMapService;
-import org.geoserver.wms.GetMapRequest;
-import org.geoserver.wms.WMS;
-import org.geoserver.wms.WMSMapContent;
-import org.geotools.factory.CommonFactoryFinder;
-import org.geotools.geometry.jts.ReferencedEnvelope;
-import org.geotools.referencing.CRS;
-import org.geotools.renderer.lite.StreamingRenderer;
-import org.geotools.api.style.Style;
-import org.geotools.xml.styling.SLDParser;
-import org.geotools.xml.styling.SLDTransformer;
-import org.locationtech.geowave.core.geotime.util.GeometryUtils;
-import org.locationtech.geowave.core.index.ByteArrayUtils;
-import org.locationtech.geowave.core.index.StringUtils;
-import org.locationtech.geowave.core.index.VarintUtils;
-import org.locationtech.geowave.core.index.persist.Persistable;
-import org.geotools.api.referencing.FactoryException;
-import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-
-public class DistributedRenderOptions implements Persistable {
- private static final Logger LOGGER = LoggerFactory.getLogger(DistributedRenderOptions.class);
- // it doesn't make sense to grab this from the context of the geoserver
- // settings, although it is unclear whether in distributed rendering this
- // should be enabled or disabled by default
- private static final boolean USE_GLOBAL_RENDER_POOL = true;
-
- private String antialias;
- private boolean continuousMapWrapping;
- private boolean advancedProjectionHandlingEnabled;
- private boolean optimizeLineWidth;
- private boolean transparent;
- private boolean isMetatile;
- private boolean kmlPlacemark;
- private boolean renderScaleMethodAccurate;
- private int mapWidth;
- private int mapHeight;
- private int buffer;
- private double angle;
- private IndexColorModel palette;
- private Color bgColor;
- private int maxRenderTime;
- private int maxErrors;
- private int maxFilters;
- private ReferencedEnvelope envelope;
- private int wmsIterpolationOrdinal;
- private List interpolationOrdinals;
-
- private Style style;
-
- public DistributedRenderOptions() {}
-
- public DistributedRenderOptions(
- final WMS wms,
- final WMSMapContent mapContent,
- final Style style) {
- optimizeLineWidth = DefaultWebMapService.isLineWidthOptimizationEnabled();
- maxFilters = DefaultWebMapService.getMaxFilterRules();
-
- transparent = mapContent.isTransparent();
- buffer = mapContent.getBuffer();
- angle = mapContent.getAngle();
- mapWidth = mapContent.getMapWidth();
- mapHeight = mapContent.getMapHeight();
- bgColor = mapContent.getBgColor();
- palette = mapContent.getPalette();
- renderScaleMethodAccurate =
- StreamingRenderer.SCALE_ACCURATE.equals(mapContent.getRendererScaleMethod());
- wmsIterpolationOrdinal = wms.getInterpolation().ordinal();
- maxErrors = wms.getMaxRenderingErrors();
- this.style = style;
- envelope = mapContent.getRenderingArea();
-
- final GetMapRequest request = mapContent.getRequest();
- final Object timeoutOption = request.getFormatOptions().get("timeout");
- int localMaxRenderTime = 0;
- if (timeoutOption != null) {
- try {
- // local render time is in millis, while WMS max render time is
- // in seconds
- localMaxRenderTime = Integer.parseInt(timeoutOption.toString()) / 1000;
- } catch (final NumberFormatException e) {
- LOGGER.warn("Could not parse format_option \"timeout\": " + timeoutOption, e);
- }
- }
- maxRenderTime = getMaxRenderTime(localMaxRenderTime, wms);
- isMetatile = request.isTiled() && (request.getTilesOrigin() != null);
- final Object antialiasObj = request.getFormatOptions().get("antialias");
- if (antialiasObj != null) {
- antialias = antialiasObj.toString();
- }
-
- if (request.getFormatOptions().get("kmplacemark") != null) {
- kmlPlacemark = ((Boolean) request.getFormatOptions().get("kmplacemark")).booleanValue();
- }
- // turn on advanced projection handling
- advancedProjectionHandlingEnabled = wms.isAdvancedProjectionHandlingEnabled();
- final Object advancedProjectionObj =
- request.getFormatOptions().get(WMS.ADVANCED_PROJECTION_KEY);
- if ((advancedProjectionObj != null)
- && "false".equalsIgnoreCase(advancedProjectionObj.toString())) {
- advancedProjectionHandlingEnabled = false;
- continuousMapWrapping = false;
- }
- final Object mapWrappingObj = request.getFormatOptions().get(WMS.ADVANCED_PROJECTION_KEY);
- if ((mapWrappingObj != null) && "false".equalsIgnoreCase(mapWrappingObj.toString())) {
- continuousMapWrapping = false;
- }
- final List interpolations = request.getInterpolations();
- if ((interpolations == null) || interpolations.isEmpty()) {
- interpolationOrdinals = Collections.emptyList();
- } else {
- interpolationOrdinals =
- Lists.transform(interpolations, new Function() {
-
- @Override
- public Integer apply(final Interpolation input) {
- if (input instanceof InterpolationNearest) {
- return Interpolation.INTERP_NEAREST;
- } else if (input instanceof InterpolationNearest) {
- return Interpolation.INTERP_NEAREST;
- } else if (input instanceof InterpolationNearest) {
- return Interpolation.INTERP_NEAREST;
- } else if (input instanceof InterpolationNearest) {
- return Interpolation.INTERP_NEAREST;
- }
- return Interpolation.INTERP_NEAREST;
- }
- });
- }
- }
-
- public int getMaxRenderTime(final int localMaxRenderTime, final WMS wms) {
- final int wmsMaxRenderTime = wms.getMaxRenderingTime();
-
- if (wmsMaxRenderTime == 0) {
- maxRenderTime = localMaxRenderTime;
- } else if (localMaxRenderTime != 0) {
- maxRenderTime = Math.min(wmsMaxRenderTime, localMaxRenderTime);
- } else {
- maxRenderTime = wmsMaxRenderTime;
- }
- return maxRenderTime;
- }
-
- public boolean isOptimizeLineWidth() {
- return optimizeLineWidth;
- }
-
- public int getMaxErrors() {
- return maxErrors;
- }
-
- public void setMaxErrors(final int maxErrors) {
- this.maxErrors = maxErrors;
- }
-
- public void setOptimizeLineWidth(final boolean optimizeLineWidth) {
- this.optimizeLineWidth = optimizeLineWidth;
- }
-
- public List getInterpolationOrdinals() {
- return interpolationOrdinals;
- }
-
- public List getInterpolations() {
- if ((interpolationOrdinals != null) && !interpolationOrdinals.isEmpty()) {
- return Lists.transform(interpolationOrdinals, input -> Interpolation.getInstance(input));
- }
- return Collections.emptyList();
- }
-
- public void setInterpolationOrdinals(final List interpolationOrdinals) {
- this.interpolationOrdinals = interpolationOrdinals;
- }
-
- public static boolean isUseGlobalRenderPool() {
- return USE_GLOBAL_RENDER_POOL;
- }
-
- public Style getStyle() {
- return style;
- }
-
- public void setStyle(final Style style) {
- this.style = style;
- }
-
- public int getWmsInterpolationOrdinal() {
- return wmsIterpolationOrdinal;
- }
-
- public void setWmsInterpolationOrdinal(final int wmsIterpolationOrdinal) {
- this.wmsIterpolationOrdinal = wmsIterpolationOrdinal;
- }
-
- public int getMaxRenderTime() {
- return maxRenderTime;
- }
-
- public void setMaxRenderTime(final int maxRenderTime) {
- this.maxRenderTime = maxRenderTime;
- }
-
- public boolean isRenderScaleMethodAccurate() {
- return renderScaleMethodAccurate;
- }
-
- public void setRenderScaleMethodAccurate(final boolean renderScaleMethodAccurate) {
- this.renderScaleMethodAccurate = renderScaleMethodAccurate;
- }
-
- public int getBuffer() {
- return buffer;
- }
-
- public void setBuffer(final int buffer) {
- this.buffer = buffer;
- }
-
- public void setPalette(final IndexColorModel palette) {
- this.palette = palette;
- }
-
- public String getAntialias() {
- return antialias;
- }
-
- public void setAntialias(final String antialias) {
- this.antialias = antialias;
- }
-
- public boolean isContinuousMapWrapping() {
- return continuousMapWrapping;
- }
-
- public void setContinuousMapWrapping(final boolean continuousMapWrapping) {
- this.continuousMapWrapping = continuousMapWrapping;
- }
-
- public boolean isAdvancedProjectionHandlingEnabled() {
- return advancedProjectionHandlingEnabled;
- }
-
- public void setAdvancedProjectionHandlingEnabled(
- final boolean advancedProjectionHandlingEnabled) {
- this.advancedProjectionHandlingEnabled = advancedProjectionHandlingEnabled;
- }
-
- public boolean isKmlPlacemark() {
- return kmlPlacemark;
- }
-
- public void setKmlPlacemark(final boolean kmlPlacemark) {
- this.kmlPlacemark = kmlPlacemark;
- }
-
- public boolean isTransparent() {
- return transparent;
- }
-
- public void setTransparent(final boolean transparent) {
- this.transparent = transparent;
- }
-
- public boolean isMetatile() {
- return isMetatile;
- }
-
- public void setMetatile(final boolean isMetatile) {
- this.isMetatile = isMetatile;
- }
-
- public Color getBgColor() {
- return bgColor;
- }
-
- public void setBgColor(final Color bgColor) {
- this.bgColor = bgColor;
- }
-
- public int getMapWidth() {
- return mapWidth;
- }
-
- public void setMapWidth(final int mapWidth) {
- this.mapWidth = mapWidth;
- }
-
- public int getMapHeight() {
- return mapHeight;
- }
-
- public void setMapHeight(final int mapHeight) {
- this.mapHeight = mapHeight;
- }
-
- public double getAngle() {
- return angle;
- }
-
- public void setAngle(final double angle) {
- this.angle = angle;
- }
-
- public int getMaxFilters() {
- return maxFilters;
- }
-
- public void setMaxFilters(final int maxFilters) {
- this.maxFilters = maxFilters;
- }
-
- public ReferencedEnvelope getEnvelope() {
- return envelope;
- }
-
- public void setEnvelope(final ReferencedEnvelope envelope) {
- this.envelope = envelope;
- }
-
- public IndexColorModel getPalette() {
- return palette;
- }
-
- @Override
- public byte[] toBinary() {
- // combine booleans into a bitset
- final BitSet bitSet = new BitSet(15);
- bitSet.set(0, continuousMapWrapping);
- bitSet.set(1, advancedProjectionHandlingEnabled);
- bitSet.set(2, optimizeLineWidth);
- bitSet.set(3, transparent);
- bitSet.set(4, isMetatile);
- bitSet.set(5, kmlPlacemark);
- bitSet.set(6, renderScaleMethodAccurate);
- final boolean storeInterpolationOrdinals =
- ((interpolationOrdinals != null) && !interpolationOrdinals.isEmpty());
- bitSet.set(7, storeInterpolationOrdinals);
- bitSet.set(8, palette != null);
- bitSet.set(9, maxRenderTime > 0);
- bitSet.set(10, maxErrors > 0);
- bitSet.set(11, angle != 0);
- bitSet.set(12, buffer > 0);
- bitSet.set(13, bgColor != null);
- bitSet.set(14, style != null);
- final boolean storeCRS =
- !((envelope.getCoordinateReferenceSystem() == null)
- || GeometryUtils.getDefaultCRS().equals(envelope.getCoordinateReferenceSystem()));
- bitSet.set(15, storeCRS);
-
- final double minX = envelope.getMinX();
- final double minY = envelope.getMinY();
- final double maxX = envelope.getMaxX();
- final double maxY = envelope.getMaxY();
- // required bytes include 32 for envelope doubles,
- // 8 for map width and height ints, and 2 for the bitset
- int bufferSize =
- 32
- + 2
- + VarintUtils.unsignedIntByteLength(mapWidth)
- + VarintUtils.unsignedIntByteLength(mapHeight);
- final byte[] wktBinary;
- if (storeCRS) {
- final String wkt = envelope.getCoordinateReferenceSystem().toWKT();
- wktBinary = StringUtils.stringToBinary(wkt);
- bufferSize += (wktBinary.length + VarintUtils.unsignedIntByteLength(wktBinary.length));
- } else {
- wktBinary = null;
- }
- if (storeInterpolationOrdinals) {
- for (final Integer ordinal : interpolationOrdinals) {
- bufferSize += VarintUtils.unsignedIntByteLength(ordinal);
- }
- bufferSize += VarintUtils.unsignedIntByteLength(interpolationOrdinals.size());
- }
-
- final byte[] paletteBinary;
- if (palette != null) {
- paletteBinary = paletteToBinary(palette);
- bufferSize +=
- (paletteBinary.length + VarintUtils.unsignedIntByteLength(paletteBinary.length));
- } else {
- paletteBinary = null;
- }
- if (maxRenderTime > 0) {
- bufferSize += VarintUtils.unsignedIntByteLength(maxRenderTime);
- }
- if (maxErrors > 0) {
- bufferSize += VarintUtils.unsignedIntByteLength(maxErrors);
- }
- if (angle != 0) {
- bufferSize += 8;
- }
- if (buffer > 0) {
- bufferSize += VarintUtils.unsignedIntByteLength(buffer);
- }
- if (bgColor != null) {
- bufferSize += 4;
- }
-
- final byte[] styleBinary;
- if (style != null) {
- final SLDTransformer transformer = new SLDTransformer();
-
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- try {
- transformer.transform(new Style[] {style}, baos);
- } catch (final TransformerException e) {
- LOGGER.warn("Unable to create SLD from style", e);
- }
- styleBinary = baos.toByteArray();
- bufferSize += (styleBinary.length + VarintUtils.unsignedIntByteLength(styleBinary.length));
- } else {
- styleBinary = null;
- }
- final ByteBuffer byteBuffer = ByteBuffer.allocate(bufferSize);
- byteBuffer.put(bitSet.toByteArray());
- byteBuffer.putDouble(minX);
- byteBuffer.putDouble(minY);
- byteBuffer.putDouble(maxX);
- byteBuffer.putDouble(maxY);
- VarintUtils.writeUnsignedInt(mapWidth, byteBuffer);
- VarintUtils.writeUnsignedInt(mapHeight, byteBuffer);
- if (wktBinary != null) {
- VarintUtils.writeUnsignedInt(wktBinary.length, byteBuffer);
- byteBuffer.put(wktBinary);
- }
- if (storeInterpolationOrdinals) {
- VarintUtils.writeUnsignedInt(interpolationOrdinals.size(), byteBuffer);
- for (final Integer interpOrd : interpolationOrdinals) {
- VarintUtils.writeUnsignedInt(interpOrd, byteBuffer);
- }
- }
- if (paletteBinary != null) {
- VarintUtils.writeUnsignedInt(paletteBinary.length, byteBuffer);
- byteBuffer.put(paletteBinary);
- }
- if (maxRenderTime > 0) {
- VarintUtils.writeUnsignedInt(maxRenderTime, byteBuffer);
- }
- if (maxErrors > 0) {
- VarintUtils.writeUnsignedInt(maxErrors, byteBuffer);
- }
- if (angle != 0) {
- byteBuffer.putDouble(angle);
- }
- if (buffer > 0) {
- VarintUtils.writeUnsignedInt(buffer, byteBuffer);
- }
- if (bgColor != null) {
- byteBuffer.putInt(bgColor.getRGB());
- }
- if (styleBinary != null) {
- VarintUtils.writeUnsignedInt(styleBinary.length, byteBuffer);
- byteBuffer.put(styleBinary);
- }
- return byteBuffer.array();
- }
-
- @Override
- public void fromBinary(final byte[] bytes) {
- final ByteBuffer buf = ByteBuffer.wrap(bytes);
- final byte[] bitSetBytes = new byte[2];
- buf.get(bitSetBytes);
- final BitSet bitSet = BitSet.valueOf(bitSetBytes);
- continuousMapWrapping = bitSet.get(0);
- advancedProjectionHandlingEnabled = bitSet.get(1);
- optimizeLineWidth = bitSet.get(2);
- transparent = bitSet.get(3);
- isMetatile = bitSet.get(4);
- kmlPlacemark = bitSet.get(5);
- renderScaleMethodAccurate = bitSet.get(6);
- final boolean interpolationOrdinalsStored = bitSet.get(7);
- final boolean paletteStored = bitSet.get(8);
- final boolean maxRenderTimeStored = bitSet.get(9);
- final boolean maxErrorsStored = bitSet.get(10);
- final boolean angleStored = bitSet.get(11);
- final boolean bufferStored = bitSet.get(12);
- final boolean bgColorStored = bitSet.get(13);
- final boolean styleStored = bitSet.get(14);
- final boolean crsStored = bitSet.get(15);
- CoordinateReferenceSystem crs;
- final double minX = buf.getDouble();
- final double minY = buf.getDouble();
- final double maxX = buf.getDouble();
- final double maxY = buf.getDouble();
- mapWidth = VarintUtils.readUnsignedInt(buf);
- mapHeight = VarintUtils.readUnsignedInt(buf);
- if (crsStored) {
- final byte[] wktBinary = ByteArrayUtils.safeRead(buf, VarintUtils.readUnsignedInt(buf));
- final String wkt = StringUtils.stringFromBinary(wktBinary);
- try {
- crs = CRS.parseWKT(wkt);
- } catch (final FactoryException e) {
- LOGGER.warn("Unable to parse coordinate reference system", e);
- crs = GeometryUtils.getDefaultCRS();
- }
- } else {
- crs = GeometryUtils.getDefaultCRS();
- }
- envelope = new ReferencedEnvelope(minX, maxX, minY, maxY, crs);
- if (interpolationOrdinalsStored) {
- final int interpolationsLength = VarintUtils.readUnsignedInt(buf);
- interpolationOrdinals = new ArrayList<>(interpolationsLength);
- for (int i = 0; i < interpolationsLength; i++) {
- interpolationOrdinals.add(VarintUtils.readUnsignedInt(buf));
- }
- } else {
- interpolationOrdinals = Collections.emptyList();
- }
- if (paletteStored) {
- final byte[] colorModelBinary =
- ByteArrayUtils.safeRead(buf, VarintUtils.readUnsignedInt(buf));
- try {
- palette = paletteFromBinary(colorModelBinary);
- } catch (final RuntimeException e) {
- LOGGER.warn("Unable to read color model", e);
- palette = null;
- }
- } else {
- palette = null;
- }
- if (maxRenderTimeStored) {
- maxRenderTime = VarintUtils.readUnsignedInt(buf);
- } else {
- maxRenderTime = 0;
- }
- if (maxErrorsStored) {
- maxErrors = VarintUtils.readUnsignedInt(buf);
- } else {
- maxErrors = 0;
- }
- if (angleStored) {
- angle = buf.getDouble();
- } else {
- angle = 0;
- }
- if (bufferStored) {
- buffer = VarintUtils.readUnsignedInt(buf);
- } else {
- buffer = 0;
- }
- if (bgColorStored) {
- bgColor = new Color(buf.getInt());
- } else {
- bgColor = null;
- }
- if (styleStored) {
- final byte[] styleBinary = ByteArrayUtils.safeRead(buf, VarintUtils.readUnsignedInt(buf));
- final SLDParser parser =
- new SLDParser(
- CommonFactoryFinder.getStyleFactory(null),
- new ByteArrayInputStream(styleBinary));
- final Style[] styles = parser.readXML();
- if ((styles != null) && (styles.length > 0)) {
- style = styles[0];
- } else {
- LOGGER.warn("Unable to deserialize style");
- style = null;
- }
- } else {
- style = null;
- }
- }
-
- private static byte[] paletteToBinary(final IndexColorModel palette) {
- final int[] rgbs = new int[palette.getMapSize()];
- palette.getRGBs(rgbs);
- final ByteBuffer buf =
- ByteBuffer.allocate(
- VarintUtils.unsignedIntByteLength(palette.getPixelSize())
- + VarintUtils.unsignedIntByteLength(rgbs.length)
- + (rgbs.length * 4)
- + 1
- + VarintUtils.signedIntByteLength(palette.getTransparentPixel())
- + VarintUtils.unsignedIntByteLength(palette.getTransferType()));
- VarintUtils.writeUnsignedInt(palette.getPixelSize(), buf);
- VarintUtils.writeUnsignedInt(rgbs.length, buf);
- for (final int rgb : rgbs) {
- buf.putInt(rgb);
- }
- buf.put((byte) (palette.hasAlpha() ? 1 : 0));
- VarintUtils.writeSignedInt(palette.getTransparentPixel(), buf);
- VarintUtils.writeUnsignedInt(palette.getTransferType(), buf);
- return buf.array();
- }
-
- private static IndexColorModel paletteFromBinary(final byte[] binary) {
- final ByteBuffer buf = ByteBuffer.wrap(binary);
- final int bits = VarintUtils.readUnsignedInt(buf);
- final int size = VarintUtils.readUnsignedInt(buf);
- if (size > (buf.remaining() / 4)) {
- throw new IllegalArgumentException("Palette size " + size + " exceeds its binary");
- }
- final int[] rgbs = new int[size];
- for (int i = 0; i < size; i++) {
- rgbs[i] = buf.getInt();
- }
- final boolean hasAlpha = buf.get() != 0;
- final int transparentPixel = VarintUtils.readSignedInt(buf);
- final int transferType = VarintUtils.readUnsignedInt(buf);
- return new IndexColorModel(bits, size, rgbs, 0, hasAlpha, transparentPixel, transferType);
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderResult.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderResult.java
deleted file mode 100644
index 098e6a5e15d..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderResult.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import java.awt.AlphaComposite;
-import java.awt.Graphics2D;
-import java.awt.Transparency;
-import java.awt.image.BufferedImage;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.tuple.Pair;
-import org.geoserver.wms.map.ImageUtils;
-import org.locationtech.geowave.core.index.ByteArrayUtils;
-import org.locationtech.geowave.core.index.Mergeable;
-import org.locationtech.geowave.core.index.VarintUtils;
-
-public class DistributedRenderResult implements Mergeable {
- public static class CompositeGroupResult implements Mergeable {
- private PersistableComposite composite;
-
- // keep each style separate so they can be composited together in the
- // original draw order
- private List> orderedStyles;
-
- public CompositeGroupResult() {}
-
- public CompositeGroupResult(
- final PersistableComposite composite,
- final List> orderedStyles) {
- this.composite = composite;
- this.orderedStyles = orderedStyles;
- }
-
- private void render(final Graphics2D parentGraphics, final int width, final int height) {
- Graphics2D graphics;
- BufferedImage compositeGroupImage = null;
- if ((composite != null) && (composite.getComposite() != null)) {
- // this will render to a back buffer so that
-
- compositeGroupImage =
- parentGraphics.getDeviceConfiguration().createCompatibleImage(
- width,
- height,
- Transparency.TRANSLUCENT);
- graphics = compositeGroupImage.createGraphics();
- graphics.setRenderingHints(parentGraphics.getRenderingHints());
- } else {
- graphics = parentGraphics;
- }
- for (final Pair currentStyle : orderedStyles) {
- if ((currentStyle == null)
- || (currentStyle.getKey() == null)
- || (currentStyle.getKey().image == null)) {
- continue;
- }
- if ((currentStyle.getValue() == null) || (currentStyle.getValue().getComposite() == null)) {
- graphics.setComposite(AlphaComposite.SrcOver);
- } else {
- graphics.setComposite(currentStyle.getValue().getComposite());
- }
- graphics.drawImage(currentStyle.getKey().image, 0, 0, null);
- }
- if (compositeGroupImage != null) {
- if ((composite == null) || (composite.getComposite() == null)) {
- parentGraphics.setComposite(AlphaComposite.SrcOver);
- } else {
- parentGraphics.setComposite(composite.getComposite());
- }
- parentGraphics.drawImage(compositeGroupImage, 0, 0, null);
- graphics.dispose();
- }
- }
-
- @Override
- public byte[] toBinary() {
- final byte[] compositeBinary;
- if (composite != null) {
- compositeBinary = composite.toBinary();
- } else {
- compositeBinary = new byte[] {};
- }
- final List styleBinaries = new ArrayList<>(orderedStyles.size());
- int bufferSize =
- compositeBinary.length + VarintUtils.unsignedIntByteLength(compositeBinary.length);
- for (final Pair style : orderedStyles) {
- byte[] styleBinary;
- if (style != null) {
- byte[] styleCompositeBinary;
- if (style.getRight() != null) {
- styleCompositeBinary = style.getRight().toBinary();
- } else {
- styleCompositeBinary = new byte[] {};
- }
- byte[] styleImageBinary;
- if (style.getLeft() != null) {
- styleImageBinary = style.getLeft().toBinary();
- } else {
- styleImageBinary = new byte[] {};
- }
- final ByteBuffer styleBuf =
- ByteBuffer.allocate(
- styleCompositeBinary.length
- + styleImageBinary.length
- + VarintUtils.unsignedIntByteLength(styleCompositeBinary.length));
- VarintUtils.writeUnsignedInt(styleCompositeBinary.length, styleBuf);
- if (styleCompositeBinary.length > 0) {
- styleBuf.put(styleCompositeBinary);
- }
- if (styleImageBinary.length > 0) {
- styleBuf.put(styleImageBinary);
- }
-
- styleBinary = styleBuf.array();
- } else {
- styleBinary = new byte[] {};
- }
-
- styleBinaries.add(styleBinary);
- bufferSize += (styleBinary.length + VarintUtils.unsignedIntByteLength(styleBinary.length));
- }
- bufferSize += VarintUtils.unsignedIntByteLength(styleBinaries.size());
- final ByteBuffer buf = ByteBuffer.allocate(bufferSize);
- VarintUtils.writeUnsignedInt(compositeBinary.length, buf);
- if (compositeBinary.length > 0) {
- buf.put(compositeBinary);
- }
- VarintUtils.writeUnsignedInt(styleBinaries.size(), buf);
- for (final byte[] styleBinary : styleBinaries) {
- VarintUtils.writeUnsignedInt(styleBinary.length, buf);
- buf.put(styleBinary);
- }
- return buf.array();
- }
-
- @Override
- public void fromBinary(final byte[] bytes) {
- final ByteBuffer buf = ByteBuffer.wrap(bytes);
- final int compositeBinaryLength = VarintUtils.readUnsignedInt(buf);
- if (compositeBinaryLength > 0) {
- final byte[] compositeBinary = ByteArrayUtils.safeRead(buf, compositeBinaryLength);
- composite = new PersistableComposite();
- composite.fromBinary(compositeBinary);
- } else {
- composite = null;
- }
- final int styleLength = VarintUtils.readUnsignedInt(buf);
- ByteArrayUtils.verifyBufferSize(buf, styleLength);
- orderedStyles = new ArrayList<>(styleLength);
- for (int i = 0; i < styleLength; i++) {
-
- final int styleBinaryLength = VarintUtils.readUnsignedInt(buf);
- if (styleBinaryLength > 0) {
- final byte[] styleBinary = ByteArrayUtils.safeRead(buf, styleBinaryLength);
- final ByteBuffer styleBuf = ByteBuffer.wrap(styleBinary);
- final int styleCompositeBinaryLength = VarintUtils.readUnsignedInt(styleBuf);
- PersistableComposite styleComposite;
- if (styleCompositeBinaryLength > 0) {
- final byte[] styleCompositeBinary =
- ByteArrayUtils.safeRead(styleBuf, styleCompositeBinaryLength);
- styleComposite = new PersistableComposite();
- styleComposite.fromBinary(styleCompositeBinary);
- } else {
- styleComposite = null;
- }
- final int styleImageBinaryLength = styleBuf.remaining();
- PersistableRenderedImage styleImage;
- if (styleImageBinaryLength > 0) {
- final byte[] styleImageBinary = new byte[styleImageBinaryLength];
- styleBuf.get(styleImageBinary);
- styleImage = new PersistableRenderedImage();
- styleImage.fromBinary(styleImageBinary);
- } else {
- styleImage = null;
- }
- orderedStyles.add(Pair.of(styleImage, styleComposite));
- } else {
- orderedStyles.add(null);
- }
- }
- }
-
- @Override
- public void merge(final Mergeable merge) {
- if (merge instanceof CompositeGroupResult) {
- final CompositeGroupResult other = (CompositeGroupResult) merge;
-
- final List> newOrderedStyles =
- new ArrayList<>();
- final int minStyles = Math.min(orderedStyles.size(), other.orderedStyles.size());
- for (int i = 0; i < minStyles; i++) {
- final Pair thisStyle =
- orderedStyles.get(i);
- final Pair otherStyle =
- other.orderedStyles.get(i);
- // all composites should be the same, if they're not then
- // these composite groups got mis-ordered by style
-
- // keep in mind that they can be null if nothing was
- // rendered to this style or other style because of rules
- // applied to that specific subset of data not resulting in
- // anything rendered for the style
- if (thisStyle != null) {
- if (otherStyle != null) {
- // render the images together and just arbitrarily
- // grab "this" composite as they both should be the
- // same
- newOrderedStyles.add(
- Pair.of(
- mergeImage(thisStyle.getLeft(), otherStyle.getLeft()),
- thisStyle.getRight()));
- } else {
- newOrderedStyles.add(thisStyle);
- }
- } else {
- newOrderedStyles.add(otherStyle);
- }
- }
-
- if (orderedStyles.size() > minStyles) {
- // hopefully this is never the case, but just in case
- newOrderedStyles.addAll(orderedStyles.subList(minStyles, orderedStyles.size()));
- }
- if (other.orderedStyles.size() > minStyles) {
- // hopefully this is never the case, but just in case
- newOrderedStyles.addAll(
- other.orderedStyles.subList(minStyles, other.orderedStyles.size()));
- }
- orderedStyles = newOrderedStyles;
- }
- }
- }
-
- // geotools has a concept of composites, which we need to keep separate so
- // that they can be composited in the original draw order, by default there
- // is only a single composite
- private List orderedComposites;
- // the parent image essentially gets labels rendered to it
- private PersistableRenderedImage parentImage;
-
- public DistributedRenderResult() {}
-
- public DistributedRenderResult(
- final PersistableRenderedImage parentImage,
- final List orderedComposites) {
- this.parentImage = parentImage;
- this.orderedComposites = orderedComposites;
- }
-
- public BufferedImage renderComposite(final DistributedRenderOptions renderOptions) {
- final BufferedImage image =
- ImageUtils.createImage(
- renderOptions.getMapWidth(),
- renderOptions.getMapHeight(),
- renderOptions.getPalette(),
- renderOptions.isTransparent() || renderOptions.isMetatile());
- final Graphics2D graphics =
- ImageUtils.prepareTransparency(
- renderOptions.isTransparent(),
- renderOptions.getBgColor(),
- image,
- null);
- for (final CompositeGroupResult compositeGroup : orderedComposites) {
- compositeGroup.render(graphics, renderOptions.getMapWidth(), renderOptions.getMapHeight());
- }
- final BufferedImage img = parentImage.getImage();
- graphics.drawImage(img, 0, 0, null);
- graphics.dispose();
- return image;
- }
-
- @Override
- public byte[] toBinary() {
- // 4 bytes for the length as an int, and 4 bytes for the size of
- // parentImage
- final byte[] parentImageBinary = parentImage.toBinary();
- int byteSize =
- VarintUtils.unsignedIntByteLength(parentImageBinary.length)
- + parentImageBinary.length
- + VarintUtils.unsignedIntByteLength(orderedComposites.size());
- final List compositeBinaries = new ArrayList<>(orderedComposites.size());
- for (final CompositeGroupResult compositeGroup : orderedComposites) {
- final byte[] compositeGroupBinary = compositeGroup.toBinary();
- byteSize +=
- (compositeGroupBinary.length
- + VarintUtils.unsignedIntByteLength(compositeGroupBinary.length));
- compositeBinaries.add(compositeGroupBinary);
- }
- final ByteBuffer buf = ByteBuffer.allocate(byteSize);
- VarintUtils.writeUnsignedInt(parentImageBinary.length, buf);
- buf.put(parentImageBinary);
- VarintUtils.writeUnsignedInt(orderedComposites.size(), buf);
- for (final byte[] compositeGroupBinary : compositeBinaries) {
- VarintUtils.writeUnsignedInt(compositeGroupBinary.length, buf);
- buf.put(compositeGroupBinary);
- }
- return buf.array();
- }
-
- @Override
- public void fromBinary(final byte[] bytes) {
- final ByteBuffer buf = ByteBuffer.wrap(bytes);
- final byte[] parentImageBinary = ByteArrayUtils.safeRead(buf, VarintUtils.readUnsignedInt(buf));
- parentImage = new PersistableRenderedImage();
- parentImage.fromBinary(parentImageBinary);
- final int numCompositeGroups = VarintUtils.readUnsignedInt(buf);
- orderedComposites = new ArrayList<>(numCompositeGroups);
- for (int i = 0; i < numCompositeGroups; i++) {
- final byte[] compositeGroupBinary =
- ByteArrayUtils.safeRead(buf, VarintUtils.readUnsignedInt(buf));
- final CompositeGroupResult compositeGroup = new CompositeGroupResult();
- compositeGroup.fromBinary(compositeGroupBinary);
- orderedComposites.add(compositeGroup);
- }
- }
-
- @Override
- public void merge(final Mergeable merge) {
- if (merge instanceof DistributedRenderResult) {
- final DistributedRenderResult other = ((DistributedRenderResult) merge);
- final int minComposites = Math.min(orderedComposites.size(), other.orderedComposites.size());
- // first render parents together
- if ((parentImage != null) && (parentImage.image != null)) {
- if ((other.parentImage != null) && (other.parentImage.image != null)) {
- // all composites should be the same, if they're not
- // then these distributed results got mis-ordered by
- // composite group, so composite remains this.composite
- parentImage = mergeImage(parentImage, other.parentImage);
- }
- } else {
- parentImage = other.parentImage;
- }
- final List newOrderedComposites = new ArrayList<>();
- for (int c = 0; c < minComposites; c++) {
- final CompositeGroupResult thisCompositeGroup = orderedComposites.get(c);
- final CompositeGroupResult otherCompositeGroup = other.orderedComposites.get(c);
- thisCompositeGroup.merge(otherCompositeGroup);
- newOrderedComposites.add(thisCompositeGroup);
- }
- if (orderedComposites.size() > minComposites) {
- // hopefully this is never the case, but just in case
- newOrderedComposites.addAll(
- orderedComposites.subList(minComposites, orderedComposites.size()));
- }
- if (other.orderedComposites.size() > minComposites) {
- // hopefully this is never the case, but just in case
- newOrderedComposites.addAll(
- other.orderedComposites.subList(minComposites, other.orderedComposites.size()));
- }
- orderedComposites = newOrderedComposites;
- }
- }
-
- private static PersistableRenderedImage mergeImage(
- final PersistableRenderedImage image1,
- final PersistableRenderedImage image2) {
- final Graphics2D graphics = image1.image.createGraphics();
- graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
- graphics.drawImage(image2.image, 0, 0, null);
- graphics.dispose();
- return new PersistableRenderedImage(image1.image);
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderWMSFacade.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderWMSFacade.java
deleted file mode 100644
index efbc544a88e..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderWMSFacade.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import org.geoserver.wms.WMS;
-import org.geoserver.wms.WMSInfo;
-import org.geoserver.wms.WMSInfo.WMSInterpolation;
-import org.geoserver.wms.WMSInfoImpl;
-
-public class DistributedRenderWMSFacade extends WMS {
- private final DistributedRenderOptions options;
-
- public DistributedRenderWMSFacade(final DistributedRenderOptions options) {
- super(null);
- this.options = options;
- }
-
- @Override
- public int getMaxBuffer() {
- return options.getBuffer();
- }
-
- @Override
- public int getMaxRenderingTime() {
- return options.getMaxRenderTime();
- }
-
- @Override
- public int getMaxRenderingErrors() {
- return options.getMaxErrors();
- }
-
- @Override
- public WMSInterpolation getInterpolation() {
- return WMSInterpolation.values()[options.getWmsInterpolationOrdinal()];
- }
-
- @Override
- public boolean isContinuousMapWrappingEnabled() {
- return options.isContinuousMapWrapping();
- }
-
- @Override
- public boolean isAdvancedProjectionHandlingEnabled() {
- return options.isAdvancedProjectionHandlingEnabled();
- }
-
- @Override
- public WMSInfo getServiceInfo() {
- return new WMSInfoImpl();
- }
-
- @Override
- public int getMaxRequestMemory() {
- // bypass checking memory within distributed rendering
- return -1;
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/InternalDistributedRenderProcess.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/InternalDistributedRenderProcess.java
deleted file mode 100644
index dd5d50a41a4..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/InternalDistributedRenderProcess.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- *
See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import java.awt.image.BufferedImage;
-import org.geotools.coverage.CoverageFactoryFinder;
-import org.geotools.coverage.grid.GridCoverage2D;
-import org.geotools.coverage.grid.GridCoverageFactory;
-import org.geotools.api.data.Query;
-import org.geotools.data.simple.SimpleFeatureCollection;
-import org.geotools.data.simple.SimpleFeatureIterator;
-import org.geotools.process.ProcessException;
-import org.geotools.process.factory.DescribeParameter;
-import org.geotools.process.factory.DescribeProcess;
-import org.geotools.process.factory.DescribeResult;
-import org.geotools.util.factory.GeoTools;
-import org.geotools.api.coverage.grid.GridGeometry;
-import org.geotools.api.feature.simple.SimpleFeature;
-
-/**
- * This class can be used as a GeoTools Render Transform ('geowave:DistributedRender') within an SLD
- * on any layer that uses the GeoWave Data Store. An example SLD is provided
- * (example-slds/DecimatePoints.sld). The pixel-size allows you to skip more than a single pixel.
- * For example, a pixel size of 3 would skip an estimated 3x3 pixel cell in GeoWave's row IDs. Note
- * that rows are only skipped when a feature successfully passes filters.
- */
-@DescribeProcess(
- title = "InternalDistributedRender",
- description = "This process will enable GeoWave to render WMS requests within the server and then this will be responsible for compositing the result client-side.")
-public class InternalDistributedRenderProcess {
- @DescribeResult(
- name = "result",
- description = "This is just a pass-through, the key is to provide enough information within invertQuery to perform a map to screen transform")
- public GridCoverage2D execute(
- @DescribeParameter(
- name = "data",
- description = "Feature collection containing the rendered image") final SimpleFeatureCollection features)
- throws ProcessException {
- // vector-to-raster render transform that take a single feature that
- // wraps a distributed render result and converts it to a GridCoverage2D
- if (features != null) {
- final SimpleFeatureIterator it = features.features();
- if (it.hasNext()) {
- final SimpleFeature resultFeature = it.next();
- final DistributedRenderResult actualResult =
- (DistributedRenderResult) resultFeature.getAttribute(0);
- final DistributedRenderOptions renderOptions =
- (DistributedRenderOptions) resultFeature.getAttribute(1);
- // convert to the GridCoverage2D required for output
- final GridCoverageFactory gcf =
- CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
- final BufferedImage result = actualResult.renderComposite(renderOptions);
- final GridCoverage2D gridCov =
- gcf.create("Process Results", result, renderOptions.getEnvelope());
- return gridCov;
- }
- }
- return null;
- }
-
- public Query invertQuery(final Query targetQuery, final GridGeometry targetGridGeometry)
- throws ProcessException {
- // it seems that without invertQuery returning the targetQuery, the geom
- // property field does not get set in the filter (line 205 of
- // org.geotools.renderer.lite.RenderingTransformationHelper in geotools
- // v15.1)
- return targetQuery;
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/PersistableComposite.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/PersistableComposite.java
deleted file mode 100644
index f95ad084f3c..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/PersistableComposite.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- *
See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import java.awt.AlphaComposite;
-import java.awt.Composite;
-import java.nio.ByteBuffer;
-import org.geotools.renderer.composite.BlendComposite;
-import org.geotools.renderer.composite.BlendComposite.BlendingMode;
-import org.locationtech.geowave.core.index.persist.Persistable;
-
-public class PersistableComposite implements Persistable {
- private boolean isBlend = true;
- private int blendModeOrAlphaRule = 0;
- private float alpha = 1f;
-
- public PersistableComposite() {}
-
- public PersistableComposite(final Composite composite) {
- if (composite instanceof BlendComposite) {
- isBlend = true;
- blendModeOrAlphaRule = ((BlendComposite) composite).getBlend().ordinal();
- alpha = ((BlendComposite) composite).getAlpha();
- } else if (composite instanceof AlphaComposite) {
- isBlend = false;
- blendModeOrAlphaRule = ((AlphaComposite) composite).getRule();
- alpha = ((AlphaComposite) composite).getAlpha();
- }
- }
-
- public Composite getComposite() {
- if (isBlend) {
- return BlendComposite.getInstance(BlendingMode.values()[blendModeOrAlphaRule], alpha);
- } else {
- return AlphaComposite.getInstance(blendModeOrAlphaRule, alpha);
- }
- }
-
- @Override
- public byte[] toBinary() {
- final ByteBuffer buf = ByteBuffer.allocate(9);
- buf.put(isBlend ? (byte) 0 : (byte) 1);
- buf.putInt(blendModeOrAlphaRule);
- buf.putFloat(alpha);
- return buf.array();
- }
-
- @Override
- public void fromBinary(final byte[] bytes) {
- final ByteBuffer buf = ByteBuffer.wrap(bytes);
- isBlend = (buf.get() == 0);
- blendModeOrAlphaRule = buf.getInt();
- alpha = buf.getFloat();
- }
-}
diff --git a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/PersistableRenderedImage.java b/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/PersistableRenderedImage.java
deleted file mode 100644
index 664430eb250..00000000000
--- a/extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/render/PersistableRenderedImage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- *
See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import javax.imageio.ImageIO;
-import org.locationtech.geowave.core.index.persist.Persistable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import ar.com.hjg.pngj.FilterType;
-import it.geosolutions.imageio.plugins.png.PNGWriter;
-
-/**
- * This class wraps a rendered image as a GeoWave Persistable object. It serializes and deserializes
- * the BufferedImage as a png using ImageIO.
- */
-public class PersistableRenderedImage implements Persistable {
- private static final Logger LOGGER = LoggerFactory.getLogger(PersistableRenderedImage.class);
- private static final float DEFAULT_PNG_QUALITY = 0.8f;
- public BufferedImage image;
-
- public PersistableRenderedImage() {}
-
- public PersistableRenderedImage(final BufferedImage image) {
- this.image = image;
- }
-
- public BufferedImage getImage() {
- return image;
- }
-
- @Override
- public byte[] toBinary() {
- if (image == null) {
- return new byte[0];
- }
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try {
- // we could just use the expected output format, but that may not be
- // correct, instead we use PNG
-
- // it seems that even though the requested image may be jpeg
- // example, the individual styles may need to retain transparency to
- // be composited correctly
- final PNGWriter writer = new PNGWriter();
- image =
- (BufferedImage) writer.writePNG(image, baos, DEFAULT_PNG_QUALITY, FilterType.FILTER_NONE);
- } catch (final Exception e) {
- LOGGER.warn("Unable to serialize image", e);
- }
- return baos.toByteArray();
- }
-
- @Override
- public void fromBinary(final byte[] bytes) {
- if (bytes.length == 0) {
- return;
- }
- final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- try {
- image = ImageIO.read(bais);
- } catch (final IOException e) {
- LOGGER.warn("Unable to deserialize image", e);
- }
- }
-}
diff --git a/extensions/adapters/vector/src/main/resources/applicationContext.xml b/extensions/adapters/vector/src/main/resources/applicationContext.xml
deleted file mode 100644
index 2813a276a15..00000000000
--- a/extensions/adapters/vector/src/main/resources/applicationContext.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/extensions/adapters/vector/src/test/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderOptionsTest.java b/extensions/adapters/vector/src/test/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderOptionsTest.java
deleted file mode 100644
index 6ee00a62514..00000000000
--- a/extensions/adapters/vector/src/test/java/org/locationtech/geowave/adapter/vector/render/DistributedRenderOptionsTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
- *
- *
See the NOTICE file distributed with this work for additional information regarding copyright
- * ownership. All rights reserved. This program and the accompanying materials are made available
- * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
- * available at http://www.apache.org/licenses/LICENSE-2.0.txt
- */
-package org.locationtech.geowave.adapter.vector.render;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import java.awt.image.DataBuffer;
-import java.awt.image.IndexColorModel;
-import org.geotools.geometry.jts.ReferencedEnvelope;
-import org.junit.Test;
-import org.locationtech.geowave.core.geotime.util.GeometryUtils;
-
-public class DistributedRenderOptionsTest {
-
- @Test
- public void testPaletteRoundTrip() {
- final int[] rgbs = {0x00000000, 0xFFFF0000, 0x8000FF00, 0xFF0000FF, 0xFFFFFFFF};
- final IndexColorModel palette =
- new IndexColorModel(4, rgbs.length, rgbs, 0, true, 0, DataBuffer.TYPE_BYTE);
-
- final IndexColorModel restored = roundTrip(palette).getPalette();
-
- assertEquals(palette.getPixelSize(), restored.getPixelSize());
- assertEquals(palette.getMapSize(), restored.getMapSize());
- assertEquals(palette.hasAlpha(), restored.hasAlpha());
- assertEquals(palette.getTransparentPixel(), restored.getTransparentPixel());
- assertEquals(palette.getTransferType(), restored.getTransferType());
- final int[] expected = new int[rgbs.length];
- final int[] actual = new int[rgbs.length];
- palette.getRGBs(expected);
- restored.getRGBs(actual);
- assertArrayEquals(expected, actual);
- }
-
- @Test
- public void testNoPalette() {
- assertNull(roundTrip(null).getPalette());
- }
-
- private static DistributedRenderOptions roundTrip(final IndexColorModel palette) {
- final DistributedRenderOptions options = new DistributedRenderOptions();
- options.setEnvelope(new ReferencedEnvelope(-10, 10, -5, 5, GeometryUtils.getDefaultCRS()));
- options.setMapWidth(256);
- options.setMapHeight(128);
- options.setPalette(palette);
- options.setMaxErrors(3);
- final DistributedRenderOptions restored = new DistributedRenderOptions();
- restored.fromBinary(options.toBinary());
- assertEquals(3, restored.getMaxErrors());
- assertEquals(256, restored.getMapWidth());
- return restored;
- }
-}
diff --git a/pom.xml b/pom.xml
index e8a545bd8b2..3264a8b5004 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1197,6 +1197,18 @@
${geotools.version}
${geotools.scope}
+