Package htm

Examples of htm.Column


    g.setColor(Color.WHITE);
    g.fillRect(0, 0, size.width, size.height);
   
    for(int cx=0; cx<_region.getWidth(); ++cx) {
      for(int cy=0; cy<_region.getHeight(); ++cy) {
        Column col = _region.getColumn(cx, cy);
        Point circle = getColumnPos(col);
       
        int gray = 255 - Math.round(col.getOverlapPercentage()*255.0f);
        if(gray<255)
          gray = gray;
        g.setColor(new Color(gray,gray,gray));
        g.fillOval(circle.x-rad, circle.y-rad, diam, diam);
       
        boolean wasDrawn = false;
        if(col.isActive()) {
          wasDrawn = true;
          g.setColor(Color.BLUE);
        }
        else
          g.setColor(new Color(192,192,192));
       
        g.drawOval(circle.x-rad, circle.y-rad, diam, diam);
       
        //Now draw individual column cells inside the column's circle
        int radCell = rad2sqrt+1;
        int rad2C = rad2-1;
        if(_region.getCellsPerCol()==1) {
          radCell = rad-(rad/3);
          rad2C = 0;
        }
       
        Point[] clocs = new Point[] {
          new Point(circle.x-rad2C, circle.y-rad2C),
          new Point(circle.x+rad2C, circle.y-rad2C),
          new Point(circle.x-rad2C, circle.y+rad2C),
          new Point(circle.x+rad2C, circle.y+rad2C)
        };
       
        for(int i=0; i<col.numCells(); ++i)
          wasDrawn |= drawCell(g, clocs[i], radCell, col.getCell(i));
       
        //Draw small black circle to indicate input bit origin locations
        if(_showInput && _data!=null && _data[col.ix()][col.iy()]==1) {
          wasDrawn = true;
          int r = Math.max(2, rad/6);
          g.setColor(new Color(128,0,128));
          g.fillOval(circle.x-r, circle.y-r, r*2, r*2);
          g.setColor(Color.BLACK);
View Full Code Here


      int rad2sqrt = (int)(((double)(_colRadius/2)) / SQRT2);
     
      int w = _colRadius*2 + COLUMN_BORDER;
      int x = _mousePos.x / w;
      int y = _mousePos.y / w;
      Column col = null;
      try { //if mouse clicked outside entire grid, return null
        col = _region.getColumn(x, y);
      }catch(ArrayIndexOutOfBoundsException ex) {
        return null;
      }
     
      if(col.numCells()==1) //special case for 1-cell
        rad2sqrt = _colRadius-(_colRadius/3);
     
      for(int i=0; i<col.numCells(); ++i) {
        Cell cell = col.getCell(i);
        Point center = getCellPos(cell);
        if(_mousePos.x > center.x-rad2sqrt && _mousePos.y > center.y-rad2sqrt) {
          if(_mousePos.x < center.x+rad2sqrt && _mousePos.y < center.y+rad2sqrt)
            return cell;
        }
View Full Code Here

TOP

Related Classes of htm.Column

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.