• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultTileFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jdesktop.swingx.mapviewer.DefaultTileFactory的典型用法代码示例。如果您正苦于以下问题:Java DefaultTileFactory类的具体用法?Java DefaultTileFactory怎么用?Java DefaultTileFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultTileFactory类属于org.jdesktop.swingx.mapviewer包,在下文中一共展示了DefaultTileFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setDefaultProvider

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
/**
 * @param prov the default provider
 */
public void setDefaultProvider(DefaultProviders prov)
{
	DefaultProviders old = this.defaultProvider;
	this.defaultProvider = prov;
	if (prov == DefaultProviders.SwingLabsBlueMarble)
	{
		setTileFactory(new CylindricalProjectionTileFactory());
		setZoom(3);
	}
	if (prov == DefaultProviders.OpenStreetMaps)
	{
		TileFactoryInfo info = new OSMTileFactoryInfo();
		TileFactory tf = new DefaultTileFactory(info);
		setTileFactory(tf);
		setZoom(11);
		setAddressLocation(new GeoPosition(51.5, 0));
	}
	firePropertyChange("defaultProvider", old, prov);
	repaint();
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:24,代码来源:JXMapKit.java


示例2: TerrainGoogleMapButtonActionPerformed

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void TerrainGoogleMapButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TerrainGoogleMapButtonActionPerformed
        // TODO add your handling code here:
               // TODO add your handling code here:
        // TODO add your handling code here:
         latitud = mapa.getCenterPosition().getLatitude();
        longitud = mapa.getCenterPosition().getLongitude();

        final int max = 18;
        TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true, "http://mt1.google.com/vt/lyrs=p", "x","y","z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String temp = this.baseURL +"&x="+x+"&y="+y+"&z="+zoom+"    ";
                return temp;
            }
        };
        info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
        TileFactory tf = new DefaultTileFactory(info);
        mapa.setTileFactory(tf);
        mapa.setCenterPosition(new GeoPosition(latitud, longitud));
        
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:22,代码来源:PanelDiagramas.java


示例3: MapGoogleMapButtonActionPerformed

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void MapGoogleMapButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MapGoogleMapButtonActionPerformed
        // TODO add your handling code here:
        // TODO add your handling code here:
         latitud = mapa.getCenterPosition().getLatitude();
        longitud = mapa.getCenterPosition().getLongitude();

        final int max = 18;
        TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true, "http://mt0.google.com/vt/", "x","y","z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String url = this.baseURL +"&x="+x+"&y="+y+"&z="+zoom+"";
                return url;
            }
        };
        info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
        TileFactory tf = new DefaultTileFactory(info);
        mapa.setTileFactory(tf);
        mapa.setCenterPosition(new GeoPosition(latitud, longitud));
        
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:21,代码来源:PanelDiagramas.java


示例4: HybridoGoogleMapButtonActionPerformed

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void HybridoGoogleMapButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_HybridoGoogleMapButtonActionPerformed
        // TODO add your handling code here:
        latitud = mapa.getCenterPosition().getLatitude();
        longitud = mapa.getCenterPosition().getLongitude();

        try{
        final int max = 18;
        TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true, "http://mt0.google.com/vt/lyrs=y", "x","y","z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String temp = this.baseURL +"&x="+x+"&y="+y+"&z="+zoom+"";
                return temp;
            }
        };
        info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
        TileFactory tf = new DefaultTileFactory(info);
        mapa.setTileFactory(tf);
        mapa.setCenterPosition(new GeoPosition(latitud, longitud));
        }catch(Exception UHE){
            JOptionPane.showMessageDialog(null, "'Se ha perdido la coneccion con el servidor de mapas de Google'", "Error 006: UnknownHostException", JOptionPane.ERROR_MESSAGE);
        }
        
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:24,代码来源:PanelDiagramas.java


