Style style = SLD.createSimpleStyle(simpleFeatureSource.getSchema(), Color.GRAY);
Layer layer = new FeatureLayer(simpleFeatureSource, style);
map.addLayer(layer);
JMapPane mapPane = new JMapPane(map);
mapPane.setBackground(Color.WHITE);
mapPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
mapPane.addMapPaneListener(new MapPaneListener() {
@Override
public void onNewMapContent(MapPaneEvent mapPaneEvent) {
//Logger.d("Map Pane New");
}
@Override
public void onDisplayAreaChanged(MapPaneEvent mapPaneEvent) {
//Logger.d("Map Pane Display Area Change");
}
@Override
public void onRenderingStarted(MapPaneEvent mapPaneEvent) {
//Logger.d("Map Pane Rendering Start");
}
@Override
public void onRenderingStopped(MapPaneEvent mapPaneEvent) {
//Logger.d("Map Pane Rendering Stop");
shapeFileRenderingProgressLabel.setVisible(Boolean.FALSE);
}
});
/*
* We use the MigLayout manager to make it easy to manually code
* our UI design
*/
StringBuilder sb = new StringBuilder();
//if (!toolSet.isEmpty()) {
// sb.append("[]"); // fixed size
//}
sb.append("[grow]"); // map pane and optionally layer table fill space
//if (showStatusBar) {
// sb.append("[min!]"); // status bar height
//}
MigLayout migLayout = new MigLayout(
"wrap 1, insets 0", // layout constrains: 1 component per row, no insets
"[grow]", // column constraints: col grows when frame is re-sized
sb.toString());
mapView.setLayout(migLayout);
mapView.add(mapPane, "grow");
mapView.updateUI();
PointSelectedHelper pointSelectedHelper = new PointSelectedHelper();
// Create PopUp menu
PointPopUpMenu pointPopUpMenu = new PointPopUpMenu(pointSelectedHelper, MainView.this);
//Add listener to components that can bring up popup menus.
MapMouseAdapter popupListener = new MapMouseListener(pointPopUpMenu.getPopupMenu(), pointSelectedHelper);
mapPane.addMouseListener(popupListener);
}