Skip to content

Instantly share code, notes, and snippets.

View dbouwman's full-sized avatar
😎
Hubbin it up @ Esri

Dave Bouwman dbouwman

😎
Hubbin it up @ Esri
View GitHub Profile
@dbouwman
dbouwman / PointClusterService.cs
Created March 24, 2012 21:26
Server Side Clustering Class in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SafeRoutes.Infrastructure.Storage.Domain;
namespace SafeRoutes.Infrastructure.Services
{
/// <summary>
/// Service that clusters ProjectPoints
@dbouwman
dbouwman / Viewer.js
Last active December 13, 2015 22:18
Simple Marionette Application with a global event debugger
/*global gmm */
if (!this.gmm || typeof this.gmm !== 'object') {
this.gmm = {};
}
(function () {
'use strict';
gmm.Viewer = new Backbone.Marionette.Application();
gmm.Viewer.addRegions({
toolsRegion: '#tool-list-region'
@dbouwman
dbouwman / ModuleAndController.js
Created February 20, 2013 04:38
Empty Module and Controller
/*global gmm */
if (!this.gmm || typeof this.gmm !== 'object') {
this.gmm = {};
}
(function () {
'use strict';
gmm.Viewer.module('NavbarModule', function (Mod, Viewer, Backbone, Marionette, $, _) {
//==================================
//initializer called on Viewer.start(options)
/*global gmm */
if (!this.gmm || typeof this.gmm !== 'object') {
this.gmm = {};
}
(function () {
'use strict';
gmm.Viewer.module('NavbarModule', function (Mod, Viewer, Backbone, Marionette, $, _) {
//==================================
//initializer called on Viewer.start(options)
@dbouwman
dbouwman / options.js
Created February 20, 2013 05:09
Options with a tool items array
var options = {
toolItems: [
{name: 'Search', eventToRaise: 'View:Search', iconclass: 'entypo-search'},
{name: 'Stats', eventToRaise: 'View:Stats', iconclass: 'entypo-chart-bar'},
{name: 'Layer List', eventToRaise: 'View:LayerList', iconclass: 'entypo-map'},
]
};
@dbouwman
dbouwman / Index.html
Last active December 13, 2015 23:59
Markup for our demo app
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8" />
<title>GeoMacMap</title>
<meta name="description" content="Demo app showing how to compose a loosely coupled mapping application using Backbone.Marionette">
<meta name="author" content="Dave Bouwman / DTSAgile.com">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link href='http://fonts.googleapis.com/css?family=Oxygen:400,700' rel='stylesheet' type='text/css'>
@dbouwman
dbouwman / options.js
Created February 24, 2013 22:36
Adding the mapConfig section to the options for our app
var options = {
menuItems: [
{ name: 'Current Fires', eventToRaise: 'View:CurrenFires' },
{ name: 'Historic Fires', eventToRaise: 'View:HistoricFires' },
{ name: 'Fire Danger Map', eventToRaise: 'View:FireDanger' }
],
toolItems: [
{name: 'Search', eventToRaise: 'View:Search', iconclass: 'entypo-search'},
{name: 'Stats', eventToRaise: 'View:Stats', iconclass: 'entypo-chart-bar'},
{name: 'Layer List', eventToRaise: 'View:LayerList', iconclass: 'entypo-map'},
@dbouwman
dbouwman / LayerListControllerInit.js
Created February 24, 2013 22:42
LayerList Controller Initialize is where all the orchestration happens because we never change the collections at runtime.
//==================================
//Controller for the LayerList Module
//==================================
var Controller = Backbone.Marionette.Controller.extend({
initialize: function (options) {
_.bindAll();
console.log('LayerListMobule:Controller:initialize');
this.region = options.region;
@dbouwman
dbouwman / markup.html
Created February 24, 2013 22:56
Markup and templates for our layer list
<!-- Container for the Layer List -->
<div id="layer-list-region" style="display:none;" class="view"></div>
<!-- Templates -->
<script id="layer-list-template" type="text/template" >
<div class="header">
<h3>Map Layers</h3>
<span id="layer-list-close" class="entypo-cancel-circled"></span>
</div>
<div class="clear"></div>
@dbouwman
dbouwman / layout.js
Created February 24, 2013 23:04
Snippet showing how the layout is created, and how we setup the regions which are nodes in the layout's template
var LayerListLayoutView = Backbone.Marionette.Layout.extend({
template: "#layer-list-template",
//define the regions using selectors for nodes
//inside the layout's template
regions: {
layerListRegion: "#layer-list",
basemapRegion: "#basemap-list"
},
events:{'click #layer-list-close':'closeView'},
closeView:function(){