Changeset 20896 in osm for applications/editors/josm/plugins/public_transport
- Timestamp:
- 2010-04-13T04:02:02+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java
r20895 r20896 2108 2108 if (curMember.isWay()) 2109 2109 { 2110 insPos = insertGapIfNecessary(curMember.getWay(), curMember.getRole(), lastNodeId, insPos);2111 2112 2110 itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole()); 2113 2111 if (insPos >= 0) 2114 2112 ++insPos; 2115 2116 lastNodeId = getLastNodeId(curMember.getWay(), curMember.getRole()); 2117 } 2118 } 2113 } 2114 } 2115 itineraryData.cleanupGaps(); 2119 2116 } 2120 2117 … … 2130 2127 ++insPos; 2131 2128 } 2132 }2133 }2134 2135 private int insertGapIfNecessary(Way way, String role, long lastNodeId, int insPos)2136 {2137 String[] buf = { "", "" };2138 if (gapNecessary(way, role, lastNodeId))2139 {2140 buf[0] = "[gap]";2141 itineraryData.insertRow(insPos, buf);2142 if (insPos >= 0)2143 ++insPos;2144 }2145 return insPos;2146 }2147 2148 private boolean gapNecessary(Way way, String role, long lastNodeId)2149 {2150 if ((way != null) && (!(way.isIncomplete())) && (way.getNodesCount() >= 1))2151 {2152 if ("backward".equals(role))2153 {2154 long firstNodeId = way.getNode(way.getNodesCount() - 1).getId();2155 if ((lastNodeId != 0) && (lastNodeId != firstNodeId))2156 return true;2157 }2158 else2159 {2160 long firstNodeId = way.getNode(0).getId();2161 if ((lastNodeId != 0) && (lastNodeId != firstNodeId))2162 return true;2163 }2164 }2165 return false;2166 }2167 2168 private long getLastNodeId(Way way, String role)2169 {2170 if ((way == null) || (way.isIncomplete()) || (way.getNodesCount() < 1))2171 {2172 return 0;2173 }2174 else2175 {2176 if ("backward".equals(role))2177 return way.getNode(0).getId();2178 else2179 return way.getNode(way.getNodesCount() - 1).getId();2180 2129 } 2181 2130 }
Note:
See TracChangeset
for help on using the changeset viewer.