Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

draw text

Hi, All
 
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.
 
RealType shape = new RealType("shape");
ScalarMap shape_map = new ScalarMap(shape, Display.Shape);
display.addMap(shape_map);
 
RealTupleType coord_type = new RealTupleType(longitude,latitude,elevation,shape);
 
 double[] start = {0.0, 0.0, 0.0};
 double[] base = {0.3, 0.0, 0.0}; 
 double[] up = {0.0, 0.3, 0.0};
 boolean center = false;
   
 PlotText pt = new PlotText();
 
 VisADLineArray shape1  = pt.render_label("My text is here", start, base, up, center);
//shape2
//shape3
 VisADGeometryArray[] shapes = new VisADGeometryArray[] {shape1,shape2,shape3};
  ShapeControl shape_control = (ShapeControl) shape_map.getControl();
  shape_control.setScale(0.2f);
  shape_control.setShapeSet(new Integer1DSet(3));
  shape_control.setShapes(shapes);
 
I also used the following code to specify the location for the text and add the shapes to display:
 
RealTuple coord_tuple = new RealTuple(coord_type, new double[] {samp2[0][0],samp2[1][0],fResult2[0],0});
DataReferenceImpl ref_coord_tuple = new DataReferenceImpl("ref_coord_tuple");
ref_coord_tuple.setData(coord_tuple);
display.addReference(ref_coord_tuple,streetColor);
 
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 parallel to x-axis and I can read it as output from any System.out.println.
 
Now, I want to display the text with any specific angles to x, y and z axis. for example, I want to display 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.
 
Thanks a lot.
 
Gaoming Fu 


Get your FREE download of MSN Explorer at http://explorer.msn.com
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690