Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java @ 5152:b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 01 Mar 2013 10:35:38 +0100 |
parents | 9c529b9de6b5 |
children | c1b60f8c3390 |
comparison
equal
deleted
inserted
replaced
5151:240ff7aeb6de | 5152:b26465581abf |
---|---|
8 import de.intevation.artifactdatabase.state.Facet; | 8 import de.intevation.artifactdatabase.state.Facet; |
9 import de.intevation.artifacts.Artifact; | 9 import de.intevation.artifacts.Artifact; |
10 import de.intevation.artifacts.CallContext; | 10 import de.intevation.artifacts.CallContext; |
11 import de.intevation.artifacts.CallMeta; | 11 import de.intevation.artifacts.CallMeta; |
12 import de.intevation.artifacts.GlobalContext; | 12 import de.intevation.artifacts.GlobalContext; |
13 import de.intevation.artifacts.common.utils.Config; | |
13 import de.intevation.artifacts.common.utils.FileTools; | 14 import de.intevation.artifacts.common.utils.FileTools; |
14 import de.intevation.flys.artifacts.access.RangeAccess; | 15 import de.intevation.flys.artifacts.access.RangeAccess; |
15 import de.intevation.flys.artifacts.FLYSArtifact; | 16 import de.intevation.flys.artifacts.FLYSArtifact; |
16 import de.intevation.flys.artifacts.context.FLYSContext; | 17 import de.intevation.flys.artifacts.context.FLYSContext; |
17 import de.intevation.flys.artifacts.model.CalculationMessage; | 18 import de.intevation.flys.artifacts.model.CalculationMessage; |
41 import java.io.FileOutputStream; | 42 import java.io.FileOutputStream; |
42 import java.io.IOException; | 43 import java.io.IOException; |
43 import java.util.ArrayList; | 44 import java.util.ArrayList; |
44 import java.util.List; | 45 import java.util.List; |
45 | 46 |
47 import javax.naming.Context; | |
48 | |
46 import org.apache.log4j.Logger; | 49 import org.apache.log4j.Logger; |
47 import org.geotools.feature.FeatureCollection; | 50 import org.geotools.feature.FeatureCollection; |
48 import org.geotools.feature.FeatureCollections; | 51 import org.geotools.feature.FeatureCollections; |
49 import org.geotools.feature.simple.SimpleFeatureBuilder; | 52 import org.geotools.feature.simple.SimpleFeatureBuilder; |
50 import org.opengis.feature.simple.SimpleFeature; | 53 import org.opengis.feature.simple.SimpleFeature; |
305 setDist(artifact, job); | 308 setDist(artifact, job); |
306 setLine(artifact, facetCreator, artifactDir, job); | 309 setLine(artifact, facetCreator, artifactDir, job); |
307 setUserShape(artifact, facetCreator, artifactDir, job); | 310 setUserShape(artifact, facetCreator, artifactDir, job); |
308 setAxis(artifact, artifactDir, job); | 311 setAxis(artifact, artifactDir, job); |
309 setPro(artifact, artifactDir, job); | 312 setPro(artifact, artifactDir, job); |
310 setDgm(artifact, job); | 313 setDgm(artifact, job, context); |
311 setArea(artifact, artifactDir, job); | 314 setArea(artifact, artifactDir, job); |
312 setOutFile(artifact, job); | 315 setOutFile(artifact, job); |
313 setWsp(artifact, context, artifactDir, job); // WSP | 316 setWsp(artifact, context, artifactDir, job); // WSP |
314 | 317 |
315 // TODO | 318 // TODO |
689 job.setPro(qpsShape.getAbsolutePath()); | 692 job.setPro(qpsShape.getAbsolutePath()); |
690 } | 693 } |
691 } | 694 } |
692 | 695 |
693 | 696 |
694 protected void setDgm(FLYSArtifact artifact, WSPLGENJob job) { | 697 protected void setDgm( |
698 FLYSArtifact artifact, | |
699 WSPLGENJob job, | |
700 CallContext context | |
701 ) { | |
695 String dgm_id = artifact.getDataAsString("dgm"); | 702 String dgm_id = artifact.getDataAsString("dgm"); |
696 | 703 |
697 int id = -1; | 704 int id = -1; |
698 try { | 705 try { |
699 id = Integer.parseInt(dgm_id); | 706 id = Integer.parseInt(dgm_id); |
706 logger.warn("Could not find specified DGM."); | 713 logger.warn("Could not find specified DGM."); |
707 | 714 |
708 return; | 715 return; |
709 } | 716 } |
710 | 717 |
711 job.setDgm(dgm.getPath()); | 718 File dgmPath = new File (dgm.getPath()); |
719 if (dgmPath.isAbsolute()) { | |
720 job.setDgm(dgm.getPath()); | |
721 } | |
722 else { | |
723 FLYSContext fc = (FLYSContext)context.globalContext(); | |
724 String prefix = (String) fc.get("dgm-path"); | |
725 job.setDgm(prefix.trim() + dgm.getPath().trim()); | |
726 } | |
712 } | 727 } |
713 | 728 |
714 | 729 |
715 protected void setArea(FLYSArtifact artifact, File dir, WSPLGENJob job) { | 730 protected void setArea(FLYSArtifact artifact, File dir, WSPLGENJob job) { |
716 String useFloodplain = artifact.getDataAsString("use_floodplain"); | 731 String useFloodplain = artifact.getDataAsString("use_floodplain"); |