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

strange behaviour of semicircle, arc on wrong site #22

Open
it4workflow opened this issue Jul 10, 2017 · 6 comments
Open

strange behaviour of semicircle, arc on wrong site #22

it4workflow opened this issue Jul 10, 2017 · 6 comments

Comments

@it4workflow
Copy link

it4workflow commented Jul 10, 2017

i use semicircle to display the direction tag of openstreetmap. have a look at viewpoint-direction. there you can see some semicircles, which were incorrectly drawn:

  • this one, the lines are correct 270° to 22°, but the arc is on the wrong site. same here from 67° to 135°
  • this and this have only one direction and should have a size of 45°. here it works fine.

So what have i missed?

@it4workflow
Copy link
Author

i've now experimented with the size (direction=270):

  • undefined:
    image
  • 30°:
    image
  • 60°:
    image
  • 90°:
    image

@jieter
Copy link
Owner

jieter commented Jul 11, 2017

@it4workflow I tested with this example page: http://jieter.github.io/Leaflet-semicircle/examples/semicircle.html, which still looks good to me, but I released the latest version in a bit of a hurry, so I might have missed something. You could try to use 0.1.2 (note the different syntax).
You could really help by providing an isolated test case, for example in a playground leaflet. Unfortunately, I'v got no time to dig through your app code...

@it4workflow
Copy link
Author

Okay, i've played a little bit, what's about this one. The view of this viewpoint is from 270° to 22° (to NNW 337°) , the lines are correct, but the arc is wrong

@it4workflow
Copy link
Author

i figured out a little bit, the problem only occurs with usage of start-/stopangle and startAngle>stopAngle. I'ved rewrite my code, manually determine the direction and size and call your setDirection-method.
So now everything is fine.

@jieter jieter reopened this Jul 23, 2017
@jieter
Copy link
Owner

jieter commented Jul 23, 2017

I suspected something like that, but we could try to do better on rendering in those cases... Reopened. If someone has time to make a fix, please open a PR.

@osmtools
Copy link

Just yesterday i read the discussion about direction for viewpoint in the OpenStreetMap wiki. And there's an interessting point: the stopAngle always has to be bigger than the startAngle - especially if the calculation is done by modulo 360.

In the playground example above, i've used startAngle=270 and stopAngle=22 (because this are the values stored in database) to get a view from west via north to northnorthwest. But you fix and correct this with the if conditions in start-/stopAngle methods ... and now i think this is right and ok.
With this unterstanding i've used startAngle=270 and stopAngle=382 (22+360) in this playground example and this is ok.

So i think, if you mention that circumstance in your documentation it should be fine.

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

3 participants