public void addRoi(String name, int shape, int lineWidth, int x, int y, int height, int width,
Color color) {
ImageViewer viewer = (ImageViewer) getComponent();
IJRoiManager imagePlus = viewer.getRoiManager();
if (imagePlus == null || name == null || name.isEmpty()) {
return;
}
Roi.setColor(color);
Roi roi = null;
Roi roi1 = null;
Roi roi2 = null;
String name1 = name + "_H";
String name2 = name + "_V";
if (roiMap.containsKey(name)) {
roi = roiMap.get(name);
imagePlus.deleteRoi(roi);
roiMap.remove(name);
roi = null;
}
// In case of cross
if (roiMap.containsKey(name1)) {
roi1 = roiMap.get(name1);
imagePlus.deleteRoi(roi1);
roiMap.remove(name1);
roi1 = null;
}
// In case of cross
if (roiMap.containsKey(name2)) {
roi2 = roiMap.get(name2);
imagePlus.deleteRoi(roi2);
roiMap.remove(name2);
roi2 = null;
}
switch (shape) {