Works out the center point of a group
@param {WireIt.Group} group The group to get the center of
@return {Array} the x, y position of the center
345083
function(group)
	{
	    var bounds = {};
	    
	    var setBound = function(position)
		{
		    var left, top;
		    left = position[0];
		    top = position[1];
		    
		    if ((typeof bounds["left"] == "undefined") || bounds["left"] > left)
			bounds["left"] = left;
			
		    if ((typeof bounds["right"] == "undefined") || bounds["right"] < left)
			bounds["right"] = left;

		    if ((typeof bounds["top"] == "undefined") || bounds["top"] > top)
			bounds["top"] = top;

		    if ((typeof bounds["bottom"] == "undefined") || bounds["bottom"] < top)
			bounds["bottom"] = top;
		}
	    
	    if (lang.isObject(group.groupContainer))
	    {
		setBound(group.groupContainer.getConfig().position)
	    }
	    else
	    {
		for (var cI in group.containers)
		{
		    var c = group.containers[cI].container;
		    var config = c.getConfig();
		    
		    setBound(config.position);
		}
		
		for (var gI in group.groups)
		{
		    var g = group.groups[gI].group;
		    
		    setBound(WireIt.GroupUtils.workOutCenter(g));
		}
	    }
	    return [
		    ((bounds.right + bounds.left)/2),
		    ((bounds.top + bounds.bottom)/2)
		];
	}
1332731
def centering_centroid(data, xi, yi, box, nloop=10, toldist=1e-3,
                       maxdist=10.0):
    '''
        
    '''

    # Store original center
    cxy = (xi, yi)
    origin = (xi, yi)
    # initial background
    back = 0.0

    if nloop == 0:
        return xi, yi, 0.0, 0, 'not recentering'

    for i in range(nloop):
        nxy, back = _centering_centroid_loop_xy(data, cxy, box)
        # _logger.debug('new center is %s', ncenter)
        # if we are to far away from the initial point, break
        dst = distance.euclidean(origin, nxy)
        if dst > maxdist:
            msg = 'maximum distance (%5.2f) from origin reached' % maxdist
            return cxy[0], cxy[1], back, 2, msg

        # check convergence
        dst = distance.euclidean(nxy, cxy)
        if dst < toldist:
            return nxy[0], nxy[1], back, 1, 'converged in iteration %i' % i
        else:
            cxy = nxy

    return nxy[0], nxy[1], back, 3, 'not converged in %i iterations' % nloop
923206
function center (msg) {
    msg        = ' ' + msg.trim() + ' ';
    const length = msg.length;
    const spaces = Math.floor((lineWidth - length) / 2);
    return Array(spaces + 1).join('-') + msg.green + Array(lineWidth - msg.length - spaces + 1).join('-');
  }
920259
def get_group_line(self, data):
        
        idx = -1
        for key in self.groups:
            i = self.get_group_key_line(data, key)
            if (i < idx and i != -1) or idx == -1:
                idx = i
        return idx
