diff --git a/settings.gradle b/settings.gradle index f353fcc6..d5bf8d5a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,4 +16,5 @@ include ':vtm-web-app' include ':vtm-jeo' include ':vtm-playground' include ':vtm-ios' +include ':vtm-ios-example' include ':vtm-app' diff --git a/vtm-ios-example/Info.plist.xml b/vtm-ios-example/Info.plist.xml new file mode 100644 index 00000000..6a225346 --- /dev/null +++ b/vtm-ios-example/Info.plist.xml @@ -0,0 +1,64 @@ + + + + MinimumOSVersion + 8.0 + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${app.name} + CFBundleExecutable + ${app.executable} + CFBundleIdentifier + ${app.id} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${app.name} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${app.version} + CFBundleSignature + ???? + CFBundleVersion + ${app.build} + LSRequiresIPhoneOS + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + Icon + Icon-72 + + + + + diff --git a/vtm-ios-example/build.gradle b/vtm-ios-example/build.gradle new file mode 100644 index 00000000..f7118c7a --- /dev/null +++ b/vtm-ios-example/build.gradle @@ -0,0 +1,103 @@ +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.2.0' + } +} + +apply plugin: 'java' +apply plugin: 'maven' +apply plugin: 'robovm' + +sourceSets.main.java.srcDirs = ["src/"] + +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +configurations {natives} + +ext { + // Configure your application main class + mainClassName = "org.oscim.ios.RoboVmLauncher" + roboVMVersion = "2.3.0" +} + +launchIPhoneSimulator.dependsOn build +launchIPadSimulator.dependsOn build +launchIOSDevice.dependsOn build +createIPA.dependsOn build + +dependencies { + compile project(':vtm') + compile project(':vtm-gdx') + compile project(':vtm-jts') + compile project(':vtm-ios') +// natives project(':vtm-ios') + compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" + compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" + compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion" + compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion" + compile 'org.slf4j:slf4j-simple:1.7.21' +} + +task copyVtmResources(type: Copy) { + from("../vtm/resources") + into("${buildDir}") +} + +task copyVtmThemesResources(type: Copy) { + from("../vtm-themes/resources") + into("${buildDir}") +} + +task copyVtmPlaygroundResources(type: Copy) { + from("../vtm-playground/resources") + into("${buildDir}/assets/") +} + +task copyIosNatives(type: Copy) { + from("../vtm-ios/natives") + into("${buildDir}/natives/") +} + + +tasks.withType(JavaCompile) { + compileTask -> compileTask.dependsOn copyVtmResources +} + +tasks.withType(JavaCompile) { + compileTask -> compileTask.dependsOn copyVtmThemesResources +} + +tasks.withType(JavaCompile) { + compileTask -> compileTask.dependsOn copyVtmPlaygroundResources +} + +tasks.withType(JavaCompile) { + compileTask -> compileTask.dependsOn copyIosNatives +} + +task nativesJar(type: Jar) { + classifier = 'natives' + from('natives') +} + +task fatJar(type: Jar, dependsOn: classes) { + classifier = 'jar-with-dependencies' + from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } + from('natives') + exclude 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF' + with jar +} + +artifacts { + archives nativesJar + //archives fatJar +} + +if (project.hasProperty("SONATYPE_USERNAME")) { + afterEvaluate { + project.apply from: "${rootProject.projectDir}/deploy.gradle" + } +} diff --git a/vtm-ios-example/data/Default-568h@2x.png b/vtm-ios-example/data/Default-568h@2x.png new file mode 100644 index 00000000..101752fe Binary files /dev/null and b/vtm-ios-example/data/Default-568h@2x.png differ diff --git a/vtm-ios-example/data/Default.png b/vtm-ios-example/data/Default.png new file mode 100644 index 00000000..f1a5582a Binary files /dev/null and b/vtm-ios-example/data/Default.png differ diff --git a/vtm-ios-example/data/Default@2x.png b/vtm-ios-example/data/Default@2x.png new file mode 100644 index 00000000..ca32f62f Binary files /dev/null and b/vtm-ios-example/data/Default@2x.png differ diff --git a/vtm-ios-example/data/Default@2x~ipad.png b/vtm-ios-example/data/Default@2x~ipad.png new file mode 100644 index 00000000..bb77ef07 Binary files /dev/null and b/vtm-ios-example/data/Default@2x~ipad.png differ diff --git a/vtm-ios-example/data/Default~ipad.png b/vtm-ios-example/data/Default~ipad.png new file mode 100644 index 00000000..855e4f2a Binary files /dev/null and b/vtm-ios-example/data/Default~ipad.png differ diff --git a/vtm-ios-example/data/Icon-72.png b/vtm-ios-example/data/Icon-72.png new file mode 100644 index 00000000..8cc57591 Binary files /dev/null and b/vtm-ios-example/data/Icon-72.png differ diff --git a/vtm-ios-example/data/Icon-72@2x.png b/vtm-ios-example/data/Icon-72@2x.png new file mode 100644 index 00000000..ec5e3803 Binary files /dev/null and b/vtm-ios-example/data/Icon-72@2x.png differ diff --git a/vtm-ios-example/data/Icon.png b/vtm-ios-example/data/Icon.png new file mode 100644 index 00000000..7f4bf363 Binary files /dev/null and b/vtm-ios-example/data/Icon.png differ diff --git a/vtm-ios-example/data/Icon@2x.png b/vtm-ios-example/data/Icon@2x.png new file mode 100644 index 00000000..eddc17c5 Binary files /dev/null and b/vtm-ios-example/data/Icon@2x.png differ diff --git a/vtm-ios-example/robovm.properties b/vtm-ios-example/robovm.properties new file mode 100644 index 00000000..3422d46a --- /dev/null +++ b/vtm-ios-example/robovm.properties @@ -0,0 +1,8 @@ +# +#Fri May 31 13:01:40 CEST 2013 +app.version=1.0 +app.id=de.longri.libgdx.mapsforge +app.mainclass=org.oscim.ios.test.ExampleLauncher +app.executable=VtmApp +app.build=1 +app.name=VectorMap diff --git a/vtm-ios-example/robovm.xml b/vtm-ios-example/robovm.xml new file mode 100644 index 00000000..6d3387a7 --- /dev/null +++ b/vtm-ios-example/robovm.xml @@ -0,0 +1,52 @@ + + ${app.executable} + ${app.mainclass} + ios + thumbv7 + ios + Info.plist.xml + + + ./build/assets + + ** + + true + + + data + + + + com.badlogic.gdx.scenes.scene2d.ui.* + com.badlogic.gdx.graphics.g3d.particles.** + com.android.okhttp.HttpHandler + com.android.okhttp.HttpsHandler + com.android.org.conscrypt.** + com.android.org.bouncycastle.jce.provider.BouncyCastleProvider + com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings + com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi + com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std + + com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi + com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL + org.apache.harmony.security.provider.cert.DRLCertFactory + org.apache.harmony.security.provider.crypto.CryptoProvider + + + build/natives/libvtm-jni.a + + + build/natives + + + SVGgh + UIKit + OpenGLES + QuartzCore + CoreGraphics + OpenAL + AudioToolbox + AVFoundation + + diff --git a/vtm-ios/src/org/oscim/ios/RobovmLauncher.java b/vtm-ios-example/src/org/oscim/ios/test/ExampleLauncher.java similarity index 85% rename from vtm-ios/src/org/oscim/ios/RobovmLauncher.java rename to vtm-ios-example/src/org/oscim/ios/test/ExampleLauncher.java index 8f96f4e4..eb880d80 100644 --- a/vtm-ios/src/org/oscim/ios/RobovmLauncher.java +++ b/vtm-ios-example/src/org/oscim/ios/test/ExampleLauncher.java @@ -13,7 +13,7 @@ * You should have received a copy of the GNU Lesser General Public License along with * this program. If not, see . */ -package org.oscim.ios; +package org.oscim.ios.test; import com.badlogic.gdx.backends.iosrobovm.IOSApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; @@ -25,7 +25,7 @@ import org.robovm.apple.uikit.UIApplication; import org.robovm.apple.uikit.UIDevice; import org.robovm.apple.uikit.UIScreen; -public class RobovmLauncher extends IOSApplication.Delegate { +public class ExampleLauncher extends IOSApplication.Delegate { @Override protected IOSApplication createApplication() { @@ -37,8 +37,13 @@ public class RobovmLauncher extends IOSApplication.Delegate { float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale()); CanvasAdapter.dpi *= scale; - IOSMapApp iosMapApp = new IOSMapApp(); - IOSMapApp.init(); +// IOSMapApp iosMapApp = new IOSMapApp(); +// IOSMapAppCluster iosMapApp = new IOSMapAppCluster(); + + IOSLineTexTest iosMapApp = new IOSLineTexTest(); + + + iosMapApp.init(); return new IOSApplication(iosMapApp, config); } @@ -52,7 +57,7 @@ public class RobovmLauncher extends IOSApplication.Delegate { NSAutoreleasePool pool = new NSAutoreleasePool(); System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE"); - UIApplication.main(argv, null, RobovmLauncher.class); + UIApplication.main(argv, null, ExampleLauncher.class); pool.drain(); } } diff --git a/vtm-ios-example/src/org/oscim/ios/test/IOSLineTexTest.java b/vtm-ios-example/src/org/oscim/ios/test/IOSLineTexTest.java new file mode 100644 index 00000000..5e017814 --- /dev/null +++ b/vtm-ios-example/src/org/oscim/ios/test/IOSLineTexTest.java @@ -0,0 +1,135 @@ +/* + * Copyright 2013 Hannes Janetzek + * Copyright 2016 Longri + * + * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). + * + * This program is free software: you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with + * this program. If not, see . + */ +package org.oscim.ios.test; + +import org.oscim.backend.CanvasAdapter; +import org.oscim.backend.GLAdapter; +import org.oscim.backend.canvas.Color; +import org.oscim.core.GeoPoint; +import org.oscim.core.MapPosition; +import org.oscim.event.Event; +import org.oscim.gdx.GdxAssets; +import org.oscim.gdx.GdxMap; +import org.oscim.ios.backend.IosGL; +import org.oscim.ios.backend.IosGraphics; +import org.oscim.layers.tile.buildings.BuildingLayer; +import org.oscim.layers.tile.vector.VectorTileLayer; +import org.oscim.layers.tile.vector.labeling.LabelLayer; +import org.oscim.layers.vector.PathLayer; +import org.oscim.layers.vector.geometries.Style; +import org.oscim.map.Map; +import org.oscim.renderer.bucket.TextureItem; +import org.oscim.theme.VtmThemes; +import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; + +import java.util.ArrayList; +import java.util.List; + +public class IOSLineTexTest extends GdxMap { + + public static void init() { + // init globals + IosGraphics.init(); + GdxAssets.init("assets/"); + GLAdapter.init(new IosGL()); + } + + private static final boolean ANIMATION = false; + + private List mPathLayers = new ArrayList<>(); + private TextureItem tex; + + @Override + public void createLayers() { + VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource()); + mMap.layers().add(new BuildingLayer(mMap, l)); + mMap.layers().add(new LabelLayer(mMap, l)); + mMap.setTheme(VtmThemes.DEFAULT); + + mMap.setMapPosition(0, 0, 1 << 2); + + tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png")); + tex.mipmap = true; + + createLayers(1, true); + + if (ANIMATION) + mMap.events.bind(new Map.UpdateListener() { + @Override + public void onMapEvent(Event e, MapPosition mapPosition) { + //if (e == Map.UPDATE_EVENT) { + long t = System.currentTimeMillis(); + float pos = t % 20000 / 10000f - 1f; + createLayers(pos, false); + mMap.updateMap(true); + //} + } + }); + } + + void createLayers(float pos, boolean init) { + + int i = 0; + + for (double lat = -90; lat <= 90; lat += 5) { + List pts = new ArrayList<>(); + + for (double lon = -180; lon <= 180; lon += 2) { + //pts.add(new GeoPoint(lat, lon)); + // double longitude = lon + (pos * 180); + // if (longitude < -180) + // longitude += 360; + // if (longitude > 180) + // longitude -= 360; + double longitude = lon; + + double latitude = lat + (pos * 90); + if (latitude < -90) + latitude += 180; + if (latitude > 90) + latitude -= 180; + + latitude += Math.sin((Math.abs(pos) * (lon / Math.PI))); + + pts.add(new GeoPoint(latitude, longitude)); + } + PathLayer pathLayer; + if (init) { + int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f); + Style style = Style.builder() + .stippleColor(c) + .stipple(24) + .stippleWidth(1) + .strokeWidth(12) + .strokeColor(c) + .fixed(true) + .texture(tex) + .randomOffset(false) + .build(); + pathLayer = new PathLayer(mMap, style); + mMap.layers().add(pathLayer); + mPathLayers.add(pathLayer); + } else { + pathLayer = mPathLayers.get(i++); + } + + pathLayer.setPoints(pts); + } + + } +} diff --git a/vtm-ios/src/org/oscim/ios/IOSMapApp.java b/vtm-ios-example/src/org/oscim/ios/test/IOSMapApp.java similarity index 99% rename from vtm-ios/src/org/oscim/ios/IOSMapApp.java rename to vtm-ios-example/src/org/oscim/ios/test/IOSMapApp.java index 3575511a..37769467 100644 --- a/vtm-ios/src/org/oscim/ios/IOSMapApp.java +++ b/vtm-ios-example/src/org/oscim/ios/test/IOSMapApp.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Lesser General Public License along with * this program. If not, see . */ -package org.oscim.ios; +package org.oscim.ios.test; import org.oscim.backend.GLAdapter; import org.oscim.gdx.GdxAssets;