Thanks. It is the my solution:
1.- Create geometry.
AttributeTypeBuilder atb = new AttributeTypeBuilder();
atb.setBinding(Point.class);
atb.setNillable(false);
atb.setCRS(DefaultGeographicCRS.WGS84);
atb.setDefaultValue(null);
atb.setName(JnlpConstantes.ATRIBUTO_JST_FIGURA);
AttributeDescriptor atJts =
atb.buildDescriptor(JnlpConstantes.ATRIBUTO_JST_FIGURA);
atb.setBinding(Double.class);
atb.setNillable(false);
atb.setCRS(DefaultGeographicCRS.WGS84);
atb.setDefaultValue(null);
atb.setName(JnlpConstantes.ATRIBUTO_IDENTIFICADOR);
AttributeDescriptor atIden =
atb.buildDescriptor(JnlpConstantes.ATRIBUTO_IDENTIFICADOR);
atb.setBinding(Object.class);
atb.setNillable(false);
atb.setCRS(DefaultGeographicCRS.WGS84);
atb.setDefaultValue(null);
atb.setName(JnlpConstantes.ATRIBUTO_OBJETO_ALMACENADO);
AttributeDescriptor atObj =
atb.buildDescriptor(JnlpConstantes.ATRIBUTO_OBJETO_ALMACENADO);
Point point = gf.createPoint(coordinate);
SimpleFeatureType pointType =
FeatureTypes.newFeatureType(
typesNew, style.getName());
pruebaDTO.setIdentificador(Math.random());
SimpleFeature ptF =
SimpleFeatureBuilder.build(pointType,new Object[]
{point,pruebaDTO.getIdentificador(), pruebaDTO},null);
memoryDataStore.addFeature(ptF);
2.- The Mouse moved and location figure, the show the property
JnlpConstantes.ATRIBUTO_OBJETO_ALMACENADO:
public void mouseMoved(MouseEvent e) {
if(getContext() != null) {
Geometry geom = this.obtenerPuntoCoordenada(e.getX(), e.getY());
if (geom != null) {
PruebaBaseDTO baseDTO =
visorEquipos.buscarCentroDesplazamiento(geom);
if (baseDTO != null) {
tip.setLocation(e.getX(), e.getY());
String latitud =
CConversiones.WGSW84toLONG(String.valueOf(baseDTO.getCoordenada().x));
String longitud =
CConversiones.WGSW84toLONG(String.valueOf(baseDTO.getCoordenada().y));
String texto =
latitud.concat(" ").concat(longitud);
int sizeFont =
tip.getFont().getSize();
int tamanoText =
(sizeFont*texto.length()/2);
tip.setTipText(texto);
tip.setSize(tamanoText+4, 20);
tip.setVisible(true);
this.setCursor(seleccionImagen);
this.add(tip);
this.setReset(true);
this.repaint();
} else {
this.setCursor(cursorDefault);
tip.setVisible(false);
this.setReset(true);
this.repaint();
}
}
}
But, I thought a listener to mousemoved to geometry.
Thanks.
apreciado wrote:
>
> Hey, how setting the tooltip to geometry?
>
> thanks
>
--
View this message in context:
http://www.nabble.com/geometry-tooltip-tp19794403p19893215.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users