get the bounding box of the elements (in raw model position)
514962
function( options ){
      var eles = this;

      options = $$.util.extend({
        includeNodes: true,
        includeEdges: true,
        includeLabels: true
      }, options);

      // recalculate projections etc
      this.cy().recalculateRenderedStyle();

      var x1 = Infinity;
      var x2 = -Infinity;
      var y1 = Infinity;
      var y2 = -Infinity;

      // find bounds of elements
      for( var i = 0; i < eles.length; i++ ){
        var ele = eles[i];
        var ex1, ex2, ey1, ey2, x, y;
        var includedEle = false;

        if( ele.css('display') === 'none' ){ continue; } // then ele doesn't take up space      

        if( ele.isNode() && options.includeNodes ){
          includedEle = true;

          var pos = ele._private.position;
          x = pos.x;
          y = pos.y;
          var w = ele.outerWidth();
          var halfW = w/2;
          var h = ele.outerHeight();
          var halfH = h/2;

          // handle node dimensions
          /////////////////////////

          ex1 = x - halfW;
          ex2 = x + halfW;
          ey1 = y - halfH;
          ey2 = y + halfH;

          x1 = ex1 < x1 ? ex1 : x1;
          x2 = ex2 > x2 ? ex2 : x2;
          y1 = ey1 < y1 ? ey1 : y1;
          y2 = ey2 > y2 ? ey2 : y2;

        } else if( ele.isEdge() && options.includeEdges ){ 
          includedEle = true;

          var n1pos = ele.source()[0]._private.position;
          var n2pos = ele.target()[0]._private.position;

          // handle edge dimensions (rough box estimate)
          //////////////////////////////////////////////

          var rstyle = ele._private.rstyle || {};

          ex1 = n1pos.x;
          ex2 = n2pos.x;
          ey1 = n1pos.y;
          ey2 = n2pos.y;

          if( ex1 > ex2 ){
            var temp = ex1;
            ex1 = ex2;
            ex2 = temp;
          }

          if( ey1 > ey2 ){
            var temp = ey1;
            ey1 = ey2;
            ey2 = temp;
          }

          x1 = ex1 < x1 ? ex1 : x1;
          x2 = ex2 > x2 ? ex2 : x2;
          y1 = ey1 < y1 ? ey1 : y1;
          y2 = ey2 > y2 ? ey2 : y2;

          // handle points along edge (sanity check)
          //////////////////////////////////////////

          var bpts = rstyle.bezierPts || [];
          var w = ele._private.style['width'].pxValue;
          for( var j = 0; j < bpts.length; j++ ){
            var bpt = bpts[j];

            x1 = bpt.x - w < x1 ? bpt.x - w : x1;
            x2 = bpt.x + w > x2 ? bpt.x + w : x2;
            y1 = bpt.y - w < y1 ? bpt.y - w : y1;
            y2 = bpt.y + w > y2 ? bpt.y + w : y2;
          }

        }

        // handle label dimensions
        //////////////////////////

        var style = ele._private.style;
        var rstyle = ele._private.rstyle;
        var label = style['content'].strValue;
        var fontSize = style['font-size'];
        var halign = style['text-halign'];
        var valign = style['text-valign'];
        var labelWidth = rstyle.labelWidth;
        var labelHeight = rstyle.labelHeight;
        var labelX = rstyle.labelX;
        var labelY = rstyle.labelY;

        if( includedEle && options.includeLabels && label && fontSize && labelHeight != undefined && labelWidth != undefined && labelX != undefined && labelY != undefined && halign && valign ){
          var lh = labelHeight;
          var lw = labelWidth;
          var lx1, lx2, ly1, ly2;

          if( ele.isEdge() ){
            lx1 = labelX - lw/2;
            lx2 = labelX + lw/2;
            ly1 = labelY - lh/2;
            ly2 = labelY + lh/2;
          } else {
            switch( halign.value ){
              case 'left':
                lx1 = labelX - lw;
                lx2 = labelX;
                break;

              case 'center':
                lx1 = labelX - lw/2;
                lx2 = labelX + lw/2;
                break;

              case 'right':
                lx1 = labelX;
                lx2 = labelX + lw;
                break;
            }

            switch( valign.value ){
              case 'top':
                ly1 = labelY - lh;
                ly2 = labelY;
                break;

              case 'center':
                ly1 = labelY - lh/2;
                ly2 = labelY + lh/2;
                break;

              case 'bottom':
                ly1 = labelY;
                ly2 = labelY + lh;
                break;
            }
          }

          x1 = lx1 < x1 ? lx1 : x1;
          x2 = lx2 > x2 ? lx2 : x2;
          y1 = ly1 < y1 ? ly1 : y1;
          y2 = ly2 > y2 ? ly2 : y2;
        }
      } // for

      return {
        x1: x1,
        x2: x2,
        y1: y1,
        y2: y2,
        w: x2 - x1,
        h: y2 - y1
      };
    }
