Changeset 32107 in osm for applications


Ignore:
Timestamp:
2016-03-09T11:38:38+01:00 (9 years ago)
Author:
roland
Message:

Fixed various bugs (see git repo)

Location:
applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/CorridorGeography.java

    r32103 r32107  
    1717   
    1818   
    19     private void setExtraElements(CorridorPart.ReachableSide side, LatLon from, LatLon to, boolean extraWayUp)
     19    private static final double MIN_LENGTH = 10.;
     20   
     21   
     22    private void setExtraElements(CorridorPart.ReachableSide side, LatLon from, LatLon to,
     23        boolean extraWayUp, double minLength)
    2024    {
    2125        LatLon middleCoor = new LatLon((from.lat() + to.lat())/2.,
     
    5256           
    5357        double scale = Math.cos(middleCoor.lat() * (Math.PI/180.));
    54         LatLon detachedCoor = new LatLon(middleCoor.lat() + (start.lon() - middleCoor.lon()) * scale,
    55             middleCoor.lon() - (start.lat() - middleCoor.lat()) / scale);
     58        double length = Math.sqrt((start.lat() - middleCoor.lat()) * (start.lat() - middleCoor.lat()) +
     59            (start.lon() - middleCoor.lon()) * (start.lon() - middleCoor.lon()) * scale * scale) / 180. * 20000000.;
     60        double lengthFactor = length < minLength ? minLength / length : 1.;
     61        LatLon detachedCoor = new LatLon(middleCoor.lat() + (start.lon() - middleCoor.lon()) * scale * lengthFactor,
     62            middleCoor.lon() - (start.lat() - middleCoor.lat()) / scale * lengthFactor);
    5663        if (detachedNode == null)
    5764        {
     
    8996        if (type == CorridorPart.Type.STAIRS_UP || type == CorridorPart.Type.STAIRS_DOWN)
    9097        {
    91             setExtraElements(side, from, to, type == CorridorPart.Type.STAIRS_UP);
     98            setExtraElements(side, from, to, type == CorridorPart.Type.STAIRS_UP, MIN_LENGTH);
    9299            target.appendNode(middleNode);
    93100
     
    109116                type == CorridorPart.Type.ESCALATOR_UP_LEAVING
    110117                || type == CorridorPart.Type.ESCALATOR_UP_ARRIVING
    111                 || type == CorridorPart.Type.ESCALATOR_UP_BIDIRECTIONAL);
     118                || type == CorridorPart.Type.ESCALATOR_UP_BIDIRECTIONAL, MIN_LENGTH);
    112119            target.appendNode(middleNode);
    113120
     
    129136        else if (type == CorridorPart.Type.ELEVATOR)
    130137        {
    131             setExtraElements(side, from, to, true);
     138            setExtraElements(side, from, to, true, 0.);
    132139            target.appendNode(middleNode);
    133140
  • applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/IndoorSweepline.java

    r32103 r32107  
    2424    {
    2525        JMenu menu = Main.main.menu.moreToolsMenu;
    26         menu.addSeparator();
     26        if (menu.isVisible())
     27            menu.addSeparator();
     28        else
     29            menu.setVisible(true);
    2730        menu.add(new JMenuItem(new IndoorSweeplineWizardAction()));
    2831    }
  • applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/IndoorSweeplineModel.java

    r32103 r32107  
    88import org.openstreetmap.josm.data.osm.DataSet;
    99import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     10
     11
     12/* TODO:
     13- offset
     14- replicate last stopline
     15- focus to useful table entry after cell edit
     16- keyboard shortcuts
     17*/
    1018
    1119
  • applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/ModelGeography.java

    r32103 r32107  
    227227            {
    228228                multipolygon = new Relation();
    229                 dataSet.addPrimitive(multipolygon);
    230                
    231                 multipolygon.removeAll();
    232                 multipolygon.put("type", "multipolygon");
    233                 addPolygonTags(type, level, multipolygon);
     229                dataSet.addPrimitive(multipolygon);             
    234230            }
     231           
     232            multipolygon.removeAll();
     233            multipolygon.put("type", "multipolygon");
     234            addPolygonTags(type, level, multipolygon);
     235           
    235236            multipolygon.setMembers(members);
    236237        }
Note: See TracChangeset for help on using the changeset viewer.