1353558
function columnGroupWidths(groups, all) {
    return {
        left: columnTotalWidth(groups.left),
        center: columnTotalWidth(groups.center),
        right: columnTotalWidth(groups.right),
        total: Math.floor(columnTotalWidth(all))
    };
}
272351
def compute_group_label_positions(self):
        
        assert self.group_label_position in ["beginning", "middle", "end"]
        data = [self.graph.node[n][self.node_grouping] for n in self.nodes]
        node_length = len(data)
        groups = items_in_groups(data)

        edge_of_plot = self.plot_radius + self.nodeprops["radius"]
        # The 1.02 serves as padding
        radius = 1.02 * edge_of_plot + self.group_label_offset
        xs = []
        ys = []
        has = []
        vas = []
        node_idcs = np.cumsum(list(groups.values()))
        node_idcs = np.insert(node_idcs, 0, 0)
        if self.group_label_position == "beginning":
            for idx in node_idcs[:-1]:
                x, y = get_cartesian(
                    r=radius, theta=group_theta(node_length, idx)
                )
                ha, va = text_alignment(x, y)
                xs.append(x)
                ys.append(y)
                has.append(ha)
                vas.append(va)

        elif self.group_label_position == "middle":
            node_idcs = node_idcs.reshape(len(node_idcs), 1)
            node_idcs = np.concatenate((node_idcs[:-1], node_idcs[1:]), axis=1)
            for idx in node_idcs:
                theta1 = group_theta(node_length, idx[0])
                theta2 = group_theta(node_length, idx[1] - 1)
                x, y = get_cartesian(r=radius, theta=(theta1 + theta2) / 2)
                ha, va = text_alignment(x, y)
                xs.append(x)
                ys.append(y)
                has.append(ha)
                vas.append(va)

        elif self.group_label_position == "end":
            for idx in node_idcs[1::]:
                x, y = get_cartesian(
                    r=radius, theta=group_theta(node_length, idx - 1)
                )
                ha, va = text_alignment(x, y)
                xs.append(x)
                ys.append(y)
                has.append(ha)
                vas.append(va)

        self.group_label_coords = {"x": xs, "y": ys}
        self.group_label_aligns = {"has": has, "vas": vas}
        self.groups = groups.keys()
989786
function getAllEntries(groups) {
    return groups.reduce(function(current, group) {
        const theseEntries = group.getEntries();
        const subEntries = getAllEntries(group.getGroups());
        if (theseEntries.length > 0) {
            current = current.concat(theseEntries);
        }
        if (subEntries.length > 0) {
            current = current.concat(subEntries);
        }
        return current;
    }, []);
}
1363927
def setPoint(self, x, group, y):
        
        if x == -1:
            # silence window
            self.plot([0],[y], symbol='o')
        else:
            yindex = self.groups.index(group)
            xdata, ydata = self.lines[yindex].getData()
            if ydata is None:
                xdata = [x]
                ydata = [y]
            else:
                xdata = np.append(xdata, x)
                ydata = np.append(ydata, y)
            self.lines[yindex].setData(xdata, ydata)
10638
function(object) {

      var groupLeft = this.get('left'),
          groupTop = this.get('top'),
          groupAngle = this.getAngle() * (Math.PI / 180),
          objectLeft = object.get('originalLeft'),
          objectTop = object.get('originalTop'),
          rotatedTop = Math.cos(groupAngle) * object.get('top') + Math.sin(groupAngle) * object.get('left'),
          rotatedLeft = -Math.sin(groupAngle) * object.get('top') + Math.cos(groupAngle) * object.get('left');

      object.setAngle(object.getAngle() + this.getAngle());

      object.set('left', groupLeft + rotatedLeft * this.get('scaleX'));
      object.set('top', groupTop + rotatedTop * this.get('scaleY'));

      object.set('scaleX', object.get('scaleX') * this.get('scaleX'));
      object.set('scaleY', object.get('scaleY') * this.get('scaleY'));

      object.setCoords();
      object.hideCorners = false;
      object.setActive(false);
      object.setCoords();

      return this;
    }
836825
function (group) {
				var stackItem = this,									// aliased this
					str = stackItem.options.formatter.call(stackItem);	// format the text in the label

				// Change the text to reflect the new total and set visibility to hidden in case the serie is hidden
				if (stackItem.label) {
					stackItem.label.attr({text: str, visibility: HIDDEN});
				// Create new label
				} else {
					stackItem.label =
						chart.renderer.text(str, 0, 0)				// dummy positions, actual position updated with setOffset method in columnseries
							.css(stackItem.options.style)			// apply style
							.attr({align: stackItem.textAlign,			// fix the text-anchor
								rotation: stackItem.options.rotation,	// rotation
								visibility: HIDDEN })					// hidden until setOffset is called
							.add(group);							// add to the labels-group
				}
			}
