As part of a significant update to the SmartDirt app on Android there were some improvements made to the functionality along with supporting updates to the user interface. The following is a summary of the updates
One other visible change is a change to the package naming for the application. We introduced four types of builds: dev, alpha, beta and rel. The nightly build is now the dev build and the labeling for this build appears to the user on the About screen. Build Number: XXX now changes to Build: Dev-XXX where XXX is the build number. The Alpha and Beta build types are for internal and external testing purposes. The About screen will show Build: Alpha-XXX and Build: Beta-XXX where XXX is the build number. On Android the Alpha and Beta builds are generated out of a release branch and the Version: X.X.X is the name of the release version. Finally the rel build is shown on the About screen with Build: Release. No build number is used for the release build.
In the Android code base there were a few different terms used to identify the Reference and Difference surfaces. These includes things like CompareTo, Design, Compare, View, Display etc… Most of these have been changed to Reference and Differences. An additional term which is View Surface is now used to identify the surface which the colored mesh is applied to. By default this surface starts as the Reference surface that is read from the Isopach.
The code was changed to load both surfaces that are identified in the isopach. Only the Reference surface was loaded in the past. The isopach also flushed the trimesh and line data from the bottom or Difference surface if it was loaded. This caused significant issues when switching the view surface since the device had to rebuild the trimesh from points and lines.
The cut/fill values are loaded from the isopach and these values are used to determine surface colors no matter which surface is the current view surface. As mentioned above an additional coloring is now available that is references to as “shaded”. When this is set the color is forced to “yellow” (i.e. middle of color table). The same diffusion code is used to get the proper shading on vertical surfaces. The isopach data is still available for proper measurements. The old code that rendered monochrome surfaces is no longer used. The mechanism for that code to be used was to check “Skip Cut/Fill”. The side effect of this was to dump the isopach. This caused measurements to stop working since the cut/fill data was gone. Also, the only way to get the isopach back was to have the device rebuild it.
Java has major memory and performance issues with Objects. This becomes especially apparent in objects that get replicated a lot, such as points or vertices. The Android code has objects for both 2D and 3D vertices (Vertex2D and Vertex3D). If these are created a lot it becomes a pretty significant performance issue. It also is a memory issue because Objects have pretty large overhead in Java. At the core of the memory improvement was removing ArrayLists of these objects in favor of arrays of primitives. There is still work left to do for lines and points. Both of these still use bloated Java Objects and Containers.
Updates were also made in the TriMesh C++ code. One significant update is the addition of a method to retrieve all the elevations at one time. The Java JNI interface to the C++ layer has significant performance issues when it is hit too often. This was the case when the elevations were retrieved for each vertex of each triangle. A significant performance improvement was made in the RenderCutFill code by getting all the elevations at the same time.
Also updated pushing triangles into the Trimesh C++ code. This change added a method to TriMesh.cpp, Surface.cpp and updating surfaceControl.cpp. The previous surfaceControl code looped through the triangles calling addtriangle in CSurface which in turn calls addtriangle in CTrimesh. The side effect of this is that memory must be allocated on the fly using Realloc. This slows things down. The new methods send the triangle vertices all the way to the CTrimesh class which allocates the required memory and adds the triangles. This improvement is general and should be used in all places this trimesh code is used.