• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python Map.Map类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中Map.Map的典型用法代码示例。如果您正苦于以下问题:Python Map类的具体用法?Python Map怎么用?Python Map使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Map类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testPolylineSerialize

    def testPolylineSerialize(self):
        map = Map()
        map.open(os.path.join(self.testdatadir, "00map.ini"))

        streets = map.getLayerByName("00_Streets")
        streets.open("r")

        cell = streets.getCell(1)

        street = cell.getCellElements()[0]

        expected = getCellElementRawData(streets, 1, 0)


        actual = street.serialize(cell)

        if actual != expected:
            print "Expected:", dump(expected)
            print "Actual:  ", dump(actual)

        outstreet = CellElementPolyline(streets)
        outstreet.deSerialize(cell, actual)

        self.assertEqual(street,outstreet)
        self.assertEqual(len(actual), len(expected))
        self.assertEqual(actual, expected)
开发者ID:codingforfun,项目名称:pymagellan,代码行数:26,代码来源:cell.py


示例2: newTak

def newTak():
	name = getValue(request, "name", None)
	uid = getValue(request, "userid", None)
	lat = getValue(request, "lat", None)
	lng = getValue(request, "lng", None)
	if not ( name and lat and lng and uid):
		return json_response(code=400)
	mapid = getValue(request, "mapid", None)
	map = None
	if uid is not None:
		user = Account.get_by_id(int(uid))
		if user is None:
			return json_response(code=400)
	if mapid is not None:
		map = Map.get_by_id(int(mapid))
	if map is None:
		map = Map(creator=user.name,creatorId=int(uid),name='Untitled',adminIds=[int(uid)])
		key = map.put()
		mapid = key.id()
		account = Account.get_by_id(int(uid))
		account.adminMaps.append(int(mapid))
		account.put()
	tak  = Tak(lng=lng,lat=lat, creator=user.name, name=name,mapId=int(mapid),creatorId=int(uid))
	key = tak.put()
	map.takIds.append(key.integer_id())
	map.put();
	return json_success(tak.Get())
开发者ID:kylepotts,项目名称:droptak-web,代码行数:27,代码来源:app.py


示例3: Game

class Game(object):

    def __init__(self):
        self.TITLE = "TEST (by zeeisl)"
        self.WIDTH = 800
        self.HEIGHT = 600
        
        self.controller = Controller()
        
        # game things
        self.char = Player("res//hero.png")
        self.map = Map()
        
        self.char1 = Character("res//hero.png", 100, 100, 32, 32)
        
    def key_input(self, event):
        self.controller.getButtonStates(event)
        self.char.key_input(event)
    
    def update(self, delta):
        self.map.update()
        self.char.update(self.char1)
        self.char1.update()
    
    def render(self, screen):
        self.map.render(screen)
        self.char.render(screen)
        self.char1.render(screen)
开发者ID:gia2api,项目名称:froscon,代码行数:28,代码来源:Game.py


示例4: main

def main():
    # initialize map
    map = Map()

    player = AIPlayer(map)
    map.setPlayer(player)

    map.mapLoop() # map's main loop event
开发者ID:beekill95,项目名称:unblockme,代码行数:8,代码来源:main.py


示例5: OpenAnt

