World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 05-26-2008, 03:30 AM   #1
findsnow
Junior Member
 
Join Date: May 2008
Posts: 5
findsnow is on a distinguished road
Unhappy how can I draw contour in WW?

Big guys:
I'm a user from chinese.I know wwj recently and have lots of question.I wanna use wwj do some research.In my research I must draw a contour in wwj? but now I hardly how how to draw a line in WWJ. Any helps? Big guys, could u tell me how to make a self-defined layer and draw something such as line,text. thanx!
findsnow is offline   Reply With Quote
Old 05-26-2008, 10:25 PM   #2
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

Welcome to the WorldWind forum findsnow

Make sure to visit the World Wind Central wiki. There are a lot of links and documentation there, although it is not complete or very well organized, you will certainly find it a useful resource.

As for drawing contour lines, this is a somewhat wide subject, as there are different approaches with various degrees of precision and complexity.

Just to mention a few:

- using a 1d texture with alternated transparent pixels and opaque pixels along with appropriate texture coordinates for the surface geometry. This allows you to 'project' lines horizontaly on the terrain - from the side intead of from the top. It produces contour lines without any complex computation, but with a rather coarse precision. You would have to tweak or replace the SDK SurfaceTileRenderer.

- using predrawn contour lines and applying the corresponding texture over the terrain, like any other layer. This requires to compute the appropriate texture in all points of the terrain. You could try using a procedural layer.

- you can do the above with a GLSL fragment shader

- you can use GL lines instead of textures - see terrain following Polylines. This would probably be very slow with a lot of contour lines, but certainly nicer and more precise. You still have to compute where exactly the lines should be and produce somewhat closed polygones...

Did you manage to compile and run WWJ?

PS: please do not mention 'big guys'
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 05-27-2008, 03:31 AM   #3
findsnow
Junior Member
 
Join Date: May 2008
Posts: 5
findsnow is on a distinguished road
Default

Thanks lot for your advise.My english is poor ,so sorry!

I have compiled and run WWJ in a IDE(IntelliJ IDEA), and I have saw a example named LineBuilder. In this example I learned how to draw a line in WWJ, it is very useful!

Now,I use two methods to draw contour in WWJ,

--one is ur method(using a 1d texture with alternated transparent pixels and opaque pixels along with appropriate texture coordinates for the surface geometry).This method is so simply that I can draw contour quickly, but which come out another question, I can't hnow which level of contour I had draw, that's to say, I can't get the altitude of my contour.

--another is: I produce contour data before I draw it(I have some position's Lon,Lat and Alt data),but this method is so complex that use few minutes to draw contour.

I prefer to use ur method, is there any method in WWJ's class to get altitude from a Lon-Lat pair. do I must to set a HTTP connetion to "http://worldwind25.arc.nasa.gov/wwelevation/wwelevation.aspx?" with T,L,X and Y parameters?

Last edited by findsnow; 05-27-2008 at 03:34 AM.
findsnow is offline   Reply With Quote
Old 05-27-2008, 04:11 PM   #4
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

Quote:
Originally Posted by findsnow View Post
--one is ur method(using a 1d texture with alternated transparent pixels and opaque pixels along with appropriate texture coordinates for the surface geometry).This method is so simply that I can draw contour quickly, but which come out another question, I can't hnow which level of contour I had draw, that's to say, I can't get the altitude of my contour.
If you managed to do that, then you must have computed the texture coordinates in such a way that it reflects the altitude of each vertex. It is up to you to provide the 1D texture and the coordinates so that each 'line' will fall at some elevation interval. For instance, you can create a 1D texture with java 2D such that you have say 9 gray thin lines and the tenth is black and bolder. You can then have this texture wrap or repeat and compute the texture coordinate so that it will cover exactly say 1000 meters. I guess you need to experiment a bit...

Quote:
Originally Posted by findsnow View Post
...is there any method in WWJ's class to get altitude from a Lon-Lat pair. do I must to set a HTTP connetion to "http://worldwind25.arc.nasa.gov/wwelevation/wwelevation.aspx?" with T,L,X and Y parameters?
Use dc.getModel().getGlobe().getElevation(la t, lon)
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 06-05-2008, 10:57 PM   #5
jlih
Junior Member
 
Join Date: May 2008
Posts: 9
jlih is on a distinguished road
Default

try to use gpx writer and reader to write a file.. then draw it on the globe
this may be easier..
worldwind supports gpx format..
jlih is offline   Reply With Quote
Old 06-05-2008, 10:58 PM   #6
jlih
Junior Member
 
Join Date: May 2008
Posts: 9
jlih is on a distinguished road
Default

if you use texture make sure you have such image to show your contour and specify the coordinates for that image..
jlih is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Interactively Draw Line dinkinflicka Development Help 1 02-20-2008 10:43 PM
Pathline.cs draw Red line regards to any color that you pass into the method fsulistio Bug Reports 8 07-18-2007 10:26 AM
Contour lines judp Technical Support 4 06-14-2007 05:39 AM
how to draw line in WW's world kinsung Developers' Corner 12 03-12-2007 02:08 AM


All times are GMT +1. The time now is 10:17 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.