Commit e3b14589 authored by Claes Sjofors's avatar Claes Sjofors

jopg first commit

parent d33e3496
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public class DynParsedAttrName {
public String name;
public boolean inverted;
public int elements;
public int type;
public int database;
public int bitmask;
}
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public class GlowArrayElem {
public int type() {return 0;}
public void draw() {}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {}
public int eventHandler(GlowEvent e, double fx, double fy) {return 0;}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import java.text.*;
public class GlowCFormat {
public GlowCFormat( String format) {
int f_idx, p_idx;
try {
if ( (f_idx = format.indexOf('o')) != -1) {
if ( f_idx >= 1 && format.charAt(f_idx-1) == '1')
format_type = FRM_1O;
else if ( f_idx >= 1 && format.charAt(f_idx-1) == '2')
format_type = FRM_2O;
else
format_type = FRM_O;
}
else if ( (f_idx = format.indexOf('t')) != -1) {
if ( f_idx >= 1 && format.charAt(f_idx-1) == '1')
format_type = FRM_1T;
else if ( f_idx >= 1 && format.charAt(f_idx-1) == '2')
format_type = FRM_2T;
else if ( f_idx >= 1 && format.charAt(f_idx-1) == '3')
format_type = FRM_3T;
else
format_type = FRM_T;
}
else if ( (f_idx = format.indexOf('m')) != -1) {
if ( f_idx >= 1 && format.charAt(f_idx-1) == '1')
format_type = FRM_1M;
else
format_type = FRM_M;
}
else
pfo = new PrintfFormat( format);
}
catch ( NumberFormatException e) {
System.out.println( "NumberFormatException: " + format);
h = -1;
}
}
int d;
int h;
int no_space = 0;
int format_type;
PrintfFormat pfo;
public static final int FRM_S = 0; // String
public static final int FRM_O = 1; // Objid object name
public static final int FRM_1O = 2; // Objid path
public static final int FRM_2O = 3; // Objid volume and path
public static final int FRM_T = 4; // Time, date and time
public static final int FRM_1T = 5; // Time, only time, no hundredth
public static final int FRM_2T = 6; // Time, only time with hundreth
public static final int FRM_3T = 7; // Time, commpressed date and time, no hundredth
public static final int FRM_M = 8; // Message
public static final int FRM_1M = 9; // Message, text only
public static final int FRM_D = 10; // Integer
public static final int FRM_F = 11; // Float
public int type() {
return format_type;
}
public StringBuffer format( float value, StringBuffer buff) {
if ( pfo != null) {
try {
return pfo.sprintf( value, buff);
}
catch ( IllegalArgumentException e) {
buff.setLength(0);
buff.append("format error");
return buff;
}
}
else
return buff;
}
public StringBuffer format( int value, StringBuffer buff) {
if ( pfo != null) {
try {
return pfo.sprintf( value, buff);
}
catch ( IllegalArgumentException e) {
buff.setLength(0);
buff.append("format error");
return buff;
}
}
else
return buff;
}
public StringBuffer format( boolean value, StringBuffer buff) {
buff.setLength(0);
if ( value)
buff.append('1');
else
buff.append('0');
return buff;
}
public StringBuffer format( String value, StringBuffer buff) {
switch( format_type) {
case FRM_S: {
if ( pfo != null) {
try {
return pfo.sprintf( value, buff);
}
catch ( IllegalArgumentException e) {
buff.setLength(0);
buff.append("format error");
return buff;
}
}
else
return buff;
}
case FRM_O: {
int idx, j, len;
len = value.length();
idx = value.lastIndexOf('-');
if ( idx == -1)
idx = 0;
else
idx++;
buff.setLength(0);
for ( j = idx; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
case FRM_1O:
case FRM_2O: {
int j, len;
len = value.length();
buff.setLength(0);
for ( j = 0; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
case FRM_T:
case FRM_1T:
case FRM_2T:
case FRM_3T: {
int j, len;
len = value.length();
buff.setLength(0);
for ( j = 0; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
case FRM_M:
case FRM_1M: {
int j, len;
len = value.length();
buff.setLength(0);
for ( j = 0; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
}
buff.setLength(0);
return buff;
}
}
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public class GlowColorRgb {
public double r;
public double g;
public double b;
public GlowColorRgb(double r, double g, double b) {
this.r = r;
this.g = g;
this.b = b;
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowConClass {
GrowCmn cmn;
public GlowConClass(GrowCmn cmn) {
this.cmn = cmn;
}
public void open(BufferedReader reader) {
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowConPoint extends GlowArrayElem {
GrowCmn cmn;
GlowPoint p;
int number;
int direction;
String trace_attribute;
int trace_attr_type;
GlowTransform trf;
public GlowConPoint(GrowCmn cmn) {
this.cmn = cmn;
p = new GlowPoint(cmn);
trf = new GlowTransform();
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowConPoint : " + line);
switch ( key) {
case Glow.eSave_ConPoint:
break;
case Glow.eSave_ConPoint_number:
number = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_ConPoint_direction:
number = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_ConPoint_p:
p.open(reader);
break;
case Glow.eSave_ConPoint_trace_attr_type:
trace_attr_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_ConPoint_trace_attribute:
if ( token.hasMoreTokens())
trace_attribute = token.nextToken();
break;
case Glow.eSave_ConPoint_trf:
trf.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowConPoint");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowConPoint");
}
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public class GlowDimension {
public int width;
public int height;
}
\ No newline at end of file
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import java.awt.*;
public interface GlowDrawIfc {
public void rect(int border, int fill, double x, double y, double witdh, double height);
public void rect(int x, int y, int width, int height, int gc_type, int idx, int highlight);
public void fill_rect(int x, int y, int width, int height, int gc_type);
public void gradient_fill_rect(int x, int y, int width, int height, int gc_type, int f1, int f2, int gradient);
public void arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type, int idx, int highlight);
public void fill_arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type);
public void gradient_fill_arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type, int f1, int f2, int gradient);
public void line(int x1, int y1, int x2, int y2, int gc_type, int idx, int highlight);
public void line_dashed(int x1, int y1, int x2, int y2, int gc_type, int idx, int highlight, int line_type);
public void polyline(GlowPointX[] points, int point_cnt, int gc_type, int idx, int highlight);
public void fill_polyline(GlowPointX[] points, int point_cnt, int gc_type, int highlight);
public void gradient_fill_polyline(GlowPointX[] points, int point_cnt, int gc_type, int f1, int f2, int gradient);
public void text( int x, int y, String text, int gc_type, int color, int idx, int highlight, int line,
int font_idx, double size, int rot);
public int gradient_rotate(double rotate, int gradient);
public GlowDimension getTextExtent( String text, int idx, int type);
public Color getColor(int gc_type);
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public class GlowEvent {
public int type;
public double x;
public double y;
Object object;
public GlowEvent() {}
}
\ No newline at end of file
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowNodeClass extends GlowArrayElem {
GrowCmn cmn;
Vector<GlowArrayElem> a = new Vector<GlowArrayElem>();
String nc_name;
int group;
int slider;
String next_nodeclass;
int animation_count;
int cycle;
double x0;
double y0;
double x1;
double y1;
int input_focus_mark;
int dynamicsize;
Object userdata;
public int dyn_type1;
public int dyn_type2;
public int action_type1;
public int action_type2;
public int[] dyn_color = new int[4];
String[] dyn_attr = new String[4];
GlowArrayElem next_nc;
GlowArrayElem prev_nc;
public GlowNodeClass(GrowCmn cmn) {
this.cmn = cmn;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowNodeClass : " + line);
switch ( key) {
case Glow.eSave_NodeClass:
break;
case Glow.eSave_NodeClass_nc_name:
nc_name = token.nextToken();
break;
case Glow.eSave_NodeClass_a:
GlowVector.open(reader, cmn, a);
break;
case Glow.eSave_NodeClass_group:
group = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_arg_cnt:
case Glow.eSave_NodeClass_argname:
case Glow.eSave_NodeClass_argtype:
case Glow.eSave_NodeClass_no_con_obstacle:
break;
case Glow.eSave_NodeClass_dyn_type1:
dyn_type1 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_type2:
dyn_type2 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_action_type1:
action_type1 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_action_type2:
action_type2 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color1:
dyn_color[0] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color2:
dyn_color[1] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color3:
dyn_color[2] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color4:
if ( token.hasMoreTokens())
dyn_color[3] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_attr1:
if ( token.hasMoreTokens())
dyn_attr[0] = token.nextToken();
break;
case Glow.eSave_NodeClass_dyn_attr2:
if ( token.hasMoreTokens())
dyn_attr[1] = token.nextToken();
break;
case Glow.eSave_NodeClass_dyn_attr3:
if ( token.hasMoreTokens())
dyn_attr[2] = token.nextToken();
break;
case Glow.eSave_NodeClass_dyn_attr4:
if ( token.hasMoreTokens())
dyn_attr[3] = token.nextToken();
break;
case Glow.eSave_NodeClass_java_name:
break;
case Glow.eSave_NodeClass_slider:
slider = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_next_nodeclass:
if ( token.hasMoreTokens())
next_nodeclass = token.nextToken();
break;
case Glow.eSave_NodeClass_animation_count:
animation_count = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_cycle:
cycle = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_y0:
y0 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_y1:
y1 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_x0:
x0 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_x1:
x1 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_input_focus_mark:
input_focus_mark = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_NodeClass_userdata_cb:
if ( cmn.appl != null)
userdata = cmn.appl.growUserdataOpen( reader, this, Glow.eUserdataCbType_NodeClass);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowNodeClass");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowNodeClass");
}
if (next_nodeclass != null && !next_nodeclass.equals("")) {
next_nc = (GlowNodeClass)cmn.ctx.get_nodeclass_from_name( next_nodeclass);
if ( next_nc == null) {
System.out.println( "GlowNode:next_nodeclass not found: " + nc_name + " " +
next_nodeclass);
System.out.println( "Note! nodeclass has to be intern");
}
else if ( ((GlowNodeClass)next_nc).prev_nc != null) {
next_nc = null;
System.out.println( "GlowNode:next_nodeclass already chained: " + nc_name + " " +
next_nodeclass);
}
else
((GlowNodeClass)next_nc).prev_nc = (GlowArrayElem) this;
}
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
for ( int i = 0; i < a.size(); i++)
a.get(i).draw(t, highlight, hot, node, colornode);
}
public int eventHandler( GlowEvent event, double fx, double fy) {
int sts;
for ( int i = 0; i < a.size(); i++) {
sts = a.get(i).eventHandler(event, fx, fy);
if ( sts != 0)
return sts;
}
return 0;
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowNodeGroup extends GlowNodeClass {
public GlowNodeGroup(GrowCmn cmn) {
super(cmn);
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowNodeGroup : " + line);
switch ( key) {
case Glow.eSave_NodeGroup:
break;
case Glow.eSave_NodeGroup_nodeclass_part:
super.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowNodeGroup");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowNodeGroup");
}
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowPoint {
GrowCmn cmn;
public double x;
public double y;
public GlowPoint(GrowCmn cmn) {
this.cmn = cmn;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowPoint : " + line);
switch ( key) {
case Glow.eSave_Point:
break;
case Glow.eSave_Point_x:
x = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Point_y:
y = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowPoint");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowPoint");
}
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public class GlowPointX {
public int x;
public int y;
}
\ No newline at end of file
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowTransform {
double a11;
double a12;
double a13;
double a21;
double a22;
double a23;
double rotation;
double s_a11;
double s_a12;
double s_a13;
double s_a21;
double s_a22;
double s_a23;
double s_rotation;
boolean stored;
public GlowTransform() {
}
public void store() {
s_a11=a11;
s_a12=a12;
s_a13=a13;
s_a21=a21;
s_a22=a22;
s_a23=a23;
s_rotation=rotation;
stored=true;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
// if ( cmn.debug) System.out.println( "GlowTransform : " + line);
switch ( key) {
case Glow.eSave_Transform: break;
case Glow.eSave_Transform_a11:
a11 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a12:
a12 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a13:
a13 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a21:
a21 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a22:
a22 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a23:
a23 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_rotation:
rotation = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowTransform");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowTransform");
}
}
public double rot( GlowTransform t) {
return t.rotation + rotation;
}
public double rot() {
return rotation;
}
public double x( double x1, double y1) {
return x1 * a11 + y1 * a12 + a13;
}
public double y( double x1, double y1) {
return x1 * a21 + y1 * a22 + a23;
}
public GlowTransform multiply(GlowTransform p) {
GlowTransform tmp = new GlowTransform();
tmp.a11 = a11 * p.a11 + a12 * p.a21;
tmp.a12 = a11 * p.a12 + a12 * p.a22;
tmp.a13 = a11 * p.a13 + a12 * p.a23 + a13;
tmp.a21 = a21 * p.a11 + a22 * p.a21;
tmp.a22 = a21 * p.a12 + a22 * p.a22;
tmp.a23 = a21 * p.a13 + a22 * p.a23 + a23;
tmp.rotation = rotation + p.rotation;
return tmp;
}
public void set_from_stored( GlowTransform t) {
a11 = t.a11 * s_a11 + t.a12 * s_a21;
a12 = t.a11 * s_a12 + t.a12 * s_a22;
a13 = t.a11 * s_a13 + t.a12 * s_a23 + t.a13;
a21 = t.a21 * s_a11 + t.a22 * s_a21;
a22 = t.a21 * s_a12 + t.a22 * s_a22;
a23 = t.a21 * s_a13 + t.a22 * s_a23 + t.a23;
rotation = s_rotation + t.rotation;
}
public void scale( double sx, double sy, double x0, double y0) {
a13 = a13 * sx + x0 * ( 1 - sx);
a23 = a23 * sy + y0 * ( 1 - sy);
a11 *= sx;
a12 *= sx;
a21 *= sy;
a22 *= sy;
}
public void scale_from_stored( double sx, double sy, double x0, double y0) {
a13 = s_a13 * sx + x0 * ( 1 - sx);
a23 = s_a23 * sy + y0 * ( 1 - sy);
a11 = s_a11 * sx;
a12 = s_a12 * sx;
a21 = s_a21 * sy;
a22 = s_a22 * sy;
}
public void rotate( double angle, double x0, double y0) {
double sin_a;
double cos_a;
GlowTransform tmp = new GlowTransform();
tmp.a11 = a11;
tmp.a12 = a12;
tmp.a13 = a13;
tmp.a21 = a21;
tmp.a22 = a22;
tmp.a23 = a23;
tmp.rotation = rotation;
if ( -90.01 < angle && angle < -89.99) {
sin_a = -1.0;
cos_a = 0.0;
}
else {
sin_a = Math.sin( angle/180*3.14159);
cos_a = Math.cos( angle/180*3.14159);
}
a11 = tmp.a11 * cos_a - tmp.a21 * sin_a;
a12 = tmp.a12 * cos_a - tmp.a22 * sin_a;
a13 = tmp.a13 * cos_a - tmp.a23 * sin_a + x0 * ( 1 - cos_a) + y0 * sin_a;
a21 = tmp.a11 * sin_a + tmp.a21 * cos_a;
a22 = tmp.a21 * sin_a + tmp.a22 * cos_a;
a23 = tmp.a13 * sin_a + tmp.a23 * cos_a + y0 * ( 1 - cos_a) - x0 * sin_a;
rotation += angle;
}
public void rotate_from_stored( double angle, double x0, double y0) {
double sin_a;
double cos_a;
if ( -90.01 < s_rotation + angle && s_rotation + angle < -89.99) {
sin_a = -1.0;
cos_a = 0.0;
}
else {
sin_a = Math.sin( (s_rotation + angle)/180*3.14159);
cos_a = Math.cos( (s_rotation + angle)/180*3.14159);
}
a11 = s_a11 * cos_a - s_a21 * sin_a;
a12 = s_a12 * cos_a - s_a22 * sin_a;
a13 = s_a13 * cos_a - s_a23 * sin_a + x0 * ( 1 - cos_a) + y0 * sin_a;
a21 = s_a11 * sin_a + s_a21 * cos_a;
a22 = s_a21 * sin_a + s_a22 * cos_a;
a23 = s_a13 * sin_a + s_a23 * cos_a + y0 * ( 1 - cos_a) - x0 * sin_a;
rotation = s_rotation + angle;
}
public void move( double x0, double y0) {
a13 += x0;
a23 += y0;
}
public void move_from_stored( double x0, double y0) {
a13 = s_a13 + x0;
a23 = s_a23 + y0;
}
public void posit( double x0, double y0) {
a13 = x0;
a23 = y0;
}
public double x( GlowTransform t, double x1, double y1) {
GlowTransform tmp = t.multiply(this);
return tmp.x( x1, y1);
}
public double y( GlowTransform t, double x1, double y1) {
GlowTransform tmp = t.multiply(this);
return tmp.y( x1, y1);
}
public GlowPoint reverse( double x, double y) {
GlowPoint p = new GlowPoint(null);
if ( a11 == 0 || ( a12 * a21 - a11 * a22) == 0) {
if ( a11 == 0 && a22 == 0 && a12 != 0 && a21 != 0) {
p.y = (x - a13) / a12;
p.x = (y - a23) / a21;
return p;
}
else {
p.y = p.x = 0;
return p;
}
}
p.y = ( a11 * ( a23 - y) - a21 * ( a13 - x)) / ( a12 * a21 - a11 * a22);
p.x = ( x - a12 * p.y - a13) / a11;
return p;
}
public double vertical_scale( GlowTransform t) {
if ( t == null)
return Math.sqrt( a12*a12 + a22*a22);
GlowTransform tmp = t.multiply(this);
return Math.sqrt( tmp.a12*tmp.a12 + tmp.a22*tmp.a22);
}
}
\ No newline at end of file
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import java.io.*;
import java.util.*;
public class GlowVector {
public GlowVector() {
}
//public static void open( BufferedReader reader, GrowCmn cmn, Vector<Object> a) {
public static void open( BufferedReader reader, GrowCmn cmn, Vector a) {
String line;
StringTokenizer token;
boolean end = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowVector : " + line);
switch ( key) {
case Glow.eSave_Array:
break;
case Glow.eSave_NodeClass: {
System.out.println("GlowVector: GlowNodeClass");
GlowNodeClass nc = new GlowNodeClass( cmn);
nc.open( reader);
a.add( (Object) nc);
break;
}
case Glow.eSave_NodeGroup: {
System.out.println("GlowVector: GlowNodeGroup");
GlowNodeGroup nc = new GlowNodeGroup( cmn);
nc.open( reader);
a.add( (Object) nc);
break;
}
case Glow.eSave_ConClass:
GlowConClass cc = new GlowConClass( cmn);
cc.open( reader);
a.add( (Object) cc);
break;
case Glow.eSave_GrowNode: {
GrowNode n = new GrowNode( cmn);
n.open( reader);
a.add( n);
break;
}
case Glow.eSave_GrowGroup: {
GrowGroup n = new GrowGroup( cmn);
n.open( reader);
a.add( n);
break;
}
case Glow.eSave_GrowRect: {
GrowRect c = new GrowRect( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowArc: {
GrowArc c = new GrowArc( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowLine: {
GrowLine c = new GrowLine( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowPolyLine: {
GrowPolyline c = new GrowPolyline( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowText: {
GrowText c = new GrowText( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_ConPoint: {
GlowConPoint c = new GlowConPoint( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowAnnot: {
GrowAnnot c = new GrowAnnot( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_Point: {
GlowPoint c = new GlowPoint( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_End:
end = true;
break;
default:
System.out.println( "Syntax error in GlowVector");
break;
}
if ( end)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowVector");
}
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
public class Graph implements GraphIfc, GrowApplIfc {
public static final int eType_Bit = (1 << 15) + 1;
public GrowCmn cmn;
public GrowCtx ctx;
public GlowDraw gdraw;
public GraphApplIfc appl;
public Gdh gdh;
public GraphLocalDb ldb;
public Graph(GraphApplIfc appl, Gdh gdh) {
this.appl = appl;
this.gdh = gdh;
ldb = new GraphLocalDb();
ctx = new GrowCtx(this);
gdraw = new GlowDraw();
cmn = ctx.getCmn();
cmn.setGdraw(gdraw);
}
public Gdh getGdh() {
return gdh;
}
public GraphLocalDb getLdb() {
return ldb;
}
public GrowCtx getCtx() {
return ctx;
}
void open(BufferedReader reader) {
ctx.open( reader);
ctx.traceConnect();
}
public void traceConnect(GrowNode object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.connect(object);
}
public void traceDisconnect(GrowNode object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.disconnect();
}
public void traceScan(GrowNode object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.scan(object);
}
int stringToType( String str) {
if ( str.equalsIgnoreCase("boolean"))
return Pwr.eType_Boolean;
if ( str.equalsIgnoreCase("float32"))
return Pwr.eType_Float32;
if ( str.equalsIgnoreCase("float64"))
return Pwr.eType_Float64;
if ( str.equalsIgnoreCase("char"))
return Pwr.eType_Char;
if ( str.equalsIgnoreCase("int8"))
return Pwr.eType_Int8;
if ( str.equalsIgnoreCase("int16"))
return Pwr.eType_Int16;
if ( str.equalsIgnoreCase("int32"))
return Pwr.eType_Int32;
if ( str.equalsIgnoreCase("int64"))
return Pwr.eType_Int64;
if ( str.equalsIgnoreCase("uint8"))
return Pwr.eType_UInt8;
if ( str.equalsIgnoreCase("uint16"))
return Pwr.eType_UInt16;
if ( str.equalsIgnoreCase("uint32"))
return Pwr.eType_UInt32;
if ( str.equalsIgnoreCase("uint64"))
return Pwr.eType_UInt64;
if ( str.equalsIgnoreCase("objid"))
return Pwr.eType_Objid;
if ( str.equalsIgnoreCase("time"))
return Pwr.eType_Time;
if ( str.equalsIgnoreCase("deltatime"))
return Pwr.eType_DeltaTime;
if ( str.equalsIgnoreCase("attrref"))
return Pwr.eType_AttrRef;
if ( str.equalsIgnoreCase("status"))
return Pwr.eType_Status;
if ( str.equalsIgnoreCase("netstatus"))
return Pwr.eType_NetStatus;
if ( str.equalsIgnoreCase("enum"))
return Pwr.eType_Enum;
if ( str.equalsIgnoreCase("mask"))
return Pwr.eType_Mask;
if ( str.equalsIgnoreCase("bit"))
return Graph.eType_Bit;
return 0;
}
int stringToElements( String str) {
int idx1, idx2;
int elements;
if ( (idx1 = str.indexOf('[')) != -1 &&
(idx2 = str.indexOf(']')) != -1 &&
idx2 > idx1) {
try {
System.out.println("Elements: " + str.substring(idx1+1, idx2));
elements = new Integer(str.substring(idx1+1, idx2)).intValue();
}
catch( NumberFormatException e) {
System.out.println("Element syntax error, " + str);
return 1;
}
return elements;
}
return 1;
}
public DynParsedAttrName parseAttrName( String name) {
int idx, tidx, eidx;
DynParsedAttrName pname = new DynParsedAttrName();
String str = name.trim();
if ( (idx = str.indexOf('[')) != -1 &&
(eidx = str.lastIndexOf('#')) != -1 &&
str.charAt(eidx-1) != '#') {
pname.elements = stringToElements(str);
str = str.substring(0, idx-1);
}
else
pname.elements = 1;
if ( (tidx = str.indexOf("##")) != -1) {
if ( str.toLowerCase().startsWith("bit", tidx+2)) {
String typestr = str.substring(tidx+2);
int bit = stringToElements(str);
pname.bitmask = 1 << bit;
str = str.substring(0, tidx+5);
}
pname.type = stringToType( str.substring(tidx+2));
str = str.substring(0, tidx);
}
else
pname.type = 0;
if ( str.startsWith("!")) {
str = str.substring(1);
str = str.trim();
pname.inverted = true;
}
else
pname.inverted = false;
pname.database = Graph.eDatabase_Gdh;
pname.name = str;
System.out.println( "ParsedName: " + name + " " + pname.name + " type: " + pname.type + " elements: " + pname.elements + " bitm: " + pname.bitmask);
return pname;
}
public Object growUserdataOpen( BufferedReader reader, Object object, int type) {
switch ( type) {
case Glow.eUserdataCbType_Ctx:
break;
case Glow.eUserdataCbType_Node: {
Dyn dyn = new Dyn(this);
dyn.open(reader);
return dyn;
}
case Glow.eUserdataCbType_NodeClass: {
Dyn dyn = new Dyn(this);
dyn.open(reader);
return dyn;
}
}
return null;
}
public void eventHandler(GlowEvent e) {
if ( e.object != null) {
int sts;
Dyn dyn = (Dyn)((GrowNode)e.object).getUserData();
sts = dyn.action((GrowNode)e.object, e);
}
}
public int command(String cmd) {
if ( appl != null)
return appl.command(cmd);
return 0;
}
public void openConfirmDialog(Object dyn, String text, Object object) {
if ( appl != null)
appl.openConfirmDialog(dyn, text, object);
}
public String get_reference_name(String name) {
// TODO
return null;
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public interface GraphApplIfc {
public int command(String cmd);
public void openConfirmDialog( Object dyn, String text, Object object);
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
public interface GraphIfc {
public static final int eDatabase_Gdh = 0;
public static final int eDatabase_User = 1;
public static final int eDatabase_Local = 2;
public static final int eDatabase_Ccm = 3;
public DynParsedAttrName parseAttrName( String name);
public Gdh getGdh();
public GraphLocalDb getLdb();
public GrowCtx getCtx();
public int command(String cmd);
public void openConfirmDialog(Object dyn, String text, Object object);
public String get_reference_name(String name);
}
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowAnnot extends GlowArrayElem {
GrowCmn cmn;
GlowPoint p;
int adjustment;
GlowTransform trf;
int number;
int draw_type;
int color_drawtype;
int text_size;
int display_level;
int annot_type;
int font;
public GrowAnnot(GrowCmn cmn) {
this.cmn = cmn;
p = new GlowPoint(cmn);
trf = new GlowTransform();
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowAnnot : " + line);
switch ( key) {
case Glow.eSave_GrowAnnot:
break;
case Glow.eSave_GrowAnnot_adjustment:
adjustment = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowAnnot_annot_part:
glowannot_open(reader);
break;
case Glow.eSave_GrowAnnot_trf:
trf.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowAnnot");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowAnnot");
}
}
public void glowannot_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowAnnot : " + line);
switch ( key) {
case Glow.eSave_Annot:
break;
case Glow.eSave_Annot_number:
number = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_color_drawtype:
color_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_text_size:
text_size = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_display_level:
display_level = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_p:
p.open( reader);
break;
case Glow.eSave_Annot_annot_type:
annot_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_font:
font = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowAnnot");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowAnnot");
}
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
int x1, y1;
if ( ((GrowNode)node).annotv[number] == null)
return;
int color;
int rot;
double trf_scale = trf.vertical_scale( t);
int idx = (int)( trf_scale * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (text_size +4) - 4);
double tsize = trf_scale * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (8+2*text_size);
if ( idx < 0)
return;
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int lfont;
int ldraw_type;
if ( node != null && ((GrowNode)node).text_font != Glow.eFont_No) {
lfont = ((GrowNode)node).text_font;
ldraw_type = ((GrowNode)node).text_type;
}
else {
lfont = font;
ldraw_type = draw_type;
}
if ( t == null) {
x1 = (int)( trf.x( p.x, p.y) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
y1 = (int)( trf.y( p.x, p.y) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
rot = (int) trf.rot();
}
else {
x1 = (int)( trf.x( t, p.x, p.y) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
y1 = (int)( trf.y( t, p.x, p.y) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
rot = (int) trf.rot( t);
}
rot = rot < 0 ? rot % 360 + 360 : rot % 360;
switch ( annot_type) {
case Glow.eAnnotType_OneLine: {
int width = 0;
int height = 0;
int descent = 0;
color = GlowColor.get_drawtype( color_drawtype, Glow.eDrawType_LineHighlight,
highlight, colornode, 2, 0);
if ( ((rot < 45 || rot >= 315) &&
( ((GrowNode)node).annotv_inputmode[number] != 0 &&
((GrowNode)node).input_selected != 0)) ||
( !(rot < 45 || rot >= 315)) ||
adjustment == Glow.eAdjustment_Right ||
adjustment == Glow.eAdjustment_Center) {
GlowDimension d = cmn.gdraw.getTextExtent( ((GrowNode)node).annotv[number], idx, ldraw_type);
width = d.width;
height = d.height;
descent = height/4;
}
switch ( adjustment) {
case Glow.eAdjustment_Left:
break;
case Glow.eAdjustment_Right:
x1 -= width;
break;
case Glow.eAdjustment_Center:
x1 -= width /2;
break;
}
if ( rot < 45 || rot >= 315) {
if ( ((GrowNode)node).annotv_inputmode[number] != 0 &&
((GrowNode)node).input_selected != 0) {
cmn.gdraw.fill_rect( x1, y1 - height + descent, width, height,
Glow.eDrawType_MediumGray);
}
}
else {
// Text is rotated, adjust the coordinates
if ( adjustment == Glow.eAdjustment_Center) {
// Only center adjustment supports text rotation
if ( 45 <= rot && rot < 135) {
x1 += width/2;
y1 += width/2;
}
else if ( 135 <= rot && rot < 225) {
y1 += height - descent;
}
else if ( 225 <= rot && rot < 315) {
x1 += width/2 - height + descent;
y1 -= width/2 - height + descent;
}
else {
x1 -= width;
}
}
else {
if ( 45 <= rot && rot < 135) {
y1 += height - descent;
}
else if ( 135 <= rot && rot < 225) {
x1 -= width;
y1 += height - descent;
}
else {
x1 -= width;
}
rot = 0;
}
}
cmn.gdraw.text( x1, y1,
((GrowNode)node).annotv[number],
ldraw_type, color, idx,
highlight, 0, lfont, tsize, rot);
if ( ((GrowNode)node).annotv_inputmode[number] != 0) {
/*
ctx->gdraw->text_cursor( w, x1, y1,
((GlowNode *) node)->annotv[number],
strlen(((GlowNode *) node)->annotv[number]),
ldraw_type, color, idx, highlight,
((GrowNode *)node)->input_position, lfont, tsize);
*/
}
break;
}
case Glow.eAnnotType_MultiLine: {
/*
int z_width, z_height, z_descent;
int len = 0;
int line_cnt = 0;
String line = new String(((GrowNode)node).annotv[number]);
char *s;
color = GlowColor.get_drawtype( color_drawtype, Glow.eDrawType_LineHighlight,
highlight, colornode, 2, 0);
GlowDimension d = cmn.gdraw.getTextExtent( "", 0, idx, ldraw_type);
z_width = d.width;
z_height = d.height;
x_descent = z_height/4;
for ( s = ((GlowNode *) ((GrowNode)node).annotv[number]; *s; s++) {
if ( *s == 10) {
if ( len) {
*s = 0;
ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, color, idx, highlight, 0, lfont, tsize, 0);
*s = 10;
}
len = 0;
line = s+1;
line_cnt++;
}
else
len++;
}
if ( len)
ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, color, idx, highlight, 0, lfont, tsize, 0);
*/
break;
}
}
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
import java.io.*;
public interface GrowApplIfc {
public Object growUserdataOpen( BufferedReader reader, Object object, int type);
public void traceConnect(GrowNode object);
public void traceDisconnect(GrowNode object);
public void traceScan(GrowNode object);
public void eventHandler(GlowEvent e);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jopg;
public interface GrowCtxIfc {
public GlowArrayElem get_nodeclass_from_name(String name);
public GlowArrayElem get_object_group( GlowArrayElem object);
public void draw();
public void draw( double ll_x, double ll_y, double ur_x, double ur_y);
public void register_callback_object(GlowArrayElem o);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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