Revision 2193 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FMultiPoint2D.java
FMultiPoint2D.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap.core; |
42 | 42 |
|
43 | 43 |
import com.iver.cit.gvsig.fmap.ViewPort; |
44 |
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities; |
|
44 | 45 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
45 | 46 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
46 | 47 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
... | ... | |
119 | 120 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D) |
120 | 121 |
*/ |
121 | 122 |
public boolean intersects(Rectangle2D r) { |
122 |
// TODO Auto-generated method stub |
|
123 |
for (int i=0;i<getNumPoints();i++){ |
|
124 |
if (r.contains(x[i],y[i]))return true; |
|
125 |
} |
|
123 | 126 |
return false; |
124 | 127 |
} |
125 | 128 |
|
... | ... | |
127 | 130 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D() |
128 | 131 |
*/ |
129 | 132 |
public Rectangle2D getBounds2D() { |
130 |
// TODO Auto-generated method stub |
|
131 |
return null; |
|
133 |
Rectangle2D r=null; |
|
134 |
if (getNumPoints()>0){ |
|
135 |
r=new Rectangle2D.Double(x[0],y[0],0.001,0.001); |
|
136 |
} |
|
137 |
for (int i=1;i<getNumPoints();i++){ |
|
138 |
r.add(x[i],y[i]); |
|
139 |
} |
|
140 |
return r; |
|
132 | 141 |
} |
133 | 142 |
|
134 | 143 |
/** |
135 | 144 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType() |
136 | 145 |
*/ |
137 | 146 |
public int getGeometryType() { |
138 |
return FShape.POINT; |
|
147 |
return FShape.MULTIPOINT;
|
|
139 | 148 |
} |
140 | 149 |
|
141 | 150 |
/* (non-Javadoc) |
... | ... | |
149 | 158 |
java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i], |
150 | 159 |
y[i]); |
151 | 160 |
vp.getAffineTransform().transform(p, p); |
161 |
FGraphicUtilities.DrawShape(g, vp.getAffineTransform(), new FPoint2D(p.getX(),p.getY()), symbol); |
|
162 |
|
|
163 |
/* java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i], |
|
164 |
y[i]); |
|
165 |
vp.getAffineTransform().transform(p, p); |
|
152 | 166 |
g.setColor(Color.red); |
153 | 167 |
g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
154 | 168 |
g.setColor(Color.black); |
155 | 169 |
g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
170 |
*/ |
|
156 | 171 |
} |
157 | 172 |
} |
158 | 173 |
|
... | ... | |
160 | 175 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry() |
161 | 176 |
*/ |
162 | 177 |
public IGeometry cloneGeometry() { |
163 |
// TODO Auto-generated method stub |
|
164 |
return null; |
|
178 |
return new FMultiPoint2D((double[])x.clone(),(double[])y.clone()); |
|
165 | 179 |
} |
166 | 180 |
|
167 | 181 |
/* (non-Javadoc) |
... | ... | |
180 | 194 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeneralPathXIterator() |
181 | 195 |
*/ |
182 | 196 |
public GeneralPathXIterator getGeneralPathXIterator() { |
183 |
//TODO no est? implementado. |
|
184 |
return null; |
|
197 |
GeneralPathX gpx=new GeneralPathX(); |
|
198 |
if (getNumPoints()>0){ |
|
199 |
gpx.moveTo(x[0],y[0]); |
|
200 |
} |
|
201 |
for (int i=1;i<getNumPoints();i++){ |
|
202 |
gpx.lineTo(x[i],y[i]); |
|
203 |
} |
|
204 |
return (GeneralPathXIterator)gpx.getPathIterator(null); |
|
185 | 205 |
} |
186 | 206 |
/* (non-Javadoc) |
187 | 207 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#fastIntersects(double, double, double, double) |
Also available in: Unified diff