]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.trend/src/org/simantics/trend/impl/ItemNode.java
Still fixes history collection value band endTime setting and rendering
[simantics/platform.git] / bundles / org.simantics.trend / src / org / simantics / trend / impl / ItemNode.java
index dcbd1c797a28ac138a0037792fbbff2a000d2130..402d793f8cc4c34e4fbc15c5d4958f9a3635e26c 100644 (file)
@@ -54,6 +54,7 @@ import org.simantics.trend.configuration.TrendItem;
 import org.simantics.trend.configuration.TrendItem.DrawMode;
 import org.simantics.trend.configuration.TrendItem.Renderer;
 import org.simantics.trend.util.KvikDeviationBuilder;
+import org.slf4j.LoggerFactory;
 
 /**
  * Data node for a TrendItem
@@ -63,7 +64,8 @@ import org.simantics.trend.util.KvikDeviationBuilder;
 public class ItemNode extends G2DNode implements TrendLayout {
 
        private static final long serialVersionUID = -4741446944761752871L;
-
+       private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ItemNode.class);
+       
        public static final AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .61f);
 
        public TrendItem item;
@@ -246,7 +248,9 @@ public class ItemNode extends G2DNode implements TrendLayout {
                        line.lineTo(maxX, ny);
                        line.moveTo(x, y);              
                } else {
-                       line.lineTo(x, y);              
+                       if (x != currentX || y != currentY) {
+                               line.lineTo(x, y);
+                       }
                }
                
        }
@@ -329,7 +333,7 @@ public class ItemNode extends G2DNode implements TrendLayout {
                        s.accessor.get(i, s.sampleBinding, vb.getSample());
                        
                        if(!validSample(vb)) {
-                               System.err.println("-invalid value band: " + i + "/" + count + ":" + vb);
+                               LOGGER.warn("-invalid value band: " + i + "/" + count + ":" + vb);
                                continue;
                        }
                        // Non-continuation point
@@ -425,7 +429,11 @@ public class ItemNode extends G2DNode implements TrendLayout {
                                                                }
                                                        }
 
-                                                       lineTo(x2, y2);
+                                                       // gitlab #35: t2 > t1 ensure that the value band is
+                                                       // rendered as a horizontal line until the the time when
+                                                       // the band's value went out of dead-band.
+                                                       if (flat || t2 > t1)
+                                                               lineTo(x2, y2);
                                                        
 //                                                     if(showBand) {
 //                                                             lineTo(x2, y2);
@@ -466,7 +474,7 @@ public class ItemNode extends G2DNode implements TrendLayout {
                        }
                                        
                        // Binary signal
-                       if (item.renderer == Renderer.Binary) {
+                       else if (item.renderer == Renderer.Binary) {
                                byte value = 0;
                                if (vb.getValueBinding() instanceof BooleanBinding) {
                                        value = ((Boolean) vb.getValue(Bindings.BOOLEAN)) ? (byte)0 : (byte)1;