當前位置: 首頁>>代碼示例>>Python>>正文


Python map_render.MapRender類代碼示例

本文整理匯總了Python中trytond.modules.map.map_render.MapRender的典型用法代碼示例。如果您正苦於以下問題:Python MapRender類的具體用法?Python MapRender怎麽用?Python MapRender使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MapRender類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_image

    def get_image(self, ids):
        if self.geom is None:
            return buffer('')

        lines, envelope, _line = get_as_epsg4326([self.equipement.geom])        
        points, _envelope, _point = get_as_epsg4326([self.geom])        
        
        if points == []:
            return buffer('')
            
        _envelope = bbox_aspect(envelope, 640, 480)    
            
        # Léger dézoom pour afficher correctement les aires qui touchent la bbox
        envelope = [
            _envelope[0] - 0.001,
            _envelope[1] + 0.001,
            _envelope[2] - 0.001,
            _envelope[3] + 0.001,
        ]                    

        m = MapRender(640, 480, envelope, True)
        
        m.plot_geom(lines[0], None, None, color=(0, 0, 1, 0.3), bgcolor=(0, 0, 1, 0.3))        
        m.plot_geom(points[0], self.code, None, color=self.COLOR, bgcolor=self.BGCOLOR)
        return buffer(m.render())     
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:25,代碼來源:rte.py

示例2: generate

 def generate(cls, records):
     for record in records:
         if record.code is None:
             continue
         
         lines, envelope, _line = get_as_epsg4326([record.equipement.geom])
         aires, _envelope, _aire = get_as_epsg4326([record.portee.geom])        
         areas, _envelope, _area = get_as_epsg4326([record.geom])
         points = [point.geom for point in record.arbre]
         points, _points_bbox, _points_area = get_as_epsg4326(points)
         
         # Léger dézoom pour afficher correctement les zones qui touchent la bbox
         envelope = [
             _envelope[0] - 0.0001,
             _envelope[1] + 0.0001,
             _envelope[2] - 0.0001,
             _envelope[3] + 0.0001,
         ]            
         
         m = MapRender(640, 480, envelope, True)
         m.add_bg()
         
         m.plot_geom(lines[0], None, None, color=(0, 0, 1, 0.3), bgcolor=(0, 0, 1, 0.1))
         m.plot_geom(aires[0], None, None, color=(0, 0, 1, 0.3), bgcolor=(0, 0, 1, 0.1))
         # Ajoute les points
         for point, rec in zip(points, record.arbre):
             m.plot_geom(point, rec.code , None, color=(1, 1, 1, 1), bgcolor=(1, 1, 1, 1))
         m.plot_geom(areas[0], record.code, None, color=cls.COLOR, bgcolor=cls.BGCOLOR)                 
        
         data = m.render()
         cls.write([record], {'image_map': buffer(data)})
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:31,代碼來源:rte.py

示例3: generate

    def generate(cls, records):
        for record in records:
            if record.num is None:
                continue                       

            # Récupère les placettes de mesure du dispositif
            EmpObj = Pool().get(record.__name__)
            objs = EmpObj.search([('dispositif', '=', record.dispositif.id)])
            pts, envelope, area = get_as_epsg4326([obj.geom for obj in objs])
            
            # Placette en cours
            points, _envelope, _area = get_as_epsg4326([record.geom])                     

            # Léger dézoom pour afficher correctement les points qui touchent la bbox
            envelope = [
                _envelope[0] - 0.001,
                _envelope[1] + 0.001,
                _envelope[2] - 0.001,
                _envelope[3] + 0.001,
            ]
            
            m = MapRender(640, 480, envelope, True)
            m.add_bg()

            # Ajoute les placettes du dispositif
            for entry in pts:
                if len(pts) == 0:
                    continue            
                if entry == get_as_epsg4326([record.geom])[0][0]:                
                    m.plot_geom(entry, None, None, color=(0, 0, 1, 1), bgcolor=record.BGCOLOR)
                else:                
                    m.plot_geom(entry, None, None, color=(0, 0, 1, 0.5), bgcolor=record.BGCOLOR)
            m.plot_geom(points[0], str(record.num), None, color=(1, 1, 1, 1), bgcolor=record.BGCOLOR)
            data = m.render()
            cls.write([record], {'image_map': buffer(data)})
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:35,代碼來源:psdrf.py

