int trace_create_analyse( WGre *gre, double x, double y, vldh_t_node source, int source_conpoint) { static int idx = 0; vldh_t_conobject dummy_con; flow_tTraceObj object_str; flow_tTraceAttr attr_str; flow_eTraceType trace_type; flow_tNode n1; flow_tCon c1; char name[80]; int sts; if ( gre->trace_started) { /* Create a trace object */ sprintf( name, "Trace%d", idx++); dummy_con.hc.source_node = source; dummy_con.lc.source_point = source_conpoint; sts = trace_get_attr_con( gre, &dummy_con, "", object_str, attr_str, &trace_type); if (EVEN(sts)) return sts; flow_CreateNode( gre->flow_ctx, name, gre->trace_analyse_nc, x, y, NULL, &n1); flow_SetTraceAttr( n1, object_str, attr_str, trace_type, 0); flow_CreateCon( gre->flow_ctx, name, gre->trace_con_cc, source->hn.node_id, n1, source_conpoint, 0, NULL, &c1, 0, NULL, NULL, &sts); if ( EVEN(sts)) return sts; } return TRA__SUCCESS; }
int goec_con_draw( WGre *gre, vldh_t_con con, int create_flag, vldh_t_node node ) { int sts; flow_tConClass con_class; int i, num; double *x_arr, *y_arr; double x[10], y[10]; vldh_t_node tmp_node_pointer; unsigned long tmp_point; pwr_tObjid tmp_node_did; if ( con->lc.drawtype == GOEN_CONSYSREF || con->lc.drawtype == GOEN_CONUSERREF) /* This is a fix for backward compatibility */ sts = gre->get_conclass( 0, (con->hc.wind)->hw.ldhses, con->lc.object_type, &con_class); else sts = gre->get_conclass( con->lc.cid, (con->hc.wind)->hw.ldhses, con->lc.object_type, &con_class); /* For grafcet-connectins source and destination class has to be right*/ if ( (con->lc.cid == pwr_cClass_TransDiv && con->hc.dest_node->ln.cid == pwr_cClass_trans) || (con->lc.cid == pwr_cClass_TransConv && con->hc.source_node->ln.cid == pwr_cClass_trans) || (con->lc.cid == pwr_cClass_StepDiv && con->hc.source_node->ln.cid == pwr_cClass_trans) || (con->lc.cid == pwr_cClass_StepConv && con->hc.dest_node->ln.cid == pwr_cClass_trans)) { /* Shift */ tmp_node_pointer = con->hc.source_node; tmp_point = con->lc.source_point; tmp_node_did = con->lc.source_oid; con->hc.source_node = con->hc.dest_node; con->lc.source_point = con->lc.dest_point; con->lc.source_oid = con->lc.dest_oid; con->hc.dest_node = tmp_node_pointer; con->lc.dest_point = tmp_point; con->lc.dest_oid = tmp_node_did; } if ( create_flag != GRE_CON_NONROUTE) { flow_CreateCon( gre->flow_ctx, con->hc.name, con_class, con->hc.source_node->hn.node_id, con->hc.dest_node->hn.node_id, con->lc.source_point, con->lc.dest_point, con, &con->hc.con_id, 0, NULL, NULL, &sts); if ( EVEN(sts)) { printf( "** Corrupt connection deleted: source %s, destination %s\n", con->hc.source_node->hn.name, con->hc.dest_node->hn.name); vldh_con_delete( con); return sts; } flow_GetConPosition( con->hc.con_id, &x_arr, &y_arr, &num); for ( i = 0; i < num; i++) { con->lc.point[i].x = x_arr[i]; con->lc.point[i].y = y_arr[i]; } con->lc.point_count = num; } else { // In V2.7 max point was 10, in flow it is 8... if ( con->lc.point_count > 8) con->lc.point_count = 8; for ( i = 0; i < (int)con->lc.point_count; i++) { x[i] = con->lc.point[i].x; y[i] = con->lc.point[i].y; } flow_CreateCon( gre->flow_ctx, con->hc.name, con_class, con->hc.source_node->hn.node_id, con->hc.dest_node->hn.node_id, con->lc.source_point, con->lc.dest_point, con, &con->hc.con_id, con->lc.point_count, x, y, &sts); if ( EVEN(sts)) { printf( "** Corrupt connection deleted: source %s, destination %s\n", con->hc.source_node->hn.name, con->hc.dest_node->hn.name); vldh_con_delete( con); return sts; } } return GRE__SUCCESS; }