Ejemplo n.º 1
0
    def __init__(self):
        self.defaultScale = 1./64
        self.objects = []
        self.pixmaps = []
        self.polyStyles = []
        self.edgeStyles = []
        self.options = MapOptions()

        ls = LineStyle("internal", 0, 0xFFFF, LineStyle.STYLE_INTERNAL)
        self.edgeStyles.append(ls)
        ls = LineStyle("default", 0, 0xFF, LineStyle.STYLE_SOLID)
        self.edgeStyles.append(ls)
        self.defEdgeStyleIndex = 1
        ps = PolygonStyle()
        ps.id = "default"
        ps.visible = ps.visibleInRadar= 1
        ps.filled = ps.textured = 0
        ps.defaultEdgeStyle = ls
        self.polyStyles.append(ps)
        self.defPolygonStyleIndex = 1
Ejemplo n.º 2
0
 def endDocument(self):
     self.model.options = MapOptions(self.opMap)
     for ps in self.pstyles.values():
         style = PolygonStyle()
         style.id = ps.id
         style.setFromFlags(ps.flags)
         if style.textured:
             if ps.textureId is None:
                 raise MapParseError("Textured polygon, no texture name")
             style.texture = self.bstyles[ps.textureId]
         if ps.color is None:
             style.color = 0xFFFFFF
         else:
             style.color = ps.color
         ls = self.estyles[ps.defEdgeId]
         style.defaultEdgeStyle = ls
         self.model.polyStyles.append(style)
         ps.ref = style
     for p in self.polys:
         ps = self.pstyles[p.style]
         style = ps.ref
         defls = style.defaultEdgeStyle
         if p.hasSpecialEdges:
             edges = []
         else:
             edges = None
         awtp = Polygon()
         pnt = p.points[0]
         x = pnt.x
         y = pnt.y
         awtp.addPoint(x, y)
         for pnt in p.points[1:-1]:
             x += pnt.x
             y += pnt.y
             awtp.addPoint(x, y)
         cls = None
         if edges != None:
             for pnt in p.points[1:]:
                 if pnt.style != None:
                     cls = self.estyles[pnt.style]
                     if cls == defls:
                         cls = None
                 edges.append(cls)
         mp = MapPolygon(awtp, style, edges)
         mp.type = p.type
         mp.team = p.team
         self.model.addToFront(mp)