[Gvsig_desarrolladores] Problemas con un PointListener

Jesuco jesuxt en yahoo.es
Dom Dic 19 17:23:47 CET 2010


Hola,

estoy teniendo algunos problemas para crear un Listener (PointListener), que
seleeciona elementos de una determinada capa (no de las activas).

El problema es que aparentemente sobre el mapa sí que selecciona el
elemento, pero otra extensión que se habilita cuando hay elementos
seleccionados de esta capa no se habilita. La otra extensión funciona
perfectamente si hago la selección atraves de el seleccionador de capas
activas de gvSIG.

Y no sé exactamente qué es lo que estoy haciendo mal. Os dejo aquí el código
para ver si me podéis echar una mano:


el método point:

public void point(PointEvent event) throws BehaviorException {
		try {

            Point2D p = event.getPoint();
            Point2D mapPoint = mapCtrl.getViewPort().toMapPoint((int)
p.getX(), (int) p.getY());

            // Tolerancia de 7 pixels
            double tol = mapCtrl.getViewPort().toMapDistance(7);
            FLayer accidentes =
mapCtrl.getMapContext().getLayers().getLayer("accidentes");
                if (accidentes instanceof FLyrVect) {
                    FLyrVect lyrVect = (FLyrVect) accidentes;
                    FBitSet oldBitSet =
lyrVect.getSource().getRecordset().getSelection();
                    FBitSet newBitSet = lyrVect.queryByPoint(mapPoint, tol);
                    if (event.getEvent().isControlDown())
                        newBitSet.xor(oldBitSet);
                    lyrVect.getRecordset().setSelection(newBitSet);
                }

		} catch (ReadDriverException e) {
			throw new BehaviorException("No se pudo hacer la selección");
		} catch (VisitorException e) {
			throw new BehaviorException("No se pudo hacer la selección");
		}
	}



y aquí donde creo el behavior:

	
                private AccidenteSelectionListener acciListener = null;	
		View v = (View) PluginServices.getMDIManager().getActiveWindow();
		MapControl mc = v.getMapControl();

			if (acciListener==null){
				acciListener = new AccidenteSelectionListener(mc);
				mc.addMapTool("seleccionarAccidente", new PointBehavior(acciListener));
			}
		mc.setTool("seleccionarAccidente");
		}


-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Problemas-con-un-PointListener-tp5849991p5849991.html
Sent from the gvSIG desarrolladores mailing list archive at Nabble.com.


Más información sobre la lista de distribución gvSIG_desarrolladores