Permalink
Browse files

Adding initial files

  • Loading branch information...
0 parents commit ed16e8348b6670f29c253c875824b313773ebe12 @jacobtoye jacobtoye committed Jun 5, 2012
Showing with 597 additions and 0 deletions.
  1. +22 −0 .gitattributes
  2. +165 −0 .gitignore
  3. +69 −0 Control.PolyDraw.css
  4. +54 −0 Control.PolyDraw.js
  5. +222 −0 Handler.PolyDraw.js
  6. +30 −0 README.md
  7. +4 −0 TODO.md
  8. +31 −0 example/drawing.html
  9. BIN images/polygon.png
  10. BIN images/polyline.png
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
@@ -0,0 +1,165 @@
+
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/**
+tmp/**
+tmp/**/*
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+**/[Dd]ebug/
+**/[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+**/*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#**/packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
@@ -0,0 +1,69 @@
+/* Leaflet controls */
+
+.leaflet-control-polydraw {
+ -moz-border-radius: 7px;
+ -webkit-border-radius: 7px;
+ border-radius: 7px;
+ }
+.leaflet-control-polydraw {
+ padding: 5px;
+ background: rgba(0, 0, 0, 0.25);
+ }
+.leaflet-control-polydraw a {
+ background-color: rgba(255, 255, 255, 0.75);
+ }
+.leaflet-control-polydraw a {
+ background-position: 50% 50%;
+ background-repeat: no-repeat;
+ display: block;
+ }
+.leaflet-control-polydraw a {
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ width: 19px;
+ height: 19px;
+ margin-top: 5px;
+ }
+.leaflet-control-polydraw a:first-child{
+ margin-top: 0;
+}
+.leaflet-control-polydraw a:hover {
+ background-color: #fff;
+ }
+.leaflet-touch .leaflet-control-polydraw a {
+ width: 27px;
+ height: 27px;
+ }
+.leaflet-control-polydraw-polyline {
+ background-image: url(images/polyline.png);
+ }
+.leaflet-control-polydraw-polygon {
+ background-image: url(images/polygon.png);
+ }
+
+.leaflet-cursor-label {
+ background-color: #fff;
+ border: 1px solid #ccc;
+ color: #999;
+ font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif;
+ margin-left: 20px;
+ margin-top: -21px;
+ padding: 2px 4px;
+ position: absolute;
+ white-space: nowrap;
+ z-index: 6;
+}
+
+.leaflet-cursor-label-latlng {
+ color: #222;
+}
+
+.leaflet-polyline-guide-dash {
+ background-color: #f06eaa;
+ font-size: 1%;
+ opacity: 0.6;
+ position: absolute;
+ width: 5px;
+ height: 5px;
+}
@@ -0,0 +1,54 @@
+L.Control.PolyDraw = L.Control.extend({
+ options: {
+ position: 'topleft',
+ drawPolyline: true,
+ drawPolygon: true
+ },
+
+ onAdd: function (map) {
+ var className = 'leaflet-control-polydraw',
+ container = L.DomUtil.create('div', className);
+
+ if(this.options.drawPolyline) {
+ this._createButton(
+ 'Draw a polyline',
+ className + '-polyline',
+ container,
+ map.polyDraw.drawPolyline,
+ map.polyDraw
+ );
+ }
+
+ if(this.options.drawPolygon) {
+ this._createButton(
+ 'Draw a polygon',
+ className + '-polygon',
+ container,
+ map.polyDraw.drawPolygon,
+ map.polyDraw
+ );
+ }
+
+ return container;
+ },
+
+ _createButton: function (title, className, container, fn, context) {
+ var link = L.DomUtil.create('a', className, container);
+ link.href = '#';
+ link.title = title;
+
+ L.DomEvent
+ .addListener(link, 'click', L.DomEvent.stopPropagation)
+ .addListener(link, 'click', L.DomEvent.preventDefault)
+ .addListener(link, 'click', fn, context);
+
+ return link;
+ }
+});
+
+L.Map.addInitHook(function () {
+ if (this.options.polyDrawControl) {
+ this.polyDrawControl = new L.Control.PolyDraw();
+ this.addControl(this.polyDrawControl);
+ }
+});
Oops, something went wrong.

0 comments on commit ed16e83

Please sign in to comment.