50 |
50 |
import org.cresques.cts.IProjection;
|
51 |
51 |
import org.slf4j.Logger;
|
52 |
52 |
import org.slf4j.LoggerFactory;
|
53 |
|
|
54 |
53 |
import org.gvsig.andami.PluginServices;
|
55 |
54 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
|
56 |
55 |
import org.gvsig.fmap.crs.CRSFactory;
|
... | ... | |
71 |
70 |
import org.gvsig.gazetteer.DeleteSearchesExtension;
|
72 |
71 |
import org.gvsig.gazetteer.querys.Feature;
|
73 |
72 |
import org.gvsig.gazetteer.querys.GazetteerQuery;
|
|
73 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol;
|
74 |
74 |
|
75 |
75 |
|
76 |
76 |
|
... | ... | |
193 |
193 |
private void addAndDrawLabel(Feature feature,boolean isRemoveOldClicked,boolean isMarkedPlaceClicked){
|
194 |
194 |
AbstractViewPanel activeView =
|
195 |
195 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
|
196 |
|
|
197 |
|
GraphicLayer lyr = activeView.getMapControl().getMapContext().getGraphicsLayer();
|
|
196 |
MapContext mc = activeView.getMapControl().getMapContext();
|
|
197 |
GraphicLayer lyr = mc.getGraphicsLayer();
|
198 |
198 |
|
199 |
199 |
if (isRemoveOldClicked){
|
200 |
200 |
lyr.clearAllGraphics();
|
201 |
201 |
}
|
202 |
202 |
|
203 |
203 |
if (isMarkedPlaceClicked){
|
204 |
|
int idSymbol = lyr.addSymbol(getSymbol(feature.getName()));
|
|
204 |
int pointSymbol = lyr.addSymbol(getSymbol());
|
|
205 |
int textSymbol = lyr.addSymbol(getTextSymbol(feature.getName()));
|
|
206 |
|
205 |
207 |
|
206 |
208 |
Point2D point2d = getReprojectedPoint(feature.getCoordinates());
|
207 |
209 |
Point point;
|
208 |
210 |
try {
|
209 |
211 |
point = geometryManager.createPoint(point2d.getX(), point2d.getY(), SUBTYPES.GEOM2D);
|
210 |
|
lyr.addGraphic("gazetteer", point, idSymbol, feature.getName());
|
211 |
|
|
|
212 |
lyr.addGraphic("gazetteer", point, pointSymbol, null);
|
|
213 |
lyr.addGraphic("gazetteer", point, textSymbol, feature.getName());
|
212 |
214 |
DeleteSearchesExtension.setVisible();
|
213 |
215 |
PluginServices.getMainFrame().enableControls();
|
214 |
216 |
} catch (CreateGeometryException e) {
|
... | ... | |
216 |
218 |
}
|
217 |
219 |
}
|
218 |
220 |
|
219 |
|
activeView.getMapControl().drawGraphics();
|
|
221 |
mc.invalidate();
|
220 |
222 |
}
|
221 |
223 |
|
222 |
224 |
/**
|
... | ... | |
224 |
226 |
* @return
|
225 |
227 |
* FSymbol
|
226 |
228 |
*/
|
227 |
|
private ISymbol getSymbol(String text){
|
|
229 |
private ISymbol getTextSymbol(String text){
|
228 |
230 |
ITextSymbol theSymbol =
|
229 |
231 |
(ITextSymbol) mapContextManager.getSymbolManager()
|
230 |
232 |
.createSymbol(ITextSymbol.SYMBOL_NAME);
|
... | ... | |
237 |
239 |
}
|
238 |
240 |
|
239 |
241 |
/**
|
|
242 |
* Creates a FSymbol
|
|
243 |
* @return
|
|
244 |
* FSymbol
|
|
245 |
*/
|
|
246 |
private ISymbol getSymbol(){
|
|
247 |
IMarkerSymbol theSymbol =
|
|
248 |
(IMarkerSymbol) mapContextManager.getSymbolManager()
|
|
249 |
.createSymbol(IMarkerSymbol.CIRCLE_STYLE);
|
|
250 |
theSymbol.setColor(Color.RED);
|
|
251 |
theSymbol.setSize(4);
|
|
252 |
return theSymbol;
|
|
253 |
}
|
|
254 |
|
|
255 |
/**
|
240 |
256 |
* Reprojects the new point
|
241 |
257 |
* @param ptOrig
|
242 |
258 |
* Origin point
|