[OpenLayers-Users] How to handle a GeometryCollection Feature

Max Weidemann max.weidemann at freenet.de
Wed Aug 26 06:55:26 EDT 2009


Hi everybody

i have tested a little bit and have found an solution, but i dont know if it
the best way!

At first i got the geometrycollection feature wich i would like to add a
geometry.
Then i create a new geometrycollection with the geometry of the feature i
had found.
In this new geometry i'm able to add the new geometry.
After that i remove the old collection from the layer and add the new to it.

Is there a better way??
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Also i got a new problem with Styling my GeometryCollections!

I have an StyleMap for my Layer wich looks like this:

	var style = {
		"default" : new OpenLayers.Style(null, {
			rules : [ new OpenLayers.Rule( {
				symbolizer : {
					"Point" : {
						pointRadius : pointRadius,
						graphicName : graphicName,
						fillColor : fillColor,
						fillOpacity : fillOpacity,
						strokeWidth : strokeWidth,
						strokeOpacity : strokeOpacity,
						strokeColor : strokeColor,
						label : label,
						fontColor : fontColor,
						fontSize : fontSize,
						fontFamily : fontFamily,
						fontWeight : fontWeight,
						labelAlign : labelAlign
					},
					"Line" : {
						strokeWidth : strokeWidth,
						strokeOpacity : strokeOpacity,
						strokeColor : strokeColor
					},
					"Polygon" : {
						strokeWidth : strokeWidth,
						strokeOpacity : strokeOpacity,
						fillColor : fillColor,
						strokeColor : strokeColor
					},

				}
			}) ]
		}),
		"select" : new OpenLayers.Style(null, {
			rules : [ new OpenLayers.Rule( {
				symbolizer : {
					"Point" : {
						pointRadius : 5,
						graphicName : "square",
						fillColor : "#0000ff",
						fillOpacity : 0.25,
						strokeWidth : 3,
						strokeOpacity : 1,
						strokeColor : "#0000ff"

					},
					"Line" : {
						strokeWidth : 3,
						strokeOpacity : 1,
						strokeColor : "#0000ff"
					},
					"Polygon" : {
						strokeWidth : 3,
						strokeOpacity : 1,
						fillColor : "#0000ff",
						strokeColor : "#0000ff"
					},

				}
			}) ]
		}),
		"temporary" : new OpenLayers.Style(null, {
			rules : [ new OpenLayers.Rule( {
				symbolizer : {
					"Point" : {
						graphicName : "square",
						pointRadius : 5,
						fillColor : "white",
						fillOpacity : 0.25,
						strokeWidth : 2,
						strokeColor : "#ff0000"
					},
					"Line" : {
						strokeWidth : 3,
						strokeOpacity : 1,
						strokeColor : "#ff0000"
					},
					"Polygon" : {
						strokeWidth : 2,
						strokeOpacity : 1,
						strokeColor : "#ff0000",
						fillColor : "#ff0000"
					}
				}
			}) ]
		})
	}

If i use this Sytlemap the geometrycollection features are not affected by
it only Point Lines and Poylgons are styled in the right way, because of the
symbolizers.
Are there more special symbolizer or is the only Solution to take one Style
for every feature???

Thanks for any Help
Max
-- 
View this message in context: http://n2.nabble.com/How-to-handle-a-GeometryCollection-Feature-tp3509578p3514702.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list