示例4: get_image

    def get_image(self, ids):
        if self.geom is None:
            return buffer('')

        points, _envelope, _area = get_as_epsg4326([self.geom])
        town, envelope, area = get_as_epsg4326([self.address.my_city.contour])
        if points == []:
            return buffer('')

        m = MapRender(640, 480, envelope)
        m.plot_geom(town[0], None, None, color=(0, 0, 1, 1), bgcolor=(0, 0, 0, 0))
        m.plot_geom(points[0], None, None, color=self.COLOR, bgcolor=self.BGCOLOR)
        return buffer(m.render())
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:13,代碼來源:allo_quoi.py

示例5: generate

    def generate(cls, records):
        for record in records:
            if record.address is None:
                continue

            town, envelope, area = get_as_epsg4326([record.address.my_city.contour])
            
            # Calcule de la bbox contenant tout les points
            _envelope = None
            for points in cls.search([]):
                _points, envelope, _area = get_as_epsg4326([points.geom])
                if envelope is None:
                    continue
                _envelope = envelope_union(envelope, _envelope)

            # Léger dézoom pour afficher correctement les points qui touchent la bbox
            envelope = [
                _envelope[0] - 0.001,
                _envelope[1] + 0.001,
                _envelope[2] - 0.001,
                _envelope[3] + 0.001,
            ]
            
            m = MapRender(640, 480, envelope, True)
            m.add_bg()
            for entry in cls.search([]):
                points, _envelope, _area = get_as_epsg4326([entry.geom])
                if len(points) == 0:
                    continue
                if record == entry:
                    m.plot_geom(points[0], None, None, color=cls.COLOR, bgcolor=cls.BGCOLOR)
                else:
                    m.plot_geom(points[0], None, None, color=(0, 0, 1, 1), bgcolor=cls.BGCOLOR)
            data = m.render()
            cls.write([record], {'image_map': buffer(data)})
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:35,代碼來源:allo_quoi.py

示例6: get_image

    def get_image(self, ids):
        if self.geom is None:
            return buffer('')        

        EmpObj = Pool().get(self.__name__)
        objs = EmpObj.search([('dispositif', '=', self.dispositif.id)])
        pts, _envelope, area = get_as_epsg4326([obj.geom for obj in objs])

        points, _envelope, _area = get_as_epsg4326([self.geom])

        # Léger dézoom pour afficher correctement les points qui touchent la bbox
        envelope = [
            _envelope[0] - 0.01,
            _envelope[1] + 0.01,
            _envelope[2] - 0.01,
            _envelope[3] + 0.01,
        ]

        if points == []:
            return buffer('')

        m = MapRender(640, 480, envelope)

        # Ajoute les points de la placette        
        for entry in pts:
            if len(pts) == 0:
                continue            
            if entry == get_as_epsg4326([self.geom])[0][0]:                
                m.plot_geom(entry, None, None, color=(0, 0, 1, 1), bgcolor=self.BGCOLOR)
            else:                
                m.plot_geom(entry, None, None, color=(0, 0, 1, 0.5), bgcolor=self.BGCOLOR)

        m.plot_geom(points[0], str(self.num), None, color=self.COLOR, bgcolor=self.BGCOLOR)
        return buffer(m.render())
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:34,代碼來源:psdrf.py

示例7: get_image

    def get_image(self, ids):
        if self.geom is None:
            return buffer('')
        
        plots, envelope, area = get_as_epsg4326([self.geom])

        if plots == []:
            return buffer('')

        envelope = bbox_aspect(envelope, 640, 480)

        m = MapRender(640, 480, envelope)
        m.plot_geom(plots[0], self.tex, color=self.COLOR, bgcolor=self.BGCOLOR)        
        data = m.render()
        return buffer(data)
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:15,代碼來源:cadastre.py

示例8: get_image

    def get_image(self, ids):
        if self.site is None:
            return buffer('')

        MiscObj = Pool().get(self.__name__)
        # Récupère l'étendu de la zone de travaux
        areas, _envelope, _area = get_as_epsg4326([self.site.geom])

        # Léger dézoom pour afficher correctement les points qui touchent la bbox
        envelope = [
            _envelope[0] - 0.001,
            _envelope[1] + 0.001,
            _envelope[2] - 0.001,
            _envelope[3] + 0.001,
        ]

        objs = MiscObj.search([('site', '=', self.site.id)])
        misc_obj, _envelope, area = get_as_epsg4326([obj.geom for obj in objs])

        if misc_obj == []:
            return buffer('')
        
        m = MapRender(640, 480, envelope)       
        # Ajoute la zone de chantier
        m.plot_geom(areas[0], None, None, color=self.COLOR, bgcolor=(0, 0, 1, 0.1))
        m.plot_geom(get_as_epsg4326([self.geom])[0][0], None, None, color=self.COLOR, bgcolor=self.BGCOLOR)
        return buffer(m.render())
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:27,代碼來源:misc_obj.py

示例9: get_image

    def get_image(self, ids):
        if self.geom is None:
            return buffer('')

        areas, envelope, _area = get_as_epsg4326([self.geom])
        
        if areas == []:
            return buffer('')
            
        _envelope = bbox_aspect(envelope, 640, 480)    
            
        # Léger dézoom pour afficher correctement les aires qui touchent la bbox
        envelope = [
            _envelope[0] - 0.001,
            _envelope[1] + 0.001,
            _envelope[2] - 0.001,
            _envelope[3] + 0.001,
        ]                    

        m = MapRender(640, 480, envelope, True)
               
        m.plot_geom(areas[0], None, None, color=self.COLOR, bgcolor=self.BGCOLOR)
        return buffer(m.render())
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:23,代碼來源:ser.py

示例10: get_image_all

    def get_image_all(self, ids):
        if self.address is None:
            return buffer('')

        town, envelope, area = get_as_epsg4326([self.address.my_city.contour])
                       
        m = MapRender(640, 480, envelope)
        m.plot_geom(town[0], None, None, color=(0, 0, 1, 1), bgcolor=(0, 0, 0, 0))
        for record in self.search([]):
            points, _envelope, _area = get_as_epsg4326([record.geom])
            if len(points) == 0:
                continue
            if record == self:
                m.plot_geom(points[0], None, None, color=self.COLOR, bgcolor=self.BGCOLOR)
            else:
                m.plot_geom(points[0], None, None, color=(0, 0, 1, 1), bgcolor=self.BGCOLOR)
        return buffer(m.render())
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:17,代碼來源:allo_quoi.py

示例11: get_image

    def get_image(self, ids):
        if self.information is None:
            return buffer('')

        PresObj = Pool().get(self.__name__)                

        objs = PresObj.search([('information', '=', self.information.id)])
        pres_obj, _envelope, area = get_as_epsg4326([obj.geom for obj in objs])

        # Léger dézoom pour afficher correctement les points qui touchent la bbox
        envelope = [
            _envelope[0] - 0.001,
            _envelope[1] + 0.001,
            _envelope[2] - 0.001,
            _envelope[3] + 0.001,
        ]

        if pres_obj == []:
            return buffer('')
        
        m = MapRender(640, 480, envelope)       
        # Ajoute les géométries        
        m.plot_geom(get_as_epsg4326([self.geom])[0][0], None, None, color=self.COLOR, bgcolor=self.BGCOLOR)
        return buffer(m.render())
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:24,代碼來源:pres_obj.py

示例12: get_image

    def get_image(self, ids):
        if self.forest is None:
            return buffer('')

        data = ''
        Plot = Pool().get(self.__name__)
        plots = Plot.search([('forest', '=', self.forest.id)])
        plots, envelope, area = get_as_epsg4326([plot.geom for plot in plots])

        if plots == []:
            return buffer('')

        envelope = bbox_aspect(envelope, 640, 480)

        m = MapRender(640, 480, envelope)
        for plot in plots:
            m.plot_geom(plot, None, color=self.COLOR, bgcolor=self.BGCOLOR)
        m.plot_geom(get_as_epsg4326([self.geom])[0][0], None, color=(1, 0, 0, 1), bgcolor=self.BGCOLOR)
        data = m.render()
        return buffer(data)
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:20,代碼來源:plot.py

示例13: generate

 def generate(cls, records):
     for record in records:
         if record.name is None:
             continue
                                
         areas, _envelope, _area = get_as_epsg4326([record.geom])
         
         # Léger dézoom pour afficher correctement les points qui touchent la bbox
         envelope = [
             _envelope[0] - 0.001,
             _envelope[1] + 0.001,
             _envelope[2] - 0.001,
             _envelope[3] + 0.001,
         ]            
         
         m = MapRender(640, 480, envelope, True)
         m.add_bg()
                   
         m.plot_geom(areas[0], None, None, color=cls.COLOR, bgcolor=cls.BGCOLOR)            
        
         data = m.render()
         cls.write([record], {'image_map': buffer(data)})  
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:22,代碼來源:ser.py

示例14: get_image

    def get_image(self, ids):
        if self.forest is None:
            return buffer("")

        MiscObj = Pool().get(self.__name__)
        CadPlot = Pool().get("forest.cad_plot")
        objs = MiscObj.search([("forest", "=", self.forest.id)])
        misc_obj, envelope, area = get_as_epsg4326([obj.geom for obj in objs])

        if misc_obj == []:
            return buffer("")

        cad_plots = [plot.geom for plot in self.forest.cad_plots]
        if cad_plots != []:
            cad_plots, cad_bbox, cad_area = get_as_epsg4326(cad_plots)

            envelope = envelope_union(envelope, cad_bbox)
            envelope = bbox_aspect(envelope, 640, 480)

        m = MapRender(640, 480, envelope)
        for plot in cad_plots:
            m.plot_geom(plot, None, None, color=CadPlot.COLOR, bgcolor=CadPlot.BGCOLOR)
        m.plot_geom(get_as_epsg4326([self.geom])[0][0], None, None, color=self.COLOR, bgcolor=self.BGCOLOR)
        return buffer(m.render())
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:24,代碼來源:track.py

示例15: image_map_gen

    def image_map_gen(cls, records):
        """Render the image map"""        
        for record in records:
            # Récupère l'étendu de la zone de travaux
            areas, _envelope, _area = get_as_epsg4326([record.geom])

            aires = [aire.geom for aire in record.misc_obj_poly]
            aires, _aires_bbox, _aires_area = get_as_epsg4326(aires)
            lignes = [ligne.geom for ligne in record.misc_obj_line]
            lignes, _lignes_bbox, _lignes_area = get_as_epsg4326(lignes)
            points = [point.geom for point in record.misc_obj_point]
            points, _points_bbox, _points_area = get_as_epsg4326(points)

            # Léger dézoom pour afficher correctement les points qui touchent la bbox
            envelope = [
                _envelope[0] - 0.001,
                _envelope[1] + 0.001,
                _envelope[2] - 0.001,
                _envelope[3] + 0.001,
            ]  

            if envelope is None:
                continue
                               
            # Map title
            title = u'Plan de situation chantier\n'
            title += u'Propriétaire: %s\n' % record.owner.name
            if record.commune is not None \
                    and record.commune.name is not None \
                    and record.commune.name is not None:
                city = record.commune.name
                dep = record.commune.subdivision.parent.code.split('-')[1]
                title += u'Commune: %s (%s)\n' % (city, dep)
            title += u'Surface: %02i ha %02i a %02i ca\n\nLe ' % cls._area_to_a(_area)
            title += date.today().strftime('%02d/%02m/%Y')

            m = MapRender(1024, 768, envelope, True)
            # Ajoute le fond de carte
            m.add_bg()

            # Ajoute les polygones
            for aire, rec in zip(aires, record.misc_obj_poly):
                m.plot_geom(aire, rec.name, u'Zones', color=(1, 1, 1, 1), bgcolor=(0, 0, 1, 1))

            # Ajoute les polylignes
            for ligne, rec in zip(lignes, record.misc_obj_line):
                m.plot_geom(ligne, rec.name, None, color=(1, 1, 1, 1), bgcolor=(1, 1, 1, 1))

            # Ajoute les points
            for point, rec in zip(points, record.misc_obj_point):
                m.plot_geom(point, rec.name, None, color=(1, 1, 1, 1), bgcolor=(1, 1, 1, 1))            

            # Ajoute la zone de chantier
            m.plot_geom(areas[0], None, u'Chantier', color=cls.COLOR, bgcolor=cls.BGCOLOR) 

            data_nl = m.render()
            m.plot_legend()
            m.plot_compass()
            m.plot_scaling()
            cls._plot_logo(m)
            m.plot_title(title)
            data = m.render()
            cls.write([record], {
                'image_map': buffer(data),
            })
開發者ID:silpol,項目名稱:tryton-bef,代碼行數:65,代碼來源:site.py


注:本文中的trytond.modules.map.map_render.MapRender類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。