Skip to content

Commit

Permalink
caom2-vis: fix for caom2-compute internal API change
Browse files Browse the repository at this point in the history
  • Loading branch information
pdowler committed May 2, 2024
1 parent 68db916 commit 9e92fe7
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions caom2-viz/src/main/java/ca/nrc/cadc/caom2/viz/VizUnion.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@
import ca.nrc.cadc.caom2.Observation;
import ca.nrc.cadc.caom2.Part;
import ca.nrc.cadc.caom2.Plane;
import ca.nrc.cadc.caom2.Position;
import ca.nrc.cadc.caom2.ProductType;
import ca.nrc.cadc.caom2.compute.ComputeUtil;
import ca.nrc.cadc.caom2.compute.PolygonUtil;
import ca.nrc.cadc.caom2.compute.PositionUtil;
import ca.nrc.cadc.caom2.compute.Util;
Expand All @@ -85,6 +83,7 @@
import ca.nrc.cadc.caom2.types.Point;
import ca.nrc.cadc.caom2.types.Polygon;
import ca.nrc.cadc.caom2.types.SegmentType;
import ca.nrc.cadc.caom2.types.Shape;
import ca.nrc.cadc.caom2.types.Vertex;
import ca.nrc.cadc.caom2.xml.ObservationReader;
import java.awt.BorderLayout;
Expand Down Expand Up @@ -140,7 +139,7 @@ public void doit()

private void doit(Plane plane)
throws Exception {
Polygon bounds = null;
Shape bounds = null;
ProductType ptype = Util.choseProductType(plane.getArtifacts());
if (plane.position != null && plane.position.bounds != null && !forceRecompute) {
// use polygon from input file
Expand All @@ -163,15 +162,21 @@ private void doit(Plane plane)
log.info("area: " + bounds.getArea());
}

DisplayPane dp = new DisplayPane();
if (bounds instanceof Polygon) {
Polygon poly = (Polygon) bounds;
DisplayPane dp = new DisplayPane();

dp.setPlane(plane, poly);
JFrame f = new JFrame("CAOM-2.0 VizTest : " + plane.getProductID());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(dp);
f.pack();
f.setLocation(1000, 200);
f.setVisible(true);
} else {
log.warn("cannot display: " + bounds.getClass().getName());
}

dp.setPlane(plane, bounds);
JFrame f = new JFrame("CAOM-2.0 VizTest : " + plane.getProductID());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(dp);
f.pack();
f.setLocation(1000, 200);
f.setVisible(true);
}

static class DisplayPane extends JPanel {
Expand Down

0 comments on commit 9e92fe7

Please sign in to comment.