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
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
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
Dmitri Naumov
ogs
Commits
966a6c8d
Commit
966a6c8d
authored
9 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Plain Diff
Merge pull request #683 from TomFischer/GeoLibRestructureAndBugFix
[GeoLib] Restructure and bug fix.
parents
77b5d595
3fb57cc1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GeoLib/GEOObjects.cpp
+25
-20
25 additions, 20 deletions
GeoLib/GEOObjects.cpp
GeoLib/PointVec.cpp
+6
-6
6 additions, 6 deletions
GeoLib/PointVec.cpp
GeoLib/PointVec.h
+1
-0
1 addition, 0 deletions
GeoLib/PointVec.h
with
32 additions
and
26 deletions
GeoLib/GEOObjects.cpp
+
25
−
20
View file @
966a6c8d
...
@@ -404,27 +404,32 @@ bool GEOObjects::mergePoints(std::vector<std::string> const & geo_names,
...
@@ -404,27 +404,32 @@ bool GEOObjects::mergePoints(std::vector<std::string> const & geo_names,
std
::
vector
<
GeoLib
::
Point
*>*
merged_points
(
new
std
::
vector
<
GeoLib
::
Point
*>
);
std
::
vector
<
GeoLib
::
Point
*>*
merged_points
(
new
std
::
vector
<
GeoLib
::
Point
*>
);
std
::
map
<
std
::
string
,
std
::
size_t
>*
merged_pnt_names
(
new
std
::
map
<
std
::
string
,
std
::
size_t
>
);
std
::
map
<
std
::
string
,
std
::
size_t
>*
merged_pnt_names
(
new
std
::
map
<
std
::
string
,
std
::
size_t
>
);
for
(
std
::
size_t
j
(
0
);
j
<
n_geo_names
;
j
++
)
{
for
(
std
::
size_t
j
(
0
);
j
<
n_geo_names
;
++
j
)
{
const
std
::
vector
<
GeoLib
::
Point
*>*
pnts
(
this
->
getPointVec
(
geo_names
[
j
]));
GeoLib
::
PointVec
const
*
const
pnt_vec
(
this
->
getPointVecObj
(
geo_names
[
j
]));
if
(
pnts
)
{
if
(
pnt_vec
==
nullptr
)
std
::
size_t
n_pnts
(
0
);
continue
;
// do not consider stations
const
std
::
vector
<
GeoLib
::
Point
*>*
pnts
(
pnt_vec
->
getVector
());
if
(
!
dynamic_cast
<
GeoLib
::
Station
*>
((
*
pnts
)[
0
]))
{
if
(
pnts
==
nullptr
)
{
std
::
string
tmp_name
;
return
false
;
n_pnts
=
pnts
->
size
();
}
for
(
std
::
size_t
k
(
0
);
k
<
n_pnts
;
k
++
)
{
merged_points
->
push_back
(
new
GeoLib
::
Point
(((
*
pnts
)[
k
])
->
getCoords
()));
// do not consider stations
if
(
this
->
getPointVecObj
(
geo_names
[
j
])
->
getNameOfElementByID
(
k
,
tmp_name
))
{
if
(
dynamic_cast
<
GeoLib
::
Station
*>
((
*
pnts
)[
0
]))
{
merged_pnt_names
->
insert
(
continue
;
std
::
pair
<
std
::
string
,
std
::
size_t
>
(
tmp_name
,
pnt_offsets
[
j
]
+
k
));
}
}
}
std
::
size_t
const
n_pnts
(
pnts
->
size
());
}
for
(
std
::
size_t
k
(
0
);
k
<
n_pnts
;
++
k
)
{
if
(
n_geo_names
-
1
>
j
)
{
merged_points
->
push_back
(
new
GeoLib
::
Point
(
*
(
*
pnts
)[
k
]));
pnt_offsets
[
j
+
1
]
=
n_pnts
+
pnt_offsets
[
j
];
std
::
string
const
&
item_name
(
pnt_vec
->
getItemNameByID
(
k
));
if
(
!
item_name
.
empty
())
{
merged_pnt_names
->
insert
(
std
::
make_pair
(
item_name
,
pnt_offsets
[
j
]
+
k
));
}
}
}
else
}
return
false
;
//if no points for a given geometry are found, something is fundamentally wrong
if
(
n_geo_names
-
1
>
j
)
{
pnt_offsets
[
j
+
1
]
=
n_pnts
+
pnt_offsets
[
j
];
}
}
}
addPointVec
(
merged_points
,
merged_geo_name
,
merged_pnt_names
,
1e-6
);
addPointVec
(
merged_points
,
merged_geo_name
,
merged_pnt_names
,
1e-6
);
...
...
This diff is collapsed.
Click to expand it.
GeoLib/PointVec.cpp
+
6
−
6
View file @
966a6c8d
...
@@ -32,13 +32,14 @@ PointVec::PointVec (const std::string& name, std::vector<Point*>* points,
...
@@ -32,13 +32,14 @@ PointVec::PointVec (const std::string& name, std::vector<Point*>* points,
std
::
map
<
std
::
string
,
std
::
size_t
>*
name_id_map
,
PointType
type
,
double
rel_eps
)
:
std
::
map
<
std
::
string
,
std
::
size_t
>*
name_id_map
,
PointType
type
,
double
rel_eps
)
:
TemplateVec
<
Point
>
(
name
,
points
,
name_id_map
),
TemplateVec
<
Point
>
(
name
,
points
,
name_id_map
),
_type
(
type
),
_type
(
type
),
_aabb
(
points
->
begin
(),
points
->
end
())
_aabb
(
points
->
begin
(),
points
->
end
()),
_rel_eps
(
rel_eps
)
{
{
assert
(
_data_vec
);
assert
(
_data_vec
);
std
::
size_t
const
number_of_all_input_pnts
(
_data_vec
->
size
());
std
::
size_t
const
number_of_all_input_pnts
(
_data_vec
->
size
());
rel_eps
*=
sqrt
(
MathLib
::
sqrDist
(
_aabb
.
getMinPoint
(),
_aabb
.
getMaxPoint
()));
_
rel_eps
*=
sqrt
(
MathLib
::
sqrDist
(
_aabb
.
getMinPoint
(),
_aabb
.
getMaxPoint
()));
makePntsUnique
(
_data_vec
,
_pnt_id_map
,
rel_eps
);
makePntsUnique
(
_data_vec
,
_pnt_id_map
,
_
rel_eps
);
if
(
number_of_all_input_pnts
>
_data_vec
->
size
())
if
(
number_of_all_input_pnts
>
_data_vec
->
size
())
WARN
(
"PointVec::PointVec(): there are %d double points."
,
WARN
(
"PointVec::PointVec(): there are %d double points."
,
...
@@ -86,11 +87,10 @@ void PointVec::push_back (Point* pnt, std::string const*const name)
...
@@ -86,11 +87,10 @@ void PointVec::push_back (Point* pnt, std::string const*const name)
std
::
size_t
PointVec
::
uniqueInsert
(
Point
*
pnt
)
std
::
size_t
PointVec
::
uniqueInsert
(
Point
*
pnt
)
{
{
const
double
eps
(
std
::
numeric_limits
<
double
>::
epsilon
());
auto
const
it
=
std
::
find_if
(
_data_vec
->
begin
(),
_data_vec
->
end
(),
auto
const
it
=
std
::
find_if
(
_data_vec
->
begin
(),
_data_vec
->
end
(),
[
&
ep
s
,
&
pnt
](
Point
*
const
p
)
[
thi
s
,
&
pnt
](
Point
*
const
p
)
{
{
return
MathLib
::
maxNormDist
(
p
,
pnt
)
<=
eps
;
return
MathLib
::
maxNormDist
(
p
,
pnt
)
<=
_rel_
eps
;
});
});
if
(
it
!=
_data_vec
->
end
())
if
(
it
!=
_data_vec
->
end
())
...
...
This diff is collapsed.
Click to expand it.
GeoLib/PointVec.h
+
1
−
0
View file @
966a6c8d
...
@@ -145,6 +145,7 @@ private:
...
@@ -145,6 +145,7 @@ private:
std
::
vector
<
std
::
string
>
_id_to_name_map
;
std
::
vector
<
std
::
string
>
_id_to_name_map
;
AABB
<
GeoLib
::
Point
>
_aabb
;
AABB
<
GeoLib
::
Point
>
_aabb
;
double
_rel_eps
;
};
};
}
// end namespace
}
// end namespace
...
...
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