diff --git a/src/osp/Image.java b/src/osp/Image.java index b7214c1..b28f3c8 100755 --- a/src/osp/Image.java +++ b/src/osp/Image.java @@ -698,21 +698,21 @@ System.out.println("Im 247 cat : "+cat); * Used to create a new object when using a manual selection-clic on image * Or when loaded by local catalog or from a server. * @param isRef : true if the object is a reference. - * @param from : Where the object has been obtained. "Cat : catalog, Loc : Local catalog, Sel: Manual selection" - * @param fromLib : Libelle of where the object comes from + * @param f : load catalog number. + * @param props : List of properties when local cat, or catalog name when download from server. * @param pos : Position of the object. * @param wcObject : Object world coordinates in J2000 * @param priority : Object priority */ // public void addObject(int id, boolean isRef, int f, String from, Point2D.Double pos, WorldCoords wcObject, int prior) { - public void addObject(String id, boolean isRef, int f, String from, Point2D.Double pos, WorldCoords wcObject, int prior) { + public void addObject(String id, boolean isRef, int f, String props, Point2D.Double pos, WorldCoords wcObject, int prior) { //System.out.println(" Image addObj 2 "+id); // if (id==-1) id=listObjects.size(); if (id=="-1") id=String.valueOf(listObjects.size()); - listObjects.add(new SkyObject(id, listObjects.size(), isRef, f, from, pos, wcObject,prior)); + listObjects.add(new SkyObject(id, listObjects.size(), isRef, f, props, pos, wcObject,prior)); } /** diff --git a/src/osp/Mask.java b/src/osp/Mask.java index 1802bc5..e6170c8 100755 --- a/src/osp/Mask.java +++ b/src/osp/Mask.java @@ -197,7 +197,7 @@ public class Mask extends Observable implements MaskInterface, Observer { leftCornerDeg = new Point2D.Double(); validated = false; setOrientation(0.0); - setM_uuid(); + // setM_uuid(); history = new MaskHistory(this); } /** diff --git a/src/osp/Reader.java b/src/osp/Reader.java index c40db89..fe1e73a 100755 --- a/src/osp/Reader.java +++ b/src/osp/Reader.java @@ -200,11 +200,11 @@ public class Reader { try { - if (maskElement.getChild("maskUUID")!= null) - { - m_uuid=maskElement.getChild("maskUUID").getText();; - } - else m_uuid="N/A"; +// if (maskElement.getChild("maskUUID")!= null) +// { +// m_uuid=maskElement.getChild("maskUUID").getText();; +// } +// else m_uuid="N/A"; //System.out.println("Reader loadMask UUID = "+m_uuid); maskCenter.x = Double.parseDouble(maskElement.getChild("center").getChild("x").getValue()); @@ -248,8 +248,8 @@ public class Reader { currentMask.addObserver(pater.getVisuPanel()); currentMask.addObserver(pater.getSelectPanel()); currentMask.addObserver(pater.getOspeControl()); - if (m_uuid.equals("N/A")) currentMask.setM_uuid(); - else currentMask.set_uuid_fromF(m_uuid); +// if (m_uuid.equals("N/A")) currentMask.setM_uuid(); +// else currentMask.set_uuid_fromF(m_uuid); } } return noError; @@ -853,8 +853,8 @@ public class Reader { currentImage.addMask(maskCenterConv); Mask currentMask = currentImage.getCurrentMask(); - if (m_uuid.equals("N/A")) currentMask.setM_uuid(); - else currentMask.set_uuid_fromF(m_uuid); +// if (m_uuid.equals("N/A")) currentMask.setM_uuid(); +// else currentMask.set_uuid_fromF(m_uuid); currentMask.setCenterWc(maskAlpha, maskDelta); currentMask.setOmega(maskAngle); diff --git a/src/osp/SkyObject.java b/src/osp/SkyObject.java index 13fb862..f9c5ce2 100755 --- a/src/osp/SkyObject.java +++ b/src/osp/SkyObject.java @@ -56,20 +56,27 @@ public class SkyObject * @param iR true if the object is a reference object, false otherwise * @param p Center of the object (in image coordinates) * @param pRecalc Center of the object once recalculated (in image coordinates) + * @param c Color following priority. */ - public SkyObject(int n, boolean iR, Point2D.Double p, Point2D.Double pRecalc) + public SkyObject(int n, boolean iR, Point2D.Double p, Point2D.Double pRecalc, Color c) { // System.out.print("SkyObj 1 "+n+" "); numIm = n; - isRef = iR; + isRef = iR; + posPix = new Point2D.Double(); setPosPix(p); - setPosPixRecalc(pRecalc); - Color c=Color.BLUE; - if (pRecalc!= null) - c=Color.green; + +// if (pRecalc!= null) +// { +// System.out.println("SkyObj - pRecal "+pRecalc.getX()+" "+pRecalc.getY()); +// setPosPixRecalc(pRecalc); +// c=Color.green; +// } + if (isRef )c=Color.red; - setColor(c); + // System.out.println("SkyObj -"+n+" const temp color "+c.toString()); + this.setColor(c); // WorldCoords coords = new WorldCoords(wc.getRA(),wc.getDec()); // setObjWorldCenter(coords); // setObjWorldRecalc(coords); @@ -83,15 +90,15 @@ public class SkyObject * @param id Object id from a project or a catalog * @param n Object number in project * @param iR true if the object is a reference object, false otherwise - * @param f nbCat : number of catalogs loaded - * @param fr from Origin catalog. + * @param fi nbCat : number of catalogs loaded + * @param props Object Properties/catalog name/ ... * @param p Center of the object (in canvas coordinates) * @param wc Object world coordinates in J2000 * @param prior Object priority */ // public SkyObject(int idO, int n, boolean iR, int fi, String fr, Point2D.Double p, WorldCoords wc, int prior) - public SkyObject(String idO, int n, boolean iR, int fi, String fr, Point2D.Double p, WorldCoords wc, int prior) + public SkyObject(String idO, int n, boolean iR, int fi, String props, Point2D.Double p, WorldCoords wc, int prior) { //System.out.println(" SkyObj 2 num "+n+" id "+idO); @@ -99,7 +106,7 @@ public class SkyObject numIm=n; isRef = iR; group=fi; - prop=fr; + prop=props; posPix = new Point2D.Double(); setPosPix(p); posPixRecalc = null; @@ -107,8 +114,24 @@ public class SkyObject objWorldRecalc=new WorldCoords(0,0); priority = prior; Color c=Color.blue; - if (isRef )c=Color.red; + switch (prior) + { + case 1: + c=Color.RED; + break; + case 2: + c=Color.WHITE; + break; + default: + c=Color.BLUE; + break; + } + + if (isRef )c=Color.RED; + setColor(c); + + // System.out.println("SkyObj - "+n+ " const Norm color "+c.toString()); } @@ -249,9 +272,14 @@ public class SkyObject */ public boolean isCenterRecalc () { - Color c = new Color(0, 255, 0); - this.setColor(c); - return posPixRecalc != null; + boolean err=false; + if (posPixRecalc != null) + { + Color c = new Color(0, 255, 0); + this.setColor(c); + err=true; + } + return err; } @@ -284,6 +312,26 @@ public Color getColor() { * Set the color the object will be drawn with * @param col : color */ +public void setColorWithPriority(int p) { +Color c; + switch (p) + { + case 1: + c=Color.RED; + break; + case 2: + c=Color.WHITE; + break; + default: + c=Color.BLUE; + break; + } + this.col=c; +} +/** + * Set the color the object will be drawn with + * @param col : color + */ public void setColor(Color col) { this.col = col; } diff --git a/src/osp/Writer.java b/src/osp/Writer.java index c843b20..49483ef 100755 --- a/src/osp/Writer.java +++ b/src/osp/Writer.java @@ -274,6 +274,10 @@ public class Writer { Attribute selectedSlit = new Attribute("selectedSlit", String.valueOf(m.getSelectedSlit())); e_mask.setAttribute(selectedSlit); + + String mUUID=m.getS_uuid(); + if (mUUID.isEmpty()) m.setM_uuid(); + Element e_maskUUID = new Element("maskUUID"); e_maskUUID.setText(m.getS_uuid()); e_mask.addContent(e_maskUUID); @@ -347,9 +351,9 @@ public class Writer { Attribute selectedSlit = new Attribute("selectedSlit", String.valueOf(m.getSelectedSlit())); e_mask.setAttribute(selectedSlit); - Element e_maskUUID = new Element("maskUUID"); - e_maskUUID.setText(m.getS_uuid()); - e_mask.addContent(e_maskUUID); +// Element e_maskUUID = new Element("maskUUID"); +// e_maskUUID.setText(m.getS_uuid()); +// e_mask.addContent(e_maskUUID); // Mask properties in the image selected /** Mask coordinates RA - DEC */ diff --git a/src/osp/ui/OSPE_VisuPanel.java b/src/osp/ui/OSPE_VisuPanel.java index 3968506..a62fd01 100755 --- a/src/osp/ui/OSPE_VisuPanel.java +++ b/src/osp/ui/OSPE_VisuPanel.java @@ -901,8 +901,9 @@ public class OSPE_VisuPanel extends JPanel implements Observer, { SkyObject sk = fov.getCurrentImage().getListObjects().get(numObj); sk.setPosPixRecalc(null); - String src=sk.getSrc().replace(" (R)", ""); - sk.setSrc(src); + sk.setColorWithPriority(sk.getPriority()); +// String src=sk.getSrc().replace(" (R)", ""); +// sk.setSrc(src); updateByHand(); //updateByHand("V revert cent"); @@ -2289,7 +2290,8 @@ public class OSPE_VisuPanel extends JPanel implements Observer, pos = positonCalcul(sk.getPosition()); sk.setPosPixRecalc(pos); - + sk.setColor(Color.GREEN); + icc.imageToCanvasCoords(pos, false); sk.setObjWorldRecalc(getWorldCoords(pos.getX(), pos.getY())); @@ -2297,12 +2299,14 @@ public class OSPE_VisuPanel extends JPanel implements Observer, /** * Information that the object center has been recalculated */ - if (!sk.getSrc().endsWith("(R)")) - { - String src=sk.getSrc(); - sk.setSrc(src + " (R)"); - } - +// String src=""; +// if (!sk.getSrc().isEmpty()) src=sk.getSrc(); +// +// if (!sk.getSrc().endsWith("(R)")) +// { +// sk.setSrc(src + " (R)"); +// } +// /** * Update object position in the image associated List, when affected to a slit. */ @@ -2475,7 +2479,8 @@ public class OSPE_VisuPanel extends JPanel implements Observer, SkyObject sk = fov.getCurrentImage().getListObjects().get(i); //System.out.print(("visu Plot Obj"+sk.getNum()+" -")); - SkyObject tempObject = new SkyObject(-1, sk.isRef(), sk.getPosPix(), sk.getPosPixRecalc()); + SkyObject tempObject = new SkyObject(-1, sk.isRef(), sk.getPosPix(), sk.getPosPixRecalc(),sk.getColor()); + //SkyObject tempObject = new SkyObject(-1, sk.isRef(), sk.getSrc(), sk.getCatLibFrom(), sk.getPosPix(), // sk.getObjWorldCenter(), sk.getPosPixRecalc(), sk.getPriority()); @@ -2503,30 +2508,31 @@ public class OSPE_VisuPanel extends JPanel implements Observer, */ private void drawSquareAroundObject(int i, SkyObject tempObject) { - Color c=tempObject.getColor(); + Color cl=tempObject.getColor(); +//System.out.println("Visu DrawSqObj - "+i+" color "+cl.toString()); listCanvasObjects1.add(divaImageGraphics.makeFigure( new Line2D.Double(tempObject.getPosition().x - 5, tempObject.getPosition().y - 5, tempObject.getPosition().x + 5, - tempObject.getPosition().y - 5), c, c, lWidth)); + tempObject.getPosition().y - 5), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects1.get(i)); listCanvasObjects2.add(divaImageGraphics.makeFigure( new Line2D.Double(tempObject.getPosition().x + 5, tempObject.getPosition().y - 5, tempObject.getPosition().x + 5, - tempObject.getPosition().y + 5), c, c, lWidth)); + tempObject.getPosition().y + 5), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects2.get(i)); listCanvasObjects3.add(divaImageGraphics.makeFigure( new Line2D.Double(tempObject.getPosition().x + 5, tempObject.getPosition().y + 5, tempObject.getPosition().x - 5, - tempObject.getPosition().y + 5), c, c, lWidth)); + tempObject.getPosition().y + 5), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects3.get(i)); listCanvasObjects4.add(divaImageGraphics.makeFigure( new Line2D.Double(tempObject.getPosition().x - 5, tempObject.getPosition().y + 5, tempObject.getPosition().x - 5, - tempObject.getPosition().y - 5), c, c, lWidth)); + tempObject.getPosition().y - 5), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects4.get(i)); } @@ -2538,25 +2544,25 @@ public class OSPE_VisuPanel extends JPanel implements Observer, */ private void drawCrossOnObject(int i, SkyObject tempObject) { Point2D.Double pt = new Point2D.Double(); - Color c=tempObject.getColor(); + Color cl=tempObject.getColor(); pt = tempObject.getPosition(); // c = new Color(255, 0, 0); listCanvasObjects1.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x, pt.y - 10, - pt.x, pt.y + 10), c, c, lWidth)); + pt.x, pt.y + 10), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects1.get(i)); listCanvasObjects2.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x - 10, pt.y, - pt.x + 10, pt.y), c, c, lWidth)); + pt.x + 10, pt.y), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects2.get(i)); listCanvasObjects3.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x, pt.y - 10, - pt.x, pt.y + 10), c, c, lWidth)); + pt.x, pt.y + 10), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects3.get(i)); listCanvasObjects4.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x - 10, pt.y, - pt.x + 10, pt.y), c, c, lWidth)); + pt.x + 10, pt.y), cl, cl, lWidth)); divaImageGraphics.add(listCanvasObjects4.get(i)); } @@ -2629,7 +2635,7 @@ public class OSPE_VisuPanel extends JPanel implements Observer, * Add an object on image * * @param type : type of the object (if it came from catalog, local cat or manually) - * @param fromLib : Libelle of where it comes from (catalog name ...) + * @param props : Libelle of where it comes from (catalog name, ...) or properties when it come from local catalog * @param c : coordinates of the object in image coordinates.
* For the objects from catalog or from local import, * the position is converted from world to image. @@ -2640,7 +2646,7 @@ public class OSPE_VisuPanel extends JPanel implements Observer, */ // public void addObject(int id, int type,String fromLib, Point2D.Double c, int priority) { - public void addObject(String id, int type,String fromLib, Point2D.Double c, int priority) { + public void addObject(String id, int type,String props, Point2D.Double c, int priority) { this.icc = new ImageCoordinateConverter(getNavigatorImageDisplay()); WorldCoords wcoord; @@ -2677,7 +2683,7 @@ public class OSPE_VisuPanel extends JPanel implements Observer, Image im=fov.getCurrentImage(); //System.out.print ("Visu Addobj "+ im.getNbrObjects() ); - fov.getCurrentImage().addObject(id,false, type, fromLib, c, wcoord, priority); + fov.getCurrentImage().addObject(id,false, type, props, c, wcoord, priority); fov.getCurrentImage().getLastObject().setObjWorldCenter(wcoord); fov.getTheBrain().computeBary(fov.getCurrentImage().getListObjects()); -- libgit2 0.21.2