Go World Wind Java Development Five-read local shp files

Source: Internet
Author: User

World Wind Java uses the Iconlayer layer class to represent points and multipoint data, using Renderablelayer layers to represent line and polygon data, and a layer can only correspond to a set of shape files. World Wind Java first uses the Shapefileloader class to complete the read and load of the shape file, and then creates the Renderablelayer through the Createlayerfromsource method. Finally, the created layer is added to the layers. The source code is as follows:

/** * Method Name: Addshapedata; * Method Description: Add local shape file; * Parameter: @param filePath: File path * parameter: @param filename: filename * parameter: @param Layertitle: Layer Name * parameter: @param maxactivealtitude: Layer Visible Highest Viewpoint * parameter: @param minactivealtitude: Layer visible Lowest Viewpoint * Parameter: @return * return type: boolean; * Creator: James; * Creation time: 2014-11-25 pm 5:19:48; * @throws */public boolean addshapedata (String FilePath, String Filena Me,string Layertitle, double maxactivealtitude,double minactivealtitude) {Boolean result = False;try{shapefileloader Pshapefileloader = new Shapefileloader ();p Shapelayer = Pshapefileloader.createlayerfromsource (filePath+ fileName +). SHP ");p Shapelayer.setname (layertitle);//Set layer name Pshapelayer.setmaxactivealtitude (maxactivealtitude); Pshapelayer.setminactivealtitude (Minactivealtitude); Worldwindowglcanvas.getmodel (). GetLayers (). Add (PShapeLayer );//Add Layer tree node Pvectornode.add (new Defaultmutabletreenode (layertitle));p Layertree.updateui (); result = true;} catch (Exception e) {//Todo:handle exceptionSystem.out.println (E.getmessage ());} ReturnResult;} 

As shown in the following:

Liushuo_whu posted on 2014-11-25 18:42:13 original link

Go World Wind Java Development Five-read local shp files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.