Given a Map element, a Layer element, and a list of declarations,
        create a new Style element with a PolygonSymbolizer, add it to Map
        and refer to it in Layer.
422377
def get_polygon_rules(declarations):
    
    property_map = {'polygon-fill': 'fill', 'polygon-opacity': 'fill-opacity',
                    'polygon-gamma': 'gamma',
                    'polygon-meta-output': 'meta-output', 'polygon-meta-writer': 'meta-writer'}

    property_names = property_map.keys()
    
    # a place to put rules
    rules = []
    
    for (filter, values) in filtered_property_declarations(declarations, property_names):
        color = values.has_key('polygon-fill') and values['polygon-fill'].value
        opacity = values.has_key('polygon-opacity') and values['polygon-opacity'].value or None
        gamma = values.has_key('polygon-gamma') and values['polygon-gamma'].value or None
        symbolizer = color and output.PolygonSymbolizer(color, opacity, gamma)
        
        if symbolizer:
            rules.append(make_rule(filter, symbolizer))
    
    return rules
127002
private DefaultFeatureCollection sharedCreateFeatures(
            final LabelPositionCollector labels,
            final SimpleFeatureBuilder featureBuilder,
            final GridParam layerData,
            final MapfishMapContext mapContext,
            final double xSpace, final double ySpace,
            final double minX, final double minY) {
        // CSON: ParameterNumber
        GeometryFactory geometryFactory = new GeometryFactory();

        ReferencedEnvelope bounds = mapContext.toReferencedEnvelope();

        CoordinateReferenceSystem mapCrs = bounds.getCoordinateReferenceSystem();
        String unit = layerData.calculateLabelUnit(mapCrs);
        MathTransform labelTransform = layerData.calculateLabelTransform(mapCrs);

        final AxisDirection direction =
                bounds.getCoordinateReferenceSystem().getCoordinateSystem().getAxis(0).getDirection();
        int numDimensions = bounds.getCoordinateReferenceSystem().getCoordinateSystem().getDimension();
        Polygon rotatedBounds = GridUtils.calculateBounds(mapContext);
        AffineTransform worldToScreenTransform = GridUtils.getWorldToScreenTransform(mapContext);

        DefaultFeatureCollection features = new DefaultFeatureCollection();

        double pointSpacing = bounds.getSpan(1) / layerData.pointsInLine;
        int i = 0;
        for (double x = minX; x < bounds.getMaxX(); x += xSpace) {
            i++;
            final SimpleFeature feature = createFeature(featureBuilder, geometryFactory, layerData,
                                                        direction, numDimensions, pointSpacing, x,
                                                        bounds.getMinimum(1), i, 1);
            features.add(feature);
            GridUtils.topBorderLabel(labels, geometryFactory, rotatedBounds, unit, x,
                                     worldToScreenTransform, labelTransform, layerData.getGridLabelFormat());
            GridUtils.bottomBorderLabel(labels, geometryFactory, rotatedBounds, unit, x,
                                        worldToScreenTransform, labelTransform,
                                        layerData.getGridLabelFormat());
        }

        pointSpacing = bounds.getSpan(0) / layerData.pointsInLine;
        int j = 0;
        for (double y = minY; y < bounds.getMaxY(); y += ySpace) {
            j++;
            final SimpleFeature feature = createFeature(featureBuilder, geometryFactory, layerData,
                                                        direction, numDimensions, pointSpacing,
                                                        bounds.getMinimum(0), y, j, 0);
            features.add(feature);
            GridUtils.rightBorderLabel(labels, geometryFactory, rotatedBounds, unit, y,
                                       worldToScreenTransform, labelTransform,
                                       layerData.getGridLabelFormat());
            GridUtils.leftBorderLabel(labels, geometryFactory, rotatedBounds, unit, y,
                                      worldToScreenTransform, labelTransform, layerData.getGridLabelFormat());

        }

        return features;
    }
1312549
public static PolygonOptions createPolygonOptions(FeatureStyle featureStyle, float density) {

        PolygonOptions polygonOptions = new PolygonOptions();
        setFeatureStyle(polygonOptions, featureStyle, density);

        return polygonOptions;
    }
78510
function(map) {
        OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
        if (!this.tileOrigin) { 
            this.tileOrigin = new OpenLayers.LonLat(this.map.maxExtent.left,
                                                this.map.maxExtent.bottom);
        }                                       
    }
637042
def append(self, child, *args, **kwargs):
        """"""
        #if no set is associated with the layer yet, we learn it from span annotation elements that are added
        if self.set is False or self.set is None:
            if inspect.isclass(child):
                if issubclass(child,AbstractSpanAnnotation):
                    if 'set' in kwargs:
                        self.set = kwargs['set']
            elif isinstance(child, AbstractSpanAnnotation):
                if child.set:
                    self.set = child.set
            elif isinstance(child, Correction):
                #descend into corrections to find the proper set for this layer (derived from span annotation elements)
                for e in itertools.chain( child.new(), child.original(), child.suggestions() ):
                    if isinstance(e, AbstractSpanAnnotation) and e.set:
                        self.set = e.set
                        break

        return super(AbstractAnnotationLayer, self).append(child, *args, **kwargs)
