Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:如何更新Skobbler地图样式_Android_Skmaps - Fatal编程技术网

Android:如何更新Skobbler地图样式

Android:如何更新Skobbler地图样式,android,skmaps,Android,Skmaps,我正在使用Skobbler SDK 2.3,我想知道如何更新SKMaps.zip中的地图样式 问题是: 我修改了包含的“daystyle”,但我注意到这只在删除应用程序数据后生效。这真的不是我想要的。它看起来像SKPrepareMapTextureThread(android.content.Context上下文,java.lang.String MapTexturePath,java.lang.String zipName,SKPrepareMapTextureListener)。start(

我正在使用Skobbler SDK 2.3,我想知道如何更新SKMaps.zip中的地图样式

问题是:

我修改了包含的“daystyle”,但我注意到这只在删除应用程序数据后生效。这真的不是我想要的。它看起来像
SKPrepareMapTextureThread(android.content.Context上下文,java.lang.String MapTexturePath,java.lang.String zipName,SKPrepareMapTextureListener)。start()


仅在SKMaps文件夹不存在时复制文件。有人知道start()方法中是否有这样的检查,或者(更好的)如何向用户提供修改后的SKMap样式吗?

SKPrepareMapTextureThread仅在SKMaps文件夹不存在的情况下复制文件,这就是它的目的,因为地图资源的解压需要相当长的时间,并且打算只执行一次。 要更新样式,需要解决方法:

1) 从映射资源路径中删除文件.installed.txt,并调用SKPrepareMapTextureThread,以便从资源中还原资源。虽然这是最简单的方法,但也是最耗时的方法:

final File txtPreparedFile = new File(mapResourcesDirPath + "/.installed.txt"); 
        if (!txtPreparedFile.exists()) { 
            txtPreparedFile.delete(); 
        } 
new SKPrepareMapTextureThread(context, mapResourcesDirPath, "SKMaps.zip", skPrepareMapTextureListener).start(); 
2) 更理想的方法是编写一个例程,用新的样式替换旧的样式

copyFile(new File("path/daystyle.json"), new File("mapResourcesDirPath/SKMaps/daystyle/daystyle.json")); 
...
public static void copyFile(File sourceFile, File destFile) throws IOException { 
    if(!destFile.exists()) { 
        destFile.createNewFile(); 
    } 

    FileChannel source = null; 
    FileChannel destination = null; 
    try { 
        source = new FileInputStream(sourceFile).getChannel(); 
        destination = new FileOutputStream(destFile).getChannel(); 

        // previous code: destination.transferFrom(source, 0, source.size()); 
        // to avoid infinite loops, should be: 
        long count = 0; 
        long size = source.size(); 
        while((count += destination.transferFrom(source, count, size-count))<size); 
    } 
    finally { 
        if(source != null) { 
            source.close(); 
        } 
        if(destination != null) { 
            destination.close(); 
        } 
    } 
}
copyFile(新文件(“path/daystyle.json”)、新文件(“mapsresourcesdirpath/SKMaps/daystyle/daystyle.json”);
...
公共静态void copyFile(File sourceFile,File destFile)引发IOException{
如果(!destFile.exists()){
destFile.createNewFile();
} 
filechannelsource=null;
filechanneldestination=null;
试试{
source=新文件输入流(sourceFile).getChannel();
destination=新文件输出流(destFile).getChannel();
//以前的代码:destination.transferFrom(source,0,source.size());
//为避免无限循环,应:
长计数=0;
long size=source.size();

虽然((count+=destination.transferFrom(source,count,size count))我们正在研究它-我们将从开发团队那里得到一个答案