@Override public void onClick(View arg0) { // TODO Auto-generated method stub getValues(); sv.setValues(carray); sv.invalidate(); }
/** Get the appropriate display for the given grid */ private void getImgH(int grid) { // double begT = getTime (grid * _xPix); // double begT = currImg.begT + getTime (grid * _xPix); double begT = FrameBegTime + getTime(grid * _xPix); double endT = begT + getTime(_xPix); MyImage the_img = searchImg(begT, endT); if (the_img != null) { currImg = the_img; debug.println("getImgH(" + grid + ") : " + "currImg = Img[" + the_img.imgIdH + "]"); } else { debug.println("getImgH(" + grid + ") : "); debug.println( "\t" + "currImg[" + currImg.imgIdH + "].drawRegion(" + begT + ", " + endT + ")"); currImg.drawRegion(begT, endT); } centralizeH(); repaint(); }
/** * Redraw all the images so that changes in options can take effect CAUTION: setupNestedStates * will hog up some of CPU's time but, it has to be performed to keep nesting upto date */ void Refresh() { waitCursor(); blink = false; blFlag = true; if (timer.isRunning()) timer.stop(); int prevH = getPrev(currImg.imgIdH); int nextH = getNext(currImg.imgIdH); waitCursor(); all_states.visible.SetupNestedStates(); normalCursor(); img[prevH].drawStuff(); img[nextH].drawStuff(); currImg.drawStuff(); if (blink) timer.start(); repaint(); parent.vcanvas1.repaint(); parent.vcanvas2.repaint(); parent.vport.setViewPosition(new Point(panePosX, 0)); debug.println("Refresh() : .parent.vport.setViewPosition(" + panePosX + ", 0)"); normalCursor(); }
public void paintComponent(Graphics g) { // We request keyboard focus out here so that we can catch events for locking zoom, etc. requestFocus(); // 3 Images are painted each time. The reason we use images rather than directly drawing // onto the graphics context is that the drawings of one image can be taking place // concurrently with the other using threads into offscreen graphic contexts assoc. // with the respective images. While printing we do the opposite if (setupComplete && currImg != null) { int prevH = getPrev(currImg.imgIdH); int nextH = getNext(currImg.imgIdH); if (blFlag || !timer.isRunning()) { img[prevH].paintStuff1(0, g, this); currImg.paintStuff1(_xPix, g, this); img[nextH].paintStuff1(_xPix + _xPix, g, this); /*g.drawImage (img [prevH].img, 0, 0, this); g.drawImage (img [prevH].timeimg, 0, _yPix, this); g.drawImage (currImg.img, _xPix, 0, this); g.drawImage (currImg.timeimg, _xPix, _yPix, this); g.drawImage (img [nextH].img, _xPix + _xPix, 0, this); g.drawImage (img [nextH].timeimg, _xPix + _xPix, _yPix, this);*/ } else { img[prevH].paintStuff2(0, g, this); currImg.paintStuff2(_xPix, g, this); img[nextH].paintStuff2(_xPix + _xPix, g, this); /*g.drawImage (img [prevH].img1, 0, 0, this); g.drawImage (img [prevH].timeimg, 0, _yPix, this); g.drawImage (currImg.img1, _xPix, 0, this); g.drawImage (currImg.timeimg, _xPix, _yPix, this); g.drawImage (img [nextH].img1, _xPix + _xPix, 0, this); g.drawImage (img [nextH].timeimg, _xPix + _xPix, _yPix, this);*/ } } if (zoomLkLineDispStatus && zXTime >= begTime && zXTime <= endTime) { int xcord = panePosX + getEvtXCord(zXTime - begTime); g.setColor(Color.white); g.drawLine(xcord, 0, xcord, _yPix); g.fillRect(xcord, _yPix - lineSize, zLockStrW + 2, lineSize); g.setColor(Color.black); g.drawRect(xcord, _yPix - lineSize, zLockStrW + 1, lineSize - 1); g.setColor(Color.red); g.drawString("Zoom Lock", xcord + 1, _yPix - fDescent); } if (elTLineDispStatus && elapsedPoint >= begTime && elapsedPoint <= endTime) { int xcord = panePosX + getEvtXCord(elapsedPoint - begTime); g.setColor(Color.white); g.drawLine(xcord, 0, xcord, _yPix); g.fillRect(xcord, _yPix - lineSize, elTimeStrW + 2, lineSize); g.setColor(Color.black); g.drawRect(xcord, _yPix - lineSize, elTimeStrW + 1, lineSize - 1); g.setColor(Color.red); g.drawString("Elapsed Time", xcord + 1, _yPix - fDescent); } }
public boolean parseImageRec(DrawFrame f) { parseB(); boolean bgflag; // iq.printLine(); if (iq.rString("img(")) { bgflag = false; } else if (iq.rString("bgimg(")) { bgflag = true; } else { return false; } parseB(); if (!iq.rString("name(")) return false; StringBuffer str = iq.rStrConst(); if (!iq.rString(").")) return false; // name(<string>) if (str == null) return false; String name = str.toString(); if (!iq.rString("(")) return false; if (!rNumPair()) return false; if (!iq.rString(").")) return false; // (<number>,<number). int offx = x1; int offy = y1; if (!iq.rString("width(")) return false; Integer wi = iq.rInteger(); if (!iq.rString(").")) return false; // width(<number>). if (wi == null) return false; int w = wi.intValue(); if (!iq.rString("height(")) return false; Integer hi = iq.rInteger(); if (!iq.rString(").")) return false; // height(<number>). if (hi == null) return false; int h = hi.intValue(); boolean isFirstTime = false; ImageOperator img = f.imageManager.getImageOperator(name); if (iq.rString("create.")) { if (img == null) { isFirstTime = true; img = new ImageOperator(f.canvas, gui.communicationNode.getNodeSettings()); f.imageManager.setImageOperator(name, img); } if (offx == 0 && offy == 0 && w == 10) { // System.out.println("xxx"); } if (!iq.rString("color(")) return false; Integer ci = iq.rInteger(); if (!iq.rString(")")) return false; // color(<number>) if (hi == null) return false; int cx = ci.intValue(); Color color = new Color(cx); // if (isFirstTime) { img.createNewImage(w, h); try { img.fillRect(0, 0, w, h, color); } catch (NullPointerException e) { System.out.println("img-create"); } FigCanvas fc = f.canvas; MyImage newfig = new MyImage(fc, img, this.getNodeSettings()); img.setMyImage(newfig); newfig.imageName = name; newfig.newFig(); newfig.offX = offx; newfig.offY = offy; if (bgflag) { fc.fs.add(newfig); newfig.depth = 25; fc.fs.setStep(-10); // f.depthIndicator.setValue(newfig.depth); } else { fc.ftemp.add(newfig); newfig.depth = 0; f.depthIndicator.setValue(newfig.depth); } } else { img.isCreatingImage = true; img.imageUpdate(null, 0, offx, offy, w, h); } parseB(); if (!iq.rString(")")) return false; // img( .... ) // return true; } else if (iq.rString("tile.")) { while (true) { if (!iq.rString("color(")) return false; Integer ci = iq.rInteger(); if (!iq.rString(")")) return false; // color(<number>) if (hi == null) return false; int cx = ci.intValue(); Color color = new Color(cx); img = gui.imageManager.getImageOperator(name); if (img == null) return false; img.fillRect(offx, offy, w, h, color); if (!iq.rString("-")) break; // - offx = offx + w; } parseB(); if (!iq.rString(")")) return false; // img( .... ) return true; } else if (iq.rString("binary")) { img = gui.imageManager.getImageOperator(name); if (img == null) return false; img.setBinaryImage(offx, offy, w, h, this.binary); // parseB(); if (!iq.rString(")")) return false; // img( .... ) return true; } else if (iq.rString("jpeg")) { img = gui.imageManager.getImageOperator(name); if (img == null) return false; img.setJpegImage(offx, offy, w, h, this.binary); parseB(); if (!iq.rString(")")) return false; // img( .... ) return true; } else if (iq.rString("sImg(")) { StringBuffer sb = iq.rStrConst(); if (sb == null) return false; if (!iq.rString(")")) return false; img = gui.imageManager.getImageOperator(name); if (img == null) return false; img.setSlowFineImage(sb.toString(), offx, offy, w, h, this.binary); parseB(); if (!iq.rString(")")) return false; // img( ...) return true; } else if (iq.rString("bmp.")) { str = iq.rStrConst(); if (str == null) return false; img = gui.imageManager.getImageOperator(name); if (img == null) return false; img.string2subImg(offx, offy, w, h, str.toString()); parseB(); if (!iq.rString(")")) return false; // img( .... ) return true; } else return false; // gui.canvas.repaint(); // return true; }