本文整理汇总了Java中com.google.gwt.maps.client.base.Point类的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Point类属于com.google.gwt.maps.client.base包,在下文中一共展示了Point类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCitySchemaMapType
import com.google.gwt.maps.client.base.Point; //导入依赖的package包/类
private ImageMapType getCitySchemaMapType() {
ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance();
opts.setMinZoom(ZOOM_MIN);
opts.setMaxZoom(ZOOM_MAX);
opts.setName(MAP_TYPE_ID);
opts.setTileSize(Size.newInstance(TILE_SIZE, TILE_SIZE));
opts.setTileUrl((point, zoomLevel) -> {
Point normalizedCoord = getNormalizedCoords(point, zoomLevel);
if (normalizedCoord == null) {
return null;
}
return TILE_IMAGES_PATH + PATH_SEPARATOR
+ (zoomLevel - 2) + PATH_SEPARATOR +
+ (zoomLevel - 2) + TILE_IMAGES_FILE_NAME_SEPARATOR
+ (int) normalizedCoord.getY() + TILE_IMAGES_FILE_NAME_SEPARATOR
+ (int) normalizedCoord.getX() + FILE_EXTENSION_SEPARATOR
+ TILE_IMAGES_FILE_EXTENSION;
});
return ImageMapType.newInstance(opts);
}
示例2: getNormalizedCoords
import com.google.gwt.maps.client.base.Point; //导入依赖的package包/类
private static Point getNormalizedCoords(Point coords, int zoom) {
double x = coords.getX();
double y = coords.getY();
double currentTileRange = BASE_TILE_RANGE << (zoom - 2);
// repeat horizontal
if (x < 0 || x >= currentTileRange) {
//x = (x % currentTileRange + currentTileRange) % currentTileRange;
return null;
}
// repeat vertical
if (y < 0 || y >= currentTileRange) {
//y = (y % currentTileRange + currentTileRange) % currentTileRange;
return null;
}
return Point.newInstance(x, y);
}
示例3: mapTypeFromUIDL
import com.google.gwt.maps.client.base.Point; //导入依赖的package包/类
private ImageMapType mapTypeFromUIDL(UIDL maptypeUIDL) {
int minZoom = maptypeUIDL.getIntAttribute(ATTR_MAPTYPE_MIN_ZOOM);
int maxZoom = maptypeUIDL.getIntAttribute(ATTR_MAPTYPE_MAX_ZOOM);
// String copyright = maptypeUIDL.getStringAttribute(ATTR_MAPTYPE_COPYRIGHT);
String name = maptypeUIDL.getStringAttribute(ATTR_MAPTYPE_NAME);
final String tileUrl = maptypeUIDL.getStringAttribute(ATTR_MAPTYPE_TILE_URL);
// boolean isPng = maptypeUIDL.getBooleanAttribute(ATTR_MAPTYPE_IS_PNG);
double opacity = maptypeUIDL.getDoubleAttribute(ATTR_MAPTYPE_OPACITY);
ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance();
opts.setMaxZoom(maxZoom);
opts.setMinZoom(minZoom);
opts.setName(name);
opts.setOpacity(opacity);
opts.setTileSize(Size.newInstance(256d, 256d));
opts.setTileUrl(new TileUrlCallBack() {
@Override
public String getTileUrl(Point point, int zoomLevel) {
return tileUrl;
}
});
return ImageMapType.newInstance(opts);
}
示例4: addMapMarker
import com.google.gwt.maps.client.base.Point; //导入依赖的package包/类
@Override
public void addMapMarker(Position position) {
if (myLocationMarker != null) {
myLocationMarker.setMap((MapWidget) null);
}
if (myLocationError != null){
myLocationError.setMap(null);
}
LatLng center = LatLng.newInstance(position.getCoordinates().getLatitude(), position.getCoordinates().getLongitude());
MarkerOptions options = MarkerOptions.newInstance();
options.setPosition(center);
MarkerImage icon = MarkerImage.newInstance(AppBundle.INSTANCE.myLocationPNG().getSafeUri().asString());
icon.setAnchor(Point.newInstance(11, 11));
options.setOptimized(true);
options.setIcon(icon);
myLocationMarker = Marker.newInstance(options);
myLocationMarker.setMap(mapWidget);
// create a circle the size of the error
CircleOptions circleOptions = CircleOptions.newInstance();
circleOptions.setFillOpacity(0.1);
circleOptions.setFillColor("#1a75ff");
circleOptions.setStrokeOpacity(0.12);
circleOptions.setStrokeWeight(1);
circleOptions.setStrokeColor("#1a75ff");
myLocationError = Circle.newInstance(circleOptions);
myLocationError.setCenter(center);
myLocationError.setRadius(position.getCoordinates().getAccuracy());
myLocationError.setMap(mapWidget);
}
示例5: addMapMarker
import com.google.gwt.maps.client.base.Point; //导入依赖的package包/类
@Override
public void addMapMarker(Position position) {
if (myLocationMarker != null) {
myLocationMarker.setMap((MapWidget) null);
}
if (myLocationError != null){
myLocationError.setMap(null);
}
LatLng center = LatLng.newInstance(position.getCoordinates().getLatitude(), position.getCoordinates().getLongitude());
MarkerOptions options = MarkerOptions.newInstance();
options.setPosition(center);
MarkerImage icon = MarkerImage.newInstance(AppBundle.INSTANCE.myLocationPNG().getSafeUri().asString());
icon.setAnchor(Point.newInstance(11, 11));
options.setOptimized(true);
options.setIcon(icon);
myLocationMarker = Marker.newInstance(options);
myLocationMarker.setMap(mapWidget);
// create a circle the size of the error
CircleOptions circleOptions = CircleOptions.newInstance();
circleOptions.setFillOpacity(0.1);
circleOptions.setFillColor("#1a75ff");
circleOptions.setStrokeOpacity(0.12);
circleOptions.setStrokeWeight(1);
circleOptions.setStrokeColor("#1a75ff");
myLocationError = Circle.newInstance(circleOptions);
myLocationError.setCenter(center);
myLocationError.setRadius(position.getCoordinates().getAccuracy());
myLocationError.setMap(mapWidget);
}
示例6: createMarker
import com.google.gwt.maps.client.base.Point; //导入依赖的package包/类
private Marker createMarker(JSONMarker jsMarker) {
MarkerImage icon = null;
if (jsMarker.getIcon() != null) {
icon = MarkerImage.newInstance(jsMarker.getIcon());
if (jsMarker.hasOriginPoint())
icon.setOrigin(Point.newInstance(jsMarker.getIconOriginX(), jsMarker.getIconOriginY()));
if (jsMarker.hasAnchorPoint())
icon.setAnchor(Point.newInstance(jsMarker.getIconAnchorX(), jsMarker.getIconAnchorY()));
log(1, "Icon URL '" + jsMarker.getIcon() + "' at anchor point (" + jsMarker.getIconAnchorX() + "," + jsMarker.getIconAnchorY() + ")");
}
log(1, "Title '" + jsMarker.getTitle() + "' position (" + jsMarker.getLat() + "," + jsMarker.getLng() + ") visible " + jsMarker.isVisible());
MarkerOptions mopts = MarkerOptions.newInstance();
mopts.setIcon(icon);
mopts.setTitle(jsMarker.getTitle());
mopts.setDraggable(jsMarker.isDraggable());
mopts.setVisible(jsMarker.isVisible());
if (jsMarker.getAnimation() == null || jsMarker.getAnimation().equals(""))
mopts.setAnimation(Animation.STOPANIMATION);
else
mopts.setAnimation(Animation.fromValue(jsMarker.getAnimation()));
final double lat = jsMarker.getLat();
final double lng = jsMarker.getLng();
if (lat < -90 || lat > 90) {
log(1, "Invalid latitude for marker: " + lat);
return null;
}
if (lng < -180 || lng > 180) {
log(1, "Invalid latitude for marker: " + lat);
return null;
}
mopts.setPosition(LatLng.newInstance(lat, lng));
return Marker.newInstance(mopts);
}