Revision 187 org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/core/GeoAlgorithm.java

View differences:

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.

Also available in: Unified diff