Commit e50d63dd4f5e081d9a115158b18a4b9ca4974137
1 parent
7dd4dc3d
Exists in
master
Image : Change name to "prop".
SkyObject : add variations about color with priority Reader / Writer/ Mask : modifications about UUID Only generated when writing file mask. Visu : displaying objects with priorities colors.
Showing
6 changed files
with
113 additions
and
55 deletions
Show diff stats
src/osp/Image.java
... | ... | @@ -698,21 +698,21 @@ System.out.println("Im 247 cat : "+cat); |
698 | 698 | * Used to create a new object when using a manual selection-clic on image |
699 | 699 | * Or when loaded by local catalog or from a server. |
700 | 700 | * @param isRef : true if the object is a reference. |
701 | - * @param from : Where the object has been obtained. "Cat : catalog, Loc : Local catalog, Sel: Manual selection" | |
702 | - * @param fromLib : Libelle of where the object comes from | |
701 | + * @param f : load catalog number. | |
702 | + * @param props : <String> List of properties when local cat, or catalog name when download from server. | |
703 | 703 | * @param pos : Position of the object. |
704 | 704 | * @param wcObject : Object world coordinates in J2000 |
705 | 705 | * @param priority : Object priority |
706 | 706 | */ |
707 | 707 | // public void addObject(int id, boolean isRef, int f, String from, Point2D.Double pos, WorldCoords wcObject, int prior) { |
708 | - public void addObject(String id, boolean isRef, int f, String from, Point2D.Double pos, WorldCoords wcObject, int prior) { | |
708 | + public void addObject(String id, boolean isRef, int f, String props, Point2D.Double pos, WorldCoords wcObject, int prior) { | |
709 | 709 | |
710 | 710 | //System.out.println(" Image addObj 2 "+id); |
711 | 711 | |
712 | 712 | // if (id==-1) id=listObjects.size(); |
713 | 713 | |
714 | 714 | if (id=="-1") id=String.valueOf(listObjects.size()); |
715 | - listObjects.add(new SkyObject(id, listObjects.size(), isRef, f, from, pos, wcObject,prior)); | |
715 | + listObjects.add(new SkyObject(id, listObjects.size(), isRef, f, props, pos, wcObject,prior)); | |
716 | 716 | } |
717 | 717 | |
718 | 718 | /** | ... | ... |
src/osp/Mask.java
... | ... | @@ -197,7 +197,7 @@ public class Mask extends Observable implements MaskInterface, Observer { |
197 | 197 | leftCornerDeg = new Point2D.Double(); |
198 | 198 | validated = false; |
199 | 199 | setOrientation(0.0); |
200 | - setM_uuid(); | |
200 | + // setM_uuid(); | |
201 | 201 | history = new MaskHistory(this); |
202 | 202 | } |
203 | 203 | /** | ... | ... |
src/osp/Reader.java
... | ... | @@ -200,11 +200,11 @@ public class Reader { |
200 | 200 | |
201 | 201 | try { |
202 | 202 | |
203 | - if (maskElement.getChild("maskUUID")!= null) | |
204 | - { | |
205 | - m_uuid=maskElement.getChild("maskUUID").getText();; | |
206 | - } | |
207 | - else m_uuid="N/A"; | |
203 | +// if (maskElement.getChild("maskUUID")!= null) | |
204 | +// { | |
205 | +// m_uuid=maskElement.getChild("maskUUID").getText();; | |
206 | +// } | |
207 | +// else m_uuid="N/A"; | |
208 | 208 | //System.out.println("Reader loadMask UUID = "+m_uuid); |
209 | 209 | |
210 | 210 | maskCenter.x = Double.parseDouble(maskElement.getChild("center").getChild("x").getValue()); |
... | ... | @@ -248,8 +248,8 @@ public class Reader { |
248 | 248 | currentMask.addObserver(pater.getVisuPanel()); |
249 | 249 | currentMask.addObserver(pater.getSelectPanel()); |
250 | 250 | currentMask.addObserver(pater.getOspeControl()); |
251 | - if (m_uuid.equals("N/A")) currentMask.setM_uuid(); | |
252 | - else currentMask.set_uuid_fromF(m_uuid); | |
251 | +// if (m_uuid.equals("N/A")) currentMask.setM_uuid(); | |
252 | +// else currentMask.set_uuid_fromF(m_uuid); | |
253 | 253 | } |
254 | 254 | } |
255 | 255 | return noError; |
... | ... | @@ -853,8 +853,8 @@ public class Reader { |
853 | 853 | currentImage.addMask(maskCenterConv); |
854 | 854 | |
855 | 855 | Mask currentMask = currentImage.getCurrentMask(); |
856 | - if (m_uuid.equals("N/A")) currentMask.setM_uuid(); | |
857 | - else currentMask.set_uuid_fromF(m_uuid); | |
856 | +// if (m_uuid.equals("N/A")) currentMask.setM_uuid(); | |
857 | +// else currentMask.set_uuid_fromF(m_uuid); | |
858 | 858 | |
859 | 859 | currentMask.setCenterWc(maskAlpha, maskDelta); |
860 | 860 | currentMask.setOmega(maskAngle); | ... | ... |
src/osp/SkyObject.java
... | ... | @@ -56,20 +56,27 @@ public class SkyObject |
56 | 56 | * @param iR true if the object is a reference object, false otherwise |
57 | 57 | * @param p Center of the object (in image coordinates) |
58 | 58 | * @param pRecalc Center of the object once recalculated (in image coordinates) |
59 | + * @param c Color following priority. | |
59 | 60 | */ |
60 | - public SkyObject(int n, boolean iR, Point2D.Double p, Point2D.Double pRecalc) | |
61 | + public SkyObject(int n, boolean iR, Point2D.Double p, Point2D.Double pRecalc, Color c) | |
61 | 62 | { |
62 | 63 | // System.out.print("SkyObj 1 "+n+" "); |
63 | 64 | numIm = n; |
64 | - isRef = iR; | |
65 | + isRef = iR; | |
66 | + | |
65 | 67 | posPix = new Point2D.Double(); |
66 | 68 | setPosPix(p); |
67 | - setPosPixRecalc(pRecalc); | |
68 | - Color c=Color.BLUE; | |
69 | - if (pRecalc!= null) | |
70 | - c=Color.green; | |
69 | + | |
70 | +// if (pRecalc!= null) | |
71 | +// { | |
72 | +// System.out.println("SkyObj - pRecal "+pRecalc.getX()+" "+pRecalc.getY()); | |
73 | +// setPosPixRecalc(pRecalc); | |
74 | +// c=Color.green; | |
75 | +// } | |
76 | + | |
71 | 77 | if (isRef )c=Color.red; |
72 | - setColor(c); | |
78 | + // System.out.println("SkyObj -"+n+" const temp color "+c.toString()); | |
79 | + this.setColor(c); | |
73 | 80 | // WorldCoords coords = new WorldCoords(wc.getRA(),wc.getDec()); |
74 | 81 | // setObjWorldCenter(coords); |
75 | 82 | // setObjWorldRecalc(coords); |
... | ... | @@ -83,15 +90,15 @@ public class SkyObject |
83 | 90 | * @param id Object id from a project or a catalog |
84 | 91 | * @param n Object number in project |
85 | 92 | * @param iR true if the object is a reference object, false otherwise |
86 | - * @param f nbCat : number of catalogs loaded | |
87 | - * @param fr from Origin catalog. | |
93 | + * @param fi nbCat : number of catalogs loaded | |
94 | + * @param props Object Properties/catalog name/ ... | |
88 | 95 | * @param p Center of the object (in canvas coordinates) |
89 | 96 | * @param wc Object world coordinates in J2000 |
90 | 97 | * @param prior Object priority |
91 | 98 | */ |
92 | 99 | |
93 | 100 | // public SkyObject(int idO, int n, boolean iR, int fi, String fr, Point2D.Double p, WorldCoords wc, int prior) |
94 | - public SkyObject(String idO, int n, boolean iR, int fi, String fr, Point2D.Double p, WorldCoords wc, int prior) | |
101 | + public SkyObject(String idO, int n, boolean iR, int fi, String props, Point2D.Double p, WorldCoords wc, int prior) | |
95 | 102 | |
96 | 103 | { |
97 | 104 | //System.out.println(" SkyObj 2 num "+n+" id "+idO); |
... | ... | @@ -99,7 +106,7 @@ public class SkyObject |
99 | 106 | numIm=n; |
100 | 107 | isRef = iR; |
101 | 108 | group=fi; |
102 | - prop=fr; | |
109 | + prop=props; | |
103 | 110 | posPix = new Point2D.Double(); |
104 | 111 | setPosPix(p); |
105 | 112 | posPixRecalc = null; |
... | ... | @@ -107,8 +114,24 @@ public class SkyObject |
107 | 114 | objWorldRecalc=new WorldCoords(0,0); |
108 | 115 | priority = prior; |
109 | 116 | Color c=Color.blue; |
110 | - if (isRef )c=Color.red; | |
117 | + switch (prior) | |
118 | + { | |
119 | + case 1: | |
120 | + c=Color.RED; | |
121 | + break; | |
122 | + case 2: | |
123 | + c=Color.WHITE; | |
124 | + break; | |
125 | + default: | |
126 | + c=Color.BLUE; | |
127 | + break; | |
128 | + } | |
129 | + | |
130 | + if (isRef )c=Color.RED; | |
131 | + | |
111 | 132 | setColor(c); |
133 | + | |
134 | + // System.out.println("SkyObj - "+n+ " const Norm color "+c.toString()); | |
112 | 135 | } |
113 | 136 | |
114 | 137 | |
... | ... | @@ -249,9 +272,14 @@ public class SkyObject |
249 | 272 | */ |
250 | 273 | public boolean isCenterRecalc () |
251 | 274 | { |
252 | - Color c = new Color(0, 255, 0); | |
253 | - this.setColor(c); | |
254 | - return posPixRecalc != null; | |
275 | + boolean err=false; | |
276 | + if (posPixRecalc != null) | |
277 | + { | |
278 | + Color c = new Color(0, 255, 0); | |
279 | + this.setColor(c); | |
280 | + err=true; | |
281 | + } | |
282 | + return err; | |
255 | 283 | |
256 | 284 | } |
257 | 285 | |
... | ... | @@ -284,6 +312,26 @@ public Color getColor() { |
284 | 312 | * Set the color the object will be drawn with |
285 | 313 | * @param col : color |
286 | 314 | */ |
315 | +public void setColorWithPriority(int p) { | |
316 | +Color c; | |
317 | + switch (p) | |
318 | + { | |
319 | + case 1: | |
320 | + c=Color.RED; | |
321 | + break; | |
322 | + case 2: | |
323 | + c=Color.WHITE; | |
324 | + break; | |
325 | + default: | |
326 | + c=Color.BLUE; | |
327 | + break; | |
328 | + } | |
329 | + this.col=c; | |
330 | +} | |
331 | +/** | |
332 | + * Set the color the object will be drawn with | |
333 | + * @param col : color | |
334 | + */ | |
287 | 335 | public void setColor(Color col) { |
288 | 336 | this.col = col; |
289 | 337 | } | ... | ... |
src/osp/Writer.java
... | ... | @@ -274,6 +274,10 @@ public class Writer { |
274 | 274 | Attribute selectedSlit = new Attribute("selectedSlit", String.valueOf(m.getSelectedSlit())); |
275 | 275 | e_mask.setAttribute(selectedSlit); |
276 | 276 | |
277 | + | |
278 | + String mUUID=m.getS_uuid(); | |
279 | + if (mUUID.isEmpty()) m.setM_uuid(); | |
280 | + | |
277 | 281 | Element e_maskUUID = new Element("maskUUID"); |
278 | 282 | e_maskUUID.setText(m.getS_uuid()); |
279 | 283 | e_mask.addContent(e_maskUUID); |
... | ... | @@ -347,9 +351,9 @@ public class Writer { |
347 | 351 | Attribute selectedSlit = new Attribute("selectedSlit", String.valueOf(m.getSelectedSlit())); |
348 | 352 | e_mask.setAttribute(selectedSlit); |
349 | 353 | |
350 | - Element e_maskUUID = new Element("maskUUID"); | |
351 | - e_maskUUID.setText(m.getS_uuid()); | |
352 | - e_mask.addContent(e_maskUUID); | |
354 | +// Element e_maskUUID = new Element("maskUUID"); | |
355 | +// e_maskUUID.setText(m.getS_uuid()); | |
356 | +// e_mask.addContent(e_maskUUID); | |
353 | 357 | |
354 | 358 | // Mask properties in the image selected |
355 | 359 | /** Mask coordinates RA - DEC */ | ... | ... |
src/osp/ui/OSPE_VisuPanel.java
... | ... | @@ -901,8 +901,9 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
901 | 901 | { |
902 | 902 | SkyObject sk = fov.getCurrentImage().getListObjects().get(numObj); |
903 | 903 | sk.setPosPixRecalc(null); |
904 | - String src=sk.getSrc().replace(" (R)", ""); | |
905 | - sk.setSrc(src); | |
904 | + sk.setColorWithPriority(sk.getPriority()); | |
905 | +// String src=sk.getSrc().replace(" (R)", ""); | |
906 | +// sk.setSrc(src); | |
906 | 907 | updateByHand(); |
907 | 908 | //updateByHand("V revert cent"); |
908 | 909 | |
... | ... | @@ -2289,7 +2290,8 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2289 | 2290 | pos = positonCalcul(sk.getPosition()); |
2290 | 2291 | |
2291 | 2292 | sk.setPosPixRecalc(pos); |
2292 | - | |
2293 | + sk.setColor(Color.GREEN); | |
2294 | + | |
2293 | 2295 | icc.imageToCanvasCoords(pos, false); |
2294 | 2296 | |
2295 | 2297 | sk.setObjWorldRecalc(getWorldCoords(pos.getX(), pos.getY())); |
... | ... | @@ -2297,12 +2299,14 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2297 | 2299 | /** |
2298 | 2300 | * Information that the object center has been recalculated |
2299 | 2301 | */ |
2300 | - if (!sk.getSrc().endsWith("(R)")) | |
2301 | - { | |
2302 | - String src=sk.getSrc(); | |
2303 | - sk.setSrc(src + " (R)"); | |
2304 | - } | |
2305 | - | |
2302 | +// String src=""; | |
2303 | +// if (!sk.getSrc().isEmpty()) src=sk.getSrc(); | |
2304 | +// | |
2305 | +// if (!sk.getSrc().endsWith("(R)")) | |
2306 | +// { | |
2307 | +// sk.setSrc(src + " (R)"); | |
2308 | +// } | |
2309 | +// | |
2306 | 2310 | /** |
2307 | 2311 | * Update object position in the image associated List, when affected to a slit. |
2308 | 2312 | */ |
... | ... | @@ -2475,7 +2479,8 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2475 | 2479 | SkyObject sk = fov.getCurrentImage().getListObjects().get(i); |
2476 | 2480 | //System.out.print(("visu Plot Obj"+sk.getNum()+" -")); |
2477 | 2481 | |
2478 | - SkyObject tempObject = new SkyObject(-1, sk.isRef(), sk.getPosPix(), sk.getPosPixRecalc()); | |
2482 | + SkyObject tempObject = new SkyObject(-1, sk.isRef(), sk.getPosPix(), sk.getPosPixRecalc(),sk.getColor()); | |
2483 | + | |
2479 | 2484 | |
2480 | 2485 | //SkyObject tempObject = new SkyObject(-1, sk.isRef(), sk.getSrc(), sk.getCatLibFrom(), sk.getPosPix(), |
2481 | 2486 | // sk.getObjWorldCenter(), sk.getPosPixRecalc(), sk.getPriority()); |
... | ... | @@ -2503,30 +2508,31 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2503 | 2508 | */ |
2504 | 2509 | private void drawSquareAroundObject(int i, SkyObject tempObject) { |
2505 | 2510 | |
2506 | - Color c=tempObject.getColor(); | |
2511 | + Color cl=tempObject.getColor(); | |
2512 | +//System.out.println("Visu DrawSqObj - "+i+" color "+cl.toString()); | |
2507 | 2513 | |
2508 | 2514 | listCanvasObjects1.add(divaImageGraphics.makeFigure( |
2509 | 2515 | new Line2D.Double(tempObject.getPosition().x - 5, |
2510 | 2516 | tempObject.getPosition().y - 5, tempObject.getPosition().x + 5, |
2511 | - tempObject.getPosition().y - 5), c, c, lWidth)); | |
2517 | + tempObject.getPosition().y - 5), cl, cl, lWidth)); | |
2512 | 2518 | divaImageGraphics.add(listCanvasObjects1.get(i)); |
2513 | 2519 | |
2514 | 2520 | listCanvasObjects2.add(divaImageGraphics.makeFigure( |
2515 | 2521 | new Line2D.Double(tempObject.getPosition().x + 5, |
2516 | 2522 | tempObject.getPosition().y - 5, tempObject.getPosition().x + 5, |
2517 | - tempObject.getPosition().y + 5), c, c, lWidth)); | |
2523 | + tempObject.getPosition().y + 5), cl, cl, lWidth)); | |
2518 | 2524 | divaImageGraphics.add(listCanvasObjects2.get(i)); |
2519 | 2525 | |
2520 | 2526 | listCanvasObjects3.add(divaImageGraphics.makeFigure( |
2521 | 2527 | new Line2D.Double(tempObject.getPosition().x + 5, |
2522 | 2528 | tempObject.getPosition().y + 5, tempObject.getPosition().x - 5, |
2523 | - tempObject.getPosition().y + 5), c, c, lWidth)); | |
2529 | + tempObject.getPosition().y + 5), cl, cl, lWidth)); | |
2524 | 2530 | divaImageGraphics.add(listCanvasObjects3.get(i)); |
2525 | 2531 | |
2526 | 2532 | listCanvasObjects4.add(divaImageGraphics.makeFigure( |
2527 | 2533 | new Line2D.Double(tempObject.getPosition().x - 5, |
2528 | 2534 | tempObject.getPosition().y + 5, tempObject.getPosition().x - 5, |
2529 | - tempObject.getPosition().y - 5), c, c, lWidth)); | |
2535 | + tempObject.getPosition().y - 5), cl, cl, lWidth)); | |
2530 | 2536 | divaImageGraphics.add(listCanvasObjects4.get(i)); |
2531 | 2537 | } |
2532 | 2538 | |
... | ... | @@ -2538,25 +2544,25 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2538 | 2544 | */ |
2539 | 2545 | private void drawCrossOnObject(int i, SkyObject tempObject) { |
2540 | 2546 | Point2D.Double pt = new Point2D.Double(); |
2541 | - Color c=tempObject.getColor(); | |
2547 | + Color cl=tempObject.getColor(); | |
2542 | 2548 | pt = tempObject.getPosition(); |
2543 | 2549 | |
2544 | 2550 | // c = new Color(255, 0, 0); |
2545 | 2551 | |
2546 | 2552 | listCanvasObjects1.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x, pt.y - 10, |
2547 | - pt.x, pt.y + 10), c, c, lWidth)); | |
2553 | + pt.x, pt.y + 10), cl, cl, lWidth)); | |
2548 | 2554 | divaImageGraphics.add(listCanvasObjects1.get(i)); |
2549 | 2555 | |
2550 | 2556 | listCanvasObjects2.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x - 10, pt.y, |
2551 | - pt.x + 10, pt.y), c, c, lWidth)); | |
2557 | + pt.x + 10, pt.y), cl, cl, lWidth)); | |
2552 | 2558 | divaImageGraphics.add(listCanvasObjects2.get(i)); |
2553 | 2559 | |
2554 | 2560 | listCanvasObjects3.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x, pt.y - 10, |
2555 | - pt.x, pt.y + 10), c, c, lWidth)); | |
2561 | + pt.x, pt.y + 10), cl, cl, lWidth)); | |
2556 | 2562 | divaImageGraphics.add(listCanvasObjects3.get(i)); |
2557 | 2563 | |
2558 | 2564 | listCanvasObjects4.add(divaImageGraphics.makeFigure(new Line2D.Double(pt.x - 10, pt.y, |
2559 | - pt.x + 10, pt.y), c, c, lWidth)); | |
2565 | + pt.x + 10, pt.y), cl, cl, lWidth)); | |
2560 | 2566 | divaImageGraphics.add(listCanvasObjects4.get(i)); |
2561 | 2567 | |
2562 | 2568 | } |
... | ... | @@ -2629,7 +2635,7 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2629 | 2635 | * Add an object on image |
2630 | 2636 | * |
2631 | 2637 | * @param type : type of the object (if it came from catalog, local cat or manually) |
2632 | - * @param fromLib : Libelle of where it comes from (catalog name ...) | |
2638 | + * @param props : Libelle of where it comes from (catalog name, ...) or properties when it come from local catalog | |
2633 | 2639 | * @param c : coordinates of the object in image coordinates.<br> |
2634 | 2640 | * For the objects from catalog or from local import, |
2635 | 2641 | * the position is converted from world to image. |
... | ... | @@ -2640,7 +2646,7 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2640 | 2646 | */ |
2641 | 2647 | |
2642 | 2648 | // public void addObject(int id, int type,String fromLib, Point2D.Double c, int priority) { |
2643 | - public void addObject(String id, int type,String fromLib, Point2D.Double c, int priority) { | |
2649 | + public void addObject(String id, int type,String props, Point2D.Double c, int priority) { | |
2644 | 2650 | |
2645 | 2651 | this.icc = new ImageCoordinateConverter(getNavigatorImageDisplay()); |
2646 | 2652 | WorldCoords wcoord; |
... | ... | @@ -2677,7 +2683,7 @@ public class OSPE_VisuPanel extends JPanel implements Observer, |
2677 | 2683 | Image im=fov.getCurrentImage(); |
2678 | 2684 | |
2679 | 2685 | //System.out.print ("Visu Addobj "+ im.getNbrObjects() ); |
2680 | - fov.getCurrentImage().addObject(id,false, type, fromLib, c, wcoord, priority); | |
2686 | + fov.getCurrentImage().addObject(id,false, type, props, c, wcoord, priority); | |
2681 | 2687 | fov.getCurrentImage().getLastObject().setObjWorldCenter(wcoord); |
2682 | 2688 | |
2683 | 2689 | fov.getTheBrain().computeBary(fov.getCurrentImage().getListObjects()); | ... | ... |