Index: branches/eam_branches/20090715/psphot/src/psphotVisual.c
===================================================================
--- branches/eam_branches/20090715/psphot/src/psphotVisual.c	(revision 25355)
+++ branches/eam_branches/20090715/psphot/src/psphotVisual.c	(revision 25356)
@@ -235,5 +235,5 @@
     // note: this uses the Ohana allocation tools:
     // ALLOCATE (overlay, KiiOverlay, 3*peaks->n + 1);
-    ALLOCATE (overlay, KiiOverlay, peaks->n);
+    ALLOCATE (overlay, KiiOverlay, peaks->n + 2);
 
     Noverlay = 0;
@@ -273,10 +273,10 @@
     }
 
-# if (0)
+# if (1)
     overlay[Noverlay].type = KII_OVERLAY_BOX;
     overlay[Noverlay].x = 10.0;
     overlay[Noverlay].y = 10.0;
-    overlay[Noverlay].dx = 0.5;
-    overlay[Noverlay].dy = 0.5;
+    overlay[Noverlay].dx = 1.0;
+    overlay[Noverlay].dy = 1.0;
     overlay[Noverlay].angle = 0.0;
     overlay[Noverlay].text = NULL;
@@ -327,4 +327,5 @@
 
         // draw the top
+	// XXX need to allow top (and bottom) to have more than one span
         span = footprint->spans->data[0];
         overlay[Noverlay].type = KII_OVERLAY_LINE;
@@ -426,4 +427,7 @@
     }
 
+    // XXX mark the different source classes with different color/shape dots
+    // XXX are moments S/N and peak S/N consistent?
+
     // note: this uses the Ohana allocation tools:
     ALLOCATE (overlay, KiiOverlay, sources->n);
@@ -451,6 +455,5 @@
         overlay[Noverlay].dy = 2.0*axes.minor;
 
-        overlay[Noverlay].angle = -axes.theta * PS_DEG_RAD;  // XXXXXXXX the axes angle is negative to display of object on kapa
-	// XXX fixed??
+        overlay[Noverlay].angle = axes.theta * PS_DEG_RAD;
 
         overlay[Noverlay].text = NULL;
@@ -496,6 +499,6 @@
 
     // select the max psfX,Y values for the plot limits
-    float Xmin = 0.0, Xmax = 0.0;
-    float Ymin = 0.0, Ymax = 0.0;
+    float Xmin = 1000.0, Xmax = 0.0;
+    float Ymin = 1000.0, Ymax = 0.0;
     {
         int nRegions = psMetadataLookupS32 (&status, recipe, "PSF.CLUMP.NREGIONS");
@@ -516,7 +519,7 @@
 	    float Y1 = psfY + 4.0*psfdY;
 
-	    if (isfinite(X0)) { Xmin = PS_MAX(Xmin, X0); }
+	    if (isfinite(X0)) { Xmin = PS_MIN(Xmin, X0); }
 	    if (isfinite(X1)) { Xmax = PS_MAX(Xmax, X1); }
-	    if (isfinite(Y0)) { Ymin = PS_MAX(Ymin, Y0); }
+	    if (isfinite(Y0)) { Ymin = PS_MIN(Ymin, Y0); }
 	    if (isfinite(Y1)) { Ymax = PS_MAX(Ymax, Y1); }
         }
@@ -807,5 +810,5 @@
         overlay[Noverlay].dx = 2.0*axes.major;
         overlay[Noverlay].dy = 2.0*axes.minor;
-        overlay[Noverlay].angle = -axes.theta * PS_DEG_RAD;
+        overlay[Noverlay].angle = axes.theta * PS_DEG_RAD;
         overlay[Noverlay].text = NULL;
         Noverlay ++;
@@ -1245,12 +1248,12 @@
         for (int ix = 0; ix < source->pixels->numCols; ix++) {
             if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix]) {
-                // rb->data.F32[nb] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
-                rb->data.F32[nb] = hypot (ix - Xo, iy - Yo) ;
+                rb->data.F32[nb] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
+                // rb->data.F32[nb] = hypot (ix - Xo, iy - Yo) ;
                 Rb->data.F32[nb] = log10(rb->data.F32[nb]);
                 fb->data.F32[nb] = log10(source->pixels->data.F32[iy][ix]);
                 nb++;
             } else {
-                // rg->data.F32[ng] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
-                rg->data.F32[ng] = hypot (ix - Xo, iy - Yo) ;
+                rg->data.F32[ng] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
+                // rg->data.F32[ng] = hypot (ix - Xo, iy - Yo) ;
                 Rg->data.F32[ng] = log10(rg->data.F32[ng]);
                 fg->data.F32[ng] = log10(source->pixels->data.F32[iy][ix]);
