![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Nov 2007
Posts: 36
|
Hello,
I'm working on a simulation which will show an airplane flying a figure-8 flight pattern within a defined airspace. I plan on using an icon of the aircraft and moving it to the appropriate geolocation relative to time. I would like to align the aircraft icon so it is pointed in the right direction (i.e., the direction of flight). But I just can't seem to figure out how to rotate an icon (it's obviously possible, since the compass icon does it). BTW, in case someone is wondering, for the display I need it will be much better to rotate the airplane icon and not the earth. Can someone point me towards information on this? Thank you. P.S. I'm quite new to WWJ (not to mention java). |
|
|
|
|
|
| James_In_Utah |
|
This message has been deleted by James_In_Utah.
Reason: Wrong section
|
|
|
#2 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
|
I dont think you can rotate an icon in the actual implementation. However, you can change its image.
Maybe you can have a set of images that have the plane pointing in a reasonable number of directions and alternate them - change the icon image source. This image set can be generated at run time from an initial icon by using j2d graphic methods and affine transforms. Anyway, icons will only work with a vertical view. |
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Jun 2007
Posts: 109
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Nov 2007
Posts: 108
|
I think the IconLayer and WWIcon need a lot of improvements to be useful.
A great new features would be -the ability of rotating icons. -the ability of making flashing icons. And the implementation should be able to handle a large number of icons in small geographical area, should render it in a decent way even if it is viewed from hight altitudes! |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jun 2007
Posts: 213
|
I kind of agree that Icons/IconLayer leave a little to be desired.
Firstly, I don't think setImageSource(Object) is a great interface. The API would probably be better off with just a constructor that takes a BufferedImage, and *possibly* an overloaded one that takes a URL. Highlighting icons isn't great, it doesn't use even the best rescaling algorithm that Java provides. Much better would be a separate "setHighlightedImage" function that allowed application specific (and higher quality) highlight. There's no way to set an anchor point in the Icon, it's fixed at the (middlex, bottomy) point of your image. I think a better default would be centered in the image and it definitely needs to be overridable. SelectEvent.getPickItems only returns one icon even if many are stacked on top of one another (due to the way rendering unique colors is used to choose the picked items). It would be great if it was easier to get all the picked icons for things like a UI to disambiguate mouse-clicks-- I'm planning on looking at using a real intersection test instead which I doubt will be very difficult. Icons and Annotations both share the problem that there are some non-obvious assumptions around the rendering of OrderedRenderables, specifically they both use the same cryptic "setDepthFunc" method which has some magic constants in it and I'm not convinced works 100%. With all these issues I list, it may sound like I'm unhappy, but nothing could be farther from the truth. I'm totally in love with how easy it is to do some amazing things with the API. I definitely should have brought these issues up earlier rather than dumping them all at once like this though. ![]() |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Nov 2007
Posts: 108
|
I use this function for symbolizing and rotating of WWIcon
private BufferedImage getSymbol(Vehicle vehicle) { String imagePath="/images/symbols/vobject.png"; if (vehicle.getType()!=null) { imagePath=String.format("/images/symbols/%d.png",vehicle.getType()); } InputStream iconStream = this.getClass().getResourceAsStream(imag ePath); BufferedImage image = null; try { image = ImageIO.read(iconStream); AffineTransform tx = new AffineTransform(); tx.rotate(Math.toRadians(vehicle.getLast Location().getHeading()), image.getWidth()/2, image.getHeight()/2); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR) ; image = op.filter(image, null); } catch (Exception e) { e.printStackTrace(); } return image; } |
|
|
|
|
|
#7 |
|
Super Member
Join Date: Jan 2006
Location: Eden, Utah
Posts: 1,446
|
Will the Java version of World Wind support importing KML? If so, will it also support the <heading> tag inside <IconStyle>? I use this in the .Net version and in GE to show directions of aircraft icons.
Thanks, James |
|
|
|
|
|
#8 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
|
There is a code contribution addressing KMLs but i dont know for the details regarding which tags are supported or when it may be incorporated.
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Nov 2007
Posts: 108
|
The code I posted seems to have a problem,
when I change the heading of the camera view, JWW does not rotate the icons to reflect the same direction! how can I fix that? Last edited by linnuxxy; 12-21-2007 at 09:10 PM. |
|
|
|
|
|
#10 | |
|
WWJ aficionado
Join Date: Aug 2007
Posts: 134
|
Hi all
if I understand well the first time I read the post, you would like to be possible rotating icons in the same way the compass rotates. Weel, I think I get it (see attached image). The rotating code is a short peace of code to put in the IconRendered.drawIcon method. The only thing is your icons has a get-setHeading method to get the rotation angle of the icon. I've create a Rotable interface for this. Quote:
I hope to release the code for this tonight or tomorrow morning and also accompanied with a new icon class called AnnotatedIcon that allows to show an annotation pointing to the icon. The icon can represent some information and when it is selected you can show an annotation with more detailed info. Bye.
__________________
|--------------------------------------- | http://acuriousanimal.orggeo.net |--------------------------------------- | http://acuriousanimal.blogspot.com | http://theballoonproject.blogspot.com |--------------------------------------- | _ __ | /_| ( _ _/'_ _ |( |. __)(//)//(/(/() | _/ |--------------------------------------- Last edited by asantiago; 12-23-2007 at 12:32 PM. |
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Plugin: My favorite Icons - Add Icons/Favorite | canosso | Add-ons & Scripts | 26 | 03-02-2010 04:06 AM |
| Bright and dim icons | caterpillar | Technical Support | 10 | 10-17-2007 07:06 PM |
| Overlapping Icons | twf | Development Help | 9 | 06-07-2007 08:01 PM |
| Icons and Icon Updated Please Test! | nigel_ht | Developers' Corner | 3 | 05-07-2007 08:33 PM |
| Rotating Icons | nigel_ht | Developers' Corner | 3 | 12-29-2005 08:07 PM |