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


Java JMapViewer类代码示例

本文整理汇总了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;
}
 
开发者ID:berniejenny,项目名称:MapAnalyst,代码行数:25,代码来源:BingAerialTileSource.java

示例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);
    }
 
开发者ID:GitHubRGI,项目名称:swagd,代码行数:24,代码来源:JMapTree.java

示例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;
	}
}
 
开发者ID:prmr,项目名称:GeoDesk,代码行数:12,代码来源:Tile.java

示例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);
}
 
开发者ID:iwabuchiken,项目名称:freemind_1.0.0_20140624_214725,代码行数:13,代码来源:FreeMindMapController.java

示例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;
}
 
开发者ID:iwabuchiken,项目名称:freemind_1.0.0_20140624_214725,代码行数:18,代码来源:FreeMindMapController.java

示例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);
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:16,代码来源:JMarkerEdit.java

示例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);
}
 
开发者ID:ne0fhyk,项目名称:3DRServices,代码行数:16,代码来源:Map.java

示例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;
    }
}
 
开发者ID:ne0fhyk,项目名称:3DRServices,代码行数:9,代码来源:BingAerialTileSource.java

示例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);
}
 
开发者ID:j-koenig,项目名称:osaft,代码行数:12,代码来源:LocationMapView.java

示例10: getMapViewer

import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public JMapViewer getMapViewer()
{
    return mapViewer;
}
 
开发者ID:RoffelKartoffel,项目名称:cmanager,代码行数:5,代码来源:CacheListView.java

示例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);
}
 
开发者ID:prmr,项目名称:GeoDesk,代码行数:63,代码来源:GeoDesk.java

示例12: map

import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
private JMapViewer map() {
    return treeMap.getViewer();
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:4,代码来源:JMarkerEdit.java

示例13: getViewer

import org.openstreetmap.gui.jmapviewer.JMapViewer; //导入依赖的package包/类
public JMapViewer getViewer(){
    return this.map;
}
 
开发者ID:GitHubRGI,项目名称:swagd,代码行数:4,代码来源:JMapTree.java

示例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);
}
 
开发者ID:GitHubRGI,项目名称:swagd,代码行数:7,代码来源:RadioButtonTree.java

示例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();

}
 
开发者ID:GitHubRGI,项目名称:swagd,代码行数:73,代码来源:MapViewWindow.java


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