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

feature: circle and square as polygon draw shapes #2013

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

jokd
Copy link
Contributor

@jokd jokd commented May 22, 2024

Fixes #2012
Configure the draw control like this to be able to draw squares and circles:

 {
  "name": "draw",
  "options": {
    "buttonText": "Rita",
    "drawTools": {
      "Polygon": ["freehand", "box", "square", "circle"],
      "LineString": ["freehand"]
    }
  }
}

@jokd
Copy link
Contributor Author

jokd commented May 22, 2024

The measurement values are perhaps a bit off since I use the circle radius and calculate it. Tested to convert the circle to a polygon and use the usual getArea function but the values seemed a bit low and I thought maybe it's because the circle getting chopped up in multiple segments.
Somebody with a bit of free time can do some control measuring and reply.

@asemoller
Copy link
Contributor

Works fine!

I did some checking against a calculator and the area and perimeter are within the margin for rounding. So I guess it's ok or did you have something else in mind?

image

I'll submitt an issue about the problem with decimals in a day or two.

@huggla
Copy link
Contributor

huggla commented Jun 11, 2024

Works fine for me too.

@Flodkvist Flodkvist merged commit a8c298d into origo-map:master Jun 12, 2024
3 checks passed
@huggla huggla mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Circle and square as draw shapes
5 participants