57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
#include "main.h"
|
|
#include "utility.h"
|
|
|
|
using CustomGraph = boost::adjacency_list < boost::vecS, boost::vecS, boost::directedS, Pin >;
|
|
|
|
// https://www.boost.org/doc/libs/1_55_0/libs/graph/doc/write-graphviz.html
|
|
// https://www.boost.org/doc/libs/1_65_0/libs/graph/doc/subgraph.html
|
|
|
|
void test4 ( void ) {
|
|
std::ifstream fileStream;
|
|
|
|
fileStream.open ( "test.csv" );
|
|
|
|
// for testing
|
|
CustomGraph W653;
|
|
|
|
|
|
if ( fileStream.is_open () ) {
|
|
std::string inputLine;
|
|
|
|
// Skip Header
|
|
std::getline ( fileStream, inputLine );
|
|
|
|
while ( std::getline ( fileStream, inputLine ) ) {
|
|
auto values = split ( inputLine, ',' );
|
|
|
|
auto pinAName = values[0];
|
|
auto pinAConnectorType = values[2];
|
|
auto pinBName = values[4];
|
|
auto pinBConnectorType = values[6];
|
|
|
|
Pin pinA ( "W653", pinAName, pinAConnectorType );
|
|
Pin pinB ( "W653", pinBName, pinBConnectorType );
|
|
|
|
auto v1 = boost::add_vertex ( pinA, W653 );
|
|
auto v2 = boost::add_vertex ( pinB, W653 );
|
|
|
|
boost::add_edge ( v1, v2, W653 );
|
|
}
|
|
}
|
|
|
|
fileStream.close ();
|
|
|
|
std::ofstream dotFile ( "W653.dot" );
|
|
|
|
boost::dynamic_properties dp;
|
|
|
|
dp.property ( "node_id", boost::get ( &Pin::pin, W653 ) );
|
|
// dp.property ( "node_id", boost::make_transform_value_property_map < std::string > ( &Pin::pin, boost::identity_property_map {} ) );
|
|
dp.property ( "label", boost::get ( &Pin::pin, W653 ) );
|
|
dp.property ( "rankdir", boost::make_constant_property < CustomGraph * > ( std::string ( "LR" ) ) );
|
|
|
|
write_graphviz_dp ( dotFile, W653, dp );
|
|
|
|
qDebug () << "Finished";
|
|
}
|