当前位置: 首页>>代码示例>>Python>>正文


Python Map.getPOIGroup方法代码示例

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


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

示例1: testAddCategory

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import getPOIGroup [as 别名]
    def testAddCategory(self):
        map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage)
        map.open("a")
        poigroup = map.getPOIGroup()
        poilayer = map.getPOILayers()[0]
        #        poilayer.open('a')
        poigroup.open("a")
        map.close()
        map.writeImage("test.imi")

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

        poigroup = map.getPOIGroup()

        poigroup.open("a")

        cat = POICategory("Aerials")
        cat.addField("POI Name")
        subcat = cat.addSubCategory(POISubCategory("NOSUB1000"))

        expected = deepcopy(poigroup.getCategories()) + [cat]

        poigroup.addCategory(cat)

        #        cat.addField

        actual = poigroup.getCategories()

        if actual != expected:
            print "actual:", actual
            print "expected:", expected

        self.assertEqual(actual, expected)

        map.close()

        map = createMap(self.testdatadir)
        map.open()

        poigroup = map.getPOIGroup()

        poigroup.open("r")

        catman = poigroup.getCategoryManager()

        print catman.getCategories()

        self.assertTrue("Aerials" in [cat.getName() for cat in catman.getCategories()])

        actual = poigroup.getCategories()

        if actual != expected:
            print "actual:", actual
            print "expected:", expected

        #        expected.sort(lambda x,y: cmp(x.name.upper(), y.name.upper()))

        self.assertEqual(actual, expected)
开发者ID:codingforfun,项目名称:pymagellan,代码行数:61,代码来源:test_poi.py

示例2: testSimple

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import getPOIGroup [as 别名]
    def testSimple(self):
        map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage)
        map.open("a")

        map.addPOIGroupAndLayer()
        poigroup = map.getPOIGroup()

        cat = POICategory("Aerials")
        cat.addField("POI Name")
        subcat = cat.addSubCategory(POISubCategory("NOSUB1000"))

        expected = [cat]

        poigroup.addCategory(cat)

        #        cat.addField

        actual = poigroup.getCategories()

        if actual != expected:
            print "actual:", actual
            print "expected:", expected

        self.assertEqual(actual, expected)

        # Close map and try it to open it again
        map.close()

        map = Map()

        map = createMap(self.testdatadir)
        map.open()

        poigroup = map.getPOIGroup()

        poigroup.open("r")

        catman = poigroup.getCategoryManager()

        print catman.getCategories()

        self.assertTrue("Aerials" in [cat.getName() for cat in catman.getCategories()])

        actual = poigroup.getCategories()

        if actual != expected:
            print "actual:", actual
            print "expected:", expected

        self.assertEqual(actual, expected, "categories were not read back correctly")
开发者ID:codingforfun,项目名称:pymagellan,代码行数:52,代码来源:test_poi.py

示例3: testCategories

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import getPOIGroup [as 别名]
    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,代码行数:15,代码来源:test_poi.py

示例4: testAddPOI

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import getPOIGroup [as 别名]
    def testAddPOI(self):
        map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage)
        map.open("a")

        poigroup = map.getPOIGroup()
        poilayer = map.getPOILayers()[0]
        poigroup.open("a")

        print "nlevels", poilayer.nlevels

        catman = poigroup.getCategoryManager()
        cat = catman.getCategory(1)
        subcat = cat.getSubCategory(1)

        # Save number of pois in category 1
        cat1count = cat.getPOICount()
        self.assertEqual(cat1count, 5)

        wkt = "POINT (16.185 58.5912)"
        poi = CellElementPOI(poilayer, categoryid=1, subcategoryid=1, wkt=wkt)
        poi.discretizeGeometry(poilayer.getCell(1))
        feature = FeaturePOI(poilayer.addCellElement(poi), ["Apmacken", "", "", "", "", ""], 1, 1)

        expected = Set([f for f in poigroup.getFeatures()]) | Set([feature])

        poigroup.addFeature(feature)

        actual = Set([f for f in poigroup.getFeatures()])

        self.assertEqual(actual, expected, "feature not present in poi group in memory")

        map.close()

        # Verify that the category statistics are updated
        self.assertEqual(cat.getPOICount(), cat1count + 1)

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

        poigroup = map.getPOIGroup()

        poigroup.open()

        actual = Set([f for f in poigroup.getFeatures()])

        self.assertEqual(len(actual), len(expected))

        if actual != expected:
            print "actual:", actual
            print "expected:", expected

        #        expected.sort(lambda x,y: cmp(x.name.upper(), y.name.upper()))

        self.assertEqual(actual, expected, "feature was not added correctly after read back")

        self.assertTrue(
            areSorted([(f.getCategoryId(), f.getSubCategoryId()) for f in poigroup.getFeatures()]),
            "Feature are not sorted",
        )

        # Verify that the category statistics are updated
        cat = poigroup.getCategory(1)
        print poigroup.getCategories()
        subcat = cat.getSubCategory(1)
        self.assertEqual(cat.getPOICount(), cat1count + 1)

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


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