zoukankan      html  css  js  c++  java
  • 清除地图中的所有图层和FileFilter的使用

    清除图层中所有图层的代码如下:

    IActiveView activeView = mainMapBean.getActiveView();   //获取当前地图的视图

    activeView.clear();                                                                        //清除地图中的图层

    activeView.refresh();                                                                    //刷新当前视图

    新建一个对话框的过滤的类

    import javax.swing.filechooser.FileFilter;

    import javax.swing.filechooser.FileNameExtensionFilter;

    public class MapFileFilter{

    public FileFilter createFileFilter(String description, String...extensions) {

      description = createFileNameFilterDescriptionFromExtensions(

        description, extensions);

      return new FileNameExtensionFilter(description, extensions);

    }

    private String createFileNameFilterDescriptionFromExtensions(

       String description, String[] extensions) {

      String fullDescription = (description == null) ?

        "(" : description + " (";

        // build the description from the extension list

      fullDescription += "." + extensions[0];

      for (int i = 1; i < extensions.length; i++) {

       fullDescription += ", .";

       fullDescription += extensions[i];

      }

      fullDescription += ")";

      return fullDescription;

    }

    }

    通过调用createFileFilter方法来实现添加过滤

    MapFileFilter fileFilter = new MapFileFilter();

    fileChooser.resetChoosableFileFilters();

    FileFilter mxdFilter = fileFilter.createFileFilter("ESRI地图文档","mxd");

    fileChooser.addChoosableFileFilter(mxdFilter);

    fileChooser.showOpenDialog(this);

  • 相关阅读:
    兼容利器之X-UA-Compatible
    SQL Server之游标的基础知识
    SQL 按特定字段值排序
    NodeJS 开篇 牛刀小试
    临时表之IF-ELSE
    css中如何设置字体
    怎么做到不加班?
    C# .net中cookie值为中文时的乱码解决方法
    HTML5商城开发一 楼层滚动加载数据
    QQ浏览器X5内核问题汇总
  • 原文地址:https://www.cnblogs.com/bluemaplestudio/p/1675111.html
Copyright © 2011-2022 走看看