Skip to content

Commit

Permalink
## 4.3.0.1
Browse files Browse the repository at this point in the history
* Throw out invalid polyline points
* Fix R&B arrow direction on globe tilt
* Handle potential invalid memory accesses for meshes that may not have textures
* Set a default tessellation threshold (160km) for polyine rendering
  • Loading branch information
takdeveloper committed Sep 14, 2021
1 parent 3b67ac5 commit ffffecd
Show file tree
Hide file tree
Showing 66 changed files with 1,623 additions and 616 deletions.
7 changes: 7 additions & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Version History

## 4.3.0.1

* Throw out invalid polyline points
* Fix R&B arrow direction on globe tilt
* Handle potential invalid memory accesses for meshes that may not have textures
* Set a default tessellation threshold (160km) for polyine rendering

## 4.3.0.0

* Lasso tool to create imagery download regions
Expand Down
2 changes: 1 addition & 1 deletion atak/ATAK/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import java.util.regex.Pattern
buildscript {

ext.ATAK_VERSION = "4.3.0"
ext.ATAK_VERSION_SUBMINOR = ".0"
ext.ATAK_VERSION_SUBMINOR = ".1"

ext.jacocoVersion = '0.8.5'

Expand Down
15 changes: 15 additions & 0 deletions atak/ATAK/app/src/main/java/com/atakmap/android/maps/Polyline.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.atakmap.android.imagecapture.PointA;
import com.atakmap.android.maps.graphics.GLMapItem;
import com.atakmap.coremap.filesystem.FileSystemUtils;
import com.atakmap.coremap.log.Log;
import com.atakmap.coremap.maps.coords.DistanceCalculations;
import com.atakmap.coremap.maps.coords.GeoBounds;
import com.atakmap.coremap.maps.coords.GeoPoint;
Expand Down Expand Up @@ -162,6 +163,7 @@ public GeoPointMetaData[] getMetaDataPoints() {
* Set the points for the polyline. These points have metadata.
*
* @param points the array of points
* @throws IllegalArgumentException if one of the points is not valid
*/
public void setPoints(GeoPointMetaData[] points) {
this.setPoints(points, 0, points.length);
Expand All @@ -171,6 +173,7 @@ public void setPoints(GeoPointMetaData[] points) {
* Set the points for the polyline. These points do not have any metadata.
*
* @param points the array of points, cannot be null.
* @throws IllegalArgumentException if one of the points is not valid
*/
public void setPoints(GeoPoint[] points) {
this.setPoints(GeoPointMetaData.wrap(points), 0, points.length);
Expand All @@ -182,6 +185,7 @@ public void setPoints(GeoPoint[] points) {
* @param points lat/lon/alt
* @param off the offset into the points array
* @param len the length to be used within the points array.
* @throws IllegalArgumentException if one of the points is not valid
*/
public void setPoints(GeoPoint[] points, int off, int len) {
this.setPoints(GeoPointMetaData.wrap(points), off, len);
Expand All @@ -193,6 +197,7 @@ public void setPoints(GeoPoint[] points, int off, int len) {
* @param points metadata enhanced points
* @param off the offset into the points array
* @param len the length to be used within the points array.
* @throws IllegalArgumentException if one of the points is not valid
*/
synchronized public void setPoints(final GeoPointMetaData[] points,
final int off, final int len) {
Expand All @@ -213,6 +218,16 @@ synchronized public void setPoints(final GeoPointMetaData[] points,

}
}

// Validate
for (int i = off; i < off + len; i++) {
GeoPoint gp = points[i].get();
if (Double.isNaN(gp.getLatitude()) || Double.isNaN(gp.getLongitude())) {
Log.e(getClass().getName(), "Invalid point " + points[i].get(), new Throwable());
// Abandon
return;
}
}

_points.clear();
final int lim = (off + len);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.atakmap.android.maps.MapView;
import com.atakmap.android.maps.Shape;
import com.atakmap.android.maps.Shape.OnPointsChangedListener;
import com.atakmap.coremap.maps.coords.DistanceCalculations;
import com.atakmap.coremap.maps.coords.GeoCalculations;
import com.atakmap.coremap.maps.coords.GeoPoint;
import com.atakmap.coremap.maps.coords.Vector3D;
Expand Down Expand Up @@ -167,6 +168,8 @@ private void _validateArrowhead(GLMapView ortho) {

_arrowheadVersion = ortho.currentPass.drawVersion;

// Fetch last 2 points w/ altitude
GeoPoint[] pts = new GeoPoint[2];
float[] points = new float[6];
for (int i = 0; i < 2; i++) {
ortho.scratch.geo.set(_pts[_pts.length - (2 - i)]);
Expand All @@ -177,11 +180,23 @@ private void _validateArrowhead(GLMapView ortho) {
if(ptAgl)
ortho.scratch.geo.set(getHae(ortho, ortho.scratch.geo));

ortho.forward(ortho.scratch.geo, ortho.scratch.pointD);
pts[i] = new GeoPoint(ortho.scratch.geo);
}

// Compute the nearby tail end of the arrow for more accurate forward results
double distance = pts[1].distanceTo(pts[0]);
double bearing = pts[1].bearingTo(pts[0]);
double inclination = Math.toDegrees(Math.atan2(pts[0].getAltitude() - pts[1].getAltitude(), distance));
pts[0] = DistanceCalculations.computeDestinationPoint(pts[1], bearing, ortho.currentScene.drawMapResolution, inclination);

// Get the tail and head in screen coordinates so we can calculate the on-screen angle
for (int i = 0; i < 2; i++) {
ortho.forward(pts[i], ortho.scratch.pointD);
points[i * 3] = (float) ortho.scratch.pointD.x;
points[i * 3 + 1] = (float) ortho.scratch.pointD.y;
points[i * 3 + 2] = (float) ortho.scratch.pointD.z;
}

int zx = 3, zy = 4, zz = 5;
int yx = 0, yy = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public class GLPolyline extends GLShape2 implements

private final static double DEFAULT_MIN_RENDER_SCALE = (1.0d / 100000.0d);

private static final double threshold = 160000;

private final Polyline _subject;
private boolean _closed;
private DoubleBuffer _points;
Expand Down Expand Up @@ -171,6 +173,7 @@ public GLPolyline(MapRenderer surface, Polyline subject) {
| GLMapView.RENDER_PASS_SURFACE
| GLMapView.RENDER_PASS_SCENES);
this.impl = new GLBatchPolygon(surface);
this.impl.setTesselationThreshold(threshold);

_subject = subject;
GeoPoint[] points = subject.getPoints();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ private void _setMetrics(float azimuth, float fov, float extent) {
}

private void updatePolygon() {

// in this case the camera point is not valid, so the polygon should not be computed
if (Double.isNaN(_point.getLatitude()) || Double.isNaN(_point.getLongitude()))
return;

LineString ls = new LineString(3);

int numSlices = SLICES_PER_90 * (int) Math.ceil(_fov / 90);
Expand All @@ -157,6 +162,7 @@ private void updatePolygon() {
_point, _extent,
_azimuth - (_fov / 2.0f) + ((_fov / numSlices) * i));
ls.addPoint(gp.getLongitude(), gp.getLatitude(), 0);

}

ls.addPoint(_point.getLongitude(), _point.getLatitude(), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import com.atakmap.android.model.viewer.processing.ShaderHelper;
import com.atakmap.android.model.viewer.processing.TextureHelper;
import com.atakmap.map.layer.feature.geometry.Envelope;
import com.atakmap.map.layer.model.Mesh;
import com.atakmap.map.layer.model.Model;
import com.atakmap.map.layer.model.Models;
import com.atakmap.map.layer.model.VertexDataLayout;
import com.atakmap.math.MathUtils;

import java.nio.Buffer;

Expand Down Expand Up @@ -251,23 +253,26 @@ public void onDrawFrame(GL10 gl) {
private void drawModel() {
final VertexDataLayout layout = objModel.getVertexDataLayout();

// XXX - this is assuming that buffer is ByteBuffer
Buffer modelVertices = objModel.getVertices(Model.VERTEX_ATTR_POSITION);
modelVertices.position(layout.position.offset);
if (MathUtils.hasBits(layout.attributes, Mesh.VERTEX_ATTR_POSITION)) {
// XXX - this is assuming that buffer is ByteBuffer
Buffer modelVertices = objModel.getVertices(Mesh.VERTEX_ATTR_POSITION);
modelVertices.position(layout.position.offset);

GLES30.glVertexAttribPointer(positionHandle, 3, GLES30.GL_FLOAT, false,
layout.position.stride,
objModel.getVertices(Model.VERTEX_ATTR_POSITION));
GLES30.glEnableVertexAttribArray(positionHandle);
GLES30.glVertexAttribPointer(positionHandle, 3, GLES30.GL_FLOAT, false,
layout.position.stride, modelVertices);
GLES30.glEnableVertexAttribArray(positionHandle);
}

//pass in texture coordinate information
Buffer modelTexCoords = objModel
.getVertices(Model.VERTEX_ATTR_TEXCOORD_0);
modelTexCoords.position(layout.texCoord0.offset);
if (MathUtils.hasBits(layout.attributes, Mesh.VERTEX_ATTR_TEXCOORD_0)) {
//pass in texture coordinate information
Buffer modelTexCoords = objModel
.getVertices(Mesh.VERTEX_ATTR_TEXCOORD_0);
modelTexCoords.position(layout.texCoord0.offset);

GLES30.glVertexAttribPointer(texCoodsHandle, 2, GLES30.GL_FLOAT, false,
layout.texCoord0.stride, modelTexCoords);
GLES30.glEnableVertexAttribArray(texCoodsHandle);
GLES30.glVertexAttribPointer(texCoodsHandle, 2, GLES30.GL_FLOAT, false,
layout.texCoord0.stride, modelTexCoords);
GLES30.glEnableVertexAttribArray(texCoodsHandle);
}

Matrix.multiplyMM(mvpMatrix, 0, viewMatrix, 0, modelMatrix, 0);
GLES30.glUniformMatrix4fv(mvMatrixHandle, 1, false, mvpMatrix, 0);
Expand Down
Binary file modified atak/ATAK/app/src/main/jniLibs/arm64-v8a/libpgscmedia.so
Binary file not shown.
Binary file modified atak/ATAK/app/src/main/jniLibs/armeabi-v7a/libpgscmedia.so
Binary file not shown.
Binary file modified atak/ATAK/app/src/main/jniLibs/x86/libpgscmedia.so
Binary file not shown.
Binary file modified depends/assimp-4.0.1-mod.tar.gz
Binary file not shown.
Binary file modified depends/gdal-2.4.4-mod.tar.gz
Binary file not shown.
Binary file modified depends/tinygltf-2.4.1-mod.tar.gz
Binary file not shown.
Binary file modified depends/tinygltfloader-0.9.5-mod.tar.gz
Binary file not shown.
29 changes: 12 additions & 17 deletions plugin-examples/helloworld/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

buildscript {
ext.PLUGIN_VERSION = "1.0"
ext.ATAK_VERSION = "4.2.1"
ext.ATAK_VERSION = "4.3.0"

def takdevVersion = '2.0.0'

Expand Down Expand Up @@ -59,7 +59,7 @@
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.0.2'
if(isDevKitEnabled()) {
classpath "com.atakmap.gradle:atak-gradle-takdev:${takdevVersion}"
} else {
Expand Down Expand Up @@ -251,7 +251,7 @@ android {
getIsDefault().set(true)
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".MIL"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
civ {
dimension "application"
Expand All @@ -261,42 +261,42 @@ android {
fvey {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".FVEY"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
aus {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".AUS"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
nzl {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".NZL"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
prt {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".PRT"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
nor {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".NOR"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
hun {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".HUN"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
bel {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".BEL"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
gbr {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".GBR"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}
gov {
dimension "application"
Expand All @@ -306,12 +306,7 @@ android {
can {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".CAN"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.fvey"'
}
intl {
dimension "application"
manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".INTL"]
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.intl"'
buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"'
}

applicationVariants.all { variant ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package com.atakmap.android.helloworld;

import com.atakmap.android.test.helpers.ATAKTestClass;
Expand All @@ -12,14 +13,14 @@

import android.os.Build;


public class ExampleTest extends ATAKTestClass {
private final HelloWorldRobot helloWorldRobot = new HelloWorldRobot();

@BeforeClass
public static void setupPlugin() throws Exception {
HelloWorldRobot.installPlugin();
fixClassLoaderForClass(ExampleTest.class, "com.atakmap.android.helloworld.plugin");
fixClassLoaderForClass(ExampleTest.class,
"com.atakmap.android.helloworld.plugin");
}

@AfterClass
Expand Down Expand Up @@ -61,7 +62,7 @@ public void testTrackSpaceStation() {
// The current ISS plotting site uses cleartext http connection and offers no https ability.
// Since this is not allowed on Android 9 or higher, do not test this capability.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
return;
return;

helloWorldRobot
.openToolFromOverflow()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package com.atakmap.android.helloworld;

import android.content.Context;
import android.os.SystemClock;

import androidx.test.platform.app.InstrumentationRegistry;

Expand All @@ -12,16 +12,17 @@
import static org.junit.Assert.*;

import org.junit.Test;
import com.atakmap.coremap.loader.NativeLoader;

public class GeocoordTest extends ATAKTestClass {
private final Context appContext = InstrumentationRegistry
.getInstrumentation()
.getTargetContext();

@Test
public void coordTest() {

double bearing = GeoCalculations.bearingTo(new GeoPoint(0, 100),
new GeoPoint(100,100));
new GeoPoint(100, 100));
assertTrue(Double.compare(bearing, 0) == 0);
}

Expand Down
Loading

0 comments on commit ffffecd

Please sign in to comment.