<p>Clones the given {@link Bbox} and applies the margins
of this {@link MapAddon} and its parent (if present) on it.</p>

@param bounds
@param group
@return cloned bounds with the margins applied to it's x and y
485235
public Bbox applyMargins(Bbox bounds) {
		Bbox applied = (Bbox) bounds.clone();
		Coordinate c = getUpperLeftCorner();
		Double x = c.getX();
		Double y = c.getY();
		if (null != group && group instanceof MapAddon && group != this) {
			Coordinate pc = ((MapAddon) group).getUpperLeftCorner();
			x += pc.getX();
			y += pc.getY();
		}
		applied.setX(x + applied.getX());
		applied.setY(y + applied.getY());
		return applied;
	}
283348
public static Geometry toPolygon(Bbox bounds) {
		double minX = bounds.getX();
		double minY = bounds.getY();
		double maxX = bounds.getMaxX();
		double maxY = bounds.getMaxY();

		Geometry polygon = new Geometry(Geometry.POLYGON, 0, -1);
		Geometry linearRing = new Geometry(Geometry.LINEAR_RING, 0, -1);

		linearRing.setCoordinates(new Coordinate[] { new Coordinate(minX, minY), new Coordinate(maxX, minY),
				new Coordinate(maxX, maxY), new Coordinate(minX, maxY), new Coordinate(minX, minY) });
		polygon.setGeometries(new Geometry[] { linearRing });
		return polygon;
	}
938784
public ESRIBounds createUnion(ESRIBounds bounds) {
		final ESRIBounds eb = new ESRIBounds();
		eb.minx = (bounds.minx < this.minx) ? bounds.minx : this.minx;
		eb.maxx = (bounds.maxx < this.maxx) ? this.maxx : bounds.maxx;
		eb.miny = (bounds.miny < this.miny) ? bounds.miny : this.miny;
		eb.maxy = (bounds.maxy < this.maxy) ? this.maxy : bounds.maxy;
		eb.minz = (bounds.minz < this.minz) ? bounds.minz : this.minz;
		eb.maxz = (bounds.maxz < this.maxz) ? this.maxz : bounds.maxz;
		eb.minm = (bounds.minm < this.minm) ? bounds.minm : this.minm;
		eb.maxm = (bounds.maxm < this.maxm) ? this.maxm : bounds.maxm;
		return eb;
	}
181821
public PropertyConstraint inGroup(String propertyName, Object[] group) {
        return value(propertyName, new InGroup(group));
    }
926912
public Set<Entry<String, String>> entrySet(String group) {
		return this.groupedMap.entrySet(group);
	}
1007926
function(bounds) {
        var equals = false;
        if (bounds != null) {
            equals = ((this.left == bounds.left) && 
                      (this.right == bounds.right) &&
                      (this.top == bounds.top) && 
                      (this.bottom == bounds.bottom));
        }
        return equals;
    }
711359
@Override
	public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) {
		if (googleMap != null) {
			String sourceCrs = map.getMapModel().getCrs();
			if (isGoogleProjection(sourceCrs)) {
				int zoomLevel = calcZoomLevel(map.getMapModel().getMapView().getCurrentScale());
				Coordinate latLon = convertToLatLon(bounds.getCenterPoint());
				fitGoogleMapBounds(googleMap, latLon, zoomLevel);
			} else {
				// transform on server
				TransformGeometryRequest request = new TransformGeometryRequest();
				request.setBounds(new org.geomajas.geometry.Bbox(bounds.getX(), bounds.getY(), bounds.getWidth(),
						bounds.getHeight()));
				request.setSourceCrs(map.getMapModel().getCrs());
				request.setTargetCrs(EPSG_3857);
				GwtCommand command = new GwtCommand(TransformGeometryRequest.COMMAND);
				command.setCommandRequest(request);
				GwtCommandDispatcher.getInstance().execute(command,
						new AbstractCommandCallback<TransformGeometryResponse>() {

							public void execute(TransformGeometryResponse response) {
								Bbox google = new Bbox(response.getBounds());
								int zoomLevel = calcZoomLevelFromBounds(google);
								fitGoogleMapBounds(googleMap, convertToLatLon(google.getCenterPoint()), zoomLevel);
							}
						});
			}
		}
	}
151847
public QueryAtomGroupImpl bind(QueryBinding binding) {
        QueryAtomGroupImpl group = new QueryAtomGroupImpl();
        for (QueryAtom atom : atoms) {
            group.addAtom(atom.bind(binding));
        }
        return group;
    }
339734
public static BoundingBox getProjectedBoundingBox(Long projectionEpsg,
			TileGrid tileGrid, int zoom) {
		return getProjectedBoundingBox(ProjectionConstants.AUTHORITY_EPSG,
				projectionEpsg, tileGrid, zoom);
	}
