Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / ShapeZMFactory.java @ 38563

History | View | Annotate | Download (3.17 KB)

1
package com.iver.cit.gvsig.fmap.core;
2

    
3

    
4
/**
5
 * This factory is used to create geoemtries with the M and Z coordinates
6
 * 
7
 * @author Flavio Pompermaier (flavio.pompermaier@sinergis.it)
8
 */
9
public class ShapeZMFactory {
10
        //TODO implement
11
        //                public static IGeometry createPoint3DM(double x, double y,double z, double m) {
12
        //                        return new FGeometryM(new FPoint3DM(x, y, z, m));
13
        //                }
14
        
15
        public static IGeometryM createPolyline3DM(FPolyline3DM polyline) {
16
                return new FGeometryM(polyline);
17
        }
18
        
19
        //TODO implement
20
        //                public static IGeometry createPolyline3DM(ByteBuffer data) {
21
        //
22
        //                        int count = data.getInt();
23
        //                        GeneralPathX gp = new GeneralPathX();
24
        //                        //double[] ms = new double[count - 1];
25
        //                        //ArrayList alMs = new ArrayList();
26
        //
27
        //                        ArrayList<Double> ms = new ArrayList<Double>();
28
        //                        //                        ArrayList<Double> ms_aux = null;
29
        //                        //                        double[] ms = null;      //Intento de evitar el tener que encapsular las m's en
30
        //                        //                        double[] ms_aux = null;  //objetos Double y de tener que recorrer un ArrayList
31
        //                        int ms_lentgh = 0;
32
        //
33
        //                        for (int i=0; i < count; i++) {
34
        //                                parseTypeAndSRID(data);
35
        //                                FPoint2DM[] points = parsePointArray(data);
36
        //                                //                            ms_aux = new double[ms_lentgh + points.length];
37
        //
38
        //                                gp.moveTo(points[0].getX(), points[0].getY());
39
        //                                //alMs.add(new Double(points[0].getM()));
40
        //                                //                            ms_aux[ms_lentgh + 0] = points[0].getM();
41
        //                                ms.add(points[0].getM());
42
        //
43
        //                                for (int j = 1; j< points.length; j++) {
44
        //                                        ms.add(points[j].getM());
45
        //                                        //                             ms_aux[ms_lentgh + j] = points[j].getM();
46
        //                                        gp.lineTo(points[j].getX(), points[j].getY());
47
        //                                } 
48
        //
49
        //                                //ms[i] = points[i].getM();
50
        //                                //                            if (ms != null) {
51
        //                                //                             System.arraycopy(ms, 0, ms_aux, ms.length, ms.length);
52
        //                                //                            }
53
        //                                //                            ms = ms_aux;
54
        //                                //                            ms_lentgh = ms.length;
55
        //                                //                            ms_aux = null;
56
        //                        }//for
57
        //
58
        //
59
        //                        // OJO: Para ahorrarme esto tendr?a que modificar la clase FPolyline2DM para
60
        //                        //      que las ms se almacenaran como objetos Double en lugar de usar el tipo
61
        //                        //      primitivo double.
62
        //                        double[] aMs = new double[ms.size()];
63
        //                        for (int i = 0; i < ms.size(); i++) {
64
        //                                aMs[i] = ((Double)ms.get(i)).doubleValue();
65
        //                        }
66
        //
67
        //                        return new FGeometryM(new FPolyline3DM(gp, aMs));
68
        //                }
69
        
70
        public static IGeometry createPolygon3DM(GeneralPathX shape, double[] pZ, double[] pM) {
71
                throw new UnsupportedOperationException();
72
        }
73
        
74
        public static IGeometry createMultipoint3DM(double[] x, double[] y, double[] z, double[] m) {
75
                throw new UnsupportedOperationException();
76
        }
77
        
78
        /**
79
         * Creates a Polyline in 3D with the Z and M coordinates.
80
         * 
81
         * @param shape
82
         *            Coordinates to create the polyline
83
         * @param pZ
84
         *            Vector de Z.
85
         * @param pM
86
         *            Vector de M.
87
         * @return Geometr?a.
88
         * @author Flavio Pompermaier
89
         */
90
        public static IGeometry createPolyline3DM(GeneralPathX shape, double[] pZ, double[] pM) {
91
                return new FGeometry(new FPolyline3DM(shape, pZ, pM));
92
        }
93
}