dodano oznaczanie działek

This commit is contained in:
veniti 2019-11-18 23:56:28 +01:00
parent cb2a6b16f3
commit 4facf6c3ba
7 changed files with 70 additions and 579 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using Assets.Cities;
using Assets.Common;
using System;
using Assets.Voronoi;
using UnityEngine;
using Random = System.Random;
namespace Assets.AnnotationPass
{
@ -18,6 +21,8 @@ namespace Assets.AnnotationPass
public double MinNudgeDistance { get; set; } = .75;
public double MinimumRoadLength { get; set; } = 2;
public double BusinessCityFields { get; set; } = 0.3;
public double LivingCityFields { get; set; } = 0.7;
public CityFieldsPass(Random random)
{
@ -120,6 +125,8 @@ namespace Assets.AnnotationPass
(current, next) = (next, GetNext(next, current));
} while (current != start && watchdog-- > 0);
field.Center = PointUtils.Mean(field.Boundary);
return field;
}
@ -133,6 +140,26 @@ namespace Assets.AnnotationPass
// remove outside field
city.Fields.RemoveAll(field => !PointUtils.IsClockwise(field.Boundary));
// add field types
var orderedFields = city.Fields.OrderBy(cf => Point.Dist(cf.Center, city.Center)).ToList();
orderedFields.First().cityFieldType = CityFieldTypes.MainSquare;
int businessCityFields = (int)Math.Ceiling((BusinessCityFields*orderedFields.Count()));
foreach (var cityField in orderedFields.Skip(1).Take(businessCityFields))
{
cityField.cityFieldType = CityFieldTypes.Business;
}
foreach (var cityField in orderedFields.Skip(1+businessCityFields))
{
cityField.cityFieldType = CityFieldTypes.Living;
}
}
public void Annotate(Map map)

View File

@ -30,6 +30,9 @@ namespace Assets.AnnotationPass
City newCity = new City();
var site = _basicGraph.Vertices[vertex];
newCity.Center = site.Center.Clone() as Point;
site.Tags.Add("City.Center");
var sites = new List<MapSite> { site };
var location = site.Metadata.GetProperty<Location>(LandmassPass.SiteLocationProperty);

View File

@ -5,7 +5,7 @@ using Assets.Voronoi;
namespace Assets.Cities
{
public class City
public class City : IHasMetadata
{
public List<MapSite> Sites { get; set; } = new List<MapSite>();
@ -15,6 +15,7 @@ namespace Assets.Cities
public List<CityField> Fields { get; set; } = new List<CityField>();
public List<(int, int)> Edges = new List<(int, int)>();
public Point Center { get; set; }
public City()
{
@ -38,5 +39,7 @@ namespace Assets.Cities
Edges = a.Union(b).Except(a.Intersect(b)).ToList();
}
public Metadata Metadata { get; } = new Metadata();
}
}

View File

@ -3,8 +3,17 @@ using Assets.Common;
namespace Assets.Cities
{
public enum CityFieldTypes
{
MainSquare,
Business,
Living
}
public class CityField
{
public IList<Point> Boundary { get; set; } = new List<Point>();
public CityFieldTypes cityFieldType { get; set; }
public Point Center { get; set; }
}
}

View File

@ -3,7 +3,7 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 17
serializedVersion: 18
productGUID: 59b609f943ea458cd81d6a9bda1ea716
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
@ -52,8 +52,8 @@ PlayerSettings:
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosAppInBackgroundBehavior: 0
displayResolutionDialog: 0
iosUseCustomAppBackgroundBehavior: 0
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1
@ -156,7 +156,6 @@ PlayerSettings:
protectGraphicsMemory: 0
enableFrameTimingStats: 0
useHDRDisplay: 0
D3DHDRBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
resolutionScalingMode: 0
@ -597,6 +596,7 @@ PlayerSettings:
XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0
XboxOneXTitleMemory: 8
xboxOneScriptCompiler: 1
XboxOneOverrideIdentityName:
vrEditorSettings:
daydream:

View File

@ -1,2 +1,2 @@
m_EditorVersion: 2019.2.0f1
m_EditorVersionWithRevision: 2019.2.0f1 (20c1667945cf)
m_EditorVersion: 2019.3.0a8
m_EditorVersionWithRevision: 2019.3.0a8 (8ea4afdbfa47)