This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> Sir, > > > I have found an issue in data transect control. > > I try to load datasource from > Server: adde.ucar.edu server > DataSet: RTIMAGES > IMAGETYPE: Mollweide Composite IR > I have a suggestion of data transect of this kind of data. First, File > New > View Window > Misc > Transect and Map. Second, select the map view, and load the same data and create the image display. Third, select the transect window, and create the Data Transect display. I try it locally, and works. Thanks for the coding suggestion. Yuan > and created display of Data Transect control and I face an Error. > > The associated snapshots have been attached (zipped up). > > I have tried to fix that bug in > ucar.unidata.idv.control.CrossSectionControl by modifying the initDone() > method: > > /** > * Called after all initialization is finished. This sets the end > points > * of the csSelector to the correct position and adds this as a > property > * change listener to the csSelector. > */ > > public void initDone() { > super.initDone(); > try { > RealTuple start = initStartPoint; > RealTuple end = initEndPoint; > > if(start == null && initLat1==initLat1 && initLon1 > ==initLon1) { > start = > new RealTuple(RealTupleType.SpatialEarth3DTuple, > new double[] { initLon1,initLat1, > initAlt }); > } > > if(end == null && initLat2==initLat2 && initLon2 ==initLon2) { > end = > new RealTuple(RealTupleType.SpatialEarth3DTuple, > new double[] { initLon2,initLat2, > initAlt }); > } > > if (csSelector != null) { > if (inGlobeDisplay()) { > csSelector.setInterpolateLinePoints(true); > } > > //Do we have old end points from bundles? > if ((startCoord != null) && (endCoord != null)) { > EarthLocation startLoc = boxToEarth(new double[] { > startCoord.getX(), > startCoord.getY(), startCoord.getZ() }); > EarthLocation endLoc = boxToEarth(new double[] { > endCoord.getX(), > endCoord.getY(), endCoord.getZ() }); > setPosition(startLoc, endLoc); > } else if (start == null) { > MapProjection mp = getDataProjection(); > Rectangle2D rect = mp.getDefaultMapArea(); > LatLonPoint startLLP = mp.getLatLon(new double[][] { > { rect.getX() }, { rect.getCenterY() } > }); > LatLonPoint endLLP = mp.getLatLon(new double[][] { > { rect.getX() + rect.getWidth() }, > { rect.getCenterY() } > }); > > if (startLLP.getLatitude().isMissing() || > startLLP.getLongitude().isMissing() > || endLLP.getLatitude().isMissing() || > endLLP.getLongitude().isMissing()) { //Tried to check here whether end > points of Transect are missing or not > > > //It is assumed that at least 10% of the projected area is not missing. > startLLP = mp.getLatLon(new double[][]{ > //And reset the end > points of the Data Transect. > {rect.getCenterX() - > rect.getWidth() / 10}, {rect.getCenterY() - rect.getHeight() / 10} > }); > endLLP = mp.getLatLon(new double[][]{ > {rect.getCenterX() + > rect.getWidth() / 10}, {rect.getCenterY() + rect.getHeight() / 10} > }); > } > > > > > EarthLocation startLoc = > new EarthLocationTuple( > startLLP.getLatitude().getValue(), > startLLP.getLongitude().getValue(), 0); > EarthLocation endLoc = > new EarthLocationTuple( > endLLP.getLatitude().getValue(), > endLLP.getLongitude().getValue(), 0); > > setPosition(startLoc, endLoc); > } else { > csSelector.setPosition(start, end); > } > > csSelector.getStartSelectorPoint().setDragAdapter(this); > csSelector.getEndSelectorPoint().setDragAdapter(this); > } > > > //Now load the data > reScale(); > loadDataFromLine(); > updateViewParameters(); > } catch (Exception e) { > logException("Initializing the csSelector", e); > } > // when user moves position of the Selector line, call > crossSectionChanged > csSelector.addPropertyChangeListener(this); > updatePositionWidget(); > } > > I have also attached the modified CrossSectionControl.java. > Kindly let me know if you have some other logic of taking its care. > > > Ghansham > > > > > Ticket Details =================== Ticket ID: EIE-202591 Department: Support IDV Priority: Normal Status: Closed