1136903
private static IntervalTreeNodeData<String> createPositionHit(Match m,
      ComponentGroup group) {
    Integer start = null;
    Integer end = null;
    if (group.hitInside != null || group.hitInsideLeft != null
        || group.hitInsideRight != null) {
      start = m.startPosition;
      end = m.endPosition - 1;
    } else {
      start = null;
      end = null;
    }
    if (group.hitLeft != null) {
      start = m.startPosition;
      end = Math.max(m.startPosition + group.hitLeft.length - 1,
          m.endPosition - 1);
    }
    if (group.hitRight != null) {
      start = Math.min(m.endPosition - group.hitRight.length, m.startPosition);
      end = end == null ? (m.endPosition - 1)
          : Math.max(end, (m.endPosition - 1));
    }
    if (group.left != null) {
      start = start == null ? m.startPosition - group.left.length
          : Math.min(m.startPosition - group.left.length, start);
      end = end == null ? m.startPosition - 1
          : Math.max(m.startPosition - 1, end);
    }
    if (group.right != null) {
      start = start == null ? m.endPosition : Math.min(m.endPosition, start);
      end = end == null ? m.endPosition + group.right.length - 1
          : Math.max(m.endPosition + group.right.length - 1, end);
    }
    return new IntervalTreeNodeData<>(start, end, m.startPosition,
        m.endPosition - 1);
  }
871693
function () {
        var foundOne
        sortGroups()

        var i
        for (i = 0; i < groupsMainTable.children.length; i++) {
          var row = groupsMainTable.children[i]
          row.trashMe = true
        }

        for (var g = 0; g < groups.length; g++) {
          // var book = groups[g][0]
          var name = groups[g][1]
          var group = groups[g][2]

          // selectedGroups[group.uri] = false
          foundOne = false

          for (i = 0; i < groupsMainTable.children.length; i++) {
            let row = groupsMainTable.children[i]
            if (row.subject && row.subject.sameTerm(group)) {
              row.trashMe = false
              foundOne = true
              break
            }
          }
          if (!foundOne) {
            var groupRow = groupsMainTable.appendChild(dom.createElement('tr'))
            groupRow.subject = group
            UI.widgets.makeDraggable(groupRow, group)

            groupRow.setAttribute('style', dataCellStyle)
            groupRow.textContent = name
            var foo = function addNewGroupRow2 (groupRow, group, name) {
              // Is something is dropped on a group, add people to group
              var handleURIsDroppedOnGroup = function (uris) {
                uris.forEach(function (u) {
                  console.log('Dropped on group: ' + u)
                  var thing = kb.sym(u)
                  var toBeFetched = [thing.doc(), group.doc()]

                  kb.fetcher.load(toBeFetched).then(function (xhrs) {
                    var types = kb.findTypeURIs(thing)
                    for (var ty in types) {
                      console.log('    drop object type includes: ' + ty) // @@ Allow email addresses and phone numbers to be dropped?
                    }
                    if (ns.vcard('Individual').uri in types || ns.vcard('Organization').uri in types) {
                      var pname = kb.any(thing, ns.vcard('fn'))
                      if (!pname) return alert('No vcard name known for ' + thing)
                      var already = kb.holds(group, ns.vcard('hasMember'), thing, group.doc())
                      if (already) return alert('ALREADY added ' + pname + ' to group ' + name)
                      var message = 'Add ' + pname + ' to group ' + name + '?'
                      if (confirm(message)) {
                        var ins = [ $rdf.st(group, ns.vcard('hasMember'), thing, group.doc()),
                          $rdf.st(thing, ns.vcard('fn'), pname, group.doc())]
                        kb.updater.update([], ins, function (uri, ok, err) {
                          if (!ok) return complain('Error adding member to group ' + group + ': ' + err)
                          console.log('Added ' + pname + ' to group ' + name)
                          // @@ refresh UI
                        })
                      }
                    }
                  }).catch(function (e) {
                    complain('Error looking up dropped thing ' + thing + ' and group: ' + e)
                  })
                })
              }
              UI.widgets.makeDropTarget(groupRow, handleURIsDroppedOnGroup)

              UI.widgets.deleteButtonWithCheck(dom, groupRow, 'group ' + name, function () {
                deleteThing(group)
                syncGroupTable()
              })
              groupRow.addEventListener('click', function (event) {
                event.preventDefault()
                var groupList = kb.sym(group.uri.split('#')[0])
                if (!event.metaKey) {
                  selectedGroups = {} // If Command key pressed, accumulate multiple
                }
                selectedGroups[group.uri] = !selectedGroups[group.uri]
                refreshGroupsSelected()
                peopleMainTable.innerHTML = '' // clear in case refreshNames doesn't work for unknown reason

                kb.fetcher.nowOrWhenFetched(groupList.uri, undefined, function (ok, message) {
                  if (!ok) return complainIfBad(ok, "Can't load group file: " + groupList + ': ' + message)
                  refreshNames()

                  if (!event.metaKey) { // If only one group has beeen selected show ACL
                    cardMain.innerHTML = ''
                    var visible = false
                    var aclControl = UI.aclControl.ACLControlBox5(group, dom, 'group', kb, function (ok, body) {
                      if (!ok) cardMain.innerHTML = 'Failed: ' + body
                    })
                    var sharingButton = cardMain.appendChild(dom.createElement('button'))
                    sharingButton.style.cssText = 'padding: 1em; margin: 1em'
                    var img = sharingButton.appendChild(dom.createElement('img'))
                    img.style.cssText = 'width: 1.5em; height: 1.5em'
                    img.setAttribute('src', UI.icons.iconBase + 'noun_123691.svg')
                    sharingButton.addEventListener('click', function () {
                      visible = !visible
                      if (visible) {
                        cardMain.appendChild(aclControl)
                      } else {
                        cardMain.removeChild(aclControl)
                      }
                    })
                  }
                })
              }, true)
            }
            foo(groupRow, group, name)
          } // if not foundOne
        } // loop g

        for (i = 0; i < groupsMainTable.children.length; i++) {
          let r = groupsMainTable.children[i]
          if (r.trashMe) {
            groupsMainTable.removeChild(r)
          }
        }
        refreshGroupsSelected()
      }
