cppDrawVertices

UseCase1




(@
#include < iostream.h >
#include < strstream.h >
@)

*operation* void cppDrawVertices()
  *constraints*
    *classes* Graph, Vertex, Coordinates, VertexName
      *directives*
         VertexN = *from* Vertex *via* vertexname *to* Coordinates;
           AllVertices = *from* Graph *through* -> *,vertices,* *to* { AltVertex, ConstVertex };
   *end*

//-------------------old codes----------------------------------------
//	*carry* *in* VertData* data = (@ new edgeData() @)
//	   *along* AllVerticies

//        *carry* *out* DemNumber* vX, *out* vY
//	   *along* position
//	   *at* Coordinates
//	           vX = (@ get_x() @)
//	           vY = (@ get_y() @)

//        *carry* *out* DemIdent* lName, *out* DemNumber* lX, *out* DemNumber* lY
//	   *along* VertexN
//	   *at* VertexName lName = (@ get_name() @)
//	   *at* Coordinates
//	           lX = (@ get_x() @)
//	           lY = (@ get_y() @)
//--------------------------------------------------------------------


   *traverse* AllVertices
     *wrapper* AltVertex
       *suffix*
        (@ 
	  ostrstream str;
	   
	  // get x, y coordinates for labels of alternation vertices
	  str << "tclAVert" << " {" << get_vertexname()->get_name() << "} ";
	  str << get_vertexname()->get_vn_position()->get_x() << " "; 
          str << get_vertexname()->get_vn_position()->get_y() << " "; 
          str << get_position()->get_x() << " "; 
          str << get_position()->get_y();
	  cout << "+++ tcl call " << str.str() << endl;
	 @)



    *wrapper* ConstVertex
      *suffix*
       (@ ostrstream str;


   	// get x, y coordinates for labels of construction vertices
	str << "tclCVert" << " {" << get_vertexname()->get_name() << "} ";
	str << get_vertexname()->get_vn_position()->get_x() << " "; 
        str << get_vertexname()->get_vn_position()->get_y() << " "; 
        str << get_position()->get_x() << " "; 
        str << get_position()->get_y();
	cout << "+++ tcl call " << str.str() << endl;   //ouput to terminal
	@)