class OpenAnt(QApplication):
    
    def __init__(self):
        QApplication.__init__(self, sys.argv)
        
        # Set the default background color to a darker grey.
        self.setPalette(QPalette(self.palette().button().color(), QColor(192, 192, 192)))
    
        self.window = MainWindow()
        self.window.show()
        self.window.start()
        self.window.setWindowTitle('OpenAnt')
        
        # Game timer, used in the gameloop FPS calculations.
        self.game_timer = QTime()
        self.game_timer.start()
        
        # Draw map, set view to ground.
        self.map = Map()
        Globals.view = self.map.generateMap()
        self.map.spawnAnts()
        
        # Start the main loop.
        self.gameLoop()
        
    def gameLoop(self):
        TICKS_PER_SECOND = 20
        SKIP_TICKS = 1000 / TICKS_PER_SECOND
        MAX_FRAMESKIP = 5
        
        next_game_tick = self.getTickCount()
        Globals.game_is_running = True
        while Globals.game_is_running:
            loops = 0
            while self.getTickCount() > next_game_tick and loops < MAX_FRAMESKIP:
                self.updateGame()
                next_game_tick += SKIP_TICKS
                loops += 1
            interpolation = float(self.getTickCount() + SKIP_TICKS - next_game_tick) / float(SKIP_TICKS)
            self.updateDisplay(interpolation)

    def updateDisplay(self, interpolation):
       
        #lerp away
        if not 'nolerp' in sys.argv:
            if self.map.yellowAnt.moving:
                self.map.yellowAnt.lerpMoveSimple(interpolation)

        Globals.glwidget.updateGL()
        self.processEvents() # Let Qt process its events.

    def getTickCount(self):
        return self.game_timer.elapsed()

    def updateGame(self):
        self.map.update()
开发者ID:HideTheMess,项目名称:OpenAnt,代码行数:56,代码来源:main.py


示例6: main

def main():
    print ("Main called")
    c1 = Coordinate(0,0,0)
    c2 = Coordinate(10,10,10)
    m = Map()
    print ("begin mapping")
    carl = m.map_1D_space(c1,c2,5)
    print ("endin mapping")
    for index, item in enumerate(carl):
        print (''+str(index)+' '+str(item.coordinate.x)+' '+str(item.coordinate.y)+' '+str(item.coordinate.z))
开发者ID:buckbaskin,项目名称:SpaceWarp,代码行数:10,代码来源:1DTest.py


示例7: testSimple

    def testSimple(self):
        map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage)
        map.open("r")

        poigroup = map.getPOIGroup()
        poigroup.open("r")

        f = poigroup.getFeatureByIndex(0)
        aux = f.getAuxAsDict(poigroup)
        print f, aux
开发者ID:codingforfun,项目名称:pymagellan,代码行数:10,代码来源:test_poi.py


示例8: api_taks

def api_taks(id=-1):
	if request.method == 'GET':
		map = Map.get_by_id(id)
		if map is None:
			return json_success({})
		else:
			return json_success(map.Get())
	if request.method == 'DELETE':
		map = Map.get_by_id(id)
		if map is None:
			return json_response(code=400, message="Map does not exist")
		map.Delete()
		return json_response(code=200,message="Success")
开发者ID:kylepotts,项目名称:droptak-web,代码行数:13,代码来源:app.py


示例9: testCategories

    def testCategories(self):
        map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage)
        map.open("a")

        poigroup = map.getPOIGroup()

        poigroup.open("a")

        catman = poigroup.getCategoryManager()

        print catman.getCategories()

        poigroup.close()
开发者ID:codingforfun,项目名称:pymagellan,代码行数:13,代码来源:test_poi.py


示例10: loadMap

    def loadMap(self, filename):        
        with open(filename, "r") as map_file:
            parts = map_file.readline().split(",")
            width = int(parts[0])
            height = int(parts[1])
            
            m = Map(width, height)
            r = 0
            for line in map_file:
                row = [TileTypes()[t] for t in line.strip('\n').split(",")]
                m.set_row(r, row)
                r = r + 1

        return m
开发者ID:DaveTCode,项目名称:MapForgetfulSearch,代码行数:14,代码来源:MapLoader.py


示例11: api_map

def api_map():
	if request.method == 'POST':
		userName = request.args.get("username","")
		mapName = request.args.get("mapname","")
		userId = request.args.get("userId","")
		userId = str(userId.encode('utf-8').decode('ascii', 'ignore'))
		uid = int(userId)
		ownMap =Map(creator=userName,creatorId=uid,name=mapName)
		key = ownMap.put()
		return json_success({"mapId":key.integer_id()}) 

	if request.method == 'GET':
		id = request.args.get("id","")
		ownMap = Map.get_by_id(int(id))
		return json_success({"creator":ownMap.creator,"name":ownMap.name,"creatorId":ownMap.creatorId,"id":int(id)})
开发者ID:kylepotts,项目名称:droptak-web,代码行数:15,代码来源:app.py


示例12: run

    def run(self):
        newMap = None
        if self.fileName:
            try:
                newMap = Map.readFromFile(self.fileName)
            except Exception as e:
                self.mapGenerationFailed.emit(e)
                return
        else:
            try:
                newMap = Map.generateCNN(self.citiesCount, self.connectionsCount)
            except Exception as e:
                self.mapGenerationFailed.emit(e)
                return

        self.mapGenerated.emit(newMap)
开发者ID:akkenoth,项目名称:TSPGen,代码行数:16,代码来源:MapGenerator.py


示例13: __init__

 def __init__(self):
     self.map = Map()
     self.numUnits = 1
     self.numPlayers = 1
     self.playerIndex = -1 
     self.turn = 1
     self.players = []
开发者ID:Temppa,项目名称:Vuoropohjainen-peli,代码行数:7,代码来源:application.py


示例14: favorite_mapsForUser

def favorite_mapsForUser(userid = -1):
	if userid <= 0:
		return json_response(code=400)
	user = Account.get_by_id(userid)
	if user is None:
		return json_response(code=400)

	if request.method == 'GET': # done
		#	GET: returns json array of information about user's map objects
		return json_success(user.getFavorites())

	mapid = getValue(request, "mapid", "")
	if not mapid:
		return json_response(code=400)
	map = Map.get_by_id(int(mapid))
	if map is None:
		return json_response(code=400)
	if request.method == 'POST':
		if not map.key.integer_id() in user.favoriteMaps:
			user.favoriteMaps.append(map.key.integer_id())
			user.put()
		return json_response(code=200)
	
	if request.method == 'DELETE':
		if map.key.integer_id() in user.favoriteMaps:
			user.favoriteMaps.remove(map.key.integer_id())
			user.put()
		return json_response(code=200)
开发者ID:kylepotts,项目名称:droptak-web,代码行数:28,代码来源:app.py


示例15: download_map

 def download_map(self, filename):
     """
     Download a map.
     @param filename Name of the map.
     @return Map object on success, None on error.
     """
     # [0]filename, [1]title, [2]filesize, [3]map_data
     map_data = self.database.do_query(Procedures.get_map(), filename);
     map = Map(self.reporter);
     try:
         if not map.read_map(map_data[0][3]):
             raise Exception, "Unknown corruption error." % filename;
     except Exception, e:
         self.report("Map file %s is corrupted (%s). Discarding." % (filename, str(e)));
         Log.quick_log("The map %s is corrupted: %s." % (filename, str(e)));
         return None;
开发者ID:summer-of-software,项目名称:vtank,代码行数:16,代码来源:Map_Manager.py


示例16: __init__

    def __init__(self):
        #GLOBAL CONSTS
        self.GAME_WIDTH = 600
        self.GAME_HEIGHT = 500

        self.clock = pygame.time.Clock()
        self.frame = 0
        self.logicFrame = 0
        self.mouseX = 0
        self.mouseY = 0
        self.cameraX = int(self.GAME_WIDTH / 2)
        self.cameraY = int(self.GAME_HEIGHT / 2)
        self.running = True
        self.debug = True
        self.map = Map(self)
        self.heldKeys = dict()
        self.checkedKeys = dict()

        self.root = pygame.display.set_mode((self.GAME_WIDTH, self.GAME_HEIGHT), pygame.DOUBLEBUF)
        self.player = Player(self)
        self._keySetup()
        #temp
        self.map.mapArray[0][0].addEntity(self.player)
        self.player.x = 100
        self.player.y = 100
        while self.running:
            self.displayLoop()
        self.quit()
