?? individualthemetest.java
字號(hào):
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對(duì)象用來訪問地圖對(duì)象 // public ArrayList cols; public VisualMapJ myMap;//可管理地圖集的各種狀態(tài),并向服務(wù)器轉(zhuǎn)發(fā)客戶請(qǐng)求 //public Hashtable ht; public IndividualThemeTest() { try{ //指上端的工具欄,工具欄默認(rèn)包含幾種功能,如果想添加其它功能可以看下面代碼 MapToolBar myMapToolBar=new MapToolBar(); //在工具欄上添加新功能 RadiusSelectionMapTool radTool =new RadiusSelectionMapTool(); //創(chuàng)建地圖 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); // 創(chuàng)建圖例 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(); } }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -