Skip to content
Snippets Groups Projects
Commit 6bb7ba6e authored by Knuiman, Bart's avatar Knuiman, Bart
Browse files

Fixeups with dependencies (injected code directly instead of dlls)

parent e3e4aee6
No related branches found
No related tags found
No related merge requests found
Showing
with 229 additions and 3 deletions
File added
fileFormatVersion: 2
guid: 739694b2bfd48604fabba992b69019e1
guid: 88653d0467cd2a6459649edf0e0e134c
PluginImporter:
externalObjects: {}
serializedVersion: 2
......
File deleted
......@@ -6,6 +6,8 @@ can convert the tile to a raster for basing a terrain upon it.
### Dependencies (GIT Pacakages)
- utils
- geotiff (for height on terrain)
- vectortile (for building up from vector tile info)
### Usage:
......@@ -20,7 +22,7 @@ tile.ForEach( width=1024, height=1024, (x, y, feature) =>
}
});
Texture2D texture = tile.RenderToTexture( width=1024, height=1024, layers );
Texture2D texture = tile.RenderToTextureSingle( width=1024, height=1024, layers );
```
......@@ -20,7 +20,7 @@ tile.ForEach( width=1024, height=1024, (x, y, feature) =>
}
});
Texture2D renderToT
Texture2D texture = tile.RenderToTexture( width=1024, height=1024, layers );
```
fileFormatVersion: 2
guid: bbab297a12638014487a8475bdf10b2d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File moved
File moved
fileFormatVersion: 2
guid: 487d8e347ba4ad4408c1af5125574847
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections.Generic;
using System.Linq;
namespace Mapbox.Vector.Tile
{
public static class AttributesParser
{
public static List<KeyValuePair<string, object>> Parse( List<string> keys, List<Tile.Value> values, List<uint> tags )
{
var result = new List<KeyValuePair<string, object>>();
var odds = tags.GetOdds().ToList();
var evens = tags.GetEvens().ToList();
for (var i = 0;i < evens.Count;i++)
{
var key = keys[(int)evens[i]];
var val = values[(int)odds[i]];
var valObject = GetAttr(val);
result.Add( new KeyValuePair<string, object>( key, valObject ) );
}
return result;
}
private static object GetAttr( Tile.Value value )
{
object res = null;
if (value.HasBoolValue)
{
res = value.BoolValue;
}
else if (value.HasDoubleValue)
{
res = value.DoubleValue;
}
else if (value.HasFloatValue)
{
res = value.FloatValue;
}
else if (value.HasIntValue)
{
res = value.IntValue;
}
else if (value.HasStringValue)
{
res = value.StringValue;
}
else if (value.HasSIntValue)
{
res = value.SintValue;
}
else if (value.HasUIntValue)
{
res = value.UintValue;
}
return res;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 7ddc3eda35313e348b619c20c6766b09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections.Generic;
namespace Mapbox.Vector.Tile
{
public class ClassifyRings
{
// docs for inner/outer rings https://www.mapbox.com/vector-tiles/specification/
public static List<List<List<Coordinate>>> Classify( List<List<Coordinate>> rings )
{
var polygons = new List<List<List<Coordinate>>>();
List<List<Coordinate>> newpoly = null;
foreach (var ring in rings)
{
var poly = new VTPolygon(ring);
if (poly.IsOuterRing())
{
newpoly = new List<List<Coordinate>>() { ring };
polygons.Add( newpoly );
}
else
{
newpoly?.Add( ring );
}
}
return polygons;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 6c8d27925c3d99c459cf664239745370
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
namespace Mapbox.Vector.Tile
{
public class Coordinate
{
public long X { get; set; }
public long Y { get; set; }
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e36fb4bb8cbc3694a85d52f3cd638fe3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ef23de46add61dc4ca4a12ec0bb17c27
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using GeoJSON.Net.Geometry;
using System;
namespace Mapbox.Vector.Tile
{
public static class CoordinateExtensions
{
public static Position ToPosition( this Coordinate c, int x, int y, int z, uint extent )
{
var size = extent * Math.Pow(2, z);
var x0 = extent * x;
var y0 = extent * y;
var y2 = 180 - (c.Y + y0) * 360 / size;
var lon = (c.X + x0) * 360 / size - 180;
var lat = 360 / Math.PI * Math.Atan(Math.Exp(y2 * Math.PI / 180)) - 90;
return new Position( lat, lon );
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: b80bae9fd3da4514582ff65e840fc636
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections.Generic;
using System.Linq;
namespace Mapbox.Vector.Tile
{
public static class EnumerableExtensions
{
public static IEnumerable<T> GetOdds<T>( this IEnumerable<T> sequence )
{
return sequence.Where( ( item, index ) => index % 2 != 0 );
}
public static IEnumerable<T> GetEvens<T>( this IEnumerable<T> sequence )
{
return sequence.Where( ( item, index ) => index % 2 == 0 );
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 624190ce711a23149b71b867d2d5f9e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment