Results 1 to 7 of 7

Thread: KML Importer. Shapes shaking

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    18

    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.

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Posts
    217

    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.

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    18

    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.

  4. #4
    Senior Member
    Join Date
    Jun 2007
    Posts
    217

    Default

    I'm familiar with KML, what KML importer project are you using, though?

  5. #5
    Senior Member heidtmare's Avatar
    Join Date
    Feb 2008
    Location
    Melbourne, FL, USA
    Posts
    685
    Go To My Homepage: Go to heidtmare's homepage

    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.

  6. #6
    Junior Member
    Join Date
    Apr 2010
    Posts
    18

    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

  7. #7
    Junior Member
    Join Date
    Apr 2010
    Posts
    18

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •