资源简介

supermap 官方中文 iclient 6R for javascript开发入门文档 案例

资源截图

代码片段和文件信息

#!/usr/bin/env python

import sys
sys.path.append(“../tools“)
import mergejs
import optparse

def build(config_file = None output_file = None options = None):
    have_compressor = []
    try:
        import jsmin
        have_compressor.append(“jsmin“)
    except ImportError:
        print “No jsmin“
    try:
        import closure
        have_compressor.append(“closure“)
    except Exception E:
        print “No closure (%s)“ % E
    try:
        import closure_ws
        have_compressor.append(“closure_ws“)
    except ImportError:
        print “No closure_ws“
    
    try:
        import minimize
        have_compressor.append(“minimize“)
    except ImportError:
        print “No minimize“

    use_compressor = None
    if options.compressor and options.compressor in have_compressor:
        use_compressor = options.compressor

    sourceDirectory = “../lib“
    configFilename = “library.cfg“
    filename = “proj4js-compressed.js“
    outputFilename = “../lib/“ + filename

    if config_file:
        configFilename = config_file
        extension = configFilename[-4:]

        if extension  != “.cfg“:
            configFilename = config_file + “.cfg“

    if output_file:
        outputFilename = output_file

    print “Merging libraries.“
    merged = mergejs.run(sourceDirectory None configFilename)
    print “Setting the filename to “+filename
    merged = merged.replace(‘scriptName: “proj4js.js“‘‘scriptName: “‘+filename+‘“‘);
    print “Compressing using %s“ % use_compressor
    if use_compressor == “jsmin“:
        minimized = jsmin.jsmin(merged)
    elif use_compressor == “minimize“:
        minimized = minimize.minimize(merged)
    elif use_compressor == “closure_ws“:
        if len(merged) > 1000000: # The maximum file size for this web service is 1000 KB.
            print “\nPre-compressing using jsmin“
            merged = jsmin.jsmin(merged)
        print “\nIs being compressed using Closure Compiler Service.“
        try:
            minimized = closure_ws.minimize(merged)
        except Exception E:
            print “\nAbnormal termination.“
            sys.exit(“ERROR: Closure Compilation using Web service failed!\n%s“ % E)
        if len(minimized) <= 2:
            print “\nAbnormal termination due to compilation errors.“
            sys.exit(“ERROR: Closure Compilation using Web service failed!“)
        else:
            print ‘\nClosure Compilation using Web service has completed successfully.‘
    elif use_compressor == “closure“:
        minimized = closure.minimize(merged)      
    else: # fallback
        minimized = merged 
    print “Adding license file.“
    minimized = file(“license.txt“).read() + minimized

    print “Writing to %s.“ % outputFilename
    file(outputFilename “w“).write(minimized)

    print “Done.“

if __name__ == ‘__main__‘:
  opt = optparse.OptionParser(usage=“%s [options] [config_file] [output_file]

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-27 14:42  apidoc\
     目录           0  2013-04-27 14:41  apidoc\files\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\baseTypes\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Control\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Feature\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Filter\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Geometry\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Handler\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\layer\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\layer\Vector\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Popup\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Protocol\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Protocol\WFS\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\Data\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\layerServices\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\MapService\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\Measure\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\NetworkAnalyst\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\Query\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\ServerType\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\Service\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\SpatialAnalyst\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\Theme\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\REST\TrafficTransferAnalyst\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Request\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Strategy\
     目录           0  2013-04-27 14:41  apidoc\files\SuperMap\Symbolizer\
     目录           0  2013-04-27 14:42  apidoc\index\
     目录           0  2013-04-27 14:42  apidoc\javascript\
............此处省略1123个文件信息

评论

共有 条评论