Commit ee67737f authored by claes's avatar claes

Return status in create connection added

parent b74a2548
/*
* Proview $Id: rt_trace.cpp,v 1.2 2007-01-17 06:22:47 claes Exp $
* Proview $Id: rt_trace.cpp,v 1.3 2007-11-22 08:50:11 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -603,7 +603,7 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
flow_CreateCon( ctx, name, tractx->trace_con_cc,
event->con_create.source_object, n1,
event->con_create.source_conpoint, 0,
NULL, &c1, 0, NULL, NULL);
NULL, &c1, 0, NULL, NULL, &sts);
}
}
switch ( event->event) {
......
/*
* Proview $Id: wb_goec.cpp,v 1.1 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_goec.cpp,v 1.2 2007-11-22 08:50:55 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -113,7 +113,13 @@ int goec_con_draw(
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);
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];
......@@ -135,7 +141,13 @@ int goec_con_draw(
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);
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;
}
......
/*
* Proview $Id: wb_gre.cpp,v 1.6 2007-09-25 13:36:32 claes Exp $
* Proview $Id: wb_gre.cpp,v 1.7 2007-11-22 08:50:55 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -2288,7 +2288,7 @@ void WGre::paste( float cursor_x, float cursor_y, int paste_type)
(*con_ptr)->hc.dest_node->hn.node_id,
(*con_ptr)->lc.source_point, (*con_ptr)->lc.dest_point,
*con_ptr, &(*con_ptr)->hc.con_id, (*con_ptr)->lc.point_count,
x, y);
x, y, &sts);
con_ptr++;
}
......
/*
* Proview $Id: wb_tra.cpp,v 1.1 2007-01-04 07:29:04 claes Exp $
* Proview $Id: wb_tra.cpp,v 1.2 2007-11-22 08:50:55 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1038,7 +1038,8 @@ int trace_create_analyse( WGre *gre,
flow_CreateCon( gre->flow_ctx, name, gre->trace_con_cc,
source->hn.node_id, n1, source_conpoint, 0, NULL, &c1,
0, NULL, NULL);
0, NULL, NULL, &sts);
if ( EVEN(sts)) return sts;
}
return TRA__SUCCESS;
}
......
/*
* Proview $Id: flow_api.cpp,v 1.11 2007-09-25 13:11:00 claes Exp $
* Proview $Id: flow_api.cpp,v 1.12 2007-11-22 08:51:50 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -166,12 +166,14 @@ void flow_CreateNode( flow_tCtx ctx, char *name, flow_tNodeClass nc,
void flow_CreateCon( flow_tCtx ctx, char *name, flow_tConClass cc,
flow_tNode source, flow_tNode dest, int source_conpoint,
int dest_conpoint, void *user_data, flow_tCon *con,
int point_num, double *x_vect, double *y_vect)
int point_num, double *x_vect, double *y_vect, int *rsts)
{
FlowCon *c1;
c1 = new FlowCon( ctx, name, (FlowConClass *)cc, (FlowNode *)source,
(FlowNode *)dest, source_conpoint, dest_conpoint, 0, point_num,
(FlowNode *)dest, source_conpoint, dest_conpoint, rsts, 0, point_num,
x_vect, y_vect);
if ( EVEN(*rsts)) return;
c1->set_user_data( user_data);
ctx->insert( c1);
ctx->nav_zoom();
......@@ -191,12 +193,14 @@ void flow_CreatePasteNode( flow_tCtx ctx, char *name, flow_tNodeClass nc,
void flow_CreatePasteCon( flow_tCtx ctx, char *name, flow_tConClass cc,
flow_tNode source, flow_tNode dest, int source_conpoint,
int dest_conpoint, void *user_data, flow_tCon *con,
int point_num, double *x_vect, double *y_vect)
int point_num, double *x_vect, double *y_vect, int *rsts)
{
FlowCon *c1;
c1 = new FlowCon( ctx, name, (FlowConClass *)cc, (FlowNode *)source,
(FlowNode *)dest, source_conpoint, dest_conpoint, 1, point_num,
(FlowNode *)dest, source_conpoint, dest_conpoint, rsts, 1, point_num,
x_vect, y_vect);
if ( EVEN(*rsts)) return;
c1->set_user_data( user_data);
ctx->paste_insert( c1);
*con = (flow_tCon) c1;
......
/*
* Proview $Id: flow_api.h,v 1.11 2007-09-25 13:11:00 claes Exp $
* Proview $Id: flow_api.h,v 1.12 2007-11-22 08:51:50 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -108,13 +108,13 @@ void flow_CreateNode( flow_tCtx ctx, char *name, flow_tNodeClass nc,
void flow_CreateCon( flow_tCtx ctx, char *name, flow_tConClass cc,
flow_tNode source, flow_tNode dest, int source_conpoint,
int dest_conpoint, void *user_data, flow_tCon *con,
int point_num, double *x_vect, double *y_vect);
int point_num, double *x_vect, double *y_vect, int *rsts);
void flow_CreatePasteNode( flow_tCtx ctx, char *name, flow_tNodeClass nc,
double x, double y, void *user_data, flow_tNode *node);
void flow_CreatePasteCon( flow_tCtx ctx, char *name, flow_tConClass cc,
flow_tNode source, flow_tNode dest, int source_conpoint,
int dest_conpoint, void *user_data, flow_tCon *con,
int point_num, double *x_vect, double *y_vect);
int point_num, double *x_vect, double *y_vect, int *rsts);
void flow_SetAnnotation( flow_tNode node, int number, char *text, int size);
void flow_SetPasteNodeAnnotation( flow_tNode node, int number, char *text,
int size);
......
/*
* Proview $Id: flow_array.cpp,v 1.5 2007-05-11 15:07:50 claes Exp $
* Proview $Id: flow_array.cpp,v 1.6 2007-11-22 08:51:50 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -725,8 +725,10 @@ void FlowArray::open( void *ctx, ifstream& fp)
}
case flow_eSave_Con:
{
int sts;
FlowCon *n = new FlowCon( (FlowCtx *) ctx, "", (FlowConClass *)0,
(FlowNode *)0, (FlowNode *)0, 0, 0);
(FlowNode *)0, (FlowNode *)0, 0, 0, &sts);
n->open( fp);
insert( n);
break;
......
/*
* Proview $Id: flow_con.cpp,v 1.6 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_con.cpp,v 1.7 2007-11-22 08:51:50 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -32,6 +32,7 @@
#include "flow_arrow.h"
#include "flow_text.h"
#include "flow_utils.h"
#include "flow_msg.h"
#define LINE_TABLE_SIZE 500
#define HV_LINE_ARRAY_SIZE 500
......@@ -129,7 +130,7 @@ FlowCon::FlowCon( FlowCtx *flow_ctx, char *name, FlowConClass *con_class,
FlowCon::FlowCon( FlowCtx *flow_ctx, char *name, FlowConClass *con_class,
FlowNode *source, FlowNode *dest, int source_cp, int dest_cp,
int nodraw, int point_num, double *x_vect, double *y_vect) :
int *rsts, int nodraw, int point_num, double *x_vect, double *y_vect) :
ctx(flow_ctx), cc(con_class),
dest_node(dest), source_node(source), dest_conpoint(dest_cp), source_conpoint(source_cp),
p_num(point_num), l_num(0), a_num(0), arrow_num(0), ref_num(0),
......@@ -144,7 +145,6 @@ FlowCon::FlowCon( FlowCtx *flow_ctx, char *name, FlowConClass *con_class,
FlowArc *a1;
FlowArrow *arrow;
int i;
int sts;
if ( !cc)
return;
......@@ -159,8 +159,11 @@ FlowCon::FlowCon( FlowCtx *flow_ctx, char *name, FlowConClass *con_class,
point_y[i] = y_vect[i];
}
}
source->get_conpoint( source_cp, &src_x, &src_y, &source_direction);
dest->get_conpoint( dest_cp, &dest_x, &dest_y, &dest_direction);
*rsts = source->get_conpoint( source_cp, &src_x, &src_y, &source_direction);
if ( EVEN(*rsts)) return;
*rsts = dest->get_conpoint( dest_cp, &dest_x, &dest_y, &dest_direction);
if ( EVEN(*rsts)) return;
switch ( cc->con_type)
{
case flow_eConType_Straight:
......@@ -274,14 +277,10 @@ FlowCon::FlowCon( FlowCtx *flow_ctx, char *name, FlowConClass *con_class,
}
else
{
sts = con_route( src_x, src_y, source_direction, dest_x, dest_y,
dest_direction);
if ( EVEN(sts) && sts != 0)
{
cout << "FlowCon:no such conpoint" << endl;
return;
}
if ( sts == 0)
*rsts = con_route( src_x, src_y, source_direction, dest_x, dest_y,
dest_direction);
if ( EVEN(*rsts) && *rsts != 0) return;
if ( *rsts == 0)
temporary_ref = 1;
else
temporary_ref = 0;
......@@ -372,7 +371,7 @@ FlowCon::FlowCon( FlowCtx *flow_ctx, char *name, FlowConClass *con_class,
strcpy( c_name, name);
get_con_borders();
*rsts = FLOW__SUCCESS;
}
FlowCon::~FlowCon()
......
/*
* Proview $Id: flow_con.h,v 1.3 2005-10-21 16:11:22 claes Exp $
* Proview $Id: flow_con.h,v 1.4 2007-11-22 08:51:50 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -57,9 +57,9 @@ class FlowCon : public FlowArrayElem {
FlowNode *source, FlowNode *dest, int source_cp, int dest_cp);
#endif
FlowCon( FlowCtx *flow_ctx, char *name, FlowConClass *con_class,
FlowNode *source, FlowNode *dest, int source_cp, int dest_cp,
int nodraw = 0, int point_num = 0, double *x_vect = 0,
double *y_vect = 0);
FlowNode *source, FlowNode *dest, int source_cp, int dest_cp,
int *rsts, int nodraw = 0, int point_num = 0,
double *x_vect = 0, double *y_vect = 0);
~FlowCon();
FlowCon() {};
FlowCon( const FlowCon& c, FlowNode *source, FlowNode *dest);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment