Opened 11 years ago

Last modified 11 years ago

#11424 closed defect

AttributeError: 'org.openstreetmap.josm.gui.MapView' object has no attribute 'recalculateCenterScale' — at Initial Version

Reported by: Polyglot Owned by: team
Priority: critical Milestone:
Component: Core Version: latest
Keywords: Cc:

Description

I looked at the source code several months ago and coded something to find ways which are close by the bus stop node I'm working on. This worked great. Now I upgraded to josm-latest.jar and it doesn't work anymore.

AttributeError: 'org.openstreetmap.josm.gui.MapView' object has no attribute 'recalculateCenterScale'

This is the (Jython) code I'm using in the scripting plugin:

# We couldn't determine the way by means of the stop_area relation
bboxCalculator = BoundingXYVisitor()
bboxCalculator.computeBoundingBox([node])
bboxCalculator.enlargeBoundingBox()
if bboxCalculator.getBounds():

mv.recalculateCenterScale(bboxCalculator)

#mv.zoomTo(node.getEastNorth())
ignorelist = [node]
stopPosition = Node()
for i in range(1,20):

candidateWays = mv.getAllNearest(mv.getPoint(node),ignorelist,Way().wayPredicate)
if candidateWays:

candidateNodes = mv.getAllNearest(mv.getPoint(node),[],Node().nodePredicate)
foundStopPosition = False
for candidateNode in candidateNodes:

# is there a stop_position node in the candidates?
if candidateNode.get('public_transport') in stop_position:

stopPosition = candidateNode
stopPositions.setdefault(nodeId, []).append(stopPosition)

ignorelist.append(candidateNode)
foundStopPosition = True
break

for candidateWay in candidateWays:

if not(candidateWay.get('highway')):

ignorelist.append(candidateWay)
continue

waylayer = candidateWay.get('layer')
if (nodelayer or waylayer) and not(waylayer == nodelayer):

ignorelist.append(candidateWay)
continue

elif isWaySuitable(candidateWay, modeOfTransport = route.get('route')):

if foundStopPosition:

if not(stopPosition in candidateWay.getNodes()):

A stop position node was found, but this candidate way doesn't contain it
continue

elif stopPosition in getEndNodes(candidateWay):

waysNextToPlatform.setdefault(node, []).append(candidateWay)

print 'using '
print candidateWay.getKeys()
waysNextToPlatform[nodeId] = [candidateWay]
platformsNextToWay.setdefault(candidateWay.getUniqueId(), []).append(node)

else:

ignorelist.append(candidateWay)
print 'ignoring '
print candidateWay.getKeys()

if nodeId in waysNextToPlatform:

if len(waysNextToPlatform[nodeId])==2:

connectionNode = areThese2WaysConnected(waysNextToPlatform[nodeId])
if connectionNode and waysNextToPlatform[nodeId][0].getNode(0) == connectionNode:

waysNextToPlatform[nodeId] = [waysNextToPlatform[nodeId][1], waysNextToPlatform[nodeId][0]]

return waysNextToPlatform[nodeId]

bboxCalculator.enlargeBoundingBox() # zoom out a bit and try again
if bboxCalculator.getBounds():

mv.recalculateCenterScale(bboxCalculator)

Doesn't work in 8343 and a few before. Worked fine with 8175, which I now am forced to revert to.

Change History (0)

Note: See TracTickets for help on using tickets.