#23293 closed Bug (fixed)

OSMapWidget.js error when use GeometryCollectionField

Reported by: koyoyo Owned by: nobody
Component: GIS Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

On method getControls at line 357, there are only check on line, point and polygon but when use GeometryCollection it didn't check anything so it will error on method enableDrawing at line 350

this.map.getControlsByClass('OpenLayers.Control.DrawFeature')[0].activate();

So we must check on method getControls when geom_name is GeometryCollection to enable line, point and polygon like this.

if (this.options.geom_name.indexOf('GeometryCollection') >= 0) {
        this.controls.push(new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}));
        this.controls.push(new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'}));
        this.controls.push(new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}));
    }

Change History (1)

comment:1 Changed 11 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to fixed
  • Status changed from new to closed

Thanks for the report. I added a fix while backporting other errors reported in #23137 ([f5e8376288783554e4da39], 1.7: [2cbafd814f151b8c926], master: [12adcd505ebe8159cf4].

Note: See TracTickets for help on using tickets.
Back to Top