Ticket #3343 (closed feature: fixed)

Opened 2 years ago

Last modified 21 months ago

methods for programmatic control of sketches while drawing

Reported by: tschaub Owned by: tschaub
Priority: minor Milestone: 2.11 Release
Component: Control.DrawFeature Version: 2.11 RC1
Keywords: Cc:
State:

Description

In many drawing applications, the user can both manually digitize points and specify coordinates or offsets for adding points to the current drawing.

Examples from ArcGIS Desktop:

In addition to these methods, it is useful to be able to finish a sketch without double-clicking (allowing the sketch to be completed without adding the point currently under the mouse) and cancel a sketch altogether.

Attachments

3343.patch Download (34.8 KB) - added by tschaub 2 years ago.
editing methods

Change History

Changed 2 years ago by tschaub

  • owner set to tschaub
  • status changed from new to assigned

Changed 2 years ago by tschaub

  • state set to Review

The attached patch adds the following API methods to the draw control:

  • insertXY
  • insertDeltaXY
  • insertDirectionLength
  • insertDeflectionLength
  • undo
  • redo
  • finishSketch
  • cancel

The use of these methods are demonstrated in two examples and in the handler tests. Tests pass and examples work on Chrome 12 and IE 6.

Thanks for any review.

Changed 2 years ago by bartvde

Reviewing this one now.

Changed 2 years ago by bartvde

Patch did not apply for me completely:

bart-van-den-eijndens-macbook-pro:ol_trunk bartvde$ patch -p0 < 3343.patch 
patching file tests/Handler/Path.html
patching file tests/Handler/Polygon.html
patching file tests/list-tests.html
patching file lib/OpenLayers/Control/DrawFeature.js
patching file lib/OpenLayers/Geometry/LinearRing.js
patching file lib/OpenLayers/Geometry/Collection.js
Hunk #1 FAILED at 183.
1 out of 3 hunks FAILED -- saving rejects to file lib/OpenLayers/Geometry/Collection.js.rej
patching file lib/OpenLayers/Geometry/LineString.js
patching file lib/OpenLayers/Handler/Polygon.js
patching file lib/OpenLayers/Handler/Path.js
patching file examples/draw-undo-redo.js
patching file examples/editing-methods.html
patching file examples/editing-methods.js
patching file examples/draw-undo-redo.html

Changed 2 years ago by bartvde

  • state changed from Review to Commit

Solid patch( full of trigonometry), nice work, some very minor remarks:

  • {Integer} instead of {Number} for getCurrentPointIndex
  • test_insertXY and test_insertDeltaXY have a duplicate testcase (the first one), the same is true for the other tests
  • the comment "Editing method tests: insertXY, insertDeltaXY, insertDirectionXY, ...." should be moved up 4 test cases
  • the change for list-tests.html is not meant for this patch

Good to go.

Changed 2 years ago by tschaub

editing methods

Changed 2 years ago by tschaub

Sorry for the tough to apply patch. I've updated it to apply cleanly against r12102.

Regarding the duplicated assertions, I'd like to keep them if you don't mind. I think the sequence of assertions is easier to interpret than just a single assertion (first assert 3 points, then add point, then assert 4 points).

Thanks for the review.

Changed 2 years ago by tschaub

  • status changed from assigned to closed
  • resolution set to fixed

(In [12103]) Methods for programmatically manipulating sketches while digitizing features. r=bartvde (closes #3343)

Changed 21 months ago by tschaub

  • state Commit deleted
  • version changed from 2.10 to 2.11 RC1
  • milestone changed from 2.12 Release to 2.11 Release
Note: See TracTickets for help on using tickets.