示例5: mapQuestActionPerformed

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void mapQuestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mapQuestActionPerformed
// TODO add your handling code here:
    latitud = mapa.getCenterPosition().getLatitude();
        longitud = mapa.getCenterPosition().getLongitude();

        final int max = 18;
        TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true, "http://otile1.mqcdn.com/tiles/1.0.0/osm", "z","x","y") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String temp = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
                return temp;
            }
        };
        
        info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
        TileFactory tf = new DefaultTileFactory(info);
        mapa.setTileFactory(tf);
        mapa.setCenterPosition(new GeoPosition(latitud, longitud));
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:20,代码来源:PanelDiagramas.java


示例6: CycleMapActionPerformed

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void CycleMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CycleMapActionPerformed
        latitud = mapa.getCenterPosition().getLatitude();
        longitud = mapa.getCenterPosition().getLongitude();

        final int max = 18;
        TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true, "http://andy.sandbox.cloudmade.com/tiles/cycle", "x","y","z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String temp = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
                return temp;
            }
        };
        info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
        TileFactory tf = new DefaultTileFactory(info);
        mapa.setTileFactory(tf);
        mapa.setCenterPosition(new GeoPosition(latitud, longitud));
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:18,代码来源:PanelDiagramas.java


示例7: tileArrobaHomeActionPerformed

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void tileArrobaHomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tileArrobaHomeActionPerformed
        // TODO add your handling code here:
        latitud = mapa.getCenterPosition().getLatitude();
        longitud = mapa.getCenterPosition().getLongitude();

        final int max = 18;
        
        TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true, "http://tah.openstreetmap.org/Tiles/tile", "x","y","z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String temp = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
                return temp;
            }
        };

        info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
        TileFactory tf = new DefaultTileFactory(info);
        mapa.setTileFactory(tf);
        mapa.setCenterPosition(new GeoPosition(latitud, longitud));
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:21,代码来源:PanelDiagramas.java


示例8: mapaCallesActionPerformed

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void mapaCallesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mapaCallesActionPerformed
        // TODO add your handling code here:

        latitud = mapa.getCenterPosition().getLatitude();
        longitud = mapa.getCenterPosition().getLongitude();

        try{
        final int max = 18;
        TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true, "http://tile.openstreetmap.org", "x","y","z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String temp = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
                return temp;
            }
        };
        info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
        TileFactory tf = new DefaultTileFactory(info);
        mapa.setTileFactory(tf);
        mapa.setCenterPosition(new GeoPosition(latitud, longitud));
        }catch(Exception UHE){
             JOptionPane.showMessageDialog(null, "'Se ha perdido la coneccion con el servidor de mapas de Open Street Maps'", "Error 006: UnknownHostException", JOptionPane.ERROR_MESSAGE);
        }
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:24,代码来源:PanelDiagramas.java


示例9: setCloudMadeStilo

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
public void setCloudMadeStilo(int numeroEstilo){
    latitud = mapa.getCenterPosition().getLatitude();
    longitud = mapa.getCenterPosition().getLongitude();

    final int max = 18;
    TileFactoryInfo info = new TileFactoryInfo(0,16,max, 256, true, true,
            "http://a.tile.cloudmade.com/8bafab36916b5ce6b4395ede3cb9ddea/" + numeroEstilo + "/256/", "x","y","z") {
        public String getTileUrl(int x, int y, int zoom) {
            zoom = max-zoom;
            String temp = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
            return temp;
        }
    };
    info.setDefaultZoomLevel(mapa.getZoomSlider().getValue());
    TileFactory tf = new DefaultTileFactory(info);
    mapa.setTileFactory(tf);
    mapa.setCenterPosition(new GeoPosition(latitud, longitud));
    actualizarSitios();
}
 
开发者ID:danielbejaranogonzalez,项目名称:Mobile-Network-LTE,代码行数:20,代码来源:PanelDiagramas.java


示例10: main

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
/**
 * @param args the program args (ignored)
 */