1193328
public synchronized JaxRsClientFactory addFeatureMap(SetMultimap<JaxRsFeatureGroup, Feature> map) {
        return addFeatureMap(Multimaps.asMap(map));
    }
1274573
def add(self, element):
        """"""
        key = self._transform(element)
        if key not in self._elements:
            self._elements[key] = element
1359923
private Polygon addRing(Polygon polygon) {
		LinearRing interiorRing = polygon.getGeometryFactory().createLinearRing(new Coordinate[] {});
		AddRingOperation op = new AddRingOperation(interiorRing);
		index.setInteriorRingIndex(polygon.getNumInteriorRing());
		index.setExteriorRing(false);
		return (Polygon) op.execute(polygon);
	}
363469
public static org.osmdroid.views.overlay.Polygon addPolygonToMap(
        MapView map,
        org.osmdroid.views.overlay.Polygon polygon, PolygonOptions options) {

        if (options!=null) {
            polygon.setFillColor(options.getFillColor());
            polygon.setTitle(options.getTitle());
            polygon.setStrokeColor(options.getStrokeColor());
            polygon.setStrokeWidth(options.getStrokeWidth());
            polygon.setSubDescription(options.getSubtitle());
            polygon.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));

        }


        map.getOverlayManager().add(polygon);
        return polygon;
    }
1268501
protected void makeLayerElement() {
    plotwidth = StyleLibrary.SCALE;
    plotheight = StyleLibrary.SCALE / optics.getOPTICSPlot(context).getRatio();
    final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN);
    layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG);
    final String transform = SVGUtil.makeMarginTransform(getWidth(), getHeight(), plotwidth, plotheight, margin * .5, margin * .5, margin * 1.5, margin * .5);
    SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform);
  }
894190
public static PolygonSymbolizerInfo createPolygonSymbolizer(FillInfo fillInfo, StrokeInfo strokeInfo) {
		PolygonSymbolizerInfo symbolizerInfo = new PolygonSymbolizerInfo();
		symbolizerInfo.setFill(fillInfo);
		symbolizerInfo.setStroke(strokeInfo);
		return symbolizerInfo;
	}
569000
public static <K, V> MapWrapper<K, V> wrap(Map<K, V> map) {
		return new MapWrapper<K, V>(map);
	}
496230
function addLegend(layer, data, options) {
    data = data || {};
    if ( !this.options.fills ) {
      return;
    }

    var html = '<dl>';
    var label = '';
    if ( data.legendTitle ) {
      html = '<h2>' + data.legendTitle + '</h2>' + html;
    }
    for ( var fillKey in this.options.fills ) {

      if ( fillKey === 'defaultFill') {
        if (! data.defaultFillName ) {
          continue;
        }
        label = data.defaultFillName;
      } else {
        if (data.labels && data.labels[fillKey]) {
          label = data.labels[fillKey];
        } else {
          label= fillKey + ': ';
        }
      }
      html += '<dt>' + label + '</dt>';
      html += '<dd style="background-color:' +  this.options.fills[fillKey] + '">&nbsp;</dd>';
    }
    html += '</dl>';

    var hoverover = d3.select( this.options.element ).append('div')
      .attr('class', 'datamaps-legend')
      .html(html);
  }
1013619
function (map) {
            var key;
            for (key in map) {
                if (map.hasOwnProperty(key)) {
                    this.addInstance(key, map[key]);
                }
            }
            return this;
        }
167346
public int addMap(Map<String, Set<String>> addM) {
    int newTrans = 0;

    for (Map.Entry<String,Set<String>> me : addM.entrySet()) {
      String k = me.getKey();
      Set<String> addList = me.getValue();
      Set<String> origList = map.get(k);
      if (origList == null) {
        map.put(k, new LinkedHashSet<String>(addList));
        Set<String> newList = map.get(k);
        if (newList != null && newList.size() != 0) {
          newTrans+=addList.size();
        }
      } else {
        for (String toAdd : addList) {
          if (!(origList.contains(toAdd))) {
            origList.add(toAdd);
            newTrans++;
          }
        }
      }
    }
    return newTrans;
  }
1312301
function(node) {
            var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
                                                       "Polygon");
            var components = [];
            if(nodeList.length > 0) {
                var polygon;
                for(var i=0; i<nodeList.length; ++i) {
                    polygon = this.parseGeometry.polygon.apply(this,
                                                               [nodeList[i]]);
                    if(polygon) {
                        components.push(polygon);
                    }
                }
            }
            return new OpenLayers.Geometry.MultiPolygon(components);
        }
412429
public static <K, V> Map<K, V> newMap(Map<K, V> map) {
        return Optional.ofNullable(map).map(HashMap::new)
                .orElseGet(HashMap::new);
    }