Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / type / GeometryType.java @ 20961

History | View | Annotate | Download (1.6 KB)

1
package org.gvsig.fmap.geom.type;
2

    
3
import java.util.ArrayList;
4
import java.util.List;
5

    
6
import org.gvsig.fmap.geom.operation.GeometryOperation;
7

    
8
public class GeometryType {
9

    
10
        /** Operaciones registradas para este tipo de geometría */
11
        private List geometryOperations = new ArrayList();
12
        
13
        /** Clase que implementa este tipo de geometría */
14
        private Class geometryClass;
15
        
16
        /** Nombre simbólico */
17
        private String name;
18
        
19
        /** Identificador del tipo de geometría */
20
        private int type;
21
        
22
        
23
        public GeometryType(Class geomClass, String name, int typeIndex) {
24
                this.geometryClass = geomClass;
25
                this.name = name;
26
                this.type = typeIndex;
27
        }
28
        
29
        public int getType() {
30
                return type;
31
        }
32
        
33
        public String getName() {
34
                return name;
35
        }
36
        
37
        /**
38
         * Guardamos una referencia a una instancia de la operación en el índice que se pasa como parámetro.
39
         * Si el índice ya está ocupado se sobrescribe.
40
         * 
41
         * @param index
42
         * @param geomOp
43
         */
44
        public void setGeometryOperation(int index, GeometryOperation geomOp) {
45
                
46
                while (index > geometryOperations.size()) {
47
                        geometryOperations.add(null);
48
                }
49
                
50
                if (index == geometryOperations.size()) {
51
                        geometryOperations.add(geomOp);
52
                }
53
                                
54
            geometryOperations.set(index, geomOp);
55
        }
56
        
57
        public GeometryOperation getGeometryOperation(int index) {
58
                return (GeometryOperation) geometryOperations.get(index);
59
        }
60
        
61
        public Class getGeometryClass() {
62
                return geometryClass;
63
        }
64

    
65
        public String toString() {
66
                StringBuffer sb = new StringBuffer("[")
67
                .append(geometryClass.getName())
68
                .append(",[")
69
                .append(geometryOperations.toString())
70
                .append("]");
71
                
72
                return sb.toString();
73
        }
74
        
75
}