Recalculates the bbox region attribute for the entire file.
        Useful after adding and/or removing features.

        No need to use this method just for saving, because saving
        automatically updates the bbox.
336256
def update_bbox(self):
        

        xmins, ymins, xmaxs, ymaxs = zip(*(feat.geometry.bbox for feat in self if feat.geometry.type != "Null"))
        bbox = [min(xmins), min(ymins), max(xmaxs), max(ymaxs)] 
        self._data["bbox"] = bbox
405190
def do_region(self, x, y, w, h):
        """"""
        infile = self.tmpfile
        outfile = self.basename + '.reg'
        # simeon@ice ~>cat m.pnm | pnmcut 10 10 100 200 > m1.pnm
        if (x is None):
            # print "region: full"
            self.tmpfile = infile
        else:
            # print "region: (%d,%d,%d,%d)" % (x,y,w,h)
            if (self.shell_call('cat ' + infile + ' | ' + self.pnmcut + ' ' + str(x) + ' ' + str(y) + ' ' + str(w) + ' ' + str(h) + '  > ' + outfile)):
                raise IIIFError(text="Oops... got nonzero output from pnmcut.")
            self.width = w
            self.height = h
            self.tmpfile = outfile
700057
def get_bbox(self):
        """"""

        x_min = self.x
        x_max = x_min + self.width
        y_min = self.y
        y_max = self.y + self.height

        return x_min, x_max, y_min, y_max
933048
def bbox(self):
        bbox = self._df[['id', 'x1', 'y1', 'x2', 'y2']].copy()
        # TODO: Fix this to become x, y, w, h
        if self.bbox_with_size:
            bbox['y2'] -= bbox['y1']
            bbox['x2'] -= bbox['x1']

        

        return to_array_list(bbox)
1120104
def _region_to_coords(region):
    
    chrom, coords = region.split(":")
    start, end = coords.split("-")
    return (chrom, int(start), int(end))
216417
private Region remove(Region x, Region t) {
    if (t != NULL_NODE) {
      // Step 1: Search down the tree and set lastNode and deletedNode
      this.lastNode = t;
      if (x.orderRelativeTo(t) < 0) {
        t.left(remove(x, t.left));
      } else {
        this.deletedNode = t;
        t.right(remove(x, t.right));
      }
      // Step 2: If at the bottom of the tree and
      // x is present, we remove it
      if (t == this.lastNode) {
        if (this.deletedNode != NULL_NODE && x.orderRelativeTo(this.deletedNode) == 0) {
          this.deletedNode.swap(t);
          this.deletedElement = t;
          t = t.right;
        }
      } else if (t.left.level < t.level - 1 || t.right.level < t.level - 1) {
        // Step 3: Otherwise, we are not at the bottom; re-balance
        if (t.right.level > --t.level) {
          t.right.level = t.level;
        }
        t = skew(t);
        t.right(skew(t.right));
        t.right.right(skew(t.right.right));
        t = split(t);
        t.right(split(t.right));
      }
    }
    return t;
  }
230387
@Override
	@Pure
	protected Rectangle2d calcBounds() {
		final Rectangle2d bounds = super.calcBounds().toBoundingBox();
		if (bounds != null && isWidePolyline()) {
			final double w = getWidth();
			final double mx = bounds.getMinX();
			final double my = bounds.getMinY();
			final double xx = bounds.getMaxX();
			final double xy = bounds.getMaxY();
			final double dw = w / 2.;
			bounds.setFromCorners(mx - dw, my - dw, xx + dw, xy + dw);
		}
		return bounds;
	}
540435
def do_region(self, x, y, w, h):
        """"""
        if (x is None):
            self.logger.debug("region: full (nop)")
        else:
            self.logger.debug("region: (%d,%d,%d,%d)" % (x, y, w, h))
            self.image = self.image.crop((x, y, x + w, y + h))
            self.width = w
            self.height = h
611416
def get_boundingbox(self):
        
        b = BoundingBox()
        for rx,rz in self.regionfiles.keys():
            region = self.get_region(rx,rz)
            rx,rz = 32*rx,32*rz
            for cc in region.get_chunk_coords():
                x,z = (rx+cc['x'],rz+cc['z'])
                b.expand(x,None,z)
        return b
