Ticket #3310 (new bug)

Opened 2 years ago

Last modified 20 months ago

DrawFeature control in freehand mode produces invalid geometries

Reported by: rayd Owned by: tschaub
Priority: minor Milestone: 2.13 Release
Component: Handler.Path Version: SVN
Keywords: geometry Cc: rayd
State: Needs Discussion

Description

To test this out I used the the draw feature example here:  http://dev.openlayers.org/releases/OpenLayers-2.10/examples/draw-feature.html

Use a DrawFeature control in freehand mode with a Path handler to draw a line. Instead of dragging the mouse, just click once -- you will get a feature with a LINESTRING geometry with only one point. You can use a tool like Firebug to inspect the created features. Similarly, use a DrawFeature control in freehand mode with a Polygon handler. Just click once on the map, and you will get a feature with a POLYGON geometry with a LinearRing geometry with only two points. This shouldn't happen since those are technically invalid geometries.

I would think in this situation we're just better off not adding the feature to the layer in the first place.

Attachments

3310.0.patch Download (3.3 KB) - added by jorix 2 years ago.
Add tests pending. Requires #3311
3310.1.patch Download (8.6 KB) - added by jorix 2 years ago.
It's simpler, and add tests.

Change History

Changed 2 years ago by jorix

Add tests pending. Requires #3311

Changed 2 years ago by jorix

It's simpler, and add tests.

  Changed 2 years ago by jorix

  • owner set to tschaub
  • state set to Review
  • version changed from 2.10 to SVN
  • component changed from Control.DrawFeature to Handler.Path

This problem is due to two bugs. One in up method of Handler.Path and the other in the clone method of Geometry.LinearRing (see #3311)

3310.1.patch Download requires patch  3311.3.patch

  Changed 2 years ago by jorix

  • cc xavier.mamano@… added

follow-up: ↓ 4   Changed 2 years ago by erilem

  • state changed from Review to Needs Discussion
  • milestone changed from 2.11 Release to 2.12 Release

No need freehand to draw invalid geometries, one can easily draw two-point polygons for example. At this point I don't know whether we want to disallow drawing invalid geometries.

I think the discussion should happen outside the 2.11 scope. Please set the milestone back to 2.11 if you think otherwise.

Btw, could you confirm that these bugs existed in 2.10?

in reply to: ↑ 3 ; follow-up: ↓ 5   Changed 2 years ago by jorix

Replying to erilem:

I think the discussion should happen outside the 2.11 scope. Please set the milestone back to 2.11 if you think otherwise.

"rayd" put it in 2.11 and I do not touch. For me is OK in 2.12

Btw, could you confirm that these bugs existed in 2.10?

Yes 2.10, 2.9 and 2.8 and I have not tested further back.

in reply to: ↑ 4   Changed 2 years ago by rayd

Oh I had only put in 2.11 since it hadn't been released yet and was following the bug reporting protocol. I'm alright with it being in 2.12 -- I don't see why we'd want to allow invalid geometries, but you're right that it shouldn't hold up 2.11.

Replying to jorix:

Replying to erilem:

I think the discussion should happen outside the 2.11 scope. Please set the milestone back to 2.11 if you think otherwise.

"rayd" put it in 2.11 and I do not touch. For me is OK in 2.12

Btw, could you confirm that these bugs existed in 2.10?

Yes 2.10, 2.9 and 2.8 and I have not tested further back.

  Changed 20 months ago by jorix

  • cc xavier.mamano@… removed

I see no need to work more on this subject, I agree with what he says erilem:

"No need freehand to draw invalid geometries, one can easily draw two-point polygons for example. At this point I don't know whether we want to disallow drawing invalid geometries."

Note: See TracTickets for help on using tickets.