public static void main(String[] args)
{
	JXMapViewer mapViewer = new JXMapViewer();

	// Create a TileFactoryInfo for OpenStreetMap
	TileFactoryInfo info = new OSMTileFactoryInfo();
	DefaultTileFactory tileFactory = new DefaultTileFactory(info);
	mapViewer.setTileFactory(tileFactory);

	// Use 8 threads in parallel to load the tiles
	tileFactory.setThreadPoolSize(8);

	// Set the focus
	GeoPosition frankfurt = new GeoPosition(50.11, 8.68);

	mapViewer.setZoom(7);
	mapViewer.setAddressLocation(frankfurt);

	// Display the viewer in a JFrame
	JFrame frame = new JFrame("JXMapviewer2 Example 1");
	frame.getContentPane().add(mapViewer);
	frame.setSize(800, 600);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setVisible(true);
}
 
开发者ID:klamann,项目名称:maps4cim,代码行数:29,代码来源:Sample1.java


示例11: main

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
/**
 * @param args the program args
 */
public static void main(String... args)
{
	SwingUtilities.invokeLater(new Runnable()
	{
		@Override
		public void run()
		{
			JXMapKit kit = new JXMapKit();
			kit.setDefaultProvider(DefaultProviders.OpenStreetMaps);

			TileFactoryInfo info = new OSMTileFactoryInfo();
			TileFactory tf = new DefaultTileFactory(info);
			kit.setTileFactory(tf);
			kit.setZoom(14);
			kit.setAddressLocation(new GeoPosition(51.5, 0));
			kit.getMainMap().setDrawTileBorders(true);
			kit.getMainMap().setRestrictOutsidePanning(true);
			kit.getMainMap().setHorizontalWrapped(false);

			((DefaultTileFactory) kit.getMainMap().getTileFactory()).setThreadPoolSize(8);
			JFrame frame = new JFrame("JXMapKit test");
			frame.add(kit);
			frame.pack();
			frame.setSize(500, 300);
			frame.setVisible(true);
		}
	});
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:32,代码来源:JXMapKit.java


示例12: initialize

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
public void initialize(NodeManager nodeManager, Map<String, Car> allCars) {
	this.nodeManager = nodeManager;

	mapViewer = new JXMapViewer();

	TileFactoryInfo info = new OSMTileFactoryInfo();
	DefaultTileFactory tileFactory = new DefaultTileFactory(info);
	tileFactory.setThreadPoolSize(8);

	mapViewer.setTileFactory(tileFactory);

	mapViewer.setAddressLocation(new GeoPosition(48.14650327493638,
			16.329095363616943));

	mapViewer.setZoom(3);

	CarPainter carPainter = new CarPainter();
	GraphPainter graphPainter = new GraphPainter();
	ClusterPainter clusterPainter = new ClusterPainter();

	CompoundPainter<JXMapViewer> painter = new CompoundPainter<JXMapViewer>();
	painter.addPainter(carPainter);
	if (MapsRacer.DEBUG) {
		painter.addPainter(graphPainter);
		painter.addPainter(clusterPainter);
	}

	carPainter.initialize(allCars);
	graphPainter.initialize(nodeManager.getStreets());
	clusterPainter.initialize(nodeManager.getClusters());

	mapViewer.setOverlayPainter(painter);

	if (MapsRacer.DEBUG) {
		MouseInputListener mouseListener = new PanMouseInputListener(
				mapViewer);
		mapViewer.addMouseListener(mouseListener);
		mapViewer.addMouseMotionListener(mouseListener);
	}
}
 
开发者ID:TomTasche,项目名称:mapsracer,代码行数:41,代码来源:MapManager.java


示例13: setDefaultProvider

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
public void setDefaultProvider(DefaultProviders prov) {
    DefaultProviders old = this.defaultProvider;
    this.defaultProvider = prov;
    if(prov == DefaultProviders.SwingLabsBlueMarble) {
        setTileFactory(new CylindricalProjectionTileFactory());
        setZoom(3);
    }
    if(prov == DefaultProviders.OpenStreetMaps) {
        final int max = 19;
        TileFactoryInfo info = new TileFactoryInfo(1,max-2,max,
                256, true, true, // tile size is 256 and x/y orientation is normal
                "http://tile.openstreetmap.org",//5/15/10.png",
                "x","y","z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max-zoom;
                String url = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
                return url;
            }
            
        };
        TileFactory tf = new DefaultTileFactory(info);
        setTileFactory(tf);
        setZoom(max-2);
        setAddressLocation(new GeoPosition(51.5,13.0));
    }
    firePropertyChange("defaultProvider", old, prov);
    repaint();
}
 
