Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
buildtimegraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xuebingbing
buildtimegraph
Commits
34d2ba5d
Commit
34d2ba5d
authored
Oct 14, 2019
by
xuebingbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new project“
parent
49bd8bd1
Pipeline
#169
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
226 additions
and
0 deletions
+226
-0
Program.cs
Program.cs
+210
-0
buildtimegraph.csproj
buildtimegraph.csproj
+16
-0
No files found.
Program.cs
0 → 100644
View file @
34d2ba5d
using
HDMapBase.Common
;
using
HDMapBase.Geometry
;
using
HDMapBase.Model.Gps
;
using
HDMapBase.Model.Graph
;
using
HDMapBase.Serialize
;
using
System
;
using
System.Collections.Generic
;
namespace
Gps2GraphPB
{
internal
class
Program
{
private
static
void
Main
(
string
[]
args
)
{
// 以 / 结尾
String
strLocalPath
=
"D:/data/JF/ly/"
;
uint
taskId
=
1012
;
Dictionary
<
ulong
,
ulong
>
prevnextdict
=
new
Dictionary
<
ulong
,
ulong
>()
{
//1-三角带
{
4348832257812
,
4348835232812
},
{
4348835598012
,
4348832282212
},
//2-主辅路
{
4348829713012
,
4348831607312
},
//{ 4348830155312,4348831940612},
//3-桥下
{
4348829683112
,
4348835812112
},
{
4348839472112
,
4348836356412
}
};
PatternOne
(
strLocalPath
,
taskId
,
prevnextdict
);
}
private
static
ulong
CalcGpsId
(
uint
taskId
,
int
week
,
double
seconds
)
{
return
(((
ulong
)
taskId
<<
32
)
|
TimeUtil
.
GetUtcShortMsFromGps
(
week
,
seconds
));
}
private
static
void
PatternOne
(
string
localRootPath
,
uint
taskId
,
Dictionary
<
ulong
,
ulong
>
prevnextdict
)
{
RValue
<
bool
>
rtn
;
FileSource
.
SetLocalTraceDir
(
localRootPath
+
"/"
);
TaskGpsData
data
=
TaskGpsData
.
LoadTaskData
(
taskId
,
SourceType
.
Local
);
var
imgpoints
=
TaskGpsData
.
FilterNoImg
(
data
.
rawData
.
GpsList
);
RawGpsPointTimeGraph
timegraph
=
new
RawGpsPointTimeGraph
(
taskId
,
MeshUtil
.
INVALID_MESHID
,
imgpoints
);
// 时间间隔大于 x 之的不建立前后链接关系
timegraph
.
Build
(
2
);
Console
.
WriteLine
(
"Check1 whole timegraph"
);
Console
.
WriteLine
(
"---------------------"
);
foreach
(
var
v
in
timegraph
.
GraphPoints
)
{
if
(!
v
.
Value
.
HasNext
&&
!
v
.
Value
.
HasPrev
)
{
string
msg
=
$"孤立拓扑点 mesh:
{
v
.
Value
.
meshId
}
gpsId:
{
v
.
Key
}
"
;
Console
.
WriteLine
(
msg
);
}
if
(
v
.
Value
.
Next
.
Count
>
1
&&
v
.
Value
.
Prev
.
Count
>
1
)
{
string
msg
=
$"出现X形状 拓扑关系mesh:
{
v
.
Value
.
meshId
}
gpsId:
{
v
.
Key
}
"
;
Console
.
WriteLine
(
msg
);
}
}
Console
.
WriteLine
(
">>>check end"
);
AppointPrevNextRelation
(
timegraph
,
prevnextdict
);
#
region
过滤
// 过滤不影响前后挂接关系
timegraph
.
FilterNearest
();
// 过滤掉倒车点
timegraph
.
FilterBack
();
// 过滤抖动不直的点
//timegraph.FilterCrack();
#
endregion
过滤
Console
.
WriteLine
(
"Check2 whole timegraph"
);
Console
.
WriteLine
(
"---------------------"
);
foreach
(
var
v
in
timegraph
.
GraphPoints
)
{
if
(!
v
.
Value
.
HasNext
&&
!
v
.
Value
.
HasPrev
)
{
string
msg
=
$"孤立拓扑点 mesh:
{
v
.
Value
.
meshId
}
gpsId:
{
v
.
Key
}
"
;
Console
.
WriteLine
(
msg
);
}
if
(
v
.
Value
.
Next
.
Count
>
1
&&
v
.
Value
.
Prev
.
Count
>
1
)
{
string
msg
=
$"出现X形状 拓扑关系mesh:
{
v
.
Value
.
meshId
}
gpsId:
{
v
.
Key
}
"
;
Console
.
WriteLine
(
msg
);
}
}
Console
.
WriteLine
(
">>>check end"
);
Dictionary
<
uint
,
RawGpsPointTimeGraph
>
meshtimegraphs
=
timegraph
.
SplitDataToMesh
();
var
enumerator
=
meshtimegraphs
.
GetEnumerator
();
while
(
enumerator
.
MoveNext
())
{
uint
meshid
=
enumerator
.
Current
.
Key
;
var
meshtimegraph
=
enumerator
.
Current
.
Value
;
GpsPointGraph
gpsPointGraph
=
new
GpsPointGraph
(
meshid
);
gpsPointGraph
.
ResetPoints
(
meshtimegraph
.
GraphPoints
);
var
rv
=
gpsPointGraph
.
ExportGpsPoints
(
SourceType
.
Local
);
if
(!
rv
.
value
)
{
Console
.
WriteLine
(
$"保存图幅 $(gpsPointGraph.meshId) 失败"
);
}
Console
.
WriteLine
(
$"Check mesh:
{
meshid
}
"
);
foreach
(
var
v
in
meshtimegraph
.
GraphPoints
)
{
if
(!
v
.
Value
.
HasNext
&&
!
v
.
Value
.
HasPrev
)
{
string
msg
=
$"孤立拓扑点 mesh:
{
meshid
}
gpsId:
{
v
.
Key
}
"
;
Console
.
WriteLine
(
msg
);
}
if
(
v
.
Value
.
Next
.
Count
>
1
&&
v
.
Value
.
Prev
.
Count
>
1
)
{
string
msg
=
$"出现X形状 拓扑关系mesh:
{
meshid
}
gpsId:
{
v
.
Key
}
"
;
Console
.
WriteLine
(
msg
);
}
}
Console
.
WriteLine
(
">>>check end"
);
}
}
private
static
void
AppointPrevNextRelation
(
RawGpsPointTimeGraph
timeGraph
,
Dictionary
<
ulong
,
ulong
>
prevnextdict
)
{
var
enumerator
=
prevnextdict
.
GetEnumerator
();
while
(
enumerator
.
MoveNext
())
{
var
pr
=
enumerator
.
Current
;
var
rv
=
timeGraph
.
Connect
(
pr
.
Key
,
pr
.
Value
);
if
(!
rv
.
value
)
{
Console
.
WriteLine
(
rv
.
errorString
);
}
}
}
private
static
Dictionary
<
ulong
,
GpsPoint
>
FilterMeshid
(
GpsBaseData
meshdata
,
RawGpsPointTimeGraph
timegraph
)
{
Dictionary
<
ulong
,
GpsPoint
>
meshdatadict
=
new
Dictionary
<
ulong
,
GpsPoint
>(
meshdata
.
GpsList
.
Count
);
foreach
(
var
item
in
meshdata
.
GpsList
)
{
GpsPoint
point
=
null
;
if
(
timegraph
.
GraphPoints
.
TryGetValue
(
item
.
gpsId
,
out
point
))
{
meshdatadict
.
Add
(
item
.
gpsId
,
point
);
}
}
var
enumtor
=
meshdatadict
.
GetEnumerator
();
List
<
GpsPoint
>
applist
=
new
List
<
GpsPoint
>();
while
(
enumtor
.
MoveNext
())
{
var
cu
=
enumtor
.
Current
;
var
pt
=
cu
.
Value
;
foreach
(
var
item
in
pt
.
Next
)
{
if
(!
meshdatadict
.
ContainsKey
(
item
.
gpsId
))
{
GpsPoint
point
=
null
;
if
(
timegraph
.
GraphPoints
.
TryGetValue
(
item
.
gpsId
,
out
point
))
{
applist
.
Add
(
point
);
}
}
}
foreach
(
var
item
in
pt
.
Prev
)
{
if
(!
meshdatadict
.
ContainsKey
(
item
.
gpsId
))
{
GpsPoint
point
=
null
;
if
(
timegraph
.
GraphPoints
.
TryGetValue
(
item
.
gpsId
,
out
point
))
{
applist
.
Add
(
point
);
}
}
}
}
// 有漏洞
foreach
(
var
item1
in
applist
)
{
meshdatadict
.
Add
(
item1
.
gpsId
,
item1
);
}
return
meshdatadict
;
}
}
}
\ No newline at end of file
buildtimegraph.csproj
0 → 100644
View file @
34d2ba5d
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\HDMapBase\HDMapBase\HDMapBase.csproj" />
</ItemGroup>
</Project>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment