Changeset 28326 in osm for applications/editors
- Timestamp:
- 2012-04-19T19:58:40+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java
r28318 r28326 1164 1164 1165 1165 // Temp 1166 if (firstNode != null)1166 /* if (firstNode != null) 1167 1167 { 1168 1168 Vector< AStarAlgorithm.Edge > path = new PublicTransportAStar(firstNode, lastNode).shortestPath(); … … 1178 1178 System.out.print("\n"); 1179 1179 } 1180 } 1180 }*/ 1181 1181 } 1182 1182 else if ("routePattern.overviewDelete".equals(event.getActionCommand())) … … 1570 1570 StopReference sr = detectMinDistance 1571 1571 (curMember.getNode(), segmentMetrics, cbRight.isSelected(), cbLeft.isSelected()); 1572 double offset = segmentMetrics.elementAt((sr.index+1) / 2).distance; 1573 if (sr.index % 2 == 0) 1574 offset += sr.pos; 1575 stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole(), offset); 1572 stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole(), 1573 calcOffset(sr, segmentMetrics)); 1576 1574 if (insPos >= 0) 1577 1575 ++insPos; … … 1591 1589 StopReference sr = detectMinDistance 1592 1590 (curMember, segmentMetrics, cbRight.isSelected(), cbLeft.isSelected()); 1593 double offset = segmentMetrics.elementAt((sr.index+1) / 2).distance; 1594 if (sr.index % 2 == 0) 1595 offset += sr.pos; 1596 stoplistData.insertRow(insPos, curMember, "", offset); 1591 stoplistData.insertRow(insPos, curMember, "", calcOffset(sr, segmentMetrics)); 1597 1592 if (insPos >= 0) 1598 1593 ++insPos; … … 1640 1635 { 1641 1636 StopReference sr = detectMinDistance 1642 (stoplistData.nodes.elementAt(i), segmentMetrics,1643 cbRight.isSelected(), cbLeft.isSelected());1637 (stoplistData.nodes.elementAt(i), segmentMetrics, 1638 cbRight.isSelected(), cbLeft.isSelected()); 1644 1639 if (sr != null) 1645 1640 { 1646 1641 if (sr.distance < 1647 Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 )1642 Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 ) 1648 1643 { 1649 sr.role = (String)stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN);1650 srm.addElement(sr);1644 sr.role = (String)stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN); 1645 srm.addElement(sr); 1651 1646 } 1652 1647 else 1653 1648 { 1654 sr.role = (String)stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN);1655 sr.index = segmentMetrics.size()*2;1656 sr.pos = 0;1657 srm.addElement(sr);1649 sr.role = (String)stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN); 1650 sr.index = segmentMetrics.size()*2; 1651 sr.pos = 0; 1652 srm.addElement(sr); 1658 1653 } 1659 1654 … … 1701 1696 StopReference sr = detectMinDistance 1702 1697 (srm.elementAt(i).node, segmentMetrics, cbRight.isSelected(), cbLeft.isSelected()); 1703 double offset = segmentMetrics.elementAt((sr.index+1) / 2).distance; 1704 if (sr.index % 2 == 0) 1705 offset += sr.pos; 1706 stoplistData.insertRow(insPos, srm.elementAt(i).node, srm.elementAt(i).role, offset); 1698 stoplistData.insertRow(insPos, srm.elementAt(i).node, srm.elementAt(i).role, 1699 calcOffset(sr, segmentMetrics)); 1707 1700 if (insPos >= 0) 1708 1701 ++insPos; … … 1755 1748 StopReference sr = detectMinDistance 1756 1749 (curMember.getNode(), segmentMetrics, cbRight.isSelected(), cbLeft.isSelected()); 1757 double offset = segmentMetrics.elementAt((sr.index+1) / 2).distance; 1758 if (sr.index % 2 == 0) 1759 offset += sr.pos; 1760 stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole(), offset); 1750 stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole(), 1751 calcOffset(sr, segmentMetrics)); 1761 1752 if (insPos >= 0) 1762 1753 ++insPos; … … 1821 1812 { 1822 1813 StopReference sr = detectMinDistance 1823 (currentNode, segmentMetrics, 1824 cbRight.isSelected(), cbLeft.isSelected()); 1814 (currentNode, segmentMetrics, cbRight.isSelected(), cbLeft.isSelected()); 1825 1815 if ((sr != null) && (sr.distance < 1826 1816 Double.parseDouble(tfSuggestStopsLimit.getText()) * 9.0 / 1000000.0 )) … … 1843 1833 StopReference sr = detectMinDistance 1844 1834 (srm.elementAt(i).node, segmentMetrics, cbRight.isSelected(), cbLeft.isSelected()); 1845 double offset = segmentMetrics.elementAt((sr.index+1) / 2).distance; 1846 if (sr.index % 2 == 0) 1847 offset += sr.pos; 1848 stoplistData.addRow(srm.elementAt(i).node, srm.elementAt(i).role, offset); 1835 stoplistData.addRow(srm.elementAt(i).node, srm.elementAt(i).role, 1836 calcOffset(sr, segmentMetrics)); 1849 1837 } 1850 1838 … … 2134 2122 } 2135 2123 2124 private double calcOffset(StopReference sr, Vector< SegmentMetric > segmentMetrics) 2125 { 2126 double offset = 0; 2127 if ((sr.index+1) / 2 < segmentMetrics.size()) 2128 { 2129 offset = segmentMetrics.elementAt((sr.index+1) / 2).distance; 2130 if (sr.index % 2 == 0) 2131 offset += sr.pos; 2132 } 2133 else 2134 offset = segmentMetrics.elementAt(segmentMetrics.size() - 1).distance 2135 + segmentMetrics.elementAt(segmentMetrics.size() - 1).length; 2136 2137 return offset; 2138 } 2139 2136 2140 private void fillStoplistTable 2137 2141 (Iterator<RelationMember> relIter, int insPos) { … … 2148 2152 else 2149 2153 { 2150 double offset = segmentMetrics.elementAt((sr.index+1) / 2).distance; 2151 if (sr.index % 2 == 0) 2152 offset += sr.pos; 2153 stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole(), offset); 2154 stoplistData.insertRow(insPos, curMember.getNode(), curMember.getRole(), 2155 calcOffset(sr, segmentMetrics)); 2154 2156 if (insPos >= 0) 2155 2157 ++insPos;
Note:
See TracChangeset
for help on using the changeset viewer.