Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gmap
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor 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
drupal.org
gmap
Commits
c3748728
Commit
c3748728
authored
16 years ago
by
Brandon Bergren
Browse files
Options
Downloads
Patches
Plain Diff
JSLint run.
== -> === changes. Remove unused variable. Dot notation.
parent
7553f3b2
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
js/gmap_shapes.js
+26
-23
26 additions, 23 deletions
js/gmap_shapes.js
with
26 additions
and
23 deletions
js/gmap_shapes.js
+
26
−
23
View file @
c3748728
/* $Id$ */
/* $Id$ */
/**
/**
* @file
* GMap Shapes
* GMap Shapes
* GMap API version / Base case
* GMap API version / Base case
*/
*/
Drupal
.
gmap
.
addHandler
(
'
gmap
'
,
function
(
elem
)
{
/*global $, Drupal, GEvent, GLatLng, GPolygon, GPolyline */
Drupal
.
gmap
.
addHandler
(
'
gmap
'
,
function
(
elem
)
{
var
obj
=
this
;
var
obj
=
this
;
/*
/*
obj.bind('init',function() {
obj.bind('init',function() {
...
@@ -14,27 +17,27 @@ Drupal.gmap.addHandler('gmap', function(elem) {
...
@@ -14,27 +17,27 @@ Drupal.gmap.addHandler('gmap', function(elem) {
}
}
});
});
*/
*/
obj
.
bind
(
'
prepareshape
'
,
function
(
shape
)
{
obj
.
bind
(
'
prepareshape
'
,
function
(
shape
)
{
var
i
,
pa
,
p
p
,
cargs
,
style
;
var
p
a
,
cargs
,
style
;
//var m = new GMarker(new GLatLng(marker.latitude,marker.longitude),marker.opts);
//var m = new GMarker(new GLatLng(marker.latitude,marker.longitude),marker.opts);
pa
=
[];
// point array (array of GLatLng-objects)
pa
=
[];
// point array (array of GLatLng-objects)
var
fillstyle
=
true
;
var
fillstyle
=
true
;
if
(
shape
.
type
==
'
circle
'
)
{
if
(
shape
.
type
==
=
'
circle
'
)
{
pa
=
obj
.
poly
.
calcPolyPoints
(
new
GLatLng
(
shape
.
center
[
0
],
shape
.
center
[
1
]),
shape
.
radius
*
1000
,
shape
.
numpoints
);
pa
=
obj
.
poly
.
calcPolyPoints
(
new
GLatLng
(
shape
.
center
[
0
],
shape
.
center
[
1
]),
shape
.
radius
*
1000
,
shape
.
numpoints
);
}
}
else
if
(
shape
.
type
==
'
rpolygon
'
)
{
else
if
(
shape
.
type
==
=
'
rpolygon
'
)
{
shape
.
center
=
new
GLatLng
(
shape
.
center
[
0
],
shape
.
center
[
1
]);
shape
.
center
=
new
GLatLng
(
shape
.
center
[
0
],
shape
.
center
[
1
]);
shape
.
point2
=
new
GLatLng
(
shape
.
point2
[
0
],
shape
.
point2
[
1
]);
shape
.
point2
=
new
GLatLng
(
shape
.
point2
[
0
],
shape
.
point2
[
1
]);
var
radius
=
shape
.
center
.
distanceFrom
(
shape
.
point2
);
var
radius
=
shape
.
center
.
distanceFrom
(
shape
.
point2
);
pa
=
obj
.
poly
.
calcPolyPoints
(
shape
.
center
,
radius
,
shape
.
numpoints
);
pa
=
obj
.
poly
.
calcPolyPoints
(
shape
.
center
,
radius
,
shape
.
numpoints
);
}
}
else
if
(
shape
.
type
==
'
polygon
'
)
{
else
if
(
shape
.
type
==
=
'
polygon
'
)
{
$
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
$
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
pa
.
push
(
new
GLatLng
(
n
[
0
],
n
[
1
]));
pa
.
push
(
new
GLatLng
(
n
[
0
],
n
[
1
]));
});
});
}
}
else
if
(
shape
.
type
==
'
line
'
)
{
else
if
(
shape
.
type
==
=
'
line
'
)
{
$
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
$
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
pa
.
push
(
new
GLatLng
(
n
[
0
],
n
[
1
]));
pa
.
push
(
new
GLatLng
(
n
[
0
],
n
[
1
]));
});
});
fillstyle
=
false
;
fillstyle
=
false
;
...
@@ -43,13 +46,13 @@ Drupal.gmap.addHandler('gmap', function(elem) {
...
@@ -43,13 +46,13 @@ Drupal.gmap.addHandler('gmap', function(elem) {
// Style normalization
// Style normalization
if
(
fillstyle
)
{
if
(
fillstyle
)
{
style
=
obj
.
vars
.
styles
[
'
poly_default
'
]
.
slice
();
style
=
obj
.
vars
.
styles
.
poly_default
.
slice
();
}
}
else
{
else
{
style
=
obj
.
vars
.
styles
[
'
line_default
'
]
.
slice
();
style
=
obj
.
vars
.
styles
.
line_default
.
slice
();
}
}
if
(
shape
.
style
)
{
if
(
shape
.
style
)
{
if
(
typeof
shape
.
style
==
'
string
'
)
{
if
(
typeof
shape
.
style
==
=
'
string
'
)
{
if
(
obj
.
vars
.
styles
[
shape
.
style
])
{
if
(
obj
.
vars
.
styles
[
shape
.
style
])
{
style
=
obj
.
vars
.
styles
[
shape
.
style
].
slice
();
style
=
obj
.
vars
.
styles
[
shape
.
style
].
slice
();
}
}
...
@@ -66,15 +69,15 @@ Drupal.gmap.addHandler('gmap', function(elem) {
...
@@ -66,15 +69,15 @@ Drupal.gmap.addHandler('gmap', function(elem) {
style
[
4
]
=
style
[
4
]
/
100
;
style
[
4
]
=
style
[
4
]
/
100
;
}
}
$
.
each
(
style
,
function
(
i
,
n
){
$
.
each
(
style
,
function
(
i
,
n
)
{
cargs
.
push
(
n
);
cargs
.
push
(
n
);
});
});
var
Pg
=
function
(
args
)
{
var
Pg
=
function
(
args
)
{
GPolygon
.
apply
(
this
,
args
);
GPolygon
.
apply
(
this
,
args
);
};
};
Pg
.
prototype
=
new
GPolygon
();
Pg
.
prototype
=
new
GPolygon
();
var
Pl
=
function
(
args
)
{
var
Pl
=
function
(
args
)
{
GPolyline
.
apply
(
this
,
args
);
GPolyline
.
apply
(
this
,
args
);
};
};
Pl
.
prototype
=
new
GPolyline
();
Pl
.
prototype
=
new
GPolyline
();
switch
(
shape
.
type
)
{
switch
(
shape
.
type
)
{
...
@@ -89,7 +92,7 @@ Drupal.gmap.addHandler('gmap', function(elem) {
...
@@ -89,7 +92,7 @@ Drupal.gmap.addHandler('gmap', function(elem) {
}
}
});
});
obj
.
bind
(
'
addshape
'
,
function
(
shape
)
{
obj
.
bind
(
'
addshape
'
,
function
(
shape
)
{
if
(
!
obj
.
vars
.
shapes
)
{
if
(
!
obj
.
vars
.
shapes
)
{
obj
.
vars
.
shapes
=
[];
obj
.
vars
.
shapes
=
[];
}
}
...
@@ -97,19 +100,19 @@ Drupal.gmap.addHandler('gmap', function(elem) {
...
@@ -97,19 +100,19 @@ Drupal.gmap.addHandler('gmap', function(elem) {
obj
.
map
.
addOverlay
(
shape
.
shape
);
obj
.
map
.
addOverlay
(
shape
.
shape
);
if
(
obj
.
vars
.
behavior
.
clickableshapes
)
{
if
(
obj
.
vars
.
behavior
.
clickableshapes
)
{
GEvent
.
addListener
(
shape
.
shape
,
'
click
'
,
function
()
{
GEvent
.
addListener
(
shape
.
shape
,
'
click
'
,
function
()
{
obj
.
change
(
'
clickshape
'
,
-
1
,
shape
);
obj
.
change
(
'
clickshape
'
,
-
1
,
shape
);
});
});
}
}
});
});
obj
.
bind
(
'
delshape
'
,
function
(
shape
)
{
obj
.
bind
(
'
delshape
'
,
function
(
shape
)
{
obj
.
map
.
removeOverlay
(
shape
.
shape
);
obj
.
map
.
removeOverlay
(
shape
.
shape
);
});
});
obj
.
bind
(
'
clearshapes
'
,
function
()
{
obj
.
bind
(
'
clearshapes
'
,
function
()
{
if
(
obj
.
vars
.
shapes
)
{
if
(
obj
.
vars
.
shapes
)
{
$
.
each
(
obj
.
vars
.
shapes
,
function
(
i
,
n
)
{
$
.
each
(
obj
.
vars
.
shapes
,
function
(
i
,
n
)
{
obj
.
change
(
'
delshape
'
,
-
1
,
n
);
obj
.
change
(
'
delshape
'
,
-
1
,
n
);
});
});
}
}
...
...
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