Commit ba53dd46 authored by Claes Sjofors's avatar Claes Sjofors

Java trace updated with triangles and more

parent 3b9b1b69
...@@ -82,6 +82,11 @@ public class Flow { ...@@ -82,6 +82,11 @@ public class Flow {
public static final int eDrawType_TextHelveticaBold = 7; public static final int eDrawType_TextHelveticaBold = 7;
public static final int eDrawType_TextHelveticaErase = 8; public static final int eDrawType_TextHelveticaErase = 8;
public static final int eDrawType_TextHelveticaEraseBold = 9; public static final int eDrawType_TextHelveticaEraseBold = 9;
public static final int eDrawType_ = 10;
public static final int eDrawType_Green = 11;
public static final int eDrawType_Yellow = 12;
public static final int eDrawType_DarkGray = 13;
public static final int eDrawType_Inherit = 9999;
public static final int mDisplayLevel_1 = 1 << 0; public static final int mDisplayLevel_1 = 1 << 0;
public static final int mDisplayLevel_2 = 1 << 2; public static final int mDisplayLevel_2 = 1 << 2;
...@@ -117,6 +122,8 @@ public class Flow { ...@@ -117,6 +122,8 @@ public class Flow {
public static final int eSave_AnnotPixmap = 16; public static final int eSave_AnnotPixmap = 16;
public static final int eSave_Radiobutton = 17; public static final int eSave_Radiobutton = 17;
public static final int eSave_Frame = 18; public static final int eSave_Frame = 18;
public static final int eSave_AnnotPixmapButton = 19;
public static final int eSave_Triangle = 20;
public static final int eSave_End = 99; public static final int eSave_End = 99;
public static final int eSave_Ctx_zoom_factor = 100; public static final int eSave_Ctx_zoom_factor = 100;
public static final int eSave_Ctx_base_zoom_factor = 101; public static final int eSave_Ctx_base_zoom_factor = 101;
...@@ -152,6 +159,7 @@ public class Flow { ...@@ -152,6 +159,7 @@ public class Flow {
public static final int eSave_Ctx_refcon_height = 131; public static final int eSave_Ctx_refcon_height = 131;
public static final int eSave_Ctx_refcon_textsize = 132; public static final int eSave_Ctx_refcon_textsize = 132;
public static final int eSave_Ctx_refcon_linewidth = 133; public static final int eSave_Ctx_refcon_linewidth = 133;
public static final int eSave_Ctx_user_version = 134;
public static final int eSave_Array_a = 200; public static final int eSave_Array_a = 200;
public static final int eSave_NodeClass_nc_name = 300; public static final int eSave_NodeClass_nc_name = 300;
public static final int eSave_NodeClass_a = 301; public static final int eSave_NodeClass_a = 301;
...@@ -171,6 +179,7 @@ public class Flow { ...@@ -171,6 +179,7 @@ public class Flow {
public static final int eSave_Rect_ll = 502; public static final int eSave_Rect_ll = 502;
public static final int eSave_Rect_ur = 503; public static final int eSave_Rect_ur = 503;
public static final int eSave_Rect_display_level = 504; public static final int eSave_Rect_display_level = 504;
public static final int eSave_Rect_fill = 505;
public static final int eSave_Line_draw_type = 600; public static final int eSave_Line_draw_type = 600;
public static final int eSave_Line_line_width = 601; public static final int eSave_Line_line_width = 601;
public static final int eSave_Line_p1 = 602; public static final int eSave_Line_p1 = 602;
...@@ -252,6 +261,7 @@ public class Flow { ...@@ -252,6 +261,7 @@ public class Flow {
public static final int eSave_Arrow_p_dest = 1404; public static final int eSave_Arrow_p_dest = 1404;
public static final int eSave_Arrow_p1 = 1405; public static final int eSave_Arrow_p1 = 1405;
public static final int eSave_Arrow_p2 = 1406; public static final int eSave_Arrow_p2 = 1406;
public static final int eSave_Triangle_rect_part = 2000;
public static String getFileName(PwrtObjid oid) { public static String getFileName(PwrtObjid oid) {
String filename = "pwr_" + String filename = "pwr_" +
......
...@@ -106,7 +106,11 @@ public class FlowAnnot implements FlowArrayElem { ...@@ -106,7 +106,11 @@ public class FlowAnnot implements FlowArrayElem {
} }
} }
public void draw( FlowPoint p0, String[] annotv, boolean highlight) { public void draw( FlowPoint p0, FlowNodeIfc node, boolean highlight) {
if ( node == null)
return;
String[] annotv = node.getAnnotv();
if ( annotv == null || annotv[number] == null) if ( annotv == null || annotv[number] == null)
return; return;
if ( (display_level & FlowCmn.display_level) == 0) if ( (display_level & FlowCmn.display_level) == 0)
......
...@@ -107,7 +107,7 @@ public class FlowArc implements FlowArrayElem { ...@@ -107,7 +107,7 @@ public class FlowArc implements FlowArrayElem {
} }
} }
public void draw( FlowPoint p, String[] annotv, boolean highlight) { public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
int color; int color;
switch ( draw_type) { switch ( draw_type) {
......
...@@ -72,6 +72,11 @@ public class FlowArray { ...@@ -72,6 +72,11 @@ public class FlowArray {
l.open( reader); l.open( reader);
a.add( l); a.add( l);
break; break;
case Flow.eSave_Triangle:
FlowTriangle t = new FlowTriangle( cmn);
t.open( reader);
a.add( t);
break;
case Flow.eSave_Arc: case Flow.eSave_Arc:
FlowArc arc = new FlowArc( cmn); FlowArc arc = new FlowArc( cmn);
arc.open( reader); arc.open( reader);
...@@ -117,9 +122,9 @@ public class FlowArray { ...@@ -117,9 +122,9 @@ public class FlowArray {
} }
} }
public void draw( FlowPoint p, String[] annotv, boolean highlight) { public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
for ( int i = 0; i < a.size(); i++) { for ( int i = 0; i < a.size(); i++) {
((FlowArrayElem)a.get(i)).draw( p, annotv, highlight); ((FlowArrayElem)a.get(i)).draw( p, node, highlight);
} }
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
package jpwr.app; package jpwr.app;
public interface FlowArrayElem { public interface FlowArrayElem {
public void draw( FlowPoint p, String[] annotv, boolean highlight); public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight);
public boolean getSelect(); public boolean getSelect();
public void setSelect(boolean select); public void setSelect(boolean select);
public boolean eventHandler(PlowEvent e); public boolean eventHandler(PlowEvent e);
......
...@@ -113,7 +113,7 @@ public class FlowArrow implements FlowArrayElem { ...@@ -113,7 +113,7 @@ public class FlowArrow implements FlowArrayElem {
System.out.println( "IOExeption FlowArrow"); System.out.println( "IOExeption FlowArrow");
} }
} }
public void draw( FlowPoint p, String[] annotv, boolean highlight) { public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
int color; int color;
Path path = new Path(); Path path = new Path();
......
...@@ -224,8 +224,8 @@ public class FlowCon implements FlowArrayElem { ...@@ -224,8 +224,8 @@ public class FlowCon implements FlowArrayElem {
} }
public void setSelect( boolean select) { public void setSelect( boolean select) {
} }
public void draw( FlowPoint p0, String[] annotv, boolean highlight) { public void draw( FlowPoint p0, FlowNodeIfc node, boolean highlight) {
// Adjust pos to javabean koordinates // Adjust pos to javabean coordinates
FlowPoint p = new FlowPoint(cmn); FlowPoint p = new FlowPoint(cmn);
p.x = 0; p.x = 0;
p.y = 0; p.y = 0;
......
...@@ -102,7 +102,7 @@ public class FlowConPoint implements FlowArrayElem { ...@@ -102,7 +102,7 @@ public class FlowConPoint implements FlowArrayElem {
} }
} }
public void draw( FlowPoint p, String[] annotv, boolean highlight) { public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
} }
@Override @Override
public boolean getSelect() { public boolean getSelect() {
......
...@@ -117,6 +117,7 @@ public class FlowCtx implements FlowCtxInterface { ...@@ -117,6 +117,7 @@ public class FlowCtx implements FlowCtxInterface {
case Flow.eSave_Ctx_refcon_height: case Flow.eSave_Ctx_refcon_height:
case Flow.eSave_Ctx_refcon_textsize: case Flow.eSave_Ctx_refcon_textsize:
case Flow.eSave_Ctx_refcon_linewidth: case Flow.eSave_Ctx_refcon_linewidth:
case Flow.eSave_Ctx_user_version:
break; break;
case Flow.eSave_Ctx_a_nc: case Flow.eSave_Ctx_a_nc:
FlowVector.open( reader, cmn, cmn.a_nc); FlowVector.open( reader, cmn, cmn.a_nc);
......
...@@ -99,7 +99,7 @@ public class FlowLine implements FlowArrayElem { ...@@ -99,7 +99,7 @@ public class FlowLine implements FlowArrayElem {
} }
} }
public void draw( FlowPoint p, String[] annotv, boolean highlight) { public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
int color; int color;
switch ( draw_type) { switch ( draw_type) {
......
...@@ -42,7 +42,7 @@ import java.io.*; ...@@ -42,7 +42,7 @@ import java.io.*;
import java.util.*; import java.util.*;
public class FlowNode implements FlowArrayElem { public class FlowNode implements FlowArrayElem, FlowNodeIfc {
static final int OFFSET = 2; static final int OFFSET = 2;
double x_right; double x_right;
double x_left; double x_left;
...@@ -59,10 +59,12 @@ public class FlowNode implements FlowArrayElem { ...@@ -59,10 +59,12 @@ public class FlowNode implements FlowArrayElem {
int trace_attr_type; int trace_attr_type;
boolean highlight; boolean highlight;
boolean select; boolean select;
int fill_color;
public FlowNode( FlowCmn cmn) { public FlowNode( FlowCmn cmn) {
this.cmn = cmn; this.cmn = cmn;
pos = new FlowPoint( cmn); pos = new FlowPoint( cmn);
fill_color = Flow.eDrawType_Inherit;
} }
@Override @Override
...@@ -70,6 +72,12 @@ public class FlowNode implements FlowArrayElem { ...@@ -70,6 +72,12 @@ public class FlowNode implements FlowArrayElem {
return Flow.eObjectType_Node; return Flow.eObjectType_Node;
} }
public String[] getAnnotv() {
return annotv;
}
public int getFillColor() {
return fill_color;
}
public boolean getSelect() { public boolean getSelect() {
return select; return select;
} }
...@@ -257,7 +265,7 @@ public class FlowNode implements FlowArrayElem { ...@@ -257,7 +265,7 @@ public class FlowNode implements FlowArrayElem {
*/ */
} }
public void draw( FlowPoint p0, String[] annotv0, boolean hl) { public void draw( FlowPoint p0, FlowNodeIfc node, boolean hl) {
if ( select) { if ( select) {
// Draw blue background // Draw blue background
cmn.gdraw.rect(false, Plow.COLOR_LIGHTBLUE, (float)(x_left * cmn.zoom_factor - cmn.offset_x), cmn.gdraw.rect(false, Plow.COLOR_LIGHTBLUE, (float)(x_left * cmn.zoom_factor - cmn.offset_x),
...@@ -266,7 +274,7 @@ public class FlowNode implements FlowArrayElem { ...@@ -266,7 +274,7 @@ public class FlowNode implements FlowArrayElem {
(float)(y_high * cmn.zoom_factor - cmn.offset_y)); (float)(y_high * cmn.zoom_factor - cmn.offset_y));
} }
nc.draw( pos, annotv, highlight); nc.draw( pos, this, highlight);
} }
......
...@@ -93,8 +93,8 @@ public class FlowNodeClass implements FlowArrayElem { ...@@ -93,8 +93,8 @@ public class FlowNodeClass implements FlowArrayElem {
} }
} }
public void draw( FlowPoint p, String[] annotv, boolean highlight) { public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
a.draw( p, annotv, highlight); a.draw( p, node, highlight);
} }
@Override @Override
public boolean getSelect() { public boolean getSelect() {
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 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.app;
public interface FlowNodeIfc {
public String[] getAnnotv();
public int getFillColor();
}
...@@ -45,6 +45,7 @@ public class FlowRect implements FlowArrayElem { ...@@ -45,6 +45,7 @@ public class FlowRect implements FlowArrayElem {
int draw_type; int draw_type;
int line_width; int line_width;
int display_level; int display_level;
int fill;
FlowCmn cmn; FlowCmn cmn;
public FlowRect( FlowCmn cmn) { public FlowRect( FlowCmn cmn) {
...@@ -79,6 +80,9 @@ public class FlowRect implements FlowArrayElem { ...@@ -79,6 +80,9 @@ public class FlowRect implements FlowArrayElem {
case Flow.eSave_Rect_display_level: case Flow.eSave_Rect_display_level:
display_level = new Integer( token.nextToken()).intValue(); display_level = new Integer( token.nextToken()).intValue();
break; break;
case Flow.eSave_Rect_fill:
fill = new Integer( token.nextToken()).intValue();
break;
case Flow.eSave_Rect_ll: case Flow.eSave_Rect_ll:
ll.open( reader); ll.open( reader);
break; break;
...@@ -100,7 +104,7 @@ public class FlowRect implements FlowArrayElem { ...@@ -100,7 +104,7 @@ public class FlowRect implements FlowArrayElem {
} }
} }
public void draw( FlowPoint p, String[] annotv, boolean highlight) { public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
if ( (display_level & FlowCmn.display_level) == 0) if ( (display_level & FlowCmn.display_level) == 0)
return; return;
......
...@@ -97,7 +97,7 @@ public class FlowText implements FlowArrayElem { ...@@ -97,7 +97,7 @@ public class FlowText implements FlowArrayElem {
} }
} }
public void draw( FlowPoint p0, String[] annotv, boolean highlight) { public void draw( FlowPoint p0, FlowNodeIfc node, boolean highlight) {
int tsize; int tsize;
int idx = (int) (cmn.zoom_factor/cmn.base_zoom_factor * text_size * 5.8 + 1.0); int idx = (int) (cmn.zoom_factor/cmn.base_zoom_factor * text_size * 5.8 + 1.0);
if ( cmn.zoom_factor/cmn.base_zoom_factor * text_size * 6.5 < 2) return; if ( cmn.zoom_factor/cmn.base_zoom_factor * text_size * 6.5 < 2) return;
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 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.app;
import java.io.*;
import java.util.*;
/**
Flow triangle element.
*/
public class FlowTriangle extends FlowRect {
public FlowTriangle( FlowCmn cmn) {
super(cmn);
}
public void open( BufferedReader reader) {
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( "line : " + key);
switch ( key) {
case Flow.eSave_Triangle_rect_part:
super.open(reader);
break;
case Flow.eSave_End:
end = true;
break;
default:
System.out.println( "Syntax error in FlowTriangle");
break;
}
if ( end)
break;
}
} catch ( Exception e) {
System.out.println( "IOExeption FlowTriangle");
}
}
public void draw( FlowPoint p, FlowNodeIfc node, boolean highlight) {
int color;
if ( fill != 0) {
int dtype;
if ( node != null && node.getFillColor() != Flow.eDrawType_Inherit)
dtype = node.getFillColor();
else
dtype = draw_type;
switch ( dtype) {
case Flow.eDrawType_LineRed:
color = Plow.COLOR_RED;
break;
case Flow.eDrawType_Green:
color = Plow.COLOR_GREEN;
break;
case Flow.eDrawType_Yellow:
color = Plow.COLOR_YELLOW;
break;
default:
color = Plow.COLOR_GRAY;
}
cmn.gdraw.triangle(color, true,
(float)((ll.x + p.x) * cmn.zoom_factor - cmn.offset_x),
(float)((ur.y + p.y) * cmn.zoom_factor - cmn.offset_y),
(float)(((ll.x + ur.x)/2 + p.x) * cmn.zoom_factor - cmn.offset_x),
(float)((ll.y + p.y) * cmn.zoom_factor - cmn.offset_y),
(float)((ur.x + p.x) * cmn.zoom_factor - cmn.offset_x),
(float)((ur.y + p.y) * cmn.zoom_factor - cmn.offset_y));
}
color = Plow.COLOR_BLACK;
if ( highlight)
color = Plow.COLOR_RED;
cmn.gdraw.triangle(color, false,
(float)((ll.x + p.x) * cmn.zoom_factor - cmn.offset_x),
(float)((ur.y + p.y) * cmn.zoom_factor - cmn.offset_y),
(float)(((ll.x + ur.x)/2 + p.x) * cmn.zoom_factor - cmn.offset_x),
(float)((ll.y + p.y) * cmn.zoom_factor - cmn.offset_y),
(float)((ur.x + p.x) * cmn.zoom_factor - cmn.offset_x),
(float)((ur.y + p.y) * cmn.zoom_factor - cmn.offset_y));
}
}
...@@ -162,6 +162,22 @@ public class PlowDraw implements PlowDrawIfc { ...@@ -162,6 +162,22 @@ public class PlowDraw implements PlowDrawIfc {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
public void triangle(int color, boolean fill, float x1, float y1, float x2, float y2, float x3, float y3) {
Path path = new Path();
paint.setColor(getColor(color));
if ( fill)
paint.setStyle(Paint.Style.FILL);
else
paint.setStyle(Paint.Style.STROKE);
path.moveTo(x1, y1);
path.lineTo(x2, y2);
path.lineTo(x3, y3);
path.lineTo(x1, y1);
canvas.drawPath(path, paint);
}
public int getColor(int color) { public int getColor(int color) {
switch ( color) { switch ( color) {
case Plow.COLOR_BLACK: case Plow.COLOR_BLACK:
......
...@@ -10,6 +10,7 @@ public interface PlowDrawIfc { ...@@ -10,6 +10,7 @@ public interface PlowDrawIfc {
public void drawText( String text, int textColor, int textSize, int font, float x, float y); public void drawText( String text, int textColor, int textSize, int font, float x, float y);
public float measureText( String text, int textSize, int font); public float measureText( String text, int textSize, int font);
public void arrow(int color, float x1, float y1, float x2, float y2, float x3, float y3); public void arrow(int color, float x1, float y1, float x2, float y2, float x3, float y3);
public void triangle(int color, boolean fill, float x1, float y1, float x2, float y2, float x3, float y3);
public int getCanvasWidth(); public int getCanvasWidth();
public int getCanvasHeight(); public int getCanvasHeight();
public void setCanvas(Canvas canvas); public void setCanvas(Canvas canvas);
......
...@@ -27,6 +27,7 @@ extern_java_sources := \ ...@@ -27,6 +27,7 @@ extern_java_sources := \
GlowPointX.java,\ GlowPointX.java,\
GlowPointDX.java,\ GlowPointDX.java,\
GlowDimension.java,\ GlowDimension.java,\
GlowDimensionD.java,\
GlowSliderInfo.java,\ GlowSliderInfo.java,\
GlowTableInfo.java,\ GlowTableInfo.java,\
GlowMenuInfo.java,\ GlowMenuInfo.java,\
...@@ -43,8 +44,10 @@ extern_java_sources := \ ...@@ -43,8 +44,10 @@ extern_java_sources := \
GlowBackgroundObject.java,\ GlowBackgroundObject.java,\
GlowEventMenu.java,\ GlowEventMenu.java,\
GlowEventToolbar.java,\ GlowEventToolbar.java,\
GlowEventTable.java,\
GrowCtxIfc.java,\ GrowCtxIfc.java,\
GrowCmn.java,\ GrowCmn.java,\
GrowAnnotIfc.java,\
GlowNodeClass.java,\ GlowNodeClass.java,\
GlowNodeGroup.java,\ GlowNodeGroup.java,\
GlowConClass.java,\ GlowConClass.java,\
......
...@@ -57,6 +57,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -57,6 +57,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
String pwrp_load = "pwrp_load/"; String pwrp_load = "pwrp_load/";
String pwr_exe = "pwr_exe/"; String pwr_exe = "pwr_exe/";
Timer timer = new Timer(); Timer timer = new Timer();
MyTask timerTask;
MainView view; MainView view;
Gdh gdh = null; Gdh gdh = null;
Handler handler = new Handler(); Handler handler = new Handler();
...@@ -126,7 +127,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -126,7 +127,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
setContentView(view); setContentView(view);
Log.i("PwrXtt", "Starting"); Log.i("PwrXtt", "Starting");
view.invalidate(); view.invalidate();
timer.schedule( new MyTask(), 0, 2000); setScanTime(0.5);
DisplayMetrics metrics = getResources().getDisplayMetrics(); DisplayMetrics metrics = getResources().getDisplayMetrics();
density = metrics.densityDpi / 150; density = metrics.densityDpi / 150;
...@@ -160,6 +161,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -160,6 +161,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
.setNegativeButton("Cancel", null) .setNegativeButton("Cancel", null)
.show(); .show();
} }
void setScanTime( double time) {
if ( timerTask != null)
timerTask.cancel();
timerTask = new MyTask();
timer.schedule( timerTask, 0, (int)(1000 * time));
}
public void onClick(DialogInterface dialog, int position) { public void onClick(DialogInterface dialog, int position) {
if ( dialog == inputDialog) { if ( dialog == inputDialog) {
Editable value = editInput.getText(); Editable value = editInput.getText();
...@@ -629,6 +638,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -629,6 +638,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
cmnAla.setGDraw(gdraw); cmnAla.setGDraw(gdraw);
PlowCmnEv cmnEve = new PlowCmnEv(appl, density * 15); PlowCmnEv cmnEve = new PlowCmnEv(appl, density * 15);
cmnEve.setGDraw(gdraw); cmnEve.setGDraw(gdraw);
setScanTime( 1);
currentCmn = cmnAla; currentCmn = cmnAla;
aev = new AEv(cmnAla, cmnEve, appl); aev = new AEv(cmnAla, cmnEve, appl);
cmnAla.setUserData(aev); cmnAla.setUserData(aev);
...@@ -636,6 +646,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -636,6 +646,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
view.invalidate(); view.invalidate();
} }
else { else {
setScanTime( 1);
currentCmn = aev.getCmnAla(); currentCmn = aev.getCmnAla();
view.invalidate(); view.invalidate();
} }
...@@ -653,6 +664,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -653,6 +664,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
cmnAla.setGDraw(gdraw); cmnAla.setGDraw(gdraw);
PlowCmnEv cmnEve = new PlowCmnEv(appl, density * 15); PlowCmnEv cmnEve = new PlowCmnEv(appl, density * 15);
cmnEve.setGDraw(gdraw); cmnEve.setGDraw(gdraw);
setScanTime( 1);
currentCmn = cmnEve; currentCmn = cmnEve;
aev = new AEv(cmnAla, cmnEve, appl); aev = new AEv(cmnAla, cmnEve, appl);
cmnAla.setUserData(aev); cmnAla.setUserData(aev);
...@@ -660,6 +672,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -660,6 +672,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
view.invalidate(); view.invalidate();
} }
else { else {
setScanTime( 1);
currentCmn = aev.getCmnEve(); currentCmn = aev.getCmnEve();
view.invalidate(); view.invalidate();
} }
...@@ -676,6 +689,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -676,6 +689,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
view.invalidate(); view.invalidate();
} }
else { else {
setScanTime( 1);
currentCmn = aev.getCmnEve(); currentCmn = aev.getCmnEve();
view.invalidate(); view.invalidate();
} }
...@@ -984,6 +998,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -984,6 +998,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
PlowCmn cmn = new PlowCmn(appl, density * 15); PlowCmn cmn = new PlowCmn(appl, density * 15);
cmn.setGDraw(gdraw); cmn.setGDraw(gdraw);
setScanTime( 1);
currentCmn = cmn; currentCmn = cmn;
cmnList.add(cmn); cmnList.add(cmn);
AXtt axtt = new AXtt((PlowCmn)currentCmn, gdh); AXtt axtt = new AXtt((PlowCmn)currentCmn, gdh);
...@@ -1055,6 +1070,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1055,6 +1070,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
PlowCmn cmn = new PlowCmn(appl, density * 15); PlowCmn cmn = new PlowCmn(appl, density * 15);
cmn.setGDraw(gdraw); cmn.setGDraw(gdraw);
setScanTime( 1);
currentCmn = cmn; currentCmn = cmn;
cmnList.add(cmn); cmnList.add(cmn);
AXtt axtt = new AXtt((PlowCmn)currentCmn, gdh); AXtt axtt = new AXtt((PlowCmn)currentCmn, gdh);
...@@ -1505,6 +1521,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1505,6 +1521,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
} }
if ( graphList.size() > 0) { if ( graphList.size() > 0) {
opwinCmn = new OpwinCmn(appl, graphList, density); opwinCmn = new OpwinCmn(appl, graphList, density);
setScanTime( 1);
currentCmn = opwinCmn; currentCmn = opwinCmn;
cmnList.add(opwinCmn); cmnList.add(opwinCmn);
} }
...@@ -1925,14 +1942,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1925,14 +1942,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
if ( currentCmn.type() == PlowCmnIfc.TYPE_FLOW) if ( currentCmn.type() == PlowCmnIfc.TYPE_FLOW)
gdraw.setDensity(1, density); gdraw.setDensity(1, density);
else else
gdraw.setDensity(density, density); gdraw.setDensity(density * density, density);
currentCmn.setCanvas(currentCanvas); currentCmn.setCanvas(currentCanvas);
currentCmn.draw(); currentCmn.draw();
/* Test /* Test */
Paint paint = new Paint(); Paint paint = new Paint();
currentCanvas.drawText( "Density " + density, 10, 100, paint); currentCanvas.drawText( "Density " + density, 10, 100, paint);
*/ /* */
getHolder().unlockCanvasAndPost(currentCanvas); getHolder().unlockCanvasAndPost(currentCanvas);
// currentCanvas = getHolder().lockCanvas(); // currentCanvas = getHolder().lockCanvas();
...@@ -1996,6 +2013,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -1996,6 +2013,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
return; return;
} }
FlowCmn fcmn = new FlowCmn(this, gdh, windowObjid); FlowCmn fcmn = new FlowCmn(this, gdh, windowObjid);
setScanTime( 1);
currentCmn = fcmn; currentCmn = fcmn;
cmnList.add(fcmn); cmnList.add(fcmn);
fcmn.setGDraw(gdraw); fcmn.setGDraw(gdraw);
...@@ -2009,8 +2027,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2009,8 +2027,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
node.setSelect(true); node.setSelect(true);
ctx.centerObject(node); ctx.centerObject(node);
} }
} }
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_OPEN, null)); new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_OPEN, null));
} }
...@@ -2052,6 +2069,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2052,6 +2069,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
graph.gdraw.setActivity(this); graph.gdraw.setActivity(this);
GraphCmn cmn = new GraphCmn(graph); GraphCmn cmn = new GraphCmn(graph);
currentCmn = cmn; currentCmn = cmn;
setScanTime( graph.getAnimationScanTime());
cmnList.add(cmn); cmnList.add(cmn);
// new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_OPEN, null)); // new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_OPEN, null));
...@@ -2269,6 +2287,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2269,6 +2287,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
if ( opwinCmn != null) if ( opwinCmn != null)
cmnIdx = 1; cmnIdx = 1;
setScanTime( 1);
currentCmn = cmnList.get(cmnIdx); currentCmn = cmnList.get(cmnIdx);
for ( int i = cmnList.size()-1; i > cmnIdx; i--) for ( int i = cmnList.size()-1; i > cmnIdx; i--)
cmnList.removeElementAt(i); cmnList.removeElementAt(i);
...@@ -2493,6 +2512,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2493,6 +2512,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
} }
public void closeGraph() { public void closeGraph() {
setScanTime( 1);
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn)); new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn));
if (graphObject.size() > 0) if (graphObject.size() > 0)
graphObject.removeElementAt(graphObject.size()-1); graphObject.removeElementAt(graphObject.size()-1);
...@@ -2551,6 +2571,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2551,6 +2571,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
if ( cmnList.size() == 1) { if ( cmnList.size() == 1) {
// Open opwin // Open opwin
if ( opwinCmn != null) { if ( opwinCmn != null) {
setScanTime( 1);
currentCmn = opwinCmn; currentCmn = opwinCmn;
cmnList.add(opwinCmn); cmnList.add(opwinCmn);
view.invalidate(); view.invalidate();
...@@ -2563,6 +2584,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2563,6 +2584,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
PlowNode o = (PlowNode)cmn.get(0); PlowNode o = (PlowNode)cmn.get(0);
AXttItemObject itemo = (AXttItemObject)o.getUserData(); AXttItemObject itemo = (AXttItemObject)o.getUserData();
itemo.close(axtt); itemo.close(axtt);
setScanTime( 1);
currentCmn = cmnList.get(cmnList.size()-2); currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1); cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size()); System.out.println( "cmnList.size() " + cmnList.size());
...@@ -2572,6 +2594,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2572,6 +2594,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
case PlowCmnIfc.TYPE_FLOW: case PlowCmnIfc.TYPE_FLOW:
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn)); new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn));
System.out.println( "cmnList.size() " + cmnList.size()); System.out.println( "cmnList.size() " + cmnList.size());
setScanTime( 1);
currentCmn = cmnList.get(cmnList.size()-2); currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1); cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size()); System.out.println( "cmnList.size() " + cmnList.size());
...@@ -2580,6 +2603,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2580,6 +2603,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
break; break;
case PlowCmnIfc.TYPE_EV: case PlowCmnIfc.TYPE_EV:
System.out.println( "cmnList.size() " + cmnList.size()); System.out.println( "cmnList.size() " + cmnList.size());
setScanTime( 1);
currentCmn = cmnList.get(cmnList.size()-1); currentCmn = cmnList.get(cmnList.size()-1);
aev = null; aev = null;
view.invalidate(); view.invalidate();
...@@ -2590,6 +2614,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2590,6 +2614,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
System.out.println( "cmnList.size() " + cmnList.size()); System.out.println( "cmnList.size() " + cmnList.size());
if (graphObject.size() > 0) if (graphObject.size() > 0)
graphObject.removeElementAt(graphObject.size()-1); graphObject.removeElementAt(graphObject.size()-1);
setScanTime( 1);
currentCmn = cmnList.get(cmnList.size()-2); currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1); cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size()); System.out.println( "cmnList.size() " + cmnList.size());
......
...@@ -67,6 +67,11 @@ public class Flow { ...@@ -67,6 +67,11 @@ public class Flow {
public static final int eDrawType_TextHelveticaBold = 7; public static final int eDrawType_TextHelveticaBold = 7;
public static final int eDrawType_TextHelveticaErase = 8; public static final int eDrawType_TextHelveticaErase = 8;
public static final int eDrawType_TextHelveticaEraseBold = 9; public static final int eDrawType_TextHelveticaEraseBold = 9;
public static final int eDrawType_ = 10;
public static final int eDrawType_Green = 11;
public static final int eDrawType_Yellow = 12;
public static final int eDrawType_DarkGray = 13;
public static final int eDrawType_Inherit = 9999;
public static final int mDisplayLevel_1 = 1 << 0; public static final int mDisplayLevel_1 = 1 << 0;
public static final int mDisplayLevel_2 = 1 << 2; public static final int mDisplayLevel_2 = 1 << 2;
...@@ -102,6 +107,8 @@ public class Flow { ...@@ -102,6 +107,8 @@ public class Flow {
public static final int eSave_AnnotPixmap = 16; public static final int eSave_AnnotPixmap = 16;
public static final int eSave_Radiobutton = 17; public static final int eSave_Radiobutton = 17;
public static final int eSave_Frame = 18; public static final int eSave_Frame = 18;
public static final int eSave_AnnotPixmapButton = 19;
public static final int eSave_Triangle = 20;
public static final int eSave_End = 99; public static final int eSave_End = 99;
public static final int eSave_Ctx_zoom_factor = 100; public static final int eSave_Ctx_zoom_factor = 100;
public static final int eSave_Ctx_base_zoom_factor = 101; public static final int eSave_Ctx_base_zoom_factor = 101;
...@@ -137,6 +144,7 @@ public class Flow { ...@@ -137,6 +144,7 @@ public class Flow {
public static final int eSave_Ctx_refcon_height = 131; public static final int eSave_Ctx_refcon_height = 131;
public static final int eSave_Ctx_refcon_textsize = 132; public static final int eSave_Ctx_refcon_textsize = 132;
public static final int eSave_Ctx_refcon_linewidth = 133; public static final int eSave_Ctx_refcon_linewidth = 133;
public static final int eSave_Ctx_user_version = 134;
public static final int eSave_Array_a = 200; public static final int eSave_Array_a = 200;
public static final int eSave_NodeClass_nc_name = 300; public static final int eSave_NodeClass_nc_name = 300;
public static final int eSave_NodeClass_a = 301; public static final int eSave_NodeClass_a = 301;
...@@ -156,6 +164,7 @@ public class Flow { ...@@ -156,6 +164,7 @@ public class Flow {
public static final int eSave_Rect_ll = 502; public static final int eSave_Rect_ll = 502;
public static final int eSave_Rect_ur = 503; public static final int eSave_Rect_ur = 503;
public static final int eSave_Rect_display_level = 504; public static final int eSave_Rect_display_level = 504;
public static final int eSave_Rect_fill = 505;
public static final int eSave_Line_draw_type = 600; public static final int eSave_Line_draw_type = 600;
public static final int eSave_Line_line_width = 601; public static final int eSave_Line_line_width = 601;
public static final int eSave_Line_p1 = 602; public static final int eSave_Line_p1 = 602;
...@@ -237,4 +246,5 @@ public class Flow { ...@@ -237,4 +246,5 @@ public class Flow {
public static final int eSave_Arrow_p_dest = 1404; public static final int eSave_Arrow_p_dest = 1404;
public static final int eSave_Arrow_p1 = 1405; public static final int eSave_Arrow_p1 = 1405;
public static final int eSave_Arrow_p2 = 1406; public static final int eSave_Arrow_p2 = 1406;
public static final int eSave_Triangle_rect_part = 2000;
} }
...@@ -108,7 +108,11 @@ public class FlowAnnot implements FlowArrayElem { ...@@ -108,7 +108,11 @@ public class FlowAnnot implements FlowArrayElem {
} }
} }
public void draw( Graphics2D g, FlowPoint p0, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p0, FlowNodeIfc node, boolean highlight) {
if ( node == null)
return;
String[] annotv = node.getAnnotv();
if ( annotv[number] == null) if ( annotv[number] == null)
return; return;
if ( (display_level & FlowCmn.display_level) == 0) if ( (display_level & FlowCmn.display_level) == 0)
......
...@@ -108,7 +108,7 @@ public class FlowArc implements FlowArrayElem { ...@@ -108,7 +108,7 @@ public class FlowArc implements FlowArrayElem {
} }
} }
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
Arc2D.Double rect = new Arc2D.Double( (ll.x + p.x) * cmn.zoom_factor, Arc2D.Double rect = new Arc2D.Double( (ll.x + p.x) * cmn.zoom_factor,
(ll.y + p.y) * cmn.zoom_factor, (ll.y + p.y) * cmn.zoom_factor,
(ur.x - ll.x) * cmn.zoom_factor, (ur.x - ll.x) * cmn.zoom_factor,
......
...@@ -79,6 +79,11 @@ public class FlowArray { ...@@ -79,6 +79,11 @@ public class FlowArray {
l.open( reader); l.open( reader);
a.add( l); a.add( l);
break; break;
case Flow.eSave_Triangle:
FlowTriangle t = new FlowTriangle( cmn);
t.open( reader);
a.add( t);
break;
case Flow.eSave_Arc: case Flow.eSave_Arc:
FlowArc arc = new FlowArc( cmn); FlowArc arc = new FlowArc( cmn);
arc.open( reader); arc.open( reader);
...@@ -124,9 +129,9 @@ public class FlowArray { ...@@ -124,9 +129,9 @@ public class FlowArray {
} }
} }
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
for ( int i = 0; i < a.size(); i++) { for ( int i = 0; i < a.size(); i++) {
((FlowArrayElem)a.get(i)).draw( g, p, annotv, highlight); ((FlowArrayElem)a.get(i)).draw( g, p, node, highlight);
} }
} }
......
...@@ -39,5 +39,5 @@ import java.awt.*; ...@@ -39,5 +39,5 @@ import java.awt.*;
import javax.swing.*; import javax.swing.*;
public interface FlowArrayElem { public interface FlowArrayElem {
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight); public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight);
} }
...@@ -113,7 +113,7 @@ public class FlowArrow implements FlowArrayElem { ...@@ -113,7 +113,7 @@ public class FlowArrow implements FlowArrayElem {
System.out.println( "IOExeption FlowArrow"); System.out.println( "IOExeption FlowArrow");
} }
} }
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
Polygon pol = new Polygon( new int[] { Polygon pol = new Polygon( new int[] {
(int) ((p1.x + p.x) * cmn.zoom_factor), (int) ((p1.x + p.x) * cmn.zoom_factor),
(int) ((p2.x + p.x) * cmn.zoom_factor), (int) ((p2.x + p.x) * cmn.zoom_factor),
......
...@@ -71,7 +71,7 @@ public class FlowCmn { ...@@ -71,7 +71,7 @@ public class FlowCmn {
this.ctx = ctx; this.ctx = ctx;
this.gdh = gdh; this.gdh = gdh;
this.session = session; this.session = session;
this.debug = false; this.debug = true;
this.antiAliasing = true; this.antiAliasing = true;
} }
......
...@@ -104,7 +104,7 @@ public class FlowConPoint implements FlowArrayElem { ...@@ -104,7 +104,7 @@ public class FlowConPoint implements FlowArrayElem {
} }
} }
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
} }
} }
......
...@@ -118,6 +118,7 @@ public class FlowCtx implements FlowCtxInterface { ...@@ -118,6 +118,7 @@ public class FlowCtx implements FlowCtxInterface {
case Flow.eSave_Ctx_refcon_height: case Flow.eSave_Ctx_refcon_height:
case Flow.eSave_Ctx_refcon_textsize: case Flow.eSave_Ctx_refcon_textsize:
case Flow.eSave_Ctx_refcon_linewidth: case Flow.eSave_Ctx_refcon_linewidth:
case Flow.eSave_Ctx_user_version:
break; break;
case Flow.eSave_Ctx_a_nc: case Flow.eSave_Ctx_a_nc:
FlowVector.open( reader, cmn, cmn.a_nc); FlowVector.open( reader, cmn, cmn.a_nc);
......
...@@ -100,7 +100,7 @@ public class FlowLine implements FlowArrayElem { ...@@ -100,7 +100,7 @@ public class FlowLine implements FlowArrayElem {
} }
} }
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
Line2D.Double line = new Line2D.Double( (p1.x + p.x) * cmn.zoom_factor, Line2D.Double line = new Line2D.Double( (p1.x + p.x) * cmn.zoom_factor,
(p1.y + p.y) * cmn.zoom_factor, (p1.y + p.y) * cmn.zoom_factor,
(p2.x + p.x) * cmn.zoom_factor, (p2.x + p.x) * cmn.zoom_factor,
......
...@@ -51,7 +51,7 @@ import java.awt.event.*; ...@@ -51,7 +51,7 @@ import java.awt.event.*;
<p> <p>
A flow node is a function object built by element of type arcs, lines, recangles, texts etc. A flow node is a function object built by element of type arcs, lines, recangles, texts etc.
*/ */
public class FlowNode extends JComponent implements FlowComponent, JopDynamic { public class FlowNode extends JComponent implements FlowComponent, FlowNodeIfc, JopDynamic {
static final int OFFSET = 2; static final int OFFSET = 2;
double x_right; double x_right;
double x_left; double x_left;
...@@ -70,16 +70,22 @@ public class FlowNode extends JComponent implements FlowComponent, JopDynamic { ...@@ -70,16 +70,22 @@ public class FlowNode extends JComponent implements FlowComponent, JopDynamic {
boolean highlight; boolean highlight;
boolean select; boolean select;
Component component; Component component;
int fill_color;
public FlowNode( FlowCmn cmn) { public FlowNode( FlowCmn cmn) {
component = this; component = this;
this.cmn = cmn; this.cmn = cmn;
pos = new FlowPoint( cmn); pos = new FlowPoint( cmn);
size = new Dimension(40,40); // .....todo size = new Dimension(40,40); // .....todo
fill_color = Flow.eDrawType_Inherit;
} }
public String[] getAnnotv() {
return annotv;
}
public int getFillColor() {
return fill_color;
}
public boolean getSelect() { public boolean getSelect() {
return select; return select;
} }
...@@ -282,7 +288,7 @@ public class FlowNode extends JComponent implements FlowComponent, JopDynamic { ...@@ -282,7 +288,7 @@ public class FlowNode extends JComponent implements FlowComponent, JopDynamic {
FlowPoint p = new FlowPoint(cmn); FlowPoint p = new FlowPoint(cmn);
p.x = pos.x - x_left + ((double) Flow.DRAWOFFSET) / cmn.zoom_factor; p.x = pos.x - x_left + ((double) Flow.DRAWOFFSET) / cmn.zoom_factor;
p.y = pos.y - y_low + ((double) Flow.DRAWOFFSET) / cmn.zoom_factor; p.y = pos.y - y_low + ((double) Flow.DRAWOFFSET) / cmn.zoom_factor;
nc.draw( g, p, annotv, highlight); nc.draw( g, p, this, highlight);
} }
boolean attrFound; boolean attrFound;
......
...@@ -95,8 +95,8 @@ public class FlowNodeClass { ...@@ -95,8 +95,8 @@ public class FlowNodeClass {
} }
} }
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
a.draw( g, p, annotv, highlight); a.draw( g, p, node, highlight);
} }
} }
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 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.jop;
import java.awt.*;
import javax.swing.*;
public interface FlowNodeIfc {
public String[] getAnnotv();
public int getFillColor();
}
...@@ -51,6 +51,7 @@ public class FlowRect implements FlowArrayElem { ...@@ -51,6 +51,7 @@ public class FlowRect implements FlowArrayElem {
int draw_type; int draw_type;
int line_width; int line_width;
int display_level; int display_level;
int fill;
FlowCmn cmn; FlowCmn cmn;
public FlowRect( FlowCmn cmn) { public FlowRect( FlowCmn cmn) {
...@@ -80,6 +81,9 @@ public class FlowRect implements FlowArrayElem { ...@@ -80,6 +81,9 @@ public class FlowRect implements FlowArrayElem {
case Flow.eSave_Rect_display_level: case Flow.eSave_Rect_display_level:
display_level = new Integer( token.nextToken()).intValue(); display_level = new Integer( token.nextToken()).intValue();
break; break;
case Flow.eSave_Rect_fill:
fill = new Integer( token.nextToken()).intValue();
break;
case Flow.eSave_Rect_ll: case Flow.eSave_Rect_ll:
ll.open( reader); ll.open( reader);
break; break;
...@@ -101,7 +105,7 @@ public class FlowRect implements FlowArrayElem { ...@@ -101,7 +105,7 @@ public class FlowRect implements FlowArrayElem {
} }
} }
public void draw( Graphics2D g, FlowPoint p, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
if ( (display_level & FlowCmn.display_level) == 0) if ( (display_level & FlowCmn.display_level) == 0)
return; return;
......
...@@ -98,7 +98,7 @@ public class FlowText implements FlowArrayElem { ...@@ -98,7 +98,7 @@ public class FlowText implements FlowArrayElem {
} }
} }
public void draw( Graphics2D g, FlowPoint p0, String[] annotv, boolean highlight) { public void draw( Graphics2D g, FlowPoint p0, FlowNodeIfc node, boolean highlight) {
int tsize; int tsize;
int idx = (int)(cmn.zoom_factor / cmn.base_zoom_factor * (text_size +4) - 4); int idx = (int)(cmn.zoom_factor / cmn.base_zoom_factor * (text_size +4) - 4);
if ( idx < 0) return; if ( idx < 0) return;
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 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.jop;
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
/**
Flow triangle element.
*/
public class FlowTriangle extends FlowRect {
public FlowTriangle( FlowCmn cmn) {
super(cmn);
}
public void open( BufferedReader reader) {
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( "line : " + key);
switch ( key) {
case Flow.eSave_Triangle_rect_part:
super.open(reader);
break;
case Flow.eSave_End:
end = true;
break;
default:
System.out.println( "Syntax error in FlowTriangle");
break;
}
if ( end)
break;
}
} catch ( Exception e) {
System.out.println( "IOExeption FlowTriangle");
}
}
public void draw( Graphics2D g, FlowPoint p, FlowNodeIfc node, boolean highlight) {
if ( (display_level & FlowCmn.display_level) == 0)
return;
Polygon pol = new Polygon( new int[] {
(int) ((ll.x + p.x) * cmn.zoom_factor),
(int) (((ll.x + ur.x) / 2 + p.x) * cmn.zoom_factor),
(int) ((ur.x + p.x) * cmn.zoom_factor),
(int) ((ll.x + p.x) * cmn.zoom_factor)},
new int[] {
(int) ((ur.y + p.y) * cmn.zoom_factor),
(int) ((ll.y + p.y) * cmn.zoom_factor),
(int) ((ur.y + p.y) * cmn.zoom_factor),
(int) ((ur.y + p.y) * cmn.zoom_factor)},
4);
g.setStroke( new BasicStroke( (float)(cmn.zoom_factor / cmn.base_zoom_factor * line_width)));
if ( fill != 0) {
int dtype;
if ( node != null && node.getFillColor() != Flow.eDrawType_Inherit)
dtype = node.getFillColor();
else
dtype = draw_type;
switch ( dtype) {
case Flow.eDrawType_LineRed:
g.setColor( Color.red);
break;
case Flow.eDrawType_Green:
g.setColor( Color.green);
break;
case Flow.eDrawType_Yellow:
g.setColor( Color.yellow);
break;
default:
g.setColor( Color.gray);
}
g.fill( pol);
}
g.setColor( Color.black);
if ( highlight)
g.setColor( Color.red);
g.draw( pol);
}
}
...@@ -99,12 +99,14 @@ local_java_sources := \ ...@@ -99,12 +99,14 @@ local_java_sources := \
GeFrameThin.java \ GeFrameThin.java \
Flow.java \ Flow.java \
FlowCtxInterface.java \ FlowCtxInterface.java \
FlowNodeIfc.java \
FlowCmn.java \ FlowCmn.java \
FlowComponent.java \ FlowComponent.java \
FlowPoint.java \ FlowPoint.java \
FlowArrayElem.java \ FlowArrayElem.java \
FlowRect.java \ FlowRect.java \
FlowLine.java \ FlowLine.java \
FlowTriangle.java \
FlowText.java \ FlowText.java \
FlowArc.java \ FlowArc.java \
FlowArrow.java \ FlowArrow.java \
......
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