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 04-19-2010, 04:19 PM   #1
davicentef
Junior Member
 
Join Date: Apr 2010
Posts: 18
davicentef is on a distinguished road
Default KML Importer. Shapes shaking

Hi:

I´m developing using KML Importer.
I have seen some problem that I´d like to fix. I load a shape, like the example of the Pentagon, and it shows ok in the globe. But when I zoom in the shape, and I do some movement with the mouse, the shape shakes some second after the globe has stopped, like an earthquake.
Does it happends to anyone more? Do you know how to fix that or what is wrong??

Regards.
davicentef is offline   Reply With Quote
Old 04-19-2010, 09:24 PM   #2
remleduff
Senior Member
 
Join Date: Jun 2007
Posts: 218
remleduff is on a distinguished road
Default

I'm not sure what code you're referring to, but when I've had this problem it was a floating point precision issue.

The fix is to do your drawing near (0,0,0), because there is more precision available for smaller floating point values.

So, if you're drawing your model at (50000.00003, 50000.000002, 50000.000003), choose a "reference center" so that the model is near the origin (0,0,0). For this example, the reference center should obviously be (50000, 50000, 50000). The reference center doesn't need to be any particular value, just choose one that puts the majority of your model near the origin;

Code:
Vec4 referenceCenter = (50000, 50000, 50000);

// Then, subtract that from every point in your model

for (point : modelPoints) {
   newPoint.subtract3(referenceCenter);
}

try {
    // Move the origin to the reference center
    dc.getView().pushReferenceCenter(dc, referenceCenter);

    // Then draw your model (this should be with the transformed points):
    model.draw
}
finally {
   // Be sure to restore the original origin
   dc.getView().popReferenceCenter(dc);
}

Last edited by remleduff; 04-19-2010 at 09:31 PM.
remleduff is offline   Reply With Quote
Old 04-20-2010, 08:10 AM   #3
davicentef
Junior Member
 
Join Date: Apr 2010
Posts: 18
davicentef is on a distinguished road
Default

Thanks for the answer.
KML Importer is a project to use with WWJ, to load and show KML objects (http://code.google.com/intl/es-ES/ap...n/kml_tut.html).
I´m drawing with 0,0,0 like reference center. The problem happens with the examples of library too, so I suppose something is not completely right in there, but I don´t know what.
I don´t know if someone is using this library and has seen what I´m talking about.
davicentef is offline   Reply With Quote
Old 04-20-2010, 05:19 PM   #4
remleduff
Senior Member
 
Join Date: Jun 2007
Posts: 218
remleduff is on a distinguished road
Default

I'm familiar with KML, what KML importer project are you using, though?
remleduff is offline   Reply With Quote
Old 04-20-2010, 06:46 PM   #5
heidtmare
Senior Member
 
heidtmare's Avatar
 
Join Date: Feb 2008
Location: Melbourne, FL, USA
Posts: 675
heidtmare is on a distinguished road
Default

If you are refering to this:
http://code.google.com/p/wwj-kml/
Its a third party contribution and You'd probably be better off posting your issue on its issue tracker.

If you mean this:
http://worldwindcentral.com/wiki/Add-on:KMLImporter
That is a plugin for the old C# WorldWind and the Java team wont be very helpful concerning it.


If its something else I'd like to know cause KML support in WWJ has been on the backburner for a while,
and the people who have implemented their own parsers only implement a tiny portion of the spec and
usually hide behind the "I cant release the source cause it was for a customer" wall.
heidtmare is offline   Reply With Quote
Old 04-21-2010, 08:07 AM   #6
davicentef
Junior Member
 
Join Date: Apr 2010
Posts: 18
davicentef is on a distinguished road
Default

Thanks for the answer.
I´m using the first one, I´m developing in JAVA. It seems this project is very abandoned . In any case, I´ll post my issue there.
I suppose nobody has suffered this same problem or knows how to fix it, hasn´t it?

Regards
davicentef is offline   Reply With Quote
Old 04-21-2010, 12:22 PM   #7
davicentef
Junior Member
 
Join Date: Apr 2010
Posts: 18
davicentef is on a distinguished road
Default

I have improved the performance at least partially.
The problem appeared when I drag the mouse / the globe (with both buttoms). But it didn´t happen when I zoom in/out.

The partial solution that I have applied, with MouseListener, when a button is released, I execute this code:

Robot robotic = new Robot();
robotic.mouseWheel(1);
robotic.mouseWheel(-1);


It doesn´t anything apparently, but the strange movement stop.
If someone find a better way, please, tell me.

Regards.
davicentef 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
How to shade an icon from KML Importer??? James_In_Utah Developers' Corner 21 04-23-2010 07:47 PM
Help with KML Importer eric567 WorldWind General 1 12-16-2008 05:34 PM
Feature enhancements needed for KML Importer James_In_Utah Developers' Corner 0 07-18-2008 11:45 PM
KML Importer change to load last loaded KML James_In_Utah Developers' Corner 7 07-15-2008 04:13 AM
KML importer coloradokid Technical Support 15 03-18-2007 06:57 PM


All times are GMT +1. The time now is 01:41 AM.


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