本文整理汇总了Java中org.openstreetmap.gui.jmapviewer.OsmMercator类的典型用法代码示例。如果您正苦于以下问题:Java OsmMercator类的具体用法?Java OsmMercator怎么用?Java OsmMercator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OsmMercator类属于org.openstreetmap.gui.jmapviewer包,在下文中一共展示了OsmMercator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tileYToLat
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
private double tileYToLat(double y, int zoom) {
double lat0;
double lat = cachedLat;
do {
lat0 = lat;
lat = lat - Math.toDegrees(nextTerm(Math.toRadians(lat), y, zoom));
if (lat > OsmMercator.MAX_LAT || lat < OsmMercator.MIN_LAT) {
Random r = new Random();
lat = OsmMercator.MIN_LAT +
r.nextInt((int) (OsmMercator.MAX_LAT - OsmMercator.MIN_LAT));
}
} while (Math.abs(lat0 - lat) > 0.000001);
cachedLat = lat;
return lat;
}
示例2: getValueAt
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
public Object getValueAt(int pRowIndex, int pColumnIndex) {
final Place place = getPlace(pRowIndex);
switch (pColumnIndex) {
case SEARCH_DISTANCE_COLUMN:
final double value = OsmMercator.getDistance(
mCursorCoordinate.getLat(), mCursorCoordinate.getLon(),
place.getLat(), place.getLon()) / 1000.0;
if (Double.isInfinite(value) || Double.isNaN(value)) {
return Double.valueOf(-1.0);
}
return new Double(value);
case SEARCH_DESCRIPTION_COLUMN:
return place.getDisplayName();
}
return null;
}
示例3: tileYToLat
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
private double tileYToLat(double y, int zoom) {
double lat0, lat;
lat = cached_lat;
do {
lat0 = lat;
lat = lat - Math.toDegrees(NextTerm(Math.toRadians(lat), y, zoom));
if (lat > OsmMercator.MAX_LAT || lat < OsmMercator.MIN_LAT) {
Random r = new Random();
lat = OsmMercator.MIN_LAT +
r.nextInt((int )(OsmMercator.MAX_LAT - OsmMercator.MIN_LAT));
}
} while ((Math.abs(lat0 - lat) > 0.000001));
cached_lat = lat;
return (lat);
}
示例4: TMSTileSource
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
/**
* Constructs a new {@code TMSTileSource}.
* @param info tile source information
*/
public TMSTileSource(TileSourceInfo info) {
super(info);
minZoom = info.getMinZoom();
maxZoom = info.getMaxZoom();
this.osmMercator = new OsmMercator(this.getTileSize());
}
示例5: destinationQuadrantCheck
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
public boolean destinationQuadrantCheck(Coordinate cursorPosition,
Coordinate pointPosition, boolean alternative) {
int mapZoomMax = getMaxZoom();
int x1 = OsmMercator.LonToX(cursorPosition.getLon(), mapZoomMax);
int y1 = OsmMercator.LatToY(cursorPosition.getLat(), mapZoomMax);
int x2 = OsmMercator.LonToX(pointPosition.getLon(), mapZoomMax);
int y2 = OsmMercator.LatToY(pointPosition.getLat(), mapZoomMax);
return destinationQuadrantCheck(x1, y1, x2, y2, alternative);
}
示例6: actionPerformed
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
public void actionPerformed(ActionEvent pE) {
String statusText = "";
// here, we look wether or not the cursor is above a node.
MapMarkerBase mapMarker = checkHit(mTimerMouseEvent);
if (mapMarker instanceof MapMarkerLocation) {
MapNodePositionHolder posHolder = ((MapMarkerLocation) mapMarker)
.getNodePositionHolder();
logger.fine("Looking for hit on node " + posHolder);
if (posHolder != null) {
statusText = Tools.getNodeTextHierarchy(posHolder.getNode(),
mMapHook.getMindMapController()) + ". ";
}
}
// calculate the distance to the cursor
Coordinate coordinate = getCoordinateFromMouseEvent(mTimerMouseEvent);
Coordinate cursorPosition = getMap().getCursorPosition();
double distance = OsmMercator.getDistance(coordinate.getLat(),
coordinate.getLon(), cursorPosition.getLat(),
cursorPosition.getLon()) / 1000.0;
Object[] messageArguments = { new Double(distance),
new Double(coordinate.getLat()),
new Double(coordinate.getLon()) };
MessageFormat formatter = new MessageFormat(
mMindMapController.getText("plugins/map/MapDialog_Distance"));
String message = formatter.format(messageArguments);
statusText += message;
mMapHook.getStatusLabel().setText(statusText);
}
示例7: getDefaultTileSize
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
/**
* @return default tile size to use, when not set in Imagery Preferences
*/
@Override
public int getDefaultTileSize() {
return OsmMercator.DEFAUL_TILE_SIZE;
}
示例8: getImageForTooltip
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
/**
* @param pPosition
* @param pTileSource
*/
public TileImage getImageForTooltip(Coordinate pPosition, int pZoom,
String pTileSource) {
TileSource tileSource = FreeMindMapController.changeTileSource(
pTileSource, null);
if (tileSource != null) {
mTileSource = tileSource;
mTileController.setTileSource(tileSource);
}
int tileSize = mTileSource.getTileSize();
int exactx = OsmMercator.LonToX(pPosition.getLon(), pZoom);
int exacty = OsmMercator.LatToY(pPosition.getLat(), pZoom);
int x = exactx / tileSize;
int y = exacty / tileSize;
// determine other surrounding tiles that are close to the exact
// point.
int dx = exactx % tileSize;
int dy = exacty % tileSize;
// determine quadrant of cursor in tile:
if (dx < tileSize / 2) {
x -= 1;
dx += tileSize;
}
if (dy < tileSize / 2) {
y -= 1;
dy += tileSize;
}
TileImage tileImage = new TileImage();
tileImage.setTiles(2, x, y, pZoom, mTileController, logger, dx, dy);
// wait for tiles:
int timeout = 60;
while (timeout-- > 0) {
try {
if (tileImage.isLoaded() || tileImage.hasErrors()) {
break;
}
Thread.sleep(100);
} catch (Exception e) {
freemind.main.Resources.getInstance().logException(e);
}
}
return tileImage;
}
示例9: getDistance
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
@Override
public double getDistance(final double lat1, final double lon1, final double lat2, final double lon2) {
return OsmMercator.getDistance(lat1, lon1, lat2, lon2);
}
示例10: LonToX
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
@Override
public int LonToX(final double lon, final int zoom) {
return (int )OsmMercator.LonToX(lon, zoom);
}
示例11: LatToY
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
@Override
public int LatToY(final double lat, final int zoom) {
return (int )OsmMercator.LatToY(lat, zoom);
}
示例12: XToLon
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
@Override
public double XToLon(final int x, final int zoom) {
return OsmMercator.XToLon(x, zoom);
}
示例13: YToLat
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
@Override
public double YToLat(final int y, final int zoom) {
return OsmMercator.YToLat(y, zoom);
}
示例14: latLonToViz
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
public static Point2D latLonToViz(Point2D p) {
return new Point2D.Double(new OsmMercator().lonToX(p.getY(), 0), new OsmMercator().latToY(p.getX(), 0));
}
示例15: LatToY
import org.openstreetmap.gui.jmapviewer.OsmMercator; //导入依赖的package包/类
@Override
public int LatToY(double lat, int zoom) {
return (int )(latToTileY(lat, zoom) * OsmMercator.TILE_SIZE);
}