[OpenLayers-Trac] Re: [OpenLayers] #3494: OpenLayers.Util.isArray issue with custom Array

OpenLayers trac-20090302 at openlayers.org
Sun Sep 11 15:20:32 EDT 2011


#3494: OpenLayers.Util.isArray issue with custom Array
------------------------------+---------------------------------------------
 Reporter:  johanhasselstrom  |       Owner:                        
     Type:  bug               |      Status:  new                   
 Priority:  minor             |   Milestone:  2.12 Release          
Component:  Util              |     Version:  2.11 RC3              
 Keywords:                    |       State:  Awaiting User Feedback
------------------------------+---------------------------------------------

Comment(by johanhasselstrom):

 The issue is inside the library when feeding e.g OpenLayers.Geometry
 .LinearRing-cunstructor a custom array of points:


 {{{
 var MyArray = function(){};
 MyArray.prototype = new Array();

 var p1 = new OpenLayers.Geometry.Point(1,1);
 var p2 = new OpenLayers.Geometry.Point(1,2);

 var pointArray = new MyArray();
 pointArray.push(p1);
 pointArray.push(p2);

 var linearRing = new OpenLayers.Geometry.LinearRing(pointArray);
 }}}

 The addComponents -function of OpenLayers.Geometry.Collection wraps the
 components in an additional array if the call to isArray is false, this
 results in issues down the road.

 For now I have implemented a toArray -function in my custom array that
 creates a standard javascript-array from the custom array. I'm fine with
 this solution even though it would be nice if the custom-array was
 supported.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3494#comment:3>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list