Statistics
| Revision:

root / branches / pilotoDWG / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / FMultiPoint2D.java @ 1532

History | View | Annotate | Download (5.65 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.fmap.core;
42

    
43
import com.iver.cit.gvsig.fmap.ViewPort;
44
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
45
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
46
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
47

    
48
import com.vividsolutions.jts.geom.Geometry;
49

    
50
import org.cresques.cts.ICoordTrans;
51

    
52
import java.awt.Color;
53
import java.awt.Graphics2D;
54
import java.awt.geom.Point2D;
55
import java.awt.geom.Rectangle2D;
56

    
57

    
58
/**
59
 * Multipunto 2D.
60
 *
61
 * @author Vicente Caballero Navarro
62
 */
63
public class FMultiPoint2D implements IGeometry {
64
        double[] x = null;
65
        double[] y = null;
66

    
67
        /**
68
         * Crea un nuevo MultiPoint2D.
69
         *
70
         * @param x DOCUMENT ME!
71
         * @param y DOCUMENT ME!
72
         */
73
        public FMultiPoint2D(double[] x, double[] y) {
74
                this.x = x;
75
                this.y = y;
76
        }
77
        public FMultiPoint2D(FPoint2D[] points) {
78
                double[] auxX=new double[points.length];
79
                double[] auxY=new double[points.length];
80
                for (int i=0;i<points.length;i++){
81
                        auxX[i]=points[i].getX();
82
                        auxY[i]=points[i].getY();
83
                }
84
        }
85
        /**
86
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D,
87
         *                 ViewPort, FStyle2D)
88
         */
89
        public void draw(Graphics2D g, ViewPort vp, FStyle2D symbol) {
90
                int size = 2;
91
                int hw = 4;
92

    
93
                for (int i = 0; i < x.length; i++) {
94
                        java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
95
                                        y[i]);
96
                        vp.getAffineTransform().transform(p, p);
97
                        g.setColor(Color.red);
98
                        g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw);
99
                        g.setColor(Color.black);
100
                        g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw);
101
                }
102
        }
103

    
104
        /**
105
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#toJTSGeometry()
106
         */
107
        public Geometry toJTSGeometry() {
108
                return null;
109
        }
110

    
111
        /**
112
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#createLabels(int, boolean)
113
         */
114
        public FLabel[] createLabels(int position, boolean duplicates) {
115
                return null;
116
        }
117

    
118
        /* (non-Javadoc)
119
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D)
120
         */
121
        public boolean intersects(Rectangle2D r) {
122
                // TODO Auto-generated method stub
123
                return false;
124
        }
125

    
126
        /* (non-Javadoc)
127
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D()
128
         */
129
        public Rectangle2D getBounds2D() {
130
                // TODO Auto-generated method stub
131
                return null;
132
        }
133

    
134
        /**
135
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType()
136
         */
137
        public int getGeometryType() {
138
                return FShape.POINT;
139
        }
140

    
141
        /* (non-Javadoc)
142
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.cit.gvsig.fmap.core.v02.FSymbol)
143
         */
144
        public void draw(Graphics2D g, ViewPort vp, FSymbol symbol) {
145
                int size = 2;
146
                int hw = 4;
147

    
148
                for (int i = 0; i < x.length; i++) {
149
                        java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
150
                                        y[i]);
151
                        vp.getAffineTransform().transform(p, p);
152
                        g.setColor(Color.red);
153
                        g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw);
154
                        g.setColor(Color.black);
155
                        g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw);
156
                }
157
        }
158

    
159
        /* (non-Javadoc)
160
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
161
         */
162
        public IGeometry cloneGeometry() {
163
                // TODO Auto-generated method stub
164
                return null;
165
        }
166

    
167
        /* (non-Javadoc)
168
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#reProject(org.cresques.cts.ICoordTrans)
169
         */
170
        public void reProject(ICoordTrans ct) {
171
                // TODO Auto-generated method stub
172
        }
173
        public int getNumPoints(){
174
                return x.length;
175
        }
176
        public FPoint2D getPoint(int i){
177
                return new FPoint2D(x[i],y[i]);
178
        }
179
        /**
180
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeneralPathXIterator()
181
         */
182
        public GeneralPathXIterator getGeneralPathXIterator() {
183
                //TODO no est? implementado.
184
                return null;
185
        }
186
    /* (non-Javadoc)
187
     * @see com.iver.cit.gvsig.fmap.core.IGeometry#fastIntersects(double, double, double, double)
188
     */
189
    public boolean fastIntersects(double x, double y, double w, double h) {
190
        // TODO Auto-generated method stub
191
        return false;
192
    }
193
        /**
194
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#move(double, double)
195
         */
196
        public void move(double x, double y) {
197
        }
198
        /**
199
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#rotate(double, double, double)
200
         */
201
        public void rotate(double r, double x, double y) {
202
        }
203
        /**
204
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#getHandlers()
205
         */
206
        public Handler[] getHandlers(int type) {
207
                return null;
208
        }
209
        /**
210
         * @see com.iver.cit.gvsig.fmap.core.IGeometry#scale(java.awt.geom.Point2D, double, double)
211
         */
212
        public void scale(Point2D point, double x, double y) {
213
        }
214
}