[OpenMap Users] getExtents() method returns rounded up/down coordinates?

From: B <gml.check.tool_at_gmail.com>
Date: Fri, 21 Jan 2011 21:16:22 +0900

Hi,

I am converting shp to gml3.2.1 then I'm having a problem during
getExtents because the float[] values are rounded up.

sample coordinates:

gml (successfully converted to shp):
<gml:Point gml:id="pt_1">
<gml:pos>35.682417 139.75306</gml:pos>
</gml:Point>

getExtents() value:
[35.68242, 139.75307, 35.68242, 139.75307]

After some investigation, the problem is converting double to float.
Please see the below code.
EsriGraphicFactory.java

protected EsriGraphic createPointGraphic(double x, double y,
Object representation,
DrawingAttributes drawingAttributes) {

if (dataTransformation != null) {
LatLonPoint llp = dataTransformation.inverse(x, y);
x = llp.getLongitude();
y = llp.getLatitude();
}

EsriGraphic ret = null;

if (representation == null) {
ret = new EsriPoint((float) y, (float) x);
} else if (representation instanceof ImageIcon) {
ret = new EsriIconPoint((float) y, (float) x, (ImageIcon) representation);
} else if (representation instanceof String) {
ret = new EsriTextPoint((float) y, (float) x, (String) representation,
OMText.JUSTIFY_CENTER);
}

if (drawingAttributes != null && ret != null) {
drawingAttributes.setTo((OMGraphic) ret);
}
return ret;
}

I think it is better to maintain the original value.
Please share your thoughts.

Regards

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Jan 21 2011 - 07:17:37 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:10 EDT