This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit e1073a35efd77db4ee78d818782ee52b8b29940e Author: jsorel <[email protected]> AuthorDate: Mon Nov 9 10:34:31 2026 +0100 feat(SE1): remove jaxb annotations on SE1 classes --- .../org.apache.sis.portrayal/main/module-info.java | 10 +- .../org/apache/sis/style/se1/AbstractStyle.java | 32 +----- .../main/org/apache/sis/style/se1/AnchorPoint.java | 18 ---- .../org/apache/sis/style/se1/ChannelSelection.java | 21 ---- .../main/org/apache/sis/style/se1/ColorMap.java | 15 --- .../org/apache/sis/style/se1/ColorReplacement.java | 11 -- .../apache/sis/style/se1/ContrastEnhancement.java | 22 ---- .../org/apache/sis/style/se1/CoverageStyle.java | 4 - .../main/org/apache/sis/style/se1/Description.java | 17 --- .../org/apache/sis/style/se1/Displacement.java | 18 ---- .../main/org/apache/sis/style/se1/ElseFilter.java | 49 --------- .../apache/sis/style/se1/ExpressionAdapter.java | 49 --------- .../org/apache/sis/style/se1/ExternalGraphic.java | 24 +---- .../org/apache/sis/style/se1/FeatureTypeStyle.java | 4 - .../main/org/apache/sis/style/se1/Fill.java | 16 --- .../main/org/apache/sis/style/se1/Font.java | 11 -- .../main/org/apache/sis/style/se1/Graphic.java | 39 +------ .../main/org/apache/sis/style/se1/GraphicFill.java | 16 +-- .../org/apache/sis/style/se1/GraphicStroke.java | 22 +--- .../org/apache/sis/style/se1/GraphicalElement.java | 4 +- .../org/apache/sis/style/se1/GraphicalSymbol.java | 14 +-- .../main/org/apache/sis/style/se1/Halo.java | 18 ---- .../org/apache/sis/style/se1/LabelPlacement.java | 13 --- .../org/apache/sis/style/se1/LegendGraphic.java | 16 +-- .../org/apache/sis/style/se1/LinePlacement.java | 32 ------ .../org/apache/sis/style/se1/LineSymbolizer.java | 20 +--- .../main/org/apache/sis/style/se1/Mark.java | 47 ++------- .../org/apache/sis/style/se1/PointPlacement.java | 24 +---- .../org/apache/sis/style/se1/PointSymbolizer.java | 41 ++------ .../apache/sis/style/se1/PolygonSymbolizer.java | 41 +------- .../org/apache/sis/style/se1/RasterSymbolizer.java | 27 ----- .../main/org/apache/sis/style/se1/Rule.java | 116 +-------------------- .../org/apache/sis/style/se1/SelectedChannel.java | 18 ---- .../org/apache/sis/style/se1/ShadedRelief.java | 20 ---- .../main/org/apache/sis/style/se1/Stroke.java | 38 ------- .../org/apache/sis/style/se1/StyleElement.java | 13 --- .../main/org/apache/sis/style/se1/Symbolizer.java | 33 ------ .../main/org/apache/sis/style/se1/Symbology.java | 7 ++ .../org/apache/sis/style/se1/TextSymbolizer.java | 28 +---- .../org/apache/sis/style/se1/package-info.java | 22 ---- .../test/org/apache/sis/style/se1/MarkTest.java | 49 +++++++++ .../apache/sis/style/se1/PointSymbolizerTest.java | 29 ++++++ .../test/org/apache/sis/style/se1/RuleTest.java | 17 +++ .../test/org/apache/sis/style/se1/XmlTest.java | 50 --------- 44 files changed, 145 insertions(+), 990 deletions(-) diff --git a/endorsed/src/org.apache.sis.portrayal/main/module-info.java b/endorsed/src/org.apache.sis.portrayal/main/module-info.java index 0047f4c479..d58893c84a 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/module-info.java +++ b/endorsed/src/org.apache.sis.portrayal/main/module-info.java @@ -25,7 +25,6 @@ */ module org.apache.sis.portrayal { requires transitive org.apache.sis.storage; - requires jakarta.xml.bind; exports org.apache.sis.style; exports org.apache.sis.portrayal; @@ -39,12 +38,9 @@ module org.apache.sis.portrayal { exports org.apache.sis.style.se1.function to org.apache.sis.portrayal.map; // In the "incubator" sub-project. + exports org.apache.sis.style.sld1 to + org.apache.sis.portrayal.map; // In the "incubator" sub-project. + provides org.apache.sis.filter.FunctionRegister with org.apache.sis.style.se1.function.SymbologyFunctions; - - /* - * Allow JAXB to use reflection for marshalling and - * unmarshalling Apache SIS objects in XML documents. - */ - opens org.apache.sis.style.se1 to jakarta.xml.bind; } diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AbstractStyle.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AbstractStyle.java index 39f0e3908f..835264da2a 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AbstractStyle.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AbstractStyle.java @@ -21,10 +21,6 @@ import java.util.List; import java.util.ArrayList; import java.util.EnumSet; import java.util.Optional; -import jakarta.xml.bind.Unmarshaller; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlAttribute; import org.opengis.util.GenericName; // Specific to the geoapi-3.1 and geoapi-4.0 branches: @@ -43,13 +39,6 @@ import org.opengis.filter.ResourceId; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(propOrder = { - "name", - "description", - "featureTypeName", -// "semanticTypeIdentifiers", - "rules" -}) public abstract class AbstractStyle<R> extends StyleElement<R> { /** * Version number of the Symbology Encoding Implementation Specification standard currently implemented. @@ -65,7 +54,6 @@ public abstract class AbstractStyle<R> extends StyleElement<R> { * * @see #getVersion() */ - @XmlAttribute protected String version; /** @@ -74,7 +62,6 @@ public abstract class AbstractStyle<R> extends StyleElement<R> { * @see #getName() * @see #setName(String) */ - @XmlElement(name = "Name") protected String name; /** @@ -83,7 +70,6 @@ public abstract class AbstractStyle<R> extends StyleElement<R> { * @see #getDescription() * @see #setDescription(Description) */ - @XmlElement(name = "Description") protected Description<R> description; /** @@ -100,7 +86,6 @@ public abstract class AbstractStyle<R> extends StyleElement<R> { * @see #getFeatureTypeName() * @see #setFeatureTypeName(GenericName) */ - @XmlElement(name = "FeatureTypeName") protected GenericName featureTypeName; /** @@ -109,7 +94,6 @@ public abstract class AbstractStyle<R> extends StyleElement<R> { * * @see #semanticTypeIdentifiers() */ -// @XmlElement(name = "SemanticTypeIdentifier") private EnumSet<SemanticType> semanticTypeIdentifiers; /** @@ -117,26 +101,16 @@ public abstract class AbstractStyle<R> extends StyleElement<R> { * * <h4>Online rules</h4> * A XML document may contain links to rules instead of a full definitions. - * Such {@code se:OnlineResource} elements are handled at marshalling time. - * When reading a XML document, the rule links are resolved automatically. + * When reading a XML document, each {@code se:OnlineResource} link is represented by + * a rule having only an {@linkplain Rule#getOnlineSource() online source}. + * The link is not resolved. * When writing a XML document, some rules may be replaced by online resources * if {@link Rule#getOnlineSource()} is provided. * - * @todo JAXB adapter for handling the online case is not yet written. - * * @see #rules() */ - @XmlElement(name = "Rule") private List<Rule<R>> rules; - /** - * Invoked by JAXB before unmarshalling this mark. - * Avoid giving the false impression that the XML document contained a version string. - */ - private void beforeUnmarshal(Unmarshaller caller, Object parent) { - version = "unspecified"; - } - /** * Creates an initially empty feature type style. * Callers should set the following properties after construction: diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AnchorPoint.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AnchorPoint.java index f894f274fe..feddf8f1ed 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AnchorPoint.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/AnchorPoint.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -39,11 +35,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "AnchorPointType", propOrder = { - "anchorPointX", - "anchorPointY" -}) -@XmlRootElement(name = "AnchorPoint") public class AnchorPoint<R> extends StyleElement<R> { /** * The <var>x</var> coordinate of the anchor point. @@ -52,7 +43,6 @@ public class AnchorPoint<R> extends StyleElement<R> { * @see #getAnchorPointX() * @see #setAnchorPointX(Expression) */ - @XmlElement(name = "AnchorPointX", required = true) protected Expression<R, ? extends Number> anchorPointX; /** @@ -62,16 +52,8 @@ public class AnchorPoint<R> extends StyleElement<R> { * @see #getAnchorPointY() * @see #setAnchorPointY(Expression) */ - @XmlElement(name = "AnchorPointY", required = true) protected Expression<R, ? extends Number> anchorPointY; - /** - * For JAXB unmarshalling only. - */ - private AnchorPoint() { - // Thread-local factory will be used. - } - /** * Creates an anchor point initialized to <var>x</var> = 0.5 and <var>y</var> = 0.5. * This initial position is the center of the graphic/label. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ChannelSelection.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ChannelSelection.java index ae7bcd9541..590694edea 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ChannelSelection.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ChannelSelection.java @@ -16,9 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; import org.apache.sis.util.resources.Errors; @@ -35,49 +32,31 @@ import org.apache.sis.util.resources.Errors; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "ChannelSelectionType", propOrder = { - "red", - "green", - "blue", - "gray" -}) -@XmlRootElement(name = "ChannelSelection") public class ChannelSelection<R> extends StyleElement<R> { /** * The red channel, or {@code null} if none. * This property is mutually exclusive with {@link #gray}. */ - @XmlElement(name = "RedChannel") protected SelectedChannel<R> red; /** * The green channel, or {@code null} if none. * This property is mutually exclusive with {@link #gray}. */ - @XmlElement(name = "GreenChannel") protected SelectedChannel<R> green; /** * The blue channel, or {@code null} if none. * This property is mutually exclusive with {@link #gray}. */ - @XmlElement(name = "BlueChannel") protected SelectedChannel<R> blue; /** * The gray channel, or {@code null} if none. * This property is mutually exclusive with {@link #red}, {@link #green} and {@link #blue}. */ - @XmlElement(name = "GrayChannel") protected SelectedChannel<R> gray; - /** - * For JAXB unmarshalling only. - */ - private ChannelSelection() { - // Thread-local factory will be used. - } - /** * Creates an initially empty channel selection. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorMap.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorMap.java index d910f0541f..76f82780ef 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorMap.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorMap.java @@ -17,8 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -44,12 +42,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "ColorMapType", propOrder = { -// "categorize", -// "interpolate", -// "jenks" -}) -@XmlRootElement(name = "ColorMap") public class ColorMap<R> extends StyleElement<R> { /** * The function computing colors from the raster data, or {@code null} if none. @@ -59,13 +51,6 @@ public class ColorMap<R> extends StyleElement<R> { */ protected Expression<R,?> function; - /** - * For JAXB unmarshalling only. - */ - private ColorMap() { - // Thread-local factory will be used. - } - /** * Creates an initially empty color map. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorReplacement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorReplacement.java index f0806a2457..1685d0d911 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorReplacement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ColorReplacement.java @@ -17,8 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -37,8 +35,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "ColorReplacementType") -@XmlRootElement(name = "ColorReplacement") public class ColorReplacement<R> extends StyleElement<R> { /** * The function computing replacement colors, or {@code null} if none. @@ -48,13 +44,6 @@ public class ColorReplacement<R> extends StyleElement<R> { */ protected Expression<R,?> function; - /** - * For JAXB unmarshalling only. - */ - private ColorReplacement() { - // Thread-local factory will be used. - } - /** * Creates an initially empty color replacement. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ContrastEnhancement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ContrastEnhancement.java index 794f1898c0..dfe1298c6c 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ContrastEnhancement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ContrastEnhancement.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -35,12 +31,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "ContrastEnhancementType", propOrder = { -// "normalize", -// "histogram", - "gammaValue" -}) -@XmlRootElement(name = "ContrastEnhancement") public class ContrastEnhancement<R> extends StyleElement<R> { /** * Method to use for applying contrast enhancement, or {@code null} for the default value. @@ -48,8 +38,6 @@ public class ContrastEnhancement<R> extends StyleElement<R> { * * @see #getMethod() * @see #setMethod(ContrastMethod) - * - * @todo Marshall as empty "Normalize" or "Histogram" XML element. */ protected ContrastMethod method; @@ -58,19 +46,9 @@ public class ContrastEnhancement<R> extends StyleElement<R> { * * @see #getGammaValue() * @see #setGammaValue(Expression) - * - * @todo Add a JAXB adapter for marshalling as a plain number. */ - @XmlElement(name = "GammaValue") protected Expression<R, ? extends Number> gammaValue; - /** - * For JAXB unmarshalling only. - */ - private ContrastEnhancement() { - // Thread-local factory will be used. - } - /** * Creates a contrast enhancement initialized to no operation. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/CoverageStyle.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/CoverageStyle.java index 1c959b91e1..a802a9c476 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/CoverageStyle.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/CoverageStyle.java @@ -16,8 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlRootElement; import org.apache.sis.coverage.BandedCoverage; @@ -26,8 +24,6 @@ import org.apache.sis.coverage.BandedCoverage; * * @author Martin Desruisseaux (Geomatys) */ -@XmlType(name = "CoverageStyleType") -@XmlRootElement(name = "CoverageStyle") public class CoverageStyle extends AbstractStyle<BandedCoverage> { /** * The default style factory for coverages. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Description.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Description.java index 49dc503fe5..d6870efd6e 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Description.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Description.java @@ -17,9 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; import org.opengis.util.InternationalString; @@ -41,11 +38,6 @@ import org.opengis.util.InternationalString; * * @todo Consider replacing this class by {@link org.opengis.metadata.identification.Identification}. */ -@XmlType(name = "DescriptionType", propOrder = { - "title", - "summary" -}) -@XmlRootElement(name = "Description") public class Description<R> extends StyleElement<R> { /** * Human readable title of the style, or {@code null} if none. @@ -53,7 +45,6 @@ public class Description<R> extends StyleElement<R> { * @see #getTitle() * @see #setTitle(InternationalString) */ - @XmlElement(name = "Title") protected InternationalString title; /** @@ -63,16 +54,8 @@ public class Description<R> extends StyleElement<R> { * @see #getAbstract() * @see #setAbstract(InternationalString) */ - @XmlElement(name = "Abstract") protected InternationalString summary; - /** - * For JAXB unmarshalling only. - */ - private Description() { - // Thread-local factory will be used. - } - /** * Creates an initially empty description. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Displacement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Displacement.java index 119c8ff71f..816ba4267a 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Displacement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Displacement.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -46,11 +42,6 @@ import org.opengis.filter.Expression; * @see Graphic#getDisplacement() * @see PolygonSymbolizer#getDisplacement() */ -@XmlType(name = "DisplacementType", propOrder = { - "displacementX", - "displacementY" -}) -@XmlRootElement(name = "Displacement") public class Displacement<R> extends StyleElement<R> { /** * The <var>x</var> offset from the geometry point. @@ -59,7 +50,6 @@ public class Displacement<R> extends StyleElement<R> { * @see #getDisplacementX() * @see #setDisplacementX(Expression) */ - @XmlElement(name = "DisplacementX", required = true) protected Expression<R, ? extends Number> displacementX; /** @@ -69,16 +59,8 @@ public class Displacement<R> extends StyleElement<R> { * @see #getDisplacementY() * @see #setDisplacementY(Expression) */ - @XmlElement(name = "DisplacementY", required = true) protected Expression<R, ? extends Number> displacementY; - /** - * For JAXB unmarshalling only. - */ - private Displacement() { - // Thread-local factory will be used. - } - /** * Creates a displacement initialized to zero offsets. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ElseFilter.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ElseFilter.java deleted file mode 100644 index e70545a01f..0000000000 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ElseFilter.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.style.se1; - -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlRootElement; - - -/** - * The element to marshall when no other rule matches the conditions. - * - * @author Martin Desruisseaux (Geomatys) - */ -@XmlType(name = "ElseFilterType") -@XmlRootElement(name = "ElseFilter") -final class ElseFilter { - /** - * The singleton instance. - */ - static final ElseFilter INSTANCE = new ElseFilter(); - - /** - * Creates the singleton instance. - */ - private ElseFilter() { - } - - /** - * Returns a string representation of this element. - */ - @Override - public String toString() { - return "ElseFilter"; - } -} diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ExpressionAdapter.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ExpressionAdapter.java deleted file mode 100644 index 2dd08f7e4d..0000000000 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ExpressionAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.style.se1; - -import jakarta.xml.bind.annotation.adapters.XmlAdapter; - -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.filter.Expression; - - -/** - * Adapter for expression in style. - * This is a place-holder for future work. - * - * @author Martin Desruisseaux (Geomatys) - * - * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. - */ -final class ExpressionAdapter<R> extends XmlAdapter<String, Expression<R,?>> { - /** - * Creates an adapter. - */ - public ExpressionAdapter() { - } - - @Override - public String marshal(Expression<R,?> value) { - return null; - } - - @Override - public Expression<R,?> unmarshal(String value) { - return null; - } -} diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ExternalGraphic.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ExternalGraphic.java index 2731e48526..a3d19d4472 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ExternalGraphic.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ExternalGraphic.java @@ -18,9 +18,6 @@ package org.apache.sis.style.se1; import java.util.List; import java.util.ArrayList; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; /** @@ -34,34 +31,15 @@ import jakarta.xml.bind.annotation.XmlRootElement; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "ExternalGraphicType", propOrder = { -// "onlineResource", // XML encoding not yet available. -// "inlineContent", // Idem. - "format", - "colorReplacements" -}) -@XmlRootElement(name = "ExternalGraphic") public class ExternalGraphic<R> extends GraphicalSymbol<R> { /** * A list of colors to replace, or {@code null} if none. - * - * <h4>XML marshalling</h4> - * A null value is not synonymous to an empty list. - * An empty list causes an empty {@code <ColorReplacement/>} element to be marshalled, - * while a {@code null} value results in no element being marshalled. + * This list is created when first needed. * * @see #colorReplacements() */ - @XmlElement(name = "ColorReplacement") protected List<ColorReplacement<R>> colorReplacements; - /** - * For JAXB unmarshalling only. - */ - private ExternalGraphic() { - // Thread-local factory will be used. - } - /** * Creates an initially empty external graphic. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/FeatureTypeStyle.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/FeatureTypeStyle.java index 34c96f2573..a1f3a41736 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/FeatureTypeStyle.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/FeatureTypeStyle.java @@ -16,8 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlRootElement; import org.apache.sis.filter.DefaultFilterFactory; // Specific to the geoapi-3.1 and geoapi-4.0 branches: @@ -32,8 +30,6 @@ import org.opengis.feature.Feature; * @author Chris Dillard (SYS Technologies) * @author Martin Desruisseaux (Geomatys) */ -@XmlType(name = "FeatureTypeStyleType") -@XmlRootElement(name = "FeatureTypeStyle") public class FeatureTypeStyle extends AbstractStyle<Feature> { /** * The default style factory for features. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Fill.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Fill.java index a1a69ba95e..78db9ca16c 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Fill.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Fill.java @@ -18,9 +18,6 @@ package org.apache.sis.style.se1; import java.awt.Color; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -37,11 +34,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "FillType", propOrder = { - "graphicFill", -// "svgParameter" -}) -@XmlRootElement(name = "Fill") public class Fill<R> extends StyleElement<R> implements Translucent<R> { /** * The image to use for filling the area, or {@code null} if a solid color should be used. @@ -49,7 +41,6 @@ public class Fill<R> extends StyleElement<R> implements Translucent<R> { * @see #getGraphicFill() * @see #setGraphicFill(GraphicFill) */ - @XmlElement(name = "GraphicFill") protected GraphicFill<R> graphicFill; /** @@ -75,13 +66,6 @@ public class Fill<R> extends StyleElement<R> implements Translucent<R> { */ protected Expression<R, ? extends Number> opacity; - /** - * For JAXB unmarshalling only. - */ - private Fill() { - // Thread-local factory will be used. - } - /** * Creates an opaque fill initialized to the gray color. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Font.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Font.java index fd5adf9f73..470e05d47f 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Font.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Font.java @@ -18,8 +18,6 @@ package org.apache.sis.style.se1; import java.util.List; import java.util.ArrayList; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -35,8 +33,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "FontType") -@XmlRootElement(name = "Font") public class Font<R> extends StyleElement<R> { /** * Family names of the font to use, in preference order. @@ -77,13 +73,6 @@ public class Font<R> extends StyleElement<R> { */ protected Expression<R, ? extends Number> size; - /** - * For JAXB unmarshalling only. - */ - private Font() { - // Thread-local factory will be used. - } - /** * Creates a font initialized to normal style, normal weight and a size of 10 pixels. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Graphic.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Graphic.java index 339ceb3db9..f7342a8b2f 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Graphic.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Graphic.java @@ -18,10 +18,6 @@ package org.apache.sis.style.se1; import java.util.List; import java.util.ArrayList; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElements; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -39,15 +35,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "GraphicType", propOrder = { - "graphicalSymbols", - "opacity", - "size", - "rotation", - "anchorPoint", - "displacement" -}) -@XmlRootElement(name = "Graphic") public class Graphic<R> extends StyleElement<R> implements Translucent<R> { /** * List of external image files or marks that comprise this graphic. @@ -56,10 +43,6 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { * * @see #graphicalSymbols() */ - @XmlElements({ - @XmlElement(name = "Mark", type = Mark.class), - @XmlElement(name = "ExternalGraphic", type = ExternalGraphic.class) - }) private List<GraphicalSymbol<R>> graphicalSymbols; /** @@ -67,10 +50,7 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { * * @see #getOpacity() * @see #setOpacity(Expression) - * - * @todo Needs a JAXB adapter to {@code ParameterValueType}. */ - @XmlElement(name = "Opacity") protected Expression<R, ? extends Number> opacity; /** @@ -78,10 +58,7 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { * * @see #getSize() * @see #setSize(Expression) - * - * @todo Needs a JAXB adapter to {@code ParameterValueType}. */ - @XmlElement(name = "Size") protected Expression<R, ? extends Number> size; /** @@ -89,10 +66,7 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { * * @see #getRotation() * @see #setRotation(Expression) - * - * @todo Needs a JAXB adapter to {@code ParameterValueType}. */ - @XmlElement(name = "Rotation") protected Expression<R, ? extends Number> rotation; /** @@ -101,7 +75,6 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { * @see #getAnchorPoint() * @see #setAnchorPoint(AnchorPoint) */ - @XmlElement(name = "AnchorPoint") protected AnchorPoint<R> anchorPoint; /** @@ -110,16 +83,8 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { * @see #getDisplacement() * @see #setDisplacement(Displacement) */ - @XmlElement(name = "Displacement") protected Displacement<R> displacement; - /** - * For JAXB unmarshalling only. - */ - private Graphic() { - // Thread-local factory will be used. - } - /** * Creates a graphic initialized to opaque default mark, default size and no rotation. * @@ -273,7 +238,7 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { /** * Sets the location inside of a graphic to use for anchoring the graphic to the main-geometry point. * The given instance is stored by reference, it is not cloned. If this method is never invoked, - * then the default value is a {@linkplain AnchorPoint#AnchorPoint() default anchor point}. + * then the default value is a {@linkplain AnchorPoint#AnchorPoint(StyleFactory) default anchor point}. * * @param value new anchor point, or {@code null} for resetting the default value. */ @@ -306,7 +271,7 @@ public class Graphic<R> extends StyleElement<R> implements Translucent<R> { /** * Sets the two-dimensional displacement from the "hot-spot" point. * The given instance is stored by reference, it is not cloned. If this method is never invoked, - * then the default value is a {@linkplain Displacement#Displacement() default displacement}. + * then the default value is a {@linkplain Displacement#Displacement(StyleFactory) default displacement}. * * @param value new displacement from the "hot-spot" point, or {@code null} for resetting the default value. */ diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicFill.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicFill.java index 4ce06a152c..394816d383 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicFill.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicFill.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - /** * Stipple-fill repeated graphic. @@ -33,8 +29,6 @@ import jakarta.xml.bind.annotation.XmlRootElement; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "GraphicFillType") -@XmlRootElement(name = "GraphicFill") public class GraphicFill<R> extends StyleElement<R> implements GraphicalElement<R> { /** * The graphic to be repeated, or {@code null} for lazily constructed default. @@ -45,13 +39,6 @@ public class GraphicFill<R> extends StyleElement<R> implements GraphicalElement< */ protected Graphic<R> graphic; - /** - * For JAXB unmarshalling only. - */ - private GraphicFill() { - // Thread-local factory will be used. - } - /** * Creates a graphic fill initialized to a default graphic. * @@ -82,7 +69,6 @@ public class GraphicFill<R> extends StyleElement<R> implements GraphicalElement< * @see GraphicStroke#getGraphic() */ @Override - @XmlElement(name = "Graphic", required = true) public final Graphic<R> getGraphic() { if (graphic == null) { graphic = factory.createGraphic(); @@ -93,7 +79,7 @@ public class GraphicFill<R> extends StyleElement<R> implements GraphicalElement< /** * Sets the graphic to be repeated. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic() default instance}. + * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic(StyleFactory) default instance}. * * @param value new graphic, or {@code null} for resetting the default value. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicStroke.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicStroke.java index 89e698fb3e..af79c8b8bb 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicStroke.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicStroke.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -36,12 +32,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "GraphicStrokeType", propOrder = { - "graphic", - "initialGap", - "gap" -}) -@XmlRootElement(name = "GraphicStroke") public class GraphicStroke<R> extends StyleElement<R> implements GraphicalElement<R> { /** * The graphic to be repeated, or {@code null} for lazily constructed default. @@ -58,7 +48,6 @@ public class GraphicStroke<R> extends StyleElement<R> implements GraphicalElemen * @see #getInitialGap() * @see #setInitialGap(Expression) */ - @XmlElement(name = "InitialGap") protected Expression<R, ? extends Number> initialGap; /** @@ -67,16 +56,8 @@ public class GraphicStroke<R> extends StyleElement<R> implements GraphicalElemen * @see #getGap() * @see #setGap(Expression) */ - @XmlElement(name = "Gap") protected Expression<R, ? extends Number> gap; - /** - * For JAXB unmarshalling only. - */ - private GraphicStroke() { - // Thread-local factory will be used. - } - /** * Creates a graphic stroke initialized to a default graphic and no gap. * @@ -109,7 +90,6 @@ public class GraphicStroke<R> extends StyleElement<R> implements GraphicalElemen * @see GraphicFill#getGraphic() */ @Override - @XmlElement(name = "Graphic", required = true) public final Graphic<R> getGraphic() { if (graphic == null) { graphic = factory.createGraphic(); @@ -120,7 +100,7 @@ public class GraphicStroke<R> extends StyleElement<R> implements GraphicalElemen /** * Sets the graphic to be repeated. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic() default instance}. + * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic(StyleFactory) default instance}. * * @param value new graphic, or {@code null} for resetting the default value. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalElement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalElement.java index bbcb3a85bf..b76067b690 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalElement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalElement.java @@ -37,10 +37,10 @@ public interface GraphicalElement<R> { /** * Sets the graphic. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic() default instance}. + * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic(StyleFactory) default instance}. * * <p>The interpretation of {@code null} argument value depends on whether the graphic is mandatory or optional. - * If mandatory, then a {@code null} argument value resets the {@linkplain Graphic#Graphic() default graphic}. + * If mandatory, then a {@code null} argument value resets the {@linkplain Graphic#Graphic(StyleFactory) default graphic}. * If optional, then a {@code null} argument value specifies to plot nothing. * * @param value new picture, or {@code null} for none or for resetting the default value. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalSymbol.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalSymbol.java index 451ab7d6e7..58082bef71 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalSymbol.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/GraphicalSymbol.java @@ -18,8 +18,6 @@ package org.apache.sis.style.se1; import javax.swing.Icon; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.metadata.citation.OnlineResource; @@ -38,7 +36,6 @@ import org.opengis.metadata.citation.OnlineResource; * * @see Graphic#graphicalSymbols() */ -@XmlTransient public abstract class GraphicalSymbol<R> extends StyleElement<R> { /** * URL to the image or mark, or {@code null} if none. @@ -46,7 +43,6 @@ public abstract class GraphicalSymbol<R> extends StyleElement<R> { * @see #getOnlineResource() * @see #setOnlineResource(OnlineResource) */ -// @XmlElement(name = "OnlineResource") protected OnlineResource onlineResource; /** @@ -57,25 +53,17 @@ public abstract class GraphicalSymbol<R> extends StyleElement<R> { * @see #getInlineContent() * @see #setInlineContent(Icon) */ -// @XmlElement(name = "InlineContent") protected Icon inlineContent; /** * The expected document MIME type, or {@code null} if unspecified. + * This property is required in {@link ExternalGraphic} but not in {@link Mark}. * * @see #getFormat() * @see #setFormat(String) */ - @XmlElement(name = "Format") // Required in ExternalGraphic but not in Mark. protected String format; - /** - * For JAXB unmarshalling only. - */ - GraphicalSymbol() { - // Thread-local factory will be used. - } - /** * Creates a new graphical symbol. * Intentionally restricted to this package because {@link #properties()} is package-private. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Halo.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Halo.java index e99788dd1f..6c239a7473 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Halo.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Halo.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -35,11 +31,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "HaloType", propOrder = { - "radius", - "fill" -}) -@XmlRootElement(name = "Halo") public class Halo<R> extends StyleElement<R> { /** * Radius (in pixels) of the halo around the text, or {@code null} for the default value. @@ -47,7 +38,6 @@ public class Halo<R> extends StyleElement<R> { * @see #getRadius() * @see #setRadius(Expression) */ - @XmlElement(name = "Radius") protected Expression<R, ? extends Number> radius; /** @@ -56,16 +46,8 @@ public class Halo<R> extends StyleElement<R> { * @see #getFill() * @see #setFill(Fill) */ - @XmlElement(name = "Fill") protected Fill<R> fill; - /** - * For JAXB unmarshalling only. - */ - private Halo() { - // Thread-local factory will be used. - } - /** * Creates an halo initialized to a white color and a radius of 1 pixel. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LabelPlacement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LabelPlacement.java index a20b87492c..de31c1d130 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LabelPlacement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LabelPlacement.java @@ -16,8 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlSeeAlso; - /** * Position of a label relative to a point, line string or polygon. @@ -32,10 +30,6 @@ import jakarta.xml.bind.annotation.XmlSeeAlso; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlSeeAlso({ - PointPlacement.class, - LinePlacement.class -}) public abstract class LabelPlacement<R> extends StyleElement<R> { /** * Creates a new label placement. @@ -47,13 +41,6 @@ public abstract class LabelPlacement<R> extends StyleElement<R> { super(factory); } - /** - * For JAXB unmarshalling only. - */ - LabelPlacement() { - // Thread-local factory will be used. - } - /** * Creates a shallow copy of the given object. * For a deep copy, see {@link #clone()} instead. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LegendGraphic.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LegendGraphic.java index f1139c32c7..8c4a4530c3 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LegendGraphic.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LegendGraphic.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - /** * A graphic to do displayed in a legend for a rule. @@ -29,8 +25,6 @@ import jakarta.xml.bind.annotation.XmlRootElement; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "LegendGraphicType") -@XmlRootElement(name = "LegendGraphic") public class LegendGraphic<R> extends StyleElement<R> implements GraphicalElement<R> { /** * The graphic to use as a legend, or {@code null} for lazily constructed default. @@ -41,13 +35,6 @@ public class LegendGraphic<R> extends StyleElement<R> implements GraphicalElemen */ protected Graphic<R> graphic; - /** - * For JAXB unmarshalling only. - */ - private LegendGraphic() { - // Thread-local factory will be used. - } - /** * Creates a legend initialized to the default graphic. * @@ -76,7 +63,6 @@ public class LegendGraphic<R> extends StyleElement<R> implements GraphicalElemen * @return graphic of the legend. */ @Override - @XmlElement(name = "Graphic", required = true) public final Graphic<R> getGraphic() { if (graphic == null) { graphic = factory.createGraphic(); @@ -87,7 +73,7 @@ public class LegendGraphic<R> extends StyleElement<R> implements GraphicalElemen /** * Sets the graphic of the legend. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic() default instance}. + * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic(StyleFactory) default instance}. * * @param value new graphic of the legend, or {@code null} for resetting the default value. */ diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LinePlacement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LinePlacement.java index ef57751adc..0557a661f9 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LinePlacement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LinePlacement.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -34,15 +30,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "LinePlacementType", propOrder = { - "perpendicularOffset", - "isRepeated", - "initialGap", - "gap", - "isAligned", - "generalizeLine" -}) -@XmlRootElement(name = "LinePlacement") public class LinePlacement<R> extends LabelPlacement<R> { /** * Perpendicular distance away from a line where to draw a label, or {@code null} for the default value. @@ -50,7 +37,6 @@ public class LinePlacement<R> extends LabelPlacement<R> { * @see #getPerpendicularOffset() * @see #setPerpendicularOffset(Expression) */ - @XmlElement(name = "PerpendicularOffset") protected Expression<R, ? extends Number> perpendicularOffset; /** @@ -58,10 +44,7 @@ public class LinePlacement<R> extends LabelPlacement<R> { * * @see #isRepeated() * @see #setRepeated(Expression) - * - * @todo Needs an adapter from expression to plain boolean. */ - @XmlElement(name = "IsRepeated") protected Expression<R,Boolean> isRepeated; /** @@ -70,7 +53,6 @@ public class LinePlacement<R> extends LabelPlacement<R> { * @see #getInitialGap() * @see #setInitialGap(Expression) */ - @XmlElement(name = "InitialGap") protected Expression<R, ? extends Number> initialGap; /** @@ -79,7 +61,6 @@ public class LinePlacement<R> extends LabelPlacement<R> { * @see #getGap() * @see #setGap(Expression) */ - @XmlElement(name = "Gap") protected Expression<R, ? extends Number> gap; /** @@ -88,10 +69,7 @@ public class LinePlacement<R> extends LabelPlacement<R> { * * @see #isAligned() * @see #setAligned(Expression) - * - * @todo Needs an adapter from expression to plain boolean. */ - @XmlElement(name = "IsAligned") protected Expression<R,Boolean> isAligned; /** @@ -99,19 +77,9 @@ public class LinePlacement<R> extends LabelPlacement<R> { * * @see #getGeneralizeLine() * @see #setGeneralizeLine(Expression) - * - * @todo Needs an adapter from expression to plain boolean. */ - @XmlElement(name = "GeneralizeLine") protected Expression<R,Boolean> generalizeLine; - /** - * For JAXB unmarshalling only. - */ - private LinePlacement() { - // Thread-local factory will be used. - } - /** * Creates a line placement initialized to no offset, no repetition and no gap. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LineSymbolizer.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LineSymbolizer.java index 71481e45ae..7ab842a8f9 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LineSymbolizer.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/LineSymbolizer.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -34,11 +30,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "LineSymbolizerType", propOrder = { - "stroke", - "perpendicularOffset" -}) -@XmlRootElement(name = "LineSymbolizer") public class LineSymbolizer<R> extends Symbolizer<R> { /** * Information about how to draw lines, or {@code null} for lazily constructed default. @@ -46,7 +37,6 @@ public class LineSymbolizer<R> extends Symbolizer<R> { * @see #getStroke() * @see #setStroke(Stroke) */ - @XmlElement(name = "Stroke") protected Stroke<R> stroke; /** @@ -55,16 +45,8 @@ public class LineSymbolizer<R> extends Symbolizer<R> { * @see #getPerpendicularOffset() * @see #setPerpendicularOffset(Expression) */ - @XmlElement(name = "PerpendicularOffset") protected Expression<R, ? extends Number> perpendicularOffset; - /** - * For JAXB unmarshalling only. - */ - private LineSymbolizer() { - // Thread-local factory will be used. - } - /** * Creates a line symbolizer with the default stroke and no perpendicular offset. * @@ -103,7 +85,7 @@ public class LineSymbolizer<R> extends Symbolizer<R> { /** * Sets the object containing all the information necessary to draw styled lines. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is a {@linkplain Stroke#Stroke() default instance}. + * If this method is never invoked, then the default value is a {@linkplain Stroke#Stroke(StyleFactory) default instance}. * * @param value new information about how to draw lines, or {@code null} for resetting the default value. */ diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Mark.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Mark.java index bf70e3add6..b04e8cf441 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Mark.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Mark.java @@ -17,10 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.Marshaller; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -40,16 +36,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "MarkType", propOrder = { - "wellKnownName", -// "onlineResource", // XML encoding not yet available. -// "inlineContent", // Idem. - "format", - "markIndex", - "fill", - "stroke" -}) -@XmlRootElement(name = "Mark") public class Mark<R> extends GraphicalSymbol<R> { /** * Expression whose value will indicate the symbol to draw, or {@code null} for the default value. @@ -57,7 +43,6 @@ public class Mark<R> extends GraphicalSymbol<R> { * @see #getWellKnownName() * @see #setWellKnownName(Expression) */ - @XmlElement(name = "WellKnownName") protected Expression<R,String> wellKnownName; /** @@ -68,7 +53,6 @@ public class Mark<R> extends GraphicalSymbol<R> { * @see #getFill() * @see #setFill(Fill) */ - @XmlElement(name = "Fill") protected Fill<R> fill; /** @@ -85,7 +69,6 @@ public class Mark<R> extends GraphicalSymbol<R> { * @see #getStroke() * @see #setStroke(Stroke) */ - @XmlElement(name = "Stroke") protected Stroke<R> stroke; /** @@ -100,29 +83,8 @@ public class Mark<R> extends GraphicalSymbol<R> { * @see #getMarkIndex() * @see #setMarkIndex(Expression) */ - @XmlElement(name = "MarkIndex") protected Expression<R,Integer> markIndex; - /** - * Invoked by JAXB before marshalling this mark. - * Creates the default fill and stroke if needed. - */ - private void beforeMarshal(Marshaller caller) { - if (fill == null && !isFillSet) fill = factory.createFill(); - if (stroke == null && !isStrokeSet) stroke = factory.createStroke(); - } - - /** - * For JAXB unmarshalling only. This constructor disables the lazy creation of default values. - * This is because OGC 05-077r4 said that if the fill or the stroke is not specified, - * then no fill or stroke should be applied. - */ - private Mark() { - // Thread-local factory will be used. - isFillSet = true; - isStrokeSet = true; - } - /** * Creates a mark initialized to a gray square with black outline. * The size is specified by {@link Graphic#getSize()} and should be 6 pixels by default. @@ -143,7 +105,10 @@ public class Mark<R> extends GraphicalSymbol<R> { super(source); wellKnownName = source.wellKnownName; fill = source.fill; + isFillSet = source.isFillSet; stroke = source.stroke; + isStrokeSet = source.isStrokeSet; + markIndex = source.markIndex; } /** @@ -198,7 +163,7 @@ public class Mark<R> extends GraphicalSymbol<R> { /** * Sets information about how the interior of marks should be filled. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is the {@linkplain Fill#Fill() default fill}. + * If this method is never invoked, then the default value is the {@linkplain Fill#Fill(StyleFactory) default fill}. * * @param value new information about the fill, or {@code null} for no fill. */ @@ -230,7 +195,7 @@ public class Mark<R> extends GraphicalSymbol<R> { /** * Sets information about styled lines. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is the {@linkplain Stroke#Stroke() default stroke}. + * If this method is never invoked, then the default value is the {@linkplain Stroke#Stroke(StyleFactory) default stroke}. * * @param value new information about styled lines, or {@code null} if lines should not be drawn. */ @@ -264,7 +229,7 @@ public class Mark<R> extends GraphicalSymbol<R> { */ @Override final Object[] properties() { - return new Object[] {wellKnownName, fill, isFillSet, stroke, isStrokeSet, markIndex}; + return new Object[] {onlineResource, inlineContent, format, wellKnownName, fill, isFillSet, stroke, isStrokeSet, markIndex}; } /** diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointPlacement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointPlacement.java index ffa53f50f1..b2c82d7b42 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointPlacement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointPlacement.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -34,12 +30,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "PointPlacementType", propOrder = { - "anchorPoint", - "displacement", - "rotation" -}) -@XmlRootElement(name = "PointPlacement") public class PointPlacement<R> extends LabelPlacement<R> { /** * Location to use for anchoring the label to the point, or {@code null} for lazily constructed default. @@ -47,7 +37,6 @@ public class PointPlacement<R> extends LabelPlacement<R> { * @see #getAnchorPoint() * @see #setAnchorPoint(AnchorPoint) */ - @XmlElement(name = "AnchorPoint") protected AnchorPoint<R> anchorPoint; /** @@ -56,7 +45,6 @@ public class PointPlacement<R> extends LabelPlacement<R> { * @see #getDisplacement() * @see #setDisplacement(Displacement) */ - @XmlElement(name = "Displacement") protected Displacement<R> displacement; /** @@ -65,16 +53,8 @@ public class PointPlacement<R> extends LabelPlacement<R> { * @see #getRotation() * @see #setRotation(Expression) */ - @XmlElement(name = "Rotation") protected Expression<R, ? extends Number> rotation; - /** - * For JAXB unmarshalling only. - */ - private PointPlacement() { - // Thread-local factory will be used. - } - /** * Creates a point placement initialized to anchor at the middle and no displacement. * @@ -118,7 +98,7 @@ public class PointPlacement<R> extends LabelPlacement<R> { /** * Sets the location inside of a label to use for anchoring the label to the point. * The given instance is stored by reference, it is not cloned. If this method is never invoked, - * then the default value is a {@linkplain AnchorPoint#AnchorPoint() default anchor point}. + * then the default value is a {@linkplain AnchorPoint#AnchorPoint(StyleFactory) default anchor point}. * * @param value new anchor point, or {@code null} for resetting the default value. */ @@ -145,7 +125,7 @@ public class PointPlacement<R> extends LabelPlacement<R> { /** * Sets the two-dimensional displacements from the "hot-spot" point. * The given instance is stored by reference, it is not cloned. If this method is never invoked, - * then the default value is a {@linkplain Displacement#Displacement() default displacement}. + * then the default value is a {@linkplain Displacement#Displacement(StyleFactory) default displacement}. * * @param value new displacements from the "hot-spot" point, or {@code null} for resetting the default value. */ diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointSymbolizer.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointSymbolizer.java index 3b617d62c2..2948458290 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointSymbolizer.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PointSymbolizer.java @@ -16,11 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.Marshaller; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - /** * Instructions about how to draw a graphic at a point. @@ -34,8 +29,6 @@ import jakarta.xml.bind.annotation.XmlRootElement; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "PointSymbolizerType") -@XmlRootElement(name = "PointSymbolizer") public class PointSymbolizer<R> extends Symbolizer<R> implements GraphicalElement<R> { /** * Information about how to draw graphics, or {@code null} for no graphic. @@ -45,7 +38,6 @@ public class PointSymbolizer<R> extends Symbolizer<R> implements GraphicalElemen * @see #getGraphic() * @see #setGraphic(Graphic) */ - @XmlElement(name = "Graphic") protected Graphic<R> graphic; /** @@ -54,25 +46,6 @@ public class PointSymbolizer<R> extends Symbolizer<R> implements GraphicalElemen */ private boolean isGraphicSet; - /** - * Invoked by JAXB before marshalling this point symbolizer. - * Creates the default graphic if needed. - */ - private void beforeMarshal(Marshaller caller) { - if (graphic == null && !isGraphicSet) { - graphic = factory.createGraphic(); - } - } - - /** - * For JAXB unmarshalling only. This constructor disables the lazy creation of default values. - * This is because OGC 05-077r4 said that if the graphic is not specified, then none should be used. - */ - private PointSymbolizer() { - // Thread-local factory will be used. - isGraphicSet = true; - } - /** * Creates a symbolizer initialized to a default graphic. * @@ -90,21 +63,25 @@ public class PointSymbolizer<R> extends Symbolizer<R> implements GraphicalElemen */ public PointSymbolizer(final PointSymbolizer<R> source) { super(source); - graphic = source.graphic; + graphic = source.graphic; + isGraphicSet = source.isGraphicSet; } /** * Returns the graphic that will be drawn at each point of the geometry. + * If {@code setGraphic(null)} has been explicitly invoked with a null argument value, + * then this method returns {@code null} for meaning that nothing will be plotted. * The returned object is <em>live</em>: - * changes in the returned instance will be reflected in this fill, and conversely. + * changes in the returned instance will be reflected in this symbolizer, and conversely. * - * @return information about how to draw graphics. + * @return information about how to draw graphics, or {@code null} if none. * * @see #isVisible() */ @Override public Graphic<R> getGraphic() { - if (graphic == null) { + if (!isGraphicSet) { + isGraphicSet = true; graphic = factory.createGraphic(); } return graphic; @@ -113,7 +90,7 @@ public class PointSymbolizer<R> extends Symbolizer<R> implements GraphicalElemen /** * Specifies the graphic that will be drawn at each point of the geometry. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic() default instance}. + * If this method is never invoked, then the default value is a {@linkplain Graphic#Graphic(StyleFactory) default instance}. * If this method is invoked with an explicit {@code null}, then nothing will be plotted. * * @param value new information about how to draw graphics, or {@code null} for none. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PolygonSymbolizer.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PolygonSymbolizer.java index 038221d58a..b5bd8b379b 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PolygonSymbolizer.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/PolygonSymbolizer.java @@ -17,10 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.Marshaller; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -46,13 +42,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "PolygonSymbolizerType", propOrder = { - "fill", - "stroke", - "displacement", - "perpendicularOffset" -}) -@XmlRootElement(name = "PolygonSymbolizer") public class PolygonSymbolizer<R> extends Symbolizer<R> { /** * Information about how the interior of polygons should be filled, or {@code null} for no fill. @@ -62,7 +51,6 @@ public class PolygonSymbolizer<R> extends Symbolizer<R> { * @see #getFill() * @see #setFill(Fill) */ - @XmlElement(name = "Fill") protected Fill<R> fill; /** @@ -79,7 +67,6 @@ public class PolygonSymbolizer<R> extends Symbolizer<R> { * @see #getStroke() * @see #setStroke(Stroke) */ - @XmlElement(name = "Stroke") protected Stroke<R> stroke; /** @@ -94,7 +81,6 @@ public class PolygonSymbolizer<R> extends Symbolizer<R> { * @see #getDisplacement() * @see #setDisplacement(Displacement) */ - @XmlElement(name = "Displacement") protected Displacement<R> displacement; /** @@ -103,29 +89,8 @@ public class PolygonSymbolizer<R> extends Symbolizer<R> { * @see #getPerpendicularOffset() * @see #setPerpendicularOffset(Expression) */ - @XmlElement(name = "PerpendicularOffset") protected Expression<R, ? extends Number> perpendicularOffset; - /** - * Invoked by JAXB before marshalling this polyogon symbolizer. - * Creates the default fill and stroke if needed. - */ - private void beforeMarshal(Marshaller caller) { - if (fill == null && !isFillSet) fill = factory.createFill(); - if (stroke == null && !isStrokeSet) stroke = factory.createStroke(); - } - - /** - * For JAXB unmarshalling only. This constructor disables the lazy creation of default values. - * This is because OGC 05-077r4 said that if the fill or the stroke is not specified, - * then no fill or stroke should be applied. - */ - private PolygonSymbolizer() { - // Thread-local factory will be used. - isFillSet = true; - isStrokeSet = true; - } - /** * Creates a polygon symbolizer initialized to the default fill and default stroke. * @@ -174,7 +139,7 @@ public class PolygonSymbolizer<R> extends Symbolizer<R> { /** * Sets information about how the interior of polygons should be filled. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is the {@linkplain Fill#Fill() default fill}. + * If this method is never invoked, then the default value is the {@linkplain Fill#Fill(StyleFactory) default fill}. * * @param value new information about the fill, or {@code null} for no fill. */ @@ -207,7 +172,7 @@ public class PolygonSymbolizer<R> extends Symbolizer<R> { /** * Sets information about styled lines. * The given instance is stored by reference, it is not cloned. - * If this method is never invoked, then the default value is the {@linkplain Stroke#Stroke() default stroke}. + * If this method is never invoked, then the default value is the {@linkplain Stroke#Stroke(StyleFactory) default stroke}. * * @param value new information about styled lines, or {@code null} if lines should not be drawn. */ @@ -242,7 +207,7 @@ public class PolygonSymbolizer<R> extends Symbolizer<R> { /** * Sets the two-dimensional displacement from the "hot-spot" point. * The given instance is stored by reference, it is not cloned. If this method is never invoked, - * then the default value is a {@linkplain Displacement#Displacement() default displacement}. + * then the default value is a {@linkplain Displacement#Displacement(StyleFactory) default displacement}. * * @param value new displacement from the "hot-spot" point, or {@code null} for resetting the default value. */ diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/RasterSymbolizer.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/RasterSymbolizer.java index 79d1d2f62f..7ef8c681e3 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/RasterSymbolizer.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/RasterSymbolizer.java @@ -17,9 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -40,16 +37,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "RasterSymbolizerType", propOrder = { - "opacity", - "channelSelection", - "overlapBehavior", - "colorMap", - "contrastEnhancement", - "shadedRelief", - "imageOutline" -}) -@XmlRootElement(name = "RasterSymbolizer") public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> { /** * Level of translucency as a floating point number between 0 and 1 (inclusive), or {@code null} the default value. @@ -58,7 +45,6 @@ public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> * @see #getOpacity() * @see #setOpacity(Expression) */ - @XmlElement(name = "Opacity") protected Expression<R, ? extends Number> opacity; /** @@ -67,7 +53,6 @@ public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> * @see #getChannelSelection() * @see #setChannelSelection(ChannelSelection) */ - @XmlElement(name = "ChannelSelection") protected ChannelSelection<R> channelSelection; /** @@ -77,7 +62,6 @@ public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> * @see #getOverlapBehavior() * @see #setOverlapBehavior(OverlapBehavior) */ - @XmlElement(name = "OverlapBehavior") protected OverlapBehavior overlapBehavior; /** @@ -86,7 +70,6 @@ public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> * @see #getColorMap() * @see #setColorMap(ColorMap) */ - @XmlElement(name = "ColorMap") protected ColorMap<R> colorMap; /** @@ -95,7 +78,6 @@ public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> * @see #getContrastEnhancement() * @see #setContrastEnhancement(ContrastEnhancement) */ - @XmlElement(name = "ContrastEnhancement") protected ContrastEnhancement<R> contrastEnhancement; /** @@ -104,7 +86,6 @@ public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> * @see #getShadedRelief() * @see #setShadedRelief(ShadedRelief) */ - @XmlElement(name = "ShadedRelief") protected ShadedRelief<R> shadedRelief; /** @@ -113,16 +94,8 @@ public class RasterSymbolizer<R> extends Symbolizer<R> implements Translucent<R> * @see #getImageOutline() * @see #setImageOutline(Symbolizer) */ - @XmlElement(name = "ImageOutline") protected Symbolizer<R> imageOutline; - /** - * For JAXB unmarshalling only. - */ - private RasterSymbolizer() { - // Thread-local factory will be used. - } - /** * Creates an initially opaque raster symbolizer with no contrast enhancement, shaded relief or outline. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Rule.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Rule.java index 6abb5ab4ed..f11fb8d2f4 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Rule.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Rule.java @@ -19,14 +19,8 @@ package org.apache.sis.style.se1; import java.util.List; import java.util.ArrayList; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementRef; -import jakarta.xml.bind.annotation.XmlRootElement; import org.opengis.metadata.citation.OnlineResource; -import org.apache.sis.xml.bind.Context; import org.apache.sis.util.ArgumentChecks; -import org.apache.sis.util.resources.Errors; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Filter; @@ -46,17 +40,6 @@ import org.opengis.filter.Filter; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "RuleType", propOrder = { - "name", - "description", - "legend", -// "filter", // XML encoding not yet available. - "elseFilter", - "minScale", - "maxScale", - "symbolizers" -}) -@XmlRootElement(name = "Rule") public class Rule<R> extends StyleElement<R> { /** * Name for this rule, or {@code null} if none. @@ -64,7 +47,6 @@ public class Rule<R> extends StyleElement<R> { * @see #getName() * @see #setName(String) */ - @XmlElement(name = "Name") protected String name; /** @@ -73,7 +55,6 @@ public class Rule<R> extends StyleElement<R> { * @see #getDescription() * @see #setDescription(Description) */ - @XmlElement(name = "Description") protected Description<R> description; /** @@ -82,7 +63,6 @@ public class Rule<R> extends StyleElement<R> { * @see #getLegend() * @see #setLegend(LegendGraphic) */ - @XmlElement(name = "LegendGraphic") protected LegendGraphic<R> legend; /** @@ -91,7 +71,6 @@ public class Rule<R> extends StyleElement<R> { * @see #getFilter() * @see #setFilter(Filter) */ -// @XmlElement(name = "Filter", namespace = "http://www.opengis.net/ogc") protected Filter<R> filter; /** @@ -106,7 +85,7 @@ public class Rule<R> extends StyleElement<R> { * Minimum value (inclusive) in the denominator of map scale at which this rule will apply. * * @see #getMinScaleDenominator() - * @see #setMaxScaleDenominator(double) + * @see #setMinScaleDenominator(double) */ protected double minScale; @@ -123,24 +102,16 @@ public class Rule<R> extends StyleElement<R> { * * @see #symbolizers() */ - @XmlElementRef(name = "Symbolizer") private List<Symbolizer<R>> symbolizers; /** * If the style comes from an external XML file, the original source. Otherwise {@code null}. * - * @see #getOnlineResource() + * @see #getOnlineSource() * @see #setOnlineSource(OnlineResource) */ protected OnlineResource onlineSource; - /** - * For JAXB unmarshalling only. - */ - private Rule() { - // Thread-local factory will be used. - } - /** * Creates an initially empty rule. * @@ -164,6 +135,7 @@ public class Rule<R> extends StyleElement<R> { description = source.description; legend = source.legend; filter = source.filter; + isElseFilter = source.isElseFilter; minScale = source.minScale; maxScale = source.maxScale; onlineSource = source.onlineSource; @@ -288,21 +260,6 @@ public class Rule<R> extends StyleElement<R> { isElseFilter = value; } - /** - * Invoked by JAXB at marshalling time for expressing the boolean {@code isElseFilter} value as an XML element. - */ - @XmlElement(name = "ElseFilter") - private ElseFilter getElseFilter() { - return isElseFilter ? ElseFilter.INSTANCE : null; - } - - /** - * Invoked at JAXB unmarshalling time when an {@code <ElseFilter/>} element is found. - */ - private void setElseFilter(final ElseFilter value) { - isElseFilter = (value != null); - } - /** * Returns the minimum value (inclusive) in the denominator of map scale at which this rule will apply. * If, for example, this value was 10000, then this rule would only apply at scales of 1:<var>X</var> @@ -320,17 +277,6 @@ public class Rule<R> extends StyleElement<R> { return minScale; } - /** - * Invoked by JAXB for marshalling the minimum scale denominator. - * If both the minimum and maximum are the default values, then this property is omitted. - * If a maximum value exists, then the zero minimum is explicitly written for clarity. - */ - @XmlElement(name = "MinScaleDenominator") - private Double getMinScale() { - final var value = minScale; - return (value > 0 || maxScale != Double.POSITIVE_INFINITY) ? value : null; - } - /** * Sets the minimum value (inclusive) in the denominator of map scale at which this rule will apply. * If the given value is greater than the maximum scale, then that maximum is discarded. @@ -346,18 +292,6 @@ public class Rule<R> extends StyleElement<R> { } } - /** - * Invoked by JAXB for unmarshalling the minimum scale denominator. - * The argument validity check assumes that this method is invoked only once. - * If this assumption is violated, the check allows range restriction but not expansion. - * If the given value is invalid, a warning is reported but the unmarshalling continue. - */ - private void setMinScale(final Double value) { - if (isValidScale("MinScaleDenominator", value)) { - minScale = value; - } - } - /** * Returns the maximum value (exclusive) in the denominator of map scale at which this rule will apply. * If, for example, this value was 10000, then this rule would only apply at scales of 1:<var>X</var> @@ -373,16 +307,6 @@ public class Rule<R> extends StyleElement<R> { return maxScale; } - /** - * Invoked by JAXB for marshalling the maximum scale denominator. - * If the value is positive infinity, then the property is omitted. - */ - @XmlElement(name = "MaxScaleDenominator") - private Double getMaxScale() { - final var value = maxScale; - return (value != Double.POSITIVE_INFINITY) ? value : null; - } - /** * Sets the maximum value (exclusive) in the denominator of map scale at which this rule will apply. * If the given value is less than the minimum scale, then that minimum is discarded. @@ -398,34 +322,6 @@ public class Rule<R> extends StyleElement<R> { } } - /** - * Invoked by JAXB for unmarshalling the maximum scale denominator. - * The argument validity check assumes that this method is invoked only once. - * If this assumption is violated, the check allows range restriction but not expansion. - * If the given value is invalid, a warning is reported but the unmarshalling continue. - */ - private void setMaxScale(final Double value) { - if (isValidScale("MaxScaleDenominator", value)) { - maxScale = value; - } - } - - /** - * Indicates whether an unmarshalled minimum or maximum scale denominator is inside the expected range of values. - * If the given value is invalid, a warning is emitted to the JAXB unmarshaller and the caller will keep the default value. - */ - private boolean isValidScale(final String name, final Double value) { - boolean isValidScale = (value != null); - if (isValidScale) { - isValidScale = (value >= minScale && value <= maxScale); - if (!isValidScale) { - Context.warningOccured(Context.current(), Rule.class, "set".concat(name), Errors.class, - Errors.Keys.ValueOutOfRange_4, name, minScale, maxScale, value); - } - } - return isValidScale; - } - /** * Returns the description of how a feature is to appear on a map. * Each symbolizer describes how the shape should appear, @@ -462,14 +358,12 @@ public class Rule<R> extends StyleElement<R> { * If the style comes from an external XML file, the original source. * If this method is never invoked, then the default value is absence. * - * <h4>Effect on XML marshalling</h4> + * <h4>Effect on XML documents</h4> * Setting this property to a non-null value has the following effect: * When this rule is written in a XML document, then instead of writing * the XML elements describing this rule, * the specified link will be written instead. * - * @todo Above-describing marshalling is not yet implemented. - * * @param value new source of this rule, or {@code null} if none. */ public void setOnlineSource(final OnlineResource value) { @@ -482,7 +376,7 @@ public class Rule<R> extends StyleElement<R> { */ @Override final Object[] properties() { - return new Object[] {name, description, legend, filter, minScale, maxScale, symbolizers, onlineSource}; + return new Object[] {name, description, legend, filter, isElseFilter, minScale, maxScale, symbolizers, onlineSource}; } /** diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/SelectedChannel.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/SelectedChannel.java index efeab4a5a6..ed2ece95d0 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/SelectedChannel.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/SelectedChannel.java @@ -17,8 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -37,21 +35,13 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "SelectedChannelType", propOrder = { - "sourceChannelName", - "contrastEnhancement" -}) -// No root element is specified in OGC 05-077r4. public class SelectedChannel<R> extends StyleElement<R> { /** * The channel's name, or {@code null} if unspecified. * * @see #getSourceChannelName() * @see #setSourceChannelName(Expression) - * - * @todo Needs an adapter from expression to plain string. */ - @XmlElement(name = "SourceChannelName", required = true) protected Expression<R,String> sourceChannelName; /** @@ -60,16 +50,8 @@ public class SelectedChannel<R> extends StyleElement<R> { * @see #getContrastEnhancement() * @see #setContrastEnhancement(ContrastEnhancement) */ - @XmlElement(name = "ContrastEnhancement") protected ContrastEnhancement<R> contrastEnhancement; - /** - * For JAXB unmarshalling only. - */ - private SelectedChannel() { - // Thread-local factory will be used. - } - /** * Creates an initially empty selected channel. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ShadedRelief.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ShadedRelief.java index c33153ba18..4501bbfccf 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ShadedRelief.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/ShadedRelief.java @@ -16,10 +16,6 @@ */ package org.apache.sis.style.se1; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -34,21 +30,13 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "ShadedReliefType", propOrder = { - "brightnessOnly", - "reliefFactor" -}) -@XmlRootElement(name = "ShadedRelief") public class ShadedRelief<R> extends StyleElement<R> { /** * Whether to apply the shading to the image generated so far by other layers. * * @see #isBrightnessOnly() * @see #setBrightnessOnly(Expression) - * - * @todo Needs an adapter from expression to plain boolean. */ - @XmlElement(name = "BrightnessOnly") protected Expression<R,Boolean> brightnessOnly; /** @@ -57,16 +45,8 @@ public class ShadedRelief<R> extends StyleElement<R> { * @see #getReliefFactor() * @see #setReliefFactor(Expression) */ - @XmlElement(name = "ReliefFactor") protected Expression<R, ? extends Number> reliefFactor; - /** - * For JAXB unmarshalling only. - */ - private ShadedRelief() { - // Thread-local factory will be used. - } - /** * Creates a shaded relief initialized to implementation-specific default values. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Stroke.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Stroke.java index be3ac3c7be..d7e6481b44 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Stroke.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Stroke.java @@ -18,9 +18,6 @@ package org.apache.sis.style.se1; import java.awt.Color; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -43,12 +40,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "StrokeType", propOrder = { - "graphicFill", - "graphicStroke", -// "svgParameter" -}) -@XmlRootElement(name = "Stroke") public class Stroke<R> extends StyleElement<R> implements Translucent<R> { /** * Graphic for tiling the (thin) area of the line, or {@code null} if none. @@ -57,7 +48,6 @@ public class Stroke<R> extends StyleElement<R> implements Translucent<R> { * @see #getGraphicFill() * @see #setGraphicFill(GraphicFill) */ - @XmlElement(name = "GraphicFill") protected GraphicFill<R> graphicFill; /** @@ -67,7 +57,6 @@ public class Stroke<R> extends StyleElement<R> implements Translucent<R> { * @see #getGraphicStroke() * @see #setGraphicStroke(GraphicStroke) */ - @XmlElement(name = "GraphicStroke") protected GraphicStroke<R> graphicStroke; /** @@ -147,13 +136,6 @@ public class Stroke<R> extends StyleElement<R> implements Translucent<R> { */ protected Expression<R,Integer> dashOffset; - /** - * For JAXB unmarshalling only. - */ - private Stroke() { - // Thread-local factory will be used. - } - /** * Creates a stroke initialized to solid line of black opaque color, 1 pixel width. * @@ -437,26 +419,6 @@ public class Stroke<R> extends StyleElement<R> implements Translucent<R> { dashOffset = value; } - /* - * TODO: we need a private method like below for formatting above SVG parameters: - * - * @XmlElement(name = "SvgParameter") - * private List<SvgParameter> svgParameters(); - * - * Where: - * - * class SvgParameter { - * @XmlAttribute(required = true) - * private String name; - * - * @XmlMixed - * @XmlElementRef(name = "expression", namespace = "http://www.opengis.net/ogc") - * private List<Expression<?,?>> content; - * } - * - * See 05-077r4 §11.1.3. - */ - /** * Returns all properties contained in this class. * This is used for {@link #equals(Object)} and {@link #hashCode()} implementations. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/StyleElement.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/StyleElement.java index cb20c18989..5cb0d3ec70 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/StyleElement.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/StyleElement.java @@ -19,7 +19,6 @@ package org.apache.sis.style.se1; import java.awt.Color; import java.util.Arrays; import java.util.Objects; -import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.util.InternationalString; // Specific to the geoapi-3.1 and geoapi-4.0 branches: @@ -36,7 +35,6 @@ import org.opengis.filter.Literal; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlTransient public abstract class StyleElement<R> implements Cloneable { /** * The factory to use for creating expressions and child elements. @@ -67,17 +65,6 @@ public abstract class StyleElement<R> implements Cloneable { factory = source.factory; } - /** - * Creates a style element for XML unmarshalling. - * <em>This constructor is unsafe</em> and should be used only by JAXB reflection. - * - * @todo Allow the factory to be set according the parent {@link AbstractStyle} being unmarshalled. - * We will need to use {@link ThreadLocal}. - */ - StyleElement() { - factory = null; // TODO - } - /** * Returns a literal for the given value. * This is a convenience method for use with setter methods that expect an expression. diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbolizer.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbolizer.java index 297a78d170..68644760bc 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbolizer.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbolizer.java @@ -18,12 +18,6 @@ package org.apache.sis.style.se1; import java.util.Objects; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import jakarta.xml.bind.annotation.XmlSchemaType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlSeeAlso; import javax.measure.Unit; import org.apache.sis.measure.Units; import org.apache.sis.util.resources.Errors; @@ -53,19 +47,6 @@ import org.opengis.filter.ValueReference; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "SymbolizerType", propOrder = { - "name", - "description", - "geometry" -}) -@XmlSeeAlso({ - LineSymbolizer.class, - PointSymbolizer.class, - PolygonSymbolizer.class, - TextSymbolizer.class, - RasterSymbolizer.class -}) -@XmlRootElement(name = "Symbolizer") public abstract class Symbolizer<R> extends StyleElement<R> { /** * Name for this style, or {@code null} if none. @@ -73,7 +54,6 @@ public abstract class Symbolizer<R> extends StyleElement<R> { * @see #getName() * @see #setName(String) */ - @XmlElement(name = "Name") protected String name; /** @@ -82,7 +62,6 @@ public abstract class Symbolizer<R> extends StyleElement<R> { * @see #getDescription() * @see #setDescription(Description) */ - @XmlElement(name = "Description") protected Description<R> description; /** @@ -93,7 +72,6 @@ public abstract class Symbolizer<R> extends StyleElement<R> { * @see #getGeometry() * @see #setGeometry(Expression) */ - @XmlElement(name = "Geometry") protected Expression<R,?> geometry; /** @@ -106,22 +84,11 @@ public abstract class Symbolizer<R> extends StyleElement<R> { * <li>uom="http://www.opengeospatial.org/se/units/pixel"</li> * </ul> * - * @todo Recommended XML representation is not yet implemented. - * * @see #getUnitOfMeasure() * @see #setUnitOfMeasure(Unit) */ - @XmlAttribute(name = "uom") - @XmlSchemaType(name = "anyURI") protected Unit<?> unit; - /** - * For JAXB unmarshalling only. - */ - Symbolizer() { - // Thread-local factory will be used. - } - /** * Creates a symbolizer initialized to default geometries and pixel unit of measurement. * diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbology.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbology.java index 4f18193bd7..3a2586d678 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbology.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/Symbology.java @@ -27,6 +27,13 @@ import org.apache.sis.style.Style; * A set of styles to be applied on different types of features. * This class contains a list of {@link FeatureTypeStyle}. * + * <h2>Relationship with Styled Layer Descriptor</h2> + * This class is the {@code <UserStyle>} element of OGC 05-078r4 — Styled Layer Descriptor 1.1.0. + * User styles are referenced by the {@link org.apache.sis.style.sld1.NamedLayer} and + * {@link org.apache.sis.style.sld1.UserLayer} elements of a styled layer descriptor. + * The {@linkplain #getDefaultSpecification() default specification} is not part of that standard + * and is not encoded in XML documents. + * * <!-- Following list of authors contains credits to OGC GeoAPI 2 contributors. --> * @author Johann Sorel (Geomatys) * @author Chris Dillard (SYS Technologies) diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/TextSymbolizer.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/TextSymbolizer.java index fdba9483e1..59d3152816 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/TextSymbolizer.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/TextSymbolizer.java @@ -17,10 +17,6 @@ package org.apache.sis.style.se1; import java.util.Optional; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementRef; -import jakarta.xml.bind.annotation.XmlRootElement; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.filter.Expression; @@ -39,14 +35,6 @@ import org.opengis.filter.Expression; * * @param <R> the type of data to style, such as {@code Feature} or {@code Coverage}. */ -@XmlType(name = "TextSymbolizerType", propOrder = { - "label", - "font", - "labelPlacement", - "halo", - "fill" -}) -@XmlRootElement(name = "TextSymbolizer") public class TextSymbolizer<R> extends Symbolizer<R> { /** * Text to display, or {@code null} if none. @@ -54,7 +42,6 @@ public class TextSymbolizer<R> extends Symbolizer<R> { * @see #getLabel() * @see #setLabel(Expression) */ - @XmlElement(name = "Label") protected Expression<R,String> label; /** @@ -63,7 +50,6 @@ public class TextSymbolizer<R> extends Symbolizer<R> { * @see #getFont() * @see #setFont(Font) */ - @XmlElement(name = "Font") protected Font<R> font; /** @@ -73,7 +59,6 @@ public class TextSymbolizer<R> extends Symbolizer<R> { * @see #getLabelPlacement() * @see #setLabelPlacement(LabelPlacement) */ - @XmlElementRef(name = "LabelPlacement") protected LabelPlacement<R> labelPlacement; /** @@ -82,7 +67,6 @@ public class TextSymbolizer<R> extends Symbolizer<R> { * @see #getHalo() * @see #setHalo(Halo) */ - @XmlElement(name = "Halo") protected Halo<R> halo; /** @@ -91,16 +75,8 @@ public class TextSymbolizer<R> extends Symbolizer<R> { * @see #getFill() * @see #setFill(Fill) */ - @XmlElement(name = "Fill") protected Fill<R> fill; - /** - * For JAXB unmarshalling only. - */ - private TextSymbolizer() { - // Thread-local factory will be used. - } - /** * Creates a text symbolizer with default placement and default font. * The new symbolizer has no initial label. @@ -165,7 +141,7 @@ public class TextSymbolizer<R> extends Symbolizer<R> { /** * Sets the font to apply on the text. * The given instance is stored by reference, it is not cloned. If this method is never invoked, - * then the default value is a {@linkplain Font#Font() default font}. + * then the default value is a {@linkplain Font#Font(StyleFactory) default font}. * * @param value new font to apply on the text, or {@code null} for resetting the default value. */ @@ -193,7 +169,7 @@ public class TextSymbolizer<R> extends Symbolizer<R> { * Sets indications about how the text should be placed with respect to the feature geometry. * The given instance is stored by reference, it is not cloned. * If this method is never invoked, then the default value is a - * {@linkplain PointPlacement#PointPlacement() default point placement}. + * {@linkplain PointPlacement#PointPlacement(StyleFactory) default point placement}. * * @param value new indications about text placement, or {@code null} for resetting the default value. */ diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/package-info.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/package-info.java index 4242241378..a93ec46f5b 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/package-info.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/style/se1/package-info.java @@ -39,26 +39,4 @@ * @author Johann Sorel (Geomatys) * @author Martin Desruisseaux (Geomatys) */ -@XmlSchema(location="https://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd", - elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.SE, - xmlns = { - @XmlNs(prefix = "se", namespaceURI = Namespaces.SE) -}) -@XmlAccessorType(XmlAccessType.NONE) -@XmlJavaTypeAdapters({ - @XmlJavaTypeAdapter(ExpressionAdapter.class), - @XmlJavaTypeAdapter(InternationalStringConverter.class), - @XmlJavaTypeAdapter(UnitAdapter.class) -}) package org.apache.sis.style.se1; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlNs; -import jakarta.xml.bind.annotation.XmlNsForm; -import jakarta.xml.bind.annotation.XmlSchema; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapters; -import org.apache.sis.xml.Namespaces; -import org.apache.sis.xml.bind.gco.InternationalStringConverter; -import org.apache.sis.xml.bind.gco.UnitAdapter; diff --git a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/MarkTest.java b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/MarkTest.java index b4431d8631..7d365a7d1b 100644 --- a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/MarkTest.java +++ b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/MarkTest.java @@ -82,4 +82,53 @@ public final class MarkTest extends StyleTestCase { cdt.setStroke(value); assertOptionalEquals(value, cdt.getStroke()); } + + /** + * Test of {@code MarkIndex} property. + */ + @Test + public void testMarkIndex() { + final var cdt = factory.createMark(); + + // Check default + assertEmpty(cdt.getMarkIndex()); + + // Check get/set + var value = literal(3); + cdt.setMarkIndex(value); + assertOptionalEquals(value, cdt.getMarkIndex()); + } + + /** + * Verifies that the copy constructor preserves all properties, + * including the explicit absence of fill and stroke. + */ + @Test + public void testCopyConstructor() { + final var cdt = factory.createMark(); + cdt.setWellKnownName(literal("circle")); + cdt.setFill(null); + cdt.setStroke(null); + cdt.setMarkIndex(literal(3)); + cdt.setFormat("image/svg+xml"); + + final var copy = new Mark<>(cdt); + assertEquals(cdt, copy); + assertEmpty(copy.getFill()); + assertEmpty(copy.getStroke()); + assertOptionalEquals(cdt.getMarkIndex().orElseThrow(), copy.getMarkIndex()); + assertOptionalEquals("image/svg+xml", copy.getFormat()); + } + + /** + * Verifies that {@code equals} takes in account the properties inherited from {@link GraphicalSymbol}. + */ + @Test + public void testEqualsWithInheritedProperties() { + final var m1 = factory.createMark(); + final var m2 = factory.createMark(); + assertEquals(m1, m2); + m2.setFormat("image/svg+xml"); + assertNotEquals(m1, m2); + } } diff --git a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/PointSymbolizerTest.java b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/PointSymbolizerTest.java index fbc3768d53..8ad837ed6a 100644 --- a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/PointSymbolizerTest.java +++ b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/PointSymbolizerTest.java @@ -53,4 +53,33 @@ public final class PointSymbolizerTest extends StyleTestCase { cdt.setGraphic(value); assertEquals(value, cdt.getGraphic()); } + + /** + * Verifies that an explicit {@code null} graphic means "no graphic" + * and is not replaced by a default graphic when requested. + */ + @Test + public void testNoGraphic() { + final var cdt = factory.createPointSymbolizer(); + assertTrue(cdt.isVisible()); + + cdt.setGraphic(null); + assertFalse(cdt.isVisible()); + assertNull(cdt.getGraphic()); + assertFalse(cdt.isVisible()); + } + + /** + * Verifies that the copy constructor preserves the explicit absence of graphic. + */ + @Test + public void testCopyConstructor() { + final var cdt = factory.createPointSymbolizer(); + cdt.setGraphic(null); + + final var copy = new PointSymbolizer<>(cdt); + assertEquals(cdt, copy); + assertFalse(copy.isVisible()); + assertNull(copy.getGraphic()); + } } diff --git a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/RuleTest.java b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/RuleTest.java index 9977611b1c..fad57a6194 100644 --- a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/RuleTest.java +++ b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/RuleTest.java @@ -118,6 +118,23 @@ public final class RuleTest extends StyleTestCase { assertTrue(cdt.isElseFilter()); } + /** + * Verifies that the {@code ElseFilter} property is preserved by the copy constructor + * and taken in account by {@code equals}. + */ + @Test + public void testElseFilterCopyAndEquals() { + final var cdt = factory.createRule(); + cdt.setElseFilter(true); + + final var copy = new Rule<>(cdt); + assertTrue(copy.isElseFilter()); + assertEquals(cdt, copy); + + copy.setElseFilter(false); + assertNotEquals(cdt, copy); + } + /** * Test of {@code MinScaleDenominator} property. */ diff --git a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/XmlTest.java b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/XmlTest.java deleted file mode 100644 index f4f91eb76b..0000000000 --- a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/style/se1/XmlTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.style.se1; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; - -// Test dependencies -import org.junit.jupiter.api.Test; -import org.apache.sis.test.TestCase; - - -/** - * Test of XML marshalling. - * The current version only verifies that {@link JAXBContext} can be created. - * We do not yet have sufficient JAXB annotations and adapters for real marshalling. - * - * @author Martin Desruisseaux (Geomatys) - */ -public final class XmlTest extends TestCase { - /** - * Creates a new test case. - */ - public XmlTest() { - } - - /** - * Tests the creation of a JAXB context. - * - * @throws JAXBException if some invalid annotations were found. - */ - @Test - public void testContext() throws JAXBException { - JAXBContext.newInstance(Symbolizer.class); - } -}