18286
def get_bounding_box(self):
        
        if len(self.elements) == 0:
            return None
        if not (self._bb_valid and
                all(ref._bb_valid for ref in self.get_dependencies(True))):
            bb = numpy.array(((1e300, 1e300), (-1e300, -1e300)))
            all_polygons = []
            for element in self.elements:
                if isinstance(element, PolygonSet):
                    all_polygons.extend(element.polygons)
                elif isinstance(element, CellReference) or isinstance(
                        element, CellArray):
                    element_bb = element.get_bounding_box()
                    if element_bb is not None:
                        bb[0, 0] = min(bb[0, 0], element_bb[0, 0])
                        bb[0, 1] = min(bb[0, 1], element_bb[0, 1])
                        bb[1, 0] = max(bb[1, 0], element_bb[1, 0])
                        bb[1, 1] = max(bb[1, 1], element_bb[1, 1])
            if len(all_polygons) > 0:
                all_points = numpy.concatenate(all_polygons).transpose()
                bb[0, 0] = min(bb[0, 0], all_points[0].min())
                bb[0, 1] = min(bb[0, 1], all_points[1].min())
                bb[1, 0] = max(bb[1, 0], all_points[0].max())
                bb[1, 1] = max(bb[1, 1], all_points[1].max())
            self._bb_valid = True
            _bounding_boxes[self] = bb
        return _bounding_boxes[self]
434150
public BoundingBox getBoundingBox() {

		GenericRawResults<Object[]> results = null;
		Object[] values = null;
		try {
			results = geometryIndexDao.queryRaw("SELECT MIN("
					+ GeometryIndex.COLUMN_MIN_X + "), MIN("
					+ GeometryIndex.COLUMN_MIN_Y + "), MAX("
					+ GeometryIndex.COLUMN_MAX_X + "), MAX("
					+ GeometryIndex.COLUMN_MAX_Y + ") FROM "
					+ GeometryIndex.TABLE_NAME + " WHERE "
					+ GeometryIndex.COLUMN_TABLE_NAME + " = ?", new DataType[] {
					DataType.DOUBLE, DataType.DOUBLE, DataType.DOUBLE,
					DataType.DOUBLE }, tableName);
			values = results.getFirstResult();
		} catch (SQLException e) {
			throw new GeoPackageException(
					"Failed to query for indexed feature bounds: " + tableName,
					e);
		} finally {
			if (results != null) {
				try {
					results.close();
				} catch (IOException e) {
					logger.log(Level.WARNING,
							"Failed to close bounds query results", e);
				}
			}
		}

		BoundingBox boundingBox = new BoundingBox((double) values[0],
				(double) values[1], (double) values[2], (double) values[3]);

		return boundingBox;
	}
889711
function getElementBoundingRect(elementSelector) {
    /**
     * @param {Window} win
     * @param {Object} [dims]
     * @returns {Object}
     */
    function computeFrameOffset(win, dims) {
        // initialize our result variable
        dims = dims || {
            left: win.pageXOffset,
            top: win.pageYOffset
        };

        // add the offset & recurse up the frame chain
        var frame = win.frameElement;
        if (frame) {
            var rect = frame.getBoundingClientRect();
            dims.left += rect.left + frame.contentWindow.pageXOffset;
            dims.top += rect.top + frame.contentWindow.pageYOffset;

            if (win !== window.top) {
                computeFrameOffset(win.parent, dims);
            }
        }

        return dims;
    }

    /**
     * @param {HTMLElement} element
     * @param {Object} frameOffset
     * @returns {Object}
     */
    function computeElementRect(element, frameOffset) {
        var rect = element.getBoundingClientRect();

        return {
            left: rect.left + frameOffset.left,
            right: rect.right + frameOffset.left,
            top: rect.top + frameOffset.top,
            bottom: rect.bottom + frameOffset.top,
            width: rect.width,
            height: rect.height
        };
    }

    var element = document.querySelectorAll(elementSelector)[0];
    if (element) {
        var frameOffset = computeFrameOffset(window);
        var elementRect = computeElementRect(element, frameOffset);

        return elementRect;
    }
}
337794
public BoundingBox getBoundingBox() {
		BoundingBox boundingBox = null;
		if (minX != null && maxX != null && minY != null && maxY != null) {
			boundingBox = new BoundingBox(getMinX(), getMinY(), getMaxX(),
					getMaxY());
		}
		return boundingBox;
	}
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
596440
def box(self):
        
        b = self.GetBounds()
        from vtkplotter.shapes import Box
        pos = (b[0]+b[1])/2, (b[3]+b[2])/2, (b[5]+b[4])/2
        length, width, height = b[1]-b[0], b[3]-b[2], b[5]-b[4]
        oa = Box(pos, length, width, height, c='gray').wire()
        if isinstance(self.GetProperty(), vtk.vtkProperty):
            oa.SetProperty(self.GetProperty())
        return oa