开发者ID:3dcitydb,项目名称:swingx-ws,代码行数:29,代码来源:JXMapKit.java


示例14: main

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
public static void main(String ... args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            JXMapKit kit = new JXMapKit();
            kit.setDefaultProvider(DefaultProviders.OpenStreetMaps);
            
            
            final int max = 17;
            TileFactoryInfo info = new TileFactoryInfo(1,max-2,max,
                    256, true, true, // tile size is 256 and x/y orientation is normal
                    "http://tile.openstreetmap.org",//5/15/10.png",
                    "x","y","z") {
                public String getTileUrl(int x, int y, int zoom) {
                    zoom = max-zoom;
                    String url = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
                    return url;
                }

            };
            TileFactory tf = new DefaultTileFactory(info);
            kit.setTileFactory(tf);
            kit.setZoom(14);
            kit.setAddressLocation(new GeoPosition(51.5,0));
            kit.getMainMap().setDrawTileBorders(true);
            kit.getMainMap().setRestrictOutsidePanning(true);
            kit.getMainMap().setHorizontalWrapped(false);
            
            ((DefaultTileFactory)kit.getMainMap().getTileFactory()).setThreadPoolSize(8);
            JFrame frame = new JFrame("JXMapKit test");
            frame.add(kit);
            frame.pack();
            frame.setSize(500,300);
            frame.setVisible(true);
        }
    });
}
 
开发者ID:3dcitydb,项目名称:swingx-ws,代码行数:37,代码来源:JXMapKit.java


示例15: getCachedTileFactory

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
protected TileFactory getCachedTileFactory() {
	// Create a TileFactoryInfo for OpenStreetMap
	TileFactoryInfo info = new OSMTileFactoryInfo();
	DefaultTileFactory tileFactory = new DefaultTileFactory(info);
	tileFactory.setThreadPoolSize(8);

	// Setup local file cache
	File cache = new Cache().getCacheDir();
	LocalResponseCache.installResponseCache(info.getBaseURL(), cache, false);

	return tileFactory;
}
 
开发者ID:klamann,项目名称:maps4cim,代码行数:13,代码来源:MapViewerFactory.java


示例16: Mapa

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
public Mapa() {
	TileFactoryInfo tfi = new GoogleTileFactoryInfo(0, 10, 17, 256, true, true, false);
	setTileFactory(new DefaultTileFactory(tfi));
}
 
开发者ID:cams7,项目名称:erp,代码行数:5,代码来源:Mapa.java


示例17: init

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
private void init()
  {
      setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill]"));

      /**
       * Set the entity painter as the overlay painter and register this panel
       * to receive new messages (plots)
       */
      mMapViewer.setOverlayPainter(mMapPainter);
      mMapService.addListener(this);

      /**
       * Map image source
       */
      TileFactoryInfo info = new OSMTileFactoryInfo();
      DefaultTileFactory tileFactory = new DefaultTileFactory(info);
      mMapViewer.setTileFactory(tileFactory);

      /**
       * Defines how many threads will be used to fetch the background map
       * tiles (graphics)
       */
      tileFactory.setThreadPoolSize(8);

      /**
       * Set initial location and zoom for the map upon display
       */
      GeoPosition syracuse = new GeoPosition(43.048, -76.147);
      int zoom = 7;

      MapViewSetting view = mSettingsManager.getMapViewSetting("Default", syracuse, zoom);

      mMapViewer.setAddressLocation(view.getGeoPosition());
      mMapViewer.setZoom(view.getZoom());

      /**
       * Add a mouse adapter for panning and scrolling
       */
      MapMouseListener listener = new MapMouseListener(mMapViewer, mSettingsManager);
      mMapViewer.addMouseListener(listener);
      mMapViewer.addMouseMotionListener(listener);

/* Map zoom listener */
      mMapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCursor(mMapViewer));

