Revision 187
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/iterative/SingleFeatureVectorLayer.java | ||
---|---|---|
5 | 5 |
import com.vividsolutions.jts.geom.Envelope; |
6 | 6 |
import com.vividsolutions.jts.geom.Geometry; |
7 | 7 |
|
8 |
import org.gvsig.tools.exception.BaseException; |
|
9 |
|
|
8 | 10 |
import es.unex.sextante.dataObjects.AbstractVectorLayer; |
9 | 11 |
import es.unex.sextante.dataObjects.IFeatureIterator; |
10 | 12 |
import es.unex.sextante.dataObjects.IVectorLayer; |
... | ... | |
129 | 131 |
|
130 | 132 |
} |
131 | 133 |
|
132 |
|
|
134 |
|
|
133 | 135 |
/* |
134 | 136 |
* Sets an internal ID. Useful for keeping external algorithm |
135 | 137 |
* providers such as GRASS informed which feature is being |
... | ... | |
141 | 143 |
m_ID = ID; |
142 | 144 |
|
143 | 145 |
} |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
146 | 148 |
public int getID () { |
147 | 149 |
|
148 | 150 |
return ( m_ID ); |
149 | 151 |
|
150 | 152 |
} |
151 |
|
|
152 | 153 |
|
154 |
|
|
153 | 155 |
public IVectorLayer getOriginalLayer() { |
154 | 156 |
|
155 | 157 |
return m_OriginalLayer; |
... | ... | |
187 | 189 |
} |
188 | 190 |
|
189 | 191 |
|
192 |
/* (non-Javadoc) |
|
193 |
* @see es.unex.sextante.dataObjects.IVectorLayer#getSubType() |
|
194 |
*/ |
|
195 |
@Override |
|
196 |
public int getSubType() throws BaseException { |
|
197 |
return m_OriginalLayer.getSubType(); |
|
198 |
} |
|
199 |
|
|
200 |
|
|
190 | 201 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.algorithm/src/main/java/es/unex/sextante/vectorTools/geometriesToPoints/GeometriesToPointsAlgorithm.java | ||
---|---|---|
6 | 6 |
import com.vividsolutions.jts.geom.Geometry; |
7 | 7 |
import com.vividsolutions.jts.geom.GeometryFactory; |
8 | 8 |
|
9 |
import org.gvsig.tools.exception.BaseException; |
|
10 |
|
|
9 | 11 |
import es.unex.sextante.additionalInfo.AdditionalInfoVectorLayer; |
10 | 12 |
import es.unex.sextante.core.GeoAlgorithm; |
11 | 13 |
import es.unex.sextante.core.Sextante; |
... | ... | |
54 | 56 |
input.addFilter(new BoundingBoxFilter(m_AnalysisExtent)); |
55 | 57 |
} |
56 | 58 |
|
59 |
int subtype; |
|
60 |
try { |
|
61 |
subtype = input.getSubType(); |
|
62 |
} catch (BaseException e) { |
|
63 |
subtype = org.gvsig.fmap.geom.Geometry.SUBTYPES.UNKNOWN; |
|
64 |
} |
|
65 |
|
|
57 | 66 |
m_Output = getNewVectorLayer(POINTS, input.getName() + "[" + Sextante.getText("Points") + "]", |
58 |
IVectorLayer.SHAPE_TYPE_POINT, input.getFieldTypes(), input.getFieldNames());
|
|
67 |
IVectorLayer.SHAPE_TYPE_POINT, input.getFieldTypes(), input.getFieldNames(), subtype);
|
|
59 | 68 |
|
69 |
|
|
60 | 70 |
int i = 0; |
61 | 71 |
final int iShapeCount = input.getShapesCount(); |
62 | 72 |
final IFeatureIterator iter = input.iterator(); |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.algorithm/src/main/java/es/unex/sextante/vectorTools/groupNearFeatures/GroupNearFeaturesAlgorithm.java | ||
---|---|---|
7 | 7 |
|
8 | 8 |
import com.vividsolutions.jts.geom.Geometry; |
9 | 9 |
|
10 |
import org.gvsig.tools.exception.BaseException; |
|
11 |
|
|
10 | 12 |
import es.unex.sextante.additionalInfo.AdditionalInfoNumericalValue; |
11 | 13 |
import es.unex.sextante.additionalInfo.AdditionalInfoVectorLayer; |
12 | 14 |
import es.unex.sextante.core.GeoAlgorithm; |
... | ... | |
73 | 75 |
System.arraycopy(in_fnames, 0, out_fnames, 0, in_fnames.length); |
74 | 76 |
out_fnames[out_fnames.length - 1] = "GROUP_ID"; |
75 | 77 |
|
78 |
int subtype; |
|
79 |
try { |
|
80 |
subtype = layerIn.getSubType(); |
|
81 |
} catch (BaseException e) { |
|
82 |
subtype = org.gvsig.fmap.geom.Geometry.SUBTYPES.UNKNOWN; |
|
83 |
} |
|
84 |
|
|
76 | 85 |
final IVectorLayer driver = getNewVectorLayer(GroupNearFeaturesAlgorithm.RESULT, Sextante.getText("Grouped_Layer"), |
77 |
layerIn.getShapeType(), out_ftypes, out_fnames); |
|
86 |
layerIn.getShapeType(), out_ftypes, out_fnames, subtype);
|
|
78 | 87 |
|
79 | 88 |
final int iTotal = layerIn.getShapesCount(); |
80 | 89 |
int groupID = 0; |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.algorithm/src/main/java/es/unex/sextante/vectorTools/transform/TransformAlgorithm.java | ||
---|---|---|
5 | 5 |
import com.vividsolutions.jts.geom.Geometry; |
6 | 6 |
import com.vividsolutions.jts.geom.util.AffineTransformation; |
7 | 7 |
|
8 |
import org.gvsig.tools.exception.BaseException; |
|
9 |
|
|
8 | 10 |
import es.unex.sextante.additionalInfo.AdditionalInfoNumericalValue; |
9 | 11 |
import es.unex.sextante.additionalInfo.AdditionalInfoVectorLayer; |
10 | 12 |
import es.unex.sextante.core.GeoAlgorithm; |
... | ... | |
61 | 63 |
layerIn.addFilter(new BoundingBoxFilter(m_AnalysisExtent)); |
62 | 64 |
} |
63 | 65 |
|
66 |
int subtype; |
|
67 |
try { |
|
68 |
subtype = layerIn.getSubType(); |
|
69 |
} catch (BaseException e) { |
|
70 |
subtype = org.gvsig.fmap.geom.Geometry.SUBTYPES.UNKNOWN; |
|
71 |
} |
|
64 | 72 |
m_Output = getNewVectorLayer(RESULT, Sextante.getText("Capa_transformada"), layerIn.getShapeType(), |
65 |
layerIn.getFieldTypes(), layerIn.getFieldNames()); |
|
73 |
layerIn.getFieldTypes(), layerIn.getFieldNames(), subtype);
|
|
66 | 74 |
|
67 | 75 |
final AffineTransformation at = new AffineTransformation(); |
68 | 76 |
at.compose(AffineTransformation.translationInstance(-dAnchorX, -dAnchorY)); |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/dataObjects/IVectorLayer.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import com.vividsolutions.jts.geom.Geometry; |
6 | 6 |
|
7 |
import org.gvsig.tools.exception.BaseException; |
|
8 |
|
|
7 | 9 |
import es.unex.sextante.dataObjects.vectorFilters.IVectorLayerFilter; |
8 | 10 |
|
9 | 11 |
/** |
10 | 12 |
* This is the base interface that all vector layers have to implement to be able to be used by SEXTANTE algorithms. |
11 |
*
|
|
13 |
* |
|
12 | 14 |
* Instead of implementing this class directly, it is recommended to extend {@link AbstractVectorLayer}. |
13 |
*
|
|
15 |
* |
|
14 | 16 |
* @author Victor Olaya. volaya@unex.es |
15 |
*
|
|
17 |
* |
|
16 | 18 |
*/ |
17 | 19 |
public interface IVectorLayer |
18 | 20 |
extends |
... | ... | |
22 | 24 |
public static final int SHAPE_TYPE_LINE = 1; |
23 | 25 |
public static final int SHAPE_TYPE_POLYGON = 2; |
24 | 26 |
public static final int SHAPE_TYPE_MIXED = 3; |
25 |
|
|
27 |
|
|
26 | 28 |
//Types to create a multilayer in gvSIG. Don't use for anything more |
27 | 29 |
public static final int SHAPE_TYPE_MULTIPOINT = 4; |
28 | 30 |
public static final int SHAPE_TYPE_MULTILINE = 5; |
... | ... | |
37 | 39 |
|
38 | 40 |
/** |
39 | 41 |
* Adds a new feature to the layer |
40 |
*
|
|
42 |
* |
|
41 | 43 |
* @param geometry |
42 | 44 |
* the geometry |
43 | 45 |
* @param attributes |
... | ... | |
49 | 51 |
|
50 | 52 |
/** |
51 | 53 |
* Adds a new feature to the layer |
52 |
*
|
|
54 |
* |
|
53 | 55 |
* @param feature |
54 | 56 |
* the feature to add |
55 | 57 |
*/ |
... | ... | |
58 | 60 |
|
59 | 61 |
/** |
60 | 62 |
* Returns an iterator to iterate through the entities of this layer |
61 |
*
|
|
63 |
* |
|
62 | 64 |
* @return an iterator to iterate the layer |
63 | 65 |
*/ |
64 | 66 |
public IFeatureIterator iterator(); |
... | ... | |
66 | 68 |
|
67 | 69 |
/** |
68 | 70 |
* Returns the name of a given field in the attributes table |
69 |
*
|
|
71 |
* |
|
70 | 72 |
* @param index |
71 | 73 |
* the zero-based field index |
72 | 74 |
* @return the name of the selected attribute field |
... | ... | |
76 | 78 |
|
77 | 79 |
/** |
78 | 80 |
* Return a class representing the data type of a given field |
79 |
*
|
|
81 |
* |
|
80 | 82 |
* @param index |
81 | 83 |
* the zero-based field index |
82 | 84 |
* @return the data type of the selected attribute field |
... | ... | |
85 | 87 |
|
86 | 88 |
|
87 | 89 |
/** |
88 |
*
|
|
90 |
* |
|
89 | 91 |
* @return the number of attributes associates to each geometry |
90 | 92 |
*/ |
91 | 93 |
public int getFieldCount(); |
... | ... | |
93 | 95 |
|
94 | 96 |
/** |
95 | 97 |
* Returns an array of classes representing the data types of the fields in the attributes table |
96 |
*
|
|
98 |
* |
|
97 | 99 |
* @return the data types of attribute fields |
98 | 100 |
*/ |
99 | 101 |
public Class[] getFieldTypes(); |
... | ... | |
101 | 103 |
|
102 | 104 |
/** |
103 | 105 |
* Returns the names of the fields in the attributes table |
104 |
*
|
|
106 |
* |
|
105 | 107 |
* @return the names of the attribute fields |
106 | 108 |
*/ |
107 | 109 |
public String[] getFieldNames(); |
... | ... | |
109 | 111 |
|
110 | 112 |
/** |
111 | 113 |
* Returns the number of features in this layer |
112 |
*
|
|
114 |
* |
|
113 | 115 |
* @return the number of features in this layer |
114 | 116 |
*/ |
115 | 117 |
public int getShapesCount(); |
... | ... | |
117 | 119 |
|
118 | 120 |
/** |
119 | 121 |
* Returns the type of geometries in this layer |
120 |
*
|
|
122 |
* |
|
121 | 123 |
* @return the type of geometries in this layer |
122 | 124 |
*/ |
123 | 125 |
public int getShapeType(); |
124 | 126 |
|
127 |
/** |
|
128 |
* Returns the subtype of geometries in this layer |
|
129 |
* |
|
130 |
* @return the subtype of geometries in this layer |
|
131 |
* @throws ReadException |
|
132 |
*/ |
|
133 |
public int getSubType() throws BaseException; |
|
125 | 134 |
|
135 |
|
|
126 | 136 |
/** |
127 | 137 |
* Returns the index of a field from its name. Returns -1 if there is not a field with that name. |
128 |
*
|
|
138 |
* |
|
129 | 139 |
* @param fieldName |
130 | 140 |
* the name of the field |
131 | 141 |
* @return the index of the given field |
... | ... | |
136 | 146 |
/** |
137 | 147 |
* Adds a new filter to this layer. When iterating the features in this layer, only those that pass the filter will be |
138 | 148 |
* returned. |
139 |
*
|
|
149 |
* |
|
140 | 150 |
* @param filter |
141 | 151 |
* the filter to add |
142 | 152 |
*/ |
... | ... | |
151 | 161 |
|
152 | 162 |
/** |
153 | 163 |
* Returns a list of all the filters currently added to this layer |
154 |
*
|
|
164 |
* |
|
155 | 165 |
* @return a list of all the filters currently added to this layer |
156 | 166 |
*/ |
157 | 167 |
public List<IVectorLayerFilter> getFilters(); |
... | ... | |
160 | 170 |
/** |
161 | 171 |
* Returns true if the layer can be edited. This includes editing while the layer is being read, so it can be overwritten by |
162 | 172 |
* algorithms that allow overwriting of input layers |
163 |
*
|
|
173 |
* |
|
164 | 174 |
* @return true if the layer can be edited |
165 | 175 |
*/ |
166 | 176 |
public boolean canBeEdited(); |
167 | 177 |
|
168 |
|
|
169 | 178 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/outputs/OutputVectorLayer.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
/** |
7 | 7 |
* An output representing a vector layer |
8 |
*
|
|
8 |
* |
|
9 | 9 |
* @author volaya |
10 |
*
|
|
10 |
* |
|
11 | 11 |
*/ |
12 | 12 |
public class OutputVectorLayer |
13 | 13 |
extends |
... | ... | |
19 | 19 |
public static final int SHAPE_TYPE_UNDEFINED = -1; |
20 | 20 |
|
21 | 21 |
private int m_iShapeType; |
22 |
private int m_subType; |
|
22 | 23 |
private String m_sInputLayerToOverwrite; |
23 | 24 |
|
24 | 25 |
|
... | ... | |
47 | 48 |
|
48 | 49 |
/** |
49 | 50 |
* Returns the shape type of this output vector layer |
50 |
*
|
|
51 |
* |
|
51 | 52 |
* @return the shape type of this output vector layer |
52 | 53 |
*/ |
53 | 54 |
public int getShapeType() { |
... | ... | |
59 | 60 |
|
60 | 61 |
/** |
61 | 62 |
* Sets the shape type of this output vector layer |
62 |
*
|
|
63 |
* |
|
63 | 64 |
* @param shapeType |
64 | 65 |
* The shape type of this output |
65 | 66 |
*/ |
... | ... | |
76 | 77 |
final Output out = super.getNewInstance(); |
77 | 78 |
((OutputVectorLayer) out).setShapeType(m_iShapeType); |
78 | 79 |
((OutputVectorLayer) out).setInputLayerToOverwrite(m_sInputLayerToOverwrite); |
80 |
((OutputVectorLayer) out).setSubType(m_subType); |
|
79 | 81 |
|
80 | 82 |
return out; |
81 | 83 |
|
... | ... | |
88 | 90 |
super.setObjectData(output); |
89 | 91 |
if (output instanceof OutputVectorLayer) { |
90 | 92 |
this.setShapeType(((OutputVectorLayer) output).getShapeType()); |
93 |
this.setSubType(((OutputVectorLayer) output).getSubType()); |
|
91 | 94 |
} |
92 | 95 |
|
93 | 96 |
} |
... | ... | |
103 | 106 |
|
104 | 107 |
/** |
105 | 108 |
* Returns the name of the input parameter that this output can overwrite |
106 |
*
|
|
109 |
* |
|
107 | 110 |
* @return the name of the input parameter that this output can overwrite |
108 | 111 |
*/ |
109 | 112 |
public String getInputLayerToOverwrite() { |
... | ... | |
115 | 118 |
|
116 | 119 |
/** |
117 | 120 |
* Sets the name of the input parameter that this output can overwrite. Returns null if it cannot overwrite. |
118 |
*
|
|
121 |
* |
|
119 | 122 |
* @param inputLayerToOverwrite |
120 | 123 |
* the name of the input parameter that this output can overwrite |
121 | 124 |
*/ |
... | ... | |
133 | 136 |
} |
134 | 137 |
|
135 | 138 |
|
139 |
/** |
|
140 |
* @return the m_subType |
|
141 |
*/ |
|
142 |
public int getSubType() { |
|
143 |
return m_subType; |
|
136 | 144 |
} |
145 |
|
|
146 |
|
|
147 |
/** |
|
148 |
* @param m_subType the m_subType to set |
|
149 |
*/ |
|
150 |
public void setSubType(int m_subType) { |
|
151 |
this.m_subType = m_subType; |
|
152 |
} |
|
153 |
|
|
154 |
|
|
155 |
} |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/core/OutputFactory.java | ||
---|---|---|
24 | 24 |
/** |
25 | 25 |
* An OutputFactory defines how new data objects (layers and tables) are created. Method in this class are called from |
26 | 26 |
* geoalgorithms to create output objects |
27 |
*
|
|
27 |
* |
|
28 | 28 |
* @author Victor Olaya volaya@unex.es |
29 |
*
|
|
29 |
* |
|
30 | 30 |
*/ |
31 | 31 |
public abstract class OutputFactory { |
32 | 32 |
|
... | ... | |
36 | 36 |
|
37 | 37 |
/** |
38 | 38 |
* Use this method to create a new IVectorLayer that can be used to generate new vector layers as output from the geo-algorithm |
39 |
*
|
|
39 |
* |
|
40 | 40 |
* @param sName |
41 | 41 |
* the name of the layer |
42 | 42 |
* @param iShapeType |
... | ... | |
58 | 58 |
IOutputChannel channel, |
59 | 59 |
Object crs) throws UnsupportedOutputChannelException; |
60 | 60 |
|
61 |
/** |
|
62 |
* Use this method to create a new IVectorLayer that can be used to generate new vector layers as output from the geo-algorithm |
|
63 |
* |
|
64 |
* @param sName |
|
65 |
* the name of the layer |
|
66 |
* @param iShapeType |
|
67 |
* the type of shapes in the layer |
|
68 |
* @param types |
|
69 |
* the data type of the fields |
|
70 |
* @param sFields |
|
71 |
* the name of the fields in the attributes table |
|
72 |
* @param channel |
|
73 |
* the output channel associated to the output layer |
|
74 |
* @param crs |
|
75 |
* An object with information to set the CRS of this layer (i.e. a string with a EPSG code) |
|
76 |
* @param subtype |
|
77 |
* the subtype of the geometries in the layer |
|
78 |
* @return an empty vector layer |
|
79 |
* @throws UnsupportedOutputChannelException |
|
80 |
*/ |
|
81 |
public abstract IVectorLayer getNewVectorLayer(String sName, |
|
82 |
int iShapeType, |
|
83 |
Class[] types, |
|
84 |
String[] sFields, |
|
85 |
IOutputChannel channel, |
|
86 |
Object crs, int subtype) throws UnsupportedOutputChannelException; |
|
61 | 87 |
|
88 |
|
|
62 | 89 |
/** |
63 | 90 |
* Use this method to create a new IVectorLayer that can be used to generate new vector layers as output from the geo-algorithm |
64 |
*
|
|
91 |
* |
|
65 | 92 |
* @param sName |
66 | 93 |
* the name of the layer |
67 | 94 |
* @param iShapeType |
... | ... | |
86 | 113 |
Object crs, |
87 | 114 |
int[] fieldSize) throws UnsupportedOutputChannelException; |
88 | 115 |
|
116 |
/** |
|
117 |
* Use this method to create a new IVectorLayer that can be used to generate new vector layers as output from the geo-algorithm |
|
118 |
* |
|
119 |
* @param sName |
|
120 |
* the name of the layer |
|
121 |
* @param iShapeType |
|
122 |
* the type of shapes in the layer |
|
123 |
* @param types |
|
124 |
* the data type of the fields |
|
125 |
* @param sFields |
|
126 |
* the name of the fields in the attributes table |
|
127 |
* @param channel |
|
128 |
* the output channel associated to the output layer |
|
129 |
* @param crs |
|
130 |
* An object with information to set the CRS of this layer (i.e. a string with a EPSG code) |
|
131 |
* @param fieldSize |
|
132 |
* A list of integers. Each value represents the size of a table field. |
|
133 |
* @param subtype |
|
134 |
* the subtype of the geometries in the layer |
|
135 |
* @return an empty vector layer |
|
136 |
* @throws UnsupportedOutputChannelException |
|
137 |
*/ |
|
138 |
public abstract IVectorLayer getNewVectorLayer(String sName, |
|
139 |
int iShapeType, |
|
140 |
Class[] types, |
|
141 |
String[] sFields, |
|
142 |
IOutputChannel channel, |
|
143 |
Object crs, |
|
144 |
int[] fieldSize, int subtype) throws UnsupportedOutputChannelException; |
|
89 | 145 |
|
90 | 146 |
/** |
91 | 147 |
* Use this method to create a new raster layer as output from the geo-algorithm. The characteristics of the raster layer |
92 | 148 |
* (extent and cellsize) are taken from the extent parameter. |
93 |
*
|
|
149 |
* |
|
94 | 150 |
* @param sName |
95 | 151 |
* the name of the layer |
96 | 152 |
* @param iDataType |
... | ... | |
104 | 160 |
* @param crs |
105 | 161 |
* An object with information to set the CRS of this layer (i.e. a string with a EPSG code) |
106 | 162 |
* @return a raster layer |
163 |
* @throws UnsupportedOutputChannelException |
|
107 | 164 |
*/ |
108 | 165 |
public abstract IRasterLayer getNewRasterLayer(String sName, |
109 | 166 |
int iDataType, |
... | ... | |
116 | 173 |
/** |
117 | 174 |
* Use this method to create a new 3D raster layer as output from the geo-algorithm. The characteristics of the raster layer |
118 | 175 |
* (extent and cellsizes) are taken from the extent parameter. |
119 |
*
|
|
176 |
* |
|
120 | 177 |
* A default implementation is given, which uses the Default3dRasterLayer class. This way, 3D algorithms can be executed within |
121 | 178 |
* the context of a GIS that does not support 3D layer, and there is no need to overwrite this method in the corresponding |
122 | 179 |
* binding |
123 |
*
|
|
180 |
* |
|
124 | 181 |
* @param sName |
125 | 182 |
* the name of the layer |
126 | 183 |
* @param iDataType |
... | ... | |
155 | 212 |
|
156 | 213 |
/** |
157 | 214 |
* Use this method to create a new table. |
158 |
*
|
|
215 |
* |
|
159 | 216 |
* @param sName |
160 | 217 |
* the name of the table |
161 | 218 |
* @param types |
... | ... | |
173 | 230 |
|
174 | 231 |
|
175 | 232 |
/** |
176 |
*
|
|
233 |
* |
|
177 | 234 |
* @return A temporary filename with the default file extension for vector layers |
178 | 235 |
*/ |
179 | 236 |
public String getTempVectorLayerFilename() { |
... | ... | |
184 | 241 |
|
185 | 242 |
|
186 | 243 |
/** |
187 |
*
|
|
244 |
* |
|
188 | 245 |
* @return A temporary filename with the default file extension for raster layers |
189 | 246 |
*/ |
190 | 247 |
public String getTempRasterLayerFilename() { |
... | ... | |
195 | 252 |
|
196 | 253 |
|
197 | 254 |
/** |
198 |
*
|
|
255 |
* |
|
199 | 256 |
* @return A temporary filename with the default file extension for 3D raster layers |
200 | 257 |
*/ |
201 | 258 |
public String getTemp3DRasterLayerFilename() { |
... | ... | |
206 | 263 |
|
207 | 264 |
|
208 | 265 |
/** |
209 |
*
|
|
266 |
* |
|
210 | 267 |
* @return A temporary filename with the default file extension for tables |
211 | 268 |
*/ |
212 | 269 |
public String getTempTableFilename() { |
... | ... | |
216 | 273 |
|
217 | 274 |
|
218 | 275 |
/** |
219 |
*
|
|
276 |
* |
|
220 | 277 |
* @return A temporary folder name |
221 | 278 |
*/ |
222 | 279 |
public String getTempFoldername() { |
... | ... | |
226 | 283 |
|
227 | 284 |
|
228 | 285 |
/** |
229 |
*
|
|
286 |
* |
|
230 | 287 |
* @param out |
231 | 288 |
* an Output object |
232 | 289 |
* @return A temporary filename with the default file extension for the specified type of output |
... | ... | |
255 | 312 |
|
256 | 313 |
/** |
257 | 314 |
* Returns a temporary filename with no extension |
258 |
*
|
|
315 |
* |
|
259 | 316 |
* @returns a temporary filename with no extension. |
260 | 317 |
*/ |
261 | 318 |
public String getTempFilenameWithoutExtension() { |
... | ... | |
268 | 325 |
/** |
269 | 326 |
* Returns the temporary folder. This will be used to store outputs when they do not have an associated filename an it is |
270 | 327 |
* needed |
271 |
*
|
|
328 |
* |
|
272 | 329 |
* @return a temporary folder |
273 | 330 |
*/ |
274 | 331 |
public abstract String getTempFolder(); |
... | ... | |
278 | 335 |
* Returns the extensions supported by this factory for creating raster layers. If a filename with an extension not found in |
279 | 336 |
* this list of extensions is used to create a raster layer, the default extension (the first one of the list) will be added to |
280 | 337 |
* the filename when creating that layer. |
281 |
*
|
|
338 |
* |
|
282 | 339 |
* @return the list of supported extensions for raster layers |
283 | 340 |
*/ |
284 | 341 |
public abstract String[] getRasterLayerOutputExtensions(); |
... | ... | |
288 | 345 |
* Returns the extensions supported by this factory for creating 3d raster layers. If a filename with an extension not found in |
289 | 346 |
* this list of extensions is used to create a 3d raster layer, the default extension (the first one of the list) will be added |
290 | 347 |
* to the filename when creating that layer. |
291 |
*
|
|
348 |
* |
|
292 | 349 |
* A default implementation is given, which returns just the "asc" extension used by the default implementation of the |
293 | 350 |
* getNew3DRasterLayer method, which uses the Default3DRasterLayer class |
294 |
*
|
|
351 |
* |
|
295 | 352 |
* @return the list of supported extensions for 3d raster layers |
296 | 353 |
*/ |
297 | 354 |
public String[] get3DRasterLayerOutputExtensions() { |
... | ... | |
305 | 362 |
* Returns the extensions supported by this factory for creating vector layers. If a filename with an extension not found in |
306 | 363 |
* this list of extensions is used to create a vector layer, the default extension (the first one of the list) will be added to |
307 | 364 |
* the filename when creating that layer. |
308 |
*
|
|
365 |
* |
|
309 | 366 |
* @return the list of supported extensions for vector layers |
310 | 367 |
*/ |
311 | 368 |
public abstract String[] getVectorLayerOutputExtensions(); |
... | ... | |
315 | 372 |
* Returns the extensions supported by this factory for creating raster layers. If a filename with an extension not found in |
316 | 373 |
* this list of extensions is used to create a raster layer, the default extension (the first one of the list) will be added to |
317 | 374 |
* the filename when creating that layer. |
318 |
*
|
|
375 |
* |
|
319 | 376 |
* @return the list of supported extensions for raster layers |
320 | 377 |
*/ |
321 | 378 |
public abstract String[] getTableOutputExtensions(); |
... | ... | |
323 | 380 |
|
324 | 381 |
/** |
325 | 382 |
* Returns the task monitor that will be used to monitor algorithm execution |
326 |
*
|
|
383 |
* |
|
327 | 384 |
* @param sTitle |
328 | 385 |
* a String used to identify the monitor. This will be used, for instance, as the title string of a progress |
329 | 386 |
* dialog. |
... | ... | |
340 | 397 |
/** |
341 | 398 |
* Returns the default CRS for new layers. This will be used when the geoalgorithm generates new layers but does not take any |
342 | 399 |
* other layer as input, so the CRS cannot be defined from the inputs |
343 |
*
|
|
400 |
* |
|
344 | 401 |
* @return an object containing information about the default CRS (i.e. a String with the EPSG code of the CRS) |
345 | 402 |
*/ |
346 | 403 |
public abstract Object getDefaultCRS(); |
... | ... | |
348 | 405 |
|
349 | 406 |
/** |
350 | 407 |
* Returns the default no data value for raster layers created by this output factory |
351 |
*
|
|
408 |
* |
|
352 | 409 |
* @return the default no data value for raster layers created by this output factory |
353 | 410 |
*/ |
354 | 411 |
public double getDefaultNoDataValue() { |
... | ... | |
360 | 417 |
|
361 | 418 |
/** |
362 | 419 |
* Sets the default no data value to use when this output factory cretes a new raster layer |
363 |
*
|
|
420 |
* |
|
364 | 421 |
* @param dValue |
365 | 422 |
* the default no data value to use when this output factory cretes a new raster layer |
366 | 423 |
*/ |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/core/GeoAlgorithm.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.text.DateFormat; |
4 | 4 |
import java.util.ArrayList; |
5 |
import java.util.Collection; |
|
6 | 5 |
import java.util.Date; |
7 | 6 |
import java.util.HashMap; |
8 | 7 |
|
9 |
import org.jfree.chart.ChartPanel; |
|
10 |
|
|
11 | 8 |
import es.unex.sextante.additionalInfo.AdditionalInfoDataObject; |
12 | 9 |
import es.unex.sextante.additionalInfo.AdditionalInfoFixedTable; |
13 | 10 |
import es.unex.sextante.additionalInfo.AdditionalInfoMultipleInput; |
... | ... | |
44 | 41 |
import es.unex.sextante.parameters.RasterLayerAndBand; |
45 | 42 |
import es.unex.sextante.shapesTools.ShapesTools; |
46 | 43 |
|
44 |
import org.jfree.chart.ChartPanel; |
|
47 | 45 |
|
46 |
import org.gvsig.fmap.geom.Geometry; |
|
47 |
|
|
48 |
|
|
48 | 49 |
/** |
49 | 50 |
* A class defining a geo-algorithm |
50 | 51 |
* |
... | ... | |
1100 | 1101 |
return sFilename + "." + exts[0]; |
1101 | 1102 |
} |
1102 | 1103 |
|
1103 |
|
|
1104 | 1104 |
/** |
1105 | 1105 |
* This method creates a new vector layer and adds it to the set of output objects of the algorithm. Use this when your |
1106 | 1106 |
* algorithm generates a new vector layer and you have to create it. |
... | ... | |
1125 | 1125 |
final String sDescription, |
1126 | 1126 |
final int iShapeType, |
1127 | 1127 |
final Class[] types, |
1128 |
final String[] sFields) throws GeoAlgorithmExecutionException { |
|
1128 |
final String[] sFields, final int subtype) throws GeoAlgorithmExecutionException {
|
|
1129 | 1129 |
|
1130 | 1130 |
try { |
1131 | 1131 |
final OutputVectorLayer out = (OutputVectorLayer) m_OutputObjects.getOutput(sName); |
1132 | 1132 |
IVectorLayer layer; |
1133 | 1133 |
final IOutputChannel channel = getOutputChannel(sName); |
1134 |
layer = m_OutputFactory.getNewVectorLayer(getLayerName(sName, sDescription), iShapeType, types, sFields, channel, m_CRS); |
|
1134 |
layer = m_OutputFactory.getNewVectorLayer(getLayerName(sName, sDescription), iShapeType, types, sFields, channel, m_CRS, subtype);
|
|
1135 | 1135 |
if(layer!=null){ |
1136 |
addOutputVectorLayer(sName, sDescription, iShapeType, channel, layer, out.getInputLayerToOverwrite()); |
|
1136 |
addOutputVectorLayer(sName, sDescription, iShapeType, channel, layer, out.getInputLayerToOverwrite(), subtype);
|
|
1137 | 1137 |
} |
1138 | 1138 |
return layer; |
1139 | 1139 |
} |
... | ... | |
1143 | 1143 |
|
1144 | 1144 |
} |
1145 | 1145 |
|
1146 |
/** |
|
1147 |
* This method creates a new vector layer and adds it to the set of output objects of the algorithm. Use this when your |
|
1148 |
* algorithm generates a new vector layer and you have to create it. |
|
1149 |
* |
|
1150 |
* @param sName |
|
1151 |
* The name of the layer. Has to be the same that you used to define this output in the |
|
1152 |
* @see {@link #defineCharacteristics()} method. |
|
1153 |
* @param sDescription |
|
1154 |
* the long description of the output. This is the one usually used to describe the layer when added to a GIS |
|
1155 |
* GUI |
|
1156 |
* @param iShapeType |
|
1157 |
* The shape type. See |
|
1158 |
* @see {@link IVectorLayer} for more info about valid values |
|
1159 |
* @param types |
|
1160 |
* an array of classes indicating data types for each field |
|
1161 |
* @param sFields |
|
1162 |
* an array of field names |
|
1163 |
* @return a new vector layer |
|
1164 |
* @throws GeoAlgorithmExecutionException |
|
1165 |
*/ |
|
1166 |
protected IVectorLayer getNewVectorLayer(final String sName, |
|
1167 |
final String sDescription, |
|
1168 |
final int iShapeType, |
|
1169 |
final Class[] types, |
|
1170 |
final String[] sFields) throws GeoAlgorithmExecutionException { |
|
1146 | 1171 |
|
1172 |
return getNewVectorLayer(sName, |
|
1173 |
sDescription, |
|
1174 |
iShapeType, |
|
1175 |
types, |
|
1176 |
sFields, Geometry.SUBTYPES.UNKNOWN); |
|
1177 |
|
|
1178 |
} |
|
1179 |
|
|
1147 | 1180 |
/** |
1148 | 1181 |
* This method creates a new vector layer and adds it to the set of output objects of the algorithm. Use this when your |
1149 | 1182 |
* algorithm generates a new vector layer and you have to create it. |
... | ... | |
1173 | 1206 |
final String[] sFields, |
1174 | 1207 |
final int[] fieldSize) throws GeoAlgorithmExecutionException { |
1175 | 1208 |
|
1209 |
return getNewVectorLayer(sName, sDescription, iShapeType, types, sFields, fieldSize, Geometry.SUBTYPES.UNKNOWN); |
|
1210 |
} |
|
1211 |
/** |
|
1212 |
* This method creates a new vector layer and adds it to the set of output objects of the algorithm. Use this when your |
|
1213 |
* algorithm generates a new vector layer and you have to create it. |
|
1214 |
* |
|
1215 |
* @param sName |
|
1216 |
* The name of the layer. Has to be the same that you used to define this output in the |
|
1217 |
* @see {@link #defineCharacteristics()} method. |
|
1218 |
* @param sDescription |
|
1219 |
* the long description of the output. This is the one usually used to describe the layer when added to a GIS |
|
1220 |
* GUI |
|
1221 |
* @param iShapeType |
|
1222 |
* The shape type. See |
|
1223 |
* @see {@link IVectorLayer} for more info about valid values |
|
1224 |
* @param types |
|
1225 |
* an array of classes indicating data types for each field |
|
1226 |
* @param sFields |
|
1227 |
* an array of field names |
|
1228 |
* @param fieldSize |
|
1229 |
* An array of field sizes |
|
1230 |
* @return a new vector layer |
|
1231 |
* @throws GeoAlgorithmExecutionException |
|
1232 |
*/ |
|
1233 |
protected IVectorLayer getNewVectorLayer(final String sName, |
|
1234 |
final String sDescription, |
|
1235 |
final int iShapeType, |
|
1236 |
final Class[] types, |
|
1237 |
final String[] sFields, |
|
1238 |
final int[] fieldSize, final int subtype) throws GeoAlgorithmExecutionException { |
|
1239 |
|
|
1176 | 1240 |
try { |
1177 | 1241 |
final OutputVectorLayer out = (OutputVectorLayer) m_OutputObjects.getOutput(sName); |
1178 | 1242 |
IVectorLayer layer; |
1179 | 1243 |
final IOutputChannel channel = getOutputChannel(sName); |
1180 | 1244 |
layer = m_OutputFactory.getNewVectorLayer(getLayerName(sName, sDescription), iShapeType, types, sFields, channel, m_CRS, |
1181 |
fieldSize); |
|
1245 |
fieldSize, subtype);
|
|
1182 | 1246 |
addOutputVectorLayer(sName, sDescription, iShapeType, channel, layer, out.getInputLayerToOverwrite()); |
1183 | 1247 |
return layer; |
1184 | 1248 |
} |
... | ... | |
1580 | 1644 |
|
1581 | 1645 |
} |
1582 | 1646 |
|
1583 |
|
|
1584 | 1647 |
/** |
1585 | 1648 |
* Adds a new vector layer to the output set |
1586 | 1649 |
* |
... | ... | |
1603 | 1666 |
final int iType, |
1604 | 1667 |
final IOutputChannel channel, |
1605 | 1668 |
final IVectorLayer layer, |
1606 |
final String sInputLayerToOverwrite) { |
|
1669 |
final String sInputLayerToOverwrite, |
|
1670 |
final int subtype) { |
|
1607 | 1671 |
|
1608 | 1672 |
final OutputVectorLayer out = new OutputVectorLayer(); |
1609 | 1673 |
out.setName(sName); |
... | ... | |
1612 | 1676 |
out.setOutputChannel(channel); |
1613 | 1677 |
out.setShapeType(iType); |
1614 | 1678 |
out.setInputLayerToOverwrite(sInputLayerToOverwrite); |
1679 |
out.setSubType(subtype); |
|
1615 | 1680 |
|
1616 | 1681 |
m_OutputObjects.add(out); |
1617 | 1682 |
|
1618 | 1683 |
} |
1619 | 1684 |
|
1685 |
/** |
|
1686 |
* Adds a new vector layer to the output set |
|
1687 |
* |
|
1688 |
* @param sName |
|
1689 |
* The name to identify the layer in the set |
|
1690 |
* @param sDescription |
|
1691 |
* The description of the layer |
|
1692 |
* @param iType |
|
1693 |
* the shape type of the layer |
|
1694 |
* @param channel |
|
1695 |
* the output channel associated to the output |
|
1696 |
* @param layer |
|
1697 |
* the layer itself |
|
1698 |
* @param sInputLayerToOverwrite |
|
1699 |
* the name of the input param (another vector layer) that this output can overwrite |
|
1700 |
* |
|
1701 |
*/ |
|
1702 |
protected void addOutputVectorLayer(final String sName, |
|
1703 |
final String sDescription, |
|
1704 |
final int iType, |
|
1705 |
final IOutputChannel channel, |
|
1706 |
final IVectorLayer layer, |
|
1707 |
final String sInputLayerToOverwrite) { |
|
1620 | 1708 |
|
1709 |
addOutputVectorLayer(sName, sDescription, iType, null, null, sInputLayerToOverwrite, Geometry.SUBTYPES.UNKNOWN); |
|
1710 |
} |
|
1711 |
|
|
1712 |
|
|
1621 | 1713 |
/** |
1622 | 1714 |
* Adds a new vector layer to the output set. The value of the output is null, and so is the filename. Use this method in the |
1623 | 1715 |
* DefineCharacteristics() method of the algorithm, to define the outputs expected. |
org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.core/pom.xml | ||
---|---|---|
34 | 34 |
<groupId>net.sf.kxml</groupId> |
35 | 35 |
<artifactId>kxml2</artifactId> |
36 | 36 |
</dependency> |
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
40 |
</dependency> |
|
37 | 41 |
</dependencies> |
38 | 42 |
|
39 | 43 |
</project> |
Also available in: Unified diff