• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Bounds类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: finish

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
@Override
protected void finish() {
    if (isFailed() || isCanceled())
        return;
    if (dataSet == null)
        return; // user canceled download or error occurred
    if (dataSet.allPrimitives().isEmpty()) {
        rememberErrorMessage(tr("No data found in this area."));
        // need to synthesize a download bounds lest the visual indication of downloaded
        // area doesn't work
        dataSet.dataSources.add(new DataSource(new Bounds(new LatLon(0, 0)), "i-locate server"));
    }
    saveUploadInfo();
    downloadedData = dataSet;
    Main.debug("[DownloadIlocateTask.DownloadTask.finish] Load data, type: "+type.toString());
    loadData(newLayerName, null);
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:18,代码来源:DownloadIlocateTask.java


示例2: build

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
public BoundedDataSet build(final GeoJsonObject data) {
    dataSet = new DataSet();

    if (data instanceof FeatureCollection) {
        processFeatureCollection((FeatureCollection) data);
    } else if (data instanceof GeometryCollection) {
        processGeometryCollection(null, (GeometryCollection) data);
    } else if (data instanceof Feature) {
        processFeature((Feature) data);
    } else {
        processGeometry(null, data);
    }

    Bounds bounds = null;
    for (OsmPrimitive osmPrimitive : dataSet.allPrimitives()) {
        bounds = mergeBounds(bounds, osmPrimitive);
    }
    return new BoundedDataSet(dataSet, bounds);
}
 
开发者ID:JOSM,项目名称:geojson,代码行数:20,代码来源:DataSetBuilder.java


示例3: paint

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
@Override
public void paint(final Graphics2D g2D, final MapView mv, final Bounds bounds) {
    mv.setDoubleBuffered(true);
    if (tripView) {
        // draw selected road sign's trip
        paintHandler.drawTripData(g2D, mv, selRoadSigns.get(0));
    } else if (dataSet != null) {

        if (!dataSet.getRoadSigns().isEmpty()) {
            // draw road signs
            paintHandler.drawRoadSigns(g2D, mv, dataSet.getRoadSigns(), selRoadSigns);
        } else if (!dataSet.getRoadSignClusters().isEmpty()) {
            // draw road sign clusters
            paintHandler.drawRoadSignClusters(g2D, mv, dataSet.getRoadSignClusters());
        }
    }
}
 
开发者ID:Telenav,项目名称:scoutsigns,代码行数:18,代码来源:ScoutSignsLayer.java


示例4: drawDataSet

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
/**
 * Draws the given data set and selected items to the map.
 *
 * @param graphics a {@code Graphics2D} used to drawing to the map
 * @param mapView the current {@code MapView}
 * @param bounds the current map {@code Bounds}
 * @param dataSet the {@code DataSet} to draw to the map
 * @param items a list of selected items
 */
void drawDataSet(final Graphics2D graphics, final MapView mapView, final Bounds bounds, final DataSet<T> dataSet,
        final List<T> selectedItems) {
    final int zoom = Util.zoom(bounds);
    final Composite originalComposite = graphics.getComposite();
    final Stroke originalStroke = graphics.getStroke();
    if (zoom <= Config.getInstance().getMaxClusterZoom()) {
        if (dataSet.getClusters() != null && !dataSet.getClusters().isEmpty()) {
            drawClusters(graphics, mapView, dataSet.getClusters(), zoom, getClusterColor());
        }
    } else {
        if (dataSet.getItems() != null && !dataSet.getItems().isEmpty()) {
            drawItems(graphics, mapView, dataSet.getItems(), selectedItems);
        }
    }
    graphics.setComposite(originalComposite);
    graphics.setStroke(originalStroke);
}
 
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:27,代码来源:PaintHandler.java


示例5: execute

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
public void execute(List<Note> dataset, Bounds bounds) throws IOException {

        int zoom = OsmUrlToBounds.getZoom(Main.map.mapView.getRealBounds());
        double requestArea = Main.map.mapView.getRealBounds().getArea();

        //API limits requests to 25 square degrees.
        //If zoomed in beyond 16 it is pointless to redownload such a small area.
        if(requestArea > 25 || zoom > 15) {
        	return;
        }

        try {
            List<Note> notes = NotesCapableOsmApi.getNotesApi().getNotesInBoundingBox(bounds);
            dataset.clear();
            dataset.addAll(notes);
        }
        catch(OsmTransferException e) {
        	e.printStackTrace();
        	return;
        }
    }
 
开发者ID:iandees,项目名称:josm-notes,代码行数:22,代码来源:DownloadAction.java


示例6: grabNotes

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
private void grabNotes() {
    if (Main.map == null)
        return;
    MapView mv = Main.map.mapView;
    Bounds bbox = mv.getLatLonBounds(mv.getBounds());

    // Have the user changed view since last time
    boolean active = isActive();
    if (active && (lastBbox == null || !lastBbox.equals(bbox))) {
        if (task != null) {
            task.cancel();
        }

        // wait 500ms before downloading in case the user is in the middle
        // of a pan/zoom
        task = new DownloadNotesTask();
        timer.schedule(task, 500);
        lastBbox = bbox;
    }
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:21,代码来源:NotesPlugin.java


示例7: mergeBounds

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
private Bounds mergeBounds(final Bounds bounds, final LatLon coords) {
    if (bounds == null) {
        return new Bounds(coords);
    } else {
        bounds.extend(coords);
        return bounds;
    }
}
 
开发者ID:JOSM,项目名称:geojson,代码行数:9,代码来源:DataSetBuilder.java


示例8: buildBBox

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
/**
 * Computes the bounding box of the currently visible {@code MapView}.
 *
 * @param mapView the currently visible map view
 * @return a {@code BoundingBox} object
 */
public static BoundingBox buildBBox(final MapView mapView) {
    final Bounds bounds =
            new Bounds(mapView.getLatLon(0, mapView.getHeight()), mapView.getLatLon(mapView.getWidth(), 0));
    return new BoundingBox(bounds.getMax().lat(), bounds.getMin().lat(), bounds.getMax().lon(),
            bounds.getMin().lon());
}
 
开发者ID:Telenav,项目名称:scoutsigns,代码行数:13,代码来源:Util.java


示例9: paint

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
@Override
public void paint(final Graphics2D graphics, final MapView mapView, final Bounds bounds) {
    mapView.setDoubleBuffered(true);
    graphics.setRenderingHints(RENDERING_MAP);
    if (dataSet != null) {
        paintHandler.drawDataSet(graphics, mapView, bounds, dataSet, selectedItems);
    }
}
 
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:9,代码来源:ImproveOsmLayer.java


示例10: run

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
@Override
public void run() {
    if (Main.map != null && Main.map.mapView != null) {
        final Bounds bounds = new Bounds(Main.map.mapView.getLatLon(0, Main.map.mapView.getHeight()),
                Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), 0));

        final BoundingBox bbox = new BoundingBox(bounds.getMax().lat(), bounds.getMin().lat(),
                bounds.getMax().lon(), bounds.getMin().lon());
        final int zoom = Util.zoom(Main.map.mapView.getRealBounds());
        final DataSet<T> result = searchData(bbox, zoom);

        // update UI
        updateUI(result);
    }
}
 
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:16,代码来源:UpdateThread.java


