Statistics
| Revision:

root / org.gvsig.toolbox / trunk / org.gvsig.toolbox / org.gvsig.toolbox.algorithm / src / main / java / es / unex / sextante / vectorTools / smoothLines / ControlCurve.java @ 59

History | View | Annotate | Download (1.01 KB)

1
/*********************************************************
2
 * Code adapted from Tim Lambert's Java Classes
3
 * http://www.cse.unsw.edu.au/~lambert/
4
 *********************************************************/
5
package es.unex.sextante.vectorTools.smoothLines;
6

    
7
/** This class represents a curve defined by a sequence of control points */
8

    
9
import com.vividsolutions.jts.geom.Coordinate;
10
import com.vividsolutions.jts.geom.Geometry;
11
import com.vividsolutions.jts.geom.LineString;
12

    
13
public abstract class ControlCurve {
14

    
15
   protected double[] m_X;
16
   protected double[] m_Y;
17
   protected Geometry m_Geometry;
18

    
19

    
20
   public ControlCurve(final Geometry geom) {
21

    
22
      final Coordinate[] coords = geom.getCoordinates();
23
      m_X = new double[coords.length];
24
      m_Y = new double[coords.length];
25
      for (int i = 0; i < coords.length; i++) {
26
         m_X[i] = coords[i].x;
27
         m_Y[i] = coords[i].y;
28
      }
29
      m_Geometry = geom;
30

    
31
   }
32

    
33

    
34
   public abstract LineString getSmoothedLine(int iSteps);
35

    
36
}