📄 individualthemetest.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.IndividualValueTheme;import com.mapinfo.dp.Attribute;import com.mapinfo.legend.IndividualValueThemeLegend;public class IndividualThemeTest extends JFrame{ public FeatureLayer lyr;//Feature对象用来访问地图对象 // public ArrayList cols; public VisualMapJ myMap;//可管理地图集的各种状态,并向服务器转发客户请求 //public Hashtable ht; public IndividualThemeTest() { 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"); IndividualValueTheme iValThm = new IndividualValueTheme("CONTINENT","Sales Coverage Breakdown"); // create a rendition Rendition rend= new RenditionImpl(); rend.setValue(Rendition.FILL, Color.red); iValThm.add(new Attribute("Asia"), rend); rend.setValue(Rendition.FILL, Color.blue); iValThm.add(new Attribute("Africa"), rend); rend.setValue(Rendition.FILL, Color.green); iValThm.add(new Attribute("Europe"), rend); // Add the theme to layers theme list lyr.getThemeList().add(iValThm); // Store column name and type in hashtable Hashtable ht = new Hashtable(); ht.put("geomtype", IndividualValueThemeLegend.REGION_GEOMETRY); ht.put("lableorder", IndividualValueThemeLegend.ORDER_ASCENDING); // 创建图例 IndividualValueThemeLegend iValThmLeg; iValThmLeg = new IndividualValueThemeLegend(iValThm, ht); iValThmLeg.setTitle("Coverge Territory legend"); //工具栏放上端 this.getContentPane().add(myMapToolBar,BorderLayout.NORTH); //地图放中间 this.getContentPane().add(myMap,BorderLayout.CENTER); //图例放右边 this.getContentPane().add(iValThmLeg,BorderLayout.EAST); this.setVisible(true); this.show(); }catch(Exception e){ System.out.println("Error"); e.printStackTrace(); } } public static void main(String args[]){ IndividualThemeTest bclr=new IndividualThemeTest(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -