Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default urban areas filling #124

Merged
merged 4 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GameRealisticMap.Arma3/Arma3LayerGeneratorCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
Expand Down
8 changes: 7 additions & 1 deletion GameRealisticMap.Arma3/Assets/Filling/BasicCollectionId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ public enum BasicCollectionId
RocksAdditional,
DefaultAreas,
WatercourseAdditional,
SmallOrchard
SmallOrchard,
DefaultAgriculturalAreas,
DefaultCommercialAreas,
DefaultIndustrialAreas,
DefaultMilitaryAreas,
DefaultResidentialAreas,
DefaultRetailAreas
}
}
Original file line number Diff line number Diff line change
@@ -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<DefaultAgriculturalAreaData>
{
public DefaultAgriculturalAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets)
: base(progress, assets)
{
}

protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0;

protected override BasicCollectionId Id => BasicCollectionId.DefaultAgriculturalAreas;
}
}
Original file line number Diff line number Diff line change
@@ -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<DefaultCommercialAreaData>
{
public DefaultCommercialAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets)
: base(progress, assets)
{
}

protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0;

protected override BasicCollectionId Id => BasicCollectionId.DefaultCommercialAreas;
}
}
Original file line number Diff line number Diff line change
@@ -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<DefaultIndustrialAreaData>
{
public DefaultIndustrialAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets)
: base(progress, assets)
{
}

protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0;

protected override BasicCollectionId Id => BasicCollectionId.DefaultIndustrialAreas;
}
}
Original file line number Diff line number Diff line change
@@ -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<DefaultMilitaryAreaData>
{
public DefaultMilitaryAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets)
: base(progress, assets)
{
}

protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0;

protected override BasicCollectionId Id => BasicCollectionId.DefaultMilitaryAreas;
}
}
Original file line number Diff line number Diff line change
@@ -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<DefaultResidentialAreaData>
{
public DefaultResidentialAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets)
: base(progress, assets)
{
}

protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0;

protected override BasicCollectionId Id => BasicCollectionId.DefaultResidentialAreas;
}
}
Original file line number Diff line number Diff line change
@@ -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<DefaultRetailAreaData>
{
public DefaultRetailAreasGenerator(IProgressSystem progress, IArma3RegionAssets assets)
: base(progress, assets)
{
}

protected override bool ShouldGenerate => assets.GetBasicCollections(Id).Count > 0;

protected override BasicCollectionId Id => BasicCollectionId.DefaultRetailAreas;
}
}
56 changes: 55 additions & 1 deletion GameRealisticMap.Studio/Labels.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion GameRealisticMap.Studio/Labels.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<value>Le fichier de style de carte est manquant.</value>
</data>
<data name="AssetDefaultAreas" xml:space="preserve">
<value>Zones par défaut</value>
<value>Zones par défaut - Non urbain / nature</value>
</data>
<data name="AssetFireHydrant" xml:space="preserve">
<value>Bouche d'incendie</value>
Expand Down Expand Up @@ -1141,4 +1141,22 @@ Dernière génération le {1}</value>
<data name="AssetSidewalks" xml:space="preserve">
<value>Trottoirs</value>
</data>
<data name="AssetDefaultAgriculturalAreas" xml:space="preserve">
<value>Zones par défaut - Agricole</value>
</data>
<data name="AssetDefaultCommercialAreas" xml:space="preserve">
<value>Zones par défaut - Bureaux</value>
</data>
<data name="AssetDefaultIndustrialAreas" xml:space="preserve">
<value>Zones par défaut - Industriel</value>
</data>
<data name="AssetDefaultMilitaryAreas" xml:space="preserve">
<value>Zones par défaut - Militaire</value>
</data>
<data name="AssetDefaultResidentialAreas" xml:space="preserve">
<value>Zones par défaut - Résidentiel</value>
</data>
<data name="AssetDefaultRetailAreas" xml:space="preserve">
<value>Zones par défaut - Commercial</value>
</data>
</root>
20 changes: 19 additions & 1 deletion GameRealisticMap.Studio/Labels.resx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<value>Commercial Building</value>
</data>
<data name="AssetDefaultAreas" xml:space="preserve">
<value>Default Areas</value>
<value>Default Areas - Non urban / natural</value>
</data>
<data name="AssetFence" xml:space="preserve">
<value>Fence</value>
Expand Down Expand Up @@ -1141,4 +1141,22 @@ Last generated on {1}</value>
<data name="AssetSidewalks" xml:space="preserve">
<value>Sidewalks</value>
</data>
<data name="AssetDefaultAgriculturalAreas" xml:space="preserve">
<value>Default Areas - Agricultural</value>
</data>
<data name="AssetDefaultCommercialAreas" xml:space="preserve">
<value>Default Areas - Commercial / offices</value>
</data>
<data name="AssetDefaultIndustrialAreas" xml:space="preserve">
<value>Default Areas - Industrial</value>
</data>
<data name="AssetDefaultMilitaryAreas" xml:space="preserve">
<value>Default Areas - Military</value>
</data>
<data name="AssetDefaultResidentialAreas" xml:space="preserve">
<value>Default Areas - Residential</value>
</data>
<data name="AssetDefaultRetailAreas" xml:space="preserve">
<value>Default Areas - Retail</value>
</data>
</root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GameRealisticMap.Studio/Resources/Icons/DefaultAreas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions GameRealisticMap/BuildersCatalog.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -62,6 +63,12 @@ public BuildersCatalog(IProgressSystem progress, IRoadTypeLibrary<IRoadTypeInfos
Register(new DefaultAreasBuilder(progress));
Register(new ProceduralStreetLampsBuilder(progress));
Register(new SidewalksBuilder(progress));
Register(new DefaultResidentialAreasBuilder(progress));
Register(new DefaultCommercialAreasBuilder(progress));
Register(new DefaultIndustrialAreasBuilder(progress));
Register(new DefaultMilitaryAreasBuilder(progress));
Register(new DefaultRetailAreasBuilder(progress));
Register(new DefaultAgriculturalAreasBuilder(progress));
}

public void Register<TData>(IDataBuilder<TData> builder)
Expand Down
5 changes: 4 additions & 1 deletion GameRealisticMap/ManMade/CategoryAreaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 9 additions & 1 deletion GameRealisticMap/ManMade/CategoryAreaData.cs
Original file line number Diff line number Diff line change
@@ -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<CategoryArea> areas)
{
Areas = areas;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using GameRealisticMap.Geometries;

namespace GameRealisticMap.ManMade.DefaultUrbanAreas
{
public class DefaultAgriculturalAreaData : DefaultCategoryAreaDataBase
{
public DefaultAgriculturalAreaData(List<TerrainPolygon> areas)
: base(areas)
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using GameRealisticMap.Geometries;
using GameRealisticMap.ManMade.Buildings;
using GameRealisticMap.Reporting;

namespace GameRealisticMap.ManMade.DefaultUrbanAreas
{
internal class DefaultAgriculturalAreasBuilder : DefaultUrbanAreasBuilderBase<DefaultAgriculturalAreaData>
{
public DefaultAgriculturalAreasBuilder(IProgressSystem progress) : base(progress)
{
}

protected override BuildingTypeId TragetedType => BuildingTypeId.Agricultural;

protected override DefaultAgriculturalAreaData Create(List<TerrainPolygon> polygons)
{
return new DefaultAgriculturalAreaData(polygons);
}
}
}
Loading
Loading