Closed ThomasDaheim closed 3 years ago
I do this to cache map tiles in my home dir:
in main
of my javafx application:
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
if(isWindows() || isMac() || isUnix()) {
System.setProperty("javafx.platform" , "Desktop");
}
// define service for desktop
StorageService storageService = new StorageService() {
@Override
public Optional<File> getPrivateStorage() {
// user home app config location (linux: /home/[yourname]/.gluonmaps)
return Optional.of(new File(System.getProperty("user.home")));
}
@Override
public Optional<File> getPublicStorage(String subdirectory) {
// this should work on desktop systems because home path is public
return getPrivateStorage();
}
@Override
public boolean isExternalStorageWritable() {
//noinspection ConstantConditions
return getPrivateStorage().get().canWrite();
}
@Override
public boolean isExternalStorageReadable() {
//noinspection ConstantConditions
return getPrivateStorage().get().canRead();
}
};
// define service factory for desktop
ServiceFactory<StorageService> storageServiceFactory = new ServiceFactory<StorageService>() {
@Override
public Class<StorageService> getServiceType() {
return StorageService.class;
}
@Override
public Optional<StorageService> getInstance() {
return Optional.of(storageService);
}
};
// register service
Services.registerServiceFactory(storageServiceFactory);
launch(args);
}
Thanks, would have a look at this. Still I would think that no exception should be thrown with vanilla usage.
Seems to work, thanks a lot!
Now I'm only left with some debug output:
Jun 25, 2017 5:45:25 PM com.gluonhq.impl.maps.ImageRetriever <clinit>
INFO: hasfilecache = true
Jun 25, 2017 5:45:25 PM com.gluonhq.impl.maps.ImageRetriever$CacheThread doCache
INFO: retrieve http://tile.openstreetmap.org/0/0/0.png and store \0\0\0.png
I am using modular Java 12. The approach above does not seem to work for me since com.gluonhq.attach.storage.impl does not seem to be exported in the module-info. It looks like if DesktopStorageService was in my classpath then it would be used. It looks like this class is in https://nexus.gluonhq.com/nexus/content/repositories/releases/com/gluonhq/attach/storage/4.0.2/storage-4.0.2-desktop.jar. I can't figure out how to add this as a Maven dependency yet though.
@brightspectrum Did you check the sample's build: https://github.com/gluonhq/maps/blob/master/samples/mobile/build.gradle, you need to use the desktop
classifier.
Thanks. I got it working now by adding the desktop classifier in my pom.xml. No more exceptions and my tiles are now being cached in C:\Users\
`
How do I get around this error:
com.gluonhq.charm.down.Platform
Trying to run the fiftystates sample applications. Any ideas? Tried the above suggestions but didn't work for me.
Thanks
@ikeboatn This is the Maps repository, If you have issues running the Gluon MObile samples, post them in their issue tracker.
Also, I don't see how your issue relates to the Storage Service either.
Sent from my Huawei phoneThanks for the feedback. -------- Original message --------From: José Pereda notifications@github.comDate: Today, 12:15 PMTo: gluonhq/maps maps@noreply.github.comCc: ikeboatn ikeboatn@gmail.com, Mention mention@noreply.github.comSubject: Re: [gluonhq/maps] Exception: Storage Service is not available (#8)@ikeboatn This is the Maps repository, If you have issues running the Gluon MObile samples, post them in their issue tracker. Also, I don't see how your issue relates to the Storage Service either.
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.
Hello, I'm having the same issue.. Can you please help me?
Gluon Maps has a dependency on Attach and this wasn't explicitly mention in the published pom and may cause an issue if the dependency to Attach isn't explicitly declared.
This has been fixed with #54
I use vanilla js and i have this problem too
Hi,
I'm using com.gluonhq:maps:1.0.1 in my code an get the following messages during startup. Afterwards, everything seems to run fine... Any ideas?
Thanks, Thomas