/* Keyboard panning listener */
      mMapViewer.addKeyListener(new PanKeyListener(mMapViewer));

      /**
       * Add a selection listener
       */
      SelectionAdapter sa = new SelectionAdapter(mMapViewer);
      mMapViewer.addMouseListener(sa);
      mMapViewer.addMouseMotionListener(sa);

      /**
       * Map component
       */
      add(mMapViewer, "span");
  }
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:61,代码来源:MapPanel.java


示例18: main

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
/**
 * @param args the program args (ignored)
 */
public static <T> void main(String[] args)
{
	JXMapViewer mapViewer = new JXMapViewer();

	// Create a TileFactoryInfo for OpenStreetMap
	TileFactoryInfo info = new OSMTileFactoryInfo();
	DefaultTileFactory tileFactory = new DefaultTileFactory(info);
	tileFactory.setThreadPoolSize(8);
	mapViewer.setTileFactory(tileFactory);

	GeoPosition frankfurt = new GeoPosition(50,  7, 0, 8, 41, 0);
	GeoPosition wiesbaden = new GeoPosition(50,  5, 0, 8, 14, 0);
	GeoPosition mainz     = new GeoPosition(50,  0, 0, 8, 16, 0);
	GeoPosition darmstadt = new GeoPosition(49, 52, 0, 8, 39, 0);
	GeoPosition offenbach = new GeoPosition(50,  6, 0, 8, 46, 0);

	// Set the focus
	mapViewer.setZoom(10);
	mapViewer.setAddressLocation(frankfurt);

	// Create a track from the geo-positions
	List<GeoPosition> track = Arrays.asList(frankfurt, wiesbaden, mainz, darmstadt, offenbach);
	RoutePainter routePainter = new RoutePainter(track);

	// Create waypoints from the geo-positions
	Set<Waypoint> waypoints = new HashSet<Waypoint>(Arrays.asList(
			new DefaultWaypoint(frankfurt),
			new DefaultWaypoint(wiesbaden),
			new DefaultWaypoint(mainz),
			new DefaultWaypoint(darmstadt),
			new DefaultWaypoint(offenbach)));

	// Create a waypoint painter that takes all the waypoints
	WaypointPainter<Waypoint> waypointPainter = new WaypointPainter<Waypoint>();
	waypointPainter.setWaypoints(waypoints);

	// Create a compound painter that uses both the route-painter and the waypoint-painter
	List<Painter<JXMapViewer>> painters = new ArrayList<Painter<JXMapViewer>>();
	painters.add(routePainter);
	painters.add(waypointPainter);

	CompoundPainter<JXMapViewer> painter = new CompoundPainter<JXMapViewer>(painters);
	mapViewer.setOverlayPainter(painter);

	// Display the viewer in a JFrame
	JFrame frame = new JFrame("JXMapviewer2 Example 2");
	frame.getContentPane().add(mapViewer);
	frame.setSize(800, 600);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setVisible(true);
}
 
开发者ID:klamann,项目名称:maps4cim,代码行数:55,代码来源:Sample2.java


示例19: main

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
/**
 * @param args the program args (ignored)
 */
public static void main(String[] args)
{
	// Create a TileFactoryInfo for OpenStreetMap
	TileFactoryInfo info = new OSMTileFactoryInfo();
	DefaultTileFactory tileFactory = new DefaultTileFactory(info);
	tileFactory.setThreadPoolSize(8);

	// Setup local file cache
	File cacheDir = new File(System.getProperty("user.home") + File.separator + ".jxmapviewer2");
	LocalResponseCache.installResponseCache(info.getBaseURL(), cacheDir, false);

	// Setup JXMapViewer
	JXMapViewer mapViewer = new JXMapViewer();
	mapViewer.setTileFactory(tileFactory);

	GeoPosition frankfurt = new GeoPosition(50.11, 8.68);

	// Set the focus
	mapViewer.setZoom(7);
	mapViewer.setAddressLocation(frankfurt);

	// Add interactions
	MouseInputListener mia = new PanMouseInputListener(mapViewer);
	mapViewer.addMouseListener(mia);
	mapViewer.addMouseMotionListener(mia);

	mapViewer.addMouseListener(new CenterMapListener(mapViewer));

	mapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCursor(mapViewer));

	mapViewer.addKeyListener(new PanKeyListener(mapViewer));

	// Add a selection painter
	SelectionAdapter sa = new SelectionAdapter(mapViewer);
	SelectionPainter sp = new SelectionPainter(sa);
	mapViewer.addMouseListener(sa);
	mapViewer.addMouseMotionListener(sa);
	mapViewer.setOverlayPainter(sp);

	// Display the viewer in a JFrame
	JFrame frame = new JFrame("JXMapviewer2 Example 3");
	frame.setLayout(new BorderLayout());
	frame.add(new JLabel("Use left mouse button to pan, mouse wheel to zoom and right mouse to select"), BorderLayout.NORTH);
	frame.add(mapViewer);
	frame.setSize(800, 600);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setVisible(true);
}
 
