/** * Init at the end * * @return Success * @throws RemoteException On badness * @throws VisADException On badness */ protected boolean initFinalInner() throws VisADException, RemoteException { if (!super.initFinalInner()) { return false; } maxDistanceBox = new LineDrawing("TransectGlyph_" + (typeCnt++)); maxDistanceBox.setLineWidth(getLineWidth()); maxDistanceBox.setColor(getColor()); addDisplayable(maxDistanceBox); if (showText) { startTextType = TextType.getTextType("TransectGlyphText_" + (typeCnt++)); startTextDisplayable = new TextDisplayable("start text_" + (typeCnt++), startTextType); startTextDisplayable.setTextSize(control.getDisplayScale() * 2.0f); endTextType = TextType.getTextType("TransectGlyphText_" + (typeCnt++)); endTextDisplayable = new TextDisplayable("end text_" + (typeCnt++), endTextType); endTextDisplayable.setTextSize(control.getDisplayScale() * 2.0f); addDisplayable(startTextDisplayable); addDisplayable(endTextDisplayable); } return true; }
/** * Set the text on the given displayable * * @param displayable The displayable * @param index Which one, 0 or 1 * @param lbl The text * @param textType The text type * @throws RemoteException On badness * @throws VisADException On badness */ private void setText(TextDisplayable displayable, int index, String lbl, TextType textType) throws VisADException, RemoteException { Text t = new Text(textType, lbl); Data theData = null; float[][] lineVals = getPointValues(); if (lineVals.length == 3) { theData = new Tuple( new Data[] { new RealTuple( RealTupleType.LatitudeLongitudeAltitude, new double[] {lineVals[0][index], lineVals[1][index], lineVals[2][index]}), t }); displayable.setData(theData); } else { /* theData = new Tuple(new Data[] { new RealTuple(RealTupleType.LatitudeLongitude, new double[] { lineVals[0][index], lineVals[1][index] }), t });*/ } }