Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mojtaba Abdolkhani
ogs
Commits
77ebdd96
Commit
77ebdd96
authored
9 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[T/FileIO] XmlGmlInterface: Make the creation of Polylines more readable.
parent
a81b9e31
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/FileIO/TestXmlGmlReader.cpp
+25
-26
25 additions, 26 deletions
Tests/FileIO/TestXmlGmlReader.cpp
with
25 additions
and
26 deletions
Tests/FileIO/TestXmlGmlReader.cpp
+
25
−
26
View file @
77ebdd96
...
@@ -92,36 +92,35 @@ public:
...
@@ -92,36 +92,35 @@ public:
void
createPolylines
()
void
createPolylines
()
{
{
auto
const
points
=
geo_objects
.
getPointVec
(
geo_name
);
auto
createPolyline
=
[](
GeoLib
::
PointVec
const
&
pnt_vec
,
const
std
::
vector
<
std
::
size_t
>
pnt_id_map
(
std
::
vector
<
GeoLib
::
Polyline
*>
&
lines
,
std
::
size_t
line_id
,
geo_objects
.
getPointVecObj
(
geo_name
)
->
getIDMap
());
std
::
vector
<
std
::
size_t
>
pnt_ids
,
std
::
map
<
std
::
string
,
std
::
size_t
>
&
line_name_map
,
std
::
string
const
&
name
)
{
auto
const
&
pnt_id_map
(
pnt_vec
.
getIDMap
());
lines
[
line_id
]
=
new
GeoLib
::
Polyline
(
*
(
pnt_vec
.
getVector
()));
for
(
std
::
size_t
k
(
0
);
k
<
pnt_ids
.
size
();
++
k
)
{
lines
[
line_id
]
->
addPoint
(
pnt_id_map
[
pnt_ids
[
k
]]);
}
if
(
!
name
.
empty
())
line_name_map
.
insert
(
std
::
make_pair
(
name
,
line_id
));
};
auto
const
&
pnt_vec
=
*
(
geo_objects
.
getPointVecObj
(
geo_name
));
auto
lines
=
std
::
unique_ptr
<
std
::
vector
<
GeoLib
::
Polyline
*>>
(
auto
lines
=
std
::
unique_ptr
<
std
::
vector
<
GeoLib
::
Polyline
*>>
(
new
std
::
vector
<
GeoLib
::
Polyline
*>
(
5
));
new
std
::
vector
<
GeoLib
::
Polyline
*>
(
5
));
std
::
map
<
std
::
string
,
std
::
size_t
>*
ply_names
=
std
::
map
<
std
::
string
,
std
::
size_t
>*
name_map
=
new
std
::
map
<
std
::
string
,
std
::
size_t
>
;
new
std
::
map
<
std
::
string
,
std
::
size_t
>
;
(
*
lines
)[
0
]
=
new
GeoLib
::
Polyline
(
*
points
);
(
*
lines
)[
0
]
->
addPoint
(
pnt_id_map
[
0
]);
createPolyline
(
pnt_vec
,
*
(
lines
.
get
()),
0
,
{
0
,
1
,
2
},
*
name_map
,
"left"
);
(
*
lines
)[
0
]
->
addPoint
(
pnt_id_map
[
1
]);
createPolyline
(
pnt_vec
,
*
(
lines
.
get
()),
1
,
{
3
,
4
,
5
},
*
name_map
,
"center"
);
(
*
lines
)[
0
]
->
addPoint
(
pnt_id_map
[
2
]);
createPolyline
(
pnt_vec
,
*
(
lines
.
get
()),
2
,
{
0
,
3
},
*
name_map
,
""
);
ply_names
->
insert
(
std
::
pair
<
std
::
string
,
std
::
size_t
>
(
"left"
,
0
));
createPolyline
(
pnt_vec
,
*
(
lines
.
get
()),
3
,
{
3
,
6
},
*
name_map
,
""
);
(
*
lines
)[
1
]
=
new
GeoLib
::
Polyline
(
*
points
);
createPolyline
(
pnt_vec
,
*
(
lines
.
get
()),
4
,
{
6
,
7
,
8
},
*
name_map
,
"right"
);
(
*
lines
)[
1
]
->
addPoint
(
pnt_id_map
[
3
]);
geo_objects
.
addPolylineVec
(
std
::
move
(
lines
),
geo_name
,
name_map
);
(
*
lines
)[
1
]
->
addPoint
(
pnt_id_map
[
4
]);
(
*
lines
)[
1
]
->
addPoint
(
pnt_id_map
[
5
]);
ply_names
->
insert
(
std
::
pair
<
std
::
string
,
std
::
size_t
>
(
"center"
,
1
));
(
*
lines
)[
2
]
=
new
GeoLib
::
Polyline
(
*
points
);
(
*
lines
)[
2
]
->
addPoint
(
pnt_id_map
[
0
]);
(
*
lines
)[
2
]
->
addPoint
(
pnt_id_map
[
3
]);
(
*
lines
)[
3
]
=
new
GeoLib
::
Polyline
(
*
points
);
(
*
lines
)[
3
]
->
addPoint
(
pnt_id_map
[
3
]);
(
*
lines
)[
3
]
->
addPoint
(
pnt_id_map
[
6
]);
(
*
lines
)[
4
]
=
new
GeoLib
::
Polyline
(
*
points
);
(
*
lines
)[
4
]
->
addPoint
(
pnt_id_map
[
6
]);
(
*
lines
)[
4
]
->
addPoint
(
pnt_id_map
[
7
]);
(
*
lines
)[
4
]
->
addPoint
(
pnt_id_map
[
8
]);
ply_names
->
insert
(
std
::
pair
<
std
::
string
,
std
::
size_t
>
(
"right"
,
4
));
geo_objects
.
addPolylineVec
(
std
::
move
(
lines
),
geo_name
,
ply_names
);
}
}
void
checkPolylineProperties
()
void
checkPolylineProperties
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment