-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quad feature #528
Merged
Merged
Quad feature #528
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fb45fef
Adding a quad feature which allows multiple quads each with a differe…
manthey 20871dc
Add some support for altering tile projections.
manthey 5ea4933
Added the necessary functions for the selection API.
manthey ec8f4e3
Add tests.
manthey ec39b02
Update to vgl 0.3.6.
manthey a53cd9e
Update quad example images.
manthey bed0fae
Add a selenium test for quads.
manthey 4f272dd
Fix an issue resizing the map.
manthey 1446ed9
Adjust the 'z' value for tile layers so that they work on devices wit…
manthey 7f86e78
Fix a typo and rename some functions for consistency.
manthey 9c19a8e
When clearing or reseting the tile layer, clear the last tile set rec…
manthey 147f956
Merge branch 'master' into quad-feature
manthey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"path": "quads", | ||
"title": "Quad features", | ||
"exampleCss": ["main.css"], | ||
"exampleJs": ["main.js"], | ||
"about": { | ||
"text": "This example shows how to add dynamic quads to a map." | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extends ../common/templates/index.jade |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
var quadDebug = {}; | ||
|
||
// Run after the DOM loads | ||
$(function () { | ||
'use strict'; | ||
|
||
var map = geo.map({ | ||
node: '#map', | ||
center: { | ||
x: -88.0, | ||
y: 29 | ||
}, | ||
zoom: 4 | ||
}); | ||
var layer = map.createLayer('feature', {renderer: 'vgl'}); | ||
var quads = layer.createFeature('quad', {selectionAPI: true}); | ||
var previewImage = new Image(); | ||
previewImage.onload = function () { | ||
|
||
quads | ||
.data([{ | ||
ll: {x: -108, y: 29}, | ||
ur: {x: -88, y: 49}, | ||
image: '/data/tilefancy.png' | ||
}, { | ||
ll: {x: -88, y: 29}, | ||
ur: {x: -58, y: 49}, | ||
image: 'flower1.jpg', | ||
opacity: 0.75 | ||
}, { | ||
ul: {x: -108, y: 29}, | ||
ur: {x: -58, y: 29}, | ||
ll: {x: -98, y: 9}, | ||
lr: {x: -68, y: 9}, | ||
previewImage: null, | ||
image: 'flower3.jpg' | ||
}, { | ||
lr: {x: -58, y: 29}, | ||
ur: {x: -58, y: 49}, | ||
ul: {x: -38, y: 54}, | ||
ll: {x: -33, y: 34}, | ||
image: 'flower2.jpg', | ||
opacity: 0.15 | ||
}, { | ||
ll: {x: -33, y: 34}, | ||
lr: {x: -33, y: 9}, | ||
ur: {x: -68, y: 9}, | ||
ul: {x: -58, y: 29}, | ||
image: '/data/tilefancy.png' | ||
}, { | ||
ll: {x: -128, y: 29}, | ||
ur: {x: -108, y: 49}, | ||
image: '/data/nosuchimage.png' | ||
}, { | ||
ul: {x: -128, y: 29}, | ||
ur: {x: -108, y: 29}, | ||
ll: {x: -123, y: 9}, | ||
lr: {x: -98, y: 9}, | ||
previewImage: null, | ||
image: '/data/nosuchimage.png' | ||
}, { | ||
ul: {x: -148, y: 29}, | ||
ur: {x: -128, y: 29}, | ||
ll: {x: -148, y: 9}, | ||
lr: {x: -123, y: 9}, | ||
previewImage: previewImage, | ||
image: '/data/nosuchimage.png' | ||
}, { | ||
ll: {x: -138, y: 29}, | ||
ur: {x: -128, y: 39}, | ||
color: '#FF0000' | ||
}, { | ||
ll: {x: -148, y: 39}, | ||
ur: {x: -138, y: 49}, | ||
color: '#FF0000' | ||
}, { | ||
ll: {x: -138, y: 39}, | ||
ur: {x: -128, y: 49}, | ||
color: '#00FFFF' | ||
}, { | ||
ll: {x: -148, y: 29}, | ||
ur: {x: -138, y: 39}, | ||
opacity: 0.25, | ||
color: '#0000FF' | ||
/* You can specify quads so that the corners are 'twisted' and the quad | ||
* would be non-convex. In this case, the quads are each rendered as a | ||
* pair of triangles, but they probably aren't what is desired. | ||
}, { | ||
ll: {x: -108, y: 49}, | ||
lr: {x: -88, y: 49}, | ||
ur: {x: -108, y: 59}, | ||
ul: {x: -88, y: 59}, | ||
image: '/data/tilefancy.png' | ||
}, { | ||
ll: {x: -88, y: 49}, | ||
ur: {x: -68, y: 49}, | ||
ul: {x: -88, y: 59}, | ||
lr: {x: -68, y: 59}, | ||
image: '/data/tilefancy.png' | ||
*/ | ||
}]) | ||
.style({ | ||
opacity: function (d) { | ||
return d.opacity !== undefined ? d.opacity : 1; | ||
}, | ||
color: function (d) { | ||
return d.color; | ||
}, | ||
previewColor: {r: 1, g: 0.75, b: 0.75}, | ||
previewImage: function (d) { | ||
return d.previewImage !== undefined ? d.previewImage : previewImage; | ||
} | ||
}) | ||
.geoOn(geo.event.feature.mouseover, function (evt) { | ||
if (evt.data.orig_opacity === undefined) { | ||
evt.data.orig_opacity = (evt.data.opacity || null); | ||
} | ||
evt.data.opacity = 0.5; | ||
// we either have to clear the internal cache on the item, or have | ||
// asked for it not to have been cached to begin with. | ||
delete evt.data._cachedQuad; | ||
this.modified(); | ||
layer.map().draw(); | ||
}) | ||
.geoOn(geo.event.feature.mouseout, function (evt) { | ||
if (evt.data.orig_opacity === undefined) { | ||
evt.data.orig_opacity = (evt.data.opacity || null); | ||
} | ||
evt.data.opacity = evt.data.orig_opacity || undefined; | ||
delete evt.data._cachedQuad; | ||
this.modified(); | ||
layer.map().draw(); | ||
}) | ||
.draw(); | ||
|
||
map.draw(); | ||
|
||
quadDebug.map = map; | ||
quadDebug.layer = layer; | ||
quadDebug.quads = quads; | ||
}; | ||
|
||
previewImage.src = '/data/grid.jpg'; | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manthey why was this necessary?