vtm-ios-example module (#326)
@ -16,4 +16,5 @@ include ':vtm-web-app'
|
|||||||
include ':vtm-jeo'
|
include ':vtm-jeo'
|
||||||
include ':vtm-playground'
|
include ':vtm-playground'
|
||||||
include ':vtm-ios'
|
include ':vtm-ios'
|
||||||
|
include ':vtm-ios-example'
|
||||||
include ':vtm-app'
|
include ':vtm-app'
|
||||||
|
64
vtm-ios-example/Info.plist.xml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||||
|
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>8.0</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>${app.name}</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${app.executable}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${app.id}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${app.name}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${app.version}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${app.build}</string>
|
||||||
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
<true />
|
||||||
|
<key>UIStatusBarHidden</key>
|
||||||
|
<true />
|
||||||
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
|
<false />
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>1</integer>
|
||||||
|
<integer>2</integer>
|
||||||
|
</array>
|
||||||
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
<array>
|
||||||
|
<string>armv7</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleIcons</key>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundlePrimaryIcon</key>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleIconFiles</key>
|
||||||
|
<array>
|
||||||
|
<string>Icon</string>
|
||||||
|
<string>Icon-72</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
103
vtm-ios-example/build.gradle
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
BIN
vtm-ios-example/data/Default-568h@2x.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
vtm-ios-example/data/Default.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
vtm-ios-example/data/Default@2x.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
vtm-ios-example/data/Default@2x~ipad.png
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
vtm-ios-example/data/Default~ipad.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
vtm-ios-example/data/Icon-72.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
vtm-ios-example/data/Icon-72@2x.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
vtm-ios-example/data/Icon.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
vtm-ios-example/data/Icon@2x.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
8
vtm-ios-example/robovm.properties
Normal file
@ -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
|
52
vtm-ios-example/robovm.xml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<config>
|
||||||
|
<executableName>${app.executable}</executableName>
|
||||||
|
<mainClass>${app.mainclass}</mainClass>
|
||||||
|
<os>ios</os>
|
||||||
|
<arch>thumbv7</arch>
|
||||||
|
<target>ios</target>
|
||||||
|
<iosInfoPList>Info.plist.xml</iosInfoPList>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>./build/assets</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**</include>
|
||||||
|
</includes>
|
||||||
|
<skipPngCrush>true</skipPngCrush>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>data</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<forceLinkClasses>
|
||||||
|
<pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>
|
||||||
|
<pattern>com.badlogic.gdx.graphics.g3d.particles.**</pattern>
|
||||||
|
<pattern>com.android.okhttp.HttpHandler</pattern>
|
||||||
|
<pattern>com.android.okhttp.HttpsHandler</pattern>
|
||||||
|
<pattern>com.android.org.conscrypt.**</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std
|
||||||
|
</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL</pattern>
|
||||||
|
<pattern>org.apache.harmony.security.provider.cert.DRLCertFactory</pattern>
|
||||||
|
<pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>
|
||||||
|
</forceLinkClasses>
|
||||||
|
<libs>
|
||||||
|
<lib>build/natives/libvtm-jni.a</lib>
|
||||||
|
</libs>
|
||||||
|
<frameworkPaths>
|
||||||
|
<path>build/natives</path>
|
||||||
|
</frameworkPaths>
|
||||||
|
<frameworks>
|
||||||
|
<framework>SVGgh</framework>
|
||||||
|
<framework>UIKit</framework>
|
||||||
|
<framework>OpenGLES</framework>
|
||||||
|
<framework>QuartzCore</framework>
|
||||||
|
<framework>CoreGraphics</framework>
|
||||||
|
<framework>OpenAL</framework>
|
||||||
|
<framework>AudioToolbox</framework>
|
||||||
|
<framework>AVFoundation</framework>
|
||||||
|
</frameworks>
|
||||||
|
</config>
|
@ -13,7 +13,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.ios;
|
package org.oscim.ios.test;
|
||||||
|
|
||||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
|
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
|
||||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
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.UIDevice;
|
||||||
import org.robovm.apple.uikit.UIScreen;
|
import org.robovm.apple.uikit.UIScreen;
|
||||||
|
|
||||||
public class RobovmLauncher extends IOSApplication.Delegate {
|
public class ExampleLauncher extends IOSApplication.Delegate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IOSApplication createApplication() {
|
protected IOSApplication createApplication() {
|
||||||
@ -37,8 +37,13 @@ public class RobovmLauncher extends IOSApplication.Delegate {
|
|||||||
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
|
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
|
||||||
CanvasAdapter.dpi *= scale;
|
CanvasAdapter.dpi *= scale;
|
||||||
|
|
||||||
IOSMapApp iosMapApp = new IOSMapApp();
|
// IOSMapApp iosMapApp = new IOSMapApp();
|
||||||
IOSMapApp.init();
|
// IOSMapAppCluster iosMapApp = new IOSMapAppCluster();
|
||||||
|
|
||||||
|
IOSLineTexTest iosMapApp = new IOSLineTexTest();
|
||||||
|
|
||||||
|
|
||||||
|
iosMapApp.init();
|
||||||
|
|
||||||
return new IOSApplication(iosMapApp, config);
|
return new IOSApplication(iosMapApp, config);
|
||||||
}
|
}
|
||||||
@ -52,7 +57,7 @@ public class RobovmLauncher extends IOSApplication.Delegate {
|
|||||||
NSAutoreleasePool pool = new NSAutoreleasePool();
|
NSAutoreleasePool pool = new NSAutoreleasePool();
|
||||||
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");
|
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();
|
pool.drain();
|
||||||
}
|
}
|
||||||
}
|
}
|
135
vtm-ios-example/src/org/oscim/ios/test/IOSLineTexTest.java
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
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<PathLayer> 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<GeoPoint> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.ios;
|
package org.oscim.ios.test;
|
||||||
|
|
||||||
import org.oscim.backend.GLAdapter;
|
import org.oscim.backend.GLAdapter;
|
||||||
import org.oscim.gdx.GdxAssets;
|
import org.oscim.gdx.GdxAssets;
|