gvSIG bugs #1180

Error cargando la leyenda de una capa de tipo Multipunto

Added by Jose Lamas almost 12 years ago. Updated over 10 years ago.

Status:New% Done:

0%

Priority:Normal
Assignee:-
Category:-
Target version:-
Severity: Add-on name:Unknown
gvSIG version:1.12.0 Add-on version:
gvSIG build:1417 Add-on build:
Operative System:Windows Add-on resolve version:
Keywords: Add-on resolve build:
Has patch:Yes

Description

Si cargamos una capa de BD con tipo de geometría 'Multipoint', le asignamos un estilo de visualización y guardamos el workspace al abrirlo no se recupera el estilo de esta capa correctamente y nos pone un estilo por defecto.

La causa está en la clase FLyrVect en el método 'setXMLEntity(XMLEntity xml)' a partir de la línea 1126 donde se hace esto:
/* * Parche para detectar cuando, por algun problema de persistencia * respecto a versiones anteriores, la leyenda que se ha cargado * no se corresponde con el tipo de shape de la capa.
/
int legShapeType = leg.getShapeType();
if (legShapeType != 0 && legShapeType != this.getShapeType()){
leg = LegendFactory.createSingleSymbolLegend(this.getShapeType());
logger.warn("Legend shape type and layer shape type does not match.");
}
/
Fin del parche */
El problema viene de que el 'legShapeType' es 1 (FShape.POINT) pero el 'this.getShapeType()' es 32 (FShape.MULTIPOINT) por lo que entra por el if cuando debería asignar ese estilo al ser válido.

Yo lo solucioné, de forma rápida, modificando la condición del if por algo así:
if (legShapeType != 0 && ((legShapeType != this.getShapeType()) && !(
(legShapeType==FShape.POINT || legShapeType== FShape.MULTIPOINT) &&
(this.getShapeType()==FShape.POINT || this.getShapeType()== FShape.MULTIPOINT)))){
leg = LegendFactory.createSingleSymbolLegend(this.getShapeType());
logger.warn("Legend shape type and layer shape type does not match.");
}

Esta solución que propongo supone que es correcto asignar una leyenda de tipo multipunto a una capa de tipo punto (no se si se pueden crear leyendas de tipo multipunto). En caso de ser incorrecta esta suposición habría que modificarse el if por algo así:
if (legShapeType != 0 && ((legShapeType != this.getShapeType()) && !(
(legShapeType==FShape.POINT) && (this.getShapeType()== FShape.MULTIPOINT)))){
leg = LegendFactory.createSingleSymbolLegend(this.getShapeType());
logger.warn("Legend shape type and layer shape type does not match.");
}

History

#1 Updated by Antonio Falciano over 11 years ago

  • Target version set to 1.13.0

I have reproduced this bug and used a simply workaround: I have applied the "Geometries to points" tool of SEXTANTE before applying the legend. In reference to Jose's patch, it seems that avoiding a strict match between geometries and legend types bypasses the issue. So, it's good for me. Cheers.

#2 Updated by Álvaro Anguix over 10 years ago

  • Project changed from Application: gvSIG desktop to | gvSIG desktop 1
  • Category deleted (Application)
  • Target version deleted (1.13.0)

Also available in: Atom PDF