⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectionthemetest.java

📁 MapXtreme 用于电子地图制作与分析
💻 JAVA
字号:
package barchant;import java.lang.*;import java.util.*;import java.util.Hashtable;import java.awt.*;import com.mapinfo.mapj.*;import com.mapinfo.graphics.Rendition;import com.mapinfo.graphics.RenditionImpl;import java.util.ArrayList;import javax.swing.*;import com.mapinfo.mapj.BarChartProperties;import com.mapinfo.beans.vmapj.VisualMapJ;import com.mapinfo.beans.tools.*;import com.mapinfo.util.DoubleRect;import com.mapinfo.dp.FeatureSet;import com.mapinfo.theme.SelectionTheme;public class SelectionThemeTest extends JFrame{  public FeatureLayer lyr;//Feature对象用来访问地图对象 // public ArrayList cols;  public VisualMapJ myMap;//可管理地图集的各种状态,并向服务器转发客户请求  //public Hashtable ht;  public SelectionThemeTest() {    try{     //指上端的工具栏,工具栏默认包含几种功能,如果想添加其它功能可以看下面代码     MapToolBar myMapToolBar=new MapToolBar();     //在工具栏上添加新功能     RadiusSelectionMapTool radTool =new RadiusSelectionMapTool();     //创建地图     myMap=new VisualMapJ();     myMap.getMapJ().loadMapDefinition("d:\\program files\\MapInfo\\MapXtreme-4.7.0\\examples\\server\\data\\local\\world.mdf");     lyr = (FeatureLayer)myMap.getMapJ().getLayers().getLayer("World Countries");    // Assume layer as a FeatureLayer object     ArrayList columns = new ArrayList();   //  double x=12,y=-67;     DoubleRect dp = new DoubleRect(-74,42,-73,42);     FeatureSet fs = null;     // Select the features at the specified location在给定位置搜索图元     fs = lyr.searchWithinRectangle(columns, dp, null);     // Create a SelectionTheme     SelectionTheme selTheme = new SelectionTheme("PointSelection");     // Create a Selection object, and add the selected features     Selection sel = new Selection();//该类用于定义一组图元,但并不存图元本身,只是保存主键便于再次查找     sel.add(fs);     // Assign the Selection object to the SelectionTheme     selTheme.setSelection(sel);     // 定义Rendition控制图元     Rendition rend = new RenditionImpl();     rend.setValue(Rendition.FILL, Color.red);     selTheme.setRendition(rend);     // Add the SelectionTheme to the layer's list of themes     lyr.getThemeList().add(selTheme);  //工具栏放上端       this.getContentPane().add(myMapToolBar,BorderLayout.NORTH);       //地图放中间       this.getContentPane().add(myMap,BorderLayout.CENTER);       //图例放右边     //  this.getContentPane().add(legend,BorderLayout.EAST);       this.setVisible(true);       this.show();    }catch(Exception e){       System.out.println("Error");       e.printStackTrace();     }   }   public static void main(String args[]){     SelectionThemeTest bclr=new SelectionThemeTest();   } }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -