Mercurial > dive4elements > river
changeset 4016:87aafd2c643a
Merged.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 02 Oct 2012 10:47:44 +0200 |
parents | 7f8d92873d58 (diff) 0be65bc65cee (current diff) |
children | e1691b74f3aa |
files | |
diffstat | 4 files changed, 63 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Tue Oct 02 10:38:57 2012 +0200 +++ b/flys-artifacts/ChangeLog Tue Oct 02 10:47:44 2012 +0200 @@ -1,3 +1,17 @@ +2012-10-02 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java + (setup): Deal with ids from datacage-doc, expose a data-item with the + annotationtypename. + + * flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationFacet.java + (getData): filter annotations given by typename, if available. + +2012-10-02 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * doc/conf/meta-data.xml: Show "per-type" annotations in + longitudinal-sections DC. + 2012-10-01 Felix Wolfsteller <felix.wolfsteller@intevation.de> * flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java,
--- a/flys-artifacts/doc/conf/meta-data.xml Tue Oct 02 10:38:57 2012 +0200 +++ b/flys-artifacts/doc/conf/meta-data.xml Tue Oct 02 10:47:44 2012 +0200 @@ -535,6 +535,25 @@ </annotation> </dc:macro> + <dc:macro name="annotations_per_type"> + <annotations> + <dc:context> + <dc:statement> + SELECT id AS anno_id, + name AS anno_description + FROM annotation_types + </dc:statement> + <dc:elements> + <annotation> + <dc:attribute name="name" value="${anno_description}"/> + <dc:attribute name="factory" value="annotations"/> + <dc:attribute name="ids" value="${river_id}:${anno_description}"/> + </annotation> + </dc:elements> + </dc:context> + </annotations> + </dc:macro> + <dc:macro name="cross_sections"> <cross_sections> <dc:attribute name="id" value="flood-protections-${river_id}"/> @@ -650,6 +669,7 @@ <dc:call-macro name="basedata_4_heightmarks-points"/> <dc:comment comment=" AMTL LINIEN ---------------------------"/> <dc:call-macro name="basedata_3_officials"/> + <dc:call-macro name="annotations_per_type"/> </dc:if> <dc:if test="dc:contains($artifact-outs, 'reference_curve')"> <dc:call-macro name="annotations"/>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java Tue Oct 02 10:38:57 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java Tue Oct 02 10:47:44 2012 +0200 @@ -9,6 +9,7 @@ import org.apache.log4j.Logger; import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; @@ -37,6 +38,23 @@ /** The name of the artifact. */ public static final String ARTIFACT_NAME = "annotation"; + @Override + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta callMeta, + Document data) + { + logger.debug("AnnotationArtifact.setup"); + String filter = StaticFLYSArtifact.getDatacageIDValue(data); + String[] splits = filter.split(":"); + if (splits.length > 1) { + addStringData("nameFilter", splits[1]); + } + super.setup(identifier, factory, context, callMeta, data); + } + /** Get river, setup Facets. */ @Override protected void initialize(Artifact artifact, Object context, @@ -63,6 +81,10 @@ } } + public String getFilterName() { + return getDataAsString("nameFilter"); + } + public double[] getDistance() { /** TODO In initialize(), access maximal range of river (via
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationFacet.java Tue Oct 02 10:38:57 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationFacet.java Tue Oct 02 10:47:44 2012 +0200 @@ -70,11 +70,17 @@ FastAnnotations fas = LocationProvider.getAnnotations(riverName); + String filterName = annotationArtifact.getFilterName(); + + FastAnnotations.Filter filter = (filterName == null) + ? FastAnnotations.IS_POINT + : new FastAnnotations.NameFilter(filterName); + List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(fas.size()); for (Iterator<FastAnnotations.Annotation> iter = - fas.filter(FastAnnotations.IS_POINT); iter.hasNext();) { + fas.filter(filter); iter.hasNext();) { FastAnnotations.Annotation fa = iter.next(); xy.add(new StickyAxisAnnotation(