當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。