if (typeofn==='array'){n=newgoogle.maps.LatLng(n[0],n[1]);}// otherwise it should be a LatLng already
pa.push(n);
});
break;
case'encoded_polygon':
fillstyle=true;
case'encoded_line':
pa=(google.maps.geometry)?google.maps.geometry.encoding.decodePath(shape.path):[];// this trinary prevents errors if the google.maps gemoetry library wasn't loaded
break;
}
}
/**
* the shapes.style processing is a leftover from the gmaps v2
* code, and the shapes configuration system, from the php side
* of things.
*/
if (shape.style){
if (shape.style){
if (typeofshape.style==='string'){
if (typeofshape.style==='string'){// the style is an index for one of our vars.styles
if (obj.vars.styles[shape.style]){
if (obj.vars.styles[shape.style]){
style=obj.vars.styles[shape.style].slice();
style=obj.vars.styles[shape.style].slice();// copy the array
}
}
}
}
else{
else{
style=shape.style.slice();
style=shape.style.slice();// copy that array
}
style[0]='#'+style[0];// color
style[1]=Number(style[1]);// strokewidth
style[2]=style[2]/100;// strokeOpacity
if (fillstyle){
style[3]='#'+style[3];// fill colour
style[4]=style[4]/100;// fill opacity
}
}
}
style[0]='#'+style[0];
style[1]=Number(style[1]);
style[2]=style[2]/100;
if (fillstyle){
style[3]='#'+style[3];
style[4]=style[4]/100;
}
if (shape.type=='encoded_line'){
if (shape.type=='encoded_line'){
shape.color=style[0];
shape.color=style[0];
shape.weight=style[1];
shape.weight=style[1];
shape.opacity=style[2];
shape.opacity=style[2];
}
}
elseif (shape.type=='encoded_polygon'){
elseif (shape.type=='encoded_polygon'){
jQuery.each(shape.polylines,function(i,polyline){
if (shape.polylines){
polyline.color=style[0];
$.each(shape.polylines,function(i,polyline){
polyline.weight=style[1];
polyline.color=style[0];
polyline.opacity=style[2];
polyline.weight=style[1];
});
polyline.opacity=style[2];
shape.fill=true;
});
shape.color=style[3];
}
shape.opacity=style[4];
shape.fill=true;
shape.outline=true;
shape.color=style[3];
shape.opacity=style[4];
shape.outline=true;
}
}
}
jQuery.each(style,function (i,n){
// add any options to the configuration
cargs.push(n);
});
if (shape.opts){
if (shape.opts){
cargs.push(shape.opts);
$.extend(cargs,shape.opts);
}
varPg=function (args){
GPolygon.apply(this,args);
};
Pg.prototype=newGPolygon();
varPl=function (args){
GPolyline.apply(this,args);
};
Pl.prototype=newGPolyline();
varpolyObject={
path:coords,
strokeColor:style[0],
strokeWeight:style[1],
strokeOpacity:style[2],
fillColor:style[3],
fillOpacity:style[4],
}
}
/**
* In general: (inherited concepts. If you change these, make sure you check them on the php side of things)
* shape.color : color used for line and fill
* shape.weight : stroke weight in pixels
* shape.opacity : fill/stroke opacity in decimal value (0< opactity <1)
* shape.fill : boolean direction to fill the shape