开发者ID:klamann,项目名称:maps4cim,代码行数:52,代码来源:Sample3.java


示例20: main

import org.jdesktop.swingx.mapviewer.DefaultTileFactory; //导入依赖的package包/类
/**
 * @param args the program args (ignored)
 */
public static void main(String[] args)
{
	// Create a TileFactoryInfo for Virtual Earth
	TileFactoryInfo info = new VirtualEarthTileFactoryInfo(VirtualEarthTileFactoryInfo.MAP);
	DefaultTileFactory tileFactory = new DefaultTileFactory(info);
	tileFactory.setThreadPoolSize(8);

	// Setup local file cache
	File cacheDir = new File(System.getProperty("user.home") + File.separator + ".jxmapviewer2");
	LocalResponseCache.installResponseCache(info.getBaseURL(), cacheDir, false);

	// Setup JXMapViewer
	JXMapViewer mapViewer = new JXMapViewer();
	mapViewer.setTileFactory(tileFactory);

	GeoPosition frankfurt = new GeoPosition(50,  7, 0, 8, 41, 0);
	GeoPosition wiesbaden = new GeoPosition(50,  5, 0, 8, 14, 0);
	GeoPosition mainz     = new GeoPosition(50,  0, 0, 8, 16, 0);
	GeoPosition darmstadt = new GeoPosition(49, 52, 0, 8, 39, 0);
	GeoPosition offenbach = new GeoPosition(50,  6, 0, 8, 46, 0);

	// Set the focus
	mapViewer.setZoom(10);
	mapViewer.setAddressLocation(frankfurt);

	// Add interactions
	MouseInputListener mia = new PanMouseInputListener(mapViewer);
	mapViewer.addMouseListener(mia);
	mapViewer.addMouseMotionListener(mia);
	mapViewer.addMouseListener(new CenterMapListener(mapViewer));
	mapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCenter(mapViewer));
	mapViewer.addKeyListener(new PanKeyListener(mapViewer));

	// Create waypoints from the geo-positions
	Set<MyWaypoint> waypoints = new HashSet<MyWaypoint>(Arrays.asList(
			new MyWaypoint("F", Color.ORANGE, frankfurt),
			new MyWaypoint("W", Color.CYAN, wiesbaden),
			new MyWaypoint("M", Color.GRAY, mainz),
			new MyWaypoint("D", Color.MAGENTA, darmstadt),
			new MyWaypoint("O", Color.GREEN, offenbach)));

	// Create a waypoint painter that takes all the waypoints
	WaypointPainter<MyWaypoint> waypointPainter = new WaypointPainter<MyWaypoint>();
	waypointPainter.setWaypoints(waypoints);
	waypointPainter.setRenderer(new FancyWaypointRenderer());

	mapViewer.setOverlayPainter(waypointPainter);

	// Display the viewer in a JFrame
	JFrame frame = new JFrame("JXMapviewer2 Example 4");
	frame.getContentPane().add(mapViewer);
	frame.setSize(800, 600);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setVisible(true);
}
 
开发者ID:klamann,项目名称:maps4cim,代码行数:59,代码来源:Sample4.java



注:本文中的org.jdesktop.swingx.mapviewer.DefaultTileFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServiceList类代码示例发布时间:2022-05-23
下一篇:
Java NodeConnector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap