本文整理汇总了Java中org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle类的典型用法代码示例。如果您正苦于以下问题:Java MapRectangle类的具体用法?Java MapRectangle怎么用?Java MapRectangle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapRectangle类属于org.openstreetmap.gui.jmapviewer.interfaces包,在下文中一共展示了MapRectangle类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JMapViewer
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
/**
* Creates a new {@link JMapViewer} instance.
* @param tileCache The cache where to store tiles
*
*/
public JMapViewer(TileCache tileCache) {
tileSource = new OsmTileSource.Mapnik();
tileController = new TileController(tileSource, tileCache, this);
mapMarkerList = Collections.synchronizedList(new LinkedList<MapMarker>());
mapPolygonList = Collections.synchronizedList(new LinkedList<MapPolygon>());
mapRectangleList = Collections.synchronizedList(new LinkedList<MapRectangle>());
mapMarkersVisible = true;
mapRectanglesVisible = true;
mapPolygonsVisible = true;
tileGridVisible = false;
setLayout(null);
initializeZoomSlider();
setMinimumSize(new Dimension(tileSource.getTileSize(), tileSource.getTileSize()));
setPreferredSize(new Dimension(400, 400));
setDisplayPosition(new Coordinate(50, 9), 3);
}
示例2: paintRectangle
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
/**
* Paint a single rectangle.
* @param g Graphics used for painting
* @param rectangle rectangle to paint
*/
protected void paintRectangle(Graphics g, MapRectangle rectangle) {
Coordinate topLeft = rectangle.getTopLeft();
Coordinate bottomRight = rectangle.getBottomRight();
if (topLeft != null && bottomRight != null) {
Point pTopLeft = getMapPosition(topLeft, false);
Point pBottomRight = getMapPosition(bottomRight, false);
if (pTopLeft != null && pBottomRight != null) {
rectangle.paint(g, pTopLeft, pBottomRight);
if (scrollWrapEnabled) {
int tilesize = tileSource.getTileSize();
int mapSize = tilesize << zoom;
int xTopLeftSave = pTopLeft.x;
int xTopLeftWrap = xTopLeftSave;
int xBottomRightSave = pBottomRight.x;
int xBottomRightWrap = xBottomRightSave;
while ((xBottomRightWrap -= mapSize) >= 0) {
xTopLeftWrap -= mapSize;
pTopLeft.x = xTopLeftWrap;
pBottomRight.x = xBottomRightWrap;
rectangle.paint(g, pTopLeft, pBottomRight);
}
xTopLeftWrap = xTopLeftSave;
xBottomRightWrap = xBottomRightSave;
while ((xTopLeftWrap += mapSize) <= getWidth()) {
xBottomRightWrap += mapSize;
pTopLeft.x = xTopLeftWrap;
pBottomRight.x = xBottomRightWrap;
rectangle.paint(g, pTopLeft, pBottomRight);
}
}
}
}
}
示例3: paintRectangle
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
/**
* Paint a single rectangle.
*/
protected void paintRectangle(Graphics g, MapRectangle rectangle) {
Coordinate topLeft = rectangle.getTopLeft();
Coordinate bottomRight = rectangle.getBottomRight();
if (topLeft != null && bottomRight != null) {
Point pTopLeft = getMapPosition(topLeft, false);
Point pBottomRight = getMapPosition(bottomRight, false);
if (pTopLeft != null && pBottomRight != null) {
rectangle.paint(g, pTopLeft, pBottomRight);
if (scrollWrapEnabled) {
int tilesize = tileSource.getTileSize();
int mapSize = tilesize << zoom;
int xTopLeftSave = pTopLeft.x;
int xTopLeftWrap = xTopLeftSave;
int xBottomRightSave = pBottomRight.x;
int xBottomRightWrap = xBottomRightSave;
while ((xBottomRightWrap -= mapSize) >= 0) {
xTopLeftWrap -= mapSize;
pTopLeft.x = xTopLeftWrap;
pBottomRight.x = xBottomRightWrap;
rectangle.paint(g, pTopLeft, pBottomRight);
}
xTopLeftWrap = xTopLeftSave;
xBottomRightWrap = xBottomRightSave;
while ((xTopLeftWrap += mapSize) <= getWidth()) {
xBottomRightWrap += mapSize;
pTopLeft.x = xTopLeftWrap;
pBottomRight.x = xBottomRightWrap;
rectangle.paint(g, pTopLeft, pBottomRight);
}
}
}
}
}
示例4: setMapRectangleList
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
/**
* Sets the list of {@link MapRectangle}s.
* @param mapRectangleList list of {@link MapRectangle}s
*/
public void setMapRectangleList(List<MapRectangle> mapRectangleList) {
this.mapRectangleList = mapRectangleList;
repaint();
}
示例5: addMapRectangle
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
/**
* Add a {@link MapRectangle}.
* @param rectangle map rectangle to add
*/
public void addMapRectangle(MapRectangle rectangle) {
mapRectangleList.add(rectangle);
repaint();
}
示例6: removeMapRectangle
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
/**
* Remove a {@link MapRectangle}.
* @param rectangle map rectangle to remove
*/
public void removeMapRectangle(MapRectangle rectangle) {
mapRectangleList.remove(rectangle);
repaint();
}
示例7: setMapRectangleList
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
public void setMapRectangleList(List<MapRectangle> mapRectangleList) {
this.mapRectangleList = mapRectangleList;
repaint();
}
示例8: getMapRectangleList
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
public List<MapRectangle> getMapRectangleList() {
return mapRectangleList;
}
示例9: addMapRectangle
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
public void addMapRectangle(MapRectangle rectangle) {
mapRectangleList.add(rectangle);
repaint();
}
示例10: removeMapRectangle
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
public void removeMapRectangle(MapRectangle rectangle) {
mapRectangleList.remove(rectangle);
repaint();
}
示例11: getMapRectangleList
import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; //导入依赖的package包/类
/**
* Returns the list of {@link MapRectangle}s.
* @return list of {@link MapRectangle}s
*/
public List<MapRectangle> getMapRectangleList() {
return mapRectangleList;
}