当前位置: 首页>>代码示例>>Java>>正文


Java GeoPosition.getLatitude方法代码示例

本文整理汇总了Java中org.jdesktop.swingx.mapviewer.GeoPosition.getLatitude方法的典型用法代码示例。如果您正苦于以下问题:Java GeoPosition.getLatitude方法的具体用法?Java GeoPosition.getLatitude怎么用?Java GeoPosition.getLatitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdesktop.swingx.mapviewer.GeoPosition的用法示例。


在下文中一共展示了GeoPosition.getLatitude方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: geoToPixel

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
@Override
public Point2D geoToPixel(GeoPosition c, int zoom)
{
	// calc the pixels per degree
	Dimension mapSizeInTiles = getMapSize(zoom);
	// double size_in_tiles = (double)getInfo().getMapWidthInTilesAtZoom(zoom);
	// double size_in_tiles = Math.pow(2, getInfo().getTotalMapZoom() - zoom);
	double size_in_pixels = mapSizeInTiles.getWidth() * getInfo().getTileSize(zoom);
	double ppd = size_in_pixels / 360;

	// the center of the world
	double centerX = this.getTileSize(zoom) * mapSizeInTiles.getWidth() / 2;
	double centerY = this.getTileSize(zoom) * mapSizeInTiles.getHeight() / 2;

	double x = c.getLongitude() * ppd + centerX;
	double y = -c.getLatitude() * ppd + centerY;

	return new Point2D.Double(x, y);
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:20,代码来源:CylindricalProjectionTileFactory.java

示例2: geoToPixel

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
public Point2D geoToPixel(GeoPosition c, int zoom) {
    // calc the pixels per degree
    Dimension mapSizeInTiles = getMapSize(zoom);
    //double size_in_tiles = (double)getInfo().getMapWidthInTilesAtZoom(zoom);
    //double size_in_tiles = Math.pow(2, getInfo().getTotalMapZoom() - zoom);
    double size_in_pixels = mapSizeInTiles.getWidth()*getInfo().getTileSize(zoom);
    double ppd = size_in_pixels / 360;
    
    // the center of the world
    double centerX = this.getTileSize(zoom)*mapSizeInTiles.getWidth()/2;
    double centerY = this.getTileSize(zoom)*mapSizeInTiles.getHeight()/2;
    
    double x = c.getLongitude() * ppd + centerX;
    double y = -c.getLatitude() * ppd + centerY;
    
    return new Point2D.Double(x, y);
}
 
开发者ID:3dcitydb,项目名称:swingx-ws,代码行数:18,代码来源:CylindricalProjectionTileFactory.java

示例3: MapViewSetting

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
public MapViewSetting(String name, GeoPosition position, int zoom)
{
    super(name);
    mLatitude = position.getLatitude();
    mLongitude = position.getLongitude();
    mZoom = zoom;
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:8,代码来源:MapViewSetting.java

示例4: boundingBoxFromGeoPositions

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
private BoundingBox boundingBoxFromGeoPositions(
		GeoPosition topLeftPosition, GeoPosition bottomRightPosition) {
	return new BoundingBox(topLeftPosition.getLongitude(),
			topLeftPosition.getLatitude(),
			bottomRightPosition.getLongitude(),
			bottomRightPosition.getLatitude());
}
 
开发者ID:TomTasche,项目名称:mapsracer,代码行数:8,代码来源:SimpleNodeManager.java

示例5: updateArea

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
/**
 * Updates the area definition with the new center at the specified screen
 * coordinates
 * @param x the x coordiante (relative to current screen)
 * @param y the y coordinate (relative to current screen)
 */
protected void updateArea(double x, double y) {
	// get current position
    Point2D cursor = new Point2D.Double(x, y);

	// calculate area
	GeoPosition gps = jxm.convertPointToGeoPosition(cursor);
	ar = new Area(new Coordinate(gps.getLatitude(), gps.getLongitude()),
			extent, UnitOfLength.KILOMETER);

	// repaint
	jxm.repaint();
}
 
开发者ID:klamann,项目名称:maps4cim,代码行数:19,代码来源:SelectionAdapter.java

示例6: getTileUrl

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
@Override
public String getTileUrl(int x, int y, int zoom)
{
	// "&usrid=&ds=&c=-117.1817|34.0556&sf=52500&fmt=&ocs=";
	// System.out.println("getting tile at zoom: " + zoom);
	// System.out.println("map width at zoom = " + getMapWidthInTilesAtZoom(zoom));

	// provide the center point of the tile, in lat/long coords
	int tileY = y;
	int tileX = x;
	int pixelX = tileX * factory.getTileSize(zoom) + (factory.getTileSize(zoom) / 2);
	int pixelY = tileY * factory.getTileSize(zoom) + (factory.getTileSize(zoom) / 2);

	GeoPosition latlong = GeoUtil.getPosition(new Point2D.Double(pixelX, pixelY), zoom, this);

	// Chris is going to hate me for this (relying on 72dpi!), but:
	// 72 pixels per inch. The earth is 24,859.82 miles in circumference, at the equator.
	// Thus, the earth is 24,859.82 * 5280 * 12 * 72 pixels in circumference.

	double numFeetPerDegreeLong = 24859.82 * 5280 / 360; // the number of feet per degree longitude at the
															// equator
	double numPixelsPerDegreeLong = getLongitudeDegreeWidthInPixels(zoom);
	double numPixelsPerFoot = 96 * 12;
	int sf = (int) (numFeetPerDegreeLong / (numPixelsPerDegreeLong / numPixelsPerFoot));

	// round lat and long to 5 decimal places
	BigDecimal lat = new BigDecimal(latlong.getLatitude());
	BigDecimal lon = new BigDecimal(latlong.getLongitude());
	lat = lat.setScale(5, RoundingMode.DOWN);
	lon = lon.setScale(5, RoundingMode.DOWN);
	System.out.println("Tile      : [" + tileX + ", " + tileY + "]");
	System.out.println("Pixel     : [" + pixelX + ", " + pixelY + "]");
	System.out.println("Lat/Long  : [" + latlong.getLatitude() + ", " + latlong.getLongitude() + "]");
	System.out.println("Lat2/Long2: [" + lat.doubleValue() + ", " + lon.doubleValue() + "]");

	String url = baseURL + "&usrid=" + factory.userId + "&ds=" + factory.datasource + "&c=" + lon.doubleValue()
			+ "%7C" + lat.doubleValue() + "&sf=" + sf + // 52500" +
			"&fmt=" + format + "&ocs=" + projection;
	System.out.println("the URL: " + url);
	return url;
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:42,代码来源:ESRITileFactory.java

示例7: setGeoPosition

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
public void setGeoPosition(GeoPosition position)
{
    mLatitude = position.getLatitude();
    mLongitude = position.getLongitude();
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:6,代码来源:MapViewSetting.java

示例8: createGeoRectangle

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
private Rectangle2D createGeoRectangle(GeoPosition southWest, GeoPosition northEast) {
	Rectangle2D tmp = new Rectangle2D.Double(southWest.getLatitude(), southWest.getLongitude(), 0, 0);
	tmp = tmp.createUnion(new Rectangle2D.Double(northEast.getLatitude(), northEast.getLongitude(), 0, 0));

	return tmp;
}
 
开发者ID:3dcitydb,项目名称:importer-exporter,代码行数:7,代码来源:BBoxSelectionPainter.java

示例9: getTileUrl

import org.jdesktop.swingx.mapviewer.GeoPosition; //导入方法依赖的package包/类
public String getTileUrl(int x, int y, int zoom) {
//                "&usrid=&ds=&c=-117.1817|34.0556&sf=52500&fmt=&ocs=";
            //System.out.println("getting tile at zoom: " + zoom);
            //System.out.println("map width at zoom = " + getMapWidthInTilesAtZoom(zoom));
            
            //provide the center point of the tile, in lat/long coords
            int tileY = y;
            int tileX = x;
            int pixelX = tileX * factory.getTileSize(zoom) + (factory.getTileSize(zoom) / 2);
            int pixelY = tileY * factory.getTileSize(zoom) + (factory.getTileSize(zoom) / 2);
            
            GeoPosition latlong = GeoUtil.getPosition(new Point2D.Double(pixelX, pixelY), zoom, this);
            
            //Chris is going to hate me for this (relying on 72dpi!), but:
            //72 pixels per inch. The earth is 24,859.82 miles in circumference, at the equator.
            //Thus, the earth is 24,859.82 * 5280 * 12 * 72 pixels in circumference.
            
            double numFeetPerDegreeLong = 24859.82 * 5280 / 360; //the number of feet per degree longitude at the equator
            double numPixelsPerDegreeLong = getLongitudeDegreeWidthInPixels(zoom);
            double numPixelsPerFoot = 96 * 12;
            int sf = (int)(numFeetPerDegreeLong / (numPixelsPerDegreeLong / numPixelsPerFoot));
            
            //round lat and long to 5 decimal places
            BigDecimal lat = new BigDecimal(latlong.getLatitude());
            BigDecimal lon = new BigDecimal(latlong.getLongitude());
            lat = lat.setScale(5, RoundingMode.DOWN);
            lon = lon.setScale(5, RoundingMode.DOWN);
            System.out.println("Tile      : [" + tileX + ", " + tileY + "]");
            System.out.println("Pixel     : [" + pixelX + ", " + pixelY + "]");
            System.out.println("Lat/Long  : [" + latlong.getLatitude() + ", " + latlong.getLongitude() + "]");
            System.out.println("Lat2/Long2: [" + lat.doubleValue() + ", " + lon.doubleValue() + "]");
            
            String url = baseURL +
                    "&usrid=" + factory.userId +
                    "&ds=" + factory.datasource +
                    "&c=" + lon.doubleValue() + "%7C" + lat.doubleValue() +
                    "&sf=" + sf + //52500" +
                    "&fmt=" + format +
                    "&ocs=" + projection;
            System.out.println("the URL: " + url);
            return url;
        }
 
开发者ID:3dcitydb,项目名称:swingx-ws,代码行数:43,代码来源:ESRITileFactory.java


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