Skip to content
Open
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
15 changes: 15 additions & 0 deletions Source/StreetMapImporting/Private/StreetMapFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ bool UStreetMapFactory::LoadFromOpenStreetMapXMLFile( UStreetMap* StreetMap, FSt
case FOSMFile::EOSMWayType::Road: // @todo: Consider excluding "Road" from our data set, as it could be a highway that wasn't properly tagged in OSM yet
RoadType = EStreetMapRoadType::Street;
break;
case FOSMFile::EOSMWayType::Living_Street: break;
case FOSMFile::EOSMWayType::Pedestrian: break;
case FOSMFile::EOSMWayType::Track: break;
case FOSMFile::EOSMWayType::Bus_Guideway: break;
case FOSMFile::EOSMWayType::Raceway: break;
case FOSMFile::EOSMWayType::Footway: break;
case FOSMFile::EOSMWayType::Cycleway: break;
case FOSMFile::EOSMWayType::Bridleway: break;
case FOSMFile::EOSMWayType::Steps: break;
case FOSMFile::EOSMWayType::Path: break;
case FOSMFile::EOSMWayType::Proposed: break;
case FOSMFile::EOSMWayType::Construction: break;
case FOSMFile::EOSMWayType::Building: break;
case FOSMFile::EOSMWayType::Other: break;
default: ;
}

if( RoadType != EStreetMapRoadType::Other )
Expand Down
3 changes: 1 addition & 2 deletions Source/StreetMapRuntime/Private/StreetMapActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#include "StreetMapRuntime.h"
#include "StreetMapComponent.h"


AStreetMapActor::AStreetMapActor(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
StreetMapComponent = CreateDefaultSubobject<UStreetMapComponent>(TEXT("StreetMapComp"));
RootComponent = StreetMapComponent;
}
}
27 changes: 19 additions & 8 deletions Source/StreetMapRuntime/Private/StreetMapComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
#include "StreetMapComponent.h"
#include "StreetMapRuntime.h"
#include "StreetMapSceneProxy.h"
#include "Runtime/Engine/Classes/Engine/StaticMesh.h"
#include "Runtime/Engine/Public/StaticMeshResources.h"
#include "PolygonTools.h"

#include "PhysicsEngine/BodySetup.h"

#if WITH_EDITOR
#include "Modules/ModuleManager.h"
#include "PropertyEditorModule.h"
#include "Components/SplineComponent.h"
#endif //WITH_EDITOR


Expand All @@ -23,7 +22,7 @@ UStreetMapComponent::UStreetMapComponent(const FObjectInitializer& ObjectInitial
{
// We make sure our mesh collision profile name is set to NoCollisionProfileName at initialization.
// Because we don't have collision data yet!
SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName);
UPrimitiveComponent::SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName);

// We don't currently need to be ticked. This can be overridden in a derived class though.
PrimaryComponentTick.bCanEverTick = false;
Expand All @@ -44,7 +43,11 @@ UStreetMapComponent::UStreetMapComponent(const FObjectInitializer& ObjectInitial

static ConstructorHelpers::FObjectFinder<UMaterialInterface> DefaultMaterialAsset(TEXT("/StreetMap/StreetMapDefaultMaterial"));
StreetMapDefaultMaterial = DefaultMaterialAsset.Object;


StreetMapSplines.Add(CreateDefaultSubobject<USplineComponent>(TEXT("SplineMapComp1")));
/*StreetMapSplines.Add(CreateDefaultSubobject<USplineComponent>(TEXT("SplineMapComp2")));
StreetMapSplines.Add(CreateDefaultSubobject<USplineComponent>(TEXT("SplineMapComp3")));
StreetMapSplines.Add(CreateDefaultSubobject<USplineComponent>(TEXT("SplineMapComp4")));*/
}


Expand Down Expand Up @@ -242,11 +245,17 @@ void UStreetMapComponent::GenerateMesh()
MeshBoundingBox.Init();

const auto& Roads = StreetMap->GetRoads();
const auto& Nodes = StreetMap->GetNodes();