示例11: paint

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
@Override
public void paint(Graphics2D g, MapView mv, Bounds bbox) {
    if (segment != null) {
        g.setColor(color);
        g.setStroke(stroke);

        Point p1 = mv.getPoint(segment.getFirstNode());
        Point p2 = mv.getPoint(segment.getSecondNode());
        Line2D overlappingLine = new Line2D.Double(p1.getX(), p1.getY(),
                                                   p2.getX(), p2.getY());
        g.draw(overlappingLine);
    }
}
 
开发者ID:JOSM,项目名称:ShapeTools,代码行数:14,代码来源:DrawableSegment.java


示例12: getNotesInBoundingBox

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
public List<Note> getNotesInBoundingBox(Bounds bounds) throws OsmTransferException {
	ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
	
	String url = new StringBuilder()
		.append("notes?bbox=")
		.append(bounds.getMin().lon())
		.append(",").append(bounds.getMin().lat())
           .append(",").append(bounds.getMax().lon())
           .append(",").append(bounds.getMax().lat())
           .toString();
	String response = sendRequest("GET", url, null, monitor, false, false);
	return parseNotes(response);
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:14,代码来源:NotesCapableOsmApi.java


示例13: bounds

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
/**
 * Determines the bounds of the current selected layer
 * @return
 */
protected Bounds bounds(){
    MapView mv = Main.map.mapView;
    return new Bounds(
        mv.getLatLon(0, mv.getHeight()),
        mv.getLatLon(mv.getWidth(), 0));
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:11,代码来源:NotesPlugin.java


示例14: setAppletZoom

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
public static void setAppletZoom() {

		KatApplet applet = KaporMenuActionListener.applet;
		if (Main.map != null && applet != null) {
			EastNorth center = Main.map.mapView.getCenter();
			LatLon centerLatLon = Main.map.mapView.getProjection()
					.eastNorth2latlon(center);

			Bounds b = Main.map.mapView.getRealBounds();
			LatLon p1 = b.getMin(), p2 = b.getMax();

			double x = centerLatLon.getX();
			double y = centerLatLon.getY();

			if (16 < x && x < 24 && 47 < y && y < 50) {
				Coordinate newcenter = new Coordinate();
				Coordinate newp1 = new Coordinate(), newp2 = new Coordinate();

				try {
					// Ignore difference between S-JTSK and S-JTSK/03
					JTS.transform(new Coordinate(x, y), newcenter, 
							Projection.etrs89_to_s_jtsk_03);

					JTS.transform(new Coordinate(p1.getX(), p1.getY()), newp1,
							Projection.etrs89_to_s_jtsk_03);
					JTS.transform(new Coordinate(p2.getX(), p2.getY()), newp2,
							Projection.etrs89_to_s_jtsk_03);
				} catch (TransformException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				double width = Math.abs(newp1.x - newp2.x);
				if (width < 1)
					width = 1;

				applet.zoomWidth(-newcenter.x, -newcenter.y, width, "M");
			}
		}
	}
 
开发者ID:MilanNobonn,项目名称:freemapKaPor,代码行数:41,代码来源:KaporZoomChangeListener.java


示例15: download

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
@Override
public Future<?> download(boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor) {
    return null;
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:5,代码来源:DownloadIlocateTask.java


示例16: getBounds

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
public Bounds getBounds() {
    return this.bounds;
}
 
开发者ID:JOSM,项目名称:geojson,代码行数:4,代码来源:GeoJsonLayer.java


示例17: BoundedDataSet

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
public BoundedDataSet(final DataSet dataSet, final Bounds bounds) {
    this.dataSet = dataSet;
    this.bounds = bounds;
}
 
开发者ID:JOSM,项目名称:geojson,代码行数:5,代码来源:DataSetBuilder.java


示例18: paint

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
@Override
public void paint(Graphics2D g, MapView mv, Bounds box) {
	Rendering painter = MapRendererFactory.getInstance().createActiveRenderer(g, mv, false);
	painter.render(data, false, box);
}
 
开发者ID:iandees,项目名称:josm-geojson,代码行数:6,代码来源:GeoJsonLayer.java


示例19: zoom

import org.openstreetmap.josm.data.Bounds; //导入依赖的package包/类
/**
 * Returns the zoom level based on the given bounds.
 *
 * @param bounds the map bounds
 * @return an integer
 */
public static int zoom(final Bounds bounds) {
    return Main.map.mapView.getScale() >= ZOOM1_SCALE ? 1 : (int) Math.min(MAX_ZOOM,
            Math.max(MIN_ZOOM, Math.round(Math.floor(Math.log(TILE_SIZE / bounds.asRect().height) / Math.log(2)))));
}
 
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:11,代码来源:Util.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GETATTR3Request类代码示例发布时间:2022-05-22
下一篇:
Java BasicType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap