Changeset 1686 for XIOS/dev/dev_olga/src/graphviz.cpp
- Timestamp:
- 07/31/19 13:51:01 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/graphviz.cpp
r1653 r1686 11 11 * 12 12 */ 13 void CGraphviz::build StaticWorkflowGraph()13 void CGraphviz::buildWorkflowGraphDot() 14 14 TRY 15 15 { 16 if ( !CWorkflowGraph::mapFieldToFilters.empty())16 if (CWorkflowGraph::mapFieldToFilters_ptr_with_info !=0 && !CWorkflowGraph::mapFieldToFilters_ptr_with_info->empty()) 17 17 { 18 18 CWorkflowGraph::buildStaticWorkflow(); … … 58 58 boost::make_label_writer(get(edge_name, g)), 59 59 boost::make_graph_attributes_writer(graph_attr, vertex_attr, edge_attr)); 60 60 61 } 61 62 } 62 63 CATCH 64 65 66 67 68 void CGraphviz::buildWorkflowGraphVisjs_with_info() 69 TRY 70 { 71 if (CWorkflowGraph::mapFilters_ptr_with_info !=0 && !CWorkflowGraph::mapFilters_ptr_with_info->empty()) 72 { 73 CWorkflowGraph::buildStaticWorkflow_with_info(); 74 75 StdString color_table[7] = {"black", "red", "blue", "green", "purple", "yellow", "gray"}; 76 77 std::ofstream fs_json; 78 fs_json.open ("graph_data.json", std::fstream::out); 79 80 fs_json << "{\"nodes\":["<<std::endl<<" "; 81 static bool firstnode=true; 82 static bool firstedge=true; 83 84 for (auto it=CWorkflowGraph::mapFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFilters_ptr_with_info->end(); it++) 85 { 86 if(firstnode) 87 { 88 fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl; 89 firstnode = false; 90 } 91 else 92 { 93 fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl; 94 } 95 if(it->second.filter_class == 1) // source filter 96 fs_json << " \"label\": \""<<it->second.filter_name<<"\\n("<<it->second.field_id<<")\", "<<std::endl; 97 else 98 fs_json << " \"label\": \""<<it->second.filter_name<<"\", "<<std::endl; 99 fs_json << " \"class\": "<<it->second.filter_class<<", "<<std::endl; 100 fs_json << " \"filled\": "<<it->second.filter_filled<<", "<<std::endl; 101 fs_json << " \"type\": \""<<it->second.transform_type<<"\", "<<std::endl; 102 fs_json << " \"entry\": "<<it->second.expected_entry_nb<<", "<<std::endl; 103 fs_json << " \"inputs\": "<<it->second.inputs_complete<<", "<<std::endl; 104 fs_json << " \"tag\": "<<it->second.filter_tag<<", "<<std::endl; 105 fs_json << " \"cid\": "<<it->second.clusterID<<", "<<std::endl; 106 fs_json << " \"distance\": "<<it->second.distance<<", "<<std::endl; 107 fs_json << " \"attributes\": \""<<it->second.attributes<<"\"}"<<std::endl<<" "; 108 } 109 fs_json << " ],"<<std::endl; 110 111 112 fs_json << " \"edges\" : ["<<std::endl<<" "; 113 114 for (auto it=CWorkflowGraph::mapFieldToFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFieldToFilters_ptr_with_info->end(); it++) 115 { 116 if(firstedge) 117 { 118 fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl; 119 firstedge = false; 120 } 121 else 122 { 123 fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl; 124 } 125 fs_json << " \"from\": "<<it->second.from+1<<", "<<std::endl; 126 fs_json << " \"to\": "<<it->second.to+1<<", "<<std::endl; 127 fs_json << " \"label\": \""<<it->second.field_id<<"\\n"<<it->second.date<<"\", "<<std::endl; 128 // fs_json << " \"title\": \""<<"Show more information about this field"<<"\", "<<std::endl; 129 // fs_json << " \"fid\": \""<<it->second.field_id<<"\", "<<std::endl; 130 // fs_json << " \"fname\": \""<<it->second.field_name<<"\", "<<std::endl; 131 // fs_json << " \"gid\": \""<<it->second.grid_id<<"\", "<<std::endl; 132 fs_json << " \"date\": \""<<it->second.date<<"\", "<<std::endl; 133 fs_json << " \"attributes\": \"id = "<<it->second.field_id<<"</br>"<<it->second.attributes<<"\"}"<<std::endl<<" "; 134 135 } 136 fs_json << " ]}"<<std::endl; 137 138 fs_json.close(); 139 } 140 } 141 CATCH 142 143 144 145 void CGraphviz::showStaticWorkflowGraph() 146 TRY 147 { 148 CWorkflowGraph::showStaticWorkflow(); 149 } 150 CATCH 63 151 }
Note: See TracChangeset
for help on using the changeset viewer.