1069403
function layoutGroupContent(groupIndex, realizedItemRange, doRealizedRange) {
                        var group = that._groups[groupIndex],
                            firstChangedIndexInGroup = Math.max(0, changedRange.firstIndex - group.startIndex),
                            realizedItemRangeInGroup = that._rangeForGroup(group, realizedItemRange),
                            beforeRealizedRange;

                        if (doRealizedRange) {
                            group.layoutRealizedRange(firstChangedIndexInGroup, realizedItemRangeInGroup);
                        } else {
                            if (!realizedItemRangeInGroup) {
                                beforeRealizedRange = (group.startIndex + group.count - 1 < realizedItemRange.firstIndex);
                            }

                            return group.layoutUnrealizedRange(firstChangedIndexInGroup, realizedItemRangeInGroup, beforeRealizedRange);
                        }
                    }
761637
@Pure
	protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
		final Rectangle2d bounds = getBoundingBox();
		assert bounds != null;
		return bounds.intersects(rectangle);
	}
125772
public final Bounds intersect(Bounds b) {
		final long _min = Math.max(this.min, b.min);
		final long _max = Math.min(this.max, b.max);
		if(_min <= _max) return new Bounds(_min, _max);
		return null;
	}
86521
public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) {
		map.getVectorContext().drawGroup(group, this);

		// Draw a dummy at 0,0 so that Internet Explorer knows where coordinate 0,0 is. If this is not drawn, the text
		// will disappear, because the parent group will have coordinate 0,0 at the upper left corner of the union of
		// all the rectangles that are drawn here.
		map.getVectorContext().drawRectangle(this, dummy.getId(), dummy.getBounds(), dummy.getStyle());

		image.getBounds().setX(getUpperLeftCorner().getX());
		image.getBounds().setY(getUpperLeftCorner().getY());

		map.getVectorContext().drawRectangle(this, getId() + "-bg", image.getBounds(),
				new ShapeStyle("#FFFFFF", 0.6f, "#FFFFFF", 0, 0));
		map.getVectorContext().drawImage(this, image.getId(), image.getHref(), image.getBounds(),
				(PictureStyle) image.getStyle());
	}
1031686
private void setMapForKeyGroup(int keyGroupId, Map<N, Map<K, S>> map) {
		try {
			state[indexToOffset(keyGroupId)] = map;
		} catch (ArrayIndexOutOfBoundsException e) {
			throw new IllegalArgumentException("Key group index " + keyGroupId + " is out of range of key group " +
				"range [" + keyGroupOffset + ", " + (keyGroupOffset + state.length) + ").");
		}
	}
239166
function(bounds) {
        bounds = bounds.clone();
        if (this.layer.map.baseLayer.wrapDateLine) {
            var worldExtent = this.layer.map.getMaxExtent(),
                tolerance = this.layer.map.getResolution();
            bounds = bounds.wrapDateLine(worldExtent, {
                leftTolerance: tolerance,
                rightTolerance: tolerance
            });
        }
        this.bounds = bounds;
    }
757975
public Map<String, String> getMap(String group) {
		final LinkedHashMap<String, String> map = this.groupedMap.get(group);
		return (null != map) ? map : new LinkedHashMap<String, String>(0);
	}
922476
function _LayoutCommon_ensureContainerSize(group) {
                    var sizes = this._sizes;
                    if (!sizes.containerSizeLoaded && !this._ensuringContainerSize) {
                        var promise;
                        if ((!this._itemInfo || typeof this._itemInfo !== "function") && this._useDefaultItemInfo) {
                            var margins = sizes.containerMargins;
                            promise = Promise.wrap({
                                width: group.groupInfo.cellWidth - margins.left - margins.right,
                                height: group.groupInfo.cellHeight - margins.top - margins.bottom
                            });

                        } else {
                            promise = this._getItemInfo();
                        }

                        var that = this;
                        this._ensuringContainerSize = promise.then(function (itemSize) {
                            sizes.containerSizeLoaded = true;
                            sizes.containerWidth = itemSize.width + sizes.itemBoxOuterWidth + sizes.containerOuterWidth;
                            sizes.containerHeight = itemSize.height + sizes.itemBoxOuterHeight + sizes.containerOuterHeight;
                            if (!that._inListMode) {
                                that._itemsPerBar = Math.floor(sizes.maxItemsContainerContentSize / sizes.containerCrossSize);
                                if (that.maximumRowsOrColumns) {
                                    that._itemsPerBar = Math.min(that._itemsPerBar, that.maximumRowsOrColumns);
                                }
                                that._itemsPerBar = Math.max(1, that._itemsPerBar);
                            } else {
                                that._itemsPerBar = 1;
                            }
                            that._createContainerStyleRule();
                        });

                        promise.done(
                            function () {
                                that._ensuringContainerSize = null;
                            },
                            function () {
                                that._ensuringContainerSize = null;
                            }
                        );

                        return promise;
                    } else {
                        return this._ensuringContainerSize ? this._ensuringContainerSize : Promise.wrap();
                    }
                }