本文整理汇总了Java中org.jxmapviewer.viewer.DefaultTileFactory类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTileFactory类的具体用法?Java DefaultTileFactory怎么用?Java DefaultTileFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTileFactory类属于org.jxmapviewer.viewer包,在下文中一共展示了DefaultTileFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setDefaultProvider
import org.jxmapviewer.viewer.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:szabob94,项目名称:vedes4,代码行数:24,代码来源:JXMapKit.java
示例2: OSMPanel
import org.jxmapviewer.viewer.DefaultTileFactory; //导入依赖的package包/类
public OSMPanel()
{
// Create a TileFactoryInfo for OpenStreetMap
final TileFactoryInfo info = new OSMTileFactoryInfo();
final DefaultTileFactory tileFactory = new DefaultTileFactory(info);
this.setTileFactory(tileFactory);
// Use 8 threads in parallel to load the tiles
tileFactory.setThreadPoolSize(NUMBER_OF_THREADS);
}
开发者ID:girtel,项目名称:Net2Plan,代码行数:12,代码来源:OSMPanel.java
示例3: MapPanel
import org.jxmapviewer.viewer.DefaultTileFactory; //导入依赖的package包/类
/**
* Konstruktor
* @param host URL usługi TMS
* @param centerPosition Współrzędne centralnego punktu mapy
*/
public MapPanel(String host, GeoPosition centerPosition) {
super();
this.centerPosition = centerPosition;
// niezaimplementowane w JXMapKit...
setDataProviderCreditShown(false);
TileFactoryInfo tileFactoryInfo = new TileFactoryInfo(2, 16, 18, 256, true, true, host, "x", "y", "z") {
@Override
public String getTileUrl(int x, int y, int zoom) {
//return this.baseURL +"?x="+x+"&y="+y+"&z="+(this.getTotalMapZoom()-zoom);
return this.baseURL + "/" + (this.getTotalMapZoom()-zoom) + "/" + x + "/" + y + ".png";
}
};
setTileFactory(new DefaultTileFactory(tileFactoryInfo));
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.NORTHEAST;
getMainMap().add(new OSMCreditPanel(), gbc);
}
开发者ID:makaw,项目名称:somado,代码行数:37,代码来源:MapPanel.java
示例4: main
import org.jxmapviewer.viewer.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:szabob94,项目名称:vedes4,代码行数:32,代码来源:JXMapKit.java
示例5: main
import org.jxmapviewer.viewer.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 MCWaypointRenderer());
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:jocopa3,项目名称:BlocktopographPC-GUI,代码行数:59,代码来源:Sample4.java
示例6: SwingMap
import org.jxmapviewer.viewer.DefaultTileFactory; //导入依赖的package包/类
/**
* @param args the program args (ignored)
*/
public SwingMap(GeoPosition initialPosition) {
super(new BorderLayout());
// 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);
// Set the focus
mapViewer.setZoom(7);
mapViewer.setAddressLocation(initialPosition);
// 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);
add(mapViewer, BorderLayout.CENTER);
}
开发者ID:automenta,项目名称:netentionj-desktop,代码行数:44,代码来源:SwingMap.java
示例7: main
import org.jxmapviewer.viewer.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:automenta,项目名称:netentionj-desktop,代码行数:53,代码来源:JXMapViewerSample3.java
注:本文中的org.jxmapviewer.viewer.DefaultTileFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论