cppDrawEdges

UseCase



// COM1205 Propagation Pattern for DemDraw Project.
//
// Created by Tom Kneeland (tomk@ccs.neu.edu)
//
// This propagation patter will traverse all the edges stored in a Graph
// object, collect all Position and Name data, and call either
// tclCEdge, or tclAEdge to draw a Construction Edge, or Alternation Edge
// appropriately.
//
// Modification History:
//
// 11/21/95 Carlos Santiago (carlos@ccs.neu.edu)
//	Modified to take advantage of the fact that coordinates are now stored
//	as strings.

(@
#include <iostream.h>
#include <strstream.h>
//#include "tclexec.h"
@)

*operation* void cppDrawEdges()
   *constraints*
	*classes* Graph, Edge, Vertex, AltEdge, ConstEdge, Coordinates, EdgeName, AltVertex, ConstVertex
	*directives*
	    EdgeTo = *from* Edge *through* -> *,vto,*, -> *,position,* *to* Coordinates;

	    EdgeFrom = *from* Edge *through* -> *,vfrom,*, -> *,position,* *to* Coordinates;

	    EdgeN = *from* ConstEdge *via* EdgeName *to* Coordinates;

            AllEdges = *from* Graph *through* -> *,edges,* *to* { AltEdge, ConstEdge };
    *end*

    *traverse* AllEdges

    *wrapper* AltEdge
	*suffix*
	(@ ostrstream str;
	   char tempchar[300];
	   str << "tclAEdge  " ;
	   str << this->get_from()->get_vertexname()->get_name() << " ";
	   str << this->get_to()->get_vertexname()->get_name();
	   if (this->get_middlepoints() != NULL)
         {  strcpy(tempchar,*this->get_middlepoints()->get_coords()) ;

	   str << tempchar;
	}
	   cout << "+++ tcl call " << str.str() << endl;
	   //tclexec << str.str();
	 @)

    *wrapper* ConstEdge
	*suffix*
	(@ ostrstream str;
	   char tempchar[300];

	   str << "tclCEdge  " ;
	   str << this->get_edgename()->get_name() << "" ;
	   str << this->get_from()->get_vertexname()->get_name() << " ";
	   str << this->get_to()->get_vertexname()->get_name();
	   strcpy( tempchar, *this->get_edgename()->get_en_offset()->get_coords() );
	   str << tempchar << " ";

	   if (this->get_middlepoints() != NULL)
            { strcpy(tempchar,*this->get_middlepoints()->get_coords()) ;
	   str << tempchar;
	    }

	   cout << "+++ tcl call " << str.str() << endl;
	   //tclexec << str.str();
	 @)