source: osm/applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java@ 26832

Last change on this file since 26832 was 26832, checked in by zverik, 15 years ago

working with arcs was a bad decision. Commit code before I rip all that out

File size: 1.3 KB
Line 
1package relcontext.actions;
2
3import static org.openstreetmap.josm.tools.I18n.tr;
4import java.awt.event.ActionEvent;
5import javax.swing.AbstractAction;
6import org.openstreetmap.josm.Main;
7import org.openstreetmap.josm.command.DeleteCommand;
8import org.openstreetmap.josm.data.osm.Relation;
9import org.openstreetmap.josm.tools.ImageProvider;
10import relcontext.ChosenRelation;
11import relcontext.ChosenRelationListener;
12
13/**
14 * Make a single polygon out of the multipolygon relation. The relation must have only outer members.
15 * @author Zverik
16 */
17public class ReconstructPolygonAction extends AbstractAction implements ChosenRelationListener {
18 private ChosenRelation rel;
19
20 public ReconstructPolygonAction( ChosenRelation rel ) {
21 super(tr("Reconstruct polygon"));
22 putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
23 putValue(LONG_DESCRIPTION, "Reconstruct polygon from multipolygon relation");
24 this.rel = rel;
25 rel.addChosenRelationListener(this);
26 setEnabled(rel.get() != null);
27 }
28
29 public void actionPerformed( ActionEvent e ) {
30 Relation r = rel.get();
31 rel.clear();
32// Main.main.undoRedo.add(new DeleteCommand(r));
33 }
34
35 public void chosenRelationChanged( Relation oldRelation, Relation newRelation ) {
36 setEnabled(newRelation != null); //todo
37 }
38}
Note: See TracBrowser for help on using the repository browser.