Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curve Class Doesn't Work? (Attempting arc between two points) #28

Open
Glchriste opened this issue Feb 26, 2015 · 0 comments
Open

Curve Class Doesn't Work? (Attempting arc between two points) #28

Glchriste opened this issue Feb 26, 2015 · 0 comments

Comments

@Glchriste
Copy link

I would like to display an arc on a map that connects two points. Ultimately, I would like to achieve something like this with GWT-OpenLayers:

Arc.js seems to do this well also: https://www.mapbox.com/mapbox.js/example/v1.0.0/arcjs/

Does GWT-OpenLayers support arcs like this? I cannot get the Curve class to display anything on a map, and I cannot find a working Curve example online. The closest examples I can find only let the user click multiple points, which are then connected by joint line segments... I would like to create arcs (or pseudo-arcs via line segments) that do not depend on user mouse input.

Here's an example for how I assume you use the Curve class, it may be incorrect.

//Use of Curve object. Does not show anything on the map.
Point midPoint = //midpoint calculation
Point midPointWithYOffset = new Point(midPoint.getX(), midPoint.getY()+10.0);
points[0] = startPoint;
points[1] = midPointWithYOffset; //to get a curve rather than a straight line
points[2] = endPoint;
VectorFeature feature = new VectorFeature(new Curve(points));

This results in nothing displaying on the map. However, if I change "Curve" to "LineString" (and ONLY if points[1] = midPoint //without Y offset), a straight line appears on the map just fine.

  • Using LineString: if I attempt to choose a point that is not directly on the shortest straight line between the startPoint and endPoint, nothing shows on the map.
  • Using Curve: I haven't been able to get this to work at all.
//Use of LineString object that does show a straight line on the map
Point midPoint = //midpoint calculation
points[0] = startPoint;
points[1] = midPoint;
points[2] = endPoint;
VectorFeature feature = new VectorFeature(new LineString(points));
//Use of LineString object that does not show anything on the map.
Point midPoint = //midpoint calculation
Point midPointWithYOffset = new Point(midPoint.getX(), midPoint.getY()+10.0);
points[0] = startPoint;
points[1] = midPointWithYOffset; //to get a curve rather than a straight line
points[2] = endPoint;
VectorFeature feature = new VectorFeature(new LineString(points));

I would be grateful for any knowledge the users here have. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant