gvSIG bugs #559

Error en método WKTParser.readLineStringText

Added by Ildefonso Junquero about 12 years ago. Updated over 11 years ago.

Status:Closed% Done:

0%

Priority:NormalSpent time:-
Assignee:Juan Lucas Domínguez
Category:-
Target version:2.0.0-devel-2055
Severity: Add-on version:
gvSIG version:2.0.0 Add-on build:
gvSIG build: Add-on resolve version:
Operative System: Add-on resolve build:
Keywords: Proyecto:
Has patch:No Hito:
Add-on name:Unknown

Description

Adjunto un reporte de un bug relacionado con la conversión de WKT a Geometría.

y que ha sido notificado en el grupo de desarrolladores de gvSIG Desktop. Adjunto enlace por si se quiere consultar el contexto y una explicación un poco más detallada del error: (http://osgeo-org.1560.n6.nabble.com/Error-en-la-edicion-de-geometrias-td4889279.html)

Resumen del bug:

He seguido avanzando en el estudio del problema, y he encontrado que en la
clase WKTParser.java, hay un método

private Geometry readLineStringText(StreamTokenizer tokenizer)

Entiendo que esta clase debería crear una geometría compatible con LineString, y sin embargo, crea una geometría Surface, que es de tipo POLYGON en lugar de LINESTRING.

He cambiado el código para que genere una geometría tipo Curve en lugar de Surface y ahora si que me funciona correctamente.

La cuestión es: ¿porqué se está creando una geometría tipo Surface en lugar de Curve? ¿Cambiar a Curve tendrá efectos colaterales?

Adjunto código de la corrección:
  • // IJM: Cambiado Surface por Curve
    Curve curve = (Curve) manager.create(TYPES.CURVE,
    SUBTYPES.GEOM2D);
    curve.setGeneralPath(gp);
    return curve;
  • }
/**
 *  Creates a LineString using the next token in the
stream. *
*@param tokenizer tokenizer over a stream of text in
Well-known Text * format. The next tokens must form a <LineString Text>.
*@return a LineString specified by the
next * token in the stream
*@throws IOException if an I/O error occurs
*@throws ParseException if an unexpected token was encountered * @throws CreateGeometryException * @throws IllegalAccessException * @throws InstantiationException
*/
private Geometry readLineStringText(StreamTokenizer tokenizer) throws
IOException, ParseException, CreateGeometryException {
Coordinate[] arrayC = getCoordinates(tokenizer);
GeneralPathX gp = new GeneralPathX();
gp.moveTo(arrayC0.x,arrayC0.y);
for (int i=1;i < arrayC.length; i++) {
gp.lineTo(arrayC[i].x, arrayC[i].y);
}

History

#1 Updated by María Maluenda almost 12 years ago

  • Assignee set to Juan Lucas Domínguez
  • Target version set to 2.0.0-rc1

#2 Updated by Juan Lucas Domínguez almost 12 years ago

  • Status changed from New to Fixed

gvsig-desktop:r38924

Added patch provided by Ildefonso Junquero (using Curve instead of Surface) and unit test.

#3 Updated by Juan Lucas Domínguez almost 12 years ago

I don't know how the testers can test this, so I have added a unit test that performs a validation test everytime the library is installed (the test is correctly passed) so I think testers don't need to test this so this bug can be closed now.

#4 Updated by Joaquín del Cerro Murciano almost 12 years ago

  • Target version changed from 2.0.0-rc1 to 2.0.0-devel-2055

#5 Updated by Vicent Domenech over 11 years ago

  • Status changed from Fixed to Closed

Also available in: Atom PDF