Ticket #3407 (closed feature: fixed)

Opened 23 months ago

Last modified 23 months ago

Option to always write Multi geometries

Reported by: ahocevar Owned by: tschaub
Priority: minor Milestone: 2.12 Release
Component: Format.WFST Version: SVN
Keywords: Cc:
State: Commit

Description

In the DrawFeature control, we have a multi option to make sure that the geometries we create are MultiPoint, MultiLineString or MultiPolygon geometries. In a WFS context, it may be necessary to always write Multi geometries, even if they were read as plain geometries. This ticket suggests adding a multi option to the WFST format's write method.

Attachments

openlayers-3407.patch Download (6.4 KB) - added by ahocevar 23 months ago.
openlayers-3407.2.patch Download (4.2 KB) - added by ahocevar 23 months ago.
nicer approach using the GML format's geometryTypes mapping
openlayers-3407.3.patch Download (7.7 KB) - added by ahocevar 23 months ago.
openlayers-3407.4.patch Download (7.8 KB) - added by ahocevar 23 months ago.
final patch, incorporates all review comments.

Change History

Changed 23 months ago by ahocevar

  Changed 23 months ago by ahocevar

  • state set to Review
  • version changed from 2.10 to SVN

Tests pass in Safari5. Thanks for any review.

  Changed 23 months ago by bartvde

  • state changed from Review to Commit

Hi Andreas, one minor issue: geometry is missing var keyword. Respective tests also pass in FF5. Please commit.

  Changed 23 months ago by ahocevar

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

(In [12168]) giving the WFST format a multi option, which makes sure that Multi geometries are written in transactions. r=bartvde (closes #3407)

  Changed 23 months ago by ahocevar

  • state changed from Commit to Review

Please consider this improvement. Tests pass in Safari5. Thanks for any review.

Changed 23 months ago by ahocevar

nicer approach using the GML format's geometryTypes mapping

  Changed 23 months ago by ahocevar

  • status changed from closed to reopened
  • resolution fixed deleted

follow-up: ↓ 7   Changed 23 months ago by bartvde

  • state changed from Review to Needs More Work

Hey Andreas, a few remarks:

  • using your current patch I cannot create a multi mapping for only lines for instance. Can we allow people to define their own multiGeometryTypes?
  • can we avoid expressions with side effects on the right side of logical operators? ( http://docstore.mik.ua/orelly/webprog/jscript/ch05_07.htm) This also avoids jslint warnings.
  • I have a failing test in FF5: test_write_multi planned 2 assertions but got 0; fail 0 ok 0, exception: : object: this.writers[prefix][local] is undefined

in reply to: ↑ 6   Changed 23 months ago by ahocevar

Thanks Bart for the review. Replying to bartvde:

* using your current patch I cannot create a multi mapping for only lines for instance. Can we allow people to define their own multiGeometryTypes?

This also is not possible with the current solution, so I'd suggest making a new ticket for this if it is needed.

* can we avoid expressions with side effects on the right side of logical operators? ( http://docstore.mik.ua/orelly/webprog/jscript/ch05_07.htm) This also avoids jslint warnings.

No such expression was in the previous patch, but I'm using a different approach in the new one which I hope you like better :-).

* I have a failing test in FF5: test_write_multi planned 2 assertions but got 0; fail 0 ok 0, exception: : object: this.writers[prefix][local] is undefined

Hm. Never underestimate the power of the browser cache. You are right, the tests failed for me as well. In fact this approach requires more changes.

New patch attached, tests now really pass. Thanks for another review.

Changed 23 months ago by ahocevar

  Changed 23 months ago by ahocevar

  • state changed from Needs More Work to Review

  Changed 23 months ago by bartvde

  • state changed from Review to Commit

Hey Andreas,

this is good to go now, thanks for the work on this, 2 remarks:

  • some of the for loops miss the use of var len
  • I still get jslint errors on some of the code, e.g.:
options.multi === true && this.setGeometryTypes();

gives: Expected an assignment or function call and instead saw an expression.

why not just use:

if (options.multi === true) {
    this.setGeometryTypes();
}

?

  Changed 23 months ago by ahocevar

Thanks Bart for the continued reviewing efforts. I'll remove the ternary operator without assignment use and replace it with if statements. But regarding the len, I haven't changed any of the loops, and var len is properly defined above the first loop that uses it.

  Changed 23 months ago by ahocevar

Bart, thanks for the explanation on IRC. Although these loops were not optimized before my patch, I'm going to optimize them before I commit.

Changed 23 months ago by ahocevar

final patch, incorporates all review comments.

  Changed 23 months ago by ahocevar

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

(In [12171]) reassign writers instead of creating a different geometry instance. r=bartvde (closes #3407)

Note: See TracTickets for help on using tickets.