const auto& Buildings = StreetMap->GetBuildings();

int index = 0;
for( const auto& Road : Roads )
{
{
FString test = Road.RoadName;
auto spline = NewObject<USplineComponent>(this,USplineComponent::StaticClass());
// auto spline = NewObject<USplineComponent>(this,USplineComponent::StaticClass(), FText::Format("spline {0}", index));
++index;
StreetMapSplines.Add(spline);

float RoadThickness = StreetThickness;
FColor RoadColor = StreetColor;
switch( Road.RoadType )
Expand All @@ -269,9 +278,11 @@ void UStreetMapComponent::GenerateMesh()
check( 0 );
break;
}

spline->SetWorldLocation(FVector(Road.RoadPoints[ 0 ].X, Road.RoadPoints[ 0 ].Y, RoadZ));
for( int32 PointIndex = 0; PointIndex < Road.RoadPoints.Num() - 1; ++PointIndex )
{
spline->AddSplinePoint(FVector(Road.RoadPoints[ PointIndex ], RoadZ), ESplineCoordinateSpace::World, true);

AddThick2DLine(
Road.RoadPoints[ PointIndex ],
Road.RoadPoints[ PointIndex + 1 ],
Expand Down
2 changes: 1 addition & 1 deletion Source/StreetMapRuntime/Public/StreetMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct STREETMAPRUNTIME_API FStreetMapMeshBuildSettings
bWant3DBuildings(true),
bWantLitBuildings(true),
StreetThickness(800.0f),
StreetColor(0.05f, 0.75f, 0.05f),
StreetColor(1.0f, 0.0f, 0.0f),
MajorRoadThickness(1000.0f),
MajorRoadColor(0.15f, 0.85f, 0.15f),
HighwayThickness(1400.0f),
Expand Down
7 changes: 4 additions & 3 deletions Source/StreetMapRuntime/Public/StreetMapActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ class STREETMAPRUNTIME_API AStreetMapActor : public AActor
GENERATED_UCLASS_BODY()

/** Component that represents a section of street map roads and buildings */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "StreetMap")
class UStreetMapComponent* StreetMapComponent;
UPROPERTY(Instanced, EditAnywhere, Category = "StreetMap")
class UStreetMapComponent* StreetMapComponent;

public:
public:
UFUNCTION(BlueprintCallable, Category="StreetMap")
FORCEINLINE class UStreetMapComponent* GetStreetMapComponent() { return StreetMapComponent; }
};
7 changes: 5 additions & 2 deletions Source/StreetMapRuntime/Public/StreetMapComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class STREETMAPRUNTIME_API UStreetMapComponent : public UMeshComponent, public I
UFUNCTION(BlueprintCallable, Category = "StreetMap")
void SetStreetMap(UStreetMap* NewStreetMap, bool bClearPreviousMeshIfAny = false, bool bRebuildMesh = false);


UFUNCTION(BlueprintCallable, Category="StreetMap")
FORCEINLINE TArray<class USplineComponent*> GetStreetMapSplines() { return StreetMapSplines; }

//** Begin Interface_CollisionDataProvider Interface */
virtual bool GetPhysicsTriMeshData(struct FTriMeshCollisionData* CollisionData, bool InUseAllTriData) override;
Expand Down Expand Up @@ -162,7 +163,9 @@ class STREETMAPRUNTIME_API UStreetMapComponent : public UMeshComponent, public I
//** Physics data for mesh collision. */
UPROPERTY(Transient)
UBodySetup* StreetMapBodySetup;


UPROPERTY(Transient, EditAnywhere, Category = "StreetMapSPlines")
TArray<class USplineComponent*> StreetMapSplines;

protected:
//
Expand Down
2 changes: 1 addition & 1 deletion Source/StreetMapRuntime/StreetMapRuntime.Build.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2017 Mike Fricker. All Rights Reserved.

//test
namespace UnrealBuildTool.Rules
{
public class StreetMapRuntime : ModuleRules
Expand Down