本文整理汇总了Java中org.openstreetmap.gui.jmapviewer.JMapViewer类的典型用法代码示例。如果您正苦于以下问题:Java JMapViewer类的具体用法?Java JMapViewer怎么用?Java JMapViewer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JMapViewer类属于org.openstreetmap.gui.jmapviewer包,在下文中一共展示了JMapViewer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributionImage
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
@Override
public Image getAttributionImage() {
try {
final InputStream imageResource = JMapViewer.class.getResourceAsStream("images/bing_maps.png");
if (imageResource != null) {
return ImageIO.read(imageResource);
} else {
// Some Linux distributions (like Debian) will remove Bing logo from sources, so get it at runtime
for (int i = 0; i < 5 && getAttribution() == null; i++) {
// Makes sure attribution is loaded
if (JMapViewer.debug) {
System.out.println("Bing attribution attempt " + (i+1));
}
}
if (brandLogoUri != null && !brandLogoUri.isEmpty()) {
System.out.println("Reading Bing logo from "+brandLogoUri);
return ImageIO.read(new URL(brandLogoUri));
}
}
} catch (IOException e) {
System.err.println("Error while retrieving Bing logo: "+e.getMessage());
}
return null;
}
示例2: JMapTree
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public JMapTree(final List<TileStoreReader> stores, final boolean treeVisible, final JMapViewer map){
super();
this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
this.map = map;
this.tree = new RadioButtonTree(stores, this.map);
this.treePanel = new JPanel();
// this.treePanel.setLayout(new BorderLayout());
// this.treePanel.add(this.tree, BorderLayout.CENTER);
// this.treePanel.add(new JLabel("<html><center>Use right mouse button to<br />show/hide texts</center></html>"), BorderLayout.SOUTH);
// this.splitPane.setOneTouchExpandable(true);
// this.splitPane.setDividerLocation(150);
//Provide minimum sizes for the two components in the split pane
// Dimension minimumSize = new Dimension(100, 50);
//tree.setMinimumSize(minimumSize);
// this.map.setMinimumSize(minimumSize);
this.createRefresh();
this.setLayout(new BorderLayout());
this.setTreeVisible(treeVisible);
}
示例3: loadImage
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
private static BufferedImage loadImage(String pRelativePath)
{
try
{
return ImageIO.read(JMapViewer.class.getResourceAsStream(pRelativePath));
}
catch(IOException e)
{
return null;
}
}
示例4: actionPerformed
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public void actionPerformed(ActionEvent pE) {
Coordinate mapCenter = getMap().getPosition();
int zoom = getMap().getZoom() + mZoomDelta;
if (zoom < JMapViewer.MIN_ZOOM) {
zoom = JMapViewer.MIN_ZOOM;
}
if (zoom > getMaxZoom()) {
zoom = getMaxZoom();
}
map.setDisplayPositionByLatLon(mapCenter.getLat(),
mapCenter.getLon(), zoom);
}
示例5: changeTileSource
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
/**
* @param pTileSource
* @param pMap
* if found, the map tile source is set. Set null, if you don't
* want this.
* @return null, if the string is not found.
*/
public static TileSource changeTileSource(String pTileSource,
JMapViewer pMap) {
logger.fine("Searching for tile source " + pTileSource);
TileSourceStore tileSource = getTileSourceByName(pTileSource);
if (tileSource != null && pMap != null) {
pMap.setTileSource(tileSource.mTileSource);
return tileSource.mTileSource;
}
return null;
}
示例6: editMarker
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public void editMarker(Geolayer layer, Geomarker marker) {
Coordinate coordinate = new Coordinate(marker.getLatitude(), marker.getLongtitude());
Layer mapLayer = new Layer(layer.getName());
mapLayer.setVisibleTexts(Boolean.TRUE);
Style markerStyle = new Style();
markerStyle.setColor(Color.GRAY);
markerStyle.setBackColor(layer.getColor());
mapMarker = new MapMarkerDot(mapLayer, marker.getName(), coordinate, markerStyle);
if (layer.getIcon() != null) {
map().addMapMarker(new IconMarker(mapMarker.getLayer(), mapMarker.getCoordinate(), layer.getIcon()));
} else {
map().addMapMarker(mapMarker);
}
map().setDisplayPosition(coordinate, JMapViewer.MAX_ZOOM / 2);
}
示例7: Map
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public Map() {
map = new JMapViewer();
try {
map.setTileLoader(new OsmFileCacheTileLoader(map));
map.setTileSource(new OsmTileSource.CycleMap());
} catch (SecurityException | IOException e) {
e.printStackTrace();
}
marker = new MapMarkerIcon(new Coordinate(-29, -51));
map.addMapMarker(marker);
guidedMarker = new MapMarkerDot(new Coordinate(0, 0));
guidedMarker.setVisible(false);
map.addMapMarker(guidedMarker);
}
示例8: getAttributionImage
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
@Override
public Image getAttributionImage() {
try {
return ImageIO.read(JMapViewer.class.getResourceAsStream("images/bing_maps.png"));
} catch (IOException e) {
return null;
}
}
示例9: initGui
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public void initGui() {
mainPanel = new JPanel(new BorderLayout());
positionLabel = new JLabel();
instructionLabel = new JLabel("Right Mouse To Move, Mousewheel To Zoom", JLabel.RIGHT);
mainPanel.add(positionLabel, BorderLayout.SOUTH);
// mainPanel.add(instructionLabel, BorderLayout.NORTH);
map = new JMapViewer();
map.addMouseListener(this);
map.addMouseMotionListener(this);
mainPanel.add(map);
}
示例10: getMapViewer
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public JMapViewer getMapViewer()
{
return mapViewer;
}
示例11: GeoDesk
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
/**
* Build and launch the application.
*/
public GeoDesk()
{
super(APP_NAME + " - " + MESSAGES.getString("app.map.osm"));
aMap = new JMapViewer();
aMap.addJMVListener(this);
aMap.setTileSource(aTileSources[3]);
buildMenus();
setLayout(new BorderLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
add(aMap, BorderLayout.CENTER);
MarkerData[] lData = null;
try
{
String lFile = SettingManager.getInstance().getDataFileName();
if( lFile != null && new File(lFile).exists() )
{
lData = JSONPersistence.loadMarkers(lFile);
}
}
catch( Exception e )
{
e.printStackTrace();
}
if( lData!= null )
{
for( MarkerData lPoint : lData )
{
aMap.addMapMarker(new MapMarkerDot(lPoint.getLatitude(), lPoint.getLongitude(),
lPoint.getName(), lPoint.getDescription()));
}
}
// So that the map layout runs in the AWT event thread.
addWindowListener(new WindowAdapter()
{
@Override
public void windowOpened(WindowEvent pEvent)
{
super.windowOpened(pEvent);
aMap.setDisplayToFitMapMarkers();
String lDataFileName = SettingManager.getInstance().getDataFileName();
if( lDataFileName == null )
{
lDataFileName = SettingManager.getInstance().getDefaultDataFileName();
SettingManager.getInstance().setDataFileName(lDataFileName);
JOptionPane.showMessageDialog(aMap, MESSAGES.getString("app.map.message.defaultfile1") +
lDataFileName + MESSAGES.getString("app.map.message.defaultfile2"),
MESSAGES.getString("app.dialogtitle.markerdatalocation"), JOptionPane.INFORMATION_MESSAGE);
}
}
});
setVisible(true);
}
示例12: map
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
private JMapViewer map() {
return treeMap.getViewer();
}
示例13: getViewer
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public JMapViewer getViewer(){
return this.map;
}
示例14: RadioButtonTree
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public RadioButtonTree(final List<TileStoreReader> stores, final JMapViewer map)
{
this.map = map;
this.mainGroup = new ButtonGroup();
this.addGroup(stores);
}
示例15: MapViewWindow
import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
/**
* Constructor
*
* @param tileStoreReaders
* Tile stores to display
*/
public MapViewWindow(final Collection<TileStoreReader> tileStoreReaders)
{
super("Tile Viewer");
if(tileStoreReaders == null)
{
throw new IllegalArgumentException("Tile store reader collection may not be null");
}
if(tileStoreReaders.isEmpty())
{
throw new IllegalArgumentException("There must be at least one Tile Store reader to display.");
}
this.tileStoreReaders = tileStoreReaders;
this.viewer = new JMapViewer();
this.addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(final WindowEvent windowEvent)
{
MapViewWindow.this.cleanUpResources();
}
});
this.viewer.addJMVListener(this);
this.setLayout(new BorderLayout());
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
new DefaultMapController(this.viewer).setMovementMouseButton(MouseEvent.BUTTON1);
//add tile grid checkbox
final JCheckBox showTileGrid = new JCheckBox("Tile grid visible");
this.addCheckboxForTileGridLines(showTileGrid);
//this adds a button to set the display to the center at the lowest integer zoom level
final JButton backToCenterButton = new JButton("Center");
backToCenterButton.setHorizontalAlignment(SwingConstants.LEFT);
this.addCenterButton(backToCenterButton);
//add Listener for the current coordinate
this.mouseCoordinateListener();
//create North panel and add components
final JPanel northPanel = new JPanel();
final JPanel panelTop = new JPanel();
//West Panel
final JPanel westPanel = new JPanel();
//Set list of tileStore Radio Buttons
this.eastPanel.setLayout(new BorderLayout());
this.setListOfTileStores(westPanel);
this.add(northPanel, BorderLayout.NORTH);
northPanel.setLayout(new BorderLayout());
northPanel.add(panelTop, BorderLayout.NORTH);
panelTop.add(backToCenterButton);
panelTop.add(showTileGrid);
this.setSize(950, 800);
this.repaint();
}