311736
function byGroup() {
    var nodes = this.spawn();
    var edges = this.spawn();

    for (var i = 0; i < this.length; i++) {
      var ele = this[i];

      if (ele.isNode()) {
        nodes.merge(ele);
      } else {
        edges.merge(ele);
      }
    }

    return {
      nodes: nodes,
      edges: edges
    };
  }
292116
function (group) {
            var options = this.options,
              formatOption = options.format,
              str = formatOption ?
                format(formatOption, this) :
                options.formatter.call(this);  // format the text in the label

            // Change the text to reflect the new total and set visibility to hidden in case the serie is hidden
            if (this.label) {
                this.label.attr({text: str, visibility: HIDDEN});
                // Create new label
            } else {
                this.label =
                  this.axis.chart.renderer.text(str, null, null, options.useHTML)		// dummy positions, actual position updated with setOffset method in columnseries
                    .css(options.style)				// apply style
                    .attr({
                        align: this.textAlign,				// fix the text-anchor
                        rotation: options.rotation,	// rotation
                        visibility: HIDDEN					// hidden until setOffset is called
                    })
                    .add(group);							// add to the labels-group
            }
        }
1352254
def a(self):
        '''
        

        '''
        a = Point(self.center)

        if self.xAxisIsMajor:
            a.x += self.majorRadius
        else:
            a.y += self.majorRadius
        return a
449585
def centerLatLon(self):
        
        # GET CENTROID FROM GSSHA GRID
        gssha_grid = self.getGrid()

        min_x, max_x, min_y, max_y = gssha_grid.bounds()
        x_ext, y_ext = transform(gssha_grid.proj,
                                 Proj(init='epsg:4326'),
                                 [min_x, max_x, min_x, max_x],
                                 [min_y, max_y, max_y, min_y],
                                 )
        return np.mean(y_ext), np.mean(x_ext)
931664
function() {
        if (!this.center && this.size) {
            this.center = this.getLonLatFromViewPortPx({
                x: this.size.w / 2,
                y: this.size.h / 2
            });
        }
        return this.center;
    }