我有个问题。我想在Google Appengine云上使用我的处理代码。我异步加载svg文件Visa @psj preload标记,并且将map1.svg与.pde文件放在同一目录中,所以我只想显示一个PShape,但它没有显示。我有以下处理代码:

编辑见下文!

我在同一文件夹../static/processing/中拥有所有文件(.pde,处理lib,geoloc.js)和map1.svg。

是否有人设法在脚本使用loadImage()或loadShape()的应用程序引擎上获取处理文件?顺便说一句,如果我不使用loadShape函数,则geoloc.js库正在运行,并且处理代码也可以运行,因此我怀疑map1.svg的路径不正确吗?

编辑!!!!!!!!!

好的,现在我已尽可能地剥离了文件,并且地图仍未显示在appengine上。如果在桌面上打开该.html文件,它可以工作,因此我仍然认为它与加载该文件有关处理代码中的map1.svg文件。我必须指出,发现正在处理.pde源,只是未显示的地图!

这是我处理过的处理代码:

再次编辑!现在正在工作...路径应该更具体-相对!

/* @pjs preload="../static/processing/map1.svg"; */

PShape worldMap;

void setup ()
{
    size(500, 500);
    worldMap = loadShape("../static/processing/map1.svg");
}

void draw ()
{
    shape(worldMap, 0, 0, 500, 500);

}


和HTML:

<!DOCTYPE html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>hiToYouToo : Built with Processing and Processing.js</title>
    <meta name="Generator" content="Processing" />
    <!--[if lt IE 9]>
        <script type="text/javascript">alert("Your browser does not support the canvas tag.");</script>
    <![endif]-->
    <script src="../static/processing/processing.js" type="text/javascript"></script>
    <script type="text/javascript">
    // convenience function to get the id attribute of generated sketch html element
    function getProcessingSketchId () { return 'hiToYouToo'; }
    </script>
</head>
<body>
    <div id="content">
        <div>
            <canvas id="hiToYouToo" data-processing-sources="../static/processing/hiToYouToo.pde"
                    width="500" height="500">
                <p>Your browser does not support the canvas tag.</p>
                <!-- Note: you can put any alternative content here. -->
            </canvas>
            <noscript>
                <p>JavaScript is required to view the contents of this page.</p>
            </noscript>
        </div>
    </div>
</body>

最佳答案

好吧,只是正式回答自己,所以任何寻求此方法的人都会很快找到答案。

这是应用引擎上的处理代码:

/* @pjs preload="../static/processing/map1.svg"; */

PShape worldMap;

void setup ()
{
    size(500, 500);
    worldMap = loadShape("../static/processing/map1.svg");
}

void draw ()
{
    shape(worldMap, 0, 0, 500, 500);

}


和HTML:

<!DOCTYPE html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>hiToYouToo : Built with Processing and Processing.js</title>
    <meta name="Generator" content="Processing" />
    <!--[if lt IE 9]>
        <script type="text/javascript">alert("Your browser does not support the canvas tag.");</script>
    <![endif]-->
    <script src="../static/processing/processing.js" type="text/javascript"></script>
    <script type="text/javascript">
    // convenience function to get the id attribute of generated sketch html element
    function getProcessingSketchId () { return 'hiToYouToo'; }
    </script>
</head>
<body>
    <div id="content">
        <div>
            <canvas id="hiToYouToo" data-processing-sources="../static/processing/hiToYouToo.pde"
                    width="500" height="500">
                <p>Your browser does not support the canvas tag.</p>
                <!-- Note: you can put any alternative content here. -->
            </canvas>
            <noscript>
                <p>JavaScript is required to view the contents of this page.</p>
            </noscript>
        </div>
    </div>
</body>

10-07 19:27
查看更多