draw text

<html><div style='background-color:'><DIV>Hi, All</DIV>
<DIV>&nbsp;</DIV>
<DIV>Sorry for asking this question again. I followed instructions from Bill 
and Don, and I used the following code (partial list) to draw some texts.</DIV>
<DIV>&nbsp;</DIV>
<DIV>RealType shape = new RealType("shape");<BR>ScalarMap shape_map = new 
ScalarMap(shape, Display.Shape);<BR>display.addMap(shape_map);</DIV>
<DIV>&nbsp;</DIV>
<DIV>RealTupleType coord_type&nbsp;= new 
RealTupleType(longitude,latitude,elevation,shape);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;double[] start = {0.0, 0.0, 0.0};<BR>&nbsp;double[] base&nbsp;= 
{0.3, 0.0, 0.0};&nbsp;<BR>&nbsp;double[] up&nbsp;= {0.0, 0.3, 
0.0};<BR>&nbsp;boolean center&nbsp;= 
false;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;PlotText pt = new PlotText();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;VisADLineArray&nbsp;shape1&nbsp;&nbsp;= pt.render_label("My text is 
here", start, base, up, center);</DIV>
<DIV>//shape2</DIV>
<DIV>//shape3</DIV>
<DIV>&nbsp;VisADGeometryArray[] shapes = new VisADGeometryArray[] 
{shape1,shape2,shape3};</DIV>
<DIV>&nbsp;&nbsp;ShapeControl shape_control = (ShapeControl) 
shape_map.getControl();<BR>&nbsp;&nbsp;shape_control.setScale(0.2f);<BR>&nbsp;&nbsp;shape_control.setShapeSet(new
 Integer1DSet(3));<BR>&nbsp; shape_control.setShapes(shapes);</DIV>
<DIV>&nbsp;</DIV>
<DIV>I also used the following code to specify the location for the text and 
add the shapes to display:</DIV>
<DIV>&nbsp;</DIV>
<DIV>RealTuple coord_tuple&nbsp;= new RealTuple(coord_type, new double[] 
{samp2[0][0],samp2[1][0],fResult2[0],0});</DIV>
<DIV>DataReferenceImpl ref_coord_tuple = new 
DataReferenceImpl("ref_coord_tuple");<BR>ref_coord_tuple.setData(coord_tuple);<BR>display.addReference(ref_coord_tuple,streetColor);</DIV>
<DIV>&nbsp;</DIV>
<DIV>The code worked for me. The text is displayed at the given location (in 
this case, samp2[0][0],samp2[1][0],fResult2[0])as we can see from Test 45 and 
Test 69, i.e., the text is dsiplayed&nbsp;parallel to x-axis and&nbsp;I can 
read it as&nbsp;output from&nbsp;any System.out.println.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Now,&nbsp;I want to display the text with any specific angles&nbsp;to x, y 
and z axis. for example, I want to display&nbsp;text with 50 degrees to x-axis, 
100 degrees to y-axis, and 260 degrees to z-axis. I do not know how to set 
start, base and up in this case. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks a lot.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Gaoming Fu&nbsp;</DIV></div><br clear=all><hr>Get your FREE download of 
MSN Explorer at <a 
href='http://go.msn.com/bql/hmtag_itl_EN.asp'>http://explorer.msn.com</a><br></html>


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: