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


Java Pixel类代码示例

本文整理汇总了Java中org.gwtopenmaps.openlayers.client.Pixel的典型用法代码示例。如果您正苦于以下问题:Java Pixel类的具体用法?Java Pixel怎么用?Java Pixel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createInfoPopup

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
public void createInfoPopup(final Map map) {
    EventHandler popupHandler = new EventHandler() {
        @Override
        public void onHandle(EventObject eventObject) {

            if (OpenlayersMarker.this.popup != null) {
                map.removePopup(OpenlayersMarker.this.popup);
            }
            Pixel pixel = new Pixel(0, 0);
            Size size = new Size(300, 200);
            FramedCloud frame = new FramedCloud("marker-info",
                                                OpenlayersMarker.this.coords,
                                                size,
                                                OpenlayersMarker.this.infoTxt,
                                                new Icon("", new Size(0, 0), pixel),
                                                true);
            OpenlayersMarker.this.setPopup(frame);
            map.addPopup(OpenlayersMarker.this.popup);
        }
    };
    //getEvents().register("click", this, popupHandler);
}
 
开发者ID:52North,项目名称:SensorWebClient,代码行数:23,代码来源:OpenlayersMarker.java

示例2: show

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
public void show() {
	if (position == null)
		return;
	Point point = new Point(position.lon(), position.lat());
	vectorFeature = createFeatureFromImageResource(imageResource,
			new Pixel(-10, -39), point, opacity);
	vectorFeature.getAttributes().setAttribute(
			OpenLayersPlannerMapWidget.WAYPOINT_TYPE_KEY, name);
	vectorFeature.getAttributes().setAttribute(
			OpenLayersPlannerMapWidget.WAYPOINT_DRAGGABLE_KEY, draggable);
	layer.addFeature(vectorFeature);
	layer.redraw();
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:14,代码来源:OpenLayersWaypoint.java

示例3: createFeatureFromImageResource

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
private VectorFeature createFeatureFromImageResource(
		ImageResource imageResource, Pixel anchor, Point position,
		double opacity) {
	Style pointStyle = new Style();
	pointStyle.setExternalGraphic(imageResource.getSafeUri().asString());
	pointStyle.setGraphicSize(imageResource.getWidth(),
			imageResource.getHeight());
	pointStyle.setGraphicOffset(anchor.x(), anchor.y());
	pointStyle.setFillOpacity(1.0 * opacity);
	pointStyle.setStrokeOpacity(1.0 * opacity);
	VectorFeature retval = new VectorFeature(position, pointStyle);
	return retval;
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:14,代码来源:OpenLayersWaypoint.java

示例4: handleClickOnMap

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
private void handleClickOnMap(LonLat lonLat, Pixel pixel) {
	if (popupMenu.isShowing()) {
		hidePopupMenu();
		return;
	}
	popupMarker.moveTo(lonLat);
	popupMenuPosition = lonLat;
	popupMenu.setPopupPosition(this.getAbsoluteLeft() + pixel.x() + 2,
			this.getAbsoluteTop() + pixel.y() + 2);
	popupMenu.show();
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:12,代码来源:OpenLayersPlannerMapWidget.java

示例5: getLonLat

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
private LonLat getLonLat(final EventObject eventObject) {
	final JSObject xy = eventObject.getJSObject().getProperty("xy");
	final Pixel px = Pixel.narrowToPixel(xy);
	return geoMap.getMap().getLonLatFromPixel(px);		 
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:6,代码来源:GeoMapInitializer.java

示例6: createFeatureFromMode

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
private VectorFeature createFeatureFromMode(TransportMode mode,
		boolean leftish, Point position, double opacity) {
	ImageResource imageResource;
	switch (mode) {
	case WALK:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplWalkPng()
				: PlannerResources.INSTANCE.modemaprWalkPng();
		break;
	case BICYCLE:
	case BICYCLE_RENTAL: // TODO Make dedicated icon
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplBicyclePng()
				: PlannerResources.INSTANCE.modemaprBicyclePng();
		break;
	case BUS:
		imageResource = leftish ? PlannerResources.INSTANCE.modemaplBusPng()
				: PlannerResources.INSTANCE.modemaprBusPng();
		break;
	case CAR:
		imageResource = leftish ? PlannerResources.INSTANCE.modemaplCarPng()
				: PlannerResources.INSTANCE.modemaprCarPng();
		break;
	case FERRY:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplFerryPng()
				: PlannerResources.INSTANCE.modemaprFerryPng();
		break;
	case GONDOLA:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplGondolaPng()
				: PlannerResources.INSTANCE.modemaprGondolaPng();
		break;
	case PLANE:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplPlanePng()
				: PlannerResources.INSTANCE.modemaprPlanePng();
		break;
	case RAIL:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplRailPng()
				: PlannerResources.INSTANCE.modemaprRailPng();
		break;
	case SUBWAY:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplSubwayPng()
				: PlannerResources.INSTANCE.modemaprSubwayPng();
		break;
	case TRAM:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplTramPng()
				: PlannerResources.INSTANCE.modemaprTramPng();
		break;
	case TROLLEY:
		imageResource = leftish
				? PlannerResources.INSTANCE.modemaplTrolleyPng()
				: PlannerResources.INSTANCE.modemaprTrolleyPng();
		break;
	default:
		return null;
	}
	Style pointStyle = new Style();
	pointStyle.setExternalGraphic(imageResource.getSafeUri().asString());
	pointStyle.setGraphicSize(imageResource.getWidth(),
			imageResource.getHeight());
	Pixel anchor = leftish ? new Pixel(-34, -34) : new Pixel(0, -34);
	pointStyle.setGraphicOffset(anchor.x(), anchor.y());
	pointStyle.setFillOpacity(1.0 * opacity);
	pointStyle.setStrokeOpacity(1.0 * opacity);
	VectorFeature retval = new VectorFeature(position, pointStyle);
	retval.getAttributes().setAttribute(
			OpenLayersPlannerMapWidget.WAYPOINT_DRAGGABLE_KEY, false);
	return retval;
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:75,代码来源:OpenLayersItinerary.java

示例7: updatePOIList

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
public void updatePOIList(String sourceId,
		java.util.Map<String, POIBean> pois) {
	// Remove only POI coming from the same sourceId
	if (layer.getFeatures() != null) {
		for (VectorFeature feature : layer.getFeatures()) {
			String poiSource = feature.getAttributes()
					.getAttributeAsString("sourceId");
			if (poiSource.equals(sourceId))
				layer.removeFeature(feature);
		}
	}
	// Order POI on z-index = latitude
	List<POIBean> poiList = new ArrayList<POIBean>(pois.values());
	Collections.sort(poiList, new Comparator<POIBean>() {
		@Override
		public int compare(POIBean o1, POIBean o2) {
			double delta = o2.getLocation().getLat()
					- o1.getLocation().getLat();
			return delta < 0.0 ? -1 : +1;
		}
	});
	for (POIBean poi : poiList) {
		ImageResource imageResource = POIUtils.getPoiIcon(poi.getType());
		String imageUrl = imageResource.getSafeUri().asString();

		Style pointStyle = new Style();
		pointStyle.setExternalGraphic(imageUrl);
		pointStyle.setGraphicSize(imageResource.getWidth(),
				imageResource.getHeight());
		// HACK ALERT! Assume all POI icons the same size.
		Pixel anchor = new Pixel(-12, -30);
		pointStyle.setGraphicOffset(anchor.x(), anchor.y());
		pointStyle.setFillOpacity(1.0);
		pointStyle.setStrokeOpacity(1.0);
		LonLat position = convertLonLat(poi.getLocation());
		Point point = new Point(position.lon(), position.lat());
		VectorFeature marker = new VectorFeature(point, pointStyle);
		// TODO Set POI name as <h3>title</h3>?
		marker.getAttributes().setAttribute(
				OpenLayersPlannerMapWidget.POPUP_CONTENT_KEY,
				poi.getHtmlDescription());
		marker.getAttributes().setAttribute(
				OpenLayersPlannerMapWidget.POPUP_CLASS_KEY, "poi-popup");
		layer.addFeature(marker);
	}
	layer.setDisplayInLayerSwitcher(!poiList.isEmpty());
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:48,代码来源:OpenLayersPOILayer.java

示例8: createIcon

import org.gwtopenmaps.openlayers.client.Pixel; //导入依赖的package包/类
private Icon createIcon(final GWTMarkerState marker) {
    return new Icon(marker.getImageURL(), new Size(32, 32), new Pixel(-16, -32));
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:OpenLayersMapPanel.java


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