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


Java Point类代码示例

本文整理汇总了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);
}
 
开发者ID:baldram,项目名称:tristar-eye,代码行数:24,代码来源:TricitySchemaService.java

示例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);
}
 
开发者ID:baldram,项目名称:tristar-eye,代码行数:21,代码来源:TricitySchemaService.java

示例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);
}
 
开发者ID:wilds,项目名称:GoogleMapWidgetV3,代码行数:26,代码来源:VGoogleMap.java

示例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);

}
 
开发者ID:WSDOT,项目名称:wsdot-mobile-app,代码行数:35,代码来源:TrafficMapViewGwtImpl.java

示例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);
}
 
开发者ID:WSDOT,项目名称:wsdot-mobile-app,代码行数:33,代码来源:VesselWatchMapViewGwtImpl.java

示例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);
        }
 
开发者ID:wilds,项目名称:GoogleMapWidgetV3,代码行数:42,代码来源:VGoogleMap.java


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