You should create a ticket and attach a sample feature that holds a 
geometry collection as an example.

Best regards,

Alexandre

(1) http://faq.openlayers.org/map/how-do-i-edit-the-wiki-or-a-ticket/
(2) http://trac.openlayers.org/wiki/FilingTickets

taviroquai wrote:
> Hi all,
>
> WKT.write method accepts a single feature OR an array of features which then
> returns as a GEOMETRYCOLLECTION.
>
> There is a case that a single feature may hold a geometry collection class.
>
> Here is my changes for the write method - I know that this is not the best
> way to resolve this case but this is the shortest code insertion - all
> feedback is welcome:
>
> write:function(features){
>                       var 
> collection,geometry,type,data,isCollection,isSubCollection;
>                       if(features.constructor==Array){
>                               collection=features;
>                               isCollection=true;
>                       }
>                       else{
>                               
> type=features.geometry.CLASS_NAME.split('.')[2].toLowerCase();
>                               if (type == 'collection') {
>                                       collection = 
> features.geometry.components;
>                                       isCollection=true;
>                                       isSubCollection=true;
>                               }
>                               else {
>                                       collection=[features];
>                                       isCollection=false;
>                               }
>                       }
>                       var pieces=[];
>                       if(isCollection){
>                               pieces.push('GEOMETRYCOLLECTION(');
>                       }
>                       for(var i=0,len=collection.length;i<len;++i){
>                               if(isCollection&&i>0){
>                                       pieces.push(',');
>                               }
>                               if (isSubCollection) geometry=collection[i]; 
> else
> geometry=collection[i].geometry;
>                               
> type=geometry.CLASS_NAME.split('.')[2].toLowerCase();
>                               if(!this.extract[type]){
>                                       return null;
>                               }
>                               
> if(this.internalProjection&&this.externalProjection){
>                                       geometry=geometry.clone();
>                                       
> geometry.transform(this.internalProjection,this.externalProjection);
>                               }
>                               data=this.extract[type].apply(this,[geometry]);
>                               pieces.push(type.toUpperCase()+'('+data+')');
>                       }
>                       if(isCollection){
>                               pieces.push(')');
>                       }
>                       return pieces.join('');
>               }, 
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to