Commit 5edb94e2 authored by claes's avatar claes

*** empty log message ***

parent 7a61f589
/*
* Proview $Id: GeDynXYCurve.java,v 1.1 2007-09-17 15:35:28 claes Exp $
* Proview $Id: GeDynXYCurve.java,v 1.2 2007-09-19 15:08:35 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -45,6 +45,8 @@ public class GeDynXYCurve extends GeDynElem {
int noofpoints;
int noOfPoints;
int xAttrType;
int yAttrType;
public float[] curveX;
public float[] curveY;
boolean updateAttrFound;
......@@ -96,6 +98,13 @@ public class GeDynXYCurve extends GeDynElem {
this.fill_curve = fill_curve;
}
public void connect() {
xAttrType = GeDyn.getTypeId( x_attr);
switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays:
yAttrType = GeDyn.getTypeId( y_attr);
break;
}
String attrName = dyn.getAttrName( update_attr);
if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
......@@ -260,11 +269,93 @@ public class GeDynXYCurve extends GeDynElem {
size = noOfPoints * 2 + 1;
break;
}
// Read x-array
CdhrFloatArray rxf;
CdhrIntArray rxi;
switch ( xAttrType) {
case Pwr.eType_Float32:
rxf = dyn.en.gdh.getObjectInfoFloatArray( attrName, size);
if ( rxf.evenSts())
return;
switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays:
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++)
curveX[i] = (rxf.value[i] - x_min_value) / ( x_max_value - x_min_value);
break;
case GeDyn.eCurveDataType_PointArray:
curveX = new float[noOfPoints];
curveY = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = (rxf.value[2*i] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = (rxf.value[2*i+1] - y_min_value) / ( y_max_value - y_min_value);
}
dyn.repaintNow = true;
break;
case GeDyn.eCurveDataType_TableObject:
noOfPoints = (int)rxf.value[0];
if ( noOfPoints > noofpoints)
noOfPoints = noofpoints;
if ( attrSize < noOfPoints)
noOfPoints = attrSize;
curveY = new float[noOfPoints];
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = (rxf.value[2*i+1] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = (rxf.value[2*i+2] - y_min_value) / ( y_max_value - y_min_value);
}
dyn.repaintNow = true;
break;
}
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
rxi = dyn.en.gdh.getObjectInfoIntArray( attrName, size);
if ( rxi.evenSts())
return;
CdhrFloatArray rx = dyn.en.gdh.getObjectInfoFloatArray( attrName, size);
if ( rx.evenSts())
switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays:
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++)
curveX[i] = ((float)rxi.value[i] - x_min_value) / ( x_max_value - x_min_value);
break;
case GeDyn.eCurveDataType_PointArray:
curveX = new float[noOfPoints];
curveY = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = ((float)rxi.value[2*i] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = ((float)rxi.value[2*i+1] - y_min_value) / ( y_max_value - y_min_value);
}
dyn.repaintNow = true;
break;
case GeDyn.eCurveDataType_TableObject:
noOfPoints = (int)rxi.value[0];
if ( noOfPoints > noofpoints)
noOfPoints = noofpoints;
if ( attrSize < noOfPoints)
noOfPoints = attrSize;
curveY = new float[noOfPoints];
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = ((float)rxi.value[2*i+1] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = ((float)rxi.value[2*i+2] - y_min_value) / ( y_max_value - y_min_value);
}
dyn.repaintNow = true;
break;
}
break;
default:
return;
}
// Read y-array
switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays:
attrName = dyn.getAttrName( y_attr);
......@@ -272,39 +363,39 @@ public class GeDynXYCurve extends GeDynElem {
if ( attrSize < noOfPoints)
noOfPoints = attrSize;
CdhrFloatArray ry = dyn.en.gdh.getObjectInfoFloatArray( attrName, noOfPoints);
if ( ry.evenSts())
return;
curveY = new float[noOfPoints];
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveY[i] = (ry.value[i] - y_min_value) / ( y_max_value - y_min_value);
curveX[i] = (rx.value[i] - x_min_value) / ( x_max_value - x_min_value);
}
dyn.repaintNow = true;
break;
case GeDyn.eCurveDataType_PointArray:
curveY = new float[noOfPoints];
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = (rx.value[2*i] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = (rx.value[2*i+1] - y_min_value) / ( y_max_value - y_min_value);
}
dyn.repaintNow = true;
break;
case GeDyn.eCurveDataType_TableObject:
noOfPoints = (int)rx.value[0];
if ( noOfPoints > noofpoints)
noOfPoints = noofpoints;
if ( attrSize < noOfPoints)
noOfPoints = attrSize;
curveY = new float[noOfPoints];
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = (rx.value[2*i+1] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = (rx.value[2*i+2] - y_min_value) / ( y_max_value - y_min_value);
CdhrFloatArray ryf;
CdhrIntArray ryi;
switch ( yAttrType) {
case Pwr.eType_Float32:
ryf = dyn.en.gdh.getObjectInfoFloatArray( attrName, noOfPoints);
if ( ryf.evenSts())
return;
for ( int i = 0; i < noOfPoints; i++)
curveY[i] = (ryf.value[i] - y_min_value) / ( y_max_value - y_min_value);
dyn.repaintNow = true;
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
ryi = dyn.en.gdh.getObjectInfoIntArray( attrName, noOfPoints);
if ( ryi.evenSts())
return;
for ( int i = 0; i < noOfPoints; i++)
curveY[i] = ((float)ryi.value[i] - y_min_value) / ( y_max_value - y_min_value);
dyn.repaintNow = true;
break;
default:
return;
}
dyn.repaintNow = true;
break;
}
......
......@@ -43,4 +43,6 @@
070720 cs co Listwidgets: Doubleclick and Enter activates a row.
070821 cs convert Template with includes inserted at structfile generation.
070905 cs doc New Guide to I/O Systems.
070906 cs statussrv Functionality to view userstatus added.
\ No newline at end of file
070906 cs statussrv Functionality to view userstatus added.
070918 cs wbl New systemclass $ClassLost to replace lost classes.
070919 cs wbl New class XyCurve to view a curve of points with x,y coordiantes.
\ No newline at end of file
This diff is collapsed.
......@@ -70,4 +70,7 @@
070824 cs wb Bugfix in WbEnvironment object, only the first nine pathes were used.
070827 cs wtt Objects in the navigator beneath a MountObject are viewed with classes from their dbs-file.
070905 cs utl Bugfix in listdescriptor. Superclass attributes where not printed.
070905 cs wb Bugfix in ldh_GetClassListAttrRef, success status was returned though list was empty.
\ No newline at end of file
070905 cs wb Bugfix in ldh_GetClassListAttrRef, success status was returned though list was empty.
070917 cs plc Bugfix, reference connections could not be set in gtk.
070918 cs wb Lost classes replaced with $ClassLost when reading wb_load file.
070919 cs wb Defaultvalues inserted into template objects when new attribute objects are added to a class.
\ No newline at end of file
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