Commit 06191506 authored by claes's avatar claes

Method 12: read nodeclass drawn in Ge added

parent ad7db411
/*
* Proview $Id: wb_goen.cpp,v 1.1 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_goen.cpp,v 1.2 2008-01-17 14:22:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -47,6 +47,7 @@
#include "wb_goenm9.h"
#include "wb_goenm10.h"
#include "wb_goenm11.h"
#include "wb_goenm12.h"
#include "wb_goenm14.h"
#include "wb_goenm15.h"
#include "wb_goenm16.h"
......@@ -78,7 +79,7 @@ goen_tGetParamFunc goen_get_parameter_m[20] = {
goen_get_parameter_m9,
goen_get_parameter_m10,
goen_get_parameter_m11,
goen_get_parameter_m0,
goen_get_parameter_m12,
goen_get_parameter_m0,
goen_get_parameter_m14,
goen_get_parameter_m15,
......@@ -98,7 +99,7 @@ goen_tCreateNodeTypeFunc goen_create_nodetype_m[20] = {
goen_create_nodetype_m9,
goen_create_nodetype_m10,
goen_create_nodetype_m11,
goen_create_nodetype_m0,
goen_create_nodetype_m12,
goen_create_nodetype_m0,
goen_create_nodetype_m14,
goen_create_nodetype_m15,
......@@ -118,7 +119,7 @@ goen_tGetPointInfoFunc goen_get_point_info_m[20] = {
goen_get_point_info_m9,
goen_get_point_info_m10,
goen_get_point_info_m11,
goen_get_point_info_m0,
goen_get_point_info_m12,
goen_get_point_info_m0,
goen_get_point_info_m14,
goen_get_point_info_m15,
......@@ -138,7 +139,7 @@ goen_tGetLocationPointFunc goen_get_location_point_m[20] = {
goen_get_location_point_m9,
goen_get_location_point_m10,
goen_get_location_point_m11,
goen_get_location_point_m0,
goen_get_location_point_m12,
goen_get_location_point_m0,
goen_get_location_point_m14,
goen_get_location_point_m15,
......
/*
* Proview $Id: wb_goenm12.cpp,v 1.1 2008-01-17 14:22:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include <stdio.h>
#include "pwr.h"
#include "flow_ctx.h"
#include "flow_api.h"
#include "co_dcli.h"
#include "wb_ldh.h"
#include "wb_foe_msg.h"
#include "wb_vldh.h"
#include "wb_goen.h"
#include "wb_gre.h"
#include "wb_goenm12.h"
static float f_strlength = GOEN_F_OBJNAME_STRWIDTH;
static float f_strheight = GOEN_F_OBJNAME_STRHEIGHT;
/*_Methods defined for this module_______________________________________*/
/*************************************************************************
*
* Name: goen_create_nodetype_m12()
*
* Type
*
* Type Parameter IOGF Description
* pwr_sGraphPlcNode *graphbody Pointer to objecttype data
* Widget widget Neted widget
* unsigned long *mask Mask for drawing inputs/outputs
* int color Highlight color
* Cursor cursor Hot cursor
* unsigned long *node_type_id Nodetypeid for created nodetype
*
* Description:
* Create a nodetype
*
**************************************************************************/
int goen_create_nodetype_m12( pwr_sGraphPlcNode *graphbody,
pwr_tClassId cid,
ldh_tSesContext ldhses,
flow_tCtx ctx,
unsigned long *mask,
unsigned long subwindowmark,
unsigned long node_width,
flow_tNodeClass *node_class,
vldh_t_node node)
{
int graph_index;
int annot_count;
int sts;
char annot_str[3][80];
int annot_nr[3];
char name[80];
int size;
flow_tNodeClass nc;
pwr_tFileName fname;
sts = ldh_ClassIdToName(ldhses, cid, name, sizeof(name), &size);
if ( EVEN(sts) ) return sts;
/* Get graph index for this class */
graph_index = graphbody->graphindex;
/* Get number of annotations and the width of the annotations */
sts = WGre::get_annotations( node,
(char *)annot_str, annot_nr, &annot_count,
sizeof( annot_str)/sizeof(annot_str[0]), sizeof( annot_str[0]));
if ( EVEN(sts)) return sts;
bool loaded = false;
if ( subwindowmark != 0) {
sprintf( fname, "$pwrp_exe/%s_sw.flwn", name);
cdh_ToLower( fname, fname);
dcli_translate_filename( fname, fname);
sts = flow_LoadNodeClass( ctx, fname, &nc);
if ( ODD(sts))
loaded = true;
else {
// Try base
sprintf( fname, "$pwr_exe/pwr_c_%s_sw.flwn", name);
cdh_ToLower( fname, fname);
dcli_translate_filename( fname, fname);
sts = flow_LoadNodeClass( ctx, fname, &nc);
if ( ODD(sts))
loaded = true;
}
}
if ( !loaded) {
sprintf( fname, "$pwrp_exe/%s.flwn", name);
cdh_ToLower( fname, fname);
dcli_translate_filename( fname, fname);
sts = flow_LoadNodeClass( ctx, fname, &nc);
if ( EVEN(sts)) {
// Try base
sprintf( fname, "$pwr_exe/pwr_c_%s.flwn", name);
cdh_ToLower( fname, fname);
dcli_translate_filename( fname, fname);
sts = flow_LoadNodeClass( ctx, fname, &nc);
if ( EVEN(sts)) return sts;
}
}
/* Add execute order display */
double x = 0;
double y = 0;
flow_AddFilledRect( nc, x, y,
GOEN_DISPLAYNODEWIDTH, GOEN_DISPLAYNODEHEIGHT,
flow_eDrawType_LineGray, flow_mDisplayLevel_2);
flow_AddAnnot( nc,
x + f_strlength,
y + (GOEN_DISPLAYNODEHEIGHT + f_strheight)/2.0,
GOEN_DISPLAYNODE_ANNOT, flow_eDrawType_TextHelveticaBold, GOEN_F_TEXTSIZE,
flow_eAnnotType_OneLine, flow_mDisplayLevel_2);
*node_class = nc;
return GOEN__SUCCESS;
}
/*************************************************************************
*
* Name: goen_get_point_info()
*
* Type
*
* Type Parameter IOGF Description
* pwr_sGraphPlcNode *graphbody Pointer to objecttype data
* unsigned long point Connection point nr
* unsigned long *mask Mask for drawing inputs/outputs
* goen_conpoint_type *info_pointer Pointer to calculated data
*
* Description:
* Calculates relativ koordinates for a connectionpoint and investigates
* the connectionpoint type.
*
**************************************************************************/
int goen_get_point_info_m12( WGre *grectx, pwr_sGraphPlcNode *graphbody,
unsigned long point, unsigned long *mask,
unsigned long node_width, goen_conpoint_type *info_pointer,
vldh_t_node node)
{
info_pointer->x = 0;
info_pointer->y = 0;
info_pointer->type = CON_RIGHT;
return GOEN__SUCCESS;
}
/*************************************************************************
*
* Name: goen_get_parameter_m12()
*
* Type
*
* Type Parameter IOGF Description
* pwr_sGraphPlcNode *graphbody Pointer to objecttype data
* unsigned long point Connection point nr
* unsigned long *mask Mask for drawing inputs/outputs
* unsigned long *par_type Input or output parameter
*
* Description:
* Gets pointer to parameterdata for connectionpoint.
*
**************************************************************************/
int goen_get_parameter_m12( pwr_sGraphPlcNode *graphbody, pwr_tClassId cid,
ldh_tSesContext ldhses, unsigned long con_point,
unsigned long *mask, unsigned long *par_type,
unsigned long *par_inverted, unsigned long *par_index)
{
ldh_sParDef *bodydef;
int rows;
unsigned long inputs,interns,outputs;
int i, input_found, output_found;
int sts;
/* Get the runtime paramters for this class */
sts = ldh_GetObjectBodyDef(ldhses, cid, "RtBody", 1,
&bodydef, &rows);
if ( EVEN(sts)) {
/* This object contains only a devbody */
sts = ldh_GetObjectBodyDef(ldhses, cid, "DevBody", 1,
&bodydef, &rows);
if ( EVEN(sts) ) return GOEN__NOPOINT;
}
inputs = graphbody->parameters[PAR_INPUT];
interns = graphbody->parameters[PAR_INTERN];
outputs = graphbody->parameters[PAR_OUTPUT];
input_found = 0;
output_found = 0;
for ( i = 0; i < (int)inputs; i++) {
if (bodydef[i].Par->Input.Graph.ConPointNr == con_point ) {
*par_type = PAR_INPUT;
*par_index = i;
*par_inverted = GOEN_NOT_INVERTED;
input_found = 1;
break;
}
}
if ( input_found == 0 ) {
for ( i = inputs + interns; i < int(inputs + interns + outputs); i++) {
if (bodydef[i].Par->Output.Graph.ConPointNr == con_point ) {
*par_type = PAR_OUTPUT;
*par_index = i;
*par_inverted = GOEN_NOT_INVERTED;
output_found = 1;
break;
}
}
}
free((char *) bodydef);
if ( input_found || output_found ) return GOEN__SUCCESS;
else return GOEN__NOPOINT;
}
/*************************************************************************
*
* Name: goen_get_location_point_m12()
*
* 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_m12( WGre *grectx, pwr_sGraphPlcNode *graphbody,
unsigned long *mask, unsigned long node_width,
goen_point_type *info_pointer, vldh_t_node node)
{
return GOEN__SUCCESS;
}
/*
* Proview $Id: wb_goenm12.h,v 1.1 2008-01-17 14:22:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef wb_goenm12_h
#define wb_goenm12_h
int goen_create_nodetype_m12( pwr_sGraphPlcNode *graphbody,
pwr_tClassId cid,
ldh_tSesContext ldhses,
flow_tCtx ctx,
unsigned long *mask,
unsigned long subwindowmark,
unsigned long node_width,
flow_tNodeClass *node_class,
vldh_t_node node);
int goen_get_point_info_m12( WGre *grectx, pwr_sGraphPlcNode *graphbody,
unsigned long point, unsigned long *mask,
unsigned long node_width, goen_conpoint_type *info_pointer,
vldh_t_node node);
int goen_get_parameter_m12( pwr_sGraphPlcNode *graphbody, pwr_tClassId cid,
ldh_tSesContext ldhses, unsigned long con_point,
unsigned long *mask, unsigned long *par_type,
unsigned long *par_inverted, unsigned long *par_index);
int goen_get_location_point_m12( WGre *grectx, pwr_sGraphPlcNode *graphbody,
unsigned long *mask, unsigned long node_width,
goen_point_type *info_pointer, vldh_t_node node);
#endif
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