560221
def calculate_bbox_area(bbox, rows, cols):
    """"""
    bbox = denormalize_bbox(bbox, rows, cols)
    x_min, y_min, x_max, y_max = bbox[:4]
    area = (x_max - x_min) * (y_max - y_min)
    return area
413615
@Override
	protected void selectRectangle(Bbox selectedArea) {
		// we can clear here !
		if (!shiftOrCtrl) {
			MapModel mapModel = mapWidget.getMapModel();
			mapModel.clearSelectedFeatures();
		}
		GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
		SearchByLocationRequest request = new SearchByLocationRequest();
		request.setLayerIds(getSelectionLayerIds());
		for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
			if (layer.isShowing() && layer instanceof VectorLayer) {
				request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter());
			}
		}

		Polygon polygon = mapWidget.getMapModel().getGeometryFactory().createPolygon(selectedArea);
		request.setLocation(GeometryConverter.toDto(polygon));
		request.setCrs(mapWidget.getMapModel().getCrs());
		request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
		request.setRatio(coverageRatio);
		request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
		request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
		commandRequest.setCommandRequest(request);
		GwtCommandDispatcher.getInstance().execute(commandRequest,
				new AbstractCommandCallback<SearchByLocationResponse>() {

			public void execute(SearchByLocationResponse response) {
				Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
				for (String layerId : featureMap.keySet()) {
					selectFeatures(layerId, featureMap.get(layerId));
				}
			}
		});
	}
334222
private boolean recalculateSize() {
        int oldSize = size;
        size = 0;
        for (long elt : elements)
            size += Long.bitCount(elt);

        return size != oldSize;
    }
430822
def resetToPreviousLoc(self):
        
        self.rect.left = self.startDraggingX
        self.rect.top = self.startDraggingY
74041
function Region() {

        this.subRegions = [];

        this.nSubRegions = 0;

        this.node = null;

        this.mass = 0;

        this.centerOfMass = null;

        this.bbox = new Float32Array(4);

        this.size = 0;
    }
906347
function recalculatePosition() {
      scope.position = appendToBody ? $position.offset(element) : $position.position(element);
      scope.position.top += element.prop('offsetHeight');
    }
1038403
def block_regions(callable_bed, in_bam, ref_file, data):
    
    min_n_size = int(data["config"]["algorithm"].get("nomap_split_size", 250))
    with shared.bedtools_tmpdir(data):
        nblock_bed = "%s-nblocks.bed" % utils.splitext_plus(callable_bed)[0]
        callblock_bed = "%s-callableblocks.bed" % utils.splitext_plus(callable_bed)[0]
        if not utils.file_uptodate(nblock_bed, callable_bed):
            ref_regions = get_ref_bedtool(ref_file, data["config"])
            nblock_regions = _get_nblock_regions(callable_bed, min_n_size, ref_regions)
            nblock_regions = _add_config_regions(nblock_regions, ref_regions, data)
            with file_transaction(data, nblock_bed, callblock_bed) as (tx_nblock_bed, tx_callblock_bed):
                nblock_regions.filter(lambda r: len(r) > min_n_size).saveas(tx_nblock_bed)
                if len(ref_regions.subtract(nblock_regions, nonamecheck=True)) > 0:
                    ref_regions.subtract(tx_nblock_bed, nonamecheck=True).merge(d=min_n_size).saveas(tx_callblock_bed)
                else:
                    raise ValueError("No callable regions found in %s from BAM file %s. Some causes:\n "
                                     " - Alignment regions do not overlap with regions found "
                                     "in your `variant_regions` BED: %s\n"
                                     " - There are no aligned reads in your BAM file that pass sanity checks "
                                     " (mapping score > 1, non-duplicates, both ends of paired reads mapped)"
                                     % (dd.get_sample_name(data), in_bam, dd.get_variant_regions(data)))
    return callblock_bed, nblock_bed
419368
private org.geomajas.geometry.Bbox toBbox(Bbox bounds) {
		return new org.geomajas.geometry.Bbox(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
	}