Commit 82293dbd authored by lafabregue's avatar lafabregue

Correction of ROI module, and add ogr import/export

parent 38e3e173
# libgdalconstjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libgdalconstjni.so.20'
# Names of this library.
library_names='libgdalconstjni.so.20.3.1 libgdalconstjni.so.20 libgdalconstjni.so'
# The name of the static archive.
old_library='libgdalconstjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libgdalconstjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 gdalconst_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libgdalconstjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libgdaljni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libgdaljni.so.20'
# Names of this library.
library_names='libgdaljni.so.20.3.1 libgdaljni.so.20 libgdaljni.so'
# The name of the static archive.
old_library='libgdaljni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libgdaljni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 gdal_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libgdaljni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libgnmjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libgnmjni.so.20'
# Names of this library.
library_names='libgnmjni.so.20.3.1 libgnmjni.so.20 libgnmjni.so'
# The name of the static archive.
old_library='libgnmjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libgnmjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 gnm_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libgnmjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libogrjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libogrjni.so.20'
# Names of this library.
library_names='libogrjni.so.20.3.1 libogrjni.so.20 libogrjni.so'
# The name of the static archive.
old_library='libogrjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libogrjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 ogr_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libogrjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
# libosrjni.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libosrjni.so.20'
# Names of this library.
library_names='libosrjni.so.20.3.1 libosrjni.so.20 libosrjni.so'
# The name of the static archive.
old_library='libosrjni.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -ljson-c -lfreexl -lqhull -lgeos_c -lwebp /usr/lib/x86_64-linux-gnu/libsqlite3.la -lodbc -lodbcinst -lkmlbase -lkmldom -lkmlengine -lkmlxsd -lkmlregionator /usr/lib/x86_64-linux-gnu/libexpat.la -lxerces-c -lopenjp2 -lnetcdf -lhdf5_hl -lsz -lhdf5 /usr/lib/libmfhdfalt.la /usr/lib/libdfalt.la -logdi -lgif -ljpeg -lgeotiff -ltiff -lpng -lpq -lz -lpthread -lrt -ldl -lpcre /usr/lib/x86_64-linux-gnu/libcurl.la -lxml2'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libosrjni.
current=23
age=3
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
relink_command="(cd /home/baptiste/Downloads/gdal-2.2.2/swig/java; /bin/bash /home/baptiste/Downloads/gdal-2.2.2/libtool --mode=relink g++ -std=gnu++11 osr_wrap.lo /home/baptiste/Downloads/gdal-2.2.2/libgdal.la -o libosrjni.la -rpath /usr/local/lib -no-undefined -version-info 23:1:3 @inst_prefix_dir@)"
......@@ -46,12 +46,13 @@ public class ClassList {
private ROIToolsFrame roi;
/** Contains the areas */
private Vector<Vector<Object>> vectorOfClass;
/** Contains the points selected with the Zone Mode */
private Vector<Point> vp_zone;
/** Color of the zone */
private Color zoneColor = null;
/** Contains the points selected with the Zone Mode */
private Vector<Point> currentPolygonPoints = new Vector<Point>();
/**
* Initialise every elements needed for the display of areas.
*/
......@@ -63,7 +64,7 @@ public class ClassList {
this.jl_classList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.jl_classList.setFixedCellHeight(30);
this.lr_classList = new ListeRenderer();
jl_classList.setCellRenderer(lr_classList);
this.jl_classList.setCellRenderer(lr_classList);
this.jsp_classList = new JScrollPane(jl_classList);
this.jsp_classList.setBorder(null);
this.vectorOfClass = new Vector<Vector<Object>>();
......@@ -185,11 +186,11 @@ public class ClassList {
* This function treats the different action the user can do: Draw points,
* draw a zone, delete a points, delete contiguous points or a complete
* area.
*
* @param x
* int x-coordinate of the point in the ImagePanel
* @param y
* int y-coordinate of the point in the ImagePanel
* @param xreal
* int x-coordinate of the point on the whole picture
* @param yreal
......@@ -199,86 +200,72 @@ public class ClassList {
/** Nothing's done if nothing is selected in the list */
if (this.jl_classList.getSelectedIndex() != -1) {
Point p = new Point(xreal, yreal);
/** The user choose to draw points */
if (this.roi.getIndexOfSelectedButton() == 0) {
Point p = new Point(xreal, yreal);
/** Verify that the point doesn't exist and add it to the list */
if (!this.PointExists(p)) {
this.addPoint(p);
this.jl_classList.repaint();
this.imageSession.getImagePanel().dessinePoint(x, y,
this.getSelectedClassColor());
// this.imageSession.getImagePanel().dessinePoint(x, y,
// this.getSelectedClassColor());
}
}
/** The user choose to delete points */
else if (this.roi.getIndexOfSelectedButton() == 2) {
Point p = new Point(xreal, yreal);
if (this.PointExists(p)) {
/** The point is removed from the vector of areas */
deletePointInTheVectorOfClasses(xreal, yreal);
/** It's removed from the map */
this.imageSession.getImagePanel().supprimePoint(x, y,
this.imageSession.getPixelColor(x, y));
this.imageSession.getImagePanel()
.updateImageView();
// this.imageSession.getImagePanel().supprimePoint(x, y,
// this.imageSession.getPixelColor(x, y));
}
}
/** The user choose to create a zone */
else if (this.roi.getIndexOfSelectedButton() == 1) {
Point pz = new Point(xreal, yreal);
Point pi;
/** Get the vector with needed informations */
Vector<Integer> vinfo = this.imageSession.renvoiInformations();
if (this.zoneColor == null)
this.zoneColor = this.getSelectedClassColor();
this.zoneColor =this.getSelectedClassColor();
else {
if (!this.zoneColor.equals(this.getSelectedClassColor())) {
this.zoneColor = null;
this.initRegionVector();
this.imageSession.loadAllPoints();
this.imageSession.getImagePanel().refresh(false);
}
}
if (this.PointExistZoneVector(pz)) {
BufferedImage img = this.imageSession.getImagePanel()
.getImage();
int xfin = img.getWidth() + vinfo.get(4);// l'abcisse de fin
// de l'image du
// panel
int yfin = img.getHeight() + vinfo.get(5);// l'ordonnee de
// fin de
// l'image du
// panel
if (this.PointExistZoneVector(p)) {
/* Traitement adequat */
int xcor[] = new int[this.vp_zone.size() + 1];
int ycor[] = new int[this.vp_zone.size() + 1];
int xcor[] = new int[this.currentPolygonPoints.size() + 1];
int ycor[] = new int[this.currentPolygonPoints.size() + 1];
/** X and Y coordinates are stored in different arrays */
for (int i = 0; i < this.vp_zone.size(); i++) {
xcor[i] = this.vp_zone.get(i).x;
ycor[i] = this.vp_zone.get(i).y;
for (int i = 0; i < this.currentPolygonPoints.size(); i++) {
xcor[i] = this.currentPolygonPoints.get(i).x;
ycor[i] = this.currentPolygonPoints.get(i).y;
}
xcor[this.vp_zone.size()] = 0;
ycor[this.vp_zone.size()] = 0;
xcor[this.currentPolygonPoints.size()] = 0;
ycor[this.currentPolygonPoints.size()] = 0;
/** The zone is initialized */
this.polyg = new Polygon(xcor, ycor, this.vp_zone.size());
this.polyg = new Polygon(xcor, ycor, this.currentPolygonPoints.size());
/**
* Search each points which is in the zone, verify that it
* doesn't exist, then add it to the vector and draw it.
*/
for (int i = vinfo.get(4); i <= xfin; i++) {
for (int i = polyg.getBounds().x; i <= polyg.getBounds().x+polyg.getBounds().width; i++) {
for (int j = vinfo.get(5); j <= yfin; j++) {
for (int j = polyg.getBounds().y; j <= polyg.getBounds().y+polyg.getBounds().height; j++) {
if (this.polyg.contains(i, j)) {
......@@ -291,32 +278,15 @@ public class ClassList {
}
this.jl_classList.repaint();
this.imageSession.loadAllPoints();
/** Vector is re-initialized */
this.initRegionVector();
/** The polygon is saved */
listOfPolygone.addPolygon(polyg);
initTemporaryPolygonPoints();
} else {
Point p = new Point(xreal, yreal);
if (!PointExists(p)) {
if (this.vp_zone.size() > 0)
this.imageSession.getImagePanel()
.dessinerLigne(
(this.vp_zone.get(this.vp_zone
.size() - 1).x)
- vinfo.get(2),
(this.vp_zone.get(this.vp_zone
.size() - 1).y)
- vinfo.get(3), x, y, this
.getSelectedClassColor());
else
this.imageSession.getImagePanel().dessinePoint(x, y,
this.getSelectedClassColor());
this.vp_zone.add(p);
this.currentPolygonPoints.add(p);
}
}
}
......@@ -434,7 +404,7 @@ public class ClassList {
java.awt.Cursor.DEFAULT_CURSOR));
}
}
this.imageSession.getImagePanel().refresh(false);
}
}
......@@ -1434,14 +1404,7 @@ public class ClassList {
*/
public void initialiseImage() {
if (this.vp_zone != null) {
if (!this.vp_zone.isEmpty())
this.imageSession.loadAllPoints();
this.initRegionVector();
} else
this.initRegionVector();
this.initRegionVector();
}
/**
......@@ -1450,7 +1413,7 @@ public class ClassList {
*/
public void initRegionVector() {
this.vp_zone = new Vector<Point>();
this.currentPolygonPoints = new Vector<Point>();
}
/**
......@@ -1562,8 +1525,8 @@ public class ClassList {
public boolean PointExistZoneVector(Point p) {
boolean b = false;
for (int i = 0; i < this.vp_zone.size() && !b; i++)
b = this.vp_zone.get(i).equals(p);
for (int i = 0; i < this.currentPolygonPoints.size() && !b; i++)
b = this.currentPolygonPoints.get(i).equals(p);
return b;
}
......@@ -1604,6 +1567,11 @@ public class ClassList {
listOfPolygone.addPolygon(plg);
}
public void initTemporaryPolygonPoints() {
this.currentPolygonPoints = new Vector<Point>();
}
/**
* Removes all points of the selected class in the list. After that, the
* impage is updated.
......@@ -1632,6 +1600,14 @@ public class ClassList {
return this.jl_classList;
}
/**
* Return the currently constructed Polygon points
* @return the list of points already selected, empty if no polygon is in construction
*/
public Vector<Point> getCurrentPolygonPoints() {
return currentPolygonPoints;
}
@SuppressWarnings("unchecked")
public void selectClass(int x, int y) {
boolean found = false;
......
package mustic.gui;
import java.beans.PropertyVetoException;
import javax.swing.JOptionPane;
import javax.swing.event.InternalFrameEvent;
......@@ -33,16 +31,12 @@ public class ImageDesktopFrame extends DesktopFrame {
ROIToolsFrame module = imageSession.getImagePanel().getROIToolsFrame();
if (module == null) {
module = new ROIToolsFrame(imageSession);
imageSession.getImagePanel().subscribeTo(module);
}
this.imageSession.gardeInstance(module);
MainFrame.getInstance().getDesktop().add(module);
try {
module.setSelected(true);
module.setVisible(true);
} catch (PropertyVetoException e) {
}
module.setVisible(true);
}
public void closeModuleROI() {
......@@ -50,7 +44,7 @@ public class ImageDesktopFrame extends DesktopFrame {
ROIToolsFrame roi = this.imageSession.getImagePanel()
.getROIToolsFrame();
if (roi != null && !roi.isClosed()) {
if (roi != null && !roi.isVisible()) {
int answer = JOptionPane.showConfirmDialog(this,
Messages.getString("DesktopFrame.0"), Messages.getString("DesktopFrame.1"), //$NON-NLS-1$ //$NON-NLS-2$
......@@ -60,10 +54,8 @@ public class ImageDesktopFrame extends DesktopFrame {
roi.saveRoiAs();
}
try {
roi.setClosed(true);
} catch (PropertyVetoException ex) {
}
roi.setVisible(false);
roi.dispose();
}
}
......
This diff is collapsed.
package mustic.gui;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyVetoException;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Hashtable;
......@@ -15,7 +19,7 @@ import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
......@@ -27,14 +31,13 @@ import javax.swing.JSlider;
import javax.swing.JToggleButton;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import mustic.gui.panels.ImagePanel;
import mustic.io.PiLLiTools;
import mustic.io.roi.ROIImage;
import mustic.io.roi.RegionOfInterest;
import mustic.io.roi.RoiFilter;
import mustic.utils.image.ImageAddOn;
import org.jfree.ui.RefineryUtilities;
......@@ -44,7 +47,7 @@ class Infos {
public String nomLabel;
}
public class ROIToolsFrame extends JInternalFrame implements ActionListener {
public class ROIToolsFrame extends JFrame implements ImageAddOn, ActionListener {
// attributs:
private static final long serialVersionUID = 1L;
......@@ -137,7 +140,9 @@ public class ROIToolsFrame extends JInternalFrame implements ActionListener {
* the name of the opened image
*/
public ROIToolsFrame(ImageSession imageSession) {
super(Messages.getString("ROIToolsFrame.0") + imageSession.mTitle, true, true, true); //$NON-NLS-1$
//super(Messages.getString("ROIToolsFrame.0") + imageSession.mTitle, true, true, true); //$NON-NLS-1$
this.setTitle(Messages.getString("ROIToolsFrame.0") + imageSession.mTitle); //$NON-NLS-1$
this.jp_module = new JPanel(new BorderLayout());
......@@ -171,72 +176,7 @@ public class ROIToolsFrame extends JInternalFrame implements ActionListener {
this.setSize(220, 400);
this.setLocation(10, 10);
setIconifiable(true);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.addInternalFrameListener(new InternalFrameListener() {
@Override
public void internalFrameActivated(InternalFrameEvent e) {
}
@Override
public void internalFrameClosed(InternalFrameEvent e) {
try {
resetROI();
e.getInternalFrame().setClosed(true);
} catch (PropertyVetoException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
@Override
public void internalFrameClosing(InternalFrameEvent e) {
// if (!ROIToolsFrame.this.classList.listOfClassIsEmpty()) {
// int code_retour =
// JOptionPane.showConfirmDialog(ROIToolsFrame.this,
// "Do you want to save ?", "Confirmation",
// JOptionPane.YES_NO_OPTION);
// if (code_retour == JOptionPane.OK_OPTION) {
// if (ROIToolsFrame.this.path != null)
// saveROI();
// else {
// ROIToolsFrame.this.annule = false;
// saveRoiAs();
// }
//
// if (!ROIToolsFrame.this.annule)
// resetROI();
// } else if (code_retour == JOptionPane.NO_OPTION)
// resetROI();
// } else
// resetROI();
}
@Override
public void internalFrameDeactivated(InternalFrameEvent e) {
}
@Override
public void internalFrameDeiconified(InternalFrameEvent e) {
}
@Override
public void internalFrameIconified(InternalFrameEvent e) {
}
@Override
public void internalFrameOpened(InternalFrameEvent e) {
}
});
}
@Override
......@@ -297,6 +237,12 @@ public class ROIToolsFrame extends JInternalFrame implements ActionListener {
this.jb_zone.setToolTipText(Messages.getString("ROIToolsFrame.6")); //$NON-NLS-1$
this.jb_zone.addActionListener(this);
this.jb_zone.setActionCommand("1"); //$NON-NLS-1$
this.jb_zone.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
classList.initTemporaryPolygonPoints();
}
});
this.jb_suppr = new JToggleButton(new ImageIcon(getClass().getResource(
"/icons/actions/edit-clear.png"))); //$NON-NLS-1$
......@@ -613,7 +559,6 @@ public class ROIToolsFrame extends JInternalFrame implements ActionListener {
/**
* Modify the transparency for each point in the map
*/
@SuppressWarnings("unchecked")
public void modifyPointsTransparency() {
JPanel jp_main = new JPanel(new BorderLayout());
......@@ -632,7 +577,7 @@ public class ROIToolsFrame extends JInternalFrame implements ActionListener {
js_transparency.setValue(100 - ((Float) (currentTransparency * 100))
.intValue());
Hashtable ht_sliderLabel = new Hashtable();
Hashtable<Integer, JLabel> ht_sliderLabel = new Hashtable<Integer, JLabel>();
ht_sliderLabel.put(new Integer(0), new JLabel("0 %")); //$NON-NLS-1$
ht_sliderLabel.put(new Integer(25), new JLabel("25 %")); //$NON-NLS-1$
ht_sliderLabel.put(new Integer(50), new JLabel("50 %")); //$NON-NLS-1$
......@@ -709,10 +654,8 @@ public class ROIToolsFrame extends JInternalFrame implements ActionListener {
saveRoiAs();
else
saveROI();
try {
this.setClosed(true);
} catch (PropertyVetoException e) {
}
this.dispose();
this.setVisible(false);
}
/**
......@@ -941,4 +884,81 @@ public class ROIToolsFrame extends JInternalFrame implements ActionListener {
RefineryUtilities.centerFrameOnScreen(this.dialogue);
}
}
@Override
public void reloadElements(BufferedImage view, int x, int y, int w, int h) {
Graphics2D graph = (Graphics2D) view.getGraphics();
for (RegionOfInterest roi : classList.getVectorRegionOfInterest()) {
graph.setColor(new Color(roi.getColor().getRed(), roi.getColor().getGreen(), roi.getColor().getBlue(), 255));
for (Point p : roi.getPoints()) {
Point topLeftPoint = imageSession.getImageDisplayer().converteCoordinatesToScreen(p.x, p.y);
Point bottomRightPoint = imageSession.getImageDisplayer().converteCoordinatesToScreen(p.x+1, p.y+1);
graph.fillRect(topLeftPoint.x, topLeftPoint.y,
bottomRightPoint.x - topLeftPoint.x,
bottomRightPoint.y - topLeftPoint.y);
}
}
if (classList.getCurrentPolygonPoints().size() > 0) {
// if only one point we just draw it
if (classList.getCurrentPolygonPoints().size() == 1) {
Point p = classList.getCurrentPolygonPoints().get(0);
Point topLeftPoint = imageSession.getImageDisplayer().converteCoordinatesToScreen(p.x, p.y);
Point bottomRightPoint = imageSession.getImageDisplayer().converteCoordinatesToScreen(p.x+1, p.y+1);
graph.fillRect(topLeftPoint.x, topLeftPoint.y,
bottomRightPoint.x - topLeftPoint.x,
bottomRightPoint.y - topLeftPoint.y);
// otherwise we draw all lines
} else {
for(int i = 0 ; i < classList.getCurrentPolygonPoints().size()-1 ; i++) {
Point pFrom = classList.getCurrentPolygonPoints().get(i);
pFrom = imageSession.getImageDisplayer().converteCoordinatesToScreen(pFrom.x,