Esempio n. 1
0
 def get_pos(view):
     if (not view):
         return (QPointF(0.0, 0.0))
     elif (isinstance(view, QPointF)):
         return (self.mapFromScene(QPointF(view.x(), view.y())))
     else:
         return (self.mapFromScene(view.mapToScene(QPointF(0.0, 0.0))))
Esempio n. 2
0
 def get_pos(view):
   if (not view):
     return(QPointF(0.0, 0.0))
   elif (isinstance(view, QPointF)):
     return(self.mapFromScene(QPointF(view.x(), view.y())))
   else:
     return(self.mapFromScene(view.mapToScene(QPointF(0.0, 0.0))))
Esempio n. 3
0
    def switchLevel(self, newLevel):
        levels = self.__map.levels()
        if self.__map.levelExists(newLevel):
            level = self.__map.getLevelByIndex(newLevel)
            if self.__registry.currentLevel is level:
                return

            newView = level.getView()
            view = self.__registry.currentLevel.getView().views()[0]
            center = view.mapToScene(view.rect().center())
            self.__registry.mainWindow.mapView().setScene(self.__map.getLevelByIndex(newLevel).getView())
            scene = self.__registry.mainWindow.mapView().scene().getModel()
            view.centerOn(center)
Esempio n. 4
0
    def switchLevel(self, newLevel):
        levels = self.__map.levels()
        if self.__map.levelExists(newLevel):
            level = self.__map.getLevelByIndex(newLevel)
            if self.__registry.currentLevel is level:
                return

            newView = level.getView()
            view = self.__registry.currentLevel.getView().views()[0]
            center = view.mapToScene(view.rect().center())
            self.__registry.mainWindow.mapView().setScene(
                self.__map.getLevelByIndex(newLevel).getView())
            scene = self.__registry.mainWindow.mapView().scene().getModel()
            view.centerOn(center)