Logo Search packages:      
Sourcecode: ktechlab version File versions

Node * CNItem::createNode ( double  _x,
double  _y,
int  orientation,
const QString &  name,
uint  type 
) [inherited]

Creates a node which is attached to the item. The node will be moved about with the item, and destroyed along with the item. The position coordinates of the node are relative to the upper left corner of the item.

Parameters:
type See Node::node_type

Definition at line 240 of file cnitem.cpp.

References Node::id(), Item::level(), Node::setChildId(), Node::setLevel(), Node::setParentItem(), and CNItem::updateAttachedPositioning().

Referenced by FlowPart::createAltOutput(), FlowPart::createStdInput(), and FlowPart::createStdOutput().

{
      orientation %= 360;
      if ( orientation < 0 )
            orientation += 360;
      
      Node::node_dir dir;
      
      if          ( orientation == 0 )    dir = Node::dir_right;
      else if ( orientation == 90 ) dir = Node::dir_down;
      else if ( orientation == 180 )      dir = Node::dir_left;
      else if ( orientation == 270 )      dir = Node::dir_up;
      else
      {
            kdError() << k_funcinfo << "Unknown orientation: " << orientation << endl;
            return 0l;
      }
      
      Node *node;
      if ( (type == Node::ec_pin) || (type == Node::ec_junction) )
      {
            node = new ECNode( p_icnDocument, Node::node_type(type), dir, QPoint( 0, 0 ) );
      }
      else
      {
            node = new FPNode( p_icnDocument, Node::node_type(type), dir, QPoint( 0, 0 ) );
      }
      node->setLevel( level() );
      
      node->setParentItem(this);
      node->setChildId(name);
      
      NodeInfo info;
      info.id = node->id();
      info.node = node;
      info.x = _x;
      info.y = _y;
      info.orientation = orientation;
      
      m_nodeMap[name] = info;
      
      updateAttachedPositioning();
      
      return node;
}


Generated by  Doxygen 1.6.0   Back to index