Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
564d34e2
Commit
564d34e2
authored
Jan 12, 2017
by
Piotr Gawron
Browse files
setters added
parent
8bbc0a5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend-js/src/main/js/map/marker/AbstractMarker.js
View file @
564d34e2
...
...
@@ -11,10 +11,8 @@ function AbstractMarker(icon, map) {
// call super constructor
ObjectWithListeners
.
call
(
this
);
// icon of the marker
this
.
_icon
=
icon
;
// AbstractCustomMap where it's located
this
.
_map
=
map
;
this
.
setIcon
(
icon
);
this
.
setCustomMap
(
map
);
}
AbstractMarker
.
prototype
=
Object
.
create
(
ObjectWithListeners
.
prototype
);
...
...
@@ -29,6 +27,10 @@ AbstractMarker.prototype.getIcon = function() {
return
this
.
_icon
;
};
AbstractMarker
.
prototype
.
setIcon
=
function
(
icon
)
{
this
.
_icon
=
icon
;
};
/**
* Shows marker on the map.
*/
...
...
@@ -37,8 +39,7 @@ AbstractMarker.prototype.show = function() {
logger
.
warn
(
"
Cannot show marker. Marker not initialized
"
);
return
;
}
if
(
this
.
getGoogleMarker
().
getMap
()
!==
undefined
&&
this
.
getGoogleMarker
().
getMap
()
!==
null
)
{
if
(
this
.
getGoogleMarker
().
getMap
()
!==
undefined
&&
this
.
getGoogleMarker
().
getMap
()
!==
null
)
{
logger
.
warn
(
"
Marker is already shown
"
);
}
else
{
this
.
getGoogleMarker
().
setMap
(
this
.
getCustomMap
().
getGoogleMap
());
...
...
@@ -50,8 +51,7 @@ AbstractMarker.prototype.hide = function() {
logger
.
warn
(
"
Cannot hide marker. Marker not initialized
"
);
return
;
}
if
(
this
.
getGoogleMarker
().
getMap
()
===
null
||
this
.
getGoogleMarker
().
getMap
()
===
undefined
)
{
if
(
this
.
getGoogleMarker
().
getMap
()
===
null
||
this
.
getGoogleMarker
().
getMap
()
===
undefined
)
{
logger
.
warn
(
"
Marker is already invisible
"
);
}
else
{
this
.
getGoogleMarker
().
setMap
(
null
);
...
...
@@ -68,6 +68,10 @@ AbstractMarker.prototype.getCustomMap = function() {
return
this
.
_map
;
};
AbstractMarker
.
prototype
.
setCustomMap
=
function
(
map
)
{
this
.
_map
=
map
;;
};
/**
* Returns {@link google.maps.Bounds bounds} of the marker (it's a single
* point).
...
...
@@ -91,14 +95,13 @@ AbstractMarker.prototype.getBounds = function() {
* Set map where the marker should be visualized.
*
* @param map
*
{@link google.maps.Map} where the marker should be visualized.
* {@link google.maps.Map} where the marker should be visualized.
*/
AbstractMarker
.
prototype
.
setMap
=
function
(
map
)
{
if
(
this
.
getGoogleMarker
()
!==
undefined
)
{
this
.
getGoogleMarker
().
setMap
(
map
);
}
else
{
logger
.
warn
(
"
[
"
+
this
.
constructor
.
name
+
"
] Cannot setup map. Marker wasn't initialized. Marker id:
"
logger
.
warn
(
"
[
"
+
this
.
constructor
.
name
+
"
] Cannot setup map. Marker wasn't initialized. Marker id:
"
+
this
.
getId
());
}
};
...
...
@@ -121,8 +124,7 @@ AbstractMarker.prototype.init = function() {
var
onclick
=
(
function
()
{
var
aliasMarker
=
self
;
return
function
()
{
aliasMarker
.
getCustomMap
().
getTopMap
().
openInfoWindowForMarker
(
aliasMarker
);
aliasMarker
.
getCustomMap
().
getTopMap
().
openInfoWindowForMarker
(
aliasMarker
);
};
})();
google
.
maps
.
event
.
addListener
(
this
.
getGoogleMarker
(),
'
click
'
,
onclick
);
...
...
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