Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11424 closed defect (invalid)

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

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

Description (last modified by bastiK)

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.

Attachments (0)

Change History (4)

comment:1 by Balaitous, 9 years ago

See r7817.
recalculateCenterScale was removed in r8318.
You can change mv.recalculateCenterScale(bboxCalculator) by mv.zoomTo(bboxCalculator).

comment:2 by bastiK, 9 years ago

Description: modified (diff)

comment:3 by stoecker, 9 years ago

Resolution: wontfix
Status: newclosed

comment:4 by Don-vip, 9 years ago

Resolution: wontfixinvalid

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.