Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Front-end app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
IPos-public
Front-end app
Commits
ee575dae
Commit
ee575dae
authored
3 years ago
by
Oleksandr Husak
Browse files
Options
Downloads
Patches
Plain Diff
minor fixes: error in parsing, empty pointer
parent
e978fe2c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/components/map/map.component.ts
+28
-7
28 additions, 7 deletions
src/app/components/map/map.component.ts
with
28 additions
and
7 deletions
src/app/components/map/map.component.ts
+
28
−
7
View file @
ee575dae
...
...
@@ -30,14 +30,22 @@ export class MapComponent implements OnInit {
this
.
root
=
{
"
refSystemId
"
:
"
ROOT
"
,
"
point
"
:
{
"
latitude
"
:
51.02545
,
"
longitude
"
:
13.72295
}}
this
.
subsRoot
=
this
.
_mqttService
.
observe
(
'
ipos/client/root
'
).
subscribe
((
message
:
IMqttMessage
)
=>
{
this
.
root
=
JSON
.
parse
(
message
.
payload
.
toString
())
console
.
log
(
"
New root:
"
,
this
.
root
)
this
.
registerPoint
(
"
ROOT
"
,
{
"
position
"
:
this
.
root
})
try
{
this
.
root
=
JSON
.
parse
(
message
.
payload
.
toString
())
console
.
log
(
"
New root:
"
,
this
.
root
)
this
.
registerPoint
(
"
ROOT
"
,
{
"
position
"
:
this
.
root
})
}
catch
(
e
)
{
console
.
log
(
e
)
}
});
this
.
subsPosition
=
this
.
_mqttService
.
observe
(
'
ipos/client/position
'
).
subscribe
((
message
:
IMqttMessage
)
=>
{
let
upd
:
PositionUpdate
=
JSON
.
parse
(
message
.
payload
.
toString
())
upd
.
objects
.
forEach
(
obj
=>
this
.
registerPoint
(
obj
.
id
,
obj
));
try
{
let
upd
:
PositionUpdate
=
JSON
.
parse
(
message
.
payload
.
toString
())
upd
.
objects
.
forEach
(
obj
=>
this
.
registerPoint
(
obj
.
id
,
obj
));
}
catch
(
e
)
{
console
.
log
(
e
)
}
});
}
...
...
@@ -88,8 +96,21 @@ export class MapComponent implements OnInit {
}
addMarker
(
key
:
string
,
pos
:
Position
,
popup
:
string
,
theta
:
number
)
{
// empty position
if
(
pos
==
undefined
)
{
console
.
log
(
"
Eroro: empty position.
"
)
return
}
let
point
=
pos
.
point
// empty point
if
(
Object
.
values
(
point
).
every
((
e
)
=>
{
e
==
undefined
}))
{
console
.
log
(
"
Eroro: empty point.
"
)
return
;
}
if
(
'
x
'
in
point
)
{
var
globPos
=
this
.
ref2root
(
point
)
}
else
{
...
...
@@ -124,8 +145,8 @@ export class MapComponent implements OnInit {
// --- Orientation
if
(
theta
&&
'
x
'
in
point
)
{
let
orient
:
RelativePos
=
{
"
x
"
:
point
.
x
+
Math
.
sin
(
theta
)
*
3
,
"
y
"
:
point
.
y
+
Math
.
cos
(
theta
)
*
3
,
"
x
"
:
point
.
x
+
Math
.
sin
(
theta
)
*
3
??
3
,
"
y
"
:
point
.
y
+
Math
.
cos
(
theta
)
*
3
??
3
,
"
z
"
:
point
.
z
}
let
globPointOrient
=
this
.
ref2root
(
orient
)
...
...
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