예제 #1
0
파일: gpx.py 프로젝트: dayanuyim/GisEditor
    def save(self, path):
        gpx = self.genRootElement()
        self.subMetadataElement(gpx)
        self.subWptElement(gpx)
        self.subTrkElement(gpx)

        util.saveXml(gpx, path)
예제 #2
0
    def save(self, dirpath, id=None):
        root = ET.Element("customMapSource")

        name = ET.SubElement(root, "name")
        name.text = self.map_title

        min_zoom = ET.SubElement(root, "minZoom")
        min_zoom.text = str(self.level_min)

        max_zoom = ET.SubElement(root, "maxZoom")
        max_zoom.text = str(self.level_max)

        tile_type = ET.SubElement(root, "tileType")
        tile_type.text = self.tile_format

        url = ET.SubElement(root, "url")
        url.text = self.url_template

        if self.server_parts:
            server_parts = ET.SubElement(root, "serverParts")
            server_parts.text = " ".join(self.server_parts)

        if self.invert_y:
            invert_y = ET.SubElement(root, "invertYCoordinate")
            invert_y.text = "true" if self.invert_y else "false"

        if self.coord_sys:
            coord_sys = ET.SubElement(root, "coordinatesystem")
            coord_sys.text = self.coord_sys

        lower_corner = ET.SubElement(root, "lowerCorner")
        lower_corner.text = "%.9f %.9f" % self.lower_corner

        upper_corner = ET.SubElement(root, "upperCorner")
        upper_corner.text = "%.9f %.9f" % self.upper_corner

        #bgcolor = ET.SubElement(root, "backgroundColor")
        #bgcolor.text = "#FFFFFF"

        #tile_update = ET.SubElement(root, "tileUpdate")
        #tile_update.text = "IfNotMatch"

        if self.expire_sec:
            exp_text = "%.3f" % (self.expire_sec / 86400.0, )
            if exp_text.endswith(".000"):
                exp_text = exp_text[:-4]
            expire = ET.SubElement(root, "expireDays")
            expire.text = exp_text

        #write to file
        filename = id if id else self.map_id
        filepath = os.path.join(dirpath, filename) + ".xml"
        util.saveXml(root, filepath)
예제 #3
0
파일: tile.py 프로젝트: dayanuyim/GisEditor
    def save(self, dirpath, id=None):
        root = ET.Element("customMapSource")

        name = ET.SubElement(root, "name")
        name.text = self.map_title

        min_zoom = ET.SubElement(root, "minZoom")
        min_zoom.text = str(self.level_min)

        max_zoom = ET.SubElement(root, "maxZoom")
        max_zoom.text = str(self.level_max)

        tile_type = ET.SubElement(root, "tileType")
        tile_type.text = self.tile_format

        url = ET.SubElement(root, "url")
        url.text = self.url_template

        if self.server_parts:
            server_parts = ET.SubElement(root, "serverParts")
            server_parts.text = " ".join(self.server_parts)

        if self.invert_y:
            invert_y = ET.SubElement(root, "invertYCoordinate")
            invert_y.text = "true" if self.invert_y else "false"

        if self.coord_sys:
            coord_sys = ET.SubElement(root, "coordinatesystem")
            coord_sys.text = self.coord_sys

        lower_corner = ET.SubElement(root, "lowerCorner")
        lower_corner.text = "%.9f %.9f" % self.lower_corner

        upper_corner = ET.SubElement(root, "upperCorner")
        upper_corner.text = "%.9f %.9f" % self.upper_corner

        #bgcolor = ET.SubElement(root, "backgroundColor")
        #bgcolor.text = "#FFFFFF"

        #tile_update = ET.SubElement(root, "tileUpdate")
        #tile_update.text = "IfNotMatch"

        if self.expire_sec:
            exp_text = "%.3f" % (self.expire_sec / 86400.0,)
            if exp_text.endswith(".000"):
                exp_text = exp_text[:-4]
            expire = ET.SubElement(root, "expireDays")
            expire.text = exp_text

        #write to file
        filename = id if id else self.map_id
        filepath = os.path.join(dirpath, filename) + ".xml"
        util.saveXml(root, filepath)