本文整理汇总了Java中org.jdesktop.swingx.mapviewer.TileFactory类的典型用法代码示例。如果您正苦于以下问题:Java TileFactory类的具体用法?Java TileFactory怎么用?Java TileFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TileFactory类属于org.jdesktop.swingx.mapviewer包,在下文中一共展示了TileFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDefaultProvider
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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();
}
示例2: setTileFactory
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的package包/类
/**
* Set the current tile factory (must not be <code>null</code>)
* @param factory the new property value
*/
public void setTileFactory(TileFactory factory)
{
if (factory == null)
throw new NullPointerException("factory must not be null");
this.factory.removeTileListener(tileLoadListener);
this.factory.dispose();
this.factory = factory;
this.setZoom(factory.getInfo().getDefaultZoomLevel());
factory.addTileListener(tileLoadListener);
repaint();
}
示例3: getBounds
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的package包/类
public static Rectangle2D getBounds(Track track, int zoomLevel,
TileFactory tileFactory) {
TileFactoryInfo info = tileFactory.getInfo();
double minLat = track.getMetadata().getMinLatitude();
double minLng = track.getMetadata().getMinLongitude();
double maxLat = track.getMetadata().getMaxLatitude();
double maxLng = track.getMetadata().getMaxLongitude();
Point2D nw = org.jdesktop.swingx.mapviewer.util.GeoUtil
.getBitmapCoordinate(minLat, minLng, zoomLevel, info);
Point2D se = org.jdesktop.swingx.mapviewer.util.GeoUtil
.getBitmapCoordinate(maxLat, maxLng, zoomLevel, info);
double mx = Math.min(nw.getX(), se.getX());
double my = Math.min(nw.getY(), se.getY());
double mw = Math.max(nw.getX(), se.getX()) - mx;
double mh = Math.max(nw.getY(), se.getY()) - my;
return new Rectangle2D.Double(mx, my, mw, mh);
}
示例4: calcMaxZoomLevel
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的package包/类
public static int calcMaxZoomLevel(JXMapKit mapKit, Track track) {
JXMapViewer mapViewer = mapKit.getMainMap();
int mmw = mapViewer.getWidth();
int mmh = mapViewer.getHeight();
TileFactory tileFactory = mapViewer.getTileFactory();
int maximumZoomLevel = tileFactory.getInfo().getMaximumZoomLevel();
int minimumZoomLevel = tileFactory.getInfo().getMinimumZoomLevel();
for (int i = maximumZoomLevel; i >= minimumZoomLevel; i--) {
Rectangle2D tr = getBounds(track, i, tileFactory);
if (tr.getWidth() > mmw || tr.getHeight() > mmh) {
return i + 1;
}
}
return minimumZoomLevel;
}
示例5: TerrainGoogleMapButtonActionPerformed
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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));
}
示例6: MapGoogleMapButtonActionPerformed
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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));
}
示例7: HybridoGoogleMapButtonActionPerformed
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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);
}
}
示例8: mapQuestActionPerformed
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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));
}
示例9: CycleMapActionPerformed
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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));
}
示例10: tileArrobaHomeActionPerformed
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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));
}
示例11: mapaCallesActionPerformed
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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);
}
}
示例12: setCloudMadeStilo
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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();
}
示例13: getMapGeoBounds
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的package包/类
/**
* Gets the bounds as a set of two <code>GeoPosition</code> objects.
* @param mapViewer The map viewer.
* @return Returns the set of two <code>GeoPosition</code> objects that represent the north west and south east
* corners of the map.
*/
private static Set<GeoPosition> getMapGeoBounds(JXMapViewer mapViewer)
{
Set<GeoPosition> set = new HashSet<GeoPosition>();
TileFactory tileFactory = mapViewer.getTileFactory();
int zoom = mapViewer.getZoom();
Rectangle2D bounds = mapViewer.getViewportBounds();
Point2D pt = new Point2D.Double(bounds.getX(), bounds.getY());
set.add(tileFactory.pixelToGeo(pt, zoom));
pt = new Point2D.Double(bounds.getX() + bounds.getWidth(), bounds.getY() + bounds.getHeight());
set.add(tileFactory.pixelToGeo(pt, zoom));
return set;
}
示例14: setTileFactory
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的package包/类
/**
* Sets the tile factory for both embedded JXMapViewer components. Calling this method will also reset the center
* and zoom levels of both maps, as well as the bounds of the zoom slider.
* @param fact the new TileFactory
*/
public void setTileFactory(TileFactory fact)
{
mainMap.setTileFactory(fact);
mainMap.setZoom(fact.getInfo().getDefaultZoomLevel());
mainMap.setCenterPosition(new GeoPosition(0, 0));
miniMap.setTileFactory(fact);
miniMap.setZoom(fact.getInfo().getDefaultZoomLevel() + 3);
miniMap.setCenterPosition(new GeoPosition(0, 0));
zoomSlider.setMinimum(fact.getInfo().getMinimumZoomLevel());
zoomSlider.setMaximum(fact.getInfo().getMaximumZoomLevel());
}
示例15: main
import org.jdesktop.swingx.mapviewer.TileFactory; //导入依赖的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);
}
});
}