newntui/discovermdi/src/disgraphnode.cpp
//-----------------------------------------------------------------------------------
// Will walk and re-reference all nodes and fields to have up-to-date
// IDs. We need this when something is removed and we need to rebuild
// global server array.
//-----------------------------------------------------------------------------------
Will walk and re-reference all nodes and fields to have up-to-date
IDs. We need this when something is removed and we need to rebuild
global server array.
Will walk and re - reference all nodes and fields to have up - to - date IDs . We need this when something is removed and we need to rebuild global server array .
void CDisGraph::ReReference(void) {
TSDListIterator nodeIterator(pNodeDList());
TSDListIterator hideIterator(pHideDigraph()->pNodeDList());
CDisGraphNode* pNode;
CString result;
CItemsList* nodeItems;
int oldIndex;
int newIndex;
CString command;
	Evaluate(CString("graph_copy_start"));
    while(nodeIterator)  {
		pNode = (CDisGraphNode *) nodeIterator.pObject();
		oldIndex = pNode->GetNodeID();
		command.Format("graph_copy_element %u",oldIndex);
		result = Evaluate(command);
		newIndex = atoi(result);
		pNode->SetNodeID(newIndex);
		nodeItems=pNode->GetItemsList();
		POSITION pos = nodeItems->GetHeadPosition();
		while(pos) {
            oldIndex = nodeItems->GetAt(pos).m_FieldID;
		    command.Format("graph_copy_element %u",oldIndex);
		    result = Evaluate(command);
		    newIndex = atoi(result);
			CNodeItem item;
            item = nodeItems->GetAt(pos);
			item.m_FieldID=newIndex;
			nodeItems->SetAt(pos,item);
			nodeItems->GetNext(pos);
		}
		nodeIterator++;
	}
    while(hideIterator)  {
		pNode = (CDisGraphNode *) hideIterator.pObject();
		oldIndex = pNode->GetNodeID();
		command.Format("graph_copy_element %u",oldIndex);
		result = Evaluate(command);
		newIndex = atoi(result);
		pNode->SetNodeID(newIndex);
		nodeItems=pNode->GetItemsList();
		POSITION pos = nodeItems->GetHeadPosition();
		while(pos) {
            oldIndex = nodeItems->GetAt(pos).m_FieldID;
		    command.Format("graph_copy_element %u",oldIndex);
		    result = Evaluate(command);
		    newIndex = atoi(result);
			CNodeItem item;
            item = nodeItems->GetAt(pos);
			item.m_FieldID=newIndex;
			nodeItems->SetAt(pos,item);
			nodeItems->GetNext(pos);
		}
		hideIterator++;
	}
	Evaluate(CString("graph_copy_complete"));
}
void CDisGraph :: ReReference ( void ) { TSDListIterator nodeIterator ( pNodeDList ( ) ) ; TSDListIterator hideIterator ( pHideDigraph ( ) -> pNodeDList ( ) ) ; CDisGraphNode * pNode ; CString result ; CItemsList * nodeItems ; int oldIndex ; int newIndex ; CString command ; Evaluate ( CString ( " " ) ) ; while ( nodeIterator ) { pNode = ( CDisGraphNode * ) nodeIterator . pObject ( ) ; oldIndex = pNode -> GetNodeID ( ) ; command . Format ( " " , oldIndex ) ; result = Evaluate ( command ) ; newIndex = atoi ( result ) ; pNode -> SetNodeID ( newIndex ) ; nodeItems = pNode -> GetItemsList ( ) ; POSITION pos = nodeItems -> GetHeadPosition ( ) ; while ( pos ) { oldIndex = nodeItems -> GetAt ( pos ) . m_FieldID ; command . Format ( " " , oldIndex ) ; result = Evaluate ( command ) ; newIndex = atoi ( result ) ; CNodeItem item ; item = nodeItems -> GetAt ( pos ) ; item . m_FieldID = newIndex ; nodeItems -> SetAt ( pos , item ) ; nodeItems -> GetNext ( pos ) ; } nodeIterator ++ ; } while ( hideIterator ) { pNode = ( CDisGraphNode * ) hideIterator . pObject ( ) ; oldIndex = pNode -> GetNodeID ( ) ; command . Format ( " " , oldIndex ) ; result = Evaluate ( command ) ; newIndex = atoi ( result ) ; pNode -> SetNodeID ( newIndex ) ; nodeItems = pNode -> GetItemsList ( ) ; POSITION pos = nodeItems -> GetHeadPosition ( ) ; while ( pos ) { oldIndex = nodeItems -> GetAt ( pos ) . m_FieldID ; command . Format ( " " , oldIndex ) ; result = Evaluate ( command ) ; newIndex = atoi ( result ) ; CNodeItem item ; item = nodeItems -> GetAt ( pos ) ; item . m_FieldID = newIndex ; nodeItems -> SetAt ( pos , item ) ; nodeItems -> GetNext ( pos ) ; } hideIterator ++ ; } Evaluate ( CString ( " " ) ) ; }
Will walk and re-reference all nodes and fields to have up-to-date
IDs.
Will walk and re - reference all nodes and fields to have up - to - date IDs .
// We will copy entity connected to the node from the original global // server array into the new one and we will assign the node an index // of the entity in the new array. // We will copy all node fields from the original global server array // to the new array and we will assign the entitiy index in the new // array to the client node field. // We will copy entity connected to the node from the original global // server array into the new one and we will assign the node an index // of the entity in the new array. // We will copy all node fields from the original global server array // to the new array and we will assign the entitiy index in the new // array to the client node field.