57808
function(model) {
    const maxLen = model.get("seq").length;
    const selection = [];
    const sels = this.g.selcol.getSelForRow(model.get("id"));
    const rows = find(sels, function(el) { return el.get("type") === "row"; });
    if ((typeof rows !== "undefined" && rows !== null)) {
      // full match
      const end = maxLen - 1;
      for (let n = 0; n <= end; n++) {
        selection.push(n);
      }
    } else if (sels.length > 0) {
      for (let i = 0, sel; i < sels.length; i++) {
        sel = sels[i];
        const start = sel.get("xStart");
        const end = sel.get("xEnd");
        for (let n = start; n <= end; n++) {
          selection.push(n);
        }
      }
    }

    return selection;
  }
422459
def get_bounding_box(self):
        
        pointlist = self.get_pointlist()

        # Initialize bounding box parameters to save values
        minx, maxx = pointlist[0][0]["x"], pointlist[0][0]["x"]
        miny, maxy = pointlist[0][0]["y"], pointlist[0][0]["y"]
        mint, maxt = pointlist[0][0]["time"], pointlist[0][0]["time"]

        # Adjust parameters
        for stroke in pointlist:
            for p in stroke:
                minx, maxx = min(minx, p["x"]), max(maxx, p["x"])
                miny, maxy = min(miny, p["y"]), max(maxy, p["y"])
                mint, maxt = min(mint, p["time"]), max(maxt, p["time"])
        return {"minx": minx, "maxx": maxx, "miny": miny, "maxy": maxy,
                "mint": mint, "maxt": maxt}
990445
function(model) {
    var maxLen = model.getMaxLength();
    if (maxLen < 200 && model.length < 30) {
      this.defaults.boxRectWidth = this.defaults.boxRectHeight = 5;
    }
    return this;
  }
492023
def bounding_box(self):
        """"""
        xmin = self.center.x - self.radius
        xmax = self.center.x + self.radius
        ymin = self.center.y - self.radius
        ymax = self.center.y + self.radius

        return BoundingBox.from_float(xmin, xmax, ymin, ymax)
774431
function (element) {
		var elementBounds = element.getBoundingClientRect();
		var left = elementBounds.left;
		var top = elementBounds.top;
		var documentBounds = document.documentElement.getBoundingClientRect();
		left -= documentBounds.left;
		top -= documentBounds.top;

		return {
			top: top,
			right: innerWidth - left - elementBounds.width,
			bottom: innerHeight - top - elementBounds.height,
			left: left,
			width: elementBounds.width,
			height: elementBounds.height
		};
	}
666525
function getBoundaries (object) {
  if (object._isw3dObject) {
    var size = object.size;
    return {
      left: 0,
      right: size.x,
      top: size.y,
      bottom: 0,
      far: 0,
      near: size.z
    };
  }
  else {
    const bbox = getBboxFromObject(object);
    return {
      left: - bbox.min.x,
      right: bbox.max.x,
      top: bbox.max.y,
      bottom: - bbox.min.y,
      far: - bbox.min.z,
      near: bbox.max.z
    };
  }
}
5238
def get_selection_bounds(self):
        """"""
        cursor = self.textCursor()
        start, end = cursor.selectionStart(), cursor.selectionEnd()
        block_start = self.document().findBlock(start)
        block_end = self.document().findBlock(end)
        return sorted([block_start.blockNumber(), block_end.blockNumber()])
1374838
function() {
    var e = this._element;
    if (!e) return null;
    if (typeof e.getBoundingClientRect !== 'function') {
      console.error("[wdg.rect] This element has non `getBoundingClientRect` function:", e);
    }
    var r = e.getBoundingClientRect();
    if( typeof r.width === 'undefined' ) r.width = r.right - r.left;
    if( typeof r.height === 'undefined' ) r.height = r.bottom - r.top;
    return r;
  }
759120
def bounding_box(visible_only = true)
      maxX = atoms(visible_only).first.x
      maxY = atoms(visible_only).first.y
      maxZ = atoms(visible_only).first.z
      minX = maxX
      minY = maxY
      minZ = maxZ
      
      atoms(visible_only).each{|a|
        if a.x > maxX
          maxX = a.x
        elsif a.x < minX
          minX = a.x
        end
        
        if a.y > maxY
          maxY = a.y
        elsif a.y < minY
          minY = a.y
        end
        
        if a.z > maxZ
          maxZ = a.z
        elsif a.z < minZ
          minZ = a.z
        end
      }

      [Atom.new(maxX, maxY, maxZ), Atom.new(minX, minY, minZ)]
    end
360772
def get_bounding_box(self, maxdist):
        
        return utils.get_bounding_box([ps.location for ps in self], maxdist)