Revision 60
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.clip/src/main/java/org/gvsig/sextante/app/algorithm/clip/ClipOperation.java | ||
---|---|---|
24 | 24 |
import org.gvsig.fmap.dal.exception.DataException; |
25 | 25 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
26 | 26 |
import org.gvsig.fmap.dal.feature.Feature; |
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 | 27 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
29 | 28 |
import org.gvsig.sextante.app.algorithm.base.core.DALFeaturePersister; |
30 | 29 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
... | ... | |
56 | 55 |
public ClipOperation(org.gvsig.fmap.geom.Geometry clip) { |
57 | 56 |
this.clippingConvexHull = GeometryUtil.geomToJTS(clip); |
58 | 57 |
} |
59 |
|
|
60 |
/** |
|
61 |
* Sets the output FeatureType |
|
62 |
* @param out |
|
63 |
* @throws DataException |
|
64 |
*/ |
|
65 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
66 |
persister = new DALFeaturePersister(out, attrNames); |
|
67 |
} |
|
68 | 58 |
|
69 | 59 |
/** |
70 | 60 |
* clips feature's geometry with the clipping geometry, preserving |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.convexhull/src/main/java/org/gvsig/sextante/app/algorithm/convexhull/ConvexHullParametersPanel.java | ||
---|---|---|
13 | 13 |
import javax.swing.JButton; |
14 | 14 |
import javax.swing.JComboBox; |
15 | 15 |
|
16 |
import org.cresques.cts.IProjection; |
|
17 |
import org.gvsig.app.gui.panels.CRSSelectPanel; |
|
18 |
import org.gvsig.fmap.crs.CRSFactory; |
|
19 | 16 |
import org.gvsig.fmap.dal.DALLocator; |
20 | 17 |
import org.gvsig.fmap.dal.DataManager; |
21 | 18 |
import org.gvsig.fmap.dal.DataStoreParameters; |
22 | 19 |
import org.gvsig.fmap.dal.exception.InitializeException; |
23 | 20 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
24 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
25 | 21 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.DynObjectEditor; |
26 | 22 |
|
27 | 23 |
import es.unex.sextante.core.GeoAlgorithm; |
... | ... | |
33 | 29 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
34 | 30 |
*/ |
35 | 31 |
public class ConvexHullParametersPanel extends GeoAlgorithmParametersPanel implements ActionListener { |
36 |
private GeoAlgorithm m_Algorithm = null;
|
|
37 |
private JComboBox combo = null; |
|
38 |
private JButton button = null; |
|
39 |
private ArrayList<DataStoreParameters> paramList = new ArrayList<DataStoreParameters>(); |
|
32 |
private static final long serialVersionUID = 1L;
|
|
33 |
private JComboBox combo = null;
|
|
34 |
private JButton button = null;
|
|
35 |
private ArrayList<DataStoreParameters> paramList = new ArrayList<DataStoreParameters>();
|
|
40 | 36 |
|
41 | 37 |
public ConvexHullParametersPanel() { |
42 | 38 |
super(); |
43 | 39 |
} |
44 | 40 |
|
45 | 41 |
public void init(GeoAlgorithm algorithm) { |
46 |
m_Algorithm = algorithm; |
|
47 | 42 |
initGUI(); |
48 | 43 |
} |
49 | 44 |
|
... | ... | |
108 | 103 |
|
109 | 104 |
} |
110 | 105 |
|
106 |
@SuppressWarnings("unchecked") |
|
111 | 107 |
private void loadProviderList(JComboBox c, ArrayList<DataStoreParameters> paramList) { |
112 | 108 |
try { |
113 | 109 |
DataManager manager = DALLocator.getDataManager(); |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.convexhull/src/main/java/org/gvsig/sextante/app/algorithm/convexhull/TestPanel.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
public class TestPanel { |
25 | 25 |
private JFrame frame = new JFrame(); |
26 |
@SuppressWarnings("deprecation") |
|
26 | 27 |
private ConvexHullParametersPanel hp = null; |
27 | 28 |
|
28 | 29 |
public TestPanel() { |
... | ... | |
39 | 40 |
new TestPanel(); |
40 | 41 |
} |
41 | 42 |
|
43 |
@SuppressWarnings("deprecation") |
|
42 | 44 |
private void initialize() { |
43 | 45 |
frame.setSize(new java.awt.Dimension(370, 50)); |
44 | 46 |
hp = new ConvexHullParametersPanel(); |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.convexhull/src/main/java/org/gvsig/sextante/app/algorithm/convexhull/ConvexHullOperation.java | ||
---|---|---|
76 | 76 |
*/ |
77 | 77 |
package org.gvsig.sextante.app.algorithm.convexhull; |
78 | 78 |
|
79 |
import org.gvsig.fmap.dal.exception.DataException; |
|
80 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
79 | 81 |
import org.gvsig.fmap.geom.GeometryLocator; |
80 | 82 |
import org.gvsig.fmap.geom.GeometryManager; |
81 | 83 |
import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
... | ... | |
106 | 108 |
geometryManager = GeometryLocator.getGeometryManager(); |
107 | 109 |
} |
108 | 110 |
|
111 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
112 |
} |
|
113 |
|
|
109 | 114 |
/** |
110 | 115 |
* Returns FMap convex hull geometry. |
111 | 116 |
* @return |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.dissolve/src/main/java/org/gvsig/sextante/app/algorithm/dissolve/DissolveOperation.java | ||
---|---|---|
34 | 34 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
35 | 35 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection; |
36 | 36 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
37 |
import org.gvsig.sextante.app.algorithm.base.core.DALFeaturePersister; |
|
38 | 37 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
39 | 38 |
import org.gvsig.sextante.app.algorithm.base.util.GeometryUtil; |
40 | 39 |
|
... | ... | |
48 | 47 |
public class DissolveOperation extends GeometryOperation { |
49 | 48 |
private EditableFeature lastEditFeature = null; |
50 | 49 |
private ArrayList<Geometry> geometries = new ArrayList<Geometry>(); |
51 |
private IDissolveRule criteria = null; |
|
50 |
private IDissolveRule criteria = null;
|
|
52 | 51 |
private AtomicDissolveOperation atomicOperation = new AtomicDissolveOperation(); |
53 | 52 |
/** |
54 | 53 |
* Cada elemento representa una feature del vectorial de entrada. Cuando se hace un dissolve de |
... | ... | |
59 | 58 |
public DissolveOperation(IDissolveRule criteria) { |
60 | 59 |
this.criteria = criteria; |
61 | 60 |
} |
62 |
|
|
63 |
/** |
|
64 |
* Sets the output FeatureType |
|
65 |
* @param out |
|
66 |
* @throws DataException |
|
67 |
*/ |
|
68 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
69 |
persister = new DALFeaturePersister(out, attrNames); |
|
70 |
} |
|
71 | 61 |
|
72 | 62 |
/* |
73 | 63 |
* (non-Javadoc) |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.difference/src/main/java/org/gvsig/sextante/app/algorithm/difference/DifferenceOperation.java | ||
---|---|---|
24 | 24 |
import org.gvsig.fmap.dal.exception.DataException; |
25 | 25 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
26 | 26 |
import org.gvsig.fmap.dal.feature.Feature; |
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 | 27 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
29 |
import org.gvsig.sextante.app.algorithm.base.core.DALFeaturePersister; |
|
30 | 28 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
31 | 29 |
import org.gvsig.sextante.app.algorithm.base.util.GeometryUtil; |
32 | 30 |
|
... | ... | |
49 | 47 |
if(overlays != null) |
50 | 48 |
this.overlaysGeom = GeometryUtil.geomToJTS(overlays); |
51 | 49 |
} |
52 |
|
|
53 |
/** |
|
54 |
* Sets the output FeatureType |
|
55 |
* @param out |
|
56 |
* @throws DataException |
|
57 |
*/ |
|
58 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
59 |
persister = new DALFeaturePersister(out, attrNames); |
|
60 |
} |
|
61 | 50 |
|
62 | 51 |
/** |
63 | 52 |
* clips feature's geometry with the clipping geometry, preserving |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.reproject/src/main/java/org/gvsig/sextante/app/algorithm/reproject/ReprojectOperation.java | ||
---|---|---|
28 | 28 |
import org.gvsig.fmap.dal.exception.DataException; |
29 | 29 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
30 | 30 |
import org.gvsig.fmap.dal.feature.Feature; |
31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
32 | 31 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
33 |
import org.gvsig.sextante.app.algorithm.base.core.DALFeaturePersister; |
|
34 | 32 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
35 | 33 |
|
36 | 34 |
import es.unex.sextante.core.Sextante; |
... | ... | |
45 | 43 |
public ReprojectOperation(IProjection srcProj, IProjection dstProj) { |
46 | 44 |
this.transf = srcProj.getCT(dstProj); |
47 | 45 |
} |
48 |
|
|
49 |
/** |
|
50 |
* Sets the output FeatureType |
|
51 |
* @param out |
|
52 |
* @throws DataException |
|
53 |
*/ |
|
54 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
55 |
persister = new DALFeaturePersister(out, attrNames); |
|
56 |
} |
|
57 | 46 |
|
58 | 47 |
/* |
59 | 48 |
* (non-Javadoc) |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.spatialjoin/src/main/java/org/gvsig/sextante/app/algorithm/spatialjoin/IntersectsSpatialJoinOperation.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2010 Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.sextante.app.algorithm.spatialjoin; |
|
20 |
|
|
21 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
22 |
import org.gvsig.fmap.dal.feature.Feature; |
|
23 |
import org.gvsig.fmap.geom.Geometry; |
|
24 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
|
25 |
|
|
26 |
/** |
|
27 |
* |
|
28 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
29 |
*/ |
|
30 |
public class IntersectsSpatialJoinOperation extends GeometryOperation { |
|
31 |
|
|
32 |
/* |
|
33 |
* (non-Javadoc) |
|
34 |
* @see org.gvsig.sextante.app.algorithm.base.core.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.dal.feature.Feature) |
|
35 |
*/ |
|
36 |
public EditableFeature invoke(Geometry g, Feature featureInput) { |
|
37 |
return null; |
|
38 |
} |
|
39 |
|
|
40 |
/* |
|
41 |
* (non-Javadoc) |
|
42 |
* @see org.gvsig.sextante.app.algorithm.base.core.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.dal.feature.EditableFeature) |
|
43 |
*/ |
|
44 |
public void invoke(Geometry g, EditableFeature featureInput) { |
|
45 |
|
|
46 |
} |
|
47 |
|
|
48 |
} |
|
0 | 49 |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.spatialjoin/src/main/java/org/gvsig/sextante/app/algorithm/spatialjoin/SpatiallyIndexedSpatialJoinOperation.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2010 Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.sextante.app.algorithm.spatialjoin; |
|
20 |
|
|
21 |
import java.util.Iterator; |
|
22 |
import java.util.List; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.exception.DataException; |
|
25 |
import org.gvsig.fmap.dal.feature.DisposableIterator; |
|
26 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
27 |
import org.gvsig.fmap.dal.feature.Feature; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureIndexes; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
31 |
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException; |
|
32 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
33 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
34 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
|
35 |
import org.gvsig.sextante.app.algorithm.base.util.GeometryUtil; |
|
36 |
import org.gvsig.sextante.app.extension.core.gvVectorLayer; |
|
37 |
|
|
38 |
import com.vividsolutions.jts.geom.Geometry; |
|
39 |
|
|
40 |
import es.unex.sextante.core.Sextante; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
45 |
*/ |
|
46 |
public class SpatiallyIndexedSpatialJoinOperation extends GeometryOperation { |
|
47 |
/** |
|
48 |
* Geometry.distance() is a costly operation. Thats the reason for we are |
|
49 |
* only using a nearest neighbor. TODO SpatialIndex works with Rectangle2D, |
|
50 |
* and this may be a simplification that drives to errors. Make additional |
|
51 |
* probes to use a number of default neighbors |
|
52 |
*/ |
|
53 |
static final int DEFAULT_NUM_NEIGBOURS = 1; |
|
54 |
|
|
55 |
/** |
|
56 |
* Number of neighbors that nearestFinder must found. |
|
57 |
*/ |
|
58 |
int numOfNeighbours = DEFAULT_NUM_NEIGBOURS; |
|
59 |
|
|
60 |
/** |
|
61 |
* Specialized instance in nearest neighbor search. |
|
62 |
*/ |
|
63 |
private FeatureIndex index = null; |
|
64 |
|
|
65 |
public SpatiallyIndexedSpatialJoinOperation(gvVectorLayer targetLayer, String indexName) { |
|
66 |
FeatureIndexes indexes = targetLayer.getFeatureStore().getIndexes(); |
|
67 |
index = indexes.getFeatureIndex(indexName); |
|
68 |
} |
|
69 |
|
|
70 |
/* |
|
71 |
* (non-Javadoc) |
|
72 |
* @see org.gvsig.sextante.app.algorithm.base.core.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.dal.feature.Feature) |
|
73 |
*/ |
|
74 |
@SuppressWarnings("unchecked") |
|
75 |
public EditableFeature invoke(org.gvsig.fmap.geom.Geometry g, Feature featureInput) { |
|
76 |
if(g == null) |
|
77 |
return lastEditFeature; |
|
78 |
|
|
79 |
try { |
|
80 |
Geometry gJts = GeometryUtil.geomToJTS(g); |
|
81 |
Envelope rect = g.getEnvelope(); |
|
82 |
FeatureSet featSet = index.getNearestFeatureSet(numOfNeighbours, rect); |
|
83 |
double nearestDistance = Double.MAX_VALUE; |
|
84 |
|
|
85 |
DisposableIterator it = featSet.iterator(); |
|
86 |
while(it.hasNext()) { |
|
87 |
Feature feat = (Feature)it.next(); |
|
88 |
List geomList = feat.getGeometries(); |
|
89 |
|
|
90 |
if(geomList == null) { |
|
91 |
org.gvsig.fmap.geom.Geometry g2 = feat.getDefaultGeometry(); |
|
92 |
Geometry g2Jts = GeometryUtil.geomToJTS(g2); |
|
93 |
double dist = gJts.distance(g2Jts); |
|
94 |
if (dist <= nearestDistance) |
|
95 |
nearestDistance = dist; |
|
96 |
buildFeature(featureInput, feat, new Double(nearestDistance), g); |
|
97 |
continue; |
|
98 |
} |
|
99 |
|
|
100 |
Iterator<org.gvsig.fmap.geom.Geometry> itGeom = geomList.iterator(); |
|
101 |
while(itGeom.hasNext()) { |
|
102 |
org.gvsig.fmap.geom.Geometry g2 = itGeom.next(); |
|
103 |
Geometry g2Jts = GeometryUtil.geomToJTS(g2); |
|
104 |
double dist = gJts.distance(g2Jts); |
|
105 |
if (dist <= nearestDistance) |
|
106 |
nearestDistance = dist; |
|
107 |
buildFeature(featureInput, feat, new Double(nearestDistance), g); |
|
108 |
} |
|
109 |
} |
|
110 |
|
|
111 |
} catch(FeatureIndexException e) { |
|
112 |
Sextante.addErrorToLog(e); |
|
113 |
} catch (DataException e) { |
|
114 |
Sextante.addErrorToLog(e); |
|
115 |
} |
|
116 |
|
|
117 |
//IFeature joinedFeature = createFeature(g, sourceIndex, targetIndex,nearestDistance); |
|
118 |
|
|
119 |
return null; |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* Builds a feature and adds it to the output file |
|
124 |
* @param feat1 |
|
125 |
* @param feat2 |
|
126 |
* @param value |
|
127 |
* @param g |
|
128 |
* @throws DataException |
|
129 |
*/ |
|
130 |
private void buildFeature(Feature feat1, Feature feat2, Object value, org.gvsig.fmap.geom.Geometry g) throws DataException { |
|
131 |
EditableFeature outFeat = persister.getOutputFeatureStore().createNewFeature(); |
|
132 |
int sizeFeat1 = feat1.getType().size(); |
|
133 |
|
|
134 |
for (int i = 0; i < sizeFeat1; i++) |
|
135 |
outFeat.set(i, feat1.get(i)); |
|
136 |
|
|
137 |
for (int i = sizeFeat1; i < sizeFeat1 + feat2.getType().size(); i++) |
|
138 |
outFeat.set(i, feat2.get(i - sizeFeat1)); |
|
139 |
|
|
140 |
outFeat.set(outFeat.getType().size() - 1, value); |
|
141 |
try { |
|
142 |
persister.addFeature(outFeat, g); |
|
143 |
} catch (CreateGeometryException e) { |
|
144 |
Sextante.addErrorToLog(e); |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
/* |
|
149 |
* (non-Javadoc) |
|
150 |
* @see org.gvsig.sextante.app.algorithm.base.core.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.dal.feature.EditableFeature) |
|
151 |
*/ |
|
152 |
public void invoke(org.gvsig.fmap.geom.Geometry g, EditableFeature featureInput) { |
|
153 |
|
|
154 |
} |
|
155 |
|
|
156 |
} |
|
0 | 157 |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.spatialjoin/src/main/java/org/gvsig/sextante/app/algorithm/spatialjoin/SpatialJoinAlgorithm.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
import java.util.HashMap; |
22 | 22 |
|
23 |
import es.unex.sextante.core.GeoAlgorithm; |
|
23 |
import org.gvsig.fmap.dal.DALLocator; |
|
24 |
import org.gvsig.fmap.dal.DataManager; |
|
25 |
import org.gvsig.fmap.dal.exception.DataException; |
|
26 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
27 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
30 |
import org.gvsig.sextante.app.extension.core.gvGeoAlgorithm; |
|
31 |
import org.gvsig.sextante.app.extension.core.gvVectorLayer; |
|
32 |
|
|
24 | 33 |
import es.unex.sextante.core.Sextante; |
25 | 34 |
import es.unex.sextante.dataObjects.IVectorLayer; |
26 | 35 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
... | ... | |
31 | 40 |
* Spatial join algorithm |
32 | 41 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
33 | 42 |
*/ |
34 |
public class SpatialJoinAlgorithm extends GeoAlgorithm { |
|
43 |
public class SpatialJoinAlgorithm extends gvGeoAlgorithm {
|
|
35 | 44 |
public static final String RESULT = "RESULT"; |
36 | 45 |
public static final String LAYER1 = "LAYER1"; |
37 | 46 |
public static final String LAYER2 = "LAYER2"; |
... | ... | |
62 | 71 |
true); |
63 | 72 |
m_Parameters.addBoolean(SELECTED_GEOM, Sextante.getText("Selected_geometries"), false); |
64 | 73 |
m_Parameters.addBoolean(NEAREST, Sextante.getText("use_the_nearest"), false); |
74 |
m_Parameters.addString(FUNCTION_LIST, Sextante.getText("Function_list")); |
|
65 | 75 |
} catch (RepeatedParameterNameException e) { |
66 | 76 |
Sextante.addErrorToLog(e); |
67 | 77 |
} |
... | ... | |
81 | 91 |
boolean nearest = m_Parameters.getParameterValueAsBoolean(NEAREST); |
82 | 92 |
String functionList = m_Parameters.getParameterValueAsString(FUNCTION_LIST); |
83 | 93 |
loadSummary(functionList); |
84 |
|
|
94 |
|
|
95 |
gvVectorLayer lyr1 = null; |
|
96 |
gvVectorLayer lyr2 = null; |
|
97 |
if(layer2 instanceof gvVectorLayer && layer1 instanceof gvVectorLayer) { |
|
98 |
lyr2 = ((gvVectorLayer)layer2); |
|
99 |
lyr1 = ((gvVectorLayer)layer1); |
|
100 |
} else |
|
101 |
return false; |
|
102 |
|
|
103 |
DataManager dataManager = DALLocator.getDataManager(); |
|
104 |
|
|
105 |
//Builds a new JSIRTree index. To do that we have to replace the default index and |
|
106 |
//when the operation has finished then it restores the original default index |
|
107 |
String indexName = lyr2.getFieldName(0); |
|
108 |
try { |
|
109 |
FeatureAttributeDescriptor fat = lyr2.getFeatureStore().getDefaultFeatureType().getAttributeDescriptor(indexName); |
|
110 |
String defaultIndex = dataManager.getDefaultFeatureIndexProviderName(fat.getDataType()); |
|
111 |
dataManager.setDefaultFeatureIndexProviderName(fat.getDataType(), "JSIRTree"); |
|
112 |
lyr2.getFeatureStore().createIndex(lyr2.getFeatureStore().getDefaultFeatureType(), indexName, indexName + "_idx"); |
|
113 |
dataManager.setDefaultFeatureIndexProviderName(fat.getDataType(), defaultIndex); |
|
114 |
} catch (DataException e) { |
|
115 |
Sextante.addErrorToLog(e); |
|
116 |
} |
|
117 |
|
|
118 |
//Builds the output and computes the operation |
|
119 |
try { |
|
120 |
if(nearest) { |
|
121 |
FeatureSet features = null; |
|
122 |
features = lyr1.getFeatureStore().getFeatureSet(); |
|
123 |
FeatureType featureType1 = features.getDefaultFeatureType(); |
|
124 |
features = lyr2.getFeatureStore().getFeatureSet(); |
|
125 |
FeatureType featureType2 = features.getDefaultFeatureType(); |
|
126 |
|
|
127 |
FeatureStore outFeatStore = buildOutPutStoreFromUnion(featureType1, |
|
128 |
featureType2, |
|
129 |
lyr1.getShapeType(), |
|
130 |
Sextante.getText("SpatialJoin"), |
|
131 |
RESULT, |
|
132 |
"DIST", |
|
133 |
Double.class); |
|
134 |
|
|
135 |
SpatiallyIndexedSpatialJoinOperation operation = new SpatiallyIndexedSpatialJoinOperation(lyr2, indexName); |
|
136 |
operation.setProgressModel(this); |
|
137 |
operation.computesGeometryOperation(lyr1.getFeatureStore(), |
|
138 |
outFeatStore, |
|
139 |
Summary, |
|
140 |
selectedGeom, |
|
141 |
true); |
|
142 |
} |
|
143 |
} catch (DataException e) { |
|
144 |
Sextante.addErrorToLog(e); |
|
145 |
} |
|
146 |
|
|
85 | 147 |
return true; |
86 | 148 |
} |
87 |
|
|
149 |
|
|
88 | 150 |
/** |
89 | 151 |
* Checks if the parameter is in Summary list |
90 | 152 |
* @param it |
... | ... | |
116 | 178 |
} |
117 | 179 |
} |
118 | 180 |
|
119 |
/** |
|
120 |
* Builds the output FeatureStore |
|
121 |
* @param featureType |
|
122 |
* @return FeatureStore |
|
123 |
*/ |
|
124 |
//@SuppressWarnings("unchecked") |
|
125 |
/*protected FeatureStore buildNearestOutPutStore(FeatureType featureType1, |
|
126 |
FeatureType featureType2, |
|
127 |
int indexField, |
|
128 |
int shapeType, |
|
129 |
String sextanteLayerName, |
|
130 |
String sextanteLayerLabel) { |
|
131 |
ArrayList<Class> typesList = new ArrayList<Class>(); |
|
132 |
ArrayList<String> attr = new ArrayList<String>(); |
|
133 |
attr.add("FID"); |
|
134 |
typesList.add(Integer.class); |
|
135 |
FeatureAttributeDescriptor desc = featureType1.getAttributeDescriptor(indexField); |
|
136 |
attr.add(desc.getName()); |
|
137 |
typesList.add(desc.getObjectClass()); |
|
138 |
for (int i = 0; i < funcList.length; i++) |
|
139 |
if(funcList[i]) { |
|
140 |
String fieldName = funcMap.get(Summary[i]); |
|
141 |
if(fieldName.length() >= 6) |
|
142 |
fieldName = fieldName.substring(0, 7); |
|
143 |
attr.add(fieldName + "_" + Summary[i]); |
|
144 |
typesList.add(Double.class); |
|
145 |
} |
|
146 |
|
|
147 |
attrNames = new String[attr.size()]; |
|
148 |
attr.toArray(attrNames); |
|
149 |
Class[] types = new Class[typesList.size()]; |
|
150 |
typesList.toArray(types); |
|
151 |
|
|
152 |
try { |
|
153 |
IVectorLayer output = getNewVectorLayer(sextanteLayerLabel, |
|
154 |
sextanteLayerName, |
|
155 |
shapeType, types, attrNames); |
|
156 |
return ((gvVectorLayer)output).getFeatureStore(); |
|
157 |
} catch (UnsupportedOutputChannelException e) { |
|
158 |
Sextante.addErrorToLog(e); |
|
159 |
} |
|
160 |
return null; |
|
161 |
}*/ |
|
162 |
|
|
163 | 181 |
} |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.spatialjoin/src/main/java/org/gvsig/sextante/app/algorithm/spatialjoin/SpatialJoinParametersPanel.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
import org.gvsig.gui.beans.table.TableContainer; |
36 | 36 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
37 |
import org.gvsig.sextante.app.extension.core.CompositeSourceOutputChannel; |
|
37 | 38 |
import org.gvsig.sextante.app.extension.gui.AlgorithmOutputPanel; |
38 | 39 |
|
39 | 40 |
import es.unex.sextante.core.GeoAlgorithm; |
40 | 41 |
import es.unex.sextante.core.ObjectAndDescription; |
42 |
import es.unex.sextante.core.OutputObjectsSet; |
|
43 |
import es.unex.sextante.core.ParametersSet; |
|
41 | 44 |
import es.unex.sextante.core.Sextante; |
42 | 45 |
import es.unex.sextante.dataObjects.IVectorLayer; |
43 | 46 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
44 | 47 |
import es.unex.sextante.gui.core.SextanteGUI; |
48 |
import es.unex.sextante.outputs.Output; |
|
45 | 49 |
|
46 | 50 |
/** |
47 | 51 |
* Panel for dissolve algorithm |
... | ... | |
261 | 265 |
|
262 | 266 |
@Override |
263 | 267 |
public boolean assignParameters() { |
264 |
/*try {
|
|
268 |
try { |
|
265 | 269 |
ParametersSet params = m_Algorithm.getParameters(); |
266 |
params.getParameter(SpatialJoinAlgorithm.LAYER).setParameterValue(getSelectedVectorLayer()); |
|
267 |
params.getParameter(SpatialJoinAlgorithm.FIELD).setParameterValue(layersJoinCombo.getSelectedIndex());
|
|
270 |
params.getParameter(SpatialJoinAlgorithm.LAYER1).setParameterValue(getSelectedVectorLayer());
|
|
271 |
params.getParameter(SpatialJoinAlgorithm.LAYER2).setParameterValue(getSelectedVectorLayer2());
|
|
268 | 272 |
params.getParameter(SpatialJoinAlgorithm.SELECTED_GEOM).setParameterValue(getSelectionCheck().isSelected()); |
269 |
params.getParameter(SpatialJoinAlgorithm.DISSOLV_ADJ).setParameterValue(getAdjacentCheck().isSelected()); |
|
270 |
|
|
273 |
params.getParameter(SpatialJoinAlgorithm.NEAREST).setParameterValue(getNearestCheck().isSelected()); |
|
271 | 274 |
params.getParameter(SpatialJoinAlgorithm.FUNCTION_LIST).setParameterValue(getValues()); |
272 | 275 |
|
273 | 276 |
OutputObjectsSet ooSet = m_Algorithm.getOutputObjects(); |
274 |
Output out = ooSet.getOutput(DissolveAlgorithm.RESULT);
|
|
275 |
IOutputSelection fsp = getAlgorithmOutputPanel();
|
|
277 |
Output out = ooSet.getOutput(SpatialJoinAlgorithm.RESULT);
|
|
278 |
AlgorithmOutputPanel fsp = getAlgorithmOutputPanel();
|
|
276 | 279 |
out.setOutputChannel(new CompositeSourceOutputChannel(fsp.getOutputParameters())); |
280 |
|
|
277 | 281 |
return true; |
278 | 282 |
} catch (Exception e) { |
279 | 283 |
Sextante.addErrorToLog(e); |
280 | 284 |
return false; |
281 |
}*/ |
|
282 |
return true; |
|
285 |
} |
|
283 | 286 |
} |
284 |
|
|
285 |
/** |
|
286 |
* Formats the content of the table |
|
287 |
* @return |
|
288 |
*/ |
|
289 |
private String getValues() { |
|
290 |
String str = ""; |
|
291 |
try { |
|
292 |
for (int i = 0; i < getRadioButtonTable().getRowCount(); i++) { |
|
293 |
str = str + (String)getRadioButtonTable().getModel().getValueAt(i, 4) + ","; |
|
294 |
for (int j = 0; j < getRadioButtonTable().getModel().getColumnCount() - 1; j++) |
|
295 |
if(((Boolean)getRadioButtonTable().getModel().getValueAt(i, j)).booleanValue()) |
|
296 |
str = str + SpatialJoinAlgorithm.Summary[j] + ","; |
|
297 |
str = str.substring(0, str.length() - 1) + ";"; |
|
298 |
} |
|
299 |
} catch (NotInitializeException e) { |
|
300 |
Sextante.addErrorToLog(e); |
|
301 |
} |
|
302 |
return str.substring(0, str.length() - 1); |
|
303 |
} |
|
304 | 287 |
|
305 | 288 |
@Override |
306 | 289 |
public void setOutputValue(String arg0, String arg1) { |
... | ... | |
336 | 319 |
} |
337 | 320 |
|
338 | 321 |
/** |
322 |
* Gets the selected vector layer in the JComboBox |
|
323 |
* @return |
|
324 |
*/ |
|
325 |
private IVectorLayer getSelectedVectorLayer2() { |
|
326 |
if(layersJoinCombo.getSelectedItem() != null) |
|
327 |
return (IVectorLayer)((ObjectAndDescription)layersJoinCombo.getSelectedItem()).getObject(); |
|
328 |
return null; |
|
329 |
} |
|
330 |
|
|
331 |
/** |
|
339 | 332 |
* Gets the field list of the selected layer |
340 | 333 |
* @return |
341 | 334 |
*/ |
... | ... | |
346 | 339 |
data[i] = layer.getFieldName(i); |
347 | 340 |
return data; |
348 | 341 |
} |
342 |
|
|
343 |
/** |
|
344 |
* Formats the content of the table |
|
345 |
* @return |
|
346 |
*/ |
|
347 |
private String getValues() { |
|
348 |
String str = ""; |
|
349 |
try { |
|
350 |
for (int i = 0; i < getRadioButtonTable().getRowCount(); i++) { |
|
351 |
str = str + (String)getRadioButtonTable().getModel().getValueAt(i, 4) + ","; |
|
352 |
for (int j = 0; j < getRadioButtonTable().getModel().getColumnCount() - 1; j++) |
|
353 |
if(((Boolean)getRadioButtonTable().getModel().getValueAt(i, j)).booleanValue()) |
|
354 |
str = str + SpatialJoinAlgorithm.Summary[j] + ","; |
|
355 |
str = str.substring(0, str.length() - 1) + ";"; |
|
356 |
} |
|
357 |
} catch (NotInitializeException e) { |
|
358 |
Sextante.addErrorToLog(e); |
|
359 |
} |
|
360 |
return str.substring(0, str.length() - 1); |
|
361 |
} |
|
362 |
|
|
349 | 363 |
} |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.xyshift/src/main/java/org/gvsig/sextante/app/algorithm/xyshift/XYShiftOperation.java | ||
---|---|---|
27 | 27 |
import org.gvsig.fmap.dal.exception.DataException; |
28 | 28 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
29 | 29 |
import org.gvsig.fmap.dal.feature.Feature; |
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
31 | 30 |
import org.gvsig.fmap.geom.Geometry; |
32 | 31 |
import org.gvsig.fmap.geom.GeometryLocator; |
33 | 32 |
import org.gvsig.fmap.geom.GeometryManager; |
... | ... | |
36 | 35 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
37 | 36 |
import org.gvsig.fmap.geom.primitive.Point; |
38 | 37 |
import org.gvsig.fmap.geom.primitive.Surface; |
39 |
import org.gvsig.sextante.app.algorithm.base.core.DALFeaturePersister; |
|
40 | 38 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
41 | 39 |
|
42 | 40 |
import es.unex.sextante.core.Sextante; |
... | ... | |
54 | 52 |
this.y = y; |
55 | 53 |
this.geometryManager = GeometryLocator.getGeometryManager(); |
56 | 54 |
} |
57 |
|
|
58 |
/** |
|
59 |
* Sets the output FeatureType |
|
60 |
* @param out |
|
61 |
* @throws DataException |
|
62 |
*/ |
|
63 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
64 |
persister = new DALFeaturePersister(out, attrNames); |
|
65 |
} |
|
66 | 55 |
|
67 | 56 |
/* |
68 | 57 |
* (non-Javadoc) |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.merge/src/main/java/org/gvsig/sextante/app/algorithm/merge/MergeOperation.java | ||
---|---|---|
23 | 23 |
import org.gvsig.fmap.dal.exception.DataException; |
24 | 24 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
25 | 25 |
import org.gvsig.fmap.dal.feature.Feature; |
26 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
27 | 26 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
28 |
import org.gvsig.sextante.app.algorithm.base.core.DALFeaturePersister; |
|
29 | 27 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
30 | 28 |
import org.gvsig.sextante.app.extension.core.gvVectorLayer; |
31 | 29 |
|
... | ... | |
43 | 41 |
public MergeOperation(IVectorLayer layer) { |
44 | 42 |
this.layer = layer; |
45 | 43 |
} |
46 |
|
|
47 |
/** |
|
48 |
* Sets the output FeatureType |
|
49 |
* @param out |
|
50 |
* @throws DataException |
|
51 |
*/ |
|
52 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
53 |
persister = new DALFeaturePersister(out, attrNames); |
|
54 |
} |
|
55 | 44 |
|
56 | 45 |
/** |
57 | 46 |
* Computes intersection between the geometry and the overlay layer. The fields of the |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.intersection/src/main/java/org/gvsig/sextante/app/algorithm/intersection/IntersectionOperation.java | ||
---|---|---|
30 | 30 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
31 | 31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
32 | 32 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
33 |
import org.gvsig.sextante.app.algorithm.base.core.DALFeaturePersister; |
|
34 | 33 |
import org.gvsig.sextante.app.algorithm.base.core.GeometryOperation; |
35 | 34 |
import org.gvsig.sextante.app.algorithm.base.util.GeometryUtil; |
36 | 35 |
|
... | ... | |
50 | 49 |
public IntersectionOperation(FeatureStore overlayLayer) { |
51 | 50 |
this.storeOverlay = overlayLayer; |
52 | 51 |
} |
53 |
|
|
54 |
/** |
|
55 |
* Sets the output FeatureType |
|
56 |
* @param out |
|
57 |
* @throws DataException |
|
58 |
*/ |
|
59 |
public void setFeatureStore(FeatureStore out, String[] attrNames) throws DataException { |
|
60 |
persister = new DALFeaturePersister(out, attrNames); |
|
61 |
} |
|
62 | 52 |
|
63 | 53 |
/** |
64 | 54 |
* Computes intersection between the geometry and the overlay layer. The fields of the |
org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.extension/src/main/java/org/gvsig/sextante/app/extension/core/gvGeoAlgorithm.java | ||
---|---|---|
70 | 70 |
* @param featureType |
71 | 71 |
* @return FeatureStore |
72 | 72 |
*/ |
73 |
@SuppressWarnings("unchecked") |
|
74 | 73 |
protected FeatureStore buildOutPutStoreFromUnion(FeatureType featureType1, |
75 | 74 |
FeatureType featureType2, |
76 | 75 |
int shapeType, |
77 | 76 |
String sextanteLayerName, |
78 | 77 |
String sextanteLayerLabel) { |
78 |
return buildOutPutStoreFromUnion(featureType1, featureType2, shapeType, sextanteLayerName, sextanteLayerLabel, null, null); |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* Builds the output FeatureStore |
|
83 |
* @param featureType |
|
84 |
* @return FeatureStore |
|
85 |
*/ |
|
86 |
@SuppressWarnings("unchecked") |
|
87 |
protected FeatureStore buildOutPutStoreFromUnion(FeatureType featureType1, |
|
88 |
FeatureType featureType2, |
|
89 |
int shapeType, |
|
90 |
String sextanteLayerName, |
|
91 |
String sextanteLayerLabel, |
|
92 |
String newField, |
|
93 |
Class newFieldType) { |
|
94 |
int sizeAux = 0; |
|
95 |
if(newField != null && newFieldType != null) |
|
96 |
sizeAux = 1; |
|
97 |
|
|
79 | 98 |
Class [] types = null; |
80 | 99 |
if(featureType1.getDefaultGeometryAttribute() != null) { //Tiene campo GEOMETRY. Hay que quitarlo |
81 |
attrNames = new String[featureType1.size() + featureType2.size() - 2]; |
|
82 |
types = new Class[featureType1.size() + featureType2.size() - 2]; |
|
100 |
attrNames = new String[featureType1.size() + featureType2.size() - 2 + sizeAux];
|
|
101 |
types = new Class[featureType1.size() + featureType2.size() - 2 + sizeAux];
|
|
83 | 102 |
} else { |
84 |
attrNames = new String[featureType1.size() + featureType2.size()]; |
|
85 |
types = new Class[featureType1.size() + featureType2.size()]; |
|
103 |
attrNames = new String[featureType1.size() + featureType2.size() + sizeAux];
|
|
104 |
types = new Class[featureType1.size() + featureType2.size() + sizeAux];
|
|
86 | 105 |
} |
87 | 106 |
|
88 | 107 |
int i = 0; |
... | ... | |
107 | 126 |
} |
108 | 127 |
} |
109 | 128 |
|
129 |
if(newField != null && newFieldType != null) { |
|
130 |
attrNames[attrNames.length - 1] = newField; |
|
131 |
types[types.length - 1] = newFieldType; |
|
132 |
} |
|
133 |
|
|
110 | 134 |
try { |
111 | 135 |
IVectorLayer output = getNewVectorLayer(sextanteLayerLabel, |
112 | 136 |
sextanteLayerName, |
... | ... | |
123 | 147 |
* @param name |
124 | 148 |
* @return |
125 | 149 |
*/ |
126 |
private String checkAttrName(String name, int size) {
|
|
150 |
protected String checkAttrName(String name, int size) {
|
|
127 | 151 |
String newName = name; |
128 | 152 |
for (int i = 0; i < size; i++) |
129 | 153 |
if(attrNames[i].compareTo(newName) == 0) |
... | ... | |
131 | 155 |
return newName; |
132 | 156 |
} |
133 | 157 |
|
134 |
/* |
|
135 |
* (non-Javadoc) |
|
136 |
* @see es.unex.sextante.core.GeoAlgorithm#getOutputFilename(es.unex.sextante.outputs.Output) |
|
137 |
*/ |
|
138 |
/*protected String getOutputFilename(Output out) { |
|
139 |
|
|
140 |
IOutputChannel channel = out.getOutputChannel(); |
|
141 |
|
|
142 |
String sFilename = null; |
|
143 |
if(channel.getParameters() instanceof String) |
|
144 |
sFilename = (String)((IOutputChannel)channel).getParameters(); |
|
145 |
else |
|
146 |
if(channel.getParameters() instanceof FilesystemStoreParameters) |
|
147 |
sFilename = ((FilesystemStoreParameters)channel.getParameters()).getFile().getAbsolutePath(); |
|
148 |
if (sFilename == null){ |
|
149 |
return null; |
|
150 |
} |
|
151 |
String[] exts = null; |
|
152 |
if (out instanceof OutputRasterLayer){ |
|
153 |
exts = m_OutputFactory.getRasterLayerOutputExtensions(); |
|
154 |
} |
|
155 |
else if (out instanceof OutputVectorLayer){ |
|
156 |
exts = m_OutputFactory.getVectorLayerOutputExtensions(); |
|
157 |
} |
|
158 |
else if (out instanceof OutputTable){ |
|
159 |
exts = m_OutputFactory.getTableOutputExtensions(); |
|
160 |
} |
|
161 |
else{ |
|
162 |
return null; |
|
163 |
} |
|
164 |
|
|
165 |
for (int i = 0; i < exts.length; i++) { |
|
166 |
if (sFilename.endsWith(exts[i])){ |
|
167 |
return sFilename; |
|
168 |
} |
|
169 |
} |
|
170 |
return sFilename + "." + exts[0]; |
|
171 |
}*/ |
|
172 |
|
|
173 |
/* |
|
174 |
* (non-Javadoc) |
|
175 |
* @see es.unex.sextante.core.GeoAlgorithm#getOutputChannel(java.lang.String) |
|
176 |
*/ |
|
177 |
/*protected IOutputChannel getOutputChannel(String sName) { |
|
178 |
Output out = null; |
|
179 |
IOutputChannel channel = null; |
|
180 |
try { |
|
181 |
out = m_OutputObjects.getOutput(sName); |
|
182 |
channel = out.getOutputChannel(); |
|
183 |
if (channel == null) |
|
184 |
return new FileOutputChannel(m_OutputFactory.getTempFilename(out)); |
|
185 |
else { |
|
186 |
String sFilename = getOutputFilename(out); |
|
187 |
if (sFilename == null) { |
|
188 |
if(channel instanceof CompositeSourceOutputChannel) |
|
189 |
return channel; |
|
190 |
return new FileOutputChannel(m_OutputFactory.getTempFilename(out)); |
|
191 |
} else { |
|
192 |
if(channel instanceof FileOutputChannel) |
|
193 |
((FileOutputChannel) channel).setFilename(sFilename); |
|
194 |
return channel; |
|
195 |
} |
|
196 |
} |
|
197 |
} catch (WrongOutputIDException e) { |
|
198 |
return null; |
|
199 |
} |
|
200 |
}*/ |
|
201 |
|
|
202 | 158 |
/** |
203 | 159 |
* Gets the shape type of the selected feature store |
204 | 160 |
* @param FeatureStore source |
Also available in: Unified diff