diff --git a/GameRealisticMap.Arma3/Arma3LayerGeneratorCatalog.cs b/GameRealisticMap.Arma3/Arma3LayerGeneratorCatalog.cs index 7383c4d4..d49bca27 100644 --- a/GameRealisticMap.Arma3/Arma3LayerGeneratorCatalog.cs +++ b/GameRealisticMap.Arma3/Arma3LayerGeneratorCatalog.cs @@ -2,6 +2,7 @@ using GameRealisticMap.Arma3.ManMade; using GameRealisticMap.Arma3.ManMade.Farmlands; using GameRealisticMap.Arma3.Nature.DefaultAreas; +using GameRealisticMap.Arma3.Nature.DefaultUrbanAreas; using GameRealisticMap.Arma3.Nature.Forests; using GameRealisticMap.Arma3.Nature.Lakes; using GameRealisticMap.Arma3.Nature.RockAreas; @@ -27,6 +28,12 @@ public Arma3LayerGeneratorCatalog(IProgressSystem progress, IArma3RegionAssets a Generators.Add(new VineyardsGenerator(progress, assets)); Generators.Add(new OrchardGenerator(progress, assets)); Generators.Add(new SidewalksGenerator(progress, assets)); + Generators.Add(new DefaultAgriculturalAreasGenerator(progress, assets)); + Generators.Add(new DefaultCommercialAreasGenerator(progress, assets)); + Generators.Add(new DefaultIndustrialAreasGenerator(progress, assets)); + Generators.Add(new DefaultMilitaryAreasGenerator(progress, assets)); + Generators.Add(new DefaultResidentialAreasGenerator(progress, assets)); + Generators.Add(new DefaultRetailAreasGenerator(progress, assets)); // Nature Generators.Add(new ForestEdgeGenerator(progress, assets)); diff --git a/GameRealisticMap.Arma3/Assets/Filling/BasicCollectionId.cs b/GameRealisticMap.Arma3/Assets/Filling/BasicCollectionId.cs index b78a796b..fa7a9282 100644 --- a/GameRealisticMap.Arma3/Assets/Filling/BasicCollectionId.cs +++ b/GameRealisticMap.Arma3/Assets/Filling/BasicCollectionId.cs @@ -8,6 +8,12 @@ public enum BasicCollectionId RocksAdditional, DefaultAreas, WatercourseAdditional, - SmallOrchard + SmallOrchard, + DefaultAgriculturalAreas, + DefaultCommercialAreas, + DefaultIndustrialAreas, + DefaultMilitaryAreas, + DefaultResidentialAreas, + DefaultRetailAreas } } \ No newline at end of file diff --git a/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreasGenerator.cs b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreasGenerator.cs new file mode 100644 index 00000000..298d852a --- /dev/null +++ b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreasGenerator.cs @@ -0,0 +1,19 @@ +using GameRealisticMap.Arma3.Assets; +using GameRealisticMap.Arma3.Assets.Filling; +using GameRealisticMap.ManMade.DefaultUrbanAreas; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.Arma3.Nature.DefaultUrbanAreas +{ + internal class DefaultAgriculturalAreasGenerator : BasicGeneratorBase + { + public DefaultAgriculturalAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets) + : base(progress, assets) + { + } + + protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0; + + protected override BasicCollectionId Id => BasicCollectionId.DefaultAgriculturalAreas; + } +} diff --git a/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultCommercialAreasGenerator.cs b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultCommercialAreasGenerator.cs new file mode 100644 index 00000000..7a72adbe --- /dev/null +++ b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultCommercialAreasGenerator.cs @@ -0,0 +1,19 @@ +using GameRealisticMap.Arma3.Assets; +using GameRealisticMap.Arma3.Assets.Filling; +using GameRealisticMap.ManMade.DefaultUrbanAreas; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.Arma3.Nature.DefaultUrbanAreas +{ + internal class DefaultCommercialAreasGenerator : BasicGeneratorBase + { + public DefaultCommercialAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets) + : base(progress, assets) + { + } + + protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0; + + protected override BasicCollectionId Id => BasicCollectionId.DefaultCommercialAreas; + } +} diff --git a/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultIndustrialAreasGenerator.cs b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultIndustrialAreasGenerator.cs new file mode 100644 index 00000000..35b31e6e --- /dev/null +++ b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultIndustrialAreasGenerator.cs @@ -0,0 +1,19 @@ +using GameRealisticMap.Arma3.Assets; +using GameRealisticMap.Arma3.Assets.Filling; +using GameRealisticMap.ManMade.DefaultUrbanAreas; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.Arma3.Nature.DefaultUrbanAreas +{ + internal class DefaultIndustrialAreasGenerator : BasicGeneratorBase + { + public DefaultIndustrialAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets) + : base(progress, assets) + { + } + + protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0; + + protected override BasicCollectionId Id => BasicCollectionId.DefaultIndustrialAreas; + } +} diff --git a/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultMilitaryAreasGenerator.cs b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultMilitaryAreasGenerator.cs new file mode 100644 index 00000000..408bad54 --- /dev/null +++ b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultMilitaryAreasGenerator.cs @@ -0,0 +1,19 @@ +using GameRealisticMap.Arma3.Assets; +using GameRealisticMap.Arma3.Assets.Filling; +using GameRealisticMap.ManMade.DefaultUrbanAreas; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.Arma3.Nature.DefaultUrbanAreas +{ + internal class DefaultMilitaryAreasGenerator : BasicGeneratorBase + { + public DefaultMilitaryAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets) + : base(progress, assets) + { + } + + protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0; + + protected override BasicCollectionId Id => BasicCollectionId.DefaultMilitaryAreas; + } +} diff --git a/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultResidentialAreasGenerator.cs b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultResidentialAreasGenerator.cs new file mode 100644 index 00000000..5c5b1b28 --- /dev/null +++ b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultResidentialAreasGenerator.cs @@ -0,0 +1,19 @@ +using GameRealisticMap.Arma3.Assets; +using GameRealisticMap.Arma3.Assets.Filling; +using GameRealisticMap.ManMade.DefaultUrbanAreas; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.Arma3.Nature.DefaultUrbanAreas +{ + internal class DefaultResidentialAreasGenerator : BasicGeneratorBase + { + public DefaultResidentialAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets) + : base(progress, assets) + { + } + + protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0; + + protected override BasicCollectionId Id => BasicCollectionId.DefaultResidentialAreas; + } +} diff --git a/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultRetailAreasGenerator.cs b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultRetailAreasGenerator.cs new file mode 100644 index 00000000..54a67e3f --- /dev/null +++ b/GameRealisticMap.Arma3/ManMade/DefaultUrbanAreas/DefaultRetailAreasGenerator.cs @@ -0,0 +1,19 @@ +using GameRealisticMap.Arma3.Assets; +using GameRealisticMap.Arma3.Assets.Filling; +using GameRealisticMap.ManMade.DefaultUrbanAreas; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.Arma3.Nature.DefaultUrbanAreas +{ + internal class DefaultRetailAreasGenerator : BasicGeneratorBase + { + public DefaultRetailAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets) + : base(progress, assets) + { + } + + protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0; + + protected override BasicCollectionId Id => BasicCollectionId.DefaultRetailAreas; + } +} diff --git a/GameRealisticMap.Studio/Labels.Designer.cs b/GameRealisticMap.Studio/Labels.Designer.cs index 4244504f..d6a0344c 100644 --- a/GameRealisticMap.Studio/Labels.Designer.cs +++ b/GameRealisticMap.Studio/Labels.Designer.cs @@ -332,7 +332,16 @@ public static string AssetDefault { } /// - /// Recherche une chaîne localisée semblable à Default Areas. + /// Recherche une chaîne localisée semblable à Default Areas - Agricultural. + /// + public static string AssetDefaultAgriculturalAreas { + get { + return ResourceManager.GetString("AssetDefaultAgriculturalAreas", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Default Areas - Non urban / natural. /// public static string AssetDefaultAreas { get { @@ -340,6 +349,15 @@ public static string AssetDefaultAreas { } } + /// + /// Recherche une chaîne localisée semblable à Default Areas - Commercial / offices. + /// + public static string AssetDefaultCommercialAreas { + get { + return ResourceManager.GetString("AssetDefaultCommercialAreas", resourceCulture); + } + } + /// /// Recherche une chaîne localisée semblable à Default ground - Industrial. /// @@ -349,6 +367,42 @@ public static string AssetDefaultIndustrial { } } + /// + /// Recherche une chaîne localisée semblable à Default Areas - Industrial. + /// + public static string AssetDefaultIndustrialAreas { + get { + return ResourceManager.GetString("AssetDefaultIndustrialAreas", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Default Areas - Military. + /// + public static string AssetDefaultMilitaryAreas { + get { + return ResourceManager.GetString("AssetDefaultMilitaryAreas", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Default Areas - Residential. + /// + public static string AssetDefaultResidentialAreas { + get { + return ResourceManager.GetString("AssetDefaultResidentialAreas", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Default Areas - Retail. + /// + public static string AssetDefaultRetailAreas { + get { + return ResourceManager.GetString("AssetDefaultRetailAreas", resourceCulture); + } + } + /// /// Recherche une chaîne localisée semblable à Default ground - Urban. /// diff --git a/GameRealisticMap.Studio/Labels.fr.resx b/GameRealisticMap.Studio/Labels.fr.resx index c70a9702..465951ea 100644 --- a/GameRealisticMap.Studio/Labels.fr.resx +++ b/GameRealisticMap.Studio/Labels.fr.resx @@ -145,7 +145,7 @@ Le fichier de style de carte est manquant. - Zones par défaut + Zones par défaut - Non urbain / nature Bouche d'incendie @@ -1141,4 +1141,22 @@ Dernière génération le {1} Trottoirs + + Zones par défaut - Agricole + + + Zones par défaut - Bureaux + + + Zones par défaut - Industriel + + + Zones par défaut - Militaire + + + Zones par défaut - Résidentiel + + + Zones par défaut - Commercial + \ No newline at end of file diff --git a/GameRealisticMap.Studio/Labels.resx b/GameRealisticMap.Studio/Labels.resx index 80a37138..454874ec 100644 --- a/GameRealisticMap.Studio/Labels.resx +++ b/GameRealisticMap.Studio/Labels.resx @@ -136,7 +136,7 @@ Commercial Building - Default Areas + Default Areas - Non urban / natural Fence @@ -1141,4 +1141,22 @@ Last generated on {1} Sidewalks + + Default Areas - Agricultural + + + Default Areas - Commercial / offices + + + Default Areas - Industrial + + + Default Areas - Military + + + Default Areas - Residential + + + Default Areas - Retail + \ No newline at end of file diff --git a/GameRealisticMap.Studio/Resources/Icons/DefaultAgriculturalAreas.png b/GameRealisticMap.Studio/Resources/Icons/DefaultAgriculturalAreas.png new file mode 100644 index 00000000..9f6daf0d Binary files /dev/null and b/GameRealisticMap.Studio/Resources/Icons/DefaultAgriculturalAreas.png differ diff --git a/GameRealisticMap.Studio/Resources/Icons/DefaultAreas.png b/GameRealisticMap.Studio/Resources/Icons/DefaultAreas.png index 3f49a321..720a80ae 100644 Binary files a/GameRealisticMap.Studio/Resources/Icons/DefaultAreas.png and b/GameRealisticMap.Studio/Resources/Icons/DefaultAreas.png differ diff --git a/GameRealisticMap.Studio/Resources/Icons/DefaultCommercialAreas.png b/GameRealisticMap.Studio/Resources/Icons/DefaultCommercialAreas.png new file mode 100644 index 00000000..ef967091 Binary files /dev/null and b/GameRealisticMap.Studio/Resources/Icons/DefaultCommercialAreas.png differ diff --git a/GameRealisticMap.Studio/Resources/Icons/DefaultIndustrialAreas.png b/GameRealisticMap.Studio/Resources/Icons/DefaultIndustrialAreas.png new file mode 100644 index 00000000..99fd0f04 Binary files /dev/null and b/GameRealisticMap.Studio/Resources/Icons/DefaultIndustrialAreas.png differ diff --git a/GameRealisticMap.Studio/Resources/Icons/DefaultMilitaryAreas.png b/GameRealisticMap.Studio/Resources/Icons/DefaultMilitaryAreas.png new file mode 100644 index 00000000..ef87407f Binary files /dev/null and b/GameRealisticMap.Studio/Resources/Icons/DefaultMilitaryAreas.png differ diff --git a/GameRealisticMap.Studio/Resources/Icons/DefaultResidentialAreas.png b/GameRealisticMap.Studio/Resources/Icons/DefaultResidentialAreas.png new file mode 100644 index 00000000..f1940635 Binary files /dev/null and b/GameRealisticMap.Studio/Resources/Icons/DefaultResidentialAreas.png differ diff --git a/GameRealisticMap.Studio/Resources/Icons/DefaultRetailAreas.png b/GameRealisticMap.Studio/Resources/Icons/DefaultRetailAreas.png new file mode 100644 index 00000000..343d5f7b Binary files /dev/null and b/GameRealisticMap.Studio/Resources/Icons/DefaultRetailAreas.png differ diff --git a/GameRealisticMap/BuildersCatalog.cs b/GameRealisticMap/BuildersCatalog.cs index 4aaf4489..812c0080 100644 --- a/GameRealisticMap/BuildersCatalog.cs +++ b/GameRealisticMap/BuildersCatalog.cs @@ -1,6 +1,7 @@ using GameRealisticMap.ElevationModel; using GameRealisticMap.ManMade; using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.ManMade.DefaultUrbanAreas; using GameRealisticMap.ManMade.Farmlands; using GameRealisticMap.ManMade.Fences; using GameRealisticMap.ManMade.Objects; @@ -62,6 +63,12 @@ public BuildersCatalog(IProgressSystem progress, IRoadTypeLibrary(IDataBuilder builder) diff --git a/GameRealisticMap/ManMade/CategoryAreaBuilder.cs b/GameRealisticMap/ManMade/CategoryAreaBuilder.cs index ddf0d553..267c5239 100644 --- a/GameRealisticMap/ManMade/CategoryAreaBuilder.cs +++ b/GameRealisticMap/ManMade/CategoryAreaBuilder.cs @@ -23,7 +23,10 @@ public CategoryAreaData Build(IBuildContext context) var buildingType = GetBuildingType(area.Tags.GetValue("landuse")); if (buildingType != null) { - var polygons = context.OsmSource.Interpret(area).SelectMany(geometry => TerrainPolygon.FromGeometry(geometry, context.Area.LatLngToTerrainPoint)).ToList(); + var polygons = context.OsmSource.Interpret(area) + .SelectMany(geometry => TerrainPolygon.FromGeometry(geometry, context.Area.LatLngToTerrainPoint)) + .SelectMany(g => g.ClippedBy(context.Area.TerrainBounds)) + .ToList(); areas.Add(new CategoryArea(buildingType.Value, polygons)); } report.ReportOneDone(); diff --git a/GameRealisticMap/ManMade/CategoryAreaData.cs b/GameRealisticMap/ManMade/CategoryAreaData.cs index b4084026..24e6228f 100644 --- a/GameRealisticMap/ManMade/CategoryAreaData.cs +++ b/GameRealisticMap/ManMade/CategoryAreaData.cs @@ -1,11 +1,19 @@ using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; using GameRealisticMap.Nature; -using GeoJSON.Text.Feature; namespace GameRealisticMap.ManMade { public class CategoryAreaData : INonDefaultArea { + public static BuildingTypeId[] Categories = new[] { + BuildingTypeId.Residential, + BuildingTypeId.Military, + BuildingTypeId.Commercial, + BuildingTypeId.Retail, + BuildingTypeId.Industrial, + BuildingTypeId.Agricultural }; + public CategoryAreaData(List areas) { Areas = areas; diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreaData.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreaData.cs new file mode 100644 index 00000000..e090068e --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreaData.cs @@ -0,0 +1,13 @@ +using GameRealisticMap.Geometries; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + public class DefaultAgriculturalAreaData : DefaultCategoryAreaDataBase + { + public DefaultAgriculturalAreaData(List areas) + : base(areas) + { + + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreasBuilder.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreasBuilder.cs new file mode 100644 index 00000000..c0d6cdef --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultAgriculturalAreasBuilder.cs @@ -0,0 +1,20 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + internal class DefaultAgriculturalAreasBuilder : DefaultUrbanAreasBuilderBase + { + public DefaultAgriculturalAreasBuilder(IProgressSystem progress) : base(progress) + { + } + + protected override BuildingTypeId TragetedType => BuildingTypeId.Agricultural; + + protected override DefaultAgriculturalAreaData Create(List polygons) + { + return new DefaultAgriculturalAreaData(polygons); + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCategoryAreaDataBase.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCategoryAreaDataBase.cs new file mode 100644 index 00000000..9b2d31fc --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCategoryAreaDataBase.cs @@ -0,0 +1,25 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.Nature; +using GeoJSON.Text.Feature; +using GeoJSON.Text.Geometry; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + public abstract class DefaultCategoryAreaDataBase : IGeoJsonData, IPolygonTerrainData + { + public DefaultCategoryAreaDataBase(List polygons) + { + Polygons = polygons; + } + + public List Polygons { get; } + + public IEnumerable ToGeoJson(Func project) + { + var properties = new Dictionary() { + {"type", "defaultCategory" } + }; + return Polygons.Select(b => new Feature(b.ToGeoJson(project), properties)); + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCategoryAreasBuilderBase.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCategoryAreasBuilderBase.cs new file mode 100644 index 00000000..b29b65ea --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCategoryAreasBuilderBase.cs @@ -0,0 +1,75 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.ManMade.Fences; +using GameRealisticMap.ManMade.Objects; +using GameRealisticMap.Nature; +using GameRealisticMap.Nature.Trees; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + internal abstract class DefaultUrbanAreasBuilderBase : IDataBuilder + where TData : class + { + private readonly IProgressSystem progress; + + public DefaultUrbanAreasBuilderBase(IProgressSystem progress) + { + this.progress = progress; + } + + public TData Build(IBuildContext context) + { + var categories = context.GetData(); + + var areaPolygons = categories.Areas + .Where(a => a.BuildingType == TragetedType) + .SelectMany(p => p.PolyList) + .ToList(); + + if (areaPolygons.Count == 0) + { + return Create(new List()); + } + + var polygonsToSubstract = CreateMask(context, categories, areaPolygons); + + var area = Merge(areaPolygons); + + var polygons = area.SubstractAll(progress, "SubstractAll", polygonsToSubstract); + + return Create(polygons.ToList()); + } + + private List CreateMask(IBuildContext context, CategoryAreaData categories, List areaPolygons) + { + using var report = progress.CreateStep("CreateMask", 1); + + var allData = context.GetOfType().Where(c => c != categories).ToList(); + + var polygonsToSubstract = allData.SelectMany(l => l.Polygons).ToList(); + polygonsToSubstract.AddRange(context.GetData().Objects.Select(o => TerrainPolygon.FromCircle(o.Point, 1f))); + polygonsToSubstract.AddRange(context.GetData().Points.Select(o => TerrainPolygon.FromCircle(o, 2f))); + polygonsToSubstract.AddRange(context.GetData().Fences.SelectMany(o => o.Polygons)); + var priority = CategoryAreaData.Categories.TakeWhile(t => t != TragetedType).ToList(); + if (priority.Count > 0) + { + polygonsToSubstract.AddRange(categories.Areas.Where(a => priority.Contains(a.BuildingType)).SelectMany(p => p.PolyList)); + } + + polygonsToSubstract.RemoveAll(p => !areaPolygons.Any(a => a.EnveloppeIntersects(p))); + + return polygonsToSubstract; + } + + protected abstract BuildingTypeId TragetedType { get; } + + protected abstract TData Create(List polygons); + + private List Merge(List areaPolygons) + { + using var report = progress.CreateStep("MergeAll", areaPolygons.Count); + return TerrainPolygon.MergeAllParallel(areaPolygons, report); + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCommercialAreaData.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCommercialAreaData.cs new file mode 100644 index 00000000..ead759c7 --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCommercialAreaData.cs @@ -0,0 +1,13 @@ +using GameRealisticMap.Geometries; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + public class DefaultCommercialAreaData : DefaultCategoryAreaDataBase + { + public DefaultCommercialAreaData(List areas) + : base(areas) + { + + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCommercialAreasBuilder.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCommercialAreasBuilder.cs new file mode 100644 index 00000000..77aeb86e --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultCommercialAreasBuilder.cs @@ -0,0 +1,20 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + internal class DefaultCommercialAreasBuilder : DefaultUrbanAreasBuilderBase + { + public DefaultCommercialAreasBuilder(IProgressSystem progress) : base(progress) + { + } + + protected override BuildingTypeId TragetedType => BuildingTypeId.Commercial; + + protected override DefaultCommercialAreaData Create(List polygons) + { + return new DefaultCommercialAreaData(polygons); + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultIndustrialAreaData.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultIndustrialAreaData.cs new file mode 100644 index 00000000..e2863b1b --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultIndustrialAreaData.cs @@ -0,0 +1,13 @@ +using GameRealisticMap.Geometries; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + public class DefaultIndustrialAreaData : DefaultCategoryAreaDataBase + { + public DefaultIndustrialAreaData(List areas) + : base(areas) + { + + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultIndustrialAreasBuilder.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultIndustrialAreasBuilder.cs new file mode 100644 index 00000000..274e0600 --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultIndustrialAreasBuilder.cs @@ -0,0 +1,20 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + internal class DefaultIndustrialAreasBuilder : DefaultUrbanAreasBuilderBase + { + public DefaultIndustrialAreasBuilder(IProgressSystem progress) : base(progress) + { + } + + protected override BuildingTypeId TragetedType => BuildingTypeId.Industrial; + + protected override DefaultIndustrialAreaData Create(List polygons) + { + return new DefaultIndustrialAreaData(polygons); + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultMilitaryAreaData.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultMilitaryAreaData.cs new file mode 100644 index 00000000..b96772c2 --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultMilitaryAreaData.cs @@ -0,0 +1,13 @@ +using GameRealisticMap.Geometries; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + public class DefaultMilitaryAreaData : DefaultCategoryAreaDataBase + { + public DefaultMilitaryAreaData(List areas) + : base(areas) + { + + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultMilitaryAreasBuilder.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultMilitaryAreasBuilder.cs new file mode 100644 index 00000000..ee6410f4 --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultMilitaryAreasBuilder.cs @@ -0,0 +1,20 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + internal class DefaultMilitaryAreasBuilder : DefaultUrbanAreasBuilderBase + { + public DefaultMilitaryAreasBuilder(IProgressSystem progress) : base(progress) + { + } + + protected override BuildingTypeId TragetedType => BuildingTypeId.Military; + + protected override DefaultMilitaryAreaData Create(List polygons) + { + return new DefaultMilitaryAreaData(polygons); + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultResidentialAreaData.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultResidentialAreaData.cs new file mode 100644 index 00000000..2ee9f509 --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultResidentialAreaData.cs @@ -0,0 +1,13 @@ +using GameRealisticMap.Geometries; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + public class DefaultResidentialAreaData : DefaultCategoryAreaDataBase + { + public DefaultResidentialAreaData(List areas) + : base(areas) + { + + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultResidentialAreasBuilder.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultResidentialAreasBuilder.cs new file mode 100644 index 00000000..8a7dd734 --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultResidentialAreasBuilder.cs @@ -0,0 +1,20 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + internal class DefaultResidentialAreasBuilder : DefaultUrbanAreasBuilderBase + { + public DefaultResidentialAreasBuilder(IProgressSystem progress) : base(progress) + { + } + + protected override BuildingTypeId TragetedType => BuildingTypeId.Residential; + + protected override DefaultResidentialAreaData Create(List polygons) + { + return new DefaultResidentialAreaData(polygons); + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultRetailAreaData.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultRetailAreaData.cs new file mode 100644 index 00000000..8a28cbc9 --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultRetailAreaData.cs @@ -0,0 +1,13 @@ +using GameRealisticMap.Geometries; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + public class DefaultRetailAreaData : DefaultCategoryAreaDataBase + { + public DefaultRetailAreaData(List areas) + : base(areas) + { + + } + } +} diff --git a/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultRetailAreasBuilder.cs b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultRetailAreasBuilder.cs new file mode 100644 index 00000000..296e2f4a --- /dev/null +++ b/GameRealisticMap/ManMade/DefaultUrbanAreas/DefaultRetailAreasBuilder.cs @@ -0,0 +1,20 @@ +using GameRealisticMap.Geometries; +using GameRealisticMap.ManMade.Buildings; +using GameRealisticMap.Reporting; + +namespace GameRealisticMap.ManMade.DefaultUrbanAreas +{ + internal class DefaultRetailAreasBuilder : DefaultUrbanAreasBuilderBase + { + public DefaultRetailAreasBuilder(IProgressSystem progress) : base(progress) + { + } + + protected override BuildingTypeId TragetedType => BuildingTypeId.Retail; + + protected override DefaultRetailAreaData Create(List polygons) + { + return new DefaultRetailAreaData(polygons); + } + } +} diff --git a/GameRealisticMap/Preview/grm-preview.js b/GameRealisticMap/Preview/grm-preview.js index 2a30f842..de550d6f 100644 --- a/GameRealisticMap/Preview/grm-preview.js +++ b/GameRealisticMap/Preview/grm-preview.js @@ -449,9 +449,12 @@ function InitPreview(geoJson) L.control.scale({ maxWidth: 200, imperial: false }).addTo(map); L.control.gridMousePosition().addTo(map); - var stripes = new L.StripePattern(); + var stripes = new L.StripePattern({ weight: 4, spaceWeight: 4, color: 'lightgreen' }); stripes.addTo(map); + var stripes2 = new L.StripePattern({ weight: 2, spaceWeight:2 }); + stripes2.addTo(map); + L.geoJSON(geoJson, { style: function(feature) { switch (feature.properties.type) { @@ -483,7 +486,8 @@ function InitPreview(geoJson) case 'tree': return { fillColor: "ForestGreen", stroke: false, fillOpacity: 0.8 }; case 'railway': return { fillColor: "black", stroke: false, fillOpacity: 0.8 }; case 'sidewalk': return { fill: false, stroke: true, weight: 1, dashArray: [5, 5], color: 'Gray' }; - + case 'defaultCategory': + return { fillPattern: stripes2, stroke: false, fillOpacity: 0.2 }; case 'ocean': return { fillColor: 'RoyalBlue', fillOpacity: 0.5, stroke: true, weight: 3, color: 'RoyalBlue' }; case 'coastline': return { stroke: true, weight: 1, dashArray: [5, 5], color: 'yellow', fillOpacity: 0 }; case 'orchard': return { fillColor: 'greenyellow', stroke: false, fillOpacity: 0.35 };