Revision 103 org.gvsig.gazetteer/trunk/org.gvsig.gazetteer/org.gvsig.gazetteer.extension/src/main/java/org/gvsig/gazetteer/loaders/FeatureLoader.java
FeatureLoader.java | ||
---|---|---|
143 | 143 |
IProjection projection = activeView.getProjection(); |
144 | 144 |
ViewPort viewPort = activeView.getMapControl().getViewPort(); |
145 | 145 |
MapContext mapContext = activeView.getMapControl().getMapContext(); |
146 |
Point2D point = getReprojectedPoint(feature.getCoordinates()); |
|
146 |
Point point = getReprojectedPoint((feature.getCoordinates())); |
|
147 |
// Point point = feature.getCoordinates(); |
|
147 | 148 |
|
148 | 149 |
if (viewPort.getAdjustedEnvelope() != null){ |
149 | 150 |
Toolkit kit = Toolkit.getDefaultToolkit(); |
... | ... | |
200 | 201 |
lyr.clearAllGraphics(); |
201 | 202 |
} |
202 | 203 |
|
203 |
if (isMarkedPlaceClicked){
|
|
204 |
int pointSymbol = lyr.addSymbol(getSymbol());
|
|
205 |
int textSymbol = lyr.addSymbol(getTextSymbol(feature.getName()));
|
|
204 |
if (isMarkedPlaceClicked) {
|
|
205 |
int pointSymbol = lyr.addSymbol(getSymbol());
|
|
206 |
int textSymbol = lyr.addSymbol(getTextSymbol(feature.getName()));
|
|
206 | 207 |
|
208 |
Point point = feature.getCoordinates(); |
|
209 |
lyr.setCoordTrans(getCoordTrans()); |
|
210 |
lyr.addGraphic("gazetteer", point, pointSymbol, null); |
|
211 |
lyr.addGraphic("gazetteer", point, textSymbol, feature.getName()); |
|
212 |
DeleteSearchesExtension.setVisible(); |
|
213 |
PluginServices.getMainFrame().enableControls(); |
|
214 |
} |
|
207 | 215 |
|
208 |
Point2D point2d = getReprojectedPoint(feature.getCoordinates()); |
|
209 |
feature.setCoordinates(point2d); |
|
210 |
Point point; |
|
211 |
try { |
|
212 |
point = geometryManager.createPoint(point2d.getX(), point2d.getY(), SUBTYPES.GEOM2D); |
|
213 |
lyr.setCoordTrans(getCoordTrans()); |
|
214 |
lyr.addGraphic("gazetteer", point, pointSymbol, null); |
|
215 |
lyr.addGraphic("gazetteer", point, textSymbol, feature.getName()); |
|
216 |
DeleteSearchesExtension.setVisible(); |
|
217 |
PluginServices.getMainFrame().enableControls(); |
|
218 |
} catch (CreateGeometryException e) { |
|
219 |
LOG.error("Error creating the point", e); |
|
220 |
} |
|
221 |
} |
|
222 |
|
|
223 | 216 |
mc.invalidate(); |
224 | 217 |
} |
225 | 218 |
|
... | ... | |
254 | 247 |
return theSymbol; |
255 | 248 |
} |
256 | 249 |
|
250 |
// /** |
|
251 |
// * Reprojects the new point |
|
252 |
// * @param ptOrig |
|
253 |
// * Origin point |
|
254 |
// * @return |
|
255 |
// * FPoint2D |
|
256 |
// */ |
|
257 |
// private Point2D getReprojectedPoint(Point2D ptOrigin){ |
|
258 |
// Point2D ptDest = null; |
|
259 |
// ICoordTrans ct = getCoordTrans(); |
|
260 |
// if(ct != null) { |
|
261 |
// return ct.convert(ptOrigin, ptDest); |
|
262 |
// } |
|
263 |
// return ptOrigin; |
|
264 |
// } |
|
265 |
|
|
266 |
/** |
|
267 |
* Reprojects the new point |
|
268 |
* @param ptOrig |
|
269 |
* Origin point |
|
270 |
* @return |
|
271 |
* Point |
|
272 |
*/ |
|
273 |
private Point getReprojectedPoint(Point ptOrigin){ |
|
274 |
Point ptDest = ((Point)ptOrigin.cloneGeometry()); |
|
275 |
ICoordTrans ct = getCoordTrans(); |
|
276 |
if(ct != null) { |
|
277 |
ptDest.reProject(ct); |
|
278 |
} |
|
279 |
return ptDest; |
|
280 |
} |
|
281 |
|
|
257 | 282 |
/** |
258 |
* Reprojects the new point |
|
259 |
* @param ptOrig |
|
260 |
* Origin point |
|
261 |
* @return |
|
262 |
* FPoint2D |
|
263 |
*/ |
|
264 |
private Point2D getReprojectedPoint(Point2D ptOrigin){ |
|
265 |
Point2D ptDest = null; |
|
266 |
ICoordTrans ct = getCoordTrans(); |
|
267 |
if(ct != null) { |
|
268 |
return ct.convert(ptOrigin, ptDest); |
|
269 |
} |
|
270 |
return ptOrigin; |
|
271 |
} |
|
272 |
/** |
|
273 | 283 |
* @return the coordTrans |
274 | 284 |
*/ |
275 | 285 |
public ICoordTrans getCoordTrans() { |
Also available in: Unified diff