## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to non-U.S. persons whether in the United States or abroad requires # an export license or other authorization. # # Contractor Name: Raytheon Company # Contractor Address: 6825 Pine Street, Suite 340 # Mail Stop B8 # Omaha, NE 68106 # 402.291.0100 # # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## # This is a utility provided to convert old style .svg syntax to something that the new plot rendering # code expects. # The code basically scans the .svg file and removes certain attributes and moves them to a plotparamters_$plugin file # import xml.etree.ElementTree as ET import sys, shutil, os, time from os import path from datetime import datetime svgNS = "{http://www.w3.org/2000/svg}" NEW_LINE="\n\n" markerPluginElement = {'displayName':'Marker', 'param':'Marker', 'displayType': 'MARKER', "svgClass":"marker", 'sampleValue':' '} markerSVGElement = {'id':'marker', 'plotParam':'Marker', 'class': 'marker', 'x':'-20px', 'y':'-20px'} styleElement = {'type':'text/css'} markerFont = " @font-face { font-family: \"MarkerSymbolFont\";\n" + " src: url(MarkerSymbols.svg#MarkerSymbols); }\n" valid_modes = ["TEXT", "BARB", "TABLE", "RANGE", "ARROW", "ARROWUV", "MARKER"] ############################################ class _CommentedTreeBuilder ( ET.XMLTreeBuilder ): def __init__ ( self, html = 0, target = None ): ET.XMLTreeBuilder.__init__( self, html, target ) self._parser.CommentHandler = self.handle_comment def handle_comment ( self, data ): self._target.start( ET.Comment, {} ) self._target.data( data ) self._target.end( ET.Comment ) ############################################ # process the CDATA section. The xmltree doesn't handle CDATA correctly. # It removes them during the parsing process. So we replace them with a tag and reverse it when # we are done def processCDATA(fName, postProcess=False): with open(fName) as f: file_string = f.read() if postProcess is False: file_string = file_string.replace("") file_string = file_string.replace("]]>", "") else: file_string = file_string.replace("", "", "]]>") file_string = file_string.replace("#NEWCDATA#", getDefaultCDATAText() ) with open(fName, 'w') as f: f.write(file_string) ############################################ def getLicenseText(): licenseText = ''' This_software_was_developed_and_/_or_modified_by_Raytheon_Company, pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government. U.S._EXPORT_CONTROLLED_TECHNICAL_DATA This_software_product_contains_export-restricted_data_whose export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires an_export_license_or_other_authorization. Contractor_Name:________Raytheon_Company Contractor_Address:_____6825_Pine_Street,_Suite_340 ________________________Mail_Stop_B8 ________________________Omaha,_NE_68106 ________________________402.291.0100 See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for further_licensing_information. -->