Exemple #1
0
/*************************************************************************
*
* Name:		goen_get_location_point_m0()
*
* Type		
*
* Type		Parameter	IOGF	Description
*    pwr_sGraphPlcNode	*graphbody	Pointer to objecttype data
*    goen_point_type	*info_pointer		Locationpoint
*
* Description:
*	Calculates kooridates for locationpoint relativ geomtrical center.
*
**************************************************************************/
int goen_get_location_point_m0( WGre *grectx, pwr_sGraphPlcNode *graphbody, 
				unsigned int *mask, unsigned long node_width, 
				goen_point_type *info_pointer, vldh_t_node node)
{
   info_pointer->y = 0;
   info_pointer->x = 0;
#if 0
    int  i;
    int	ipoints;
    int	inputpoints, outputpoints;
    unsigned long    pointmask;
    unsigned long    *mask_pointer;
    int 		i_innr;
    int 		i_internnr;
    int			i_outnr;
    float		ll_x,ll_y,mid_x,mid_y;
    int			sts;

	/* Get number of parameters */
	i_innr = graphbody->parameters[PAR_INPUT];
	i_internnr = graphbody->parameters[PAR_INTERN];
	i_outnr = graphbody->parameters[PAR_OUTPUT];

	/* Count number of inputpoints in mask  */
	mask_pointer = mask;
	pointmask = 1;
	inputpoints = 0;
	for ( i = 0; i < i_innr; i++)  
	{
	  inputpoints += ((*mask_pointer & pointmask) != 0);
	  pointmask <<= 1;
	}
	/* Count number of outputpoints in mask  */
	pointmask = 1;
	outputpoints = 0;
	mask_pointer++;
	for ( i = 0; i < i_outnr; i++)  
	{
	  outputpoints += ((*mask_pointer & pointmask) != 0);
	  pointmask <<= 1;
	}
	
	sts = NetedMeasureNode( grectx->neted_window,
			  node->hn.node_id,
			  &ll_x,&ll_y,&mid_x,&mid_y,&f_width,&f_height);
	tst_neted( sts, "NetedMeasureNode", 204 );

	f_width -= 2* GOEN_F_LINEWIDTH;
	f_height -= 2* GOEN_F_LINEWIDTH;
	if ( inputpoints > 0)
	  f_width -= f_pinlength;
	if ( outputpoints > 0)
	  f_width -= f_pinlength;

	info_pointer->y = - f_height / 2 + f_repeat * 1.5;
	info_pointer->x = f_width/2 - f_pinlength / 2 * ( outputpoints == 0 );

#endif
	return GOEN__SUCCESS;
}
/*************************************************************************
*
* Name:		goen_get_location_point_m5()
*
* Type		
*
* Type		Parameter	IOGF	Description
*    pwr_sGraphPlcNode	*graphbody	Pointer to objecttype data
*    goen_point_type	*info_pointer		Locationpoint
*
* Description:
*	Calculates kooridates for locationpoint relativ geomtrical center.
*
**************************************************************************/
int goen_get_location_point_m5( WGre *grectx, pwr_sGraphPlcNode *graphbody, 
				unsigned int *mask, unsigned long node_width, 
				goen_point_type *info_pointer, vldh_t_node node)
{
#if 0
    int  i;
    int	ipoints;
    int	inputpoints, outputpoints;
	unsigned long    pointmask;
	unsigned int     *inmask_pointer;
	unsigned int     *outmask_pointer;
	int 		inputs;
	int 		interns;
	int			ouputs;
	float		ll_x,ll_y,mid_x,mid_y;
	int		sts;

	/* Get number of parameters */
	inputs = graphbody->parameters[PAR_INPUT];
	interns = graphbody->parameters[PAR_INTERN];
	ouputs = graphbody->parameters[PAR_OUTPUT];

	inmask_pointer = mask++;
	outmask_pointer = mask;

	/* Check if condition input in mask (second bit) */
	pointmask = 2;
	inputpoints = 1;
	inputpoints += ((*inmask_pointer & pointmask) != 0);

	/* Check if output in mask (first bit) */
	pointmask = 1;
	outputpoints = 0;
	outputpoints += ((*outmask_pointer & pointmask) != 0);
	
	sts = NetedMeasureNode( grectx->neted_window,
			  node->hn.node_id,
			  &ll_x,&ll_y,&mid_x,&mid_y,&f_width,&f_height);
	tst_neted( sts, "NetedMeasureNode", 204 );

	f_width -= 2* GOEN_F_LINEWIDTH;
	f_height -= 2* GOEN_F_LINEWIDTH;
	if ( inputpoints == 2)
	  f_height -= f_pinlength;
	f_width -= f_pinlength;
	if ( outputpoints > 0)
	  f_width -= f_pinlength;

	info_pointer->x = f_width/2 + f_pinlength / 2 * 
		(( inputpoints == 0 ) - ( outputpoints == 0 ));
	info_pointer->y = f_pinlength/2 * ( inputpoints == 2 );


#endif
	return GOEN__SUCCESS;
}
/*************************************************************************
*
* Name:		goen_get_location_point_m3()
*
* Type		
*
* Type		Parameter	IOGF	Description
*    pwr_sGraphPlcNode	*graphbody	Pointer to objecttype data
*    goen_point_type	*info_pointer		Locationpoint
*
* Description:
*	Calculates kooridates for locationpoint relativ geomtrical center.
*
**************************************************************************/
int goen_get_location_point_m3( WGre *grectx, pwr_sGraphPlcNode *graphbody, 
				unsigned int *mask, unsigned long node_width, 
				goen_point_type *info_pointer, vldh_t_node node)
{
#if 0
	int		sts, size;
	float		ll_x,ll_y,mid_x,mid_y;

	sts = NetedMeasureNode( grectx->neted_window,
			  node->hn.node_id,
			  &ll_x,&ll_y,&mid_x,&mid_y,&f_width,&f_height);
	tst_neted( sts, "NetedMeasureNode", 204 );

	f_width -= 2* GOEN_F_LINEWIDTH;
	f_height -= 2* GOEN_F_LINEWIDTH;

	info_pointer->x = f_width / 2;
	info_pointer->y = - f_height / 2 + GOEN_F_GRID / 2.;
#endif
	return GOEN__SUCCESS;
}
Exemple #4
0
/*************************************************************************
*
* Name:		goen_get_location_point_m4()
*
* Type		
*
* Type		Parameter	IOGF	Description
*    pwr_sGraphPlcNode	*graphbody	Pointer to objecttype data
*    goen_point_type	*info_pointer		Locationpoint
*
* Description:
*	Calculates kooridates for locationpoint relativ geomtrical center.
*
**************************************************************************/
int goen_get_location_point_m4( WGre *grectx, pwr_sGraphPlcNode *graphbody, 
				unsigned int *mask, unsigned long node_width, 
				goen_point_type *info_pointer, vldh_t_node node)
{
#if 0
	float 	center_x;
	float	center_y;
	double	root_ll_x;
	double	root_ll_y;
	double	root_width;
	double	root_height;
	goe_tab_con goe_point_info;
	int	graph_index;
	float	x_min, y_max;
	int	x_found, y_found;
	int	i;
	float	ll_x,ll_y,mid_x,mid_y;
	int	sts;
	float	f_width, f_height;
	float	delta = 0.004079;
	ldh_tSesContext	 ldhses;

	ldhses = (node->hn.window_pointer)->hw.ldhsession;

	/* Get graph index for this class */
	graph_index = graphbody->graphindex;	
	sts = NetedMeasureNode( grectx->neted_window,
			  node->hn.node_id,
			  &ll_x,&ll_y,&mid_x,&mid_y,&f_width,&f_height);
	tst_neted( sts, "NetedMeasureNode", 204 );

	goe_measure_node( graph_index, scale, &root_ll_x, &root_ll_y,
				&root_width, &root_height);

	y_found = 0;
	x_found = 0;
	y_max = -10000.;
	x_min = 10000.;
	i = 0;
	while ( goe_get_connection_point( graph_index, i, scale, &goe_point_info)
						 != 0 )
	{
	  if ( (goe_point_info.direction == CON_CENTER) ||
		(goe_point_info.direction == CON_LEFT) ||
		(goe_point_info.direction == CON_RIGHT) )
	  {
	    y_max = max( y_max, goe_point_info.loc.y );
	    y_found = 1;
	  }
	  if ( (goe_point_info.direction == CON_CENTER) ||
		(goe_point_info.direction == CON_UP) ||
		(goe_point_info.direction == CON_DOWN) )
	  {
	    x_min = min( x_min, goe_point_info.loc.x );
	    x_found = 1;
	  }
	  i++;
	}
	if ( !y_found )
	  y_max = root_height / 2 + root_ll_y;

	if ( !x_found )
	  x_min = root_width / 2 + root_ll_x;

	info_pointer->x = f_width / 2 - ( x_min - root_ll_x + delta);
	info_pointer->y = f_height / 2  - ( delta + root_height 
			- ( y_max - root_ll_y));

	if ( node->ln.classid == pwr_cClass_trans)
	  info_pointer->x = f_width / 2 - ( x_min - root_ll_x + delta * 3.0/2);

#endif	
	return GOEN__SUCCESS;
}