protected void createAndDrawImage() throws IOException { if (gradient != null) { remove(gradient); } createImage(); drawDensityOnImage(); if (imagePanel != null) { imagePanel.setPixPerCol(pixpercol); imagePanel.setPixPerRow(pixperrow); imagePanel.setBucketSize(wellDensity.getBucketSize()); imagePanel.setImage(bimage); imagePanel.setCoordscale(coordscale); } else { imagePanel = new WellsImagePanel( expcontext, BORDER, bimage, pixpercol, pixperrow, wellDensity.getBucketSize(), this, nrWidgets); imagePanel.setCoordscale(coordscale); // p("WellsImagePanel created"); add("Center", imagePanel); imagePanel.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { processClick(e); } @Override public void mouseReleased(MouseEvent e) { processClick(e); } }); imagePanel.addMouseListener(popAdapter); } afterImageCreated(); add("East", gradient); gradient.repaint(); imagePanel.repaint(); this.repaint(); }
public WellCoordinate getWellCoordinate(int x, int y) { if (imagePanel == null) { p("Got no image panel"); return null; } WellCoordinate coord = imagePanel.getCoord(new Point(x, y)); return coord; }
@Override public void repaint() { super.repaint(); if (imagePanel != null) { imagePanel.repaint(); } if (gradient != null) { gradient.repaint(); } }
protected void processClick(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { popcoord = imagePanel.getCoord(e.getPoint()); } if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) { p("GeneralDensityPanel.processClick"); WellSelection sel = imagePanel.getWellSelection(); if (sel == null && imagePanel.getWellCoordinate() == null) { p("GeneralDensityPanel.processClick. Got no well selection or coordinate"); return; } p( "Got selection from image: " + ", sel is: " + sel + ", area offset=" + imagePanel.getAreaOffsetX() + "/" + imagePanel.getAreaOffsetY()); if (sel != null) { ArrayList<WellCoordinate> coords = getCoords(sel); sel.setAllWells(coords); p("publishing SELECTION"); publishSelection(sel); } WellCoordinate coord = imagePanel.getWellCoordinate(); if (wellcontext == null && expcontext != null) { wellcontext = expcontext.getWellContext(); } if (coord != null && wellcontext != null) { wellcontext.setCoordinate(coord); wellcontext.loadMaskData(coord); p("publishing relative coord: " + coord); publishCoord(coord); } } return; }
public Point getImagePointFromWell(WellCoordinate coord) { return imagePanel.getImagePointFromWell(coord); }
public void showNavigationImage(boolean b) { if (imagePanel != null) { imagePanel.setNavigationImageEnabled(b); } }