Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java @ 1115:f953c9a559d8
Added license file and license headers.
gnv-artifacts/trunk@1260 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 02 Nov 2010 17:46:55 +0000 |
parents | 9a24c743efa6 |
children | dec4257ad570 |
rev | line source |
---|---|
1115
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
1 /* |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
3 * |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
7 */ |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
8 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.gnv.state.profile.horizontalcrosssection; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 |
829
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
11 import java.awt.Dimension; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
12 import java.io.File; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
13 import java.io.IOException; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
14 import java.io.OutputStream; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
15 import java.util.ArrayList; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
16 import java.util.Collection; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
17 import java.util.Date; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
18 import java.util.HashMap; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
19 import java.util.List; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
20 import java.util.Map; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
21 |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
22 import org.apache.log4j.Logger; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
23 import org.w3c.dom.Document; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
24 import org.w3c.dom.Element; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
25 import org.w3c.dom.Node; |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
26 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
27 import com.vividsolutions.jts.geom.Coordinate; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
28 import com.vividsolutions.jts.geom.Envelope; |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
29 import com.vividsolutions.jts.geom.MultiLineString; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
30 import com.vividsolutions.jts.geom.MultiPolygon; |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
31 import com.vividsolutions.jts.geom.Polygon; |
358
2f7a28f211c7
Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
343
diff
changeset
|
32 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
33 import de.intevation.artifactdatabase.Config; |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
34 import de.intevation.artifactdatabase.XMLUtils; |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
35 import de.intevation.artifacts.ArtifactNamespaceContext; |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
36 import de.intevation.artifacts.CallContext; |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
37 import de.intevation.gnv.artifacts.cache.CacheFactory; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
38 import de.intevation.gnv.artifacts.context.GNVArtifactContext; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 import de.intevation.gnv.geobackend.base.Result; |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
40 import de.intevation.gnv.geobackend.base.ResultDescriptor; |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
41 import de.intevation.gnv.geobackend.base.query.QueryExecutor; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
42 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
43 import de.intevation.gnv.geobackend.base.query.exception.QueryException; |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
44 import de.intevation.gnv.geobackend.sde.datasources.RasterObject; |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
45 import de.intevation.gnv.math.AreaInterpolation; |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
46 import de.intevation.gnv.math.AttributedPoint2ds; |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
47 import de.intevation.gnv.math.Point2d; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
48 import de.intevation.gnv.math.QueriedXYDepth; |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
49 import de.intevation.gnv.raster.ExternalIndexConverter; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
50 import de.intevation.gnv.raster.IsoAttributeGenerator; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
51 import de.intevation.gnv.raster.JTSMultiLineStringProducer; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
52 import de.intevation.gnv.raster.JTSMultiPolygonProducer; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
53 import de.intevation.gnv.raster.Palette; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
54 import de.intevation.gnv.raster.PaletteManager; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
55 import de.intevation.gnv.raster.Raster; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
56 import de.intevation.gnv.raster.Vectorizer; |
459
9c2767fcb388
Added the possibility to enter a Polygon represented by an WKT into the Workflow of the HorizontalCrossSections
Tim Englich <tim.englich@intevation.de>
parents:
439
diff
changeset
|
57 import de.intevation.gnv.state.InputData; |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
58 import de.intevation.gnv.state.OutputStateBase; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 import de.intevation.gnv.state.exception.StateException; |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
60 import de.intevation.gnv.utils.ExclusiveExec; |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
61 import de.intevation.gnv.utils.FileUtils; |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
593
diff
changeset
|
62 import de.intevation.gnv.utils.MapfileGenerator; |
646
c8749d83d9b6
Added a configuration section for mapserver relevant stuff. Moved source to write meta files out to an own helper class named MetaWriter.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
63 import de.intevation.gnv.utils.MetaWriter; |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
64 import de.intevation.gnv.utils.Pair; |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
65 import de.intevation.gnv.utils.ShapeFileWriter; |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
66 import de.intevation.gnv.utils.StringUtils; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
67 import de.intevation.gnv.utils.WKTUtils; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 /** |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
70 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
71 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
72 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 */ |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
74 public class HorizontalCrossSectionMeshOutputState |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
75 extends OutputStateBase |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
76 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 private static Logger log = Logger |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
78 .getLogger(HorizontalCrossSectionMeshOutputState.class); |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
79 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 * The UID of this Class |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 private static final long serialVersionUID = 3233620652465061860L; |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
84 |
528
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
85 public static final boolean USE_INDEX_BUFFER = |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
86 Boolean.getBoolean("gnv.horizontal.cross.section.mesh.index.buffer"); |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
87 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
88 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
89 * Shapefile name for isolines. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
90 */ |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
91 public static final String ISOLINES_NAME = "isolines.shp"; |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
92 |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
93 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
94 * Shapefile name for polygons. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
95 */ |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
96 public static final String POLYGON_NAME = "polygons.shp"; |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
97 |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
98 public static final String LAYER_MODEL = "horizontalcrosssection"; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
99 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
100 private String ijkQueryID; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
101 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
102 private Boolean shapeFileLock = new Boolean(true); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
103 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
104 private String shapeFilePath; |
1070
7096a2e13676
Added functionality to publish the the mbr of the generated layer to
Tim Englich <tim.englich@intevation.de>
parents:
1060
diff
changeset
|
105 |
7096a2e13676
Added functionality to publish the the mbr of the generated layer to
Tim Englich <tim.englich@intevation.de>
parents:
1060
diff
changeset
|
106 private Envelope bbox = null; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
109 * Constructor |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
110 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 public HorizontalCrossSectionMeshOutputState() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
112 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
113 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
114 @Override |
504
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
115 public void initialize(String uuid, CallContext callContext) |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
116 throws StateException { |
504
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
117 super.initialize(uuid, callContext); |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
118 if (log.isDebugEnabled()) { |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
119 log.debug("initialize output state " + uuid); |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
120 } |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
121 // fill the cache |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
122 getResult(uuid, callContext); |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
123 } |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
124 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
125 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
126 * Returns the shapefile directory path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
127 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
128 * @return the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
129 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
130 public String getShapeFilePath() { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
131 synchronized (shapeFileLock) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
132 return shapeFilePath; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
133 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
134 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
135 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
136 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
137 * Set the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
138 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
139 * @param shapeFilePath Destination path to write shapefiles. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
140 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
141 public void setShapeFilePath(String shapeFilePath) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
142 synchronized (shapeFileLock) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
143 this.shapeFilePath = shapeFilePath; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
144 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
145 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
146 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
147 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
148 * Method to reset the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
149 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
150 * @return the old path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
151 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
152 public String resetShapeFilePath() { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
153 synchronized (shapeFileLock) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
154 String path = shapeFilePath; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
155 shapeFilePath = null; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
156 return path; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
157 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
158 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
159 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
160 |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
161 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
162 * This method removes all shapefiles which might have been written by this |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
163 * artifact and resets the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
164 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
165 * @param globalContext CallContext |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
166 */ |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
167 @Override |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
168 public void endOfLife(Object globalContext) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
169 super.endOfLife(globalContext); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
170 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
171 // do it in background |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
172 new Thread() { |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
173 @Override |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
174 public void run() { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
175 String path = resetShapeFilePath(); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
176 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
177 if (path == null) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
178 return; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
179 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
180 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
181 File dir = new File(path); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
182 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
183 for (int i = 0; i < 10; ++i) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
184 if (!dir.exists() || FileUtils.deleteRecursive(dir)) { |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
593
diff
changeset
|
185 MapfileGenerator.getInstance().update(); |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
186 return; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
187 } |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
593
diff
changeset
|
188 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
189 try { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
190 Thread.sleep(10000L); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
191 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
192 catch (InterruptedException ie) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
193 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
194 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
195 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
196 log.error("failed to remove directory '" + path + "'"); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
197 } // run |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
198 }.start(); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
199 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
200 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
201 |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
202 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
203 * This out target has two options:<br> |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
204 * <ol> |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
205 * <li>zip: Write the resulting data to shapefiles and export them as |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
206 * zip-archive.</li> |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
207 * <li>wms: Write the resulting data to shapefiles and feed a map service |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
208 * with a layer displaying these shapefiles.</li> |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
209 * </ol> |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
210 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
211 * @param format |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
212 * @param inputData |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
213 * @param outputStream |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
214 * @param uuid |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
215 * @param callContext |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
216 * @throws StateException |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
217 */ |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
218 public void out( |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
219 Document format, |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
220 Collection<InputData> inputData, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
221 OutputStream outputStream, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
222 String uuid, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
223 CallContext callContext |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
224 ) |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
225 throws StateException |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
226 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
227 String outputMode = XMLUtils.xpathString( |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
228 format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
229 |
537
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
230 if (outputMode == null) { |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
231 throw new StateException("cannot find outputMode or mime"); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
232 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
233 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
234 outputMode = outputMode.toLowerCase(); |
471
06887e2e3f7a
Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
468
diff
changeset
|
235 |
504
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
236 if (log.isDebugEnabled()) { |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
237 log.debug("---- asking for: " + outputMode); |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
238 } |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
239 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
240 if ("zip".equals(outputMode)) { |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
241 writeZip(uuid, callContext, outputStream); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
242 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
243 else if ("wms".equals(outputMode)) { |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
244 XMLUtils.toStream( |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
245 getWMS(uuid, callContext, inputData), |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
246 outputStream); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
247 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
248 else { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
249 throw new StateException("unsupported output mode"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
250 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
251 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
252 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
253 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
254 * Create a zip archive with the shapefiles of the given shapefiles path and |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
255 * write it to <code>output</code>. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
256 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
257 * @param uuid The UUID of the current artifact. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
258 * @param callContext The CallContext object. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
259 * @param output The output stream. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
260 * @throws StateException if an error occured while zipfile creation. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
261 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
262 protected void writeZip( |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
263 String uuid, |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
264 CallContext callContext, |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
265 OutputStream output |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
266 ) |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
267 throws StateException |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
268 { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
269 try { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
270 String p = getShapeFilePath(); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
271 if (p != null) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
272 File dir = new File(p); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
273 if (dir.isDirectory()) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
274 FileUtils.createZipArchive(dir, output); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
275 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
276 } |
537
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
277 else { |
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
278 AttributedPoint2ds result = getResult(uuid, callContext); |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
279 ExclusiveExec.UniqueKey k = ExclusiveExec.INSTANCE.acquire(uuid); |
537
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
280 if (result != null |
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
281 && (p = writeToShapeFile(uuid, result, callContext)) != null) { |
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
282 FileUtils.createZipArchive(new File(p), output); |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
283 ExclusiveExec.INSTANCE.release(k); |
537
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
284 } |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
285 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
286 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
287 catch (IOException ioe) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
288 log.error(ioe.getLocalizedMessage(), ioe); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
289 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
290 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
291 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
292 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
293 * Write data to shapefiles and feed a map service with information about |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
294 * these shapefiles. The map service can be queried for displaying |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
295 * corresponding layers as WMS. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
296 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
297 * @param uuid The UUID of the current artifact. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
298 * @param callContext The CallContext object. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
299 * @param inputData A collection with some input data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
300 * @return a document with some meta information (shapefile path, geometry |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
301 * type, time to live of the current artifact, etc). |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
302 * @throws StateException if an error occured while shapefile writing. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
303 */ |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
304 protected Document getWMS( |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
305 String uuid, |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
306 CallContext callContext, |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
307 Collection<InputData> inputData |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
308 ) |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
309 throws StateException |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
310 { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
311 Document document = XMLUtils.newDocument(); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
312 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
313 Element pathElement = document.createElement("path"); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
314 document.appendChild(pathElement); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
315 |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
316 String path = getShapeFilePath(); |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
317 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
318 if (path != null && new File(path).isDirectory()) { |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
319 Document meta = MetaWriter.initMeta(); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
320 MetaWriter.insertAbstractMeta(callContext, meta); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
321 |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
322 String prefix = getLayerPrefix(inputData); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
323 if (prefix == null) { |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
324 prefix = uuid; |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
325 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
326 |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
327 // append polygon meta |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
328 String model = findParameterType(callContext); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
329 String type = "POLYGON"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
330 String name = getLayerName(uuid, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
331 String title = getLayerTitle(prefix, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
332 String data = getLayerData(uuid, POLYGON_NAME); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
333 String status = "OFF"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
334 MetaWriter.insertLayer( |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
335 callContext, meta, name, title, data, model, type, status); |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
336 |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
337 // append isoline meta |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
338 model += "_isolines"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
339 type = "LINE"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
340 name = getLayerName(uuid, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
341 title = getLayerTitle(prefix, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
342 data = getLayerData(uuid, ISOLINES_NAME); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
343 MetaWriter.insertLayer( |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
344 callContext, meta, name, title, data, model, type, status); |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
345 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
346 if (meta != null) { |
1070
7096a2e13676
Added functionality to publish the the mbr of the generated layer to
Tim Englich <tim.englich@intevation.de>
parents:
1060
diff
changeset
|
347 MetaWriter.insertMbr(this.bbox, "EPSG:4326", meta); |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
348 MetaWriter.writeMetaFile(path, meta); |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
349 MapfileGenerator.getInstance().update(); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
350 return meta; |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
351 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
352 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
353 pathElement.setTextContent(path); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
354 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
355 else { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
356 AttributedPoint2ds result = getResult(uuid, callContext); |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
357 ExclusiveExec.UniqueKey key = ExclusiveExec.INSTANCE.acquire(uuid); |
829
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
358 try{ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
359 if (result != null |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
360 && (path = writeToShapeFile(uuid, result, callContext)) != null) { |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
361 Document meta = MetaWriter.initMeta(); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
362 MetaWriter.insertAbstractMeta(callContext, meta); |
835
2423cefe7d39
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
829
diff
changeset
|
363 |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
364 String prefix = getLayerPrefix(inputData); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
365 if (prefix == null) { |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
366 prefix = uuid; |
646
c8749d83d9b6
Added a configuration section for mapserver relevant stuff. Moved source to write meta files out to an own helper class named MetaWriter.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
367 } |
c8749d83d9b6
Added a configuration section for mapserver relevant stuff. Moved source to write meta files out to an own helper class named MetaWriter.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
368 |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
369 // append polygon meta |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
370 String model = findParameterType(callContext); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
371 String type = "POLYGON"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
372 String name = getLayerName(uuid, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
373 String title = getLayerTitle(prefix, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
374 String data = getLayerData(uuid, POLYGON_NAME); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
375 String status = "OFF"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
376 MetaWriter.insertLayer( |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
377 callContext, meta, name, title, data, model, type, status); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
378 |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
379 // append isoline meta |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
380 model += "_isolines"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
381 type = "LINE"; |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
382 name = getLayerName(uuid, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
383 title = getLayerTitle(prefix, type); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
384 data = getLayerData(uuid, ISOLINES_NAME); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
385 MetaWriter.insertLayer( |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
386 callContext, meta, name, title, data, model, type, status); |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
387 |
646
c8749d83d9b6
Added a configuration section for mapserver relevant stuff. Moved source to write meta files out to an own helper class named MetaWriter.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
388 if (meta != null) { |
1112
9a24c743efa6
Write missing bbox into meta file while publishing a WMS layer for product 'Horizontalschnitt'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1111
diff
changeset
|
389 MetaWriter.insertMbr(this.bbox, "EPSG:4326", meta); |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
390 MetaWriter.writeMetaFile(path, meta); |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
391 MapfileGenerator.getInstance().update(); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
392 return meta; |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
393 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
394 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
395 pathElement.setTextContent(path); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
396 } |
829
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
397 }finally{ |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
398 ExclusiveExec.INSTANCE.release(key); |
95733e564896
Bugfix: Put some Code that is responsible for Synchonization into the final-block to prevent that the lock is not released.
Tim Englich <tim.englich@intevation.de>
parents:
805
diff
changeset
|
399 } |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
400 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
401 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
402 return document; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
403 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
404 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
405 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
406 * Find the parameter name which is used during mapfile creation in |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
407 * MapfileGenerator. |
805
bb7afd783321
Removed trailing whitespace. Added more javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
804
diff
changeset
|
408 * |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
409 * @param callContext The CallContext object. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
410 * @return the parameter name of the current parameterization. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
411 */ |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
412 protected String findParameterType(CallContext callContext) { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
413 InputData inputParam = inputData.get("parameterid"); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
414 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
415 Map<Integer, PaletteManager> paletteManagers = getPalettes(callContext); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
416 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
417 if (inputParam == null || paletteManagers == null) { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
418 log.warn("Parameter-id not found."); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
419 return LAYER_MODEL; |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
420 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
421 else { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
422 Integer parameterId = Integer.parseInt(inputParam.getValue()); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
423 PaletteManager paletteManager = paletteManagers.get(parameterId); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
424 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
425 return LAYER_MODEL + "_" + paletteManager.getName(); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
426 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
427 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
428 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
429 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
430 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
431 * Find the title for a wms layer specified by the user. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
432 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
433 * @param inputData A collection with InputData objects. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
434 * @return the title. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
435 */ |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
436 protected String getLayerPrefix(Collection<InputData> inputData) { |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
437 for (InputData data: inputData) { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
438 String name = data.getName(); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
439 if (name != null && name.equals("title")) { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
440 return (String) data.getValue(); |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
441 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
442 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
443 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
444 return null; |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
445 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
446 |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
447 |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
448 /** |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
449 * Returns the name of the layer. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
450 * |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
451 * @param uuid The uuid the the current session. It is the base part of the |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
452 * layername. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
453 * @param type The type of the layer ('POLYGON' or 'LINE'). |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
454 * @return the name of the layer. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
455 */ |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
456 protected String getLayerName(String uuid, String type) { |
1111
19182eaccc8d
Added a prefix for WMS layers to prevent the mapserver from generating invalid xml that would end in a bug (issue314, issue315).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1070
diff
changeset
|
457 return "GNV_" + uuid + "-" + type; |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
458 } |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
459 |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
460 /** |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
461 * Returns the layer title. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
462 * |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
463 * @param prefix A prefix (null not permitted). |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
464 * @param type The layer type. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
465 * @return the title of the layer. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
466 */ |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
467 protected String getLayerTitle(String prefix, String type) { |
1111
19182eaccc8d
Added a prefix for WMS layers to prevent the mapserver from generating invalid xml that would end in a bug (issue314, issue315).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1070
diff
changeset
|
468 return "GNV_" + prefix + "-" + type; |
1057
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
469 } |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
470 |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
471 |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
472 /** |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
473 * Returns the path to the shapefile that serves the layer data. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
474 * |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
475 * @param shapeDir The shapefile directory. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
476 * @param filename The name of the shapefile. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
477 * @return the relative path to the shapefile. |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
478 */ |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
479 protected String getLayerData(String shapeDir, String filename) { |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
480 File path = new File(shapeDir, filename); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
481 |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
482 return path.toString(); |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
483 } |
04967dc9c83f
The title of a layer can be changed by the user. Product 'Layer' and 'Horizontalschnitt' now use the same code path to write the meta information file. (issue198)
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1030
diff
changeset
|
484 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
485 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
486 * Write the resulting data to shapefiles. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
487 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
488 * @param uuid The UUID of the current artifact. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
489 * @param result The finalized data used for shapefile creation. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
490 * @param callContext The CallContext object. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
491 * @return the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
492 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
493 protected String writeToShapeFile( |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
494 String uuid, |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
495 AttributedPoint2ds result, |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
496 CallContext callContext |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
497 ) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
498 File baseDir = shapefileDirectory(callContext); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
499 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
500 File shapeDir = new File(baseDir, uuid); |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
501 |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
502 boolean success = false; |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
503 boolean createdDir = false; |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
504 |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
505 try { |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
506 synchronized (shapeFileLock) { |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
507 if (shapeDir.exists()) { |
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
508 FileUtils.deleteContent(shapeDir); |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
509 } |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
510 else if (!shapeDir.mkdirs()) { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
511 log.error("cannot create directory '" |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
512 + shapeDir.getAbsolutePath() + "'"); |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
513 return null; |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
514 } |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
515 createdDir = true; |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
516 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
517 |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
518 Map<Integer, MultiPolygon> polygons = result.getPolygons(); |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
519 |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
520 List<Pair<Object, MultiLineString>> isolines = |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
521 result.getLineStrings(); |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
522 |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
523 File polygonsFile = new File(shapeDir, POLYGON_NAME); |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
524 File isolinesFile = new File(shapeDir, ISOLINES_NAME); |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
525 |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
526 if (!ShapeFileWriter.writeMultiPolygonsToFile( |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
527 polygonsFile, |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
528 (Integer)result.getAttribute("parameter"), |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
529 (Integer)result.getAttribute("layer"), |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
530 (Date) result.getAttribute("date"), |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
531 polygons) |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
532 ) { |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
533 log.error("writing polygons failed"); |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
534 return null; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
535 } |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
536 |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
537 if (!ShapeFileWriter.writeMultiLineStringsToFile( |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
538 isolinesFile, |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
539 (Integer)result.getAttribute("parameter"), |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
540 (Integer)result.getAttribute("layer"), |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
541 (Date) result.getAttribute("date"), |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
542 isolines) |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
543 ) { |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
544 log.error("writing isolines failed"); |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
545 return null; |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
546 } |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
547 |
537
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
548 shapeFilePath = shapeDir.getAbsolutePath(); |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
549 success = true; |
537
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
550 |
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
551 callContext.afterCall(CallContext.STORE); |
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
552 |
f7f97edf09ba
Solved issue 164 - applied patch of msg 763. Remove directories and shape files of out-dated artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
528
diff
changeset
|
553 return shapeFilePath; |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
554 } |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
555 finally { |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
556 if (!success && createdDir) { |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
557 FileUtils.deleteRecursive(shapeDir); |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
558 } |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
559 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
560 } |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
561 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
562 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
563 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
564 * Return the processed results ready for being written to shapefile. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
565 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
566 * @param uuid The UUID of the current artifacts. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
567 * @param callContext The CallContext object. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
568 * @return the processed data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
569 * @throws StateException if an error occured while processing data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
570 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
571 protected AttributedPoint2ds getResult(String uuid, CallContext callContext) |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
572 throws StateException |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
573 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
574 CacheFactory cf = CacheFactory.getInstance(); |
1060
cc4ec127d666
Remove the elements of an outdated state from cache if its endOfLife method is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1057
diff
changeset
|
575 String key = getHash(); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
576 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
577 if (cf.isInitialized()) { |
1030
c07d9f9a738c
Removed bugs that existed in the caching mechanism (issue264, issue268).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
843
diff
changeset
|
578 log.debug("Using cache - key: " + key); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
579 net.sf.ehcache.Element value = cf.getCache().get(key); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
580 if (value != null) { |
1030
c07d9f9a738c
Removed bugs that existed in the caching mechanism (issue264, issue268).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
843
diff
changeset
|
581 log.debug("Found element in cache."); |
c07d9f9a738c
Removed bugs that existed in the caching mechanism (issue264, issue268).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
843
diff
changeset
|
582 return (AttributedPoint2ds)value.getObjectValue(); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
583 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
584 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
585 |
1030
c07d9f9a738c
Removed bugs that existed in the caching mechanism (issue264, issue268).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
843
diff
changeset
|
586 log.debug("Not using cache or element not found."); |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
587 AttributedPoint2ds result = produceResult(callContext); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
588 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
589 if (result != null && cf.isInitialized()) { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
590 cf.getCache().put(new net.sf.ehcache.Element(key, result)); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
591 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
592 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
593 return result; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
594 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
595 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
596 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
597 * Query the database for result data and turn it into a useful format to |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
598 * write this data into shapefiles. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
599 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
600 * @param callContext The CallContext object. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
601 * @return the processed data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
602 * @throws StateException if an error occured while processing data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
603 */ |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
604 protected AttributedPoint2ds produceResult(CallContext callContext) |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
605 throws StateException |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
606 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
607 InputData meshPolygon = inputData.get("mesh_polygon"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
608 InputData meshId = inputData.get("meshid"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
609 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
610 if (meshPolygon == null) { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
611 log.error("mesh_polygon is not defined"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
612 throw new StateException("missing mesh_linestring"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
613 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
614 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
615 if (meshId == null) { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
616 log.error("meshid is not defined"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
617 throw new StateException("missing meshid"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
618 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
619 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
620 Polygon p = WKTUtils.toPolygon(meshPolygon.getValue()); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
621 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
622 if (p == null) { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
623 log.error("no valid polygon"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
624 throw new StateException("no valid polygon"); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
625 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
626 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
627 try { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
628 Envelope env = p.getEnvelopeInternal(); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
629 |
1070
7096a2e13676
Added functionality to publish the the mbr of the generated layer to
Tim Englich <tim.englich@intevation.de>
parents:
1060
diff
changeset
|
630 this.bbox = env; |
528
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
631 String additionWhere; |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
632 |
528
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
633 if (USE_INDEX_BUFFER) { |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
634 Coordinate [] coords = new Coordinate [] { |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
635 new Coordinate(env.getMinX(), env.getMinY()), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
636 new Coordinate(env.getMinX(), env.getMaxY()), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
637 new Coordinate(env.getMaxX(), env.getMaxY()), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
638 new Coordinate(env.getMaxX(), env.getMinY()) }; |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
639 |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
640 additionWhere = |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
641 WKTUtils.worldEnvelopeCoordinatesToIndex( |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
642 coords, |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
643 meshId.getValue(), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
644 ijkQueryID); |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
645 } |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
646 else { |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
647 additionWhere = WKTUtils.TRUE_EXPRESSION; |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
648 } |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
649 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
650 String[] addedFilterValues = StringUtils.append( |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
651 generateFilterValuesFromInputData(), |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
652 additionWhere); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
653 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
654 QueryExecutor queryExecutor = QueryExecutorFactory |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
655 .getInstance() |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
656 .getQueryExecutor(); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
657 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
658 return process( |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
659 env, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
660 p, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
661 callContext, |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
662 preProcess( |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
663 queryExecutor.executeQuery( |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
664 queryID, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
665 addedFilterValues))); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
666 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
667 catch (QueryException e) { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
668 log.error(e,e); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
669 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
670 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
671 throw new StateException("no result produced"); |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
672 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
673 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
674 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
675 * First step of finalizing the data returned from database. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
676 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
677 * @param results Resulting data from database. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
678 * @return the pre-processed data which is still not useful for being |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
679 * written to shapefiles. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
680 */ |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
681 public AttributedPoint2ds preProcess(Collection<Result> results) { |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
682 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
683 boolean debug = log.isDebugEnabled(); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
684 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
685 if (debug) { |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
686 log.debug("--- preProcess: " + results.size() + " results"); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
687 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
688 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
689 AttributedPoint2ds ap2ds = new AttributedPoint2ds(); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
690 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
691 ArrayList<Point2d> points = new ArrayList<Point2d>(results.size()); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
692 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
693 int sIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
694 int iIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
695 int jIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
696 int vIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
697 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
698 boolean firstWarn = true; |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
699 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
700 for (Result result: results) { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
701 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
702 if (sIdx == -1) { |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
703 ResultDescriptor rd = result.getResultDescriptor(); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
704 sIdx = rd.getColumnIndex("SHAPE"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
705 iIdx = rd.getColumnIndex("IPOSITION"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
706 jIdx = rd.getColumnIndex("JPOSITION"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
707 vIdx = rd.getColumnIndex("YORDINATE"); |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
708 int kIdx = rd.getColumnIndex("KPOSITION"); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
709 int tIdx = rd.getColumnIndex("TIMEVALUE"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
710 int pIdx = rd.getColumnIndex("PARAMETERID"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
711 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
712 if (sIdx == -1 || iIdx == -1 |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
713 || jIdx == -1 || kIdx == -1 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
714 || vIdx == -1 || tIdx == -1 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
715 || pIdx == -1 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
716 ) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
717 log.error("missing column in result set"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
718 return null; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
719 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
720 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
721 ap2ds.setAttribute("date", result.getDate(tIdx)); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
722 ap2ds.setAttribute("parameter", result.getInteger(pIdx)); |
498
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
723 ap2ds.setAttribute("layer", result.getInteger(kIdx)); |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
724 } |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
725 Coordinate coord = WKTUtils.toCoordinate(result.getString(sIdx)); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
726 if (coord == null) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
727 if (firstWarn) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
728 firstWarn = false; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
729 log.warn("cannot fetch coordinate from result"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
730 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
731 continue; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
732 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
733 double v = result.getDouble(vIdx); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
734 int i = result.getInteger(iIdx); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
735 int j = result.getInteger(jIdx); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
736 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
737 Point2d p2d = new Point2d(coord.x, coord.y, v, i, j); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
738 points.add(p2d); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
739 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
740 } |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
741 ap2ds.setPoints(points); |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
742 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
743 return ap2ds; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
744 } |
622
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
745 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
746 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
747 * The last step of finalizing the data. The returned data is useful for |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
748 * shapefile creation. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
749 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
750 * @param boundingBox The bounding box. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
751 * @param polygon A polygon. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
752 * @param callContext CallContext. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
753 * @param input The pre-processed data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
754 * @return the finalized data ready for shapefile creation. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
755 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
756 public AttributedPoint2ds process( |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
757 Envelope boundingBox, |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
758 Polygon polygon, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
759 CallContext callContext, |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
760 AttributedPoint2ds input |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
761 ) { |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
762 if (input == null) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
763 log.error("no data to interpolate"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
764 return null; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
765 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
766 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
767 Integer parameterId = |
495
6e8364e766fa
Generate JTS geometries of "Horizontalschnitte" correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
484
diff
changeset
|
768 (Integer)input.getAttribute("parameter"); // XXX: hardcoded |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
769 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
770 if (parameterId == null) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
771 log.error("missing parameter id"); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
772 return null; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
773 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
774 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
775 Map<Integer, PaletteManager> paletteManagers = |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
776 getPalettes(callContext); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
777 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
778 PaletteManager paletteManager = paletteManagers.get(parameterId); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
779 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
780 if (paletteManager == null) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
781 log.error("no palette found for parameter id " + parameterId); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
782 return null; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
783 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
784 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
785 boolean debug = log.isDebugEnabled(); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
786 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
787 if (debug) { |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
788 log.debug("interpolation"); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
789 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
790 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
791 AreaInterpolation interpolation = |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
792 new AreaInterpolation(); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
793 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
794 int numSamples = numSamples(callContext); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
795 int groundInterpolation = getGroundInterpolation(callContext); |
593
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
796 int extrapolationRounds = extrapolationRounds(callContext); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
797 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
798 if (!interpolation.interpolate( |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
799 input.getPoints(), |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
800 boundingBox, |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
801 new Dimension(numSamples, numSamples), |
593
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
802 new QueriedXYDepth(groundInterpolation), |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
803 extrapolationRounds |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
804 )) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
805 log.error("interpolation failed"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
806 return null; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
807 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
808 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
809 // Do the post processing |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
810 Raster raster = new Raster( |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
811 interpolation.getRaster(), |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
812 numSamples); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
813 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
814 // TODO: Filter operations. |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
815 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
816 if (debug) { |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
817 log.debug("to indexed raster"); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
818 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
819 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
820 // scan for regions with base palette |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
821 Palette basePalette = paletteManager.getBase(); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
822 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
823 int [] intRaster = raster.toIndexed(basePalette); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
824 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
825 // produce JFreeChart compatible polygons |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
826 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
827 if (debug) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
828 log.debug("vectorize indexed raster"); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
829 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
830 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
831 // produce JTS compatible polygons |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
832 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
833 JTSMultiPolygonProducer jtsmpp = new JTSMultiPolygonProducer( |
499
e065a72f6b62
Clip "Horizontalschnitte" against given clipping polygon.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
498
diff
changeset
|
834 polygon, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
835 boundingBox.getMinX(), boundingBox.getMinY(), |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
836 boundingBox.getMaxX(), boundingBox.getMaxY()); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
837 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
838 int numRegions = new Vectorizer(intRaster, numSamples) |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
839 .process(jtsmpp); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
840 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
841 Map<Integer, MultiPolygon> polygons = jtsmpp.getMultiPolygons( |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
842 new ExternalIndexConverter(basePalette)); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
843 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
844 jtsmpp.clear(); jtsmpp = null; // help gc |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
845 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
846 int numColors = polygons.size(); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
847 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
848 if (debug) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
849 log.debug("number of regions: " + numRegions); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
850 log.debug("number of colors: " + numColors); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
851 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
852 // generate iso lines |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
853 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
854 int numIso; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
855 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
856 if (numColors < 5) { numIso = 5; } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
857 else if (numColors < 10) { numIso = 2; } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
858 else { numIso = 0; } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
859 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
860 Palette isoPalette; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
861 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
862 if (numIso == 0) { // same palette |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
863 isoPalette = basePalette; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
864 /* intRaster = intRaster; */ |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
865 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
866 else { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
867 isoPalette = paletteManager.getLevel(numIso); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
868 intRaster = raster.toIndexed(isoPalette); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
869 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
870 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
871 JTSMultiLineStringProducer jtslsp = new JTSMultiLineStringProducer( |
499
e065a72f6b62
Clip "Horizontalschnitte" against given clipping polygon.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
498
diff
changeset
|
872 polygon, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
873 boundingBox.getMinX(), boundingBox.getMinY(), |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
874 boundingBox.getMaxX(), boundingBox.getMaxY()); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
875 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
876 numRegions = new Vectorizer(false, intRaster, numSamples) |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
877 .process(jtslsp); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
878 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
879 IsoAttributeGenerator iag = new IsoAttributeGenerator(isoPalette); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
880 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
881 List<Pair<Object, MultiLineString>> lineStrings = |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
882 jtslsp.getMultiLineStrings(iag); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
883 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
884 jtslsp.clear(); jtslsp = null; // help gc |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
885 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
886 input.setInterpolation(interpolation); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
887 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
888 input.setPolygons(polygons); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
889 input.setLineStrings(lineStrings); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
890 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
891 return input; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
892 } |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
893 |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
894 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
895 @Override |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
896 public void setup(Node configuration) { |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
897 super.setup(configuration); |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
898 this.ijkQueryID = Config.getStringXPath(configuration,"queryID-ijk"); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
899 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
900 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
901 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
902 private static int numSamples(CallContext callContext) { |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
903 GNVArtifactContext context = |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
904 (GNVArtifactContext)callContext.globalContext(); |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
905 Integer samples = (Integer)context.get( |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
906 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY); |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
907 return samples != null |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
908 ? samples.intValue() |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
909 : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
910 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
911 |
593
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
912 private static int extrapolationRounds(CallContext callContext) { |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
913 GNVArtifactContext context = |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
914 (GNVArtifactContext)callContext.globalContext(); |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
915 Integer extrapolationRounds = (Integer)context.get( |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
916 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY); |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
917 return extrapolationRounds != null |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
918 ? extrapolationRounds.intValue() |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
919 : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS; |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
920 } |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
921 |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
922 private static File shapefileDirectory(CallContext callContext) { |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
923 GNVArtifactContext context = |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
924 (GNVArtifactContext)callContext.globalContext(); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
925 File dir = (File)context.get( |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
926 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
927 return dir != null |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
928 ? dir |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
929 : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH; |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
930 } |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
931 |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
932 private static int getGroundInterpolation(CallContext callContext) { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
933 GNVArtifactContext context = |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
934 (GNVArtifactContext)callContext.globalContext(); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
935 |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
936 String interpolation = (String)context.get( |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
937 GNVArtifactContext.HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
938 |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
939 return RasterObject.getInterpolationType(interpolation); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
940 } |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
941 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
942 private static Map<Integer, PaletteManager> getPalettes( |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
943 CallContext callContext |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
944 ) { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
945 GNVArtifactContext context = |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
946 (GNVArtifactContext)callContext.globalContext(); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
947 Map<Integer, PaletteManager> palettes = |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
948 (Map<Integer, PaletteManager>)context.get( |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
949 GNVArtifactContext.PALETTES_KEY); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
950 return palettes != null |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
951 ? palettes |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
952 : new HashMap<Integer, PaletteManager>(); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
953 } |
759
93489a0c1328
Added a cleanup mechanism to do some things before an artifact is being exported (issue208).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
730
diff
changeset
|
954 |
93489a0c1328
Added a cleanup mechanism to do some things before an artifact is being exported (issue208).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
730
diff
changeset
|
955 |
93489a0c1328
Added a cleanup mechanism to do some things before an artifact is being exported (issue208).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
730
diff
changeset
|
956 @Override |
93489a0c1328
Added a cleanup mechanism to do some things before an artifact is being exported (issue208).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
730
diff
changeset
|
957 public void cleanup(Object context) { |
93489a0c1328
Added a cleanup mechanism to do some things before an artifact is being exported (issue208).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
730
diff
changeset
|
958 resetShapeFilePath(); |
93489a0c1328
Added a cleanup mechanism to do some things before an artifact is being exported (issue208).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
730
diff
changeset
|
959 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
960 } |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
961 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |