Logo Search packages:      
Sourcecode: ktechlab version File versions

void FlowContainer::updateConnectorPoints ( bool  add = true  )  [virtual, inherited]

ICNDocument needs to know what 'cells' a CNItem is present in, so that connection mapping can be done to avoid CNItems. This function will add the hit penalty to the cells pointed to by ICNDocument::cells()

Reimplemented from CNItem.

Definition at line 174 of file flowcontainer.cpp.

{
      if ( b_deleted || !isVisible() )
            add = false;

      if ( b_pointsAdded == add )
            return;
      
      b_pointsAdded = add;
      
      Cells *cells = p_icnDocument->cells();
      if (!cells) return;
      
      int _x = (int)x()+offsetX();
      int _y = (int)y()+offsetY();
      int w = width();
      int h = b_expanded ? height() : topStrip;
      
      const int mult = add ? 1 : -1;
      
      // Top strip
      for ( int y=_y; y <_y+24; ++y )
      {
            for ( int x = _x; x<=_x+w; x += 8 )
            {
                  if ( p_icnDocument->isValidCellReference( x/8, y/8 ) )
                  {
                        (*cells)[x/8][y/8].CIpenalty += mult*ICNDocument::hs_item;
                  }
            }
      }
      
      // Bottom strip
      for ( int y = _y+h-16; y <= _y+h; ++y )
      {
            for ( int x = _x; x<=_x+width(); x += 8 )
            {
                  if ( p_icnDocument->isValidCellReference( x/8, y/8 ) )
                  {
                        (*cells)[x/8][y/8].CIpenalty += mult*ICNDocument::hs_item;
                  }
            }
      }
      
      // Left strip
      int x = _x;
      for ( int y = _y+24; y<_y+h-16; y += 8 )
      {
            if ( p_icnDocument->isValidCellReference( x/8, y/8 ) )
            {
                  (*cells)[x/8][y/8].CIpenalty += mult*ICNDocument::hs_item;
            }
      }
      
      // Right strip
      x = _x+width();
      for ( int y = _y+24; y<_y+h-16; y += 8 )
      {
            if ( p_icnDocument->isValidCellReference( x/8, y/8 ) )
            {
                  (*cells)[x/8][y/8].CIpenalty += mult*ICNDocument::hs_item;
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index