开发者ID:Redyz,项目名称:FiddleSticks,代码行数:28,代码来源:arcade.py


示例17: __init__

    def __init__(self, mapdict):
        self.mapdef = mapdict
        self.cellmap = Map(mapdict)

        self.gemgos = []
        for gemgo in MGO.GEMGOTYPES:
            self.gemgos += gemgo.place(self.cellmap)
开发者ID:BinkyToo,项目名称:CCDQuest,代码行数:7,代码来源:World.py


示例18: mapData

def mapData(mapid = -1):
	if mapid <= 0:
		return json_response(code=400)
	map = Map.get_by_id(mapid)
	if map is None:
		return json_response(code=400)

	if request.method == 'GET': # done
		# returns json map info
		return json_success(map.Get())

	if request.method == 'DELETE': #todo
		# DELETE: used to delete a map object and all associated tak objects, parameters: none
		map.Delete()
		return json_response(code=200,message="Success")
		

	if request.method == 'PUT': #todo
		#PUT: 	used to update map in database, parameters: (any map parameter)
		# return json map object
		newName = request.args.get("name","")
		newIsPublic = request.args.get("isPublic","")
		newOwner = request.args.get("owner","")
		map.Put(newName=newName,newIsPublic=newIsPublic,newOwner=newOwner)
		return json_response(code=200,message="Success")
开发者ID:kylepotts,项目名称:droptak-web,代码行数:25,代码来源:app.py


示例19: __init__

	def __init__(self):
		pygame.init()

		#self.screen = pygame.display.set_mode((1024, 768), pygame.FULLSCREEN)
		self.screen = pygame.display.set_mode(bounds)
		self.clock = pygame.time.Clock()
		self.state = JOIN

		mapRect = pygame.Rect(0, 0, bounds[0], bounds[1])
		self.map = Map(mapRect)
		self.quit = False

		UDP_IP = "0.0.0.0"
		UDP_PORT = 5005

		self.sock = socket.socket(socket.AF_INET, # Internet
			socket.SOCK_DGRAM) # UDP
		self.sock.settimeout(.1)
		self.sock.bind((UDP_IP, UDP_PORT))

		pygame.mouse.set_visible(False)

		self.joinPage = JoinPage(bounds)

		self.mutex = Lock()
		t = Thread(target = Game.netThread, args = (self,))
		t.start()

		self.countDown()
开发者ID:driechers,项目名称:bijou-snake,代码行数:29,代码来源:Game.py


示例20: __init__

	def __init__(self):
		QtGui.QMainWindow.__init__(self)

		self.trans = None # Per mantenir l'estructura del fitxer de transport en memoria

		self.stOrigen = None
		self.stDesti = None

		self.a = None
		self.cami = None

		self.ui = uic.loadUi('transPublic.ui')

		#Preparem el Frame del mapa i el posem al form
		self.mF = Map(self,None)
		lay = QtGui.QGridLayout()
		lay.addWidget(self.mF)
		self.ui.mapGruopBox.setLayout(lay)

		self.connect(self.ui.menuOpen, QtCore.SIGNAL("activated()"), self.openFile)
		self.connect(self.ui.cbOrigen, QtCore.SIGNAL("activated(QString)"), self.cbOrigen_changed)
		self.connect(self.ui.cbDesti, QtCore.SIGNAL("activated(QString)"), self.cbDesti_changed)
		self.connect(self.ui.pbCalcula, QtCore.SIGNAL("clicked()"), self.calcula)

		self.ui.show()
开发者ID:afibanez,项目名称:TransPublic,代码行数:25,代码来源:transPublic.py



注:本文中的Map.Map类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python MapList.MapList类代码示例发布时间:2022-05-24
下一篇:
Python Manager.Manager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap