DEPRECATION NOTICE: This addon is deprecated, please use ember-google-maps instead.
Ember CLI G-Maps is a Google Map component for map driven applications.
A map driven application responds to map interactions with fresh data. What this means for the developer is that you will need consistent access to the state of the map as well as intuitive ways to efficiently render large amounts of data.
Ember-cli-g-maps seeks to give you the information you need, when you need it, so that you can make the necessary requests and render the most relevant map data for your users.
Built with the GMaps-For-Apps.js library, a fork of GMaps.
Full installation & configuration documentation.
Supports:
In terminal:
ember install ember-cli-g-maps
This will install the ember-cli-g-maps
node module and the gmaps
bower component. The g-maps component will be available to your application, however you need to update your environment configuration to avoid violating the content security policy.
Update your config/environment.js
Content Security Policy to contain:
ENV.contentSecurityPolicy = {
'default-src': "'none'",
'script-src': "'self' 'unsafe-eval' *.googleapis.com maps.gstatic.com",
'font-src': "'self' fonts.gstatic.com",
'connect-src': "'self' maps.gstatic.com",
'img-src': "'self' *.googleapis.com maps.gstatic.com csi.gstatic.com",
'style-src': "'self' 'unsafe-inline' fonts.googleapis.com maps.gstatic.com"
};
You wont see your map unless it has height. In app/styles/app.css
:
.ember-cli-g-map {
height: 300px;
}
Install and Configuration
Component Properties and Events
Elements
Services
Selections
Heatmap
Simplest Possible G-Map
In your controller:
export default Ember.Controller.extend({
lat: 32.75494243654723,
lng: -86.8359375,
zoom: 4
});
In your template:
Adding Markers
export default Ember.Controller.extend({
markers: null,
init() {
this.set('markers', [
{
id: 'unique-marker-id', // Recommended
lat: 33.516674497188255, // Required
lng: -86.80091857910156, // Required
infoWindow: {
content: '<p>Birmingham</p>',
visible: true
},
click(event, marker) {},
rightclick(event, marker) {},
dblclick(event, marker) {},
mouseover(event, marker) {},
mouseout(event, marker) {},
mouseup(event, marker) {},
mousedown(event, marker) {},
drag(e, marker) {},
dragstart(e, marker) {},
dragend(e, marker) {}
}
]);
}
});
Adding Polygons
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
polygons: Ember.A([
{
id: 'unique-polygon-id', // Recommended
paths: [ // Required
[35.0041, -88.1955], // Lat, Lng
[31.0023, -84.9944], // Lat, Lng
[30.1546, -88.3864], // Lat, Lng
[34.9107, -88.1461] // Lat, Lng
],
click: function(event, polygon) {},
rightclick: function(event, polygon) {},
dblclick: function(event, polygon) {},
mouseover: function(event, polygon) {},
mouseout: function(event, polygon) {},
mouseup: function(event, polygon) {},
mousedown: function(event, polygon) {},
mousemove: function(event, polygon) {},
drag: function(event, polygon) {},
dragstart: function(event, polygon) {},
dragend: function(event, polygon) {},
set_at: function(polygonPath) {},
insert_at: function(polygonPath) {},
remove_at: function(polygonPath) {}
}
])
});
}
});
Adding Polylines
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
polylines: Ember.A([
{
id: 'unique-polyline-id', // Recommended
strokeColor: 'blue',
strokeOpacity: 1,
strokeWeight: 6,
path: [ // Required
[34.220, -100.7], // Lat, Lng
[33.783, -92.81], // Lat, Lng
[35.946, -94.83], // Lat, Lng
[32.458, -95.71], // Lat, Lng
[33.783, -92.85] // Lat, Lng
],
click: function(event, polyline) {},
rightclick: function(event, polyline) {},
dblclick: function(event, polyline) {},
mouseover: function(event, polyline) {},
mouseout: function(event, polyline) {},
mouseup: function(event, polyline) {},
mousedown: function(event, polyline) {},
mousemove: function(event, polyline) {},
set_at: function(polylinePath) {},
insert_at: function(polylinePath) {},
remove_at: function(polylinePath) {}
}
])
});
}
});
Adding Circles
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
circles: Ember.A([
{
id: 'unique-circle-id', // Recommended
lat: 32.75494243654723, // Required
lng: -86.8359375, // Required
radius: 500000 // Not Required, but you'll probaby want to see it
click: function(event, circle) {},
rightclick: function(event, circle) {},
dblclick: function(event, circle) {},
mouseover: function(event, circle) {},
mouseout: function(event, circle) {},
mouseup: function(event, circle) {},
mousedown: function(event, circle) {},
mousemove: function(event, circle) {},
drag: function(e, circle) {},
dragstart: function(e, circle) {},
dragend: function(e, circle) {},
radius_changed: function(circle) {},
center_changed: function(circle) {}
}
])
});
}
});
Adding Rectangles
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
rectangles: Ember.A([
{
id: 'unique-rectangle-id', // Recommended
bounds: [
[40.300476079749465, -102.3046875], // NE lat, lng
[26.258936094468414, -73.828125] // SW lat, lng
],
strokeColor: 'green',
strokeOpacity: 1,
strokeWeight: 3,
fillColor: 'green',
fillOpacity: 0.2,
click: function(event, rectangle) {},
rightclick: function(event, rectangle) {},
dblclick: function(event, rectangle) {},
mouseover: function(event, rectangle) {},
mouseout: function(event, rectangle) {},
mouseup: function(event, rectangle) {},
mousedown: function(event, rectangle) {},
mousemove: function(event, rectangle) {},
drag: function(e, rectangle) {},
dragstart: function(e, rectangle) {},
dragend: function(e, rectangle) {},
bounds_changed: function(rectangle) {}
}
])
});
}
});
Adding Overlays
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
overlays: Ember.A([
{
id: 'unique-overlay-id', // Recommended
lat: 32.75494243654723, // Required
lng: -86.8359375, // Required
content: '<strong class="my-class">Some HTML</strong>',
verticalAlign: 'top',
horizontalAlign: 'center',
click: function(event, overlay) {},
dblclick: function(event, overlay) {},
mouseup: function(event, overlay) {},
mousedown: function(event, overlay) {},
mouseover: function(event, overlay) {},
mousemove: function(event, overlay) {},
mouseout: function(event, overlay) {}
}
])
});
}
});
Basic G-Map Component Event
export default Ember.Route.extend({
actions: {
onMapEvent: function(event) {
console.info('Click coordinate',
event.latLng.lat(), // Latitude
event.latLng.lng() // Longitude
);
console.info('Map boundaries',
event.bounds[0], // Northeast map coordinate
event.bounds[1] // Southwest map coordinate
);
console.info('Map\'s center',
this.controller.lat,
this.controller.lng
);
event.mapIdle.then(function() { // Promise
console.log('maps done loading tiles and user is not interacting with map');
});
event.mapTilesLoaded.then(function() { // Promise
console.log('Map tiles have finished loading');
});
}
}
});
Setting Map Properties
Full component properties documentation
// Default settings
export default Ember.Controller.extend({
lat: 33.5205556,
lng: -86.8025,
mapType: 'satellite', // Accepts 'roadmap', 'satellite', 'hybrid', or 'terrain'
showMapTypeControl: true,
clickableIcons: true,
draggable: true,
disableDefaultUI: false,
disableDoubleClickZoom: false,
scrollwheel: true,
showZoomControl: true,
showScaleControl: true
});
React to Map Loading Completion
export default Ember.Route.extend({
actions: {
onMapLoad(e) {
console.log(e.map +' has finished loading!');
// > "my-map has finished loading!"
}
}
});
Full component events documentation
Repurposed from the Google Maps Drawing Manager, Selections allow you to draw shapes on your map instance. This allows users to select areas on the map to interact with. Supported selection types include:
Selections Requirements
Selections requires the Google Maps Drawing library. To add this library in:config/environment.js
add:
ENV.googleMap = {
libraries: ['drawing']
};
Actions
Actions are fired when a selections are completed. Available selections actions are:
Heatmap is an abstraction of the Google Maps Heatmap Layer.
Heatmap Requirements
Heatmap requires the Google Maps Visualization library. To add this library in:config/environment.js
add:
ENV.googleMap = {
libraries: ['visualization']
};
In config/environment.js
ENV.googleMap = {
// your configuration goes in here
libraries: ['places', 'geometry'], // milage varies based on g-maps supported features
version: '3', // not recommended
apiKey: 'your-unique-google-map-api-key',
lazyLoad: false, // default
language: 'ja', // optional
region: 'JA' // optional
}
The MIT License (MIT)
Copyright (c) 2015 Matt Jensen. github.com/Matt-Jensen
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.
Ember启动报错 Path or pattern "bower_components/dinosheets/dist/dinosheets.amd.js" did not match any files Error: Path or pattern "bower_components/dinosheets/dist/dinosheets.amd.js" did not match any fil
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 //参考文章 https://dev.to/michalbryxi/debugging-emberjs-with-vscode-2p5g "
Ember CLI 是一个 Ember.js 命令行工具,提供了由 broccoli 提供的快速的资源管道和项目结构。 Ember CLI 基于 Ember App Kit Project 目前已经废弃。 Assets Compilation Ember CLI asset compilation is based on broccoli. Broccoli has support for: Ha
This repository is no longer maintained. As a replacement check out: https://github.com/sir-dunxalot/ember-tooltips Ember CLI Tooltipster An Ember CLI add-on that wraps Tooltipster into an ember compo
ember-cli-updater This ember-cli addon helps you update your ember-cli application or addon. The idea of this addon is to automate some parts of the upgrade process so it's simplified. Not every chang
Ember-cli-yadda This Ember CLI addon facilitates writing BDD tests in the Gherkin language and executing them against your Ember app. @mschinis (Micheal Schinis) Did a great talk at @emberlondon BDD a
Ember-cli-simditor Ember component wrapper for simditor. Changes 0.0.7 Different from previous version, you must wrap content in object. See issue 6 for why. Getting Started Installation In your ember
ember-cli-chai Chai assertions for Ember.js. Deprecated This package is deprecated. Please use ember-auto-import to use chai and chai plugins directly. If you'd like to use chai, or were previously us