- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Whanger, Thomas <thomas.whanger_at_zeltech.com>

Date: Mon, 1 Nov 2004 15:02:42 -0500

Hello,

The com.bbn.openmap.dataAccess.shape.EsriPolygonList.convert(OMCircle,

Projection) method converts the given OMCircle to an OMPoly using the given

Projection, and it works great for circles with a larger radius.

However, if the radius is less than approximately 0.2 decimal degrees, then

the converted OMPoly is a rectangle or triangle (not a circular shaped

polygon). In addition, if the radius is less than 0.04 decimal degrees,

then the converted OMPoly is a vertical line (not a circular shaped

polygon).

Does anyone know why this method fails for these circles with a smaller

radius and/or how to get the method to work with these circles with a

smaller radius? Any help is greatly appreciated.

Thanks,

-Tom

Here is the method's code:

//converts circles into polygons

public static OMPoly convert(OMCircle omCircle, Projection proj) {

GeneralPath shape = omCircle.getShape();

//get the PathIterator that defines the outline of the circle

PathIterator circle = shape.getPathIterator(null);

Vector initialPoints = new Vector();

float[] segPoints = new float[2];

while (!circle.isDone()) {

//by passing segpoints the array is filled with each x\y point

//iterated by the circle

int segType = circle.currentSegment(segPoints);

initialPoints.add(new Float(segPoints[0]));

initialPoints.add(new Float(segPoints[1]));

circle.next();

}

float[] circlePoints = new float[initialPoints.size()];

if (proj == null) {

return null;

}

//convert the x/y points to lat/lon points

for (int p = 0; p < initialPoints.size(); p += 2) {

LatLonPoint llp = proj.inverse(

((Float)initialPoints.elementAt(p)).intValue(),

((Float)initialPoints.elementAt(p + 1)).intValue());

circlePoints[p] = llp.getLatitude();

circlePoints[p + 1] = llp.getLongitude();

}

//using the circle data create an OMPoly

OMPoly poly = new OMPoly(circlePoints, OMGraphic.DECIMAL_DEGREES,

omCircle.getLineType());

poly.setAppObject(omCircle.getAppObject());

DrawingAttributes da = new DrawingAttributes();

da.setFrom(omCircle);

da.setTo(poly);

return poly;

}

Date: Mon, 1 Nov 2004 15:02:42 -0500

Hello,

The com.bbn.openmap.dataAccess.shape.EsriPolygonList.convert(OMCircle,

Projection) method converts the given OMCircle to an OMPoly using the given

Projection, and it works great for circles with a larger radius.

However, if the radius is less than approximately 0.2 decimal degrees, then

the converted OMPoly is a rectangle or triangle (not a circular shaped

polygon). In addition, if the radius is less than 0.04 decimal degrees,

then the converted OMPoly is a vertical line (not a circular shaped

polygon).

Does anyone know why this method fails for these circles with a smaller

radius and/or how to get the method to work with these circles with a

smaller radius? Any help is greatly appreciated.

Thanks,

-Tom

Here is the method's code:

//converts circles into polygons

public static OMPoly convert(OMCircle omCircle, Projection proj) {

GeneralPath shape = omCircle.getShape();

//get the PathIterator that defines the outline of the circle

PathIterator circle = shape.getPathIterator(null);

Vector initialPoints = new Vector();

float[] segPoints = new float[2];

while (!circle.isDone()) {

//by passing segpoints the array is filled with each x\y point

//iterated by the circle

int segType = circle.currentSegment(segPoints);

initialPoints.add(new Float(segPoints[0]));

initialPoints.add(new Float(segPoints[1]));

circle.next();

}

float[] circlePoints = new float[initialPoints.size()];

if (proj == null) {

return null;

}

//convert the x/y points to lat/lon points

for (int p = 0; p < initialPoints.size(); p += 2) {

LatLonPoint llp = proj.inverse(

((Float)initialPoints.elementAt(p)).intValue(),

((Float)initialPoints.elementAt(p + 1)).intValue());

circlePoints[p] = llp.getLatitude();

circlePoints[p + 1] = llp.getLongitude();

}

//using the circle data create an OMPoly

OMPoly poly = new OMPoly(circlePoints, OMGraphic.DECIMAL_DEGREES,

omCircle.getLineType());

poly.setAppObject(omCircle.getAppObject());

DrawingAttributes da = new DrawingAttributes();

da.setFrom(omCircle);

da.setTo(poly);

return poly;

}

-- [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 Mon Nov 01 2004 - 14:50:44 EST

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