1
Я использую Geotools, у меня есть основной Jframe, и я использую JMapPan для отображения карты. но у меня проблемы с панелью инструментов, как добавить кнопку курсора и кнопку для определения функций. Я просто добавил кнопки масштабирования. Исходный код:MapPane geotools
final MapContent map = new MapContent();
map.setTitle("The Map");
Layer rasterLayer = new GridReaderLayer(reader, rasterStyle);
map.addLayer(rasterLayer);
Layer shpLayer = new FeatureLayer(shapefileSource, shpStyle);
map.addLayer(shpLayer);
JMapPane mapPane = new JMapPane(map);
JFrame frame = new JFrame("The Map");
frame.setLayout(new BorderLayout());
frame.add(mapPane, BorderLayout.CENTER);
JPanel buttons = new JPanel();
JButton zoomInButton = new JButton(new ZoomInAction(mapPane));
buttons.add(zoomInButton);
JButton zoomOutButton = new JButton(new ZoomOutAction(mapPane));
buttons.add(zoomOutButton);
JButton pamButton = new JButton(new PanAction(mapPane));
buttons.add(pamButton);
//how to add cursor button and identify features button.
frame.add(buttons, BorderLayout.NORTH);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(600, 400);
frame.setVisible(true);