Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java @ 1111:19182eaccc8d
Added a prefix for WMS layers to prevent the mapserver from generating invalid xml that would end in a bug (issue314, issue315).
gnv-artifacts/trunk@1245 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 29 Jun 2010 16:35:36 +0000 |
parents | 7096a2e13676 |
children | 9a24c743efa6 |
rev | line source |
---|---|
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.state.profile.horizontalcrosssection; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 |
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
|
3 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
|
4 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
|
5 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
|
6 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
|
7 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
|
8 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
|
9 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
|
10 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
|
11 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
|
12 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
|
13 |
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 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
|
15 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
|
16 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
|
17 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
|
18 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
19 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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
25 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
|
26 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
|
27 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
|
28 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
|
29 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
|
30 import de.intevation.gnv.artifacts.context.GNVArtifactContext; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 import de.intevation.gnv.math.Point2d; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 import de.intevation.gnv.state.OutputStateBase; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 import de.intevation.gnv.utils.WKTUtils; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 /** |
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
|
62 * @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
|
63 * @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
|
64 * @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
|
65 */ |
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
|
66 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
|
67 extends OutputStateBase |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
68 { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 private static Logger log = Logger |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
70 .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
|
71 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 * The UID of this Class |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 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
|
76 |
528
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
77 public static final boolean USE_INDEX_BUFFER = |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
78 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
|
79 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
80 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
81 * Shapefile name for isolines. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
82 */ |
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
|
83 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
|
84 |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
85 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
86 * Shapefile name for polygons. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
87 */ |
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
|
88 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
|
89 |
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
|
90 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
|
91 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
92 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
|
93 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
94 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
|
95 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
96 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
|
97 |
7096a2e13676
Added functionality to publish the the mbr of the generated layer to
Tim Englich <tim.englich@intevation.de>
parents:
1060
diff
changeset
|
98 private Envelope bbox = null; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
99 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
100 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
101 * Constructor |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
102 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 public HorizontalCrossSectionMeshOutputState() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
106 @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
|
107 public void initialize(String uuid, CallContext callContext) |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 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
|
112 } |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
113 // 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
|
114 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
|
115 } |
efab67e68bba
Trigger the calculation of the "Horizontalschnitt" when the output state is initialized.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
499
diff
changeset
|
116 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
117 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
118 * 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
|
119 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
120 * @return the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
121 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
126 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
127 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
128 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
129 * Set the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
130 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
131 * @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
|
132 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
137 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
138 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
139 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
140 * 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
|
141 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
142 * @return the old path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
143 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
144 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
|
145 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
|
146 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
|
147 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
|
148 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
|
149 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
150 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
151 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
152 |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
153 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
154 * 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
|
155 * 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
|
156 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
157 * @param globalContext CallContext |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
158 */ |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
159 @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
|
160 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
|
161 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
|
162 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
163 // 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
|
164 new Thread() { |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
165 @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
|
166 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
|
167 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
|
168 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
169 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
|
170 return; |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
171 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
172 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
173 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
|
174 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
175 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
|
176 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
|
177 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
|
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 } |
621
567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
593
diff
changeset
|
180 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
181 try { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
182 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
|
183 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
184 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
|
185 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
186 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
187 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
188 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
|
189 } // run |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
190 }.start(); |
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 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
193 |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
194 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
195 * 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
|
196 * <ol> |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
197 * <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
|
198 * zip-archive.</li> |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
199 * <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
|
200 * 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
|
201 * </ol> |
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 * @param format |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
204 * @param inputData |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
205 * @param outputStream |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
206 * @param uuid |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
207 * @param callContext |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
208 * @throws StateException |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
209 */ |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
210 public void out( |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 ) |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
217 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
|
218 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
219 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
|
220 format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
221 |
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
|
222 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
|
223 throw new StateException("cannot find outputMode or mime"); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
224 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
225 |
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 outputMode = outputMode.toLowerCase(); |
471
06887e2e3f7a
Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
468
diff
changeset
|
227 |
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
|
228 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
|
229 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
|
230 } |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
231 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
232 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
|
233 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
|
234 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
235 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
|
236 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
|
237 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
|
238 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
|
239 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
240 else { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
241 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
|
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 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
244 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
245 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
246 * 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
|
247 * 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
|
248 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
249 * @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
|
250 * @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
|
251 * @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
|
252 * @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
|
253 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
254 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
|
255 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
|
256 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
|
257 OutputStream output |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
258 ) |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
259 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
|
260 { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
261 try { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
262 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
|
263 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
|
264 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
|
265 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
|
266 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
|
267 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
268 } |
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
|
269 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
|
270 AttributedPoint2ds result = getResult(uuid, callContext); |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
271 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
|
272 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
|
273 && (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
|
274 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
|
275 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
|
276 } |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
277 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
278 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
279 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
|
280 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
|
281 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
282 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
283 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
284 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
285 * 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
|
286 * 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
|
287 * corresponding layers as WMS. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
288 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
289 * @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
|
290 * @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
|
291 * @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
|
292 * @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
|
293 * 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
|
294 * @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
|
295 */ |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
296 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
|
297 String uuid, |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
298 CallContext callContext, |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
299 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
|
300 ) |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
301 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
|
302 { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
303 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
|
304 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
305 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
|
306 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
|
307 |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
308 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
|
309 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
310 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
|
311 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
|
312 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
|
313 |
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
|
314 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
|
315 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
|
316 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
|
317 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
318 |
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 // 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 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
|
327 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
|
328 |
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
|
329 // 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
|
330 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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 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
|
336 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
|
337 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
338 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
|
339 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
|
340 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
|
341 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
|
342 return meta; |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
343 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
344 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
345 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
|
346 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
347 else { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
348 AttributedPoint2ds result = getResult(uuid, callContext); |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
349 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
|
350 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
|
351 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
|
352 && (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
|
353 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
|
354 MetaWriter.insertAbstractMeta(callContext, meta); |
835
2423cefe7d39
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
829
diff
changeset
|
355 |
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
|
356 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
|
357 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
|
358 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
|
359 } |
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
|
360 |
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 // 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
|
362 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
|
363 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
|
364 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
|
365 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
|
366 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
|
367 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
|
368 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
|
369 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
|
370 |
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 // 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
|
372 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
|
373 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
|
374 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 |
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
|
380 if (meta != 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
|
381 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
|
382 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
|
383 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
|
384 } |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
385 |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
386 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
|
387 } |
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
|
388 }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
|
389 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
|
390 } |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
391 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
392 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
393 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
|
394 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
395 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
396 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
397 * 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
|
398 * MapfileGenerator. |
805
bb7afd783321
Removed trailing whitespace. Added more javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
804
diff
changeset
|
399 * |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
400 * @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
|
401 * @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
|
402 */ |
730
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
403 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
|
404 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
|
405 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
406 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
|
407 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
408 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
|
409 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
|
410 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
|
411 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
412 else { |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
413 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
|
414 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
|
415 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
416 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
|
417 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
418 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
419 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
420 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
421 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
422 * 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
|
423 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
424 * @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
|
425 * @return the title. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
426 */ |
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
|
427 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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
433 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
434 |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
435 return null; |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
436 } |
452fad121560
Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
726
diff
changeset
|
437 |
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
|
438 |
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
|
439 /** |
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
|
440 * 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
|
441 * |
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
|
442 * @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
|
443 * 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
|
444 * @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
|
445 * @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
|
446 */ |
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 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
|
448 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
|
449 } |
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 /** |
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 * 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
|
453 * |
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 * @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
|
455 * @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
|
456 * @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
|
457 */ |
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 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
|
459 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
|
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 |
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 /** |
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 * 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
|
465 * |
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 * @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
|
467 * @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
|
468 * @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
|
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 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
|
471 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
|
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 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
|
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 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
476 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
477 * 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
|
478 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
479 * @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
|
480 * @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
|
481 * @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
|
482 * @return the shapefile path. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
483 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
484 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
|
485 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
|
486 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
|
487 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
|
488 ) { |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
489 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
|
490 |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
491 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
|
492 |
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
|
493 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
|
494 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
|
495 |
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
|
496 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
|
497 synchronized (shapeFileLock) { |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
498 if (shapeDir.exists()) { |
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
499 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
|
500 } |
775
eedad2ddad14
Removed race-condition while shapefile creation (issue164).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
759
diff
changeset
|
501 else if (!shapeDir.mkdirs()) { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
502 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
|
503 + 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
|
504 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
|
505 } |
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 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
|
507 } |
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
508 |
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 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
|
510 |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
511 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
|
512 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
|
513 |
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
|
514 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
|
515 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
|
516 |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
517 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
|
518 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
|
519 (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
|
520 (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
|
521 (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
|
522 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
|
523 ) { |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
524 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
|
525 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
|
526 } |
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
|
527 |
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 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
|
529 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
|
530 (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
|
531 (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
|
532 (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
|
533 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
|
534 ) { |
4080b57dcb52
Upgraded to Geotools 2.5.8. Write polygons and line strings to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
495
diff
changeset
|
535 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
|
536 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
|
537 } |
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 |
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
|
539 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
|
540 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
|
541 |
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
|
542 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
|
543 |
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
|
544 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
|
545 } |
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 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
|
547 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
|
548 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
|
549 } |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
550 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
551 } |
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
|
552 |
89aca25642d6
Implemented method stubs of MapfileGenerator. Mapfiles are successfully created corresponding meta.xml files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
621
diff
changeset
|
553 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
554 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
555 * 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
|
556 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
557 * @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
|
558 * @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
|
559 * @return the processed data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
560 * @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
|
561 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
562 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
|
563 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
|
564 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
565 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
|
566 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
|
567 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
575 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
576 |
1030
c07d9f9a738c
Removed bugs that existed in the caching mechanism (issue264, issue268).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
843
diff
changeset
|
577 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
|
578 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
|
579 |
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 (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
|
581 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
|
582 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
583 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
584 return result; |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
585 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
586 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
587 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
588 * 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
|
589 * 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
|
590 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
591 * @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
|
592 * @return the processed data. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
593 * @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
|
594 */ |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
595 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
|
596 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
|
597 { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
598 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
|
599 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
|
600 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
601 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
|
602 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
|
603 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
|
604 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
605 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
606 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
|
607 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
|
608 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
|
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 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
611 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
|
612 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
613 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
|
614 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
|
615 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
|
616 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
617 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
618 try { |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
619 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
|
620 |
1070
7096a2e13676
Added functionality to publish the the mbr of the generated layer to
Tim Englich <tim.englich@intevation.de>
parents:
1060
diff
changeset
|
621 this.bbox = env; |
528
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
622 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
|
623 |
528
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
624 if (USE_INDEX_BUFFER) { |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
625 Coordinate [] coords = new Coordinate [] { |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
626 new Coordinate(env.getMinX(), env.getMinY()), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
627 new Coordinate(env.getMinX(), env.getMaxY()), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
628 new Coordinate(env.getMaxX(), env.getMaxY()), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
629 new Coordinate(env.getMaxX(), env.getMinY()) }; |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
630 |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
631 additionWhere = |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
632 WKTUtils.worldEnvelopeCoordinatesToIndex( |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
633 coords, |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
634 meshId.getValue(), |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
635 ijkQueryID); |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
636 } |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
637 else { |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
638 additionWhere = WKTUtils.TRUE_EXPRESSION; |
44415ae01ddb
Fixed issue gnv/issue159
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
504
diff
changeset
|
639 } |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
640 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
641 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
|
642 generateFilterValuesFromInputData(), |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
643 additionWhere); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
644 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
645 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
|
646 .getInstance() |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
647 .getQueryExecutor(); |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
648 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
649 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
|
650 env, |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
651 p, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
652 callContext, |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
653 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
|
654 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
|
655 queryID, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
656 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
|
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 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
|
659 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
|
660 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
661 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
662 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
|
663 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
664 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
665 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
666 * 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
|
667 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
668 * @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
|
669 * @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
|
670 * written to shapefiles. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
671 */ |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
672 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
|
673 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
674 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
|
675 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
676 if (debug) { |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
677 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
|
678 } |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
679 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
680 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
|
681 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
682 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
|
683 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
684 int sIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
685 int iIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
686 int jIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
687 int vIdx = -1; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
688 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
689 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
|
690 |
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
691 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
|
692 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
693 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
|
694 ResultDescriptor rd = result.getResultDescriptor(); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
695 sIdx = rd.getColumnIndex("SHAPE"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
696 iIdx = rd.getColumnIndex("IPOSITION"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
697 jIdx = rd.getColumnIndex("JPOSITION"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
698 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
|
699 int kIdx = rd.getColumnIndex("KPOSITION"); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
700 int tIdx = rd.getColumnIndex("TIMEVALUE"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
701 int pIdx = rd.getColumnIndex("PARAMETERID"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
702 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
703 if (sIdx == -1 || iIdx == -1 |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
704 || jIdx == -1 || kIdx == -1 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
705 || vIdx == -1 || tIdx == -1 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
706 || pIdx == -1 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
707 ) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
708 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
|
709 return null; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
710 } |
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 ap2ds.setAttribute("date", result.getDate(tIdx)); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
713 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
|
714 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
|
715 } |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
716 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
|
717 if (coord == null) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
718 if (firstWarn) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
719 firstWarn = false; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
720 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
|
721 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
722 continue; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
723 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
724 double v = result.getDouble(vIdx); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
725 int i = result.getInteger(iIdx); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
726 int j = result.getInteger(jIdx); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
727 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
728 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
|
729 points.add(p2d); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
730 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
731 } |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
732 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
|
733 |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
734 return ap2ds; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
735 } |
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
|
736 |
804
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
737 /** |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
738 * 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
|
739 * shapefile creation. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
740 * |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
741 * @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
|
742 * @param polygon A polygon. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
743 * @param callContext CallContext. |
9058c08eac3a
Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
744 * @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
|
745 * @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
|
746 */ |
481
20dde2b6f1b5
Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
480
diff
changeset
|
747 public AttributedPoint2ds process( |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
748 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
|
749 Polygon polygon, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
750 CallContext callContext, |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
751 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
|
752 ) { |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
753 if (input == null) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
754 log.error("no data to interpolate"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
755 return null; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
756 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
757 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
758 Integer parameterId = |
495
6e8364e766fa
Generate JTS geometries of "Horizontalschnitte" correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
484
diff
changeset
|
759 (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
|
760 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
761 if (parameterId == null) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
762 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
|
763 return null; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
764 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
765 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
766 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
|
767 getPalettes(callContext); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
768 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
769 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
|
770 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
771 if (paletteManager == null) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
772 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
|
773 return null; |
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 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
776 boolean debug = log.isDebugEnabled(); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
777 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
778 if (debug) { |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
779 log.debug("interpolation"); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
780 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
781 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
782 AreaInterpolation interpolation = |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
783 new AreaInterpolation(); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
784 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
785 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
|
786 int groundInterpolation = getGroundInterpolation(callContext); |
593
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
787 int extrapolationRounds = extrapolationRounds(callContext); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
788 |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
789 if (!interpolation.interpolate( |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
790 input.getPoints(), |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
791 boundingBox, |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
792 new Dimension(numSamples, numSamples), |
593
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
793 new QueriedXYDepth(groundInterpolation), |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
794 extrapolationRounds |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
795 )) { |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
796 log.error("interpolation failed"); |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
797 return null; |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
798 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
799 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
800 // 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
|
801 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
|
802 interpolation.getRaster(), |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
803 numSamples); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
804 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
805 // TODO: Filter operations. |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
806 |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
807 if (debug) { |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
808 log.debug("to indexed raster"); |
482
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
809 } |
64e65daa65e9
Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
481
diff
changeset
|
810 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
811 // 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
|
812 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
|
813 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
814 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
|
815 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
816 // 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
|
817 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
818 if (debug) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
819 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
|
820 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
821 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
822 // 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
|
823 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
824 JTSMultiPolygonProducer jtsmpp = new JTSMultiPolygonProducer( |
499
e065a72f6b62
Clip "Horizontalschnitte" against given clipping polygon.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
498
diff
changeset
|
825 polygon, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
826 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
|
827 boundingBox.getMaxX(), boundingBox.getMaxY()); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
828 |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
829 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
|
830 .process(jtsmpp); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
831 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
832 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
|
833 new ExternalIndexConverter(basePalette)); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
834 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
835 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
|
836 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
837 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
|
838 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
839 if (debug) { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
840 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
|
841 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
|
842 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
843 // generate iso lines |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
844 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
845 int numIso; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
846 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
847 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
|
848 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
|
849 else { numIso = 0; } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
850 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
851 Palette isoPalette; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
852 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
853 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
|
854 isoPalette = basePalette; |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
855 /* intRaster = intRaster; */ |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
856 } |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
857 else { |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
858 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
|
859 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
|
860 } |
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 JTSMultiLineStringProducer jtslsp = new JTSMultiLineStringProducer( |
499
e065a72f6b62
Clip "Horizontalschnitte" against given clipping polygon.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
498
diff
changeset
|
863 polygon, |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
864 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
|
865 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
|
866 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
867 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
|
868 .process(jtslsp); |
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 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
|
871 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
872 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
|
873 jtslsp.getMultiLineStrings(iag); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
874 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
875 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
|
876 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
877 input.setInterpolation(interpolation); |
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 input.setPolygons(polygons); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
880 input.setLineStrings(lineStrings); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
881 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
882 return input; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
883 } |
480
211cad2fb5ba
Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
884 |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
885 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
886 @Override |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
887 public void setup(Node configuration) { |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
888 super.setup(configuration); |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
889 this.ijkQueryID = Config.getStringXPath(configuration,"queryID-ijk"); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
890 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
891 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
892 |
468
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
893 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
|
894 GNVArtifactContext context = |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
895 (GNVArtifactContext)callContext.globalContext(); |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
896 Integer samples = (Integer)context.get( |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
897 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
|
898 return samples != null |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
899 ? samples.intValue() |
7ba4c7222265
Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents:
461
diff
changeset
|
900 : 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
|
901 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
902 |
593
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
903 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
|
904 GNVArtifactContext context = |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
905 (GNVArtifactContext)callContext.globalContext(); |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
906 Integer extrapolationRounds = (Integer)context.get( |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
907 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
|
908 return extrapolationRounds != null |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
909 ? extrapolationRounds.intValue() |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
910 : 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
|
911 } |
b248531fa20b
Added experimental support for extrapolation in "Horizontalschnitte"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
537
diff
changeset
|
912 |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
913 private static File shapefileDirectory(CallContext callContext) { |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
914 GNVArtifactContext context = |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
915 (GNVArtifactContext)callContext.globalContext(); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
916 File dir = (File)context.get( |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
917 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
|
918 return dir != null |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
919 ? dir |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
920 : 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
|
921 } |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
922 |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
923 private static int getGroundInterpolation(CallContext callContext) { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
924 GNVArtifactContext context = |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
925 (GNVArtifactContext)callContext.globalContext(); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
926 |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
927 String interpolation = (String)context.get( |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
928 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
|
929 |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
930 return RasterObject.getInterpolationType(interpolation); |
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
931 } |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
932 |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
933 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
|
934 CallContext callContext |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
935 ) { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
775
diff
changeset
|
936 GNVArtifactContext context = |
484
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
937 (GNVArtifactContext)callContext.globalContext(); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
938 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
|
939 (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
|
940 GNVArtifactContext.PALETTES_KEY); |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
941 return palettes != null |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
942 ? palettes |
823e4f808418
Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
482
diff
changeset
|
943 : 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
|
944 } |
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
|
945 |
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
|
946 |
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
|
947 @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
|
948 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
|
949 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
|
950 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
951 } |
474
ab29e4ff2fda
Added area interpolation needed for "Horizontalschnitt"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
471
diff
changeset
|
952 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |