Changeset 32109 in osm
- Timestamp:
- 2016-03-09T17:13:00+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/Beam.java
r32103 r32109 6 6 public class Beam 7 7 { 8 public Beam(double width, CorridorPart.ReachableSide defaultSide) 9 { 8 public Beam(Vector<Double> blueprint, double blueprintOffset, CorridorPart.ReachableSide defaultSide) 9 { 10 offset = blueprintOffset; 10 11 parts = new Vector<CorridorPart>(); 11 12 12 setDefaultSide_(defaultSide); 13 addCorridorPart_(true, width); 13 setDefaultSide_(defaultSide); 14 if (defaultSide == CorridorPart.ReachableSide.RIGHT) 15 { 16 for (int i = 1; i < blueprint.size(); i += 2) 17 { 18 addCorridorPart_(true, CorridorPart.Type.WALL, 19 blueprint.elementAt(i).doubleValue() - blueprint.elementAt(i-1).doubleValue()); 20 if (i+1 < blueprint.size()) 21 addCorridorPart_(true, CorridorPart.Type.VOID, 22 blueprint.elementAt(i+1).doubleValue() - blueprint.elementAt(i).doubleValue()); 23 } 24 } 25 else 26 { 27 for (int i = 1; i < blueprint.size(); i += 2) 28 { 29 addCorridorPart_(true, CorridorPart.Type.PASSAGE, 30 blueprint.elementAt(i).doubleValue() - blueprint.elementAt(i-1).doubleValue()); 31 if (i+1 < blueprint.size()) 32 addCorridorPart_(true, CorridorPart.Type.VOID, 33 blueprint.elementAt(i+1).doubleValue() - blueprint.elementAt(i).doubleValue()); 34 } 35 } 14 36 adjustStripCache(); 15 37 } … … 19 41 { 20 42 this.defaultSide = defaultSide; 21 defaultType = defaultSide == CorridorPart.ReachableSide.RIGHT ?22 CorridorPart.Type.WALL : CorridorPart.Type.PASSAGE;23 43 } 24 44 … … 34 54 return parts; 35 55 } 36 37 38 private void addCorridorPart_(boolean append, double width) 56 57 58 public double getBeamOffset() 59 { 60 return offset; 61 } 62 63 public void setBeamOffset(double beamOffset) 64 { 65 offset = beamOffset; 66 } 67 68 69 private void addCorridorPart_(boolean append, CorridorPart.Type type, double width) 39 70 { 40 71 CorridorPart.ReachableSide side = defaultSide == CorridorPart.ReachableSide.RIGHT ? … … 42 73 43 74 if (append) 44 parts.add(new CorridorPart(width, defaultType, side));45 else 46 parts.add(0, new CorridorPart(width, defaultType, side));75 parts.add(new CorridorPart(width, type, side)); 76 else 77 parts.add(0, new CorridorPart(width, type, side)); 47 78 } 48 79 49 80 public void addCorridorPart(boolean append, double width) 50 81 { 51 addCorridorPart_(append, width); 82 addCorridorPart_(append, 83 defaultSide == CorridorPart.ReachableSide.RIGHT ? CorridorPart.Type.WALL : CorridorPart.Type.PASSAGE, 84 width); 52 85 adjustStripCache(); 53 86 } … … 177 210 178 211 212 private double offset; 179 213 private Vector<CorridorPart> parts; 180 214 private Vector<StripPosition> lhsStrips; … … 314 348 315 349 316 private CorridorPart.Type defaultType;317 350 private CorridorPart.ReachableSide defaultSide; 318 351 } -
applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/BeamGeography.java
r32103 r32109 46 46 47 47 48 public void adjustNodes(LatLon pivot, Vector<CorridorPart> parts )48 public void adjustNodes(LatLon pivot, Vector<CorridorPart> parts, double beamOffset) 49 49 { 50 double offset = -beamOffset; 50 51 this.parts = parts; 51 adjustNode(0, new LatLon(pivot.lat(), pivot.lon())); 52 53 adjustNode(0, new LatLon(addMetersToLat(pivot, offset), pivot.lon())); 52 54 53 double offset = 0;54 55 for (int i = 0; i < parts.size(); ++i) 55 56 { -
applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/IndoorSweeplineController.java
r32103 r32109 73 73 } 74 74 75 public double getBeamOffset(int index) 76 { 77 return model.getBeamOffset(index); 78 } 79 80 public void setBeamOffset(int index, double beamOffset) 81 { 82 model.setBeamOffset(index, beamOffset); 83 } 84 75 85 public List<CorridorPart> getBeamParts(int index) 76 86 { -
applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/IndoorSweeplineModel.java
r32107 r32109 11 11 12 12 /* TODO: 13 - offset14 - replicate last stopline15 13 - focus to useful table entry after cell edit 16 14 - keyboard shortcuts … … 63 61 for (int i = 0; i < strips.size(); ++i) 64 62 offset += strips.elementAt(i).width; 65 66 beams.add(new Beam(width, side)); 63 64 if (strips.size() == 0) 65 { 66 Vector<Double> blueprint = new Vector<Double>(); 67 blueprint.addElement(0.); 68 blueprint.addElement(10.); 69 beams.add(new Beam(blueprint, 0., side)); 70 } 71 else 72 beams.add(new Beam(strips.elementAt(strips.size()-1).lhs, 73 beams.elementAt(beams.size()-1).getBeamOffset(), side)); 67 74 68 75 if (strips.size() > 0) … … 128 135 strips.elementAt(index / 2).width = value; 129 136 137 updateOsmModel(); 138 } 139 140 141 public double getBeamOffset(int index) 142 { 143 return beams.elementAt(index / 2).getBeamOffset(); 144 } 145 146 public void setBeamOffset(int index, double beamOffset) 147 { 148 beams.elementAt(index / 2).setBeamOffset(beamOffset); 130 149 updateOsmModel(); 131 150 } -
applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/IndoorSweeplineWizardDialog.java
r32103 r32109 54 54 panel.add(new JButton(next), 2, 2, 2, 1); 55 55 56 panel.add( new JLabel(tr("Strip width:")), 0, 3, 3, 1);56 panel.add(makeWidthLabel(), 0, 3, 3, 1); 57 57 panel.add(makeWidthField(), 3, 3, 1, 1); 58 58 … … 85 85 try 86 86 { 87 stripWidth.setEditable(beamIndex % 2 == 1);88 87 if (beamIndex % 2 == 0) 89 stripWidth.setText("---"); 88 { 89 widthOffsetLabel.setText("Offset into background:"); 90 stripWidth.setText(Double.toString(controller.getBeamOffset(beamIndex))); 91 } 90 92 else 93 { 94 widthOffsetLabel.setText("Strip width:"); 91 95 stripWidth.setText(Double.toString(controller.getStripWidth(beamIndex))); 96 } 92 97 } 93 98 catch (IllegalStateException ex) … … 364 369 365 370 371 private JLabel widthOffsetLabel; 372 373 private JLabel makeWidthLabel() 374 { 375 widthOffsetLabel = new JLabel(tr("Offset into background:")); 376 return widthOffsetLabel; 377 } 378 379 366 380 private JTextField stripWidth; 367 381 … … 399 413 try 400 414 { 401 if (beamIndex % 2 == 1) 415 if (beamIndex % 2 == 0) 416 controller.setBeamOffset(beamIndex, Double.parseDouble(stripWidth.getText())); 417 else 402 418 controller.setStripWidth(beamIndex, Double.parseDouble(stripWidth.getText())); 403 419 } -
applications/editors/josm/plugins/indoor_sweepline/src/indoor_sweepline/ModelGeography.java
r32107 r32109 76 76 beamsGeography.setElementAt(new BeamGeography(dataSet, this), i); 77 77 beamsGeography.elementAt(i).adjustNodes(new LatLon(center.lat(), addMetersToLon(center, offset)), 78 beams.elementAt(i).getBeamParts() );78 beams.elementAt(i).getBeamParts(), beams.elementAt(i).getBeamOffset()); 79 79 80 80 if (i < strips.size())
Note:
See TracChangeset
for help on using the changeset viewer.