コード例 #1
0
    def test_geo_feature_style(self):
        geomap = GeoMap(self.doc, self.doc.REQUEST)

        geo_feature_style = geomap.geo_feature_style
        self.assertEqual(
            geo_feature_style['marker_image'],
            "http://nohost/plone/++resource++collective.js.leaflet/images/marker-icon.png",
            'Incorect default marker image url')

        registry = getUtility(IRegistry)
        registry['collective.geo.settings.interfaces.IGeoFeatureStyle.linewidth'] = float(3.0)

        manager = IGeoFeatureStyle(self.doc, None)
        manager.set('use_custom_styles', False)
        manager.set('linewidth', float(11.0))
        self.doc.reindexObject(idxs=['zgeo_geometry', 'collective_geo_styles'])

        geomap = GeoMap(self.doc, self.doc.REQUEST)
        geo_feature_style = geomap.geo_feature_style

        self.assertEqual(geo_feature_style["linewidth"], 3.0)

        manager.set('use_custom_styles', True)
        self.doc.reindexObject(idxs=['zgeo_geometry', 'collective_geo_styles'])

        geomap = GeoMap(self.doc, self.doc.REQUEST)
        geo_feature_style = geomap.geo_feature_style

        self.assertEqual(geo_feature_style["linewidth"], 11.0)
コード例 #2
0
 def test_coordinates(self):
     geomap = GeoMap(self.doc, self.doc.REQUEST)
     self.assertEqual(geomap.coordinates[0], 'Point')
     self.assertEqual(geomap.coordinates[1], (5.583, 50.633))
コード例 #3
0
 def test_inline_style(self):
     geomap = GeoMap(self.doc, self.doc.REQUEST)
     self.assertEqual(geomap.inline_style(), 'width: 100%;height: 600px')
コード例 #4
0
 def test_default_layers(self):
     geomap = GeoMap(self.doc, self.doc.REQUEST)
     baselayers = json.loads(geomap.default_layers()['baselayers'])
     keys = [key['name'] for key in baselayers]
     self.assertIn('osm', keys)
コード例 #5
0
 def test_geo_settings(self):
     geomap = GeoMap(self.doc, self.doc.REQUEST)
     geo_settings = geomap.geo_settings
     self.assertIn(u'osm', geo_settings['default_layers'])
コード例 #6
0
    def test_init_geomap(self):
        geomap = GeoMap(self.portal, self.portal.REQUEST)
        self.assertFalse(geomap.has_map)

        geomap = GeoMap(self.doc, self.doc.REQUEST)
        self.assertTrue(geomap.has_map)