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
d215538c
"source/ist-git@git.uwaterloo.ca:wcms/uw_wcms_gesso.git" did not exist on "a967bd79b4a1312936912988f6186bc958ef6632"
Commit
d215538c
authored
16 years ago
by
Brandon Bergren
Browse files
Options
Downloads
Patches
Plain Diff
JSLint run.
parent
e98e2026
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
js/gmap_marker.js
+9
-6
9 additions, 6 deletions
js/gmap_marker.js
js/poly.js
+17
-10
17 additions, 10 deletions
js/poly.js
with
26 additions
and
16 deletions
js/gmap_marker.js
+
9
−
6
View file @
d215538c
/* $Id$ */
/* $Id$ */
/**
/**
* @file
* GMap Markers
* GMap Markers
* GMap API version -- No manager
* GMap API version -- No manager
*/
*/
/*global Drupal, GMarker */
// Replace to override marker creation
// Replace to override marker creation
Drupal
.
gmap
.
factory
.
marker
=
function
(
loc
,
opts
)
{
Drupal
.
gmap
.
factory
.
marker
=
function
(
loc
,
opts
)
{
return
new
GMarker
(
loc
,
opts
);
return
new
GMarker
(
loc
,
opts
);
};
};
Drupal
.
gmap
.
addHandler
(
'
gmap
'
,
function
(
elem
)
{
Drupal
.
gmap
.
addHandler
(
'
gmap
'
,
function
(
elem
)
{
var
obj
=
this
;
var
obj
=
this
;
obj
.
bind
(
'
addmarker
'
,
function
(
marker
)
{
obj
.
bind
(
'
addmarker
'
,
function
(
marker
)
{
obj
.
map
.
addOverlay
(
marker
.
marker
);
obj
.
map
.
addOverlay
(
marker
.
marker
);
});
});
obj
.
bind
(
'
delmarker
'
,
function
(
marker
)
{
obj
.
bind
(
'
delmarker
'
,
function
(
marker
)
{
obj
.
map
.
removeOverlay
(
marker
.
marker
);
obj
.
map
.
removeOverlay
(
marker
.
marker
);
});
});
obj
.
bind
(
'
clearmarkers
'
,
function
()
{
obj
.
bind
(
'
clearmarkers
'
,
function
()
{
// @@@ Maybe don't nuke ALL overlays?
// @@@ Maybe don't nuke ALL overlays?
obj
.
map
.
clearOverlays
();
obj
.
map
.
clearOverlays
();
});
});
...
...
This diff is collapsed.
Click to expand it.
js/poly.js
+
17
−
10
View file @
d215538c
/* $Id$ */
/* $Id$ */
/**
/**
* @file
* GPolyLine / GPolygon manager
* GPolyLine / GPolygon manager
*/
*/
/*global Drupal, GLatLng, GPoint */
Drupal
.
gmap
.
map
.
prototype
.
poly
=
{};
Drupal
.
gmap
.
map
.
prototype
.
poly
=
{};
/**
/**
* Distance in pixels between 2 points.
* Distance in pixels between 2 points.
*/
*/
Drupal
.
gmap
.
map
.
prototype
.
poly
.
distance
=
function
(
point1
,
point2
)
{
Drupal
.
gmap
.
map
.
prototype
.
poly
.
distance
=
function
(
point1
,
point2
)
{
return
Math
.
sqrt
(
Math
.
pow
(
point2
.
x
-
point1
.
x
,
2
)
+
Math
.
pow
(
point2
.
y
-
point1
.
y
,
2
));
return
Math
.
sqrt
(
Math
.
pow
(
point2
.
x
-
point1
.
x
,
2
)
+
Math
.
pow
(
point2
.
y
-
point1
.
y
,
2
));
};
};
/**
/**
* Circle -- Following projection.
* Circle -- Following projection.
*/
*/
Drupal
.
gmap
.
map
.
prototype
.
poly
.
computeCircle
=
function
(
obj
,
center
,
point2
)
{
Drupal
.
gmap
.
map
.
prototype
.
poly
.
computeCircle
=
function
(
obj
,
center
,
point2
)
{
var
numSides
=
36
;
var
numSides
=
36
;
var
sideInc
=
10
;
// 360 / 20 = 18 degrees
var
sideInc
=
10
;
// 360 / 20 = 18 degrees
var
convFactor
=
Math
.
PI
/
180
;
var
convFactor
=
Math
.
PI
/
180
;
var
points
=
[];
var
points
=
[];
var
radius
=
obj
.
poly
.
distance
(
center
,
point2
);
var
radius
=
obj
.
poly
.
distance
(
center
,
point2
);
// 36 sided poly ~= circle
// 36 sided poly ~= circle
for
(
var
i
=
0
;
i
<=
numSides
;
i
++
)
{
for
(
var
i
=
0
;
i
<=
numSides
;
i
++
)
{
var
rad
=
i
*
sideInc
*
convFactor
;
var
rad
=
i
*
sideInc
*
convFactor
;
var
x
=
center
.
x
+
radius
*
Math
.
cos
(
rad
);
var
x
=
center
.
x
+
radius
*
Math
.
cos
(
rad
);
var
y
=
center
.
y
+
radius
*
Math
.
sin
(
rad
);
var
y
=
center
.
y
+
radius
*
Math
.
sin
(
rad
);
//points.push(obj.map.getCurrentMapType().getProjection().fromPixelToLatLng(new GPoint(x,y),obj.map.getZoom()));
//points.push(obj.map.getCurrentMapType().getProjection().fromPixelToLatLng(new GPoint(x,y),obj.map.getZoom()));
points
.
push
(
new
GPoint
(
x
,
y
));
points
.
push
(
new
GPoint
(
x
,
y
));
}
}
return
points
;
return
points
;
};
};
Drupal
.
gmap
.
map
.
prototype
.
poly
.
calcPolyPoints
=
function
(
center
,
radM
,
numPoints
,
sAngle
)
{
Drupal
.
gmap
.
map
.
prototype
.
poly
.
calcPolyPoints
=
function
(
center
,
radM
,
numPoints
,
sAngle
)
{
if
(
!
numPoints
)
{
numPoints
=
32
;}
if
(
!
numPoints
)
{
if
(
!
sAngle
)
{
sAngle
=
0
;}
numPoints
=
32
;
}
if
(
!
sAngle
)
{
sAngle
=
0
;
}
var
d2r
=
Math
.
PI
/
180.0
;
var
d2r
=
Math
.
PI
/
180.0
;
var
r2d
=
180.0
/
Math
.
PI
;
var
r2d
=
180.0
/
Math
.
PI
;
...
...
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