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
9c614007
Commit
9c614007
authored
12 years ago
by
git
Committed by
Andriy Podanenko
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue #1887506 by iancawthorne: Fixed Shapes not working 7.x-2.x?.
parent
d9a7a684
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gmap.module
+7
-7
7 additions, 7 deletions
gmap.module
js/gmap_shapes.js
+28
-14
28 additions, 14 deletions
js/gmap_shapes.js
with
35 additions
and
21 deletions
gmap.module
+
7
−
7
View file @
9c614007
...
@@ -1136,17 +1136,17 @@ function gmap_decimal($num) {
...
@@ -1136,17 +1136,17 @@ function gmap_decimal($num) {
* as it could possibly take several seconds for this function to return.
* as it could possibly take several seconds for this function to return.
* See http://www.google.com/apis/maps/documentation/reference.html#GGeoStatusCode
* See http://www.google.com/apis/maps/documentation/reference.html#GGeoStatusCode
* for a description of the possible status codes.
* for a description of the possible status codes.
* @see http://drupal.org/node/1940474
*/
*/
function
gmap_geocode
(
$address
,
$tld
=
'com'
)
{
function
gmap_geocode
(
$address
,
$tld
=
'com'
)
{
$key
=
gmap_get_key
();
$data
=
drupal_http_request
(
gmap_views_protocol
()
.
'://maps.googleapis.'
.
$tld
.
'/maps/api/geocode/json?address='
.
urlencode
(
$address
)
.
'&sensor=false'
);
$data
=
drupal_http_request
(
gmap_views_protocol
()
.
'://maps.google.'
.
$tld
.
'/maps/geo?q='
.
urlencode
(
$address
)
.
'&output=csv&key='
.
$key
);
if
(
$data
->
code
==
200
)
{
if
(
$data
->
code
==
200
)
{
$
r
=
explode
(
','
,
$data
->
data
);
$
data_decoded
=
json_decode
(
$data
->
data
);
return
array
(
return
array
(
'status'
=>
(
int
)
$r
[
0
]
,
'status'
=>
$data_decoded
->
status
,
'accuracy'
=>
(
int
)
$r
[
1
]
,
'accuracy'
=>
$data_decoded
->
results
[
0
]
->
geometry
->
location_type
,
'latitude'
=>
$
r
[
2
]
,
'latitude'
=>
$
data_decoded
->
results
[
0
]
->
geometry
->
location
->
lat
,
'longitude'
=>
$
r
[
3
]
,
'longitude'
=>
$
data_decoded
->
results
[
0
]
->
geometry
->
location
->
lng
,
);
);
}
}
// Non 200 is G_GEO_SERVER_ERROR (500).
// Non 200 is G_GEO_SERVER_ERROR (500).
...
...
This diff is collapsed.
Click to expand it.
js/gmap_shapes.js
+
28
−
14
View file @
9c614007
...
@@ -31,15 +31,16 @@ Drupal.gmap.addHandler('gmap', function (elem) {
...
@@ -31,15 +31,16 @@ Drupal.gmap.addHandler('gmap', function (elem) {
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
'
)
{
var
coords
=
new
Array
();
jQuery
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
jQuery
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
pa
.
push
(
new
G
LatLng
(
n
[
0
],
n
[
1
]));
coords
.
push
(
new
google
.
maps
.
LatLng
(
n
[
0
],
n
[
1
]));
});
});
}
}
else
if
(
shape
.
type
===
'
line
'
)
{
else
if
(
shape
.
type
===
'
line
'
)
{
var
coords
=
new
Array
();
jQuery
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
jQuery
.
each
(
shape
.
points
,
function
(
i
,
n
)
{
pa
.
push
(
new
G
LatLng
(
n
[
0
],
n
[
1
]));
coords
.
push
(
new
google
.
maps
.
LatLng
(
n
[
0
],
n
[
1
]));
});
});
fillstyle
=
false
;
}
}
cargs
=
[
pa
];
cargs
=
[
pa
];
...
@@ -67,7 +68,7 @@ Drupal.gmap.addHandler('gmap', function (elem) {
...
@@ -67,7 +68,7 @@ Drupal.gmap.addHandler('gmap', function (elem) {
style
[
3
]
=
'
#
'
+
style
[
3
];
style
[
3
]
=
'
#
'
+
style
[
3
];
style
[
4
]
=
style
[
4
]
/
100
;
style
[
4
]
=
style
[
4
]
/
100
;
}
}
if
(
shape
.
type
==
'
encoded_line
'
)
{
if
(
shape
.
type
==
'
encoded_line
'
)
{
shape
.
color
=
style
[
0
];
shape
.
color
=
style
[
0
];
shape
.
weight
=
style
[
1
];
shape
.
weight
=
style
[
1
];
...
@@ -99,17 +100,27 @@ Drupal.gmap.addHandler('gmap', function (elem) {
...
@@ -99,17 +100,27 @@ Drupal.gmap.addHandler('gmap', function (elem) {
GPolyline
.
apply
(
this
,
args
);
GPolyline
.
apply
(
this
,
args
);
};
};
Pl
.
prototype
=
new
GPolyline
();
Pl
.
prototype
=
new
GPolyline
();
var
polyObject
=
{
path
:
coords
,
strokeColor
:
style
[
0
],
strokeWeight
:
style
[
1
],
strokeOpacity
:
style
[
2
],
fillColor
:
style
[
3
],
fillOpacity
:
style
[
4
],
}
switch
(
shape
.
type
)
{
switch
(
shape
.
type
)
{
case
'
circle
'
:
case
'
circle
'
:
case
'
polygon
'
:
case
'
polygon
'
:
case
'
rpolygon
'
:
case
'
rpolygon
'
:
shape
.
shape
=
new
Pg
(
cargs
);
shape
.
shape
=
new
google
.
maps
.
Polygon
(
polyObject
);
break
;
break
;
case
'
line
'
:
case
'
line
'
:
shape
.
shape
=
new
Pl
(
cargs
);
shape
.
shape
=
new
google
.
maps
.
Polyline
(
polyObject
);
break
;
break
;
case
'
encoded_line
'
:
case
'
encoded_line
'
:
shape
.
shape
=
GPolyline
.
fromEncoded
(
shape
);
shape
.
shape
=
GPolyline
.
fromEncoded
(
shape
);
break
;
break
;
case
'
encoded_polygon
'
:
case
'
encoded_polygon
'
:
shape
.
shape
=
GPolygon
.
fromEncoded
(
shape
);
shape
.
shape
=
GPolygon
.
fromEncoded
(
shape
);
...
@@ -118,17 +129,16 @@ Drupal.gmap.addHandler('gmap', function (elem) {
...
@@ -118,17 +129,16 @@ Drupal.gmap.addHandler('gmap', function (elem) {
});
});
obj
.
bind
(
'
addshape
'
,
function
(
shape
)
{
obj
.
bind
(
'
addshape
'
,
function
(
shape
)
{
if
(
!
obj
.
vars
.
shapes
)
{
if
(
!
obj
.
map
.
shapes
)
obj
.
map
.
shapes
=
new
Array
();
obj
.
vars
.
shapes
=
[];
shape
.
shape
.
setMap
(
obj
.
map
);
}
//obj.map.shapes.push( shape.shape );
obj
.
vars
.
shapes
.
push
(
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
)
{
...
@@ -143,3 +153,7 @@ Drupal.gmap.addHandler('gmap', function (elem) {
...
@@ -143,3 +153,7 @@ Drupal.gmap.addHandler('gmap', function (elem) {
}
}
});
});
});
});
/**
This is a comment
*/
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