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