diff --git a/assets/images/logos/makinacorpus.png b/assets/images/logos/makinacorpus.png index 94d88d60..844e7b8e 100644 Binary files a/assets/images/logos/makinacorpus.png and b/assets/images/logos/makinacorpus.png differ diff --git a/assets/images/logos/makinacorpus.svg b/assets/images/logos/makinacorpus.svg new file mode 100644 index 00000000..600d11da --- /dev/null +++ b/assets/images/logos/makinacorpus.svg @@ -0,0 +1,101 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/assets/styles/main-425f2db200.css b/assets/styles/main-425f2db200.css new file mode 100644 index 00000000..a9953b03 --- /dev/null +++ b/assets/styles/main-425f2db200.css @@ -0,0 +1,5 @@ +@charset "UTF-8";/*! + * Bootstrap v3.3.7 (http://getbootstrap.com) + * Copyright 2011-2016 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */.label,sub,sup{vertical-align:baseline}hr,img{border:0}.btn-group>.btn-group,.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.dropdown-menu{float:left}.img-responsive,.img-thumbnail,.table,label{max-width:100%}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.pre-scrollable{max-height:340px}.form-control-feedback,.menu-icon,.tile,a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}b,optgroup,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0}mark{background:#ff0;color:#000}sub,sup{font-size:75%;line-height:0;position:relative}sup{top:-.5em}sub{bottom:-.25em}img{vertical-align:middle}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}code,kbd,pre,samp{font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{blockquote,img,pre,tr{page-break-inside:avoid}*,:after,:before{background:0 0!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{border:1px solid #999}thead{display:table-header-group}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}.btn,.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-warning.active,.btn-warning:active,.btn.active,.btn:active,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover,.form-control,.navbar-toggle,.open>.btn-danger.dropdown-toggle,.open>.btn-default.dropdown-toggle,.open>.btn-info.dropdown-toggle,.open>.btn-primary.dropdown-toggle,.open>.btn-warning.dropdown-toggle{background-image:none}.img-thumbnail,body{background-color:#fff}@font-face{font-family:'Glyphicons Halflings';src:url(../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.eot);src:url(../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix) format("embedded-opentype"),url(../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2) format("woff2"),url(../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.woff) format("woff"),url(../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf) format("truetype"),url(../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format("svg")}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before,.glyphicon-btc:before,.glyphicon-xbt:before{content:"\e227"}.glyphicon-jpy:before,.glyphicon-yen:before{content:"\00a5"}.glyphicon-rub:before,.glyphicon-ruble:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*,:after,:before{box-sizing:border-box}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;line-height:1.42857;color:#333}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}figure{margin:0}.img-responsive{display:block;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{padding:4px;line-height:1.42857;border:1px solid #ddd;border-radius:4px;transition:all .2s ease-in-out;display:inline-block;height:auto}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}dt,kbd kbd,label{font-weight:700}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{background-color:#fcf8e3;padding:.2em}.list-inline,.list-unstyled{padding-left:0;list-style:none}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.initialism,.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}pre code,table{background-color:transparent}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}dl,ol,ul{margin-top:0}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child,ol ol,ol ul,ul ol,ul ul{margin-bottom:0}address,dl{margin-bottom:20px}ol,ul{margin-bottom:10px}.list-inline{margin-left:-5px}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px}dd,dt{line-height:1.42857}dd{margin-left:0}.dl-horizontal dd:after,.dl-horizontal dd:before{content:" ";display:table}.dl-horizontal dd:after{clear:both}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}.container{width:750px}}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dropdown-menu>li>a,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857;color:#777}legend,pre{color:#333}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0;text-align:right}code,kbd{padding:2px 4px;font-size:90%}caption,th{text-align:left}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{font-style:normal;line-height:1.42857}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{color:#fff;background-color:#333;border-radius:3px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}.container-fluid:after,.container-fluid:before,.container:after,.container:before,.row:after,.row:before{display:table;content:" "}.container,.container-fluid{margin-right:auto;margin-left:auto}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;border-radius:0}.container,.container-fluid{padding-left:15px;padding-right:15px}.pre-scrollable{overflow-y:scroll}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.row{margin-left:-15px;margin-right:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-left:15px;padding-right:15px}.col-xs-1{width:8.33333%}.col-xs-2{width:16.66667%}.col-xs-3{width:25%}.col-xs-4{width:33.33333%}.col-xs-5{width:41.66667%}.col-xs-6{width:50%}.col-xs-7{width:58.33333%}.col-xs-8{width:66.66667%}.col-xs-9{width:75%}.col-xs-10{width:83.33333%}.col-xs-11{width:91.66667%}.col-xs-12{width:100%}.col-xs-pull-0{right:auto}.col-xs-pull-1{right:8.33333%}.col-xs-pull-2{right:16.66667%}.col-xs-pull-3{right:25%}.col-xs-pull-4{right:33.33333%}.col-xs-pull-5{right:41.66667%}.col-xs-pull-6{right:50%}.col-xs-pull-7{right:58.33333%}.col-xs-pull-8{right:66.66667%}.col-xs-pull-9{right:75%}.col-xs-pull-10{right:83.33333%}.col-xs-pull-11{right:91.66667%}.col-xs-pull-12{right:100%}.col-xs-push-0{left:auto}.col-xs-push-1{left:8.33333%}.col-xs-push-2{left:16.66667%}.col-xs-push-3{left:25%}.col-xs-push-4{left:33.33333%}.col-xs-push-5{left:41.66667%}.col-xs-push-6{left:50%}.col-xs-push-7{left:58.33333%}.col-xs-push-8{left:66.66667%}.col-xs-push-9{left:75%}.col-xs-push-10{left:83.33333%}.col-xs-push-11{left:91.66667%}.col-xs-push-12{left:100%}.col-xs-offset-0{margin-left:0}.col-xs-offset-1{margin-left:8.33333%}.col-xs-offset-2{margin-left:16.66667%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-4{margin-left:33.33333%}.col-xs-offset-5{margin-left:41.66667%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-7{margin-left:58.33333%}.col-xs-offset-8{margin-left:66.66667%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-10{margin-left:83.33333%}.col-xs-offset-11{margin-left:91.66667%}.col-xs-offset-12{margin-left:100%}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-1{width:8.33333%}.col-sm-2{width:16.66667%}.col-sm-3{width:25%}.col-sm-4{width:33.33333%}.col-sm-5{width:41.66667%}.col-sm-6{width:50%}.col-sm-7{width:58.33333%}.col-sm-8{width:66.66667%}.col-sm-9{width:75%}.col-sm-10{width:83.33333%}.col-sm-11{width:91.66667%}.col-sm-12{width:100%}.col-sm-pull-0{right:auto}.col-sm-pull-1{right:8.33333%}.col-sm-pull-2{right:16.66667%}.col-sm-pull-3{right:25%}.col-sm-pull-4{right:33.33333%}.col-sm-pull-5{right:41.66667%}.col-sm-pull-6{right:50%}.col-sm-pull-7{right:58.33333%}.col-sm-pull-8{right:66.66667%}.col-sm-pull-9{right:75%}.col-sm-pull-10{right:83.33333%}.col-sm-pull-11{right:91.66667%}.col-sm-pull-12{right:100%}.col-sm-push-0{left:auto}.col-sm-push-1{left:8.33333%}.col-sm-push-2{left:16.66667%}.col-sm-push-3{left:25%}.col-sm-push-4{left:33.33333%}.col-sm-push-5{left:41.66667%}.col-sm-push-6{left:50%}.col-sm-push-7{left:58.33333%}.col-sm-push-8{left:66.66667%}.col-sm-push-9{left:75%}.col-sm-push-10{left:83.33333%}.col-sm-push-11{left:91.66667%}.col-sm-push-12{left:100%}.col-sm-offset-0{margin-left:0}.col-sm-offset-1{margin-left:8.33333%}.col-sm-offset-2{margin-left:16.66667%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-4{margin-left:33.33333%}.col-sm-offset-5{margin-left:41.66667%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-7{margin-left:58.33333%}.col-sm-offset-8{margin-left:66.66667%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-10{margin-left:83.33333%}.col-sm-offset-11{margin-left:91.66667%}.col-sm-offset-12{margin-left:100%}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-1{width:8.33333%}.col-md-2{width:16.66667%}.col-md-3{width:25%}.col-md-4{width:33.33333%}.col-md-5{width:41.66667%}.col-md-6{width:50%}.col-md-7{width:58.33333%}.col-md-8{width:66.66667%}.col-md-9{width:75%}.col-md-10{width:83.33333%}.col-md-11{width:91.66667%}.col-md-12{width:100%}.col-md-pull-0{right:auto}.col-md-pull-1{right:8.33333%}.col-md-pull-2{right:16.66667%}.col-md-pull-3{right:25%}.col-md-pull-4{right:33.33333%}.col-md-pull-5{right:41.66667%}.col-md-pull-6{right:50%}.col-md-pull-7{right:58.33333%}.col-md-pull-8{right:66.66667%}.col-md-pull-9{right:75%}.col-md-pull-10{right:83.33333%}.col-md-pull-11{right:91.66667%}.col-md-pull-12{right:100%}.col-md-push-0{left:auto}.col-md-push-1{left:8.33333%}.col-md-push-2{left:16.66667%}.col-md-push-3{left:25%}.col-md-push-4{left:33.33333%}.col-md-push-5{left:41.66667%}.col-md-push-6{left:50%}.col-md-push-7{left:58.33333%}.col-md-push-8{left:66.66667%}.col-md-push-9{left:75%}.col-md-push-10{left:83.33333%}.col-md-push-11{left:91.66667%}.col-md-push-12{left:100%}.col-md-offset-0{margin-left:0}.col-md-offset-1{margin-left:8.33333%}.col-md-offset-2{margin-left:16.66667%}.col-md-offset-3{margin-left:25%}.col-md-offset-4{margin-left:33.33333%}.col-md-offset-5{margin-left:41.66667%}.col-md-offset-6{margin-left:50%}.col-md-offset-7{margin-left:58.33333%}.col-md-offset-8{margin-left:66.66667%}.col-md-offset-9{margin-left:75%}.col-md-offset-10{margin-left:83.33333%}.col-md-offset-11{margin-left:91.66667%}.col-md-offset-12{margin-left:100%}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-1{width:8.33333%}.col-lg-2{width:16.66667%}.col-lg-3{width:25%}.col-lg-4{width:33.33333%}.col-lg-5{width:41.66667%}.col-lg-6{width:50%}.col-lg-7{width:58.33333%}.col-lg-8{width:66.66667%}.col-lg-9{width:75%}.col-lg-10{width:83.33333%}.col-lg-11{width:91.66667%}.col-lg-12{width:100%}.col-lg-pull-0{right:auto}.col-lg-pull-1{right:8.33333%}.col-lg-pull-2{right:16.66667%}.col-lg-pull-3{right:25%}.col-lg-pull-4{right:33.33333%}.col-lg-pull-5{right:41.66667%}.col-lg-pull-6{right:50%}.col-lg-pull-7{right:58.33333%}.col-lg-pull-8{right:66.66667%}.col-lg-pull-9{right:75%}.col-lg-pull-10{right:83.33333%}.col-lg-pull-11{right:91.66667%}.col-lg-pull-12{right:100%}.col-lg-push-0{left:auto}.col-lg-push-1{left:8.33333%}.col-lg-push-2{left:16.66667%}.col-lg-push-3{left:25%}.col-lg-push-4{left:33.33333%}.col-lg-push-5{left:41.66667%}.col-lg-push-6{left:50%}.col-lg-push-7{left:58.33333%}.col-lg-push-8{left:66.66667%}.col-lg-push-9{left:75%}.col-lg-push-10{left:83.33333%}.col-lg-push-11{left:91.66667%}.col-lg-push-12{left:100%}.col-lg-offset-0{margin-left:0}.col-lg-offset-1{margin-left:8.33333%}.col-lg-offset-2{margin-left:16.66667%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-4{margin-left:33.33333%}.col-lg-offset-5{margin-left:41.66667%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-7{margin-left:58.33333%}.col-lg-offset-8{margin-left:66.66667%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-10{margin-left:83.33333%}.col-lg-offset-11{margin-left:91.66667%}.col-lg-offset-12{margin-left:100%}}caption{padding-top:8px;padding-bottom:8px;color:#777}.table{width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered,.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover,.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}table col[class*=col-]{position:static;float:none;display:table-column}table td[class*=col-],table th[class*=col-]{position:static;float:none;display:table-cell}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{overflow-x:auto;min-height:.01%}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset,legend{padding:0;border:0}fieldset{margin:0;min-width:0}legend{display:block;width:100%;margin-bottom:20px;font-size:21px;line-height:inherit;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px}input[type=search]{box-sizing:border-box;-webkit-appearance:none}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}.form-control,output{font-size:14px;line-height:1.42857;color:#555;display:block}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}output{padding-top:7px}.form-control{width:100%;height:34px;padding:6px 12px;background-color:#fff;border:1px solid #ccc;box-shadow:inset 0 1px 1px rgba(0,0,0,.075);transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .form-control-feedback,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.form-control::-ms-expand{border:0;background-color:transparent}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],.input-group-sm>.input-group-btn>input[type=date].btn,.input-group-sm>.input-group-btn>input[type=time].btn,.input-group-sm>.input-group-btn>input[type=datetime-local].btn,.input-group-sm>.input-group-btn>input[type=month].btn,.input-group-sm>input[type=date].form-control,.input-group-sm>input[type=date].input-group-addon,.input-group-sm>input[type=time].form-control,.input-group-sm>input[type=time].input-group-addon,.input-group-sm>input[type=datetime-local].form-control,.input-group-sm>input[type=datetime-local].input-group-addon,.input-group-sm>input[type=month].form-control,.input-group-sm>input[type=month].input-group-addon,input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],.input-group-lg>.input-group-btn>input[type=date].btn,.input-group-lg>.input-group-btn>input[type=time].btn,.input-group-lg>.input-group-btn>input[type=datetime-local].btn,.input-group-lg>.input-group-btn>input[type=month].btn,.input-group-lg>input[type=date].form-control,.input-group-lg>input[type=date].input-group-addon,.input-group-lg>input[type=time].form-control,.input-group-lg>input[type=time].input-group-addon,.input-group-lg>input[type=datetime-local].form-control,.input-group-lg>input[type=datetime-local].input-group-addon,.input-group-lg>input[type=month].form-control,.input-group-lg>input[type=month].input-group-addon,input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-left:-20px;margin-top:4px\9}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}.checkbox-inline.disabled,.checkbox.disabled label,.radio-inline.disabled,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio label,fieldset[disabled] .radio-inline,fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0;min-height:34px}.form-control-static.input-lg,.form-control-static.input-sm,.input-group-lg>.form-control-static.form-control,.input-group-lg>.form-control-static.input-group-addon,.input-group-lg>.input-group-btn>.form-control-static.btn,.input-group-sm>.form-control-static.form-control,.input-group-sm>.form-control-static.input-group-addon,.input-group-sm>.input-group-btn>.form-control-static.btn{padding-left:0;padding-right:0}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn,.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.input-group-sm>.input-group-btn>select.btn,.input-group-sm>select.form-control,.input-group-sm>select.input-group-addon,select.input-sm{height:30px;line-height:30px}.input-group-sm>.input-group-btn>select[multiple].btn,.input-group-sm>.input-group-btn>textarea.btn,.input-group-sm>select[multiple].form-control,.input-group-sm>select[multiple].input-group-addon,.input-group-sm>textarea.form-control,.input-group-sm>textarea.input-group-addon,select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn,.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.33333;border-radius:6px}.input-group-lg>.input-group-btn>select.btn,.input-group-lg>select.form-control,.input-group-lg>select.input-group-addon,select.input-lg{height:46px;line-height:46px}.input-group-lg>.input-group-btn>select[multiple].btn,.input-group-lg>.input-group-btn>textarea.btn,.input-group-lg>select[multiple].form-control,.input-group-lg>select[multiple].input-group-addon,.input-group-lg>textarea.form-control,.input-group-lg>textarea.input-group-addon,select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.33333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center}.collapsing,.dropdown,.dropup{position:relative}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-group-lg>.form-control+.form-control-feedback,.input-group-lg>.input-group-addon+.form-control-feedback,.input-group-lg>.input-group-btn>.btn+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-group-sm>.form-control+.form-control-feedback,.input-group-sm>.input-group-addon+.form-control-feedback,.input-group-sm>.input-group-btn>.btn+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .form-control{border-color:#3c763d;box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .form-control-feedback,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .form-control-feedback,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;border-color:#a94442;background-color:#f2dede}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-control-static,.form-inline .form-group{display:inline-block}.form-inline .control-label,.form-inline .form-group{margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}.form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:7px}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{margin-top:0;margin-bottom:0;padding-top:7px}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-left:-15px;margin-right:-15px}.form-horizontal .form-group:after,.form-horizontal .form-group:before{content:" ";display:table}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{outline:0;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;opacity:.65;filter:alpha(opacity=65);box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.btn-default:hover,.open>.btn-default.dropdown-toggle{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.btn-default.dropdown-toggle.focus,.open>.btn-default.dropdown-toggle:focus,.open>.btn-default.dropdown-toggle:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary.active,.btn-primary:active,.btn-primary:hover,.open>.btn-primary.dropdown-toggle{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.btn-primary.dropdown-toggle.focus,.open>.btn-primary.dropdown-toggle:focus,.open>.btn-primary.dropdown-toggle:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success.active,.btn-success:active,.btn-success:hover,.open>.btn-success.dropdown-toggle{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.btn-success.dropdown-toggle.focus,.open>.btn-success.dropdown-toggle:focus,.open>.btn-success.dropdown-toggle:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.btn-success.dropdown-toggle{background-image:none}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info.active,.btn-info:active,.btn-info:hover,.open>.btn-info.dropdown-toggle{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.btn-info.dropdown-toggle.focus,.open>.btn-info.dropdown-toggle:focus,.open>.btn-info.dropdown-toggle:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.btn-warning:hover,.open>.btn-warning.dropdown-toggle{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.btn-warning.dropdown-toggle.focus,.open>.btn-warning.dropdown-toggle:focus,.open>.btn-warning.dropdown-toggle:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger.active,.btn-danger:active,.btn-danger:hover,.open>.btn-danger.dropdown-toggle{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.btn-danger.dropdown-toggle.focus,.open>.btn-danger.dropdown-toggle:focus,.open>.btn-danger.dropdown-toggle:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{color:#337ab7;font-weight:400;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.33333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{height:0;overflow:hidden;transition-property:height,visibility;transition-duration:.35s;transition-timing-function:ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:14px;text-align:left;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu-right,.dropdown-menu.pull-right{left:auto;right:0}.dropdown-header,.dropdown-menu>li>a{display:block;padding:3px 20px;line-height:1.42857;white-space:nowrap}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle,.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child,.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child),.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn,.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{font-weight:400;color:#333}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;outline:0;background-color:#337ab7}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;background-color:transparent;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{font-size:12px;color:#777}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{left:0;right:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar:after,.btn-toolbar:before{content:" ";display:table}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn .caret,.btn-group>.btn:first-child{margin-left:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.btn-group-lg.btn-group>.btn+.dropdown-toggle,.btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.btn-group.open .dropdown-toggle{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{box-shadow:none}.btn-group-lg>.btn .caret,.btn-lg .caret{border-width:5px 5px 0}.dropup .btn-group-lg>.btn .caret,.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before{content:" ";display:table}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-radius:4px 4px 0 0}.btn-group-vertical>.btn:last-child:not(:first-child){border-radius:0 0 4px 4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn,.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group,.input-group-btn,.input-group-btn>.btn{position:relative}.input-group{display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-left:0;padding-right:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.input-group-addon.btn{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.input-group-addon.btn{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{font-size:0;white-space:nowrap}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{margin-bottom:0;padding-left:0;list-style:none}.nav:after,.nav:before{content:" ";display:table}.nav>li,.nav>li>a{display:block;position:relative}.nav:after{clear:both}.nav>li>a{padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;background-color:transparent;cursor:not-allowed}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default}.nav-pills>li{float:left}.nav-justified>li,.nav-stacked>li,.nav-tabs.nav-justified>li{float:none}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified,.nav-tabs.nav-justified{width:100%}.nav-justified>li>a,.nav-tabs.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}.nav-tabs-justified,.nav-tabs.nav-justified{border-bottom:0}.nav-tabs-justified>li>a,.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-justified>li,.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a,.nav-tabs.nav-justified>li>a{margin-bottom:0}.nav-tabs-justified>li>a,.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}.navbar:after,.navbar:before{content:" ";display:table}.navbar-header:after,.navbar-header:before{content:" ";display:table}.navbar-collapse{overflow-x:visible;padding-right:15px;padding-left:15px;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,.1);-webkit-overflow-scrolling:touch}.navbar-collapse:after,.navbar-collapse:before{content:" ";display:table}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar{border-radius:4px}.navbar-header{float:left}.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-left:0;padding-right:0}}.embed-responsive,.modal,.modal-open,.progress{overflow:hidden}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}.navbar-static-top{z-index:1000;border-width:0 0 1px}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px;font-size:18px;line-height:20px;height:50px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;margin-right:15px;padding:9px 10px;margin-top:8px;margin-bottom:8px;background-color:transparent;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}.progress-bar-striped,.progress-striped .progress-bar,.progress-striped .progress-bar-danger,.progress-striped .progress-bar-info,.progress-striped .progress-bar-success,.progress-striped .progress-bar-warning{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}@media (min-width:768px){.navbar-toggle{display:none}.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;border-top:1px solid transparent;border-bottom:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);margin:8px -15px}@media (min-width:768px){.navbar-form .form-control-static,.navbar-form .form-group{display:inline-block}.navbar-form .control-label,.navbar-form .form-group{margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}.navbar-form{width:auto;border:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;box-shadow:none}}.breadcrumb>li,.pagination{display:inline-block}.btn .badge,.btn .label{top:-1px;position:relative}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-radius:4px 4px 0 0}.navbar-btn{margin-top:8px;margin-bottom:8px}.btn-group-sm>.navbar-btn.btn,.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.btn-group-xs>.navbar-btn.btn,.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-left:15px;margin-right:15px}.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-nav>li>a,.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{background-color:#e7e7e7;color:#555}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#090909}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>li>a,.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#090909}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{background-color:#090909;color:#fff}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#090909}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#090909}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#090909}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li+li:before{content:"/ ";padding:0 5px;color:#ccc}.breadcrumb>.active{color:#777}.pagination{padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;line-height:1.42857;text-decoration:none;color:#337ab7;background-color:#fff;border:1px solid #ddd;margin-left:-1px}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-bottom-right-radius:4px;border-top-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;background-color:#337ab7;border-color:#337ab7;cursor:default}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;background-color:#fff;border-color:#ddd;cursor:not-allowed}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.33333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-bottom-right-radius:6px;border-top-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.badge,.label{font-weight:700;line-height:1;white-space:nowrap;text-align:center}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-bottom-right-radius:3px;border-top-right-radius:3px}.pager{padding-left:0;margin:20px 0;list-style:none;text-align:center}.pager:after,.pager:before{content:" ";display:table}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;background-color:#fff;cursor:not-allowed}.label{display:inline;padding:.2em .6em .3em;font-size:75%;color:#fff;border-radius:.25em}.label:empty{display:none}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;color:#fff;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.media-object,.thumbnail{display:block}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.jumbotron,.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.alert,.thumbnail{margin-bottom:20px}.alert .alert-link,.close{font-weight:700}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px;padding-left:15px;padding-right:15px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-left:60px;padding-right:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{padding:4px;line-height:1.42857;background-color:#fff;border:1px solid #ddd;border-radius:4px;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto;margin-left:auto;margin-right:auto}.thumbnail .caption{padding:9px;color:#333}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.alert{padding:15px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.modal,.modal-backdrop{top:0;right:0;bottom:0;left:0}.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{background-color:#fcf8e3;border-color:#faebcc;color:#8a6d3b}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#a94442}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;background-color:#f5f5f5;border-radius:4px;box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-bar-info{background-color:#5bc0de}.progress-bar-warning{background-color:#f0ad4e}.progress-bar-danger{background-color:#d9534f}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{zoom:1;overflow:hidden}.media-body{width:10000px}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle,footer div img{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{margin-bottom:20px;padding-left:0}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{text-decoration:none;color:#555;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{background-color:#eee;color:#777;cursor:not-allowed}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.panel-heading>.dropdown .dropdown-toggle,.panel-title,.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-title,.panel>.list-group,.panel>.panel-collapse>.list-group,.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel-body{padding:15px}.panel-body:after,.panel-body:before{content:" ";display:table}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-title{margin-top:0;font-size:16px}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel-group .panel-heading,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-responsive:last-child>.table:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-right-radius:3px;border-top-left-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel>.table-responsive:first-child>.table:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-right-radius:3px;border-top-left-radius:3px}.list-group+.panel-footer,.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-left:15px;padding-right:15px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-responsive{border:0;margin-bottom:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.popover,.tooltip{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;line-break:auto;line-height:1.42857;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;text-decoration:none}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none}.modal-content,.popover{background-clip:padding-box}.modal{display:none;position:fixed;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before{display:table;content:" "}.modal.fade .modal-dialog{transform:translate(0,-25%);transition:transform .3s ease-out}.modal.in .modal-dialog{transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0}.modal-backdrop{position:fixed;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}.tooltip.top-left .tooltip-arrow,.tooltip.top-right .tooltip-arrow{bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;text-align:left;text-align:start;font-size:12px;opacity:0;filter:alpha(opacity=0)}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{margin-top:-3px;padding:5px 0}.tooltip.right{margin-left:3px;padding:0 5px}.tooltip.bottom{margin-top:3px;padding:5px 0}.tooltip.left{margin-left:-3px;padding:0 5px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px}.tooltip.top-right .tooltip-arrow{left:5px}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow,.tooltip.bottom-left .tooltip-arrow,.tooltip.bottom-right .tooltip-arrow{border-width:0 5px 5px;border-bottom-color:#000;top:0}.tooltip.bottom .tooltip-arrow{left:50%;margin-left:-5px}.tooltip.bottom-left .tooltip-arrow{right:5px;margin-top:-5px}.tooltip.bottom-right .tooltip-arrow{left:5px;margin-top:-5px}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;text-align:left;text-align:start;font-size:14px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;box-shadow:0 5px 10px rgba(0,0,0,.2)}.carousel-caption,.carousel-control{color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.6);text-align:center}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{margin:0;padding:8px 14px;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.carousel,.carousel-inner{position:relative}.popover>.arrow{border-width:11px}.popover>.arrow:after{border-width:10px;content:""}.popover.top>.arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0,0,0,.25);bottom:-11px}.popover.top>.arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#fff}.popover.left>.arrow:after,.popover.right>.arrow:after{content:" ";bottom:-10px}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0,0,0,.25)}.popover.right>.arrow:after{left:1px;border-left-width:0;border-right-color:#fff}.popover.bottom>.arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25);top:-11px}.popover.bottom>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;border-right-width:0;border-left-color:#fff}.carousel-inner{overflow:hidden;width:100%}.carousel-inner>.item{display:none;position:relative;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{display:block;max-width:100%;height:auto;line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{transform:translate3d(100%,0,0);left:0}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{transform:translate3d(-100%,0,0);left:0}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{transform:translate3d(0,0,0);left:0}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;left:0;bottom:0;width:15%;opacity:.5;filter:alpha(opacity=50);font-size:20px;background-color:transparent}.carousel-control.left{background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1)}.carousel-control.right{left:auto;right:0;background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1)}.carousel-control:focus,.carousel-control:hover{outline:0;color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;margin-top:-10px;z-index:5;display:inline-block}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;line-height:1;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;margin-left:-30%;padding-left:0;list-style:none;text-align:center}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;border:1px solid #fff;border-radius:10px;cursor:pointer;background-color:#000\9;background-color:transparent}.carousel-indicators .active{margin:0;width:12px;height:12px;background-color:#fff}.carousel-caption{position:absolute;left:15%;right:15%;bottom:20px;z-index:10;padding-top:20px;padding-bottom:20px}.carousel-caption .btn,.text-hide{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{left:20%;right:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:after,.clearfix:before{content:" ";display:table}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.hidden,.visible-lg,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;background-color:transparent;border:0}.affix{position:fixed}@-ms-viewport{width:device-width}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}.visible-xs-block{display:block!important}.visible-xs-inline{display:inline!important}.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}.visible-sm-block{display:block!important}.visible-sm-inline{display:inline!important}.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}.visible-md-block{display:block!important}.visible-md-inline{display:inline!important}.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}.visible-lg-block{display:block!important}.visible-lg-inline{display:inline!important}.visible-lg-inline-block{display:inline-block!important}.hidden-lg{display:none!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}.hidden-print{display:none!important}}.browsehappy{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}body,html{max-height:100%;height:100vh;margin:0;padding:0}*,body,html{box-sizing:border-box;font-size:16px}h1{font-size:3rem}h2{font-size:2rem}h3{font-size:1.5rem}body{display:flex;flex-direction:column}body footer{flex:none;height:100px}body div[ng-view]{flex:4 1 90%}.container .logo{max-width:50rem;max-height:20rem}aside .logo{text-align:center;display:block}aside .logo img{height:75px}#pattern,#pattern svg{width:0;height:0}.btn,.form-control{border-radius:2px}.btn.btn-tile{height:4em;width:6em;font-size:1rem;padding:.5em}div[ng-view]{overflow:auto;display:flex}div[ng-view] aside,div[ng-view] main{max-height:100%;max-width:100%;overflow:auto}div[ng-view] main{flex:1 1 100%}div[ng-view] main #legend{height:100%;background-color:#ddd;display:flex}div[ng-view] main #legend svg{margin:auto;background-color:#fff}div[ng-view] main #workspace{height:calc(100vh);width:auto}div[ng-view] aside.right-side{border-right:1px solid #e5e5e5;display:flex;flex-direction:column}div[ng-view] aside.right-side div.aside-content{flex:1 1 100%;overflow:auto}div[ng-view] aside.right-side div.aside-content h4:not(.panel-title){margin-top:1em;border-bottom:1px solid #e5e5e5}div[ng-view] aside.right-side div.aside-footer{border-top:1px solid #e5e5e5;text-align:right;padding:.5em 0}footer,header{display:flex}footer div:first-child{border-right:1px solid #e5e5e5;margin-right:1em}footer div{flex:0 1 50%;width:50%}footer div img{max-height:3em;max-width:6em;width:auto;height:auto}footer div ul,footer div ul>li{list-style:none;margin:0;padding:0}footer div table{width:100%;max-width:500px;margin:auto}footer div table td{width:50%;padding-bottom:1em}header h1,header h2,header h3,header h4{display:inline-block}header h1{flex:10 0 auto}header h2,header h3,header h4{flex:1 0 auto}.header,header{border-bottom:1px solid #e5e5e5}.header h3,header h3{margin-top:0;margin-bottom:0;line-height:40px;padding-bottom:19px}.footer,footer{padding-top:19px;color:#777;border-top:1px solid #e5e5e5}.container-narrow>hr{margin:30px 0}.jumbotron{text-align:center;background-color:transparent;height:auto;margin:auto}.jumbotron .btn{font-size:2rem;padding:1rem;margin-bottom:4rem}.jumbotron table{width:100%}.jumbotron table.table--five-column td{width:20%;text-align:center}.jumbotron table.table--four-column td{width:25%;text-align:center}.jumbotron img{max-height:3rem}.marketing{margin:40px 0}.marketing p+h4{margin-top:28px}@media screen and (max-width:768px){.container{max-width:730px}.footer,.header,.marketing,div[ng-view],footer,header{padding-left:0;padding-right:0}.header,header{margin-bottom:30px}.jumbotron{border-bottom:0}}@font-face{font-family:Braille_2007;src:url(../fonts/Braille_2007.ttf)}.braille{font-family:Braille_2007}.panel-heading a:after{font-family:'Glyphicons Halflings';content:"\e114";float:right;color:grey}.panel-heading a.collapsed:after{content:"\e080"}.panel-body ul{padding:0;margin:0}.panel-body ul li{list-style:none;margin-bottom:25px}.panel-body ul li img{cursor:pointer}.panel-body .img-responsive{max-width:100%}.form-inline{padding-bottom:15px}.icon-15px{width:15px}.slider-container{width:200px!important}svg:not(:root){overflow:visible}.features-list{padding-left:0}.map{position:relative}.layer,.tile{position:absolute}.tile{width:256px;height:256px}.style-selector{padding:0;border:0}.style-selector .ui-select-match .form-control{width:100%}.menu-right{background-color:#EEE}.filters-grid{height:200px}.highlight{background-color:beige!important}.edition,.ongoing{stroke-width:2px;stroke:grey}.menu-segment{fill:#d4d4d4}.menu-segment:hover{fill:#e5e5e5} \ No newline at end of file diff --git a/index.html b/index.html index 298173cc..357dfb6c 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ - + @@ -22,70 +22,6 @@
- - - + diff --git a/scripts/app-6dc63e7f18.js b/scripts/app-6dc63e7f18.js new file mode 100644 index 00000000..bf62cc8c --- /dev/null +++ b/scripts/app-6dc63e7f18.js @@ -0,0 +1,9830 @@ +(function() { + 'use strict'; + /** + * @ngdoc overview + * @name accessimapEditeurDerApp + * @description + * Main module of the application. + */ + var moduleApp = 'accessimapEditeurDerApp'; + + window.moduleApp = moduleApp; + + angular + .module(moduleApp, [ + 'ngOpbeat', + 'ngAnimate', + 'ngCookies', + 'ngResource', + 'ngRoute', + 'ngSanitize', + 'ngTouch', + 'ui.select', + 'ui.bootstrap', + 'ui.bootstrap-slider', + 'bootstrap.fileField' + ]) + .config(function($routeProvider) { + $routeProvider + .when('/', { + templateUrl: 'scripts/routes/home/template.html', + controller: 'HomeController', + controllerAs: '$ctrl' + }) + .when('/edit', { + templateUrl: 'scripts/routes/edit/template.html', + controller: 'EditController', + controllerAs: '$ctrl' + }) + .otherwise({ + redirectTo: '/' + }); + }) + .config(function(uiSelectConfig) { + uiSelectConfig.dropdownPosition = 'down'; + }) + .config(function ($opbeatProvider) { + $opbeatProvider.config({ + orgId: '43f4c77b74f64097ab04194c87d98086', + appId: '7bcd582124' + }) + }); + +})(); + + +/** + * @ngdoc filter + * @name accessimapEditeurDerApp.filter:layerNotSelected + * @function + * + * @description + * Return all the layers not selected from an array of layers + * & another of selected layers + * + * Intersection between layers'set and selectedLayer'set + */ +(function() { + 'use strict'; + + angular.module(moduleApp) + .filter('layerNotSelected', function() { + return function(layers, selectedLayers) { + var filteredLayers = []; + + angular.forEach(layers, function(layer) { + var toAdd = true; + angular.forEach(selectedLayers, function(selectedLayer) { + if (layer.id === selectedLayer.id) { + toAdd = false; + } + }); + + if (toAdd) { + filteredLayers.push(layer); + } + }); + + return filteredLayers; + }; + }); +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToasterService + * @description + * Service providing functions to display messages to the user. + * + * Use toastr, but could be another library in the future without breaking the code. + * + */ +(function() { + 'use strict'; + + function ToasterService() { + + this.error = error; + this.success = success; + this.warning = warning; + this.info = info; + this.remove = remove; + + /** + * @ngdoc method + * @name error + * @methodOf accessimapEditeurDerApp.ToasterService + * + * @description + * Display an error message to the user, alias of toastr.error + * + * @param {Error} error + * Error raised or throwned by the system. + * + * @param {Object} options + * Options passed to toastr + + */ + function error(error, options) { + toastr.error(error, options) + } + + /** + * @ngdoc method + * @name info + * @methodOf accessimapEditeurDerApp.ToasterService + * + * @description + * Display an info to the user, alias of toastr.info + * + * @param {string} message + * Message to be displayed + * + * @param {Object} options + * Options passed to toastr + * + */ + function info(message, options) { + toastr.info(message, options) + } + + /** + * @ngdoc method + * @name success + * @methodOf accessimapEditeurDerApp.ToasterService + * + * @description + * Display a success to the user, alias of toastr.success + * + * @param {string} message + * Message to be displayed + * + * @param {Object} options + * Options passed to toastr + * + */ + function success(message, options) { + toastr.success(message, options) + } + + /** + * @ngdoc method + * @name warning + * @methodOf accessimapEditeurDerApp.ToasterService + * + * @description + * Display a warning to the user, alias of toastr.warning + * + * @param {string} message + * Message to be displayed + * + * @param {Object} options + * Options passed to toastr + * + */ + function warning(message, options) { + toastr.warning(message, options) + } + + /** + * @ngdoc method + * @name remove + * @methodOf accessimapEditeurDerApp.ToasterService + * + * @description + * Remove the current toastr without animations, alias of toastr.remove + * + */ + function remove() { + toastr.remove() + } + + } + + angular.module(moduleApp).service('ToasterService', ToasterService); + + ToasterService.$inject = []; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.RadialMenuService + * + * @description + * Service providing functions to draw a radial menu on a specific feature + */ +(function() { + 'use strict'; + + function RadialMenuService(SettingsActions, MapService) { + + this.drawMenu = drawMenu; + this.addRadialMenu = addRadialMenu; + this.hideRadialMenu = hideRadialMenu; + + this.init = init; + + var menu = null, + svg, + getCurrentZoom, + currentTarget, + draw; + + function init(_svg, _getCurrentZoom) { + svg = _svg; + getCurrentZoom = _getCurrentZoom; + } + + /** + * @ngdoc method + * @name drawMenu + * @methodOf accessimapEditeurDerApp.RadialMenuService + * + * @description + * Draw the menu for the specific target, at a specific point + * + * @param {[type]} target + * Target on which will be attached the menu + * + * @param {Array} mousePosition + * Point [x,y] where the menu will be displayed + * + * @return {Object} + * The menu drawned + */ + function drawMenu(target, mousePosition, svg) { + + currentTarget = target; + + var type = target.attr('data-type') ? target.attr('data-type') : 'default' , + overlay = document.querySelector('svg[data-name="overlay"]'); + + if (type) { + var data = SettingsActions.ACTIONS[type], + + m = new d3.radialMenu() + .radius(50) + .thickness(60) + .animationDuration(100) + .iconSize(40) + .translation(mousePosition[0] + ' ' + mousePosition[1]) + .onClick(function(d) { + + d3.event.preventDefault(); + d3.event.stopPropagation(); + + hideRadialMenu(); + + var action = d.data.action; + action(target, addRadialMenu); + }) + .appendTo(overlay) + .show(data); + + svg.on('click', hideRadialMenu); + $(document).on('mousedown', hideRadialMenu); + MapService.getMap().on("click", hideRadialMenu) + + return m; + } + } + + /** + * @ngdoc method + * @name addRadialMenu + * @methodOf accessimapEditeurDerApp.RadialMenuService + * + * @description + * Attach a radial menu to a specific element + * + * @param {Object} elements + * DOM Element(s) on which the event 'contextmenu' will be attached + * + */ + function addRadialMenu(elements, svg) { + elements.on('contextmenu', function() { + var elmt = d3.select(this), + pos = [d3.event.offsetX, d3.event.offsetY]; + + d3.event.preventDefault(); + d3.event.stopPropagation(); + + draw = function redrawMenu() { + if (menu) menu.hide(); + menu = drawMenu(elmt, pos, svg); + } + + draw(); + + MapService.getMap().on("zoomend", draw) + }); + + // useful if we want to add a visual helper to the user + // for seeing which feature he's going to edit + // elements.on('mouseover', function(event) { + // console.log('mouseover') + // }) + + // useful if we want to display properties of this element + // elements.on('click', function(event) { + // console.log('click') + // }) + } + + /** + * @ngdoc method + * @name hideRadialMenu + * @methodOf accessimapEditeurDerApp.RadialMenuService + * + * @description + * Remove the menu if exists (TODO: destroyed the DOM element ?) + */ + function hideRadialMenu() { + if (menu) { + menu.hide(); + menu = null; + svg.on('click', function() {}); + $(document).on('click', function() {}); + MapService.getMap().off("zoomend", draw); + MapService.getMap().off("click", hideRadialMenu) + } + + // if (currentTarget) { + // currentTarget.classed('blink', false); + // } + + } + + } + + angular.module(moduleApp).service('RadialMenuService', RadialMenuService); + + RadialMenuService.$inject = ['SettingsActions', 'MapService']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.UtilService + * @description + * Service exposing utils functions + */ +(function() { + 'use strict'; + + function UtilService($q) { + + this.convertImgToBase64 = convertImgToBase64; + this.getiid = getiid; + this.uploadFile = uploadFile; + + /** + * @ngdoc method + * @name convertImgToBase64 + * @methodOf accessimapEditeurDerApp.UtilService + * + * @description + * Convert a png tile into a base64 image + * + * Useful for later edition in software like Inkscape for better display / edition + * @param {Object} tile [description] + */ + function convertImgToBase64(tile) { + if (tile) { + var img = new Image(); + img.crossOrigin = 'Anonymous'; + img.src = d3.select(tile).attr('href'); + img.onload = function() { + var canvas = document.createElement('CANVAS'), + ctx = canvas.getContext('2d'); + canvas.height = this.height; + canvas.width = this.width; + ctx.drawImage(this, 0, 0); + var dataURL = canvas.toDataURL('image/png'); + d3.select(tile).attr('href', dataURL); + }; + } + } + + var iid = 1; + + /** + * ngdoc method + * @name getiid + * @methodOf accessimapEditeurDerApp.UtilService + * + * @description + * Function returning an unique identifier + * Useful to store svg element with a uid + * + * @return {integer} Fresh id ! + */ + function getiid() { + return iid++; + } + + /** + * @ngdoc method + * @name uploadFile + * @methodOf accessimapEditeurDerApp.UtilService + * + * @description + * Get a file and send back the dataUrl with the file type + * + * @param {Object} element Input file object + * @return {Promise} Promise containing if success an object { type, dataUrl } + */ + function uploadFile(element) { + var file = element.files[0], + fileType = file.type, + reader = new FileReader(), + deferred = $q.defer(); + + reader.readAsDataURL(file); + reader.onload = function(e) { + deferred.resolve({type: fileType, dataUrl: e.target.result }) + }; + + reader.onerror = deferred.reject; + + return deferred.promise; + } + + } + + angular.module(moduleApp).service('UtilService', UtilService); + + UtilService.$inject= ['$q']; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.StorageService + * + * @description + * Service exposing storage functions to allow user retrieve his drawings + */ +(function() { + 'use strict'; + + function StorageService() { + + } + + angular.module(moduleApp) + .service('StorageService', StorageService); + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SVGService + * @description + * Service exposing utils functions + */ +(function() { + 'use strict'; + + function SVGService() { + + this.parseSVGPath = parseSVGPath; + this.serializeSVGPath = serializeSVGPath; + this.translateSVGPath = translateSVGPath; + + this.circlePath = circlePath; + this.circleCrossPath = circleCrossPath; + this.ovalPath = ovalPath; + this.trianglePath = trianglePath; + this.squarePath = squarePath; + this.northOrientation = northOrientation; + this.squareDiagPath = squareDiagPath; + this.squareCrossPath = squareCrossPath; + this.crossPath = crossPath; + this.horizontalRectPath = horizontalRectPath; + this.horizontalArrowPath = horizontalArrowPath; + this.horizontalSmallArrowPath = horizontalSmallArrowPath; + + + /** + * https://github.com/jkroso/parse-svg-path/ + * @param {[type]} path [description] + * @return {[type]} [description] + */ + function parseSVGPath(path) { + + /** + * expected argument lengths + * @type {Object} + */ + + var length = {a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0}, + + /** + * segment pattern + * @type {RegExp} + */ + + segment = /([astvzqmhlc])([^astvzqmhlc]*)/ig , + + /** + * parse an svg path data string. Generates an Array + * of commands where each command is an Array of the + * form `[command, arg1, arg2, ...]` + * + * @param {String} path + * @return {Array} + */ + + data = [] + + path.replace(segment, function(_, command, args) { + var type = command.toLowerCase() + args = parseValues(args) + + // overloaded moveTo + if (type == 'm' && args.length > 2) { + data.push([command].concat(args.splice(0, 2))) + type = 'l' + command = command == 'm' ? 'l' : 'L' + } + + while (true) { + if (args.length == length[type]) { + args.unshift(command) + return data.push(args) + } + + if (args.length < length[type]) throw new Error('malformed path data') + data.push([command].concat(args.splice(0, length[type]))) + } + }) + return data + + function parseValues(args) { + args = args.match(/-?[.0-9]+(?:e[-+]?\d+)?/ig) + return args ? args.map(Number) : [] + } + + + } + + /** + * git@github.com:michaelrhodes/translate-svg-path.git + * @param {[type]} segments [description] + * @param {[type]} x [description] + * @param {[type]} y [description] + * @return {[type]} [description] + */ + function translateSVGPath(segments, x, y) { + // y is optional + y = y || 0 + + return segments.map(function(segment) { + var cmd = segment[0] + + // Shift coords only for commands with absolute values + if ('ACHLMRQSTVZ'.indexOf(cmd) === -1) { + return segment + } + + var name = cmd.toLowerCase() + + // V is the only command, with shifted coords parity + if (name === 'v') { + segment[1] += y + + return segment + } + + // ARC is: ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] + // touch x, y only + if (name === 'a') { + segment[6] += x + segment[7] += y + + return segment + } + + // All other commands have [cmd, x1, y1, x2, y2, x3, y3, ...] format + return segment.map(function(val, i) { + if (!i) { + return val + } + + return i % 2 ? val + x : val + y + }) + }) + + } + + /** + * git://github.com/jkroso/serialize-svg-path.git + * @param {[type]} path [description] + * @return {[type]} [description] + */ + function serializeSVGPath(path) { + return path.reduce(function(str, seg) { + return str + seg[0] + seg.slice(1).join(',') + }, '') + } + + function circlePath(cx, cy, r) { + var d = 'M ' + cx + ' ' + cy; + d += ' m -' + r + ', 0'; + d += ' a ' + r + ',' + r + ' 0 1,0 ' + r * 2 + ',0'; + d += ' a ' + r + ',' + r + ' 0 1,0 -' + r * 2 + ',0'; + + return d; + }; + + function circleCrossPath(cx, cy, r) { + var d = 'M ' + cx + ' ' + cy; + d += ' m -' + r + ', 0'; + d += ' a ' + r + ',' + r + ' 0 1,0 ' + r * 2 + ',0'; + d += ' a ' + r + ',' + r + ' 0 1,0 -' + r * 2 + ',0'; + d += ' Z'; + r = r / Math.cos(45 * Math.PI / 180); + d += ' M ' + (cx - r / 2) + ' ' + (cy - r / 2); + d += ' L ' + (cx + r / 2) + ' ' + (cy + r / 2); + d += ' Z'; + d += ' M ' + (cx - r / 2) + ' ' + (cy + r / 2); + d += ' L ' + (cx + r / 2) + ' ' + (cy - r / 2); + d += ' Z'; + + return d; + }; + + function ovalPath(cx, cy, r) { + var d = 'M ' + cx + ' ' + cy; + d += ' m -' + r / 2 + ', 0'; + d += ' a ' + r / 2 + ',' + r + ' 0 1,0 ' + r + ',0'; + d += ' a ' + r / 2 + ',' + r + ' 0 1,0 -' + r + ',0'; + + return d; + }; + + function trianglePath(cx, cy, r) { + var d = 'M ' + (cx - r / 2) + ' ' + cy; + d += ' L' + cx + ' ' + (cy - Math.sqrt(3 * r * r / 4)); + d += ' L' + (cx + r / 2) + ' ' + cy; + d += ' Z'; + + return d; + }; + + function squarePath(cx, cy, r) { + var d = 'M ' + (cx - r / 2) + ' ' + (cy - r / 2); + d += ' v' + r; + d += ' h' + r; + d += ' v' + (-r); + d += ' Z'; + + return d; + }; + + function northOrientation(cx, cy, r) { + var d = 'M ' + (cx + r / 2) + ' ' + (cy + r / 2); + d += ' h' + (-r); + d += ' Z'; + d += 'M ' + cx + ' ' + (cy + r / 2); + d += ' v' + (-r); + d += ' Z'; + + return d; + }; + + function squareDiagPath(cx, cy, r) { + var d = 'M ' + (cx - r / 2) + ' ' + (cy - r / 2); + d += ' v' + r; + d += ' h' + r; + d += ' v' + (-r); + d += ' Z'; + d += ' M ' + (cx - r / 2) + ' ' + (cy - r / 2); + d += ' L ' + (cx + r / 2) + ' ' + (cy + r / 2); + d += ' Z'; + + return d; + }; + + function squareCrossPath(cx, cy, r) { + var d = 'M ' + (cx - r / 2) + ' ' + (cy - r / 2); + d += ' v' + r; + d += ' h' + r; + d += ' v' + (-r); + d += ' Z'; + d += ' M ' + (cx - r / 2) + ' ' + (cy - r / 2); + d += ' L ' + (cx + r / 2) + ' ' + (cy + r / 2); + d += ' Z'; + d += ' M ' + (cx - r / 2) + ' ' + (cy + r / 2); + d += ' L ' + (cx + r / 2) + ' ' + (cy - r / 2); + d += ' Z'; + + return d; + }; + + function crossPath(cx, cy, r) { + var d = 'M ' + (cx - r / 2) + ' ' + cy; + d += ' h' + r; + d += ' Z'; + d += 'M ' + cx + ' ' + (cy - r / 2); + d += ' v' + r; + d += ' Z'; + + return d; + }; + + function horizontalRectPath(cx, cy, r) { + var d = 'M ' + (cx - r / 2) + ' ' + cy; + d += ' h' + r; + d += ' Z'; + + return d; + }; + + function horizontalArrowPath(cx, cy, r) { + var d = 'M ' + cx + ' ' + cy; + d += ' L' + (cx - 3 * r / 10) + ' ' + (cy - 3 * r / 10); + d += ' L' + (cx - 3 * r / 10) + ' ' + (cy - 1 * r / 10); + d += ' L' + (cx - 12 * r / 10) + ' ' + (cy - 1 * r / 10); + d += ' L' + (cx - 12 * r / 10) + ' ' + (cy + 1 * r / 10); + d += ' L' + (cx - 3 * r / 10) + ' ' + (cy + 1 * r / 10); + d += ' L' + (cx - 3 * r / 10) + ' ' + (cy + 3 * r / 10); + d += ' Z'; + + return d; + }; + + function horizontalSmallArrowPath(cx, cy, r) { + var d = 'M ' + cx + ' ' + cy; + d += ' L' + (cx - 5 * r / 10) + ' ' + (cy - 4 * r / 10); + d += ' L' + (cx - 5 * r / 10) + ' ' + (cy - 1 * r / 10); + d += ' L' + (cx - 12 * r / 10) + ' ' + (cy - 1 * r / 10); + d += ' L' + (cx - 12 * r / 10) + ' ' + (cy + 1 * r / 10); + d += ' L' + (cx - 5 * r / 10) + ' ' + (cy + 1 * r / 10); + d += ' L' + (cx - 5 * r / 10) + ' ' + (cy + 4 * r / 10); + d += ' Z'; + + return d; + }; + } + + angular.module(moduleApp).service('SVGService', SVGService); + + SVGService.$inject= []; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.InteractionService + * + * @description + * Service providing methods to CRUD interactions + */ +(function() { + 'use strict'; + + function InteractionService(UtilService) { + + this.isFeatureInteractive = isFeatureInteractive; + this.addInteraction = addInteraction; + this.setInteraction = setInteraction; + this.removeInteraction = removeInteraction; + this.addFilter = addFilter; + this.removeFilter = removeFilter; + this.getXMLExport = getXMLExport; + + this.getInteractions = function() { + return interactions + } + this.getFilters = function() { + return filters + } + + var + /** + * @ngdoc property + * @name interactions + * @propertyOf accessimapEditeurDerApp.InteractionService + * + * @description + * Array of interactions + * + * An interaction is a feature (point, circle, polygon, ...) that + * will be attached to a pointer/touch event (click, double click, ...) + * and play a specific media (sound, vibration, ...) + * + * @type {Array} + */ + interactions = [], + + /** + * @ngdoc property + * @name filters + * @propertyOf accessimapEditeurDerApp.InteractionService + * + * @description + * Array of filters + * + * A filter define a specific type of interaction. + * It's composed by : + * - a name, useful for display + * - a type of interaction : tap, double tap, ... + * - a protocol : mp3, text-to-speech (tts), ... + * + * @type {Array} + */ + filters = [{ + id : 'f1', + name : 'Défaut', + gesture : 'tap', + protocol : 'tts' + }]; + + /** + * @ngdoc method + * @name isFeatureInteractive + * @methodOf accessimapEditeurDerApp.InteractionService + * + * @description + * Return if the feature is an interactive one + * + * @param {Object} feature + * Feature to be checked + * + * @return {Boolean} + * True if interactive, false if not + */ + function isFeatureInteractive(feature) { + var featureIid = feature.attr('data-link'), + featurePosition = + interactions.filter(function(row) { + return row.id === 'poi-' + featureIid; + }); + + + return interactions.indexOf(featurePosition[0]) >= 0; + } + + function removeInteraction(feature) { + + var featureIid = feature.attr('data-link'); + + if (isFeatureInteractive(feature)) { + interactions = interactions.filter(function deleteFeature(current) { + return current.id !== 'poi-' + featureIid; + }) + } + + } + + /** + * @ngdoc method + * @name addInteraction + * @methodOf accessimapEditeurDerApp.InteractionService + * + * @description + * Add an interaction on a feature + * + * @param {Object} feature + * Feature that will be interactive + */ + function addInteraction(feature) { + + var featureIid = feature.attr('data-link'); + + if (!featureIid) { + featureIid = UtilService.getiid(); + feature.attr('data-link', featureIid); + } + + // Add the highlight class to the relevant cells of the grid + // TODO: this method DO NOT change CSS properties... + // d3.selectAll('.poi-' + featureIid).classed('highlight', true); + + setInteraction('poi-' + featureIid, 'f1', feature.attr('name')); + + } + + /** + * @ngdoc method + * @name setInteraction + * @methodOf accessimapEditeurDerApp.InteractionService + * + * @description + * Set an interaction {filter: value} for a feature (id) + * + * @param {String} id + * Id of the feature + * + * @param {String} filter + * Category/filter to [description] + * @param {[type]} value [description] + */ + function setInteraction(id, filter, value) { + + var interaction = interactions.find(function(element) { + return element.id === id; + }); + + if (! interaction) { + interactions.push( + { + 'id': id, + 'filters': { + } + }); + interaction = interactions[interactions.length - 1] + } + + interaction.filters[filter] = value; + } + + function addFilter(name, gesture, protocol, id) { + filters.push({ + id : id ? id : 'f' + generateUUID(), + name : name, + gesture : gesture, + protocol : protocol + }); + } + + function removeFilter(id) { + // first, delete for each interaction the corresponding filter + interactions.forEach(function deleteCategory(current) { + delete current.filters[id] + }) + + // then remove the filter + filters = filters.filter(function removeFilter(element, index) { + return element.id !== id; + }) + } + + function getXMLExport() { + + var xmlToExport = '\n'; + + if (filters.length > 0) { + + var nodeXML = d3.select(document.createElement('exportXML')), + config = nodeXML.append('config'); + + config.append('filters') + .selectAll('filter') + .data(filters) + .enter() + .append('filter') + .attr('id', function(d) { + return d.id; + }) + .attr('name', function(d) { + return d.name; + }) + .attr('gesture', function(d) { + return d.gesture; + }) + .attr('protocol', function(d) { + return d.protocol; + }) + .attr('expandable', function(d) { + // return d.expandable; + return false; // TODO: qu'est ce qu'expandable ? + }); + + config.append('pois') + .selectAll('poi') + .data(interactions) + .enter() + .append('poi') + .attr('id', function(d) { + return d.id; + }) + .each(function(d) { + + // get the bounding box of the current POI, + // no matter if it is a drawing or a geojson feature + // > no selection of a specific svg, we search in the entire DOM + var bbox, poi; + d3.selectAll('path')[0] + .forEach(function(shape) { + if ('poi-' + d3.select(shape).attr('data-link') === d.id) { + bbox = d3.select(shape).node().getBBox(); + } + }); + + poi = d3.select(this).attr('id', d.id); + + if (bbox) { + poi.attr('x', bbox.x); + poi.attr('y', bbox.y); + poi.attr('width', bbox.width); + poi.attr('height', bbox.height); + } + + // exporting actions for the current POI + var actions = poi.append('actions'); + d3.keys(d.filters).forEach(function(key) { + var currentCategory = filters.find(function(element) { + return element.id === key; + }) + actions.append('action') + .attr('gesture', currentCategory.gesture) + .attr('filter', key) + .attr('value', d.filters[key]) + .attr('protocol', currentCategory.protocol); + }); + }); + + xmlToExport += (new XMLSerializer()).serializeToString(config.node()); + + } + + return xmlToExport; + } + + function generateUUID() { + var d = new Date().getTime(); + + if(window.performance && typeof window.performance.now === "function") { + d += performance.now(); //use high-precision timer if available + } + + var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = (d + Math.random()*16)%16 | 0; + d = Math.floor(d/16); + + return (c=='x' ? r : (r&0x3|0x8)).toString(16); + }); + + return uuid; + } + } + + angular.module(moduleApp).service('InteractionService', InteractionService); + + InteractionService.$inject = ['UtilService']; + +})(); + +// jscs: disable maximumNumberOfLines +/** + * @ngdoc service + * @name accessimapEditeurDerApp.FeatureService + * + * @description + * Service providing actions to manage features + * TODO: rename this service ? It's not clear about what it's doing + */ +(function() { + 'use strict'; + + function FeatureService(InteractionService, + EmptyComfortService, + UtilService, + GeometryUtilsService, + GeneratorService, + SelectPathService) { + + this.duplicatePath = duplicatePath; + this.movePath = movePath; + this.movePoint = movePoint; + this.rotatePath = rotatePath; + this.skew = skew; + + this.removeObject = removeObject; + + this.undo = undo; + this.isUndoAvailable = isUndoAvailable; + + this.toggleStroke = toggleStroke; + this.toggleArrow = toggleArrow; + this.toggleEmptyComfortNearFeature = toggleEmptyComfortNearFeature; + + this.changeColor = changeColor; + this.changePattern = changePattern; + this.changePoint = changePoint; + + this.lineToCardinal = lineToCardinal; + + this.init = init; + + // this var retain the last feature deleted + // useful for cancel this deletion + // TODO: need to be improved to integrate the history pattern (undo/redo) + // Surely need a specific service for that + var removedFeature = null, + pointsLayer, + polygonsLayer, + linesLayer, + textLayer, + layer, + projection, + handlers; + + function init(_layer, _projection, _handlers) { + layer = _layer; + projection = _projection; + handlers = _handlers; + + pointsLayer = layer.select('g[data-name="points-layer"]'); + polygonsLayer = layer.select('g[data-name="polygons-layer"]'); + linesLayer = layer.select('g[data-name="lines-layer"]'); + textLayer = layer.select('g[data-name="texts-layer"]'); + } + + function isUndoAvailable() { + return removedFeature !== null; + } + + function undo() { + if (isUndoAvailable()) { + + var deletedElement = d3.select('#deletedElement').node(), + t = document.createElement('path'); + + d3.select(t).attr('id', 'restoredElement'); + deletedElement.parentNode.insertBefore(t, deletedElement); + d3.select('#restoredElement').node().outerHTML = removedFeature; + d3.select('#deletedElement').remove(); + removedFeature = null; + } + } + + function removeFeature(feature) { + var featuresToUpdate = feature; + + if (feature.attr('data-link')) { + featuresToUpdate = d3.selectAll('.link_' + feature.attr('data-link')); + } + var el = featuresToUpdate.node(), + t = document.createElement('foreignObject'); + + removedFeature = new XMLSerializer().serializeToString(el), + + d3.select(t).attr('id', 'deletedElement'); + el.parentNode.insertBefore(t, el); + featuresToUpdate.remove(); + + } + + function removeObject(feature) { + + // Some objects should not be deletable + if (!d3.select(feature).node().classed('notDeletable')) { + + // Remove previous deleted Element placeholder if it exists + d3.select('#deletedElement').remove(); + + if (InteractionService.isFeatureInteractive(feature)) { + + if (window.confirm('Ce point est interactif. Voules-vous vraiment le supprimer ?')) { + InteractionService.removeInteraction(feature); + + return removeFeature(feature); + } else { + return false; + } + + } else { + return removeFeature(feature); + } + + } + } + + function movePath(feature) { + + var el = feature.node(), + parentNode = el.parentNode, + temporaryPath = el.cloneNode(true), + + emptyCircle = d3.select('.c' + feature.attr('data-link')), + emptyCircleExists = emptyCircle.node(), + temporaryCircle = emptyCircleExists ? emptyCircleExists.cloneNode(true) : null, + + transform = d3.transform(layer.attr('transform')), + hasRotate = /rotate\((.*?)(?: |,)(.*?)(?: |,)(.*?)\)/.exec(feature.attr('transform')), + bbox = el.getBBox(); + + transform.translate = [0,0]; + + d3.select(temporaryCircle).attr('opacity', 0.5).attr('transform', transform); + d3.select(temporaryPath).attr('opacity', 0.5).attr('transform', transform); + + if (temporaryCircle) parentNode.appendChild(temporaryCircle); + parentNode.appendChild(temporaryPath); + + handlers.removeEventListener(['click', 'mousemove']); + + handlers.addClickListener(function(e) { + + if (d3.select(temporaryPath).classed('moved')) { + + var p = projection.latLngToLayerPoint(e.latlng), + realCoordinates = GeometryUtilsService.realCoordinates(transform, [p.x, p.y], bbox), + transformString = ''; + + if (hasRotate) { + transformString += 'rotate(' + [hasRotate[1], + (parseFloat(hasRotate[2]) + realCoordinates[0]), + (parseFloat(hasRotate[3]) + realCoordinates[1])] + ')'; + } + transformString += 'translate(' + [realCoordinates[0], realCoordinates[1]] + ')'; + + feature.attr('transform', transformString); + + if (emptyCircleExists) emptyCircle.attr('transform', transformString); + + d3.select(temporaryPath).remove(); + d3.select(temporaryCircle).remove(); + + handlers.removeEventListener(['click', 'mousemove']); + + } + }) + + handlers.addMouseMoveListener(function(e) { + + var p = projection.latLngToLayerPoint(e.latlng), + realCoordinates = GeometryUtilsService.realCoordinates(transform, [p.x, p.y], bbox), + transformString = ''; + + if (hasRotate) { + transformString += 'rotate(' + [hasRotate[1], + (parseFloat(hasRotate[2]) + realCoordinates[0]), + (parseFloat(hasRotate[3]) + realCoordinates[1])] + ')'; + } + transformString += 'translate(' + [realCoordinates[0], realCoordinates[1]] + ')'; + + d3.select(temporaryPath) + .classed('moved', true) + .attr('transform', transformString); + + d3.select(temporaryCircle) + .classed('moved', true) + .attr('transform', transformString); + + }) + + } + + function duplicatePath(feature, addRadialMenuFunction) { + + var el = feature.node(), + parentNode = el.parentNode, + temporaryPath = el.cloneNode(true), + + emptyCircle = d3.select('.c' + feature.attr('data-link')), + emptyCircleExists = emptyCircle.node(), + temporaryCircle = emptyCircleExists ? emptyCircleExists.cloneNode(true) : null, + + transform = d3.transform(layer.attr('transform')), + hasRotate = /rotate\((.*?)(?: |,)(.*?)(?: |,)(.*?)\)/.exec(feature.attr('transform')), + bbox = el.getBBox(), + iid = UtilService.getiid(); + + transform.translate = [0,0]; + + d3.select(temporaryCircle) + .attr('opacity', 0.5) + .attr('transform', transform) + .classed('c' + feature.attr('data-link'), false) + .classed('link_' + feature.attr('data-link'), false) + .classed('c' + iid, true) + .classed('link_' + iid, true); + + d3.select(temporaryPath) + .attr('opacity', 0.5) + .attr('transform', transform) + .classed('link_' + feature.attr('data-link'), false) + .classed('link_' + iid, true) + .attr('data-link', iid); + + if (temporaryCircle) parentNode.appendChild(temporaryCircle) + parentNode.appendChild(temporaryPath) + + handlers.removeEventListener(['click', 'mousemove']); + + handlers.addClickListener(function(e) { + + if (d3.select(temporaryPath).classed('moved')) { + + var p = projection.latLngToLayerPoint(e.latlng), + realCoordinates = GeometryUtilsService.realCoordinates(transform, [p.x, p.y], bbox), + transformString = ''; + + if (hasRotate) { + transformString += 'rotate(' + [hasRotate[1], + (parseFloat(hasRotate[2]) + realCoordinates[0]), + (parseFloat(hasRotate[3]) + realCoordinates[1])] + ')'; + } + transformString += 'translate(' + [realCoordinates[0], realCoordinates[1]] + ')'; + + d3.select(temporaryPath) + .classed('moved', false) + .attr('opacity', '') + .attr('transform', transformString); + + d3.select(temporaryCircle) + .classed('moved', false) + .attr('opacity', '') + .attr('transform', transformString); + + addRadialMenuFunction(d3.select(temporaryPath), layer); + SelectPathService.addTo(d3.select(temporaryPath)); + + handlers.removeEventListener(['click', 'mousemove']); + + } + }) + + handlers.addMouseMoveListener(function(e) { + + var p = projection.latLngToLayerPoint(e.latlng), + realCoordinates = GeometryUtilsService.realCoordinates(transform, [p.x, p.y], bbox), + transformString = ''; + + if (hasRotate) { + transformString += 'rotate(' + [hasRotate[1], + (parseFloat(hasRotate[2]) + realCoordinates[0]), + (parseFloat(hasRotate[3]) + realCoordinates[1])] + ')'; + } + transformString += 'translate(' + [realCoordinates[0], realCoordinates[1]] + ')'; + + d3.select(temporaryPath) + .classed('moved', true) + .attr('transform', transformString); + + d3.select(temporaryCircle) + .classed('moved', true) + .attr('transform', transformString); + + }) + + } + + function movePoint(feature) { + var el = feature.node(), + pathData = el.getPathData(), + featuresToUpdate = feature; + + if (feature.attr('data-link')) { + featuresToUpdate = d3.selectAll('.link_' + feature.attr('data-link')); + } + + // draw temporary node at all path breaks + var features = [], + drag = d3.behavior.drag(); + + angular.forEach(pathData, function(point, index) { + var pointValues = point.values; + + if (pointValues && pointValues.length === 2) { + var px = pointValues[0], + py = pointValues[1]; + features.push([px, py, index]); + pointsLayer + .append('circle') + .classed('ongoing', true) + .attr('id', 'n' + index) + .attr('cx', px) + .attr('cy', py) + .attr('r', 10) + .attr('fill', 'red') + .call(drag); + } + }); + + var nearest = null; + + drag.on('dragstart', function(e) { + // silence other listeners + d3.event.sourceEvent.stopPropagation(); + nearest = GeometryUtilsService.nearest(d3.mouse(this), features); + }); + + drag.on('drag', function() { + d3.event.sourceEvent.stopPropagation(); + var mousePosition = d3.mouse(this); + d3.select(this).attr('cx', mousePosition[0]) + .attr('cy', mousePosition[1]); + + var vertexNumber = parseInt(d3.select(this).attr('id').replace('n', '')); + + featuresToUpdate.each(function(d, i) { + var pathDataToUpdate = this.getPathData(); + pathDataToUpdate[vertexNumber].values[0] = mousePosition[0]; + pathDataToUpdate[vertexNumber].values[1] = mousePosition[1]; + this.setPathData(pathDataToUpdate); + }); + }); + } + + /** + * @ngdoc method + * @name skew + * @methodOf accessimapEditeurDerApp.FeatureService + * + * @description + * Enter into the skew mode for the feature selected. + * + * When user click and move his mouse, + * we detect the axis by analyzing first direction of the move, + * then apply a skew linked by the distance from initial click and actual position of the mouse + * + * When user 'mouseup', we act the skew transformation is finished. + * + * @param {Object} feature + * Feature on which the skew will operate + * + */ + function skew(feature) { + + var el = feature.node(), + parentNode = el.parentNode, + temporaryPath = el.cloneNode(true), + + emptyCircle = d3.select('.c' + feature.attr('data-link')), + emptyCircleExists = emptyCircle.node(), + temporaryCircle = emptyCircleExists ? emptyCircleExists.cloneNode(true) : null, + + transform = d3.transform(layer.attr('transform')), + // hasRotate = /rotate\((.*?)(?: |,)(.*?)(?: |,)(.*?)\)/.exec(feature.attr('transform')), + bbox = el.getBBox(), + axis = null, + originalPoint = { x: null, y: null }, + originalMove = { x: 0, y: 0 }, + initialTransform = feature.attr('transform') !== null ? feature.attr('transform') : ''; + + transform.translate = [0,0]; + + d3.select(temporaryCircle).attr('opacity', 0.5).attr('transform', transform); + d3.select(temporaryPath).attr('opacity', 0.5).attr('transform', transform); + + if (temporaryCircle) parentNode.appendChild(temporaryCircle); + parentNode.appendChild(temporaryPath); + + handlers.removeEventListener(['click', 'mousemove']); + + handlers.addClickListener(function(e) { + + if (d3.select(temporaryPath).classed('moved')) { + + var transformString = d3.select(temporaryPath).attr('transform') + feature.attr('transform', transformString); + + if (emptyCircleExists) emptyCircle.attr('transform', transformString); + + d3.select(temporaryPath).remove(); + d3.select(temporaryCircle).remove(); + + handlers.removeEventListener(['click', 'mousemove']); + + } + }) + + handlers.addMouseMoveListener(function(e) { + + var p = projection.latLngToLayerPoint(e.latlng), + // realCoordinates = GeometryUtilsService.realCoordinates(transform, [p.x, p.y], bbox), + transformString = initialTransform, + shiftKeyPressed = e.originalEvent.shiftKey, + transform = d3.svg.transform(); + + originalPoint.x = originalPoint.x === null ? p.x : originalPoint.x; + originalPoint.y = originalPoint.y === null ? p.y : originalPoint.y; + + originalMove.x = Math.abs(originalPoint.x - p.x) + originalMove.y = Math.abs(originalPoint.y - p.y) + + + // if (hasRotate) { + // transformString += 'rotate(' + [hasRotate[1], + // (parseFloat(hasRotate[2]) + realCoordinates[0]), + // (parseFloat(hasRotate[3]) + realCoordinates[1])] + ')'; + // } + + if (! shiftKeyPressed) { + transform.skewX(( p.x - originalPoint.x ) / 5) + .skewY(( p.y - originalPoint.y ) / 5) + } else { + + if ( originalMove.x > 5 || originalMove.y > 5 ) { + axis = ( originalMove.x < originalMove.y ) ? 'Y' : 'X'; + } + + switch(axis) { + case 'X': + transform.skewX(( p.x - originalPoint.x ) / 5) + break; + + case 'Y': + transform.skewY(( p.y - originalPoint.y ) / 5) + break; + } + } + + d3.select(temporaryPath) + .classed('moved', true) + .attr('transform', initialTransform + transform()); + + d3.select(temporaryCircle) + .classed('moved', true) + .attr('transform', initialTransform + transform()); + + }) + + } + + function rotatePath(feature) { + var el = feature.node(), + bbox = el.getBBox(), + pathCenter = [ bbox.x + bbox.width / 2, bbox.y + bbox.height / 2 ], + pathCenterTranslate = [], + emptyCircle = d3.select('.c' + feature.attr('data-link')), + emptyCircleExists = emptyCircle.node(); + pathCenterTranslate[0] = pathCenter[0]; + pathCenterTranslate[1] = pathCenter[1]; + + if (feature.attr('transform')) { + var pathHasTranslate = /translate\((.*?)(?: |,)(.*?)\)/.exec(feature.attr('transform')); + + if (pathHasTranslate) { + pathCenterTranslate[0] = pathCenter[0] + parseFloat(pathHasTranslate[1]); + pathCenterTranslate[1] = pathCenter[1] + parseFloat(pathHasTranslate[2]); + } + } + + var drag = d3.behavior.drag(), + + rotationMarker = pointsLayer + .append('g') + .classed('ongoing', true) + .attr('transform', 'translate(' + + pathCenterTranslate[0] + + ',' + + (pathCenterTranslate[1] + bbox.height ) + + ')') + .attr('pathCenter', pathCenter) + .attr('pathCenterTranslate', pathCenterTranslate) + .call(drag); + + rotationMarker.append('circle') + .attr('cx', 0) + .attr('cy', 0) + .attr('r', 10) + .attr('fill', 'red') + .attr('stroke', 'none'); + + rotationMarker.append('svg:image') + .attr('xlink:href', 'assets/icons/autorenew.svg') + .attr('width', 20) + .attr('height', 20) + .attr('x', -10) + .attr('y', -10); + + var initialAngle = 0; + + drag.on('dragstart', function() { + // silence other listeners + d3.event.sourceEvent.stopPropagation(); + var mouse = d3.mouse(pointsLayer.node()); + initialAngle = GeometryUtilsService.angle(pathCenterTranslate[0], + pathCenterTranslate[1], + mouse[0], + mouse[1]); + }).on('drag', function() { + var mouse = d3.mouse(pointsLayer.node()), + currentAngle = GeometryUtilsService.angle(pathCenterTranslate[0], + pathCenterTranslate[1], + mouse[0], + mouse[1]), + diffAngle = currentAngle - initialAngle, + + transformString = '', + hasTranslate = /translate\((.*?)\)/.exec(feature.attr('transform')); + + if (hasTranslate) { + transformString += hasTranslate[0]; + } + + transformString += 'rotate(' + + diffAngle + + ' ' + + pathCenter[0] + + ' ' + + pathCenter[1] + + ')'; + + feature.attr('transform', transformString); + + if (emptyCircleExists) { + emptyCircle.attr('transform', transformString); + } + + rotationMarker.attr('transform', 'translate(' + + mouse[0] + + ',' + + mouse[1] + + ')'); + }).on('dragend', function() { + pointsLayer.on('mousedown.drag', null); + $('#der').css('cursor', 'auto'); + }); + } + + /** + * @ngdoc method + * @name toggleStroke + * @methodOf accessimapEditeurDerApp.FeatureService + * @description + * Add or remove (toggle) the stroke (2px border) on a feature. + * + * @param {Object} feature + * Feature (shape) on which will be added the 'white area' + */ + function toggleStroke(feature) { + if (feature.attr('stroke')) { + feature.attr('stroke', null) + .attr('stroke-width', null); + } else { + feature.attr('stroke', 'black') + .attr('stroke-width', '2'); + } + } + + function toggleArrow(feature) { + $('#changeArrowsModal').modal('show'); + feature.classed('styleEdition', true); + } + + /** + * @ngdoc method + * @name toggleEmptyComfortNearFeature + * @methodOf accessimapEditeurDerApp.FeatureService + * + * @description + * Add an empty (white) area around the feature shape. + * + * @param {Object} feature + * Feature (shape) on which will be added the 'white area' + */ + function toggleEmptyComfortNearFeature(feature) { + + var emptyCircleExists = d3.select('.c' + feature.attr('data-link')).node(); + + if (emptyCircleExists) { + emptyCircleExists.remove(); + } else { + var emptyArea = EmptyComfortService.calcEmptyComfort(feature); + + feature.node().parentNode.insertBefore(emptyArea, feature.node()); + } + } + + function changeColor(feature) { + // TODO: init correctly value of modal dialog + /* + scope.styleChoices = scope.styles.polygon; + var style = $.grep(scope.styleChoices, function(style) { + return style.id == feature.attr('e-style'); + }), + color = $.grep(scope.colors, function(color) { + return color.color == feature.attr('e-color'); + }); + scope.styleChosen = style[0]; + scope.colorChosen = color[0]; + */ + $('#changeColorModal').modal('show'); + + feature.classed('styleEdition', true); + $('#changeColorModal').on('hidden.bs.modal', function () { + d3.select('.styleEdition').classed('styleEdition', false) + }); + } + + function changePattern(feature) { + // TODO: init correctly value of modal dialog + /* + scope.styleChoices = scope.styles.polygon; + var style = $.grep(scope.styleChoices, function(style) { + return style.id == feature.attr('e-style'); + }), + color = $.grep(scope.colors, function(color) { + return color.color == feature.attr('e-color'); + }); + scope.styleChosen = style[0]; + scope.colorChosen = color[0]; + */ + $('#changePatternModal').modal('show'); + feature.classed('styleEdition', true); + } + + function changePoint(feature) { + $('#changePointModal').modal('show'); + feature.classed('styleEdition', true); + } + + /** + * @ngdoc method + * @name lineToCardinal + * @methodOf accessimapEditeurDerApp.FeatureService + * + * @description + * Transform a line into a bezier curve ? + * + * @param {Object} feature + * Path to 'simplify' + * + */ + function lineToCardinal(feature) { + var arr = feature.attr('d').split('L'), + featuresToUpdate = feature; + + if (feature.attr('data-link')) { + featuresToUpdate = + d3.selectAll('.link_' + feature.attr('data-link')); + } + var coords = undefined; + + if (arr.length > 1) { // line's type is linear + coords = arr.map(function(c) { + c = c.replace(/M(\s?)+/, ''); + c = c.replace('Z', ''); + c = c.replace(/(\s?)+/, ''); //remove first space + c = c.replace(/\s+$/, ''); //remove last space + var coordsArray = c.split(','); + + if (coordsArray.length < 2) { + coordsArray = c.split(' '); + } + + return coordsArray.map(function(ca) { + return parseFloat(ca); + }); + }); + featuresToUpdate.attr('d', GeneratorService.cardinalLineFunction(coords)); + } + + else { // line's type is cardinal + arr = feature.attr('d').split(/[CQS]+/); + coords = arr.map(function(c) { + c = c.replace(/M(\s?)+/, ''); + c = c.replace('Z', ''); + c = c.replace(/(\s?)+/, ''); //remove first space + c = c.replace(/\s+$/, ''); //remove last space + var coordsArray = c.split(','); + + if (coordsArray.length < 2) { + coordsArray = c.split(' '); + } + + if (coordsArray.length > 2) { + var l = coordsArray.length; + coordsArray = [coordsArray[l - 2], coordsArray[l - 1]]; + } + + return coordsArray.map(function(ca) { + return parseFloat(ca); + }); + }); + featuresToUpdate.attr('d', GeneratorService.lineFunction(coords)); + } + } + + } + + angular.module(moduleApp).service('FeatureService', FeatureService); + + FeatureService.$inject = ['InteractionService', 'EmptyComfortService', 'UtilService', + 'GeometryUtilsService', 'GeneratorService', 'SelectPathService'] + +})(); + +/*global textures */ +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SettingsService + * @requires accessimapEditeurDerApp.SettingsActions + * @requires accessimapEditeurDerApp.SettingsColors + * @requires accessimapEditeurDerApp.SettingsFonts + * @requires accessimapEditeurDerApp.SettingsFormats + * @requires accessimapEditeurDerApp.SettingsQuery + * @requires accessimapEditeurDerApp.SettingsStyles + * @description + * # SettingsService + * Factory in the accessimapEditeurDerApp. + */ +(function() { + 'use strict'; + + function SettingsService (SettingsColors, SettingsFonts, SettingsFormats, + SettingsQuery, SettingsStyles) { + + var leafletConf = { + GLOBAL_MAP_CENTER1: [1.441019, 43.604268], // [lon, lat] + GLOBAL_MAP_CENTER: [43.604268, 1.441019], // [lon, lat] + GLOBAL_MAP_DEFAULT_ZOOM: 13, + }, + + /** + * @ngdoc property + * @name ratioPixelPoint + * @propertyOf accessimapEditeurDerApp.SettingsService + * @type {Number} + * @description Ratio between a pixel and a millimeter + */ + ratioPixelPoint = 0.283, + + margin = 40, + + mapCategories = [{ + id: 'world', + name: 'Monde', + images: [{ + path: 'assets/data/BlankMap-World6-Equirectangular.svg' + }] + }, { + id: 'france', + name: 'France', + images: [{ + path: 'assets/data/France_all_regions_A4.svg' + }] + }], + + markerStart = [{ + id: 'null', + name: 'Aucun' + }, { + id: 'arrowStartMarker', + name: 'Flèche' + }, { + id: 'straightMarker', + name: 'Trait' + }], + + markerStop = [{ + id: 'null', + name: 'Aucun' + }, { + id: 'arrowStopMarker', + name: 'Flèche' + }, { + id: 'straightMarker', + name: 'Trait' + }], + + XAPI_URL = 'http://overpass-api.de/api/interpreter?data=', + // XAPI_URL = 'http://api.openstreetmap.fr/oapi/interpreter/?data=', + NOMINATIM_URL = 'http://nominatim.openstreetmap.org/search/'; + + // Public API here + return { + XAPI_URL : XAPI_URL, + NOMINATIM_URL : NOMINATIM_URL, + + FONTS : SettingsFonts.FONTS, + + COLORS : SettingsColors.COLORS, + ALL_COLORS : SettingsColors.ALL_COLORS, + + FORMATS : SettingsFormats.FORMATS, + DEFAULT_DRAWING_FORMAT : SettingsFormats.DEFAULT_DRAWING_FORMAT, + DEFAULT_LEGEND_FORMAT : SettingsFormats.DEFAULT_LEGEND_FORMAT, + + QUERY_LIST : SettingsQuery.QUERY_LIST, + QUERY_DEFAULT : SettingsQuery.QUERY_DEFAULT, + QUERY_POI : SettingsQuery.QUERY_POI, + + POLYGON_STYLES : SettingsStyles.POLYGON_STYLES, + STYLES : SettingsStyles.STYLES, + ALL_STYLES : SettingsStyles.ALL_STYLES, + + // ACTIONS : SettingsActions.ACTIONS, + + markerStart : markerStart, + markerStop : markerStop, + leaflet : leafletConf, + ratioPixelPoint : ratioPixelPoint, + margin : margin, + mapCategories : mapCategories + }; + } + + angular.module(moduleApp).factory('SettingsService', SettingsService); + + SettingsService.$inject = [ + 'SettingsColors', + 'SettingsFonts', + 'SettingsFormats', + 'SettingsQuery', + 'SettingsStyles']; + +})(); +// jscs:disable maximumNumberOfLines +// jscs:disable maximumLineLength +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SettingsStyles + * @description + */ +(function() { + 'use strict'; + + function SettingsStyles(SVGService) { + + var POLYGON_STYLES = { + 'bighash': textures.lines().id('bighash').orientation('vertical'), + 'bighashm45': textures.lines().id('bighashm45').orientation('6/8'), + 'bighash45': textures.lines().id('bighash45').orientation('2/8'), + 'smallhash': textures.lines().id('smallhash').orientation('vertical').thicker(), + 'smallhashm45': textures.lines().id('smallhashm45').orientation('6/8').thicker(), + 'smallhash45': textures.lines().id('smallhash45').orientation('2/8').thicker(), + 'waves': textures.paths().id('waves').d('waves'), + 'smalldots': textures.circles().id('smalldots').complement(), + 'smalldotsline': textures.circles().id('smalldotsline').lighter().thicker().complement().strokeWidth(1.1).background('white'), + 'smalldotsthicker': textures.circles().id('smalldotsthicker').lighter().thicker().complement().strokeWidth(1.1), + 'smalldotsthicker2': textures.circles().id('smalldotsthicker2').lighter().thicker().complement().strokeWidth(1.3), + 'bigdots': textures.circles().id('bigdots').fill('grey').heavier().complement(), + 'squares45': textures.lines().id('squares45').orientation('2/8', '6/8').size(20).strokeWidth(1), + 'caps': textures.paths().id('caps').d('caps'), + 'woven': textures.paths().id('woven').d('woven'), + 'solid': textures.lines().id('solid').strokeWidth(0), + 'bighash_white': textures.lines().id('bighash_white').orientation('vertical').background('white'), + 'bighashm45_white': textures.lines().id('bighashm45_white').orientation('6/8').background('white'), + 'bighash45_white': textures.lines().id('bighash45_white').orientation('2/8').background('white'), + 'smallhash_white': textures.lines().id('smallhash_white').orientation('vertical').thicker().background('white'), + 'smallhashm45_white': textures.lines().id('smallhashm45_white').orientation('6/8').thicker().background('white'), + 'smallhash45_white': textures.lines().id('smallhash45_white').orientation('2/8').thicker().background('white'), + 'waves_white': textures.paths().id('waves_white').d('waves').background('white'), + 'smalldots_white': textures.circles().id('smalldots_white').complement().background('white'), + 'smalldotsline_white': textures.circles().id('smalldotsline_white').lighter().thicker().complement().strokeWidth(1.1).background('white'), + 'smalldotsthicker_white': textures.circles().id('smalldotsthicker_white').lighter().thicker().complement().strokeWidth(1.1).background('white'), + 'smalldotsthicker2_white': textures.circles().id('smalldotsthicker2_white').lighter().thicker().complement().strokeWidth(1.3).background('white'), + 'bigdots_white': textures.circles().id('bigdots_white').fill('grey').heavier().complement().background('white'), + 'squares45_white': textures.lines().id('squares45_white').orientation('2/8', '6/8').size(20).strokeWidth(1).background('white'), + 'caps_white': textures.paths().id('caps_white').d('caps').background('white'), + 'woven_white': textures.paths().id('woven_white').d('woven').background('white'), + 'solid_white': textures.lines().id('solid_white').strokeWidth(0).background('white'), + 'bighash_blue': textures.lines().id('bighash_blue').orientation('vertical').background('blue'), + 'bighashm45_blue': textures.lines().id('bighashm45_blue').orientation('6/8').background('blue'), + 'bighash45_blue': textures.lines().id('bighash45_blue').orientation('2/8').background('blue'), + 'smallhash_blue': textures.lines().id('smallhash_blue').orientation('vertical').thicker().background('blue'), + 'smallhashm45_blue': textures.lines().id('smallhashm45_blue').orientation('6/8').thicker().background('blue'), + 'smallhash45_blue': textures.lines().id('smallhash45_blue').orientation('2/8').thicker().background('blue'), + 'waves_blue': textures.paths().id('waves_blue').d('waves').background('blue'), + 'smalldots_blue': textures.circles().id('smalldots_blue').complement().background('blue'), + 'smalldotsline_blue': textures.circles().id('smalldotsline_blue').lighter().thicker().complement().strokeWidth(1.1).background('blue'), + 'smalldotsthicker_blue': textures.circles().id('smalldotsthicker_blue').lighter().thicker().complement().strokeWidth(1.1).background('blue'), + 'smalldotsthicker2_blue': textures.circles().id('smalldotsthicker2_blue').lighter().thicker().complement().strokeWidth(1.3).background('blue'), + 'bigdots_blue': textures.circles().id('bigdots_blue').fill('grey').heavier().complement().background('blue'), + 'squares45_blue': textures.lines().id('squares45_blue').orientation('2/8', '6/8').size(20).strokeWidth(1).background('blue'), + 'caps_blue': textures.paths().id('caps_blue').d('caps').background('blue'), + 'woven_blue': textures.paths().id('woven_blue').d('woven').background('blue'), + 'solid_blue': textures.lines().id('solid_blue').strokeWidth(0).background('blue'), + 'bighash_cyan': textures.lines().id('bighash_cyan').orientation('vertical').background('cyan'), + 'bighashm45_cyan': textures.lines().id('bighashm45_cyan').orientation('6/8').background('cyan'), + 'bighash45_cyan': textures.lines().id('bighash45_cyan').orientation('2/8').background('cyan'), + 'smallhash_cyan': textures.lines().id('smallhash_cyan').orientation('vertical').thicker().background('cyan'), + 'smallhashm45_cyan': textures.lines().id('smallhashm45_cyan').orientation('6/8').thicker().background('cyan'), + 'smallhash45_cyan': textures.lines().id('smallhash45_cyan').orientation('2/8').thicker().background('cyan'), + 'waves_cyan': textures.paths().id('waves_cyan').d('waves').background('cyan'), + 'smalldots_cyan': textures.circles().id('smalldots_cyan').complement().background('cyan'), + 'smalldotsline_cyan': textures.circles().id('smalldotsline_cyan').lighter().thicker().complement().strokeWidth(1.1).background('cyan'), + 'smalldotsthicker_cyan': textures.circles().id('smalldotsthicker_cyan').lighter().thicker().complement().strokeWidth(1.1).background('cyan'), + 'smalldotsthicker2_cyan': textures.circles().id('smalldotsthicker2_cyan').lighter().thicker().complement().strokeWidth(1.3).background('cyan'), + 'bigdots_cyan': textures.circles().id('bigdots_cyan').fill('grey').heavier().complement().background('cyan'), + 'squares45_cyan': textures.lines().id('squares45_cyan').orientation('2/8', '6/8').size(20).strokeWidth(1).background('cyan'), + 'caps_cyan': textures.paths().id('caps_cyan').d('caps').background('cyan'), + 'woven_cyan': textures.paths().id('woven_cyan').d('woven').background('cyan'), + 'solid_cyan': textures.lines().id('solid_cyan').strokeWidth(0).background('cyan'), + 'bighash_red': textures.lines().id('bighash_red').orientation('vertical').background('red'), + 'bighashm45_red': textures.lines().id('bighashm45_red').orientation('6/8').background('red'), + 'bighash45_red': textures.lines().id('bighash45_red').orientation('2/8').background('red'), + 'smallhash_red': textures.lines().id('smallhash_red').orientation('vertical').thicker().background('red'), + 'smallhashm45_red': textures.lines().id('smallhashm45_red').orientation('6/8').thicker().background('red'), + 'smallhash45_red': textures.lines().id('smallhash45_red').orientation('2/8').thicker().background('red'), + 'waves_red': textures.paths().id('waves_red').d('waves').background('red'), + 'smalldots_red': textures.circles().id('smalldots_red').complement().background('red'), + 'smalldotsline_red': textures.circles().id('smalldotsline_red').lighter().thicker().complement().strokeWidth(1.1).background('red'), + 'smalldotsthicker_red': textures.circles().id('smalldotsthicker_red').lighter().thicker().complement().strokeWidth(1.1).background('red'), + 'smalldotsthicker2_red': textures.circles().id('smalldotsthicker2_red').lighter().thicker().complement().strokeWidth(1.3).background('red'), + 'bigdots_red': textures.circles().id('bigdots_red').fill('grey').heavier().complement().background('red'), + 'squares45_red': textures.lines().id('squares45_red').orientation('2/8', '6/8').size(20).strokeWidth(1).background('red'), + 'caps_red': textures.paths().id('caps_red').d('caps').background('red'), + 'woven_red': textures.paths().id('woven_red').d('woven').background('red'), + 'solid_red': textures.lines().id('solid_red').strokeWidth(0).background('red'), + 'bighash_yellow': textures.lines().id('bighash_yellow').orientation('vertical').background('yellow'), + 'bighashm45_yellow': textures.lines().id('bighashm45_yellow').orientation('6/8').background('yellow'), + 'bighash45_yellow': textures.lines().id('bighash45_yellow').orientation('2/8').background('yellow'), + 'smallhash_yellow': textures.lines().id('smallhash_yellow').orientation('vertical').thicker().background('yellow'), + 'smallhashm45_yellow': textures.lines().id('smallhashm45_yellow').orientation('6/8').thicker().background('yellow'), + 'smallhash45_yellow': textures.lines().id('smallhash45_yellow').orientation('2/8').thicker().background('yellow'), + 'waves_yellow': textures.paths().id('waves_yellow').d('waves').background('yellow'), + 'smalldots_yellow': textures.circles().id('smalldots_yellow').complement().background('yellow'), + 'smalldotsline_yellow': textures.circles().id('smalldotsline_yellow').lighter().thicker().complement().strokeWidth(1.1).background('yellow'), + 'smalldotsthicker_yellow': textures.circles().id('smalldotsthicker_yellow').lighter().thicker().complement().strokeWidth(1.1).background('yellow'), + 'smalldotsthicker2_yellow': textures.circles().id('smalldotsthicker2_yellow').lighter().thicker().complement().strokeWidth(1.3).background('yellow'), + 'bigdots_yellow': textures.circles().id('bigdots_yellow').fill('grey').heavier().complement().background('yellow'), + 'squares45_yellow': textures.lines().id('squares45_yellow').orientation('2/8', '6/8').size(20).strokeWidth(1).background('yellow'), + 'caps_yellow': textures.paths().id('caps_yellow').d('caps').background('yellow'), + 'woven_yellow': textures.paths().id('woven_yellow').d('woven').background('yellow'), + 'solid_yellow': textures.lines().id('solid_yellow').strokeWidth(0).background('yellow'), + 'bighash_limegreen': textures.lines().id('bighash_limegreen').orientation('vertical').background('limegreen'), + 'bighashm45_limegreen': textures.lines().id('bighashm45_limegreen').orientation('6/8').background('limegreen'), + 'bighash45_limegreen': textures.lines().id('bighash45_limegreen').orientation('2/8').background('limegreen'), + 'smallhash_limegreen': textures.lines().id('smallhash_limegreen').orientation('vertical').thicker().background('limegreen'), + 'smallhashm45_limegreen': textures.lines().id('smallhashm45_limegreen').orientation('6/8').thicker().background('limegreen'), + 'smallhash45_limegreen': textures.lines().id('smallhash45_limegreen').orientation('2/8').thicker().background('limegreen'), + 'waves_limegreen': textures.paths().id('waves_limegreen').d('waves').background('limegreen'), + 'smalldots_limegreen': textures.circles().id('smalldots_limegreen').complement().background('limegreen'), + 'smalldotsline_limegreen': textures.circles().id('smalldotsline_limegreen').lighter().thicker().complement().strokeWidth(1.1).background('limegreen'), + 'smalldotsthicker_limegreen': textures.circles().id('smalldotsthicker_limegreen').lighter().thicker().complement().strokeWidth(1.1).background('limegreen'), + 'smalldotsthicker2_limegreen': textures.circles().id('smalldotsthicker2_limegreen').lighter().thicker().complement().strokeWidth(1.3).background('limegreen'), + 'bigdots_limegreen': textures.circles().id('bigdots_limegreen').fill('grey').heavier().complement().background('limegreen'), + 'squares45_limegreen': textures.lines().id('squares45_limegreen').orientation('2/8', '6/8').size(20).strokeWidth(1).background('limegreen'), + 'caps_limegreen': textures.paths().id('caps_limegreen').d('caps').background('limegreen'), + 'woven_limegreen': textures.paths().id('woven_limegreen').d('woven').background('limegreen'), + 'solid_limegreen': textures.lines().id('solid_limegreen').strokeWidth(0).background('limegreen'), + 'bighash_purple': textures.lines().id('bighash_purple').orientation('vertical').background('purple'), + 'bighashm45_purple': textures.lines().id('bighashm45_purple').orientation('6/8').background('purple'), + 'bighash45_purple': textures.lines().id('bighash45_purple').orientation('2/8').background('purple'), + 'smallhash_purple': textures.lines().id('smallhash_purple').orientation('vertical').thicker().background('purple'), + 'smallhashm45_purple': textures.lines().id('smallhashm45_purple').orientation('6/8').thicker().background('purple'), + 'smallhash45_purple': textures.lines().id('smallhash45_purple').orientation('2/8').thicker().background('purple'), + 'waves_purple': textures.paths().id('waves_purple').d('waves').background('purple'), + 'smalldots_purple': textures.circles().id('smalldots_purple').complement().background('purple'), + 'smalldotsline_purple': textures.circles().id('smalldotsline_purple').lighter().thicker().complement().strokeWidth(1.1).background('purple'), + 'smalldotsthicker_purple': textures.circles().id('smalldotsthicker_purple').lighter().thicker().complement().strokeWidth(1.1).background('purple'), + 'smalldotsthicker2_purple': textures.circles().id('smalldotsthicker2_purple').lighter().thicker().complement().strokeWidth(1.3).background('purple'), + 'bigdots_purple': textures.circles().id('bigdots_purple').fill('grey').heavier().complement().background('purple'), + 'squares45_purple': textures.lines().id('squares45_purple').orientation('2/8', '6/8').size(20).strokeWidth(1).background('purple'), + 'caps_purple': textures.paths().id('caps_purple').d('caps').background('purple'), + 'woven_purple': textures.paths().id('woven_purple').d('woven').background('purple'), + 'solid_purple': textures.lines().id('solid_purple').strokeWidth(0).background('purple'), + }, + + STYLES = { + 'line': [{ + id: 'straight_2', + name: 'Trait 2', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'straight_3', + name: 'Trait 3', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '3' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'straight_5', + name: 'Trait 5', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'straight_8', + name: 'Traits parallèles', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '8' + }, { + 'k': 'stroke-linecap', + 'v': 'butt' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke', + 'v': 'white' + }, { + 'k': 'stroke-width', + 'v': '4' + }, { + 'k': 'stroke-linecap', + 'v': 'round' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'straight_12', + name: 'Traits parallèles 2', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '12' + }, { + 'k': 'stroke-linecap', + 'v': 'butt' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke', + 'v': 'white' + }, { + 'k': 'stroke-width', + 'v': '8' + }, { + 'k': 'stroke-linecap', + 'v': 'round' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'straight_20', + name: 'Traits parallèles 3', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '20' + }, { + 'k': 'stroke-linecap', + 'v': 'butt' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke', + 'v': 'white' + }, { + 'k': 'stroke-width', + 'v': '15' + }, { + 'k': 'stroke-linecap', + 'v': 'round' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'straight_20_fill', + name: 'Traits parallèles 3 rempli', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '20' + }, { + 'k': 'stroke-linecap', + 'v': 'round' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke', + 'v': POLYGON_STYLES.smalldotsline.url() + }, { + 'k': 'stroke-width', + 'v': '15' + }, { + 'k': 'stroke-linecap', + 'v': 'round' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'straight_35', + name: 'Traits parallèles 4', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '35' + }, { + 'k': 'stroke-linecap', + 'v': 'butt' + }, { + 'k': 'fill', + 'v': 'none' + }], + styleInner: [{ + 'k': 'stroke', + 'v': 'white' + }, { + 'k': 'stroke-width', + 'v': '30' + }, { + 'k': 'stroke-linecap', + 'v': 'round' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed11_11_5', + name: 'Passage', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '15' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '4, 4' + }], + styleInner: [{ + 'k': 'stroke', + 'v': 'white' + }, { + 'k': 'stroke-width', + 'v': '15' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '4, 4' + }, { + 'k': 'stroke-dashoffset', + 'v': '4' + }] + },{ + id: 'dashed21_5', + name: 'Tirets 21_5', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '10, 5' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed22_3', + name: 'Tirets 22_3', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '3' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '6, 6' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed22_5', + name: 'Tirets 22_5', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '10, 10' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed42_3', + name: 'Tirets 42_3', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '3' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '12, 6' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed42_5', + name: 'Tirets 42_5', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '20, 10' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed42_5', + name: 'Tirets 62_5', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '30, 10' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed4212_3', + name: 'Tirets 4212_3', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '3' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '12, 6, 3, 6' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + },{ + id: 'dashed4212_5', + name: 'Tirets 4212_5', + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + }, { + 'k': 'fill', + 'v': 'none' + }, { + 'k': 'stroke-dasharray', + 'v': '20, 10, 5, 10' + }], + styleInner: [{ + 'k': 'stroke-width', + 'v': '0' + }, { + 'k': 'fill', + 'v': 'none' + }] + }], + 'polygon': [{ + id: 'bighash', + name: 'Hachures', + style: [{ + 'k': 'fill-pattern', + 'v': 'bighash' + }] + },{ + id: 'bighash-45', + name: 'Hachures -45', + style: [{ + 'k': 'fill-pattern', + 'v': 'bighashm45' + }] + },{ + id: 'bighash45', + name: 'Hachures 45', + style: [{ + 'k': 'fill-pattern', + 'v': 'bighash45' + }] + },{ + id: 'smallhash', + name: 'Petites hachures', + style: [{ + 'k': 'fill-pattern', + 'v': 'smallhash' + }] + },{ + id: 'smallhashm45', + name: 'Petites hachures -45', + style: [{ + 'k': 'fill-pattern', + 'v': 'smallhashm45' + }] + },{ + id: 'smallhash45', + name: 'Petites hachures 45', + style: [{ + 'k': 'fill-pattern', + 'v': 'smallhash45' + }] + },{ + id: 'waves', + name: 'Vagues', + style: [{ + 'k': 'fill-pattern', + 'v': 'waves' + }] + },{ + id: 'bigdots', + name: 'Points', + style: [{ + 'k': 'fill-pattern', + 'v': 'bigdots' + }] + },{ + id: 'smalldots', + name: 'Petits points', + style: [{ + 'k': 'fill-pattern', + 'v': 'smalldots' + }] + },{ + id: 'smalldotsthicker', + name: 'Petits points rapprochés', + style: [{ + 'k': 'fill-pattern', + 'v': 'smalldotsthicker' + }] + },{ + id: 'squares45', + name: 'Quadrillage 45', + style: [{ + 'k': 'fill-pattern', + 'v': 'squares45' + }] + },{ + id: 'caps', + name: 'Chevron', + style: [{ + 'k': 'fill-pattern', + 'v': 'caps' + }] + },{ + id: 'woven', + name: 'Trame', + style: [{ + 'k': 'fill-pattern', + 'v': 'woven' + }] + },{ + id: 'solid', + name: 'Fond uni', + style: [{ + 'k': 'fill-pattern', + 'v': 'solid' + }] + }], + 'point': [{ + id: 'smallcircleempty', + name: 'Petit cercle vide', + path: SVGService.circlePath, + radius: 10, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'bigcircleempty', + name: 'Grand cercle vide', + path: SVGService.circlePath, + radius: 18, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'smallcircle', + name: 'Petit cercle plein', + path: SVGService.circlePath, + radius: 10, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'bigcircle', + name: 'Grand cercle plein', + path: SVGService.circlePath, + radius: 18, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'circleCross', + name: 'Cercle croix', + path: SVGService.circleCrossPath, + radius: 18, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'ovalempty', + name: 'Ovale vide', + path: SVGService.ovalPath, + radius: 18, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'oval', + name: 'Ovale plein', + path: SVGService.ovalPath, + radius: 18, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'triangleempty', + name: 'Triangle vide', + path: SVGService.trianglePath, + radius: 22, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'triangle', + name: 'Triangle plein', + path: SVGService.trianglePath, + radius: 22, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'squareempty', + name: 'Carré vide', + path: SVGService.squarePath, + radius: 20, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '3' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'square', + name: 'Carré plein', + path: SVGService.squarePath, + radius: 20, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'squareDiag', + name: 'Carré barré', + path: SVGService.squareDiagPath, + radius: 25, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'squareCross', + name: 'Carré croix', + path: SVGService.squareCrossPath, + radius: 25, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': 'white' + }] + },{ + id: 'cross', + name: 'Croix fine', + path: SVGService.crossPath, + radius: 25, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '3' + },{ + 'k': 'fill', + 'v': 'black' + }] + },{ + id: 'cross2', + name: 'Croix moyenne', + path: SVGService.crossPath, + radius: 25, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + },{ + 'k': 'fill', + 'v': 'black' + }] + },{ + id: 'cross3', + name: 'Croix épaisse', + path: SVGService.crossPath, + radius: 30, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '5' + },{ + 'k': 'fill', + 'v': 'black' + }] + },{ + id: 'horizontalRect', + name: 'Rectangle plein', + path: SVGService.horizontalRectPath, + radius: 20, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '10' + },{ + 'k': 'fill', + 'v': 'black' + }] + },{ + id: 'horizontalArrow', + name: 'Grande flèche pleine', + path: SVGService.horizontalArrowPath, + radius: 100, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '4' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'horizontalArrowMedium', + name: 'Moyenne flèche pleine', + path: SVGService.horizontalArrowPath, + radius: 60, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '4' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'horizontalArrowSmall', + name: 'Petite flèche pleine', + path: SVGService.horizontalSmallArrowPath, + radius: 30, + style: [{ + 'k': 'stroke', + 'v': 'grey' + }, { + 'k': 'stroke-width', + 'v': '4' + },{ + 'k': 'fill', + 'v': 'grey' + }] + },{ + id: 'horizontalArrowHash', + name: 'Grande flèche hachurée', + path: SVGService.horizontalArrowPath, + radius: 100, + style: [{ + 'k': 'stroke-width', + 'v': '0' + },{ + 'k': 'fill', + 'v': POLYGON_STYLES.smallhashm45.url() + }] + },{ + id: 'horizontalArrowDots', + name: 'Grande flèche points', + path: SVGService.horizontalArrowPath, + radius: 100, + style: [{ + 'k': 'stroke', + 'v': '#343434' + }, { + 'k': 'stroke-width', + 'v': '2' + },{ + 'k': 'fill', + 'v': POLYGON_STYLES.smalldotsthicker2.url() + }] + },{ + id: 'northOrientation', + name: 'Flèche du Nord', + path: SVGService.northOrientation, + radius: 30, + style: [{ + 'k': 'stroke', + 'v': 'black' + }, { + 'k': 'stroke-width', + 'v': '4' + },{ + 'k': 'fill', + 'v': 'none' + }] + }]} + + this.POLYGON_STYLES = POLYGON_STYLES; + this.STYLES = STYLES; + this.ALL_STYLES = STYLES.point.concat(STYLES.polygon.concat(STYLES.line)); + + } + + angular.module(moduleApp).service('SettingsStyles', SettingsStyles); + + SettingsStyles.$inject = ['SVGService'] + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SettingsColors + * @description + * # SettingsColors + * Factory in the accessimapEditeurDerApp. + */ +(function() { + 'use strict'; + + function SettingsColors () { + + var COLORS = { + 'black': [{ + name: 'Noir', + color: 'black', + }], + 'transparent': [{ + name: 'Transparent', + color: 'none', + }, { + name: 'Blanc', + color: 'white', + }], + 'other': [{ + name: 'Bleu', + color: 'blue', + }, { + name: 'Cyan', + color: 'cyan', + }, { + name: 'Rouge', + color: 'red', + }, { + name: 'Jaune', + color: 'yellow', + }, { + name: 'Vert', + color: 'limegreen', + }, { + name: 'Violet', + color: 'purple', + } + ]} + + this.COLORS = COLORS; + this.ALL_COLORS = COLORS.black.concat(COLORS.transparent.concat(COLORS.other)); + + } + + angular.module(moduleApp).service('SettingsColors', SettingsColors); + + SettingsColors.$inject = []; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SettingsFonts + * @description + */ +(function() { + 'use strict'; + + function SettingsFonts () { + + var FONTS = [{ + name: 'Braille', + size: '35px', + family: 'Braille_2007', + weight: null, + color: 'black' + }, { + name: 'Arial gras 32', + size: '32px', + family: 'Arial', + weight: 'bold', + color: 'other' + }, { + name: 'Arial gras 28', + size: '28px', + family: 'Arial', + weight: 'bold', + color: 'other' + }, { + name: 'Arial gras 22', + size: '22px', + family: 'Arial', + weight: 'bold', + color: 'other' + }, { + name: 'Arial gras 18', + size: '18px', + family: 'Arial', + weight: 'bold', + color: 'other' + } + ] + + this.FONTS = FONTS; + + } + + angular.module(moduleApp).service('SettingsFonts', SettingsFonts); + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SettingsFormats + * + * @description + * Provide different drawing formats + */ +(function() { + 'use strict'; + + function SettingsFormats () { + + var + /** + * @ngdoc property + * @name accessimapEditeurDerApp.SettingsFormats.FORMATS + * @propertyOf accessimapEditeurDerApp.SettingsFormats + * @description + * Formats availables for editing documents. + */ + FORMATS = { + 'portraitA4': { + name: 'A4 Portrait', + width: 210, + height: 297 + }, + 'landscapeA4': { + name: 'A4 Paysage', + width: 297, + height: 210 + }, + 'portraitA3': { + name: 'A3 Portrait', + width: 297, + height: 420 + }, + 'landscapeA3': { + name: 'A3 Paysage', + width: 420, + height: 297 + }, + 'nexus9': { + name: 'Nexus 9 Paysage', + width: 181, // 7.12" + height: 136 // 5.35" + } + } + + this.FORMATS = FORMATS; + + } + + angular.module(moduleApp).service('SettingsFormats', SettingsFormats); + +})(); +// jscs:disable maximumLineLength +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SettingsQuery + * @description + */ +(function() { + 'use strict'; + + function SettingsQuery () { + + var QUERY_LIST = [{ + id: 'poi', + name: 'Point d\'intérêt', + type: 'point', + query: ['node["amenity"]', 'node["shop"]'], + icon: 'road' + },{ + id: 'trottoirs', + name: 'Trottoirs', + type: 'line', + query: ['way["footway"="sidewalk"]'], + icon: 'road' + }, { + id: 'ppietons', + name: 'Passages piétons', + type: 'line', + query: ['way["footway"="crossing"]'], + icon: 'road' + }, { + id: 'principales', + name: 'Routes principales', + type: 'line', + query: ['way["highway"~"motorway|trunk|primary|secondary"]'], + icon: 'road' + }, { + id: 'places', + name: 'Places', + type: 'polygon', + query: ['way["highway"="pedestrian"]["area"="yes"]'], + icon: 'road' + }, { + id: 'rues', + name: 'Toutes les rues', + type: 'line', + query: ['way["highway"]["highway"!="footway"]["highway"!="cycleway"]["highway"!="path"]["highway"!="steps"]["area"!="yes"]'], + icon: 'road' + }, { + id: 'ruespietonnes', + name: 'Chemins piétons', + type: 'line', + query: ['way["highway"~"footway|cycleway|path|steps"]["area"!="yes"]["footway"!="sidewalk"]["footway"!="crossing"]'], + icon: 'road' + }, { + id: 'trafficSignals', + name: 'Feux tricolores', + type: 'point', + query: ['node["highway"="traffic_signals"]'], + icon: 'street-view' + }, { + id: 'trafficSignals_sound', + name: 'Feux sonores', + type: 'point', + query: ['node["traffic_signals:sound"]'], + icon: 'street-view' + }, { + id: 'batiments', + name: 'Batiments', + type: 'polygon', + query: ['way["building"]["building"!="no"]'], + icon: 'building-o' + }, { + id: 'eau', + name: 'Eau', + type: 'polygon', + query: ['relation["type"="multipolygon"]["natural"="water"]', 'way["waterway"="riverbank"]'], + icon: 'leaf' + }, { + id: 'parc', + name: 'Parc', + type: 'polygon', + query: ['way["leisure"="park"]'], + icon: 'leaf' + }] + + this.QUERY_LIST = QUERY_LIST; + this.QUERY_DEFAULT = QUERY_LIST[4]; + this.QUERY_POI = QUERY_LIST[0]; + + + } + + angular.module(moduleApp).service('SettingsQuery', SettingsQuery); + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SettingsActions + * @description + */ +(function() { + 'use strict'; + + function SettingsActions (FeatureService, InteractionService, LegendService) { + + var ACTIONS = { + 'point': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject}, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/autorenew.svg', action: FeatureService.rotatePath }, + { icon: 'assets/icons/texture.svg', action: FeatureService.changePoint }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + ], + 'line': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject }, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/linear_scale.svg', action: FeatureService.movePoint }, + { icon: 'assets/icons/trending_flat.svg', action: FeatureService.toggleArrow }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + { icon: 'assets/icons/rounded_corner.svg', action: FeatureService.lineToCardinal }, + ], + 'polygon': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject }, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/autorenew.svg', action: FeatureService.rotatePath }, + { icon: 'assets/icons/linear_scale.svg', action: FeatureService.movePoint }, + { icon: 'assets/icons/texture.svg', action: FeatureService.changePattern }, + { icon: 'assets/icons/palette.svg', action: FeatureService.changeColor }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + { icon: 'assets/icons/crop_din.svg', action: FeatureService.toggleStroke }, + ], + 'circle': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject }, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/autorenew.svg', action: FeatureService.rotatePath }, + { icon: 'assets/icons/texture.svg', action: FeatureService.changePattern }, + { icon: 'assets/icons/palette.svg', action: FeatureService.changeColor }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + { icon: 'assets/icons/crop_din.svg', action: FeatureService.toggleStroke }, + ], + 'rect': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject }, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/toolbox_skew.svg', action: FeatureService.skew }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/autorenew.svg', action: FeatureService.rotatePath }, + { icon: 'assets/icons/texture.svg', action: FeatureService.changePattern }, + { icon: 'assets/icons/palette.svg', action: FeatureService.changeColor }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + { icon: 'assets/icons/crop_din.svg', action: FeatureService.toggleStroke }, + ], + 'triangle': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject }, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/toolbox_skew.svg', action: FeatureService.skew }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/autorenew.svg', action: FeatureService.rotatePath }, + { icon: 'assets/icons/texture.svg', action: FeatureService.changePattern }, + { icon: 'assets/icons/palette.svg', action: FeatureService.changeColor }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + { icon: 'assets/icons/crop_din.svg', action: FeatureService.toggleStroke }, + ], + 'text': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject }, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/autorenew.svg', action: FeatureService.rotatePath }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + ], + 'default': [ + { icon: 'assets/icons/delete.svg', action: FeatureService.removeObject }, + { icon: 'assets/icons/open_with.svg', action: FeatureService.movePath }, + { icon: 'assets/icons/copy.svg', action: FeatureService.duplicatePath }, + { icon: 'assets/icons/autorenew.svg', action: FeatureService.rotatePath }, + { icon: 'assets/icons/linear_scale.svg', action: FeatureService.movePoint }, + { icon: 'assets/icons/texture.svg', action: FeatureService.changePattern }, + { icon: 'assets/icons/palette.svg', action: FeatureService.changeColor }, + { icon: 'assets/icons/radio_button_checked.svg', action: FeatureService.toggleEmptyComfortNearFeature }, + { icon: 'assets/icons/hearing.svg', action: InteractionService.addInteraction }, + { icon: 'assets/icons/crop_din.svg', action: FeatureService.toggleStroke }, + ], + 'legend': [ + { icon: 'assets/icons/delete.svg', action: LegendService.removeObject }, + { icon: 'assets/icons/arrow-up2.svg', action: LegendService.goUpObject }, + { icon: 'assets/icons/arrow-down2.svg', action: LegendService.goDownObject }, + { icon: 'assets/icons/draw_text.png', action: LegendService.editText }, + ] + } + + this.ACTIONS = ACTIONS; + } + + angular.module(moduleApp).service('SettingsActions', SettingsActions); + + SettingsActions.$inject = ['FeatureService', 'InteractionService', 'LegendService']; + +})(); + + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SearchService + * + * @requires $http + * @requires $q + * @requires accessimapEditeurDerApp.SettingsService + * + * @description + * Provide functions to get information on nominatim + */ +(function() { + 'use strict'; + + function SearchService($http, $q, SettingsService) { + + this.retrieveData = retrieveData; + this.searchAddress = searchAddress; + + /** + * @ngdoc method + * @name retrieveData + * @methodOf accessimapEditeurDerApp.SearchService + * + * @description + * Retrieve data from overpass for a specific point, + * and display the information on the svg element + * + * @param {Object} point + * Geographic point [lng, lat] + * + * @param {Object} queryChosen + * Query to ask to nominatim : shop, park, ... + * + * @return {Promise} + * Promise with data for successCallback + */ + function retrieveData(point, queryChosen) { + + var deferred = $q.defer(), + mapS, mapW, mapN, mapE; + + if (Array.isArray(point) && point.length === 2) { + mapS = parseFloat(point[1]) - 0.00005; + mapW = parseFloat(point[0]) - 0.00005; + mapN = parseFloat(point[1]) + 0.00005; + mapE = parseFloat(point[0]) + 0.00005; + } else if (point._southWest && point._northEast) { + mapS = point._southWest.lat; + mapW = point._southWest.lng; + mapN = point._northEast.lat; + mapE = point._northEast.lng; + } else { + throw new Error('Parameter "point" is unacceptable. ' + + 'Please see the docs to provide an array[x,y] or an object {_southWest,_northEast}.') + } + + var url = SettingsService.XAPI_URL + '[out:xml];('; + + for (var i = 0; i < queryChosen.query.length; i++) { + url += queryChosen.query[i]; + url += '(' + mapS + ',' + mapW + ',' + mapN + ',' + mapE + ');'; + } + url += ');out body;>;out skel qt;'; + $http.get(url) + .success(function successCallback(data) { + + var osmGeojson = osmtogeojson(new DOMParser().parseFromString(data, 'text/xml')); + + // osmtogeojson writes polygon coordinates in anticlockwise order, not fitting the geojson specs. + // Polygon coordinates need therefore to be reversed + osmGeojson.features.forEach(function(feature, index) { + + if (feature.geometry.type === 'Polygon') { + var n = feature.geometry.coordinates.length; + feature.geometry.coordinates[0].reverse(); + + if (n > 1) { + for (var i = 1; i < n; i++) { + var reversedCoordinates = feature.geometry.coordinates[i].slice().reverse(); + osmGeojson.features[index].geometry.coordinates[i] = reversedCoordinates; + } + } + } + + if (feature.geometry.type === 'MultiPolygon') { + // Split it in simple polygons + feature.geometry.coordinates.forEach(function(coords) { + var n = coords.length; + coords[0].reverse(); + + if (n > 1) { + for (var i = 1; i < n; i++) { + coords[i] = coords[i].slice().reverse(); + } + } + osmGeojson.features.push( + { + 'type': 'Feature', + 'properties': osmGeojson.features[index].properties, + 'geometry': { + 'type': 'Polygon', + 'coordinates': coords + } + }); + }); + } + }); + deferred.resolve(osmGeojson); + }) + .error(deferred.reject); + + return deferred.promise; + + } + + /** + * @ngdoc method + * @name searchAddress + * @methodOf accessimapEditeurDerApp.SearchService + * + * @description + * Search to nominatim an address + * + * @param {String} address + * Address to search + * + * @return {Promise} + * Promise with array of results for successCallback + * Could be empty, or having one or more results + * + */ + function searchAddress(address) { + + var deferred = $q.defer(), + url = SettingsService.NOMINATIM_URL + address + '?format=json'; + + $http.get(url) + .success(deferred.resolve) + .error(deferred.reject); + + return deferred.promise; + + } + + } + + angular.module(moduleApp).service('SearchService', SearchService); + + SearchService.$inject = ['$http', '$q', 'SettingsService']; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.MapService + * + * @requires accessimapEditeurDerApp.SettingsService + * @requires accessimapEditeurDerApp.SearchService + * + * @description + * Service used for initializing leaflet maps + */ +(function() { + 'use strict'; + + function MapService($q, SettingsService, SearchService) { + + var _selectorDOM = '', + _isMapVisible, + map = {}, + overlay = null, + layerMapBox, + layerMapBoxId = 'mapbox.streets', + layerOSM, + layerOSMId = 'osm', + layerControl, + minHeight, + minWidth, + currentLayer; + + this.isMapVisible = function() { return _isMapVisible } + + this.getMap = getMap; + this.getBaseLayer = getBaseLayer; + this.getBaseLayerId = getBaseLayerId; + this.getBounds = getBounds; + this.init = init; + this.resizeFunction = resizeFunction; + + this.addEventListener = addEventListener; + this.addClickListener = addClickListener; + this.addMouseMoveListener = addMouseMoveListener; + this.addDoubleClickListener = addDoubleClickListener; + this.removeEventListeners = removeEventListeners; + this.removeEventListener = removeEventListener; + + this.addMoveHandler = addMoveHandler; + this.removeMoveHandler = removeMoveHandler; + this.addClickHandler = addClickHandler; + this.removeClickHandler = removeClickHandler; + this.addViewResetHandler = addViewResetHandler; + this.removeViewResetHandler = removeViewResetHandler; + + this.changeCursor = changeCursor; + this.resetCursor = resetCursor; + this.projectPoint = projectPoint; + this.latLngToLayerPoint = latLngToLayerPoint; + + this.showMapLayer = showMapLayer; + this.hideMapLayer = hideMapLayer; + + this.freezeMap = freezeMap; + this.unFreezeMap = unFreezeMap; + + this.searchAddress = SearchService.searchAddress + this.resetZoom = resetZoom; + this.resetView = resetView; + this.setMinimumSize = setMinimumSize; + + /** + * @ngdoc method + * @name retrieveData + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * alias of accessimapEditeurDerApp.SearchService:retrieveData + */ + this.retrieveData = SearchService.retrieveData; + + /** + * @ngdoc method + * @name init + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Init a map with leaflet library + * + * @param {string} selector + * Id of the leaflet's map container + */ + function init(selectorDOM, format, _ratioPixelPoint, _resizeFunction) { + + _selectorDOM = selectorDOM; + _isMapVisible = false; + + setMinimumSize(SettingsService.FORMATS[format].width / _ratioPixelPoint, + SettingsService.FORMATS[format].height / _ratioPixelPoint) + + map = L.map(_selectorDOM).setView(SettingsService.leaflet.GLOBAL_MAP_CENTER, + SettingsService.leaflet.GLOBAL_MAP_DEFAULT_ZOOM); + var access_token = + "pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw"; + + layerMapBox = L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=' + + access_token, { + maxZoom: 18, + attribution: 'Map data © OpenStreetMap contributors, ' + + 'CC-BY-SA, ' + + 'Imagery © Mapbox', + id: layerMapBoxId + }); + + layerOSM = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors', + id: layerOSMId + }); + + currentLayer = layerMapBox; + + layerControl = L.control.layers({ 'Open Street Map': layerOSM, 'MapBox Street': layerMapBox}) + + // Use Leaflet to implement a D3 geometric transformation. + $(window).on("resize", _resizeFunction).trigger("resize"); + + map.on('baselayerchange', function(layerEvent) { + currentLayer = layerEvent.layer; + }) + } + + function setMinimumSize(width, height) { + minWidth = width; + minHeight = height; + $('#' + _selectorDOM).css('min-height', minHeight) + $('#' + _selectorDOM).css('min-width', minWidth) + + } + + /** + * @ngdoc method + * @name projectPoint + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Project a geographical point to a layer map point + * Useful for d3 projections + * + * @param {integer} x + * Latitude + * + * @param {integer} y + * Longitude + * + * @return {Array} + * Point with projected coordinates + */ + function projectPoint(x, y) { + var point = map.latLngToLayerPoint(new L.LatLng(y, x)); + + if (this && this.stream) { + this.stream.point(point.x, point.y); + } else { + return point; + } + } + + function latLngToLayerPoint(point) { + return map.latLngToLayerPoint(point); + } + + /** + * @ngdoc method + * @name resizeFunction + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Get the current size of the container + * + * Calc the available space for the map by substracting siblings height + * + * Change the height of the leaflet map and apply for changes + * + * @param {string} selector + * Id of the leaflet's map container + */ + function resizeFunction() { + + var parentHeight = $('#' + _selectorDOM).parent().height(), + parentWidth = $('#' + _selectorDOM).parent().width(), + siblingHeight = $($('#' + _selectorDOM).siblings()[0]).outerHeight(true), + mapHeight = ( ( parentHeight - siblingHeight ) > minHeight ) + ? ( parentHeight - siblingHeight ) + : minHeight, + mapWidth = ( parentWidth > minWidth ) ? 'auto' : minWidth; + + // $("#" + _selectorDOM).height('calc(100vh - 80px)'); + // $("#" + _selectorDOM).width(mapWidth); + map.invalidateSize(); + + } + + var listeners = []; + + function addEventListener(events, listener) { + events.forEach(function(event) { + listeners.push({event: event, function: listener}) + map.addEventListener(event, listener) + }) + } + + /** + * @ngdoc method + * @name addClickListener + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Add a listener to the click event + * + * @param {function} listener + * function executed when click event is fired + */ + function addClickListener(listener) { + addEventListener([ 'click' ], listener) + } + + /** + * @ngdoc method + * @name addMouseMoveListener + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Add a listener to the mousemove event + * + * @param {function} listener + * function executed when mousemove event is fired + */ + function addMouseMoveListener(listener) { + addEventListener([ 'mousemove' ], listener) + } + + /** + * @ngdoc method + * @name addDoubleClickListener + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Add a listener to the doubleclick event + * + * @param {function} listener + * function executed when doubleclick event is fired + */ + function addDoubleClickListener(listener) { + addEventListener([ 'contextmenu' ], listener) + } + + /** + * @ngdoc method + * @name removeEventListeners + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Remove all the listeners to the map + */ + function removeEventListeners() { + listeners.forEach(function(currentValue) { + map.removeEventListener(currentValue.event, currentValue.function) + }) + } + + /** + * @ngdoc method + * @name removeEventListener + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Remove one or several listeners + * + * @param {Array} events + * Array of string representing events : [ 'click', 'mousemove' ] for example + */ + function removeEventListener(events) { + events.forEach(function(event) { + map.removeEventListener(event) + }) + } + + /** + * @ngdoc method + * @name changeCursor + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Change the CSS appearance of the cursor on the map + * + * @param {string} style + * CSS style for cursor property : 'crosshair', '...' + * + * https://developer.mozilla.org/fr/docs/Web/CSS/cursor + */ + function changeCursor(style) { + document.getElementById(_selectorDOM).style.setProperty('cursor', style) + } + + /** + * @ngdoc method + * @name resetCursor + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Reset to 'default' the cursor on the map + */ + function resetCursor() { + document.getElementById(_selectorDOM).style.removeProperty('cursor') + } + + /** + * @ngdoc method + * @name getBounds + * @methodOf accessimapEditeurDerApp.MapService + * + * @description + * Returns the LatLngBounds of the current map view + * + * http://leafletjs.com/reference.html#map-getbounds + * + * @return {LatLngBounds} + * LatLngBounds of the current map view + */ + function getBounds() { + return map.getBounds(); + } + + /** + * @ngdoc method + * @name getMap + * @methodOf accessimapEditeurDerApp.MapService + * + * @description Getter for the map property + * + * @return {Object} Leaflet map + */ + function getMap() { + return map; + } + + function getBaseLayer() { + return currentLayer; + } + + function getBaseLayerId() { + return currentLayer ? currentLayer.options.id : undefined; + } + + function showMapLayer(layerId) { + if (! _isMapVisible) { + _isMapVisible = true; + layerControl.addTo(map) + if (layerId === layerOSMId) { + map.addLayer(layerOSM); + } else if (layerId === layerMapBoxId) { + map.addLayer(layerMapBox) + } else { + map.addLayer(currentLayer); + } + } + } + + function hideMapLayer() { + if (_isMapVisible) { + _isMapVisible = false; + layerControl.removeFrom(map) + map.removeLayer(currentLayer); + } + } + + function freezeMap() { + map.setMaxBounds(map.getBounds()); + } + + function unFreezeMap() { + map.setMaxBounds(null); + } + + function addMoveHandler(callback) { + map.on('move', function(event) { + callback(map.getSize(), map.getPixelOrigin(), map.getPixelBounds().min); + }) + map.fire('move'); + } + + function removeMoveHandler() { + map.off('move'); + } + + function addClickHandler() { + map.on('click', function(event) { + $(document).click(); + }) + } + + function removeClickHandler() { + map.off('click'); + } + + function addViewResetHandler(callback) { + map.on('viewreset', function(event) { + callback(event, map.getPixelOrigin(), map.getZoom()); + }) + map.fire('viewreset'); + } + + function removeViewResetHandler() { + map.off('viewreset'); + } + + function resetZoom() { + map.setZoom(SettingsService.leaflet.GLOBAL_MAP_DEFAULT_ZOOM); + } + + /** + * @ngdoc method + * @name resetView + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * If a center of the drawing is defined, + * we pan / zoom to the initial state of the drawing. + * + * @param {function} callback + * Optional, function to be called when the setView is finished + */ + function resetView(center, zoom, callback) { + + if (center !== null && zoom !== null) { + // if the tile layer don't zoom, we're not going to load tiles + // we have to detect if we are going to change the zoom level or not + var zoomWillChange = ( map.getZoom() !== zoom ); + + if (zoomWillChange) { + if (_isMapVisible) { + getBaseLayer().once('load', function() { + if (callback) callback(); + }) + } + } + + map.setView(center, zoom, {animate:false}) + + if ( callback && ( ( ! zoomWillChange ) || ( zoomWillChange && ! _isMapVisible ) ) ) { + callback(); + } + + } else { + if (callback) callback(); + } + + } + + + } + + angular.module(moduleApp).service('MapService', MapService); + + MapService.$inject = ['$q', 'SettingsService', 'SearchService']; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.LegendService + * @description + * Service providing drawing functions + * Provide functions to + * - init a map/draw area + * - draw features + * - export data + */ +(function() { + 'use strict'; + + function LegendService(SettingsStyles) { + + this.init = init; + this.getSize = getSize; + this.getModel = getModel; + + this.showFontBraille = showFontBraille; + this.hideFontBraille = hideFontBraille; + + this.addItem = addItem; + this.updateItem = updateItem; + this.removeItem = removeItem; + + this.removeObject = removeObject; + this.goDownObject = goDownObject; + this.goUpObject = goUpObject; + + this.setFormat = setFormat; + + this.editText = editText; + + this.drawLegend = drawLegend; + + this.getNode = function() { return _svg !== undefined ? _svg.node() : undefined } + + var _width, + _height, + _margin, + _ratioPixelPoint, + _fontBraille, + _svg, + _model = [], + _addRadialMenuFunction, + frameGroup; + + /** + * @ngdoc method + * @name init + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Create the legend svg in a dom element with specific size + * + * @param {string} id + * id of element in which will be appended svg + * + * @param {integer} width + * width in millimeters of the svg created + * + * @param {integer} height + * height in millimeters of the svg created + * + * @param {integer} margin + * margin of border in millimeters of the svg created + * + * @param {integer} ratioPixelPoint + * ratioPixelPoint ? TODO please explain it... + */ + function init(id, width, height, margin, ratioPixelPoint, addRadialMenuFunction) { + + _width = width / ratioPixelPoint; + _height = height / ratioPixelPoint; + _margin = margin; + _ratioPixelPoint = ratioPixelPoint; + _addRadialMenuFunction = addRadialMenuFunction; + + _svg = d3.select(id).append('svg'); + + setFormat(_width, _height); + + showFontBraille(); + + return _svg; + } + + /** + * @ngdoc method + * @name showFontBraille + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Show the 'braille' font on the legend's svg. + */ + function showFontBraille() { + + _svg.classed('braille', true) + .attr('font-family', 'Braille_2007'); + + } + + /** + * @ngdoc method + * @name hideFontBraille + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Hide the 'braille' font on the legend's svg and display it in Arial + */ + function hideFontBraille() { + + _svg.classed('braille', false) + .attr('font-family', 'Arial'); + + } + + /** + * @ngdoc method + * @name setFormat + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Draw a frame linked to the width & height arguments + * + * @param {integer} width + * Width in pixel of the printing format + * + * @param {integer} height + * Height in pixel of the printing format + */ + function setFormat(width, height) { + + _width = width; + _height = height; + + _svg.attr('width', _width) + .attr('height', _height) + .attr('viewBox', '0 0 ' + _width + ' ' + _height); + + drawLegend(); + + } + + /** + * @ngdoc method + * @name createFramePath + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Create a frame of the legend, telling user about the print format + */ + function createFramePath() { + var w40 = _width - _margin, + h40 = _height - _margin; + + frameGroup = _svg.append('g') + .append('path') + .attr('d', function() { + return 'M ' + _margin + ' ' + _margin + ' L ' + + w40 + + ' ' + _margin + ' L ' + + w40 + + ' ' + + h40 + + ' L ' + _margin + ' ' + + h40 + + ' L ' + _margin + ' ' + _margin + ' z'; + }) + .attr('fill', 'none') + .attr('opacity', '.75') + .attr('stroke', '#000000') + .attr('stroke-width', '2px') + .attr('stroke-opacity', '1') + .attr('id', 'svgContainer') + .classed('notDeletable', true); + }; + + /** + * @ngdoc method + * @name getSize + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * return the size of the layer, representing the size of the legend + * + * @return {Object} + * {width, height} + * + */ + function getSize() { + return {width: _width, height: _height} + } + /** + * @ngdoc method + * @name getModel + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * return a clone of the current array of items + * + * @return {Array} + * The model + * + */ + function getModel() { + return _model.slice() + } + + /** + * @ngdoc method + * @name addItem + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Add an item in the model, and redraw the legend + * + */ + function addItem(id, name, type, style, color, contour) { + + _model.push({ + id : id, + name : name, + type : type, + style : style, + color : color, + contour : contour + }) + + drawLegend(); + + } + + /** + * @ngdoc method + * @name addItem + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Remove an item from the model, thanks to the id params + * + */ + function removeItem(id) { + + _model = _model.filter(function filterModel(currentItem, index) { + return currentItem.id !== id + }) + + drawLegend(); + } + + /** + * @ngdoc method + * @name addItem + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Update an item from the model, thanks to the id params + * + */ + function updateItem(id, name, type, style, color, contour) { + + var itemToUpdate = _model.find(function findItem(currentItem) { return currentItem.id === id }) + + itemToUpdate.name = name; + itemToUpdate.type = type; + itemToUpdate.style = style; + itemToUpdate.color = color; + itemToUpdate.contour = contour; + + drawLegend(); + } + + /** + * @ngdoc method + * @name drawLegend + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Draw the legend, based on the _model array. + * + */ + function drawLegend() { + + _svg.selectAll('*').remove(); + + createFramePath(); + + _svg.append('text') + .attr('x', function() { + return _margin; + }) + .attr('y', function() { + return _margin * 2; + }) + .attr('font-size', '35px') + .text(function() { + return 'Légende'; + }) + + _model.forEach(function(item, index, array) { + + var legendGroup = _svg.append('g') + // .attr('id', query.id) // TODO: see if it's useful ? + .attr('class', 'legend') + .attr('data-type', 'legend') + .attr('data-link', item.id), + symbol; + + switch(item.type) { + case 'line': + symbol = legendGroup.append('line') + .attr('x1', function() { + return _margin * 2; + }) + .attr('y1', function() { + return ( index + 1 ) * 40 +_margin * 2; + }) + .attr('x2', function() { + return _margin * 2 + 40; + }) + .attr('y2', function() { + return ( index + 1 ) * 40 +_margin * 2; + }) + .attr('class', 'symbol') + .attr('fill', 'red'); + + var symbolInner = legendGroup.append('line') + .attr('x1', function() { + return _margin * 2; + }) + .attr('y1', function() { + return ( index + 1 ) * 40 +_margin * 2; + }) + .attr('x2', function() { + return _margin * 2 + 40; + }) + .attr('y2', function() { + return ( index + 1 ) * 40 +_margin * 2; + }) + .attr('class', 'symbol') + .attr('class', 'inner') + .attr('fill', 'red'); + + angular.forEach(item.style.style, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (typeof(v) === 'function') { + v = v.url(); + } + symbol.attr(k, v); + }); + + if (item.style.styleInner) { + angular.forEach(item.style.styleInner, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (typeof(v) === 'function') { + v = v.url(); + } + symbolInner.attr(k, v); + }); + } + break; + + case 'point': + symbol = legendGroup.append('path') + .attr('cx',_margin * 2 + 20) + .attr('cy', ( index + 1 ) * 40 +_margin * 2 + item.style.radius / 2) + .attr('d', function() { + var x = parseFloat(d3.select(this).attr('cx')), + y = parseFloat(d3.select(this).attr('cy')); + + return item.style.path(x, y, item.style.radius); + }) + .attr('class', 'symbol') + .attr('fill', 'red'); + break; + + case 'polygon': + symbol = legendGroup.append('rect') + .attr('x', function() { + return _margin * 2; + }) + .attr('y', function() { + return ( index + 1 ) * 40 +_margin * 2 - 15; + }) + .attr('width', function() { + return 40; + }) + .attr('height', function() { + return 15; + }) + .attr('class', 'symbol') + .attr('fill', 'red'); + break; + } + + angular.forEach(item.style.style, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + if (item.color && item.color.color !== 'none') { + v += '_' + item.color.color; + } + symbol.attr('fill', SettingsStyles.POLYGON_STYLES[v].url()); + } else { + symbol.attr(k, v); + } + }); + + if (item.contour && !symbol.attr('stroke')) { + symbol.attr('stroke', 'black') + .attr('stroke-width', '2'); + } + + legendGroup + .append('text') + .attr('x', function() { + return _margin * 2 + 50; + }) + .attr('y', function() { + return ( index + 1 )* 40 +_margin * 2 ; + }) + .attr('font-size', '35px') + .text(function() { + return item.name; + }) + + if (_addRadialMenuFunction) + _addRadialMenuFunction(legendGroup, _svg) + + }) + + } + + function removeObject(target) { + removeItem(target.attr('data-link')) + } + + function goDownObject(target) { + var currentId = target.attr('data-link'), + currentIndex = _model.findIndex(function findIndex(currentItem, index) { + return currentItem.id === currentId + }) + + if (_model.length >= 2 && currentIndex < _model.length - 1) { + var currentItem = _model[currentIndex], + itemToMove = _model[currentIndex + 1] + + _model[currentIndex + 1] = currentItem; + _model[currentIndex] = itemToMove; + } + + drawLegend() + + } + + function goUpObject(target) { + + var currentId = target.attr('data-link'), + currentIndex = _model.findIndex(function findIndex(currentItem, index) { + return currentItem.id === currentId + }) + + if (_model.length >= 2 && currentIndex > 0) { + var currentItem = _model[currentIndex], + itemToMove = _model[currentIndex - 1] + + _model[currentIndex - 1] = currentItem; + _model[currentIndex] = itemToMove; + } + + drawLegend() + + } + + /** + * @ngdoc method + * @name editText + * @methodOf accessimapEditeurDerApp.LegendService + * + * @description + * Enable the edition of the legend's item text + * + * @param {Object} target + * Item in the legend which text will be edited + */ + function editText(target) { + + } + + } + + angular.module(moduleApp).service('LegendService', LegendService); + + LegendService.$inject = ['SettingsStyles']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.DefsService + * + * @description + * Service provinding a method to add 'definitions' patterns to a svg + */ +(function() { + 'use strict'; + + function DefsService(SettingsService) { + + this.createDefs = createDefs; + + /** + * @ngdoc method + * @name accessimapEditeurDerApp.DefsService.createDefs + * @methodOf accessimapEditeurDerApp.DefsService + * + */ + function createDefs(node) { + + var _svg = node.append('svg'), + _defs = _svg.attr("data-name", "defs") + .append("defs"); + + _defs.append('marker') + .attr('id', 'arrowStartMarker') + .attr('refX', 5) + .attr('refY', 5) + .attr('markerWidth', 10) + .attr('markerHeight', 10) + .attr('orient', 'auto') + .append('path') + .attr('d', 'M9,1 L5,5 9,9') + .attr('style', 'fill:none;stroke:#000000;stroke-opacity:1'); + + _defs.append('marker') + .attr('id', 'arrowStopMarker') + .attr('refX', 5) + .attr('refY', 5) + .attr('markerWidth', 10) + .attr('markerHeight', 10) + .attr('orient', 'auto') + .append('path') + .attr('d', 'M1,1 L5,5 1,9') + .attr('style', 'fill:none;stroke:#000000;stroke-opacity:1'); + + _defs.append('marker') + .attr('id', 'straightMarker') + .attr('refX', 1) + .attr('refY', 5) + .attr('markerWidth', 2) + .attr('markerHeight', 10) + .attr('orient', 'auto') + .append('path') + .attr('d', 'M1,1 L1,9') + .attr('style', 'fill:none;stroke:#000000;stroke-opacity:1'); + + Object.keys(SettingsService.POLYGON_STYLES).forEach(function(value, index, array) { + _defs.call(SettingsService.POLYGON_STYLES[value]); + }); + + return _svg; + + } + + } + + angular.module(moduleApp).service('DefsService', DefsService); + + DefsService.$inject = ['SettingsService']; + +})(); + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name accessimapEditeurDerApp.GeometryUtilsService + * + * @description + * Useful functions for calc distances, angles, ... + */ + function GeometryUtilsService() { + + this.distance = distance ; + this.nearest = nearest ; + this.realCoordinates = realCoordinates ; + this.angle = angle ; + this.extendPath = extendPath ; + this.getPathDirection = getPathDirection ; + + /** + * @ngdoc method + * @name distance + * @methodOf accessimapEditeurDerApp.GeometryUtilsService + * + * @description + * Return the distance between two points + * + * @param {Point} point1 + * Coordinates [x,y] + * + * @param {Point} point2 + * Coordinates [x,y] + * + * @return {float} + * Distance between the points + */ + function distance(point1, point2) { + var distance = Math.sqrt(Math.pow((point1[0] - point2[0]), 2) + + Math.pow((point1[1] - point2[1]), 2)); + + return distance; + } + + /** + * @ngdoc method + * @name nearest + * @methodOf accessimapEditeurDerApp.GeometryUtilsService + * + * @description + * Return the nearest point of a targetPoint + * + * @param {Point} targetPoint + * Coordinates [x,y] + * + * @param {[Point]} points + * Array of coordinates + * + * @return {Point} + * Coordinates [x,y] of the nearest point + */ + function nearest(targetPoint, points) { + var nearestPoint, + _this = this; + + points.forEach(function(pt) { + var dist = _this.distance(targetPoint, pt); + + if (!nearestPoint) { + nearestPoint = pt; + nearestPoint[3] = dist; + } else { + if (dist < nearestPoint[3]) { + nearestPoint = pt; + nearestPoint[3] = dist; + } + } + }); + + return nearestPoint; + } + + /** + * @ngdoc method + * @name realCoordinates + * @methodOf accessimapEditeurDerApp.GeometryUtilsService + * + * @param {[type]} transform [description] + * + * @param {[type]} coordinates [description] + * + * @return {[type]} [description] + */ + function realCoordinates(transform, coordinates, bbox) { + + var translate = transform.translate, + realCoordinates = []; + + if (! bbox) bbox = { x: 0, y: 0, width: 0, height: 0 } + + realCoordinates[0] = (coordinates[0] - translate[0] - bbox.x - ( bbox.width / 2 )) + realCoordinates[1] = (coordinates[1] - translate[1] - bbox.y - ( bbox.height / 2 )) + + return realCoordinates; + } + + /** + * @ngdoc method + * @name angle + * @methodOf accessimapEditeurDerApp.GeometryUtilsService + * + * @param {integer} cx + * X coordinate of the first point + * + * @param {integer} cy + * Y coordinate of the first point + * + * @param {integer} ex + * X coordinate of the second point + * + * @param {integer} ey + * Y coordinate of the second point + * + * @return {integer} + * angle, in degrees, between the two points + */ + function angle(cx, cy, ex, ey) { + var dy = ey - cy, + dx = ex - cx, + theta = Math.atan2(dy, dx); + theta *= 180 / Math.PI; + //if (theta < 0) theta = 360 + theta; // range [0, 360) + return theta; + } + + /** + * @ngdoc method + * @name extendPath + * @methodOf accessimapEditeurDerApp.GeometryUtilsService + * + * @description + * Extend a path composed by two points + * + * Use Thales theorem to calculate the new coordinates + * + * Upon the direction path, we add / substract the extended coordinates + * + * @param {Array} point1 + * First point of the path + * + * @param {Array} point2 + * Second point of the path + * + * @param {float} extension + * Length to add to each side of the path + * + * @return {Array} + * Array of points extended drawing the new path, + * in the same order than [ point1, point2 ] + * + */ + function extendPath(point1, point2, extension) { + + var initialDistance = distance(point1,point2), + extendedPath = [], + + vectorExtensionX = ((point1[0] - point2[0]) / initialDistance) * extension, + vectorExtensionY = ((point1[1] - point2[1]) / initialDistance) * extension; + + extendedPath[0] = [ point1[0] + vectorExtensionX, point1[1] + vectorExtensionY ] + extendedPath[1] = [ point2[0] - vectorExtensionX, point2[1] - vectorExtensionY ] + + return extendedPath; + } + + /** + * @ngdoc method + * @name getPathDirection + * @methodOf accessimapEditeurDerApp.GeometryUtilsService + * + * @description + * Knowing the y axis is from top to bottom, + * and x axis is from left to right, + * + * Calculate the direction of a path : + * - top right to bottom left (1) + * - bottom right to top left (2) + * - bottom left to top right (3) + * - top left to bottom right (4) + * + * @param {Array} point1 + * First point of the path + * + * @param {Array} point2 + * Second point of the path + * + * @return {integer} + * The integer matching the direction + * + */ + function getPathDirection(point1, point2) { + + var isLeftToRight, + isBottomToTop, + pathDirection; + + // if point1 x is at the left of the point2 x + if (point1[0] < point2[0]) + isLeftToRight = true; + else + isLeftToRight = false; + + // if point1 y is above the point2 y + if (point1[1] < point2[1]) + isBottomToTop = false; + else + isBottomToTop = true; + + if (! isLeftToRight && ! isBottomToTop) + pathDirection = 1 + else if (! isLeftToRight && isBottomToTop) + pathDirection = 2 + else if (isLeftToRight && isBottomToTop) + pathDirection = 3 + else if (isLeftToRight && ! isBottomToTop) + pathDirection = 4 + + return pathDirection; + + } + + } + + angular.module(moduleApp).service('GeometryUtilsService', GeometryUtilsService); +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.EmptyComfortService + * + * @description + * + */ +(function() { + 'use strict'; + + function EmptyComfortService(SVGService) { + + this.calcEmptyComfort = calcEmptyComfort; + + /** + * @ngdoc method + * @name calcEmptyComfort + * @methodOf accessimapEditeurDerApp.EmptyComfortService + * + * @description + * Calculate the empty area around an element. + * For a line path, we extend the path on the extremities, + * For a text feature, we return a rect bigger than 7px of the original bounding box + * + * @param {Object} feature + * d3 object + * + * @return {DOMElement} + * element to add to DOM representing the empty comfort + */ + function calcEmptyComfort(feature) { + + var el = feature.node(), + bbox = el.getBBox(), + type = feature.attr('data-type'), + emptyArea, + path = feature.attr('d'), + transformString = null || feature.attr('transform'); + + switch (type) { + case 'text': + var radius = Math.max(bbox.height, bbox.width) / 2 + 14; + + emptyArea = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); + + d3.select(emptyArea) + .attr('x', bbox.x - 7) + .attr('y', bbox.y - 7) + .attr('width', bbox.width + 14) + .attr('height', bbox.height + 14) + .attr('fill', 'white'); + + break; + + default: + + emptyArea = el.cloneNode(true); + + d3.select(emptyArea) + .attr('iid', null) + .attr('fill', 'none') + .attr('stroke', 'white') + .attr('style', '') + .attr('d', path) + .attr('stroke-width', '20'); + + + if (type === 'line' || type === 'point') + d3.select(emptyArea) + .attr('stroke-linejoin', 'round') + .attr('stroke-linecap', 'round') + + break; + } + + d3.select(emptyArea) + .attr('transform', transformString) + .classed('c' + feature.attr('data-link'), true) + .classed('link_' + feature.attr('data-link'), true) + .classed('notDeletable', true); + + return emptyArea; + + } + + } + + angular.module(moduleApp).service('EmptyComfortService', EmptyComfortService); + + EmptyComfortService.$inject= ['SVGService']; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.SelectPathService + * + * @description + * Provide function to calculate the 'select path' of a feature + * + */ +(function() { + 'use strict'; + + function SelectPathService() { + + this.calcSelectPath = calcSelectPath; + this.addTo = addTo; + this.removeTo = removeTo; + + /** + * @ngdoc method + * @name calcSelectPath + * @methodOf accessimapEditeurDerApp.SelectPathService + * + * @description + * Calculate the select path around an element. + * It's a rect identical of the bbox. + * + * @param {Object} feature + * d3 object + * + * @return {DOMElement} + * element to add to DOM representing the empty comfort + */ + function calcSelectPath(feature) { + + var el = feature.node(), + bbox = el.getBBox(), + type = feature.attr('data-type'), + selectPath, + path = feature.attr('d'), + transformString = null || feature.attr('transform'); + + selectPath = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); + + d3.select(selectPath) + .attr('x', bbox.x) + .attr('y', bbox.y) + .attr('width', bbox.width) + .attr('height', bbox.height) + .attr('data-type', 'select-path') + .attr('fill', 'none') + .attr('stroke', 'red') + .attr('stroke-width', '2') + .attr('transform', transformString); + + return selectPath; + + } + + function addTo(nodes) { + nodes.style('cursor', 'crosshair') + .on('mouseover', function(event) { + var feature = d3.select(this), + selectPath = calcSelectPath(feature); + feature.node().parentNode.appendChild(selectPath); + }) + .on('mouseout', function(event) { + var feature = d3.select(this), + selectPath = d3.select(feature.node().parentNode) + .selectAll('[data-type="select-path"]') + .remove(); + }) + } + + function removeTo(nodes) { + nodes.style('cursor', '') + .on('mouseover', function() {}) + .on('mouseout', function() {}) + .on('click', function() {}) + } + + } + + angular.module(moduleApp).service('SelectPathService', SelectPathService); + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.LayerService + * @description + * Service providing layer functions to add + * - defs + * - + * Provide functions to + * - init a map/draw area + * - draw features + * - export data + */ +(function() { + 'use strict'; + + function LayerService(LayerBackgroundService, LayerOverlayService, LayerGeoJSONService, LayerDrawingService) { + + // layers functions + this.createLayers = createLayers; + + this.geojson = LayerGeoJSONService; + this.geojson.getLayer = getGeoJSONLayer; + this.geojson.getZoom = getGeoJSONZoom; + + this.overlay = LayerOverlayService; + this.overlay.getLayer = getOverlayLayer; + this.overlay.getZoom = getOverlayZoom; + + this.drawing = LayerDrawingService; + this.drawing.getLayer = getDrawingLayer; + this.drawing.getZoom = getDrawingZoom; + + this.background = LayerBackgroundService; + this.background.getLayer = getBackgroundLayer; + + var _elements = { geojson: {}, drawing: {}, overlay: {}, background: {}}; + this._elements = _elements; + + /** + * @ngdoc method + * @name createLayers + * @methodOf accessimapEditeurDerApp.LayerService + * + * @description + * Add all the required layers to the svg + * + * @param {Object} svg + * SVG node on which will be added layers + * + * @param {Object} g + * G node on which will be added layers of polygon, points, etc. + * + * @param {enum} format + * Format (landscapeA4, landscapeA3, ...) of the drawing + */ + function createLayers(elements, format) { + + _elements = elements; + + LayerBackgroundService.createLayer(elements.background.sel, format, elements.background.proj); + LayerGeoJSONService.createLayer(elements.geojson.sel, elements.geojson.proj); + LayerDrawingService.createLayer(elements.drawing.sel); + LayerOverlayService.createLayer(elements.overlay.sel, format, elements.overlay.proj); + + } + + function getOverlayLayer() { + return _elements.overlay.sel; + } + + function getDrawingLayer() { + return _elements.drawing.sel; + } + + function getGeoJSONLayer() { + return _elements.geojson.sel; + } + + function getBackgroundLayer() { + return _elements.background.sel; + } + + function getOverlayZoom() { + return _elements.overlay.proj.scale; + } + + function getDrawingZoom() { + return _elements.drawing.proj.scale; + } + + function getGeoJSONZoom() { + return _elements.geojson.proj.scale; + } + + + + } + + angular.module(moduleApp).service('LayerService', LayerService); + + LayerService.$inject = ['LayerBackgroundService', 'LayerOverlayService', + 'LayerGeoJSONService', 'LayerDrawingService']; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.LayerBackgroundService + * + * @description + * Service providing the management of background layer + */ +(function() { + 'use strict'; + + function LayerBackgroundService(SettingsService) { + + this.createLayer = createLayer; + this.append = append; + this.appendImage = appendImage; + this.refresh = refresh; + this.setFormat = setFormat; + + var _width, + _height, + _target, + _projection, + _g, + _backgroundImage, + _backgroundPath, + _lastTranslationX, + _lastTranslationY; + + + function createLayer(target, format, projection) { + _target = target; + _projection = projection; + + _g = _target.attr("data-name", "background-layer") + .attr('id', 'background-layer') + .append('g') + + _backgroundPath = _g.append('path') + + setFormat(format) + + } + + function append(element) { + _g.append(d3.select(element).node()); + } + + function appendImage(dataUrl, size, pixelOrigin, pixelBoundMin) { + + var img = new Image(); + + img.src = dataUrl; + img.onload = function() { // need to load the image to obtain width & height + _g.selectAll('image').remove(); + + _backgroundImage = _g.append('image') + .attr('data-width', this.width) + .attr('data-height', this.height) + .attr('xlink:href', dataUrl); + + resizeBackgroundImage(); + + }; + + } + + function resizeBackgroundImage() { + if (_backgroundImage) { + var svgRatio = _height / _width, + + imageWidth = _backgroundImage.attr('data-width'), + imageHeight = _backgroundImage.attr('data-height'), + imageRatio = imageHeight / imageWidth, + + finalWidth, finalHeight; + + if (imageRatio > svgRatio) { + finalHeight = _height; + finalWidth = finalHeight / imageRatio; + } else { + finalWidth = _width; + finalHeight = finalWidth * imageRatio; + } + + // calculate coordinates + var x = ( ( _width - finalWidth) / 2 ), + y = ( _height - finalHeight ) / 2 ; + + _backgroundImage + .attr('x', x) + .attr('y', y) + .attr('width', finalWidth) + .attr('height', finalHeight); + } + + } + + /** + * @ngdoc method + * @name setFormat + * @methodOf accessimapEditeurDerApp.LayerBackgroundService + * + * @description + * Change the format of the current layer, and update the background Image if needed + * + * @param {Object} format + * Format of the drawing + */ + function setFormat(format) { + _width = SettingsService.FORMATS[format].width / SettingsService.ratioPixelPoint; + _height = SettingsService.FORMATS[format].height / SettingsService.ratioPixelPoint; + resizeBackgroundImage(); + resizePath(); + } + + /** + * @ngdoc method + * @name createPath + * @methodOf accessimapEditeurDerApp.LayerBackgroundService + * + * @description + * Create an invisible path + * + * Could be useful later if user want a background pattern + */ + function resizePath() { + + _backgroundPath.attr('d', function() { + return 'M 0 0 L ' + + _width + + ' 0 L ' + + _width + + ' ' + + _height + + ' L 0 ' + + _height + + ' L 0 0 z'; + }) + .attr('id', 'background-path') + .style('pointer-events', 'none') + .style('fill', 'none') + .classed('notDeletable', true) + } + + /** + * @ngdoc method + * @name refresh + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @description + * Function moving the overlay svg, thanks to map movements... + * + * This function has to be used only if we want the overlay be 'fixed' + * + * TODO: clear the dependencies to map... maybe, give the responsability to the map + * and so, thanks to a 'class', we could 'freeze' the overlay thanks to this calc + */ + function refresh(size, pixelOrigin, pixelBoundMin) { + // x,y are coordinates to position overlay + // coordinates 0,0 are not the top left, but the point at the middle left + _lastTranslationX = + // to get x, we calc the space between left and the overlay + ( ( size.x - _width) / 2 ) + // and we substract the difference between the original point of the map + // and the actual bounding topleft point + - (pixelOrigin.x - pixelBoundMin.x), + + _lastTranslationY = + // to get y, we calc the space between the middle axe and the top of the overlay + _height / -2 + // and we substract the difference between the original point of the map + // and the actual bounding topleft point + - (pixelOrigin.y - pixelBoundMin.y - size.y / 2); + + _g.attr("transform", "translate(" + (_lastTranslationX ) +"," + (_lastTranslationY) + ")") + } + + } + + angular.module(moduleApp).service('LayerBackgroundService', LayerBackgroundService); + + LayerBackgroundService.$inject = ['SettingsService']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.LayerDrawingService + * @requires accessimapEditeurDerApp.LayerService + * + * @description + * Service providing drawing functions + * Provide functions to + * - init a map/draw area + * - draw features + */ +(function() { + 'use strict'; + + function LayerDrawingService() { + + var _target, + _g; + + this.createLayer = createLayer; + this.appendImage = appendImage; + this.appendSvg = appendSvg; + this.clean = clean; + + function createLayer(target) { + + _target = target; + + _g = _target.attr("data-name", "drawing-layer") + .attr("id", "drawing-layer"); + + createDrawing(); + } + + /** + * @ngdoc method + * @name accessimapEditeurDerApp.LayerDrawingService.createDrawing + * @methodOf accessimapEditeurDerApp.LayerDrawingService + * + * @param {Object} target [description] + */ + function createDrawing() { + _g.append('g').attr('data-name', 'images-layer'); + _g.append('g').attr('data-name', 'polygons-layer'); + _g.append('g').attr('data-name', 'lines-layer'); + _g.append('g').attr('data-name', 'points-layer'); + _g.append('g').attr('data-name', 'texts-layer'); + } + + function appendImage(dataUrl, size, pixelOrigin, pixelBoundMin) { + + var img = new Image(); + + img.src = dataUrl; + img.onload = function() { // need to load the image to obtain width & height + var width = this.width, + height = this.height, + ratio = height / width, + + // calculate coordinates + x = + // to get x, we calc the space between left and the overlay + ( ( size.x - width) / 2 ) + // and we substract the difference between the original point of the map + // and the actual bounding topleft point + - (pixelOrigin.x - pixelBoundMin.x), + + y = + // to get y, we calc the space between the middle axe and the top of the overlay + height / -2 + // and we substract the difference between the original point of the map + // and the actual bounding topleft point + - (pixelOrigin.y - pixelBoundMin.y - size.y / 2); + + _g.select('[data-name="images-layer"]') + .append('image') + .attr('x', x) + .attr('y', y) + .attr('width', width) + .attr('height', height) + .attr('xlink:href', dataUrl); + + }; + + } + + function appendSvg(svgElement, transformToApply) { + var children = svgElement.childNodes; + + for (var i = 0; i < children.length; i++) { + if (children[i].localName === 'svg') { + $(children[i]).attr('transform', transformToApply); + _g.select('[data-name="images-layer"]').node().appendChild(children[i]) + } + } + } + + function clean() { + _g.select('[data-name="images-layer"]').selectAll('*').remove() + _g.select('[data-name="polygons-layer"]').selectAll('*').remove() + _g.select('[data-name="lines-layer"]').selectAll('*').remove() + _g.select('[data-name="points-layer"]').selectAll('*').remove() + _g.select('[data-name="texts-layer"]').selectAll('*').remove() + } + } + + angular.module(moduleApp).service('LayerDrawingService', LayerDrawingService); + + LayerDrawingService.$inject = []; + +})(); + +// jscs:disable maximumNumberOfLines +/** + * @ngdoc service + * @name accessimapEditeurDerApp.LayerGeoJSONService + * @requires accessimapEditeurDerApp.LayerService + * @description + * Service providing drawing functions + * Provide functions to + * - init a map/draw area + * - draw features + */ +(function() { + 'use strict'; + + function LayerGeoJSONService(SettingsService, LegendService, RadialMenuService) { + + var _geojson = [], + _projection, + _g, + _lastTranslationX, + _lastTranslationY; + + this.createLayer = createLayer; + + this.geojsonToSvg = geojsonToSvg; + this.removeFeature = removeFeature; + this.updateFeature = updateFeature; + this.rotateFeature = rotateFeature; + this.drawAddress = drawAddress; + this.transform = transform; + this.clean = clean; + + this.getFeatures = function() { + return _geojson.slice(0) + } + this.setFeatures = function(features) { + _geojson = features ; + } + this.resetFeatures = function() { + _geojson = [] ; + } + + this.refresh = refresh; + + function createLayer(target, projectPoint) { + _projection = projectPoint; + + _g = target + .attr("data-name", "geojson-layer") + .attr("id", "geojson-layer"); + + createDrawing(); + } + + /** + * @ngdoc method + * @name accessimapEditeurDerApp.LayerGeoJSONService.createDrawing + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + */ + function createDrawing() { + _g.append('g').attr('data-name', 'polygons-layer'); + _g.append('g').attr('data-name', 'lines-layer'); + _g.append('g').attr('data-name', 'points-layer'); + _g.append('g').attr('data-name', 'texts-layer'); + }; + + function transform(transform) { + _g.attr('transform', transform) + } + + /** + * @ngdoc method + * @name refresh + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * Project all paths from _geojson + */ + function refresh(projectPoint) { + + if (projectPoint) _projection = projectPoint; + + _geojson.forEach(function (geojson) { + + d3.selectAll('path.' + geojson.id) + .filter(function(d) { + return d.geometry.type !== 'Point'; }) + .attr('d', _projection.pathFromGeojson) + .attr('stroke-width', 2 / _projection.scale) + + d3.selectAll('path.inner.' + geojson.id) + .filter(function(d) { + return d.geometry.type !== 'Point'; }) + .attr('d', _projection.pathFromGeojson) + .attr('stroke-width', 2 / _projection.scale) + + d3.selectAll('path.' + geojson.id) + .filter(function(d) { + return d.geometry.type === 'Point'; }) + .attr('stroke-width', 2 / _projection.scale) + .attr('cx', function(d) { + return _projection.latLngToLayerPoint(L.latLng(d.geometry.coordinates[1], + d.geometry.coordinates[0])).x; + }) + .attr('cy', function(d) { + return _projection.latLngToLayerPoint(L.latLng(d.geometry.coordinates[1], + d.geometry.coordinates[0])).y; + }) + .attr('d', function(d) { + var coords = _projection.latLngToLayerPoint(L.latLng(d.geometry.coordinates[1], + d.geometry.coordinates[0])); + + return geojson.style.path(coords.x, coords.y, geojson.style.radius / _projection.scale); + }) + .attr('transform', function(d) { + var result = ''; + + if (this.transform.baseVal.length > 0) { + var coords = _projection.latLngToLayerPoint(L.latLng(d.geometry.coordinates[1], + d.geometry.coordinates[0])); + + result += 'rotate(' + geojson.rotation + ')';//' ' + coords.x + ' ' + coords.y + ');'; + } + + return result; + }); + }); + + } + + /** + * @ngdoc method + * @name geojsonToSvg + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * simplify... ? + * + * @param {Object} data + * [description] + * + * @param {Object} feature + * [description] + * + * @param {Object} optionalClass + * [description] + */ + function geojsonToSvg(data, simplification, id, poi, queryChosen, styleChosen, + styleChoices, colorChosen, checkboxModel, rotationAngle) { + if (data) { + // data.features.forEach(function(feature, index) { + // if (simplification) { + // data.features[index] = turf.simplify(feature, simplification, false); + // } + // }); + + var featureExists, obj; + + if (id) { + featureExists = _geojson.filter(function(obj) { + return obj.id === id; + }); + } else { + featureExists = _geojson.filter(function(obj) { + return obj.id === queryChosen.id; + }); + } + + if (featureExists.length === 0) { + + if (poi) { + var tags = data.features[0].properties.tags, + name = tags.name || tags.amenity || tags.shop || 'POI'; + obj = { + id: id, + name: name, + type: queryChosen.type, + layer: $.extend(true, {}, data), //deep copy, + originallayer: $.extend(true, {}, data), //deep copy + style: styleChosen, + styleChoices: styleChoices, + rotation: 0 + }; + LegendService.addItem(id, + name, + 'point', + styleChosen, + colorChosen, + checkboxModel.contour); + } else { + obj = { + id: queryChosen.id, + name: queryChosen.name, + type: queryChosen.type, + layer: $.extend(true, {}, data), //deep copy, + originallayer: $.extend(true, {}, data), //deep copy + style: styleChosen, + styleChoices: styleChoices, + contour: checkboxModel.contour, + color: colorChosen + }; + LegendService.addItem(queryChosen.id, + queryChosen.name, + queryChosen.type, + styleChosen, + colorChosen, + checkboxModel.contour); + } + _geojson.push(obj); + drawFeature(data, [obj], null, styleChosen, colorChosen, checkboxModel, rotationAngle); + + if (styleChosen.styleInner) { + drawFeature(data, [obj], 'inner', styleChosen, colorChosen, checkboxModel, rotationAngle); + } + + } else { + drawFeature(data, featureExists, null, styleChosen, colorChosen, checkboxModel, rotationAngle); + + if (styleChosen.styleInner) { + drawFeature(data, + featureExists, + 'inner', + styleChosen, + colorChosen, + checkboxModel, + rotationAngle); + } + } + } + } + + /** + * @ngdoc method + * @name drawAddress + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * draw a circle for an address + * + * @param {Object} data + * data returned by a nominatim server, + * containing geometry & other stuff + * to display the poi + * + * @param {string} id + * specific string identifying this address + * useful to erase the d3 node + * + * @param {SettingsService.STYLES} style + * style of the point ... ? + * + * @param {SettingsService.COLORS} color + * Color of the POI + * + */ + function drawAddress(data, id, label, style, color) { + var lon = data.lon, + lat = data.lat, + point = turf.point([lon, lat]); + + // Draw a point + if (d3.select('#' + id).node()) { + d3.select('#' + id).remove(); + } + + // remove from the _geojson if exist + var geojsonItemIndex = _geojson.findIndex(function(element, index) { + return element.id === id + }); + + if (geojsonItemIndex !== -1) { + _geojson.splice(geojsonItemIndex, 1); + } + + var obj = { + id: id, + name: label, + type: 'point', + layer: $.extend(true, {}, point), //deep copy, + originallayer: $.extend(true, {}, point), //deep copy + style: SettingsService.STYLES.point[0], + styleChoices: SettingsService.STYLES.point, + rotation: 0 + }; + + _geojson.push(obj); + + var features = turf.featurecollection([point]); + drawFeature(features, [obj], null, style, color, null, 0); + + } + + /** + * @ngdoc method + * @name drawFeature + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * Draw the features + * + * @param {Object} data + * [description] + * + * @param {Object} feature + * [description] + * + * @param {Object} optionalClass + * [description] + * + * @param {Object} styleChosen + * [description] + * + * @param {Object} colorChosen + * [description] + * + * @param {Object} checkboxModel + * [description] + * + * @param {Object} rotationAngle + * [description] + */ + function drawFeature(data, feature, optionalClass, styleChosen, colorChosen, checkboxModel, rotationAngle) { + var featureGroup, + type = feature[0].type, + drawingLayer = d3.select(_g).node().select('[data-name="' + type + 's-layer"]') ; + + if (optionalClass) { + if (d3.select('.vector.' + optionalClass + '#' + feature[0].id).empty()) { + featureGroup = drawingLayer.append('g') + .classed('vector', true) + .classed(optionalClass, true) + .classed('rotable', true) + .attr('id', feature[0].id); + } else { + featureGroup = d3.select('.vector.' + optionalClass + '#' + feature[0].id); + } + } else { + if (d3.select('.vector#' + feature[0].id).empty()) { + featureGroup = drawingLayer.append('g') + .classed('vector', true) + .classed('rotable', true) + .attr('id', feature[0].id); + } else { + featureGroup = d3.select('.vector#' + feature[0].id); + } + } + + featureGroup + .selectAll('path') + // specific for every features except points + .data(data.features.filter(function(d) { + return d.geometry.type !== 'Point'; + })) + .enter().append('path') + .attr('data-type', type) + .attr('data-from', 'osm') + .attr('class', function(d) { + if (optionalClass) { + return feature[0].id + ' ' + optionalClass + ' link_' + d.properties.id; + } else { + return feature[0].id + ' link_' + d.properties.id; + } + }) + .attr('data-link', function(d) { + return d.properties.id; + }) + .attr('name', function(d) { + if (d.properties.tags) { + return d.properties.tags.name; + } + }) + .attr('e-style', styleChosen.id) + .attr('e-color', colorChosen.color) + // TODO: useful for lines ? + // .attr('stroke-width', 2 / _projection.scale) + .attr('d', function(d) { + return _projection.pathFromGeojson(d); + }) + .append('svg:title') + .text(function(d) { + return d.properties.tags.name; + }) + + // specific for point's features + .data(data.features.filter(function(d) { + return d.geometry.type === 'Point'; + })) + .enter().append('path') + .attr('data-type', type) + .attr('data-from', 'osm') + .attr('class', feature[0].id) + .attr('name', function(d) { + if (d.properties.tags) { + return d.properties.tags.name; + } + }) + // TODO: useful for lines ? + // .attr('stroke-width', 2 / _projection.scale) + .attr('cx', function(d) { + return _projection.latLngToLayerPoint(L.latLng(d.geometry.coordinates[1], + d.geometry.coordinates[0])).x; + }) + .attr('cy', function(d) { + return _projection.latLngToLayerPoint(L.latLng(d.geometry.coordinates[1], + d.geometry.coordinates[0])).y; + }) + .attr('d', function(d) { + var coords = _projection.latLngToLayerPoint(L.latLng(d.geometry.coordinates[1], + d.geometry.coordinates[0])); + + return feature[0].style.path(coords.x, coords.y, feature[0].style.radius); + }); + + // SettingsService style attributes + angular.forEach(feature[0].style.style, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + if (colorChosen && colorChosen.color !== 'none') { + v += '_' + colorChosen.color; + } + d3.select('#' + feature[0].id).attr('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + d3.select('#' + feature[0].id).attr(k, v); + } + }); + + if (optionalClass) { + angular.forEach(feature[0].style.styleInner, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + if (colorChosen && colorChosen.color !== 'none') { + v += '_' + colorChosen.color; + } + d3.select('.' + optionalClass + '#' + feature[0].id) + .attr('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + d3.select('.' + optionalClass + '#' + feature[0].id) + .attr(k, v); + } + }); + } + + if (checkboxModel + && checkboxModel.contour + && !d3.select('#' + feature[0].id).attr('stroke')) { + d3.select('#' + feature[0].id) + .attr('stroke', 'black') + .attr('stroke-width', '2'); + } + + if (optionalClass) { + angular.forEach(feature[0].style['style_' + optionalClass], function(attribute) { + d3.select('.' + optionalClass + '#' + feature[0].id) + .attr(attribute.k, attribute.v); + }); + } + + // // Update the uid so to ensure this will be unique + // angular.forEach(data.features, function(f) { + // if ($rootScope.uid < f.properties.id) { + // $rootScope.uid = f.properties.id; + // } + // }); + + // rotate(rotationAngle); + + } + + /** + * @ngdoc method + * @name updateFeature + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * update the style of a 'feature' = item of '_geojson' collection. + * + * @param {Object} id + * id of the feature + */ + function updateFeature(id, style, color) { + + var result = _geojson.filter(function(obj) { + return obj.id === id; + }), + objectId = _geojson.indexOf(result[0]); + + if(color) _geojson[objectId].color = color; + + if(style) _geojson[objectId].style = style; + + if (_geojson[objectId].contour) { + d3.select('#' + id) + .attr('stroke', 'black') + .attr('stroke-width', '2'); + } else { + d3.select('#' + id) + .attr('stroke', null) + .attr('stroke-width', null); + } + + angular.forEach(style.style, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + if (_geojson[objectId].color && _geojson[objectId].color.color !== 'none') { + v += '_' + _geojson[objectId].color.color; + } + d3.select('#' + id) + .attr('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + d3.select('#' + id) + .attr(k, v); + } + }) + + if (style.styleInner) { + angular.forEach(style.styleInner, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + d3.select('.inner#' + id).attr('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + d3.select('.inner#' + id).attr(k, v); + } + }) + } + + if (style.path) { + _geojson[objectId].style.path = style.path; + refresh(); + } + + var symbol = d3.select('.legend#' + id).select('.symbol'); + + if (_geojson[objectId].contour) { + symbol + .attr('stroke', 'black') + .attr('stroke-width', '2'); + } else { + symbol + .attr('stroke', null) + .attr('stroke-width', null); + } + + angular.forEach(style.style, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + if (_geojson[objectId].color && _geojson[objectId].color.color !== 'none') { + v += '_' + _geojson[objectId].color.color; + } + symbol.attr('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + symbol.attr(k, v); + } + }) + + if (style.styleInner) { + var symbolInner = d3.select('.legend#' + id).select('.inner'); + angular.forEach(style.styleInner, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + symbol.attr('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + symbolInner.attr(k, v); + } + }) + } + + if (style.path) { + symbol.attr('d', function() { + return style.path(symbol.attr('cx'), symbol.attr('cy'), style.radius); + }) + } + + // update the legend + LegendService.updateItem(id, + _geojson[objectId].name, + _geojson[objectId].type, + _geojson[objectId].style, + _geojson[objectId].color, + _geojson[objectId].contour) + + } + + /** + * @ngdoc method + * @name removeFeature + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * remove a 'feature' = item of '_geojson' collection. + * + * Remove it from the array and from the map / legend + * + * @param {Object} id + * id of the feature + */ + function removeFeature(id) { + // Remove object from _geojson + var result = _geojson.filter(function(obj) { + return obj.id === id; + }), + index = _geojson.indexOf(result[0]); + _geojson.splice(index, 1); + + // Remove object from map + d3.select('.vector#' + id).remove(); + + if (d3.select('.vector.inner#' + id)) { + d3.select('.vector.inner#' + id).remove(); + } + + LegendService.removeItem(id) + + } + + /** + * @ngdoc method + * @name rotateFeature + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * rotate a feature element (feature.id) of a feature.rotation + * + * @param {Object} feature + * Object with id & rotation properties + */ + function rotateFeature(feature) { + var features = d3.selectAll('.' + feature.id); + angular.forEach(features[0], function(featurei) { + var cx = d3.select(featurei).attr('cx'), + cy = d3.select(featurei).attr('cy'); + d3.select(featurei).attr('transform', 'rotate(' + feature.rotation + ' ' + cx + ' ' + cy + ')'); + }); + } + + /** + * @ngdoc method + * @name clean + * @methodOf accessimapEditeurDerApp.LayerGeoJSONService + * + * @description + * clean the layer by removing all paths inside the GeoJSON layer + */ + function clean() { + _g.select('[data-name="polygons-layer"]').selectAll('*').remove() + _g.select('[data-name="lines-layer"]').selectAll('*').remove() + _g.select('[data-name="points-layer"]').selectAll('*').remove() + _g.select('[data-name="texts-layer"]').selectAll('*').remove() + + // Remove object from _geojson + _geojson.forEach(function(element, index, array) { + LegendService.removeItem(element.id); + }) + + _geojson = []; + + } + + } + + angular.module(moduleApp).service('LayerGeoJSONService', LayerGeoJSONService); + + LayerGeoJSONService.$inject = ['SettingsService', 'LegendService', 'RadialMenuService']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.LayerOverlayService + * + * @description + * Service providing the management of overlay layer + */ +(function() { + 'use strict'; + + function LayerOverlayService(SettingsService) { + + this.createLayer = createLayer; + this.refresh = refresh; + this.draw = draw; + this.getCenter = getCenter; + this.getTranslation = getTranslation; + this.getSize = getSize; + this.setFormat = setFormat; + + this.getFormat = function() { return _format } + this.getTranslationX = function() { return _lastTranslationX } + this.getTranslationY = function() { return _lastTranslationY } + + var _marginGroup, + _frameGroup, + _format, + _width, + _height, + _margin, + _target, + _projection, + _lastTranslationX, + _lastTranslationY, + _framePath, + _marginPath, + _backgroundPath; + + + /** + * @ngdoc method + * @name accessimapEditeurDerApp.LayerOverlayService.createLayer + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @description + * create the overlay layer, with margin & frame groups + * + * @param {Object} target + * d3 area + * + * @param {integer} width + * Width of the d3 area + * + * @param {integer} height + * Height of the d3 area + * + * @param {integer} margin + * Margin wished + * + * @param {function} projection + * Projection function to use for conversion between GPS & layer point + */ + function createLayer(target, format, projection) { + _margin = SettingsService.margin; + _target = target; + _projection = projection; + + _marginGroup = _target.append('g').attr('id', 'margin-layer') + _frameGroup = _target.append('g').attr('id', 'frame-layer') + + _framePath = _frameGroup.append('path') + _marginPath = _marginGroup.append('path') + _backgroundPath = _marginGroup.append('path') + + setFormat(format) + + } + + /** + * @ngdoc method + * @name accessimapEditeurDerApp.LayerOverlayService.createMarginPath + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @description + * draw the margin path + */ + function createMarginPath() { + var w40 = _width - _margin, + h40 = _height - _margin; + + _marginPath.attr('d', function() { + var outer = 'M 0 0 L 0 ' + + _height + + ' L ' + + _width + + ' ' + + _height + + ' L ' + + _width + + ' 0 L 0 0 z ', + inner = 'M ' + _margin + ' ' + _margin + ' L ' + + w40 + + ' ' + _margin + ' L ' + + w40 + + ' ' + + h40 + + ' L ' + _margin + ' ' + + h40 + + ' L ' + _margin + ' ' + _margin + ' z'; + + return outer + inner; + }) + .style('fill', '#ffffff') + .style('pointer-events', 'none') + .attr('id', 'svgWhiteBorder') + .classed('notDeletable', true); + + _backgroundPath.attr('d', function() { + var outer = 'M -10000 -10000 L -10000 ' + + ( _height + 10000 ) + + ' L ' + + ( _width + 10000 ) + + ' ' + + ( _height + 10000 ) + + ' L ' + + ( _width + 10000 ) + + ' -10000 L -10000 -10000 z ', + inner = 'M 0 0 L ' + + _width + + ' 0 L ' + + _width + + ' ' + + _height + + ' L ' + 0 + ' ' + + _height + ' z'; + + return outer + inner; + }) + .style('pointer-events', 'none') + .style('fill', '#bbb') + .style('fill-opacity', '.5') + .classed('notDeletable', true); + + }; + + function getCenter() { + return _projection.layerPointToLatLng([( _width / 2 ) + _lastTranslationX, + ( _height / 2 ) + _lastTranslationY]); + } + + /** + * @ngdoc method + * @name accessimapEditeurDerApp.LayerOverlayService.createFramePath + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @param {Object} target + * [description] + * + * @param {integer} width + * [description] + * + * @param {integer} height + * [description] + */ + function createFramePath() { + var w40 = _width - _margin, + h40 = _height - _margin; + + _framePath.attr('d', function() { + return 'M ' + _margin + ' ' + _margin + ' L ' + + w40 + + ' ' + _margin + ' L ' + + w40 + + ' ' + + h40 + + ' L ' + _margin + ' ' + + h40 + + ' L ' + _margin + ' ' + _margin + ' z'; + }) + .attr('fill', 'none') + .attr('opacity', '.75') + .attr('stroke', '#000000') + .attr('stroke-width', '2px') + .attr('stroke-opacity', '1') + .style('pointer-events', 'none') + .classed('notDeletable', true) + } + + /** + * @ngdoc method + * @name draw + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @description + * Draw margin & frame groups, id overlay. + * + * @param {integer} width + * Overlay's width + * + * @param {integer} height + * Overlay's height + * + */ + function draw() { + + createMarginPath(); + createFramePath(); + + } + + function setFormat(format) { + _format = format; + _width = SettingsService.FORMATS[format].width / SettingsService.ratioPixelPoint; + _height = SettingsService.FORMATS[format].height / SettingsService.ratioPixelPoint; + draw(); + } + + /** + * @ngdoc method + * @name refresh + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @description + * Function moving the overlay svg, thanks to map movements... + * + * This function has to be used only if we want the overlay be 'fixed' + * + * TODO: clear the dependencies to map... maybe, give the responsability to the map + * and so, thanks to a 'class', we could 'freeze' the overlay thanks to this calc + */ + function refresh(size, pixelOrigin, pixelBoundMin) { + // x,y are coordinates to position overlay + // coordinates 0,0 are not the top left, but the point at the middle left + _lastTranslationX = + // to get x, we calc the space between left and the overlay + ( ( size.x - _width) / 2 ) + // and we substract the difference between the original point of the map + // and the actual bounding topleft point + - (pixelOrigin.x - pixelBoundMin.x), + + _lastTranslationY = + // to get y, we calc the space between the middle axe and the top of the overlay + _height / -2 + // and we substract the difference between the original point of the map + // and the actual bounding topleft point + - (pixelOrigin.y - pixelBoundMin.y - size.y / 2); + + _marginGroup.attr("transform", "translate(" + (_lastTranslationX ) +"," + (_lastTranslationY) + ")") + _frameGroup.attr("transform", "translate(" + (_lastTranslationX ) +"," + (_lastTranslationY) + ")") + } + + /** + * @ngdoc method + * @name getTranslation + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @description + * calc the translation of the margin-layer group (or frame-layer, it's the same) + * + * take in consideration the parent group + * + * @return {Object} + * {x, y} representing the translation on x axis & y axis + * + */ + function getTranslation() { + var translateScaleOverlayGroup = _target.attr('transform'), + + translateOverlayGroup = ( translateScaleOverlayGroup === null ) ? null + : translateScaleOverlayGroup.substring(translateScaleOverlayGroup.indexOf('(') + 1, + translateScaleOverlayGroup.indexOf(')')), + + translateOverlayGroupArray = ( translateOverlayGroup === null ) ? [0, 0] + : translateOverlayGroup.slice(0, translateOverlayGroup.length).split(','), + + translateOverlayArray = [ _lastTranslationX, _lastTranslationY ] + + return { x: ( parseInt(translateOverlayArray[0]) + parseInt(translateOverlayGroupArray[0]) ), + y: ( parseInt(translateOverlayArray[1]) + parseInt(translateOverlayGroupArray[1]) ) } + } + + /** + * @ngdoc method + * @name getSize + * @methodOf accessimapEditeurDerApp.LayerOverlayService + * + * @description + * return the size of the layer, representing the size of the drawing + * + * @return {Object} + * {width, height} + * + */ + function getSize() { + return {width: _width, height: _height} + } + + } + + angular.module(moduleApp).service('LayerOverlayService', LayerOverlayService); + + LayerOverlayService.$inject = ['SettingsService']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToolboxService + * + * @description + * Expose different methods to draw on the d3 svg area + * + * The toolbox is a set of 'drawing tools', giving the user the ability to draw some specific shapes : + * + * - points + * - ellipses, circles + * - rectangles, squares + * - text + * - lines + * - polygons + */ +(function() { + 'use strict'; + + function ToolboxService(RadialMenuService, + SettingsService, + UtilService, + ToolboxTriangleService, + ToolboxRectangleService, + ToolboxEllipseService, + ToolboxTextService, + ToolboxPolylineService, + ToolboxImageService, + SelectPathService, + $sce) { + + this.init = init; + + this.addContextMenus = addContextMenus; + this.hideContextMenus = hideContextMenus; + + this.addSelectPaths = addSelectPaths; + this.hideSelectPaths = hideSelectPaths; + + this.drawPoint = drawPoint; + + this.writeText = ToolboxTextService.writeText; + + this.beginLineOrPolygon = ToolboxPolylineService.beginLineOrPolygon; + this.drawHelpLineOrPolygon = ToolboxPolylineService.drawHelpLineOrPolygon; + this.finishLineOrPolygon = ToolboxPolylineService.finishLineOrPolygon; + + this.drawCircle = ToolboxEllipseService.drawCircle; + this.updateCircleRadius = ToolboxEllipseService.updateCircleRadius; + + this.drawSquare = ToolboxRectangleService.drawSquare; + this.updateSquare = ToolboxRectangleService.updateSquare; + + this.drawTriangle = ToolboxTriangleService.drawTriangle; + this.updateTriangle = ToolboxTriangleService.updateTriangle; + + this.changeTextColor = changeTextColor; + this.updateBackgroundStyleAndColor = updateBackgroundStyleAndColor; + this.updateFeatureStyleAndColor = updateFeatureStyleAndColor; + this.updateMarker = updateMarker; + + this.featureIcon = featureIcon; + + var svgDrawing; + + function init(_svgDrawing, svgMenu, getCurrentZoom) { + RadialMenuService.init(d3.select(_svgDrawing.node().parentNode.parentNode), getCurrentZoom); + svgDrawing = _svgDrawing; + + ToolboxTriangleService.init(_svgDrawing, applyStyle) + ToolboxRectangleService.init(_svgDrawing, applyStyle) + ToolboxEllipseService.init(_svgDrawing, applyStyle) + ToolboxPolylineService.init(_svgDrawing, applyStyle) + ToolboxTextService.init(_svgDrawing, applyStyle) + } + + /** + * @ngdoc method + * @name addContextMenus + * @methodOf accessimapEditeurDerApp.ToolboxService + * @description + * + * Add radial menus to d3 for differents elements : + * - path + * - circle + * - text + * + * Then users can edit these shapes by right-clicking on it + * + * @param {Object} model [description] + */ + var selectors = [ + 'path:not(.notDeletable)', + 'circle:not(.notDeletable)', + 'ellipse:not(.notDeletable)', + 'rect:not(.notDeletable)', + 'text:not(.notDeletable)', + 'image:not(.notDeletable)', + ] + + function addContextMenus() { + selectors.forEach(function(currentSelector, index, array) { + RadialMenuService.addRadialMenu(d3.selectAll(currentSelector), svgDrawing); + }) + } + + function hideContextMenus() { + selectors.forEach(function(currentSelector, index, array) { + d3.selectAll(currentSelector).on('contextmenu', function() {}); + }) + } + + function addSelectPaths() { + selectors.forEach(function(selector, index) { + SelectPathService.addTo(d3.selectAll(selector)) + }) + } + + function hideSelectPaths() { + selectors.forEach(function(selector, index) { + SelectPathService.removeTo(d3.selectAll(selector)) + }) + } + + /** + * @ngdoc method + * @name drawPoint + * @methodOf accessimapEditeurDerApp.ToolboxService + * + * @description + * Draw a point (circle, arrow,...) at specific coordinates + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {Object} style + * SettingsService.STYLE of the point + * + * @param {Object} color + * SettingsService.COLOR of the point + * + */ + function drawPoint(x, y, style, color) { + + var iid = UtilService.getiid(), + + feature = svgDrawing + .select('g[data-name="points-layer"]') + .append('path') + .classed('link_' + iid, true) + .attr('d', style.path(x,y,style.radius)) + .attr('data-x', x) + .attr('data-y', y) + .attr('data-link', iid) + .attr('data-type', 'point') + .attr('data-from', 'drawing'); + + applyStyle(feature, style.style, color); + + } + + + + function changeTextColor(model) { + model.fontColorChosen = model.fontColors[model.fontChosen.color][0]; + }; + + function updateBackgroundStyleAndColor(style, color) { + updateStyleAndColor(d3.select('#background-path'), style, color) + } + + function updateFeatureStyleAndColor(style, color) { + updateStyleAndColor(d3.select('.styleEdition'), style, color) + } + + function updateStyleAndColor(path, style, color) { + var currentStyleId = path.attr('e-style'), + currentColorName = path.attr('e-color'); + + if (style) { + path.attr('e-style', style.id); + } else { + // no style, we just find the current style of the feature + SettingsService.ALL_STYLES.forEach(function (item, index, array) { + if (item.id === currentStyleId) { + style = item; + } + }) + } + + if (color) { + path.attr('e-color', color.color); + } else { + // no color, we just find the current color of the feature + SettingsService.ALL_COLORS.forEach(function (item, index, array) { + if (item.color === currentColorName) { + color = item; + } + }) + } + + if (path.attr('data-type') === 'point') { + var x = parseInt(path.attr('data-x')), + y = parseInt(path.attr('data-y')) + path.attr('d', style.path(x,y,style.radius)) + } + + if (style && color) { + applyStyle(path, style.style, color); + } + }; + + function updateMarker(markerStart, markerStop) { + var path = d3.select('.styleEdition'); + + if (markerStart) { + path.attr('marker-start', 'url(#' + markerStart.id + ')'); + } + + if (markerStop) { + path.attr('marker-end', 'url(#' + markerStop.id + ')'); + } + }; + + function applyStyle(path, style, colorChosen) { + angular.forEach(style, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + if (colorChosen && colorChosen.color !== 'none') { + v += '_' + colorChosen.color; + } + path.style('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + path.style(k, v); + } + }) + }; + + /** + * @ngdoc method + * @name featureIcon + * @methodOf accessimapEditeurDerApp.ToolboxService + * + * @param {Object} item [description] + * @param {Object} type [description] + * @return {string} [description] + */ + function featureIcon(item, type) { + var iconSvg = document.createElement('svg'), + iconContainer = d3.select(iconSvg) + .attr('height', 40).append('g'), + symbol; + + switch(type) { + case 'line': + symbol = iconContainer.append('line') + .attr('x1', 0) + .attr('y1', 15) + .attr('x2', 250) + .attr('y2', 15) + .attr('fill', 'red'); + + var symbolInner = iconContainer.append('line') + .attr('x1', 0) + .attr('y1', 15) + .attr('x2', 250) + .attr('y2', 15) + .attr('fill', 'red'); + + angular.forEach(item.styleInner, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (typeof(v) === 'function') { + v = v.url(); + } + symbolInner.attr(k, v); + }); + break; + + case 'point': + symbol = iconContainer.append('path') + .attr('d', function() { + return item.path(20, 20, item.radius); + }); + break; + + default: + symbol = iconContainer.append('rect') + .attr('x', 0) + .attr('y', 0) + .attr('width', 250) + .attr('height', 30) + .attr('fill', 'red'); + break; + } + + angular.forEach(item.style, function(attribute) { + var k = attribute.k, + v = attribute.v; + + if (k === 'fill-pattern') { + symbol.style('fill', SettingsService.POLYGON_STYLES[v].url()); + } else { + symbol.style(k, v); + } + }); + + return $sce.trustAsHtml((new XMLSerializer()).serializeToString(iconSvg)); + + }; + + } + + angular.module(moduleApp).service('ToolboxService', ToolboxService); + + ToolboxService.$inject = ['RadialMenuService', 'SettingsService', 'UtilService', + 'ToolboxTriangleService', + 'ToolboxRectangleService', + 'ToolboxEllipseService', + 'ToolboxTextService', + 'ToolboxPolylineService', + 'ToolboxImageService', + 'SelectPathService', + '$sce']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToolboxImageService + * @description + * Expose different methods to draw on the d3 svg area + */ +(function() { + 'use strict'; + + function ToolboxImageService(UtilService) { + + this.init = init; + + var svgDrawing, + applyStyle ; + + function init(_svgDrawing, _applyStyle) { + svgDrawing = _svgDrawing; + applyStyle = _applyStyle; + } + + /** + * @ngdoc method + * @name importImage + * @methodOf accessimapEditeurDerApp.ToolboxImageService + * + * @description + * + * Import a local image in the DER + * + */ + function importImage(x, y, style, color, contour) { + + var feature; + + if (d3.select('.edition')[0][0]) { // second click + feature = d3.select('.edition'); + var xOffset = x - feature.attr('cx'), + yOffset = y - feature.attr('cy'), + r = Math.sqrt(Math.pow(xOffset, 2) + Math.pow(yOffset, 2)) + + if (r > 0) { + + feature.attr('r', r) + .attr('e-style', style.id) + .attr('e-color', color.color) + .attr('data-origin-x', '') + .attr('data-origin-y', '') + .classed('edition', false) + } else { + feature.remove() + } + + } else { // first click + var iid = UtilService.getiid(); + feature = svgDrawing.select('g[data-name="polygons-layer"]') + .append('ellipse') + .attr('cx', x) + .attr('cy', y) + .classed('link_' + iid, true) + .attr('data-origin-x', x) + .attr('data-origin-y', y) + .attr('data-link', iid) + .attr('data-type', 'circle') + .attr('data-from', 'drawing') + .classed('edition', true); + + applyStyle(feature, style.style, color); + + if (contour && !feature.attr('stroke')) { + feature + .attr('stroke', 'black') + .attr('stroke-width', '2'); + } + } + } + + /** + * @ngdoc method + * @name updateCircleRadius + * @methodOf accessimapEditeurDerApp.ToolboxImageService + * + * @description + * Update the radius of a feature circle + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {boolean} shiftKeyPressed + * Whether or not the shift key is pressed + * + */ + function updateCircleRadius(x, y, shiftKeyPressed) { + var feature = d3.select('.edition'); + + if (feature[0][0]) { + + var originX = parseFloat(feature.attr('data-origin-x')), + originY = parseFloat(feature.attr('data-origin-y')), + deltaX = x - originX, + deltaY = y - originY, + newX = originX + ( deltaX / 2 ), + newY = originY + ( deltaY / 2 ), + + xOffset = Math.abs(x - originX), + yOffset = Math.abs(y - originY); + + // if shift key, we draw a circle, and not an ellipse + if (shiftKeyPressed) { + if (xOffset < yOffset) { + xOffset = yOffset + newX = originX + ( Math.abs(deltaY) / 2 * ( x < originX ? -1 : 1 ) ) + } else { + yOffset = xOffset; + newY = originY + ( Math.abs(deltaX) / 2 * ( y < originY ? -1 : 1 ) ) + } + } + + feature.attr('rx', xOffset / 2) + .attr('ry', yOffset / 2) + .attr('cx', newX) + .attr('cy', newY); + } + } + + } + + angular.module(moduleApp).service('ToolboxImageService', ToolboxImageService); + + ToolboxImageService.$inject = ['UtilService']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToolboxTriangleService + * + * @description + * Service to draw a triangle + */ +(function() { + 'use strict'; + + function ToolboxTriangleService(RadialMenuService, GeneratorService, UtilService) { + + this.drawTriangle = drawTriangle; + this.updateTriangle = updateTriangle; + this.init = init; + + var svgDrawing, + applyStyle ; + + function init(_svgDrawing, _applyStyle) { + svgDrawing = _svgDrawing; + applyStyle = _applyStyle; + } + + /** + * @ngdoc method + * @name drawCircle + * @methodOf accessimapEditeurDerApp.ToolboxTriangleService + * + * @description + * Draw a circle at specific coordinates + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {Object} style + * SettingsService.STYLE of the point + * + * @param {Object} color + * SettingsService.COLOR of the point + * + * @param {boolean} contour + * If true add a shape to the circle + * + */ + function drawTriangle(x, y, style, color, contour) { + + var drawingLayer = svgDrawing.select('g[data-name="polygons-layer"]'), + feature; + + if (d3.select('.edition')[0][0]) { + + // second click + feature = d3.select('.edition'); + feature.attr('e-style', style.id) + .attr('e-color', color.color) + .classed('edition', false) + + } else { + + // first click + var iid = UtilService.getiid(), + feature = drawingLayer + .append('path') + .attr('x', x) + .attr('y', y) + .attr('data-origin-x', x) + .attr('data-origin-y', y) + .classed('link_' + iid, true) + .attr('data-link', iid) + .attr('data-type', 'triangle') + .attr('data-from', 'drawing') + .classed('edition', true) + + applyStyle(feature, style.style, color); + + if (contour && !feature.attr('stroke')) { + feature.attr('stroke', 'black') + .attr('stroke-width', '2'); + } + } + } + + /** + * @ngdoc method + * @name updateCircleRadius + * @methodOf accessimapEditeurDerApp.ToolboxTriangleService + * + * @description + * Update the radius of a feature circle + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {boolean} shiftKeyPressed + * Whether or not the shift key is pressed + * + */ + function updateTriangle(x, y, shiftKeyPressed) { + var feature = d3.select('.edition'); + + if (feature[0][0]) { + + var originX = parseFloat(feature.attr('data-origin-x')), + originY = parseFloat(feature.attr('data-origin-y')), + + width = Math.abs(x - originX), + height = Math.abs(y - originY), + + // calc the three points of the triangle + firstPoint = [ x < originX ? x + width / 2 : originX + width / 2, y < originY ? y : originY ], + secondPoint = [ x < originX ? originX : x, y < originY ? originY : y ], + thirdPoint = [ x < originX ? x : originX, y < originY ? originY : y ]; + + feature.attr('d', GeneratorService.pathFunction.polygon([ firstPoint, secondPoint, thirdPoint ])) + } + } + + } + + angular.module(moduleApp).service('ToolboxTriangleService', ToolboxTriangleService); + + ToolboxTriangleService.$inject = ['RadialMenuService', 'GeneratorService', 'UtilService']; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToolboxRectangleService + * @description + * Expose different methods to draw on the d3 svg area + */ +(function() { + 'use strict'; + + function ToolboxRectangleService(RadialMenuService, GeneratorService, UtilService) { + + this.init = init; + this.drawSquare = drawSquare; + this.updateSquare = updateSquare; + + var svgDrawing, + applyStyle ; + + function init(_svgDrawing, _applyStyle) { + svgDrawing = _svgDrawing; + applyStyle = _applyStyle; + } + + /** + * @ngdoc method + * @name drawSquare + * @methodOf accessimapEditeurDerApp.ToolboxRectangleService + * + * @description + * Draw a square at specific coordinates + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {Object} style + * SettingsService.STYLE of the point + * + * @param {Object} color + * SettingsService.COLOR of the point + * + * @param {boolean} contour + * If true add a shape to the circle + * + */ + function drawSquare(x, y, style, color, contour) { + + var feature; + + if (d3.select('.edition')[0][0]) { // second click + feature = d3.select('.edition'); + + var originX = parseFloat(feature.attr('data-origin-x')), + originY = parseFloat(feature.attr('data-origin-y')), + width = x - originX, + height = y - originY; + + if (width !== 0 && height !== 0) { + + feature + .attr('data-origin-x', '') + .attr('data-origin-y', '') + .attr('e-style', style.id) + .attr('e-color', color.color) + .classed('edition', false) + } else { + feature.remove() + } + + } else { // first click + var iid = UtilService.getiid(); + feature = svgDrawing.select('g[data-name="polygons-layer"]') + .append('rect') + .attr('x', x) + .attr('y', y) + .attr('data-origin-x', x) + .attr('data-origin-y', y) + .classed('link_' + iid, true) + .attr('data-link', iid) + .attr('data-type', 'rect') + .attr('data-from', 'drawing') + .classed('edition', true); + + applyStyle(feature, style.style, color); + + if (contour && !feature.attr('stroke')) { + feature + .attr('stroke', 'black') + .attr('stroke-width', '2'); + } + } + } + + /** + * @ngdoc method + * @name updateSquare + * @methodOf accessimapEditeurDerApp.ToolboxRectangleService + * + * @description + * Update the radius of a feature circle + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {boolean} shiftKeyPressed + * Whether or not the shift key is pressed + * + */ + function updateSquare(x, y, shiftKeyPressed) { + var feature = d3.select('.edition'); + + if (feature[0][0]) { + + var originX = parseFloat(feature.attr('data-origin-x')), + originY = parseFloat(feature.attr('data-origin-y')), + width = Math.abs(x - originX), + height = Math.abs(y - originY), + newX = x < originX ? x : originX, + newY = y < originY ? y : originY; + + // if shift key, we draw a square, and not a rectangle + // TODO: fix the coordinates + if (shiftKeyPressed) { + if (width < height) { + width = height; + newY = y < originY ? originY - width : originY + newX = x < originX ? originX - height : originX + + } else { + height = width; + newY = y < originY ? originY - width : originY + newX = x < originX ? originX - height : originX + } + } + + feature.attr('width', width) + .attr('height', height) + .attr('x', newX) + .attr('y', newY) + } + } + + } + + angular.module(moduleApp).service('ToolboxRectangleService', ToolboxRectangleService); + + ToolboxRectangleService.$inject = ['RadialMenuService', 'GeneratorService', 'UtilService']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToolboxEllipseService + * @description + * Expose different methods to draw on the d3 svg area + */ +(function() { + 'use strict'; + + function ToolboxEllipseService(RadialMenuService, GeneratorService, UtilService) { + + this.drawCircle = drawCircle; + this.updateCircleRadius = updateCircleRadius; + this.init = init; + + var svgDrawing, + applyStyle ; + + function init(_svgDrawing, _applyStyle) { + svgDrawing = _svgDrawing; + applyStyle = _applyStyle; + } + + /** + * @ngdoc method + * @name drawCircle + * @methodOf accessimapEditeurDerApp.ToolboxEllipseService + * + * @description + * Draw a circle at specific coordinates + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {Object} style + * SettingsService.STYLE of the point + * + * @param {Object} color + * SettingsService.COLOR of the point + * + * @param {boolean} contour + * If true add a shape to the circle + * + */ + function drawCircle(x, y, style, color, contour) { + + var feature; + + if (d3.select('.edition')[0][0]) { // second click + feature = d3.select('.edition'); + var xOffset = x - feature.attr('cx'), + yOffset = y - feature.attr('cy'), + r = Math.sqrt(Math.pow(xOffset, 2) + Math.pow(yOffset, 2)) + + if (r > 0) { + + feature.attr('r', r) + .attr('e-style', style.id) + .attr('e-color', color.color) + .attr('data-origin-x', '') + .attr('data-origin-y', '') + .classed('edition', false) + } else { + feature.remove() + } + + } else { // first click + var iid = UtilService.getiid(); + feature = svgDrawing.select('g[data-name="polygons-layer"]') + .append('ellipse') + .attr('cx', x) + .attr('cy', y) + .classed('link_' + iid, true) + .attr('data-origin-x', x) + .attr('data-origin-y', y) + .attr('data-link', iid) + .attr('data-type', 'circle') + .attr('data-from', 'drawing') + .classed('edition', true); + + applyStyle(feature, style.style, color); + + if (contour && !feature.attr('stroke')) { + feature + .attr('stroke', 'black') + .attr('stroke-width', '2'); + } + } + } + + /** + * @ngdoc method + * @name updateCircleRadius + * @methodOf accessimapEditeurDerApp.ToolboxEllipseService + * + * @description + * Update the radius of a feature circle + * + * @param {integer} x + * X coordinate of the point + * + * @param {integer} y + * Y coordinate of the point + * + * @param {boolean} shiftKeyPressed + * Whether or not the shift key is pressed + * + */ + function updateCircleRadius(x, y, shiftKeyPressed) { + var feature = d3.select('.edition'); + + if (feature[0][0]) { + + var originX = parseFloat(feature.attr('data-origin-x')), + originY = parseFloat(feature.attr('data-origin-y')), + deltaX = x - originX, + deltaY = y - originY, + newX = originX + ( deltaX / 2 ), + newY = originY + ( deltaY / 2 ), + + xOffset = Math.abs(x - originX), + yOffset = Math.abs(y - originY); + + // if shift key, we draw a circle, and not an ellipse + if (shiftKeyPressed) { + if (xOffset < yOffset) { + xOffset = yOffset + newX = originX + ( Math.abs(deltaY) / 2 * ( x < originX ? -1 : 1 ) ) + } else { + yOffset = xOffset; + newY = originY + ( Math.abs(deltaX) / 2 * ( y < originY ? -1 : 1 ) ) + } + } + + feature.attr('rx', xOffset / 2) + .attr('ry', yOffset / 2) + .attr('cx', newX) + .attr('cy', newY); + } + } + + } + + angular.module(moduleApp).service('ToolboxEllipseService', ToolboxEllipseService); + + ToolboxEllipseService.$inject = ['RadialMenuService', 'GeneratorService', 'UtilService'] + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToolboxTextService + * @description + * Expose different methods to draw on the d3 svg area + */ +(function() { + 'use strict'; + + function ToolboxTextService(GeneratorService, UtilService, $q) { + + this.writeText = writeText; + this.setTextEditable = setTextEditable; + this.init = init; + + var svgDrawing, + applyStyle ; + + function init(_svgDrawing, _applyStyle) { + svgDrawing = _svgDrawing; + applyStyle = _applyStyle; + } + + // TODO: Fréd, ça sert à quoi ? + function selectElementContents(el) { + var range = document.createRange(); + range.selectNodeContents(el); + var sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + } + + function writeText(x, y, font, color) { + + // the previously edited text should not be edited anymore + d3.select('.edition').classed('edition', false); + + var iid = UtilService.getiid(), + + textElement = svgDrawing.select('g[data-name="texts-layer"]') + .append('text') + .attr('x', x) + .attr('y', y - 35) + .attr('font-family', font.family) + .attr('font-size', font.size) + .attr('font-weight', function() { + return font.weight; + }) + .attr('fill', color.color) + // .attr('id', 'finalText') + .classed('edition', true) + .classed('link_' + iid, true) + .attr('data-type', 'text') + .attr('data-from', 'drawing') + .attr('data-link', iid) + .text(''); + + return setTextEditable(textElement); + + } + + function setTextEditable(textElement) { + + var deferred = $q.defer(), + text = textElement.text() || 'Texte'; + + textElement.text('') + + svgDrawing.select('g[data-name="texts-layer"]') + .selectAll('foreignObject#textEdition') + .data([text]) + .enter() + .append('foreignObject') + .attr('id', 'textEdition') + .attr('x', textElement.attr('x')) + .attr('y', textElement.attr('y')) + .attr('height', 500) + .attr('width', 500) + .attr('font-family', textElement.attr('font-family')) + .attr('font-size', textElement.attr('font-size')) + .attr('font-weight', textElement.attr('font-weight')) + .attr('fill', textElement.attr('fill')) + .classed('edition', true) + .append('xhtml:p') + .attr('contentEditable', 'true') + .text(text) + .on('click', function() { + d3.event.stopPropagation(); + }) + .on('mousedown', function() { + d3.event.stopPropagation(); + }) + .on('keydown', function() { + d3.event.stopPropagation(); + + if (d3.event.keyCode === 13 && !d3.event.shiftKey) { + this.blur(); + } + }) + .on('blur', function() { + angular.forEach(this.childNodes, function(node) { + var data = node.data; + + if (data) { + textElement + .attr('text-anchor', 'start') + .append('tspan') + .attr('text-anchor', 'start') + .attr('x', function() { + return d3.select(this.parentNode).attr('x'); + }) + .attr('dy', 40) + .text(data); + } + }); + d3.select(this.parentElement).remove(); + + d3.select('.edition').classed('edition', false); + textElement.style('cursor','text') + .on('click', function(event) { + // when we click in the text, we will enter the edition mode + d3.event.stopPropagation(); + setTextEditable(d3.select(this)) + }) + .attr('id', null); + + deferred.resolve(textElement); + }); + + selectElementContents( + d3.selectAll('foreignObject#textEdition') + .selectAll('p') + .node()); + + return deferred.promise; + } + + + } + + angular.module(moduleApp).service('ToolboxTextService', ToolboxTextService); + + ToolboxTextService.$inject = ['GeneratorService', 'UtilService', '$q'] + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ToolboxPolylineService + * @description + * Expose different methods to draw on the d3 svg area + */ +(function() { + 'use strict'; + + function ToolboxPolylineService(RadialMenuService, GeneratorService, UtilService) { + + this.init = init; + this.beginLineOrPolygon = beginLineOrPolygon; + this.drawHelpLineOrPolygon = drawHelpLineOrPolygon; + this.finishLineOrPolygon = finishLineOrPolygon; + + var svgDrawing, + applyStyle ; + + function init(_svgDrawing, _applyStyle) { + svgDrawing = _svgDrawing; + applyStyle = _applyStyle; + } + + + function beginLineOrPolygon(x, y, style, color, contour, mode, lastPoint, lineEdit) { + var drawingLayer = svgDrawing.select('g[data-name="' + mode + 's-layer"]'), + path, + pathInner; + + // follow the line / polygon + if (d3.select('.edition')[0][0]) { + path = d3.select('.edition'); + + if (mode === 'line') { + pathInner = d3.select('.edition.inner'); + } + + } else { + // first click + // lineEdit = []; + path = drawingLayer + .append('path') + .attr({'class': 'edition'}); + + applyStyle(path, style.style, color); + + if (contour && !path.attr('stroke')) { + path.attr('stroke', 'black') + .attr('stroke-width', '2'); + } + + if (mode === 'line') { + pathInner = drawingLayer + .append('path') + .attr({'class': 'edition inner'}); + applyStyle(pathInner, style.styleInner, color); + } + } + + if (lastPoint) { + var tanAngle = Math.abs((y - lastPoint.y) / (x - lastPoint.x)), + tan5 = Math.tan((5 * 2 * Math.PI) / 360), + tan85 = Math.tan((85 * 2 * Math.PI) / 360); + + // If the ctrlKey is pressed + // draw horizontal or vertical lines + // with a tolerance of 5° + if (d3.event && d3.event.ctrlKey + && (tanAngle < tan5 || tanAngle > tan85)) { + if (tanAngle < tan5) { + y = lastPoint.y; + } else { + x = lastPoint.x; + } + } + } + + lineEdit.push([x, y]); + path.attr({ + d: GeneratorService.pathFunction[mode](lineEdit) + }); + + if (mode === 'line') { + pathInner.attr({ + d: GeneratorService.pathFunction[mode](lineEdit) + }); + } + applyStyle(path, style.style, color); + + if (contour && !path.attr('stroke')) { + path.attr('stroke', 'black') + .attr('stroke-width', '2'); + } + + if (mode === 'line') { + applyStyle(pathInner, style.styleInner, color); + } + } + + function drawHelpLineOrPolygon(x, y, style, color, contour, mode, lastPoint) { + if (lastPoint) { + var drawingLayer = svgDrawing.select('g[data-name="' + mode + 's-layer"]'), + line; + + if (d3.select('.ongoing')[0][0]) { + line = d3.select('.ongoing'); + } else { + line = drawingLayer + .append('line') + .attr({'class': 'ongoing'}); + applyStyle(line, style.style, color); + + if (contour && !line.attr('stroke')) { + line.attr('stroke', 'black') + .attr('stroke-width', '2'); + } + } + var tanAngle = Math.abs((y - lastPoint.y) / (x - lastPoint.x)), + tan5 = Math.tan((5 * 2 * Math.PI) / 360), + tan85 = Math.tan((85 * 2 * Math.PI) / 360); + + // If the ctrlKey is pressed + // draw horizontal or vertical lines + // with a tolerance of 5° + if (d3.event && d3.event.ctrlKey + && (tanAngle < tan5 || tanAngle > tan85)) { + if (tanAngle < tan5) { + y = lastPoint.y; + } else { + x = lastPoint.x; + } + } + + line.attr('x1', lastPoint.x) + .attr('y1', lastPoint.y) + .attr('x2', x) + .attr('y2', y); + } + } + + function finishLineOrPolygon(x, y, style, color, mode) { + var iid = UtilService.getiid(); + + if (mode === 'line') { + d3.select('.edition.inner') + .classed('edition', false) + .classed('link_' + iid, true) + .attr('data-link', iid); + } + + d3.select('.edition').attr('e-style', style.id) + .attr('e-color', color.color); + + d3.select('.edition') + .classed('edition', false) + .classed('link_' + iid, true) + .attr('data-type', mode) + .attr('data-from', 'drawing') + .attr('data-link', iid); + + d3.select('.ongoing').remove(); + + } + + } + + angular.module(moduleApp).service('ToolboxPolylineService', ToolboxPolylineService); + + ToolboxPolylineService.$inject = ['RadialMenuService', 'GeneratorService', 'UtilService']; + +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.DrawingService + * @requires accessimapEditeurDerApp.LayerService + * @requires accessimapEditeurDerApp.ToolboxService + * @description + * Service providing drawing functions + * Provide functions to + * - init a map/draw area + * - draw features + */ +(function() { + 'use strict'; + + function DrawingService(LayerService, ToolboxService) { + + this.initDrawing = initDrawing; + + this.toolbox = ToolboxService; + this.layers = LayerService; + this.updatePoint = updatePoint; + + /** + * @ngdoc method + * @name accessimapEditeurDerApp.DrawingService.initDrawing + * @methodOf accessimapEditeurDerApp.DrawingService + * + * @description + * Create the drawing svg in a dom element with specific size + * + * @param {Object} elements + * Object containing each layer (overlay, drawing, geojson) with a sel & proj property + * + * These properties are given by D3SvgOverlay and help us to display at the right place features & drawings + * + * @param {enum} format + * Format (landscapeA4, landscapeA3, ...) of the drawing + * + */ + function initDrawing(elements, format) { + + LayerService.createLayers(elements, format) + + ToolboxService.init(LayerService.drawing.getLayer(), + LayerService.overlay.getLayer(), + LayerService.overlay.getZoom ) + + } + + /** + * @ngdoc method + * @name updateFeatureStyleAndColor + * @methodOf accessimapEditeurDerApp.DrawingService + * + * @description + * Update the style (pattern) & color of a feature. + * Could be a geojson feature or a drawing feature. + * + * @param {Object} style + * SettingsService.STYLES object + * + */ + function updatePoint(style) { + + var currentSelection = d3.select('.styleEdition'), + featureId = currentSelection.attr('id'), + featureFrom = currentSelection.attr('data-from'); + + if (featureFrom === 'drawing') { + ToolboxService.updateFeatureStyleAndColor(style, null); + } else if (featureFrom === 'osm') { + // find the id of the current feature + var idFound = null, + currentParent = currentSelection.node().parentNode; + + while (! currentParent.getAttribute('id')) { + currentParent = currentParent.parentNode; + } + + layers.geojson.updateFeature(currentParent.getAttribute('id'), style) + } + currentSelection.classed('styleEdition', false) + } + + } + + angular.module(moduleApp).service('DrawingService', DrawingService); + + DrawingService.$inject = ['LayerService', 'ToolboxService']; + +})(); +/** + * @ngdoc service + * @name accessimapEditeurDerApp.GeneratorService + * + * @description + * Service providing function to draw lines, cardinal & polygon + */ +(function() { + 'use strict'; + + function GeneratorService() { + + this.lineFunction = d3.svg.line().x(function(d) { return d[0]; }) + .y(function(d) { return d[1]; }) + .interpolate('linear'); + + this.cardinalLineFunction = d3.svg.line().x(function(d) { return d[0]; }) + .y(function(d) { return d[1]; }) + .interpolate('cardinal'); + + this.polygonFunction = d3.svg.line().x(function(d) { return d[0]; }) + .y(function(d) { return d[1]; }) + .interpolate('linear-closed'); + + this.pathFunction = { + 'line': this.lineFunction, + 'polygon': this.polygonFunction + }; + + } + + angular.module(moduleApp).service('GeneratorService', GeneratorService); + +})(); +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name accessimapEditeurDerApp.ImportService + * @memberOf accessimapEditeurDerApp + * + * @description + * Provide service to import a drawing : + * - background layer + * - geojson layer + * - drawing layer + * - interactions + * - legend + */ + function ImportService(LayerService, InteractionService, LegendService, SettingsService, SVGService) { + + this.importDrawing = importDrawing; + this.importInteraction = importInteraction; + this.getModelFromSVG = getModelFromSVG; + + function isVersionOfSVGAcceptable(svgElement) { + + return svgElement.querySelector('svg').getAttribute('data-version') >= '0.1'; + + } + + function getModelFromSVG(svgElement) { + + var model = null; + + if (isVersionOfSVGAcceptable(svgElement)) { + var metadataModel = svgElement.querySelector('metadata[data-name="data-model"]'); + + if (metadataModel) { + model = JSON.parse(metadataModel.getAttribute('data-value')); + } + } + + if (! model) { + model = { + title : 'Nouveau dessin', + isMapVisible : false, + comment : 'Pas de commentaire', + mapFormat : 'landscapeA4', + legendFormat : 'landscapeA4', + backgroundColor : SettingsService.COLORS.transparent[0], // transparent + backgroundStyle : SettingsService.STYLES.polygon[SettingsService.STYLES.polygon.length - 1], + } + } + + return model; + } + + function cloneChildrenFromNodeAToB(nodeFrom, nodeTo, translationToApply) { + + var children = nodeFrom.children, + paths = nodeFrom.querySelectorAll('path,circle,line,text'); + + if (translationToApply) { + for (var i = 0; i < paths.length; i++) { + var currentD = paths[i].getAttribute('d'); + + if (currentD) { + var currentParseD = SVGService.parseSVGPath(currentD), + currentTranslateD = SVGService.translateSVGPath(currentParseD, + translationToApply.x, + translationToApply.y), + currentSerializeD = SVGService.serializeSVGPath(currentTranslateD); + + paths[i].setAttribute('d', currentSerializeD) + } else { + var cx = paths[i].getAttribute('cx'), + cy = paths[i].getAttribute('cy'), + x = paths[i].getAttribute('x'), + y = paths[i].getAttribute('y'); + + if (cx !== null ) { + paths[i].setAttribute('cx', parseFloat(cx) + translationToApply.x) + paths[i].setAttribute('cy', parseFloat(cy) + translationToApply.y) + } else { + paths[i].setAttribute('x', parseFloat(x) + translationToApply.x) + paths[i].setAttribute('y', parseFloat(y) + translationToApply.y) + } + + } + } + } + + var length = children.length; + + for (var i = 0; i < length; i++) { + nodeTo.appendChild(children[0]); + } + } + + /** + * @ngdoc method + * @name importDrawing + * @methodOf accessimapEditeurDerApp.ImportService + * + * @description + * Import data from the svgElement by trying to find the layers + * + * @param {DOM Element} svgElement + * the element to import for drawing purpose + */ + function importDrawing(svgElement) { + + var + + currentGeoJSONLayer = LayerService.geojson.getLayer().node(), + currentDrawingLayer = LayerService.drawing.getLayer().node(), + currentBackgroundLayer = LayerService.background.getLayer().node(), + + geojsonLayer = svgElement.querySelector('g[data-name="geojson-layer"]'), + drawingLayer = svgElement.querySelector('g[data-name="drawing-layer"]'), + backgroundLayer = svgElement.querySelector('g[data-name="background-layer"]'), + overlayLayer = svgElement.querySelector('svg[data-name="overlay"]'), + + metadataGeoJSON = svgElement.querySelector('metadata[data-name="data-geojson"]'), + // metadataInteractions = svgElement.querySelector('metadata[data-name="data-interactions"]'), + + format = svgElement.querySelector('svg').getAttribute('data-format'), + center = svgElement.querySelector('svg').getAttribute('data-center'), + + currentOverlayTranslation = LayerService.overlay.getTranslation(), + + translateScaleOverlayGroup = overlayLayer && overlayLayer.getAttribute('transform'), + + translateOverlayGroup = ( translateScaleOverlayGroup === null ) + ? null + : translateScaleOverlayGroup + .substring(translateScaleOverlayGroup.indexOf('(') + 1, + translateScaleOverlayGroup.indexOf(')')), + + translateOverlayGroupArray = ( translateOverlayGroup === null ) ? [0, 0] + : translateOverlayGroup.slice(0, translateOverlayGroup.length).split(','), + + translateMarginGroup = overlayLayer + && overlayLayer.querySelector('g[id="margin-layer"]').getAttribute('transform'), + + translateMargin = ( translateMarginGroup === null ) + ? null + : translateMarginGroup + .substring(translateMarginGroup.indexOf('(') + 1, + translateMarginGroup.indexOf(')')), + + translateMarginArray = ( translateMargin === null ) ? [0, 0] + : translateMargin.slice(0, translateMargin.length).split(','), + + translationToApply = { x: currentOverlayTranslation.x + - translateOverlayGroupArray[0] + - translateMarginArray[0], + y: currentOverlayTranslation.y + - translateOverlayGroupArray[1] + - translateMarginArray[1] + }; + + if (isVersionOfSVGAcceptable(svgElement)) { + + // if exists, inserts data of the geojson layers + if (geojsonLayer) { + cloneChildrenFromNodeAToB(geojsonLayer, currentGeoJSONLayer, translationToApply); + } + + // if exists, inserts data of the drawing layers + if (drawingLayer) { + cloneChildrenFromNodeAToB(drawingLayer, currentDrawingLayer, translationToApply); + } + + // if exists, inserts data of the drawing layers + if (backgroundLayer) { + cloneChildrenFromNodeAToB(backgroundLayer, currentBackgroundLayer, translationToApply); + } + + if (metadataGeoJSON && metadataGeoJSON.getAttribute('data-value') !== '') { + var dataGeoJSON = JSON.parse(metadataGeoJSON.getAttribute('data-value')); + LayerService.geojson.setFeatures(dataGeoJSON); + generateLegend(dataGeoJSON); + } + + } else { + // it's not a draw from the der, but we will append each element in the 'drawing section' + // we remove metadata, namedview elements because it crash the export + var metadata = svgElement.querySelector('metadata'), + namedview = svgElement.querySelector('namedview'), + translationToApply = 'translate(' + translationToApply.x + ',' + translationToApply.y + ')'; + + if (metadata) metadata.remove(); + + if (namedview) namedview.remove(); + + LayerService.drawing.appendSvg(svgElement, translationToApply); + } + + } + + function generateLegend(dataGeoJSON) { + dataGeoJSON.forEach(function(element, index, array) { + var currentStyle = SettingsService.STYLES[element.type].find(function(style, index, array) { + return style.id = element.style.id; + }) + LegendService.addItem(element.id, + element.name, + element.type, + currentStyle, + element.color, + element.contour) + }) + } + + function importInteraction(interactionData) { + + // insertion of filters + var filters = interactionData.querySelectorAll('filter'); + + // we don't take the first filter, because it's the OSM Value by default in a DER + for (var i = 1; i < filters.length; i++) { + InteractionService.addFilter(filters[i].getAttribute('name'), + filters[i].getAttribute('gesture'), + filters[i].getAttribute('protocol'), filters[i].getAttribute('id')) + } + + // insertion of interactions + var pois = interactionData.querySelectorAll('poi'); + + for (var i = 0; i < pois.length; i++) { + var actions = pois[i].querySelectorAll('action'); + + for (var j = 0; j < actions.length; j++) { + InteractionService.setInteraction(pois[i].getAttribute('id'), + actions[j].getAttribute('filter'), + actions[j].getAttribute('value')); + } + } + + } + + } + + angular.module(moduleApp).service('ImportService', ImportService); + + ImportService.$inject = ['LayerService', 'InteractionService', 'LegendService', 'SettingsService', 'SVGService']; + +})(); + +(function() { + 'use strict'; + + /*global JSZip, saveAs */ + /** + * @ngdoc service + * @name accessimapEditeurDerApp.ExportService + * @memberOf accessimapEditeurDerApp + * @module + * @description + * Service in the accessimapEditeurDerApp. + */ + function ExportService(InteractionService, LegendService, DrawingService, DefsService, MapService, $q) { + + this.exportData = exportData; + + var exportVersion = '0.1'; + + // TODO: add parameters to not have to use DOM selectors. + // this function have to be independant from the DOM + // To be added : drawingNode, legendNode, interactions + function exportData(model) { + + var deferred = $q.defer(); + + if (! model.title) + model.title = 'der'; + + var node = MapService.getMap().getPanes().mapPane, + transformStyle = $(node).css('transform'), + drawingNode = MapService.getMap().getContainer(), + tilesNode = null, + legendNode = LegendService.getNode(), + comments = $('#comment').val(), + interactionsContentXML = InteractionService.getXMLExport(), + titleDrawing = document.createElementNS("http://www.w3.org/2000/svg", "title"), + + zip = new JSZip(), + exportNode = drawingNode ? drawingNode.cloneNode(true) : null, + sizeDrawing = DrawingService.layers.overlay.getSize() , + svgDrawing = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + + d3.select(svgDrawing) + .attr('data-version', exportVersion) + .attr('width', sizeDrawing.width) + .attr('height', sizeDrawing.height) + .style('overflow', 'visible') + + // patterns + DefsService.createDefs(d3.select(svgDrawing)) + + // get transform attribute of margin / frame layers + var translateOverlayArray = DrawingService.layers.overlay.getTranslation(), + translateReverseOverlayPx = "translate(" + ( translateOverlayArray.x * -1 ) + 'px,' + + ( translateOverlayArray.y * -1 ) + 'px)'; + + d3.select(svgDrawing).attr('viewBox', translateOverlayArray.x + ' ' + + translateOverlayArray.y + ' ' + + sizeDrawing.width + ' ' + sizeDrawing.height) + + function filterDOM(node) { + return (node.tagName !== 'svg') + } + + // TODO: union promises with a Promise.all to maintain a sequence programmation + + // TODO: inject DEFS ? il manque les fill patterns + var defs = DefsService.createDefs(d3.select(node)) + function initNodeState() { + defs.remove() + $(node).css('transform', transformStyle) + } + + $(node).css('transform', translateReverseOverlayPx); + domtoimage.toPng(node, {width: sizeDrawing.width, height: sizeDrawing.height/*, filter: filterDOM */}) + .then(function(dataUrl) { + + // save the image in a file & add it to the current zip + var imgBase64 = dataUrl.split('base64,') + zip.file('carte.png', imgBase64[1], {base64: true}); + + // add the current image to a svg:image element + var image = document.createElementNS("http://www.w3.org/2000/svg", "image"); + d3.select(image) + .attr('width', sizeDrawing.width) + .attr('height', sizeDrawing.height) + .attr('x', translateOverlayArray.x) + .attr('y', translateOverlayArray.y) + .attr('xlink:href', dataUrl) + + // create some metadata object + var metadataGeoJSON = document.createElementNS("http://www.w3.org/2000/svg", "metadata"), + // metadataInteractions = document.createElementNS("http://www.w3.org/2000/svg", "metadata"), + metadataModel = document.createElementNS("http://www.w3.org/2000/svg", "metadata"); + + metadataGeoJSON.setAttribute('data-name', 'data-geojson') + metadataGeoJSON.setAttribute('data-value', + JSON.stringify(DrawingService.layers.geojson.getFeatures())) + + // metadataInteractions.setAttribute('data-name', 'data-interactions') + // metadataInteractions.setAttribute('data-value', interactionsContentXML) + + metadataModel.setAttribute('data-name', 'data-model') + metadataModel.setAttribute('data-value', JSON.stringify(model)) + + // Assembly of 'carte_avec_source.svg' + svgDrawing.appendChild(metadataGeoJSON); + // svgDrawing.appendChild(metadataInteractions); + svgDrawing.appendChild(metadataModel); + + svgDrawing.appendChild(image); + + svgDrawing.appendChild(d3.select(exportNode) + .select("svg[data-name='background']") + .style('overflow', 'visible').node()); + svgDrawing.appendChild(d3.select(exportNode) + .select("svg[data-name='geojson']") + .style('overflow', 'visible').node()); + svgDrawing.appendChild(d3.select(exportNode) + .select("svg[data-name='drawing']") + .style('overflow', 'visible').node()); + svgDrawing.appendChild(d3.select(exportNode) + .select("svg[data-name='overlay']") + .style('overflow', 'visible').node()); + + zip.file('carte_avec_source.svg', (new XMLSerializer()).serializeToString(svgDrawing)); + + // Assembly of 'carte_sans_source.svg' => remove tiles + svgDrawing.removeChild(image); + + zip.file('carte_sans_source.svg', (new XMLSerializer()).serializeToString(svgDrawing)); + + // Assembly of legend + if (legendNode) { + + var svgLegend = document.createElementNS("http://www.w3.org/2000/svg", "svg"), + sizeLegend = LegendService.getSize(), + legendNodeClone = legendNode.cloneNode(true); + + DefsService.createDefs(d3.select(svgLegend)) + + d3.select(svgLegend) + .attr('data-version', exportVersion) + .attr('width', sizeLegend.width) + .attr('height', sizeLegend.height) + .attr('viewBox', '0 0 ' + sizeLegend.width + ' ' + sizeLegend.height) + .style('overflow', 'visible') + + svgLegend.appendChild(legendNodeClone); + + zip.file('legende.svg', (new XMLSerializer()).serializeToString(svgLegend)); + } + + // Adding the comments + zip.file('commentaires.txt', comments); + + // Adding the interactions + zip.file('interactions.xml', interactionsContentXML); + + domtoimage.toPng(node, {width: sizeDrawing.width, height: sizeDrawing.height}) + .then(function(dataUrl) { + + initNodeState(); + + // save the image in a file & add it to the current zip + var imgBase64 = dataUrl.split('base64,') + zip.file('der.png', imgBase64[1], {base64: true}); + + // get the Braille Font & add it to the current zip + var urlFont = window.location.origin + // pathname could be a path like 'xxx/#/route' or 'xxx/file.html' + // we have to obtain 'xxx' string + + ( window.location.pathname !== undefined + ? window.location.pathname.substring(0,window.location.pathname.lastIndexOf('/')) + : '' ) + + '/assets/fonts/Braille_2007.ttf'; + + $.ajax({ + url: urlFont, + type: "GET", + dataType: 'binary', + processData: false, + success: function(result) { + zip.file('Braille_2007.ttf', result, {binary: true}) + zip.generateAsync({type: 'blob'}) + .then(function(content) { + saveAs(content, model.title + '.zip'); + deferred.resolve(model.title + '.zip'); + }).catch(deferred.reject) + }, + error: function(error) { + deferred.reject('Braille font ' + error.statusText) + } + }) + + }).catch(function(error) { + initNodeState(); + deferred.reject(error); + }) + + }).catch(deferred.reject) + + return deferred.promise; + } + + } + + angular.module(moduleApp).service('ExportService', ExportService); + + ExportService.$inject = ['InteractionService', 'LegendService', 'DrawingService', + 'DefsService', 'MapService', '$q']; +})(); + +/** + * @ngdoc service + * @name accessimapEditeurDerApp.ModeService + * + * @description + * Manage events (map, d3) in the editor + * + */ +(function() { + 'use strict'; + + function ModeService(MapService, DrawingService, SettingsService, SelectPathService) { + + this.init = init; + + this.resetState = resetState; + this.initMode = initMode; + + this.enableDefaultMode = enableDefaultMode; + this.enableSelectMode = enableSelectMode; + this.enablePointMode = enablePointMode; + this.enableCircleMode = enableCircleMode; + this.enableSquareMode = enableSquareMode; + this.enableTriangleMode = enableTriangleMode; + this.enableTextMode = enableTextMode; + this.enableImageMode = enableImageMode; + this.enableLineOrPolygonMode = enableLineOrPolygonMode; + + this.enableAddPOI = enableAddPOI; + this.disableAddPOI = disableAddPOI; + + var projection ; + + function init(_projection) { + projection = _projection; + } + + function initMode() { + + MapService.resetCursor(); + MapService.removeEventListeners(); + MapService.addEventListener([ 'click', 'contextmenu', 'mousemove', 'mousedown', 'mouseup' ], function(e) { + e.originalEvent.stopImmediatePropagation(); + }) + + DrawingService.toolbox.hideContextMenus(); + DrawingService.toolbox.hideSelectPaths(); + + } + + function resetState() { + d3.selectAll('path:not(.menu-segment)').on('click', function() {}); + d3.selectAll('svg').on('click', function() {}); + d3.select('body').on('keydown', function() {}); + + MapService.resetCursor(); + + d3.selectAll('.ongoing').remove(); + + // d3.selectAll('.blink').classed('blink', false); + d3.selectAll('.edition').classed('edition', false); + d3.selectAll('.styleEdition').classed('styleEdition', false); + d3.selectAll('.highlight').classed('highlight', false); + + MapService.removeEventListeners(); + } + + + /** + * @ngdoc method + * @name enableSelectMode + * @methodOf accessimapEditeurDerApp.ModeService + * + * @description + + * Enable the select mode : + * + * - user can select items and edit them + * + * - user can right click on an item and get a context menu + */ + function enableSelectMode() { + + initMode(); + + DrawingService.toolbox.addContextMenus(); + DrawingService.toolbox.addSelectPaths(); + + MapService.removeEventListener(['mousemove', 'mousedown', 'mouseup']); + + + } + + /** + * @ngdoc method + * @name enableDefaultMode + * @methodOf accessimapEditeurDerApp.ModeService + * + * @description + * + * Enable the select mode : + * + * - user can select items and edit them + * + * - user can right click on an item and get a context menu + */ + function enableDefaultMode() { + MapService.resetCursor(); + MapService.removeEventListeners(); + DrawingService.toolbox.hideContextMenus(); + DrawingService.toolbox.hideSelectPaths(); + } + + function enablePointMode(getDrawingParameter) { + + initMode(); + + MapService.changeCursor('crosshair'); + // MapService.addClickListener(function(e) { + MapService.addEventListener([ 'mouseup' ] , function(e) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + DrawingService.toolbox.drawPoint(p.x, p.y, drawingParameters.style, drawingParameters.color); + }) + + } + + function enableCircleMode(getDrawingParameter) { + + initMode(); + + MapService.changeCursor('crosshair'); + MapService.addEventListener([ 'mousedown', 'mouseup' ] , function(e) { + // only left click + if (e.originalEvent.button === 0) { + + e.originalEvent.stopImmediatePropagation() + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + + DrawingService.toolbox.drawCircle(p.x, p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.contour) + + MapService.addMouseMoveListener(function(e) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + DrawingService.toolbox.updateCircleRadius(p.x, p.y, e.originalEvent.shiftKey); + }) + + } + }) + + + } + + function enableSquareMode(getDrawingParameter) { + + initMode(); + + MapService.changeCursor('crosshair'); + MapService.addEventListener([ 'mousedown' ] , function(e) { + // only left click + // e.originalEvent.stopImmediatePropagation() + if (e.originalEvent.button === 0) { + + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + + DrawingService.toolbox.drawSquare(p.x, p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.contour) + + MapService.addEventListener([ 'mousemove' ] , function(e) { + + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + + DrawingService.toolbox.updateSquare(p.x, p.y, e.originalEvent.shiftKey); + + MapService.addEventListener([ 'mouseup' ] , function(e) { + // only left click + e.originalEvent.stopImmediatePropagation() + if (e.originalEvent.button === 0) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + DrawingService.toolbox.drawSquare(p.x, p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.contour) + enableSquareMode(getDrawingParameter) + } + }) + + }) + + } + + }) + + } + + function enableTriangleMode(getDrawingParameter) { + + initMode(); + + MapService.changeCursor('crosshair'); + MapService.addEventListener([ 'mousedown' ] , function(e) { + // only left click + // e.originalEvent.stopImmediatePropagation() + if (e.originalEvent.button === 0) { + + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + + DrawingService.toolbox.drawTriangle(p.x, p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.contour) + + MapService.addEventListener([ 'mousemove' ] , function(e) { + + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + + DrawingService.toolbox.updateTriangle(p.x, p.y, e.originalEvent.shiftKey); + + MapService.addEventListener([ 'mouseup' ] , function(e) { + // only left click + e.originalEvent.stopImmediatePropagation() + if (e.originalEvent.button === 0) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + DrawingService.toolbox.drawTriangle(p.x, p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.contour) + enableTriangleMode(getDrawingParameter) + } + }) + + }) + + } + + }) + + } + + function enableLineOrPolygonMode(getDrawingParameter) { + + initMode(); + + var lastPoint = null, + lineEdit = []; + + MapService.changeCursor('crosshair'); + MapService.addEventListener([ 'click' ], function(e) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + DrawingService.toolbox.beginLineOrPolygon(p.x, + p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.contour, + drawingParameters.mode, + lastPoint, + lineEdit); + lastPoint = p; + }) + + MapService.addEventListener([ 'mousemove' ], function(e) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + DrawingService.toolbox.drawHelpLineOrPolygon(p.x, + p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.contour, + drawingParameters.mode, + lastPoint); + }) + + MapService.addEventListener([ 'contextmenu' ], function(e) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + DrawingService.toolbox.finishLineOrPolygon(p.x, + p.y, + drawingParameters.style, + drawingParameters.color, + drawingParameters.mode); + lastPoint = null; + lineEdit = []; + }) + + } + + function enableTextMode(getDrawingParameter) { + + initMode(); + + MapService.changeCursor('crosshair'); + MapService.addEventListener([ 'click' ], function(e) { + var p = projection.latLngToLayerPoint(e.latlng), + drawingParameters = getDrawingParameter(); + + DrawingService.toolbox.writeText(p.x, p.y, drawingParameters.font, drawingParameters.fontColor) + .then(function addAgainClickListener(element) { + MapService.addEventListener([ 'click' ], function(e) { + enableTextMode(getDrawingParameter) + }) + }) + + // to prevent the draw of a new text feature + MapService.removeEventListener(['click']); + }) + + } + + function enableImageMode(getDrawingParameter) { + + initMode(); + + } + + /** + * @ngdoc method + * @name enableAddPOI + * @methodOf accessimapEditeurDerApp.ModeService + * + * @description + * Enable the 'Add POI' mode, + * allowing user to click on the map and retrieve data from OSM + * + * @param {function} _successCallback + * Callback function called when data has been retrieved, data is passed in first argument + * + * @param {function} _errorCallback + * Callback function called when an error occured, error is passed in first argument + */ + function enableAddPOI(_warningCallback, _errorCallback, _currentParametersFn) { + + initMode(); + + MapService.changeCursor('crosshair'); + + MapService.addEventListener([ 'click' ], function(e) { + + var currentParameters = _currentParametersFn(), + styleChosen = SettingsService.ALL_STYLES.find(function(element, index, array) { + return element.id === currentParameters.style.id; + }), + colorChosen = SettingsService.ALL_COLORS.find(function(element, index, array) { + return element.id === currentParameters.color.id; + }) + // TODO: prevent any future click + // user has to wait before click again + MapService.changeCursor('progress'); + + MapService + .retrieveData([e.latlng.lng, e.latlng.lat], SettingsService.QUERY_LIST[0]) + .then(function successCallback(osmGeojson) { + if (!osmGeojson) { + _errorCallback('Erreur lors de la recherche de POI... Merci de recommencer.') + } + + if (osmGeojson.features && osmGeojson.features.length > 0) { + DrawingService.layers.geojson.geojsonToSvg(osmGeojson, + null, + 'node_' + osmGeojson.features[0].properties.id, + true, + SettingsService.QUERY_POI, + styleChosen, + SettingsService.STYLES[SettingsService.QUERY_POI.type], + colorChosen, null, null) + } else { + _warningCallback('Aucun POI trouvé à cet endroit... Merci de cliquer ailleurs !?') + } + }) + .catch(_errorCallback) + .finally(function finallyCallback() { + MapService.changeCursor('crosshair'); + }) + }) + } + + /** + * @ngdoc method + * @name disableAddPOI + * @methodOf accessimapEditeurDerApp.ModeService + * + * @description + * Disable the 'Add POI' mode by resetting CSS cursor. + * + */ + function disableAddPOI() { + MapService.resetCursor(); + } + + } + + angular.module(moduleApp).service('ModeService', ModeService); + + ModeService.$inject = ['MapService', 'DrawingService', 'SettingsService', 'SelectPathService']; + +})(); +// jscs:disable maximumNumberOfLines +/** + * @ngdoc service + * @name accessimapEditeurDerApp.EditService + * + * @requires accessimapEditeurDerApp.SettingsService + * @requires accessimapEditeurDerApp.MapService + * @requires accessimapEditeurDerApp.DrawingService + * @requires accessimapEditeurDerApp.LegendService + * @requires accessimapEditeurDerApp.DefsService + * @requires accessimapEditeurDerApp.InteractionService + * @requires accessimapEditeurDerApp.ExportService + * @requires accessimapEditeurDerApp.UtilService + * @requires accessimapEditeurDerApp.ImportService + * @requires accessimapEditeurDerApp.ModeService + * + * @description + * Service used for the 'EditController', and the 'edit' view + * + * Provide functions to + * - init a map/draw area + * - draw features + * - export data + */ +(function() { + 'use strict'; + + function EditService($q, SettingsService, MapService, DrawingService, LegendService, + DefsService, InteractionService, ExportService, UtilService, ImportService, + FeatureService, ModeService, RadialMenuService) { + + this.init = init; + this.settings = SettingsService; + this.featureIcon = DrawingService.toolbox.featureIcon; + this.insertOSMData = insertOSMData; + + this.enableAddPOI = ModeService.enableAddPOI; + this.disableAddPOI = ModeService.disableAddPOI; + + // Drawing services + // TODO : reset action has to work correctly for event... + // we have to use map event or d3 event... not both (mea culpa) + this.resetState = ModeService.resetState; + + // Toolbox + this.drawPoint = DrawingService.toolbox.drawPoint; + this.drawCircle = DrawingService.toolbox.drawCircle; + this.changeTextColor = DrawingService.toolbox.changeTextColor; + this.updateBackgroundStyleAndColor = DrawingService.toolbox.updateBackgroundStyleAndColor; + this.updateFeatureStyleAndColor = DrawingService.toolbox.updateFeatureStyleAndColor; + this.updateMarker = DrawingService.toolbox.updateMarker; + this.updatePoint = DrawingService.updatePoint; + + this.isUndoAvailable = FeatureService.isUndoAvailable; + this.undo = FeatureService.undo; + + this.enableDefaultMode = ModeService.enableDefaultMode; + this.enableSelectMode = ModeService.enableSelectMode; + this.enablePointMode = ModeService.enablePointMode; + this.enableCircleMode = ModeService.enableCircleMode; + this.enableSquareMode = ModeService.enableSquareMode; + this.enableTriangleMode = ModeService.enableTriangleMode; + this.enableLineOrPolygonMode = ModeService.enableLineOrPolygonMode; + this.enableTextMode = ModeService.enableTextMode; + this.enableImageMode = ModeService.enableImageMode; + + this.exportData = function(model) { + var deferred = $q.defer(); + + model.center = DrawingService.layers.overlay.getCenter(); + model.zoom = zoom ? zoom : MapService.getMap().getZoom(); + model.mapIdVisible = MapService.getBaseLayerId(); + + MapService.resetView(model.center, model.zoom, function() { + ExportService.exportData(model).then(function() { + deferred.resolve() + }) + .catch(deferred.reject) + }); + + return deferred.promise; + } + + // Map services + this.showMapLayer = MapService.showMapLayer; + this.hideMapLayer = MapService.hideMapLayer; + + this.geojsonToSvg = DrawingService.layers.geojson.geojsonToSvg; + this.getFeatures = DrawingService.layers.geojson.getFeatures; + + this.removeFeature = DrawingService.layers.geojson.removeFeature; + this.updateFeature = DrawingService.layers.geojson.updateFeature; + this.rotateFeature = DrawingService.layers.geojson.rotateFeature; + + this.searchAndDisplayAddress = searchAndDisplayAddress; + this.fitBounds = function (latlng) { return MapService.getMap().fitBounds(latlng) }; + this.panTo = function (latlng) { return MapService.getMap().panTo(latlng) }; + + this.freezeMap = freezeMap; + + this.resetView = function(callback) { + MapService.resetView(center, zoom, callback); + } + + this.rotateMap = rotateMap; + + this.interactions = InteractionService; + + this.changeDrawingFormat = changeDrawingFormat; + this.changeLegendFormat = changeLegendFormat; + this.showFontBraille = LegendService.showFontBraille; + this.hideFontBraille = LegendService.hideFontBraille; + + this.importBackground = importBackground; + this.importImage = importImage; + this.appendSvg = appendSvg; + this.importDER = importDER; + + var d3Element = null, + overlayDrawing, + overlayGeoJSON, + overlayBackground, + overlay, + center = null, + zoom = null, + referenceBounds, // useful to remember where to center view + // useful to know if the map is 'freezed', + // that is to say it's not moving anymore inside the 'format overlay' + mapFreezed, + // indicates if the initial scaled have been defined + // to be used in d3svgoverlay + // if true, we don't need to init overlay anymore + scaleDefined = false; + + function freezeMap() { + mapFreezed = true; + MapService.removeMoveHandler(); + // MapService.removeViewResetHandler(); + if (scaleDefined!==true) { + scaleDefined = true; + } + + overlay.unFreezeScaling(); + overlayGeoJSON.unFreezeScaling(); + overlayDrawing.unFreezeScaling(); + overlayBackground.unFreezeScaling(); + + center = DrawingService.layers.overlay.getCenter(); + zoom = zoom ? zoom : MapService.getMap().getZoom(); + + } + + function initWorkspace() { + + mapFreezed = false; + scaleDefined = false; + + MapService.addMoveHandler(function(size, pixelOrigin, pixelBoundMin) { + // if scale is not defined, + // we have to re draw the overlay to keep the initial format / position + if (scaleDefined!==true) { + DrawingService.layers.background.refresh(size, pixelOrigin, pixelBoundMin); + DrawingService.layers.overlay.refresh(size, pixelOrigin, pixelBoundMin); + } + }) + + MapService.addClickHandler(); + + overlay.freezeScaling(); + overlayGeoJSON.freezeScaling(); + overlayDrawing.freezeScaling(); + overlayBackground.freezeScaling(); + + center = null; + zoom = null; + } + + /** + * @ngdoc method + * @name init + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * Initialize the different services : + * - MapLeaflet to init the map container + * - Drawing to init the d3 container + * - Legend to init the legend container + * + * Link the map & the d3 container on 'move' and 'viewreset' events + * + * @param {[type]} drawingFormat + * Printing format of the d3 container and the map container + * + * @param {[type]} legendFormat + * Printing format of the legend container + */ + var selBackground, selOverlay, selDrawing, selGeoJSON, + projBackground, projOverlay, projDrawing, projGeoJSON, + currentDrawingFormat, currentLegendFormat ; + + function init(drawingFormat, legendFormat) { + + currentDrawingFormat = (drawingFormat === undefined + && SettingsService.FORMATS[drawingFormat] === undefined) + ? SettingsService.FORMATS[SettingsService.DEFAULT_DRAWING_FORMAT] + : SettingsService.FORMATS[drawingFormat]; + currentLegendFormat = (legendFormat === undefined + && SettingsService.FORMATS[legendFormat] === undefined) + ? SettingsService.FORMATS[SettingsService.DEFAULT_LEGEND_FORMAT] + : SettingsService.FORMATS[legendFormat]; + + MapService.init('workspace', drawingFormat, SettingsService.ratioPixelPoint, MapService.resizeFunction); + + // Background used to import images, svg or pdf to display a background helper + overlayBackground = L.d3SvgOverlay(function(sel, proj) { + selBackground = sel; + projBackground = proj; + }, { zoomDraw: true, zoomHide: false, name: 'background'}); + overlayBackground.addTo(MapService.getMap()) + overlayBackground.freezeScaling(); + + // Overlay used to import GeoJSON features from OSM + overlayGeoJSON = L.d3SvgOverlay(function(sel, proj) { + selGeoJSON = sel; + projGeoJSON = proj; + + DrawingService.layers._elements.geojson.sel = sel; + DrawingService.layers._elements.geojson.sel = proj; + + // if map is freezed, we just use the translate / zoom from d3svgoverlay + // if not, we re draw the geojson features with reverse scaling + if (mapFreezed !== true){ + DrawingService.layers.geojson.refresh(proj); + } + + }, { zoomDraw: true, zoomHide: false, name: 'geojson'}); + overlayGeoJSON.addTo(MapService.getMap()) + overlayGeoJSON.freezeScaling(); + + // Overlay used to draw shapes + overlayDrawing = L.d3SvgOverlay(function(sel, proj) { + selDrawing = sel; + projDrawing = proj; + DrawingService.layers._elements.drawing.sel = sel; + DrawingService.layers._elements.drawing.sel = proj; + }, { zoomDraw: true, zoomHide: false, name: 'drawing'}); + overlayDrawing.addTo(MapService.getMap()) + overlayDrawing.freezeScaling(); + + // Overlay used to display the printing format + overlay = L.d3SvgOverlay(function(sel, proj) { + selOverlay = sel; + projOverlay = proj; + }, { zoomDraw: false, zoomHide: false, name: 'overlay'}); + overlay.addTo(MapService.getMap()) + overlay.freezeScaling(); + + DrawingService.initDrawing({ + background: {sel: selBackground, proj: projBackground }, + overlay: {sel: selOverlay, proj: projOverlay }, + drawing: {sel: selDrawing, proj: projDrawing }, + geojson: {sel: selGeoJSON, proj: projGeoJSON } + }, + drawingFormat) + + initWorkspace(); + + MapService.getMap().setView(MapService.getMap().getCenter(), MapService.getMap().getZoom(), {reset:true}); + + // we create defs svg in a different svg of workspace & legend + // it's useful to let #legend & #workspace svg access to patterns + // created inside #pattern svg + DefsService.createDefs(d3.select('#pattern')); + + LegendService.init('#legend', + currentLegendFormat.width, + currentLegendFormat.height, + SettingsService.margin, + SettingsService.ratioPixelPoint, + RadialMenuService.addRadialMenu); + + FeatureService.init(selDrawing, projDrawing, MapService) + ModeService.init(projDrawing) + + } + + function changeDrawingFormat(format) { + // first, we set the initial state, center & zoom + MapService.resetView(center, zoom) + DrawingService.layers.overlay.setFormat(format); + DrawingService.layers.background.setFormat(format); + MapService.setMinimumSize(SettingsService.FORMATS[format].width / SettingsService.ratioPixelPoint, + SettingsService.FORMATS[format].height / SettingsService.ratioPixelPoint); + MapService.resizeFunction(); + center = DrawingService.layers.overlay.getCenter(); + MapService.resetView(center, zoom); + } + + function changeLegendFormat(format) { + LegendService.setFormat(SettingsService.FORMATS[format].width / SettingsService.ratioPixelPoint, + SettingsService.FORMATS[format].height / SettingsService.ratioPixelPoint); + } + + /** + * @ngdoc method + * @name insertOSMData + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * Retrieve data from nominatim (via MapService) for a specific 'query' + * + */ + function insertOSMData(query, _warningCallback, _errorCallback, _infoCallback, _currentParametersFn) { + + MapService.changeCursor('progress'); + _infoCallback('Récupération des données cartographiques en cours...'); + + var currentParameters = _currentParametersFn(), + styleChosen = SettingsService.ALL_STYLES.find(function(element, index, array) { + return element.id === currentParameters.style.id; + }), + colorChosen = SettingsService.ALL_COLORS.find(function(element, index, array) { + return element.name === currentParameters.color.name; + }), + queryChosen = SettingsService.QUERY_LIST.find(function(element, index, array) { + return element.id === query.id; + }), + checkboxModel = { contour: currentParameters.contour } + + MapService + .retrieveData(MapService.getBounds(), query) + .then(function successCallback(osmGeojson) { + if (!osmGeojson) { + _errorCallback('Erreur lors de la récupération des données cartographiques... ' + + 'Merci de recommencer.') + } + + if (osmGeojson.features && osmGeojson.features.length > 0) { + DrawingService.layers.geojson.geojsonToSvg(osmGeojson, + null, + 'node_' + osmGeojson.features[0].properties.id, + false, + queryChosen, + styleChosen, + SettingsService.STYLES[queryChosen.type], + colorChosen, checkboxModel, null) + } else { + _warningCallback('Aucune donnée cartographique trouvée... Merci de chercher autre chose !?') + } + + }) + .catch(_errorCallback) + .finally(function finallyCallback() { + MapService.resetCursor(); + }) + } + + /** + * @ngdoc method + * @name rotateMap + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * Rotate all '.rotable' elements + * + * @param {Object} angle + * Angle in degree of the rotation + */ + function rotateMap(angle) { + var size = MapService.getMap().getSize(); + + $('.leaflet-layer').css('transform', 'rotate(' + angle + 'deg)'); + //' ' + size.x / 2 + ' ' + size.y / 2 + ')'); + d3.selectAll('.rotable').attr('transform', 'rotate(' + angle + ')'); + //' ' + _width / 2 + ' ' + _height / 2 + ')'); + } + + /** + * @ngdoc method + * @name searchAndDisplayAddress + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * Search via nominatim & display the first result in d3 drawing + * + * Could be more clever by displaying all the results + * and allow the user to choose the right one... + * + * In a future version maybe ! + * + * @param {String} address + * Address to search & display + * + * @return {Promise} + * The promise of the search... could be successful, or not ! + */ + function searchAndDisplayAddress(address, id, label, style, color) { + var deferred = $q.defer(); + MapService.searchAddress(address) + .then(function(results) { + // if (results.length >= 1) { + // display something to allow user choose an option ? + // } else { + if (results.length > 0) + DrawingService.layers.geojson.drawAddress(results[0], id, label, style, color); + // } + deferred.resolve(results[0]); + }) + return deferred.promise; + } + + /** + * @ngdoc method + * @name importBackground + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * Import a file (SVG/PNG/JPEG/PDF) as a background of the current drawing + * + * Add it in the background layer + * + * @param {Object} element + * Input file to be uploaded & imported in the background + */ + function importBackground(element) { + + UtilService.uploadFile(element) + .then(function(data) { + switch (data.type) { + case 'image/svg+xml': + case 'image/png': + case 'image/jpeg': + DrawingService.layers.background.appendImage(data.dataUrl, + MapService.getMap().getSize(), + MapService.getMap().getPixelOrigin(), + MapService.getMap().getPixelBounds().min); + break; + + case 'application/pdf': + appendPdf(data.dataUrl); + break; + + default: + console.error('Mauvais format'); + } + }) + + } + + /** + * @ngdoc method + * @name importImage + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * Import an image file (SVG/PNG/JPEG) in the drawing layer, image group + * + * @param {Object} element + * Input file to be uploaded & imported in the drawing layer + */ + function importImage(element) { + + UtilService.uploadFile(element) + .then(function(data) { + switch (data.type) { + case 'image/svg+xml': + case 'image/png': + case 'image/jpeg': + DrawingService.layers.drawing.appendImage(data.dataUrl, + MapService.getMap().getSize(), + MapService.getMap().getPixelOrigin(), + MapService.getMap().getPixelBounds().min); + break; + + default: + console.error('Mauvais format'); + } + }) + + } + + /** + * @ngdoc method + * @name appendPdf + * @methodOf accessimapEditeurDerApp.EditService + * + * @description + * Append the first page of a pdf in the background layer + * + * @param {dataUrl} image + * dataUrl (could be png, jpg, ...) to insert in the background + * + */ + function appendPdf(dataURI) { + var BASE64_MARKER = ';base64,', + base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length, + base64 = dataURI.substring(base64Index), + raw = window.atob(base64), + rawLength = raw.length, + array = new Uint8Array(new ArrayBuffer(rawLength)); + + for (var i = 0; i < rawLength; i++) { + array[i] = raw.charCodeAt(i); + } + PDFJS.getDocument(array) + .then(function(pdf) { + pdf.getPage(1).then(function(page) { + var scale = 1.5, + viewport = page.getViewport(scale), + canvas = document.createElement('canvas'), //document.getElementById('pdf-canvas'), + context = canvas.getContext('2d'); + + canvas.height = viewport.height; + canvas.width = viewport.width; + + var renderContext = { + canvasContext: context, + viewport: viewport + }; + page.render(renderContext).then(function() { + DrawingService.layers.background.appendImage(canvas.toDataURL(), MapService.getMap().getSize(), + MapService.getMap().getPixelOrigin(), MapService.getMap().getPixelBounds().min); + }); + }); + }); + } + + function appendSvg(path) { + + d3.xml(path, function(xml) { + // adapt the format of the drawing + $(xml.documentElement).data('format') + + // Load polygon fill styles taht will be used on common map + var originalSvg = d3.select(xml.documentElement), + children = originalSvg[0][0].children, + returnChildren = function() { + return children[i]; + }; + + for (var i = 0; i < children.length; i++) { + var id = d3.select(children[i]).attr('id'), + element = d3.select(children[i]); + + if (id !== 'margin-layer' + && id !== 'frame-layer' + && id !== 'background-layer') { + d3.select(children[i]).classed('sourceDocument', true); + DrawingService.layers.background.append(returnChildren); + } + } + + }); + } + + function importDER(element) { + + var deferred = $q.defer(); + + function initUpload() { + + MapService.resetView(center, zoom); + + initWorkspace(); + + // empty the svg:g + // var currentGeoJSONLayer = DrawingService.layers.geojson.getLayer().node(), + // currentDrawingLayer = DrawingService.layers.drawing.getLayer().node(), + // currentBackgroundLayer = DrawingService.layers.background.getLayer().node(); + // + // // if map displayed, display it and center on the right place + // function removeChildren(node) { + // var children = node.children, + // length = children.length; + // + // for (var i = 0; i < length; i++) { + // node.removeChild(children[0]); // children list is live, removing a child change the list... + // } + // } + // + // removeChildren(currentGeoJSONLayer); + // removeChildren(currentDrawingLayer); + // removeChildren(currentBackgroundLayer); + + DrawingService.layers.geojson.resetFeatures(); + + } + + UtilService.uploadFile(element) + .then(function(data) { + + switch (data.type) { + case 'image/svg+xml': + initUpload(); + d3.xml(data.dataUrl, function loadDrawingFromSVG(svgElement) { + var model = ImportService.getModelFromSVG(svgElement); + ImportService.importDrawing(svgElement); + freezeMap(); + deferred.resolve(model); + }) + break; + + case 'application/zip': + case 'application/x-zip-compressed': + case 'application/binary': + case 'binary/octet-stream': + initUpload(); + JSZip.loadAsync(element.files[0]).then(function loadDrawingFromZip(zip) { + + var commentairesPath, + legendPath, + drawingPath, + interactionPath, + legendElement, svgElement, interactionData; + + zip.forEach(function getPath(relativePath, zipEntry) { + + if (relativePath.indexOf("carte_sans_source.svg") >= 0) { + drawingPath = relativePath; + } + + if (relativePath.indexOf("interactions.xml") >= 0) { + interactionPath = relativePath; + } + }); + + var parser = new DOMParser(); + + if (drawingPath) { + zip.file(drawingPath).async("string").then(function importDrawing(data) { + + var svgElement = parser.parseFromString(data, "text/xml"), + model = ImportService.getModelFromSVG(svgElement); + + changeDrawingFormat(model.mapFormat) + + if (model.isMapVisible) { + MapService.showMapLayer(model.mapIdVisible); + } + + if (model.center !== null && model.zoom !== null) { + center = model.center; + zoom = model.zoom; + + MapService.resetView(center, zoom); + freezeMap(); + } + + ImportService.importDrawing(svgElement) + ModeService.enableDefaultMode(); + deferred.resolve(model); + + }) + } else { + deferred.reject('Fichier carte_sans_source.svg non trouvé dans l\'archive') + } + + if (interactionPath) { + zip.file(interactionPath).async("string") + .then(function importInteraction(data) { + ImportService.importInteraction(parser.parseFromString(data, "text/xml")); + }) + } + + // TODO: make a Promise.all to manage the import time + + }); + + break; + + default: + deferred.reject('Fichier au mauvais format !...' + data.type) + } + + }) + + return deferred.promise; + + } + + } + + angular.module(moduleApp).service('EditService', EditService); + + EditService.$inject = ['$q', + 'SettingsService', + 'MapService', + 'DrawingService', + 'LegendService', + 'DefsService', + 'InteractionService', + 'ExportService', + 'UtilService', + 'ImportService', + 'FeatureService', + 'ModeService', + 'RadialMenuService', + ]; + +})(); + +/*global turf, osmtogeojson */ + +/** + * @ngdoc controller + * @name accessimapEditeurDerApp.controller:EditController + * @requires accessimapEditeurDerApp.EditService + * @description + * Controller of the '/edit' view + * + * The '/edit' view is a POC to leaflet's map & drawing + * + * This view allow the user to : + * - display a map (thanks to leaflet) + * - search some features (address, POI, areas) + * - get data for POI or for a specific set (buildings, roads, ...) & display them + * - visualize the area which will be print + */ +(function() { + 'use strict'; + + function EditController(EditService, ToasterService, $location, $q) { + + var $ctrl = this; + + /** + * @ngdoc property + * @name queryChoices + * @propertyOf accessimapEditeurDerApp.controller:EditController + * + * @description + * Options of POI and area to add on the map + */ + $ctrl.queryChoices = EditService.settings.QUERY_LIST; + + /** + * @ngdoc property + * @name queryChosen + * @propertyOf accessimapEditeurDerApp.controller:EditController + * + * @description + * POI / area selected + */ + $ctrl.queryChosen = EditService.settings.QUERY_DEFAULT; // $ctrl.queryChoices[1]; + /** + * @ngdoc property + * @name styleChoices + * @propertyOf accessimapEditeurDerApp.controller:EditController + * + * @description + * Options of styling for the queryChosen' type + */ + $ctrl.styleChoices = EditService.settings.STYLES[$ctrl.queryChosen.type]; + + /** + * @ngdoc property + * @name pointChoices + * @propertyOf accessimapEditeurDerApp.controller:EditController + * + * @description + * Options of styling for POI / points + */ + $ctrl.pointChoices = EditService.settings.STYLES.point; + + /** + * @ngdoc property + * @name styleChosen + * @propertyOf accessimapEditeurDerApp.controller:EditController + * @description + * Style selected for the queryChosen' type + */ + $ctrl.styleChosen = $ctrl.styleChoices[0]; + + /** + * @ngdoc + * @name changeStyle + * @methodOf accessimapEditeurDerApp.controller:EditController + * @description Update the styleChoices & styleChosen properties according to the queryChosen type + */ + $ctrl.changeStyle = function() { + $ctrl.styleChoices = EditService.settings.STYLES[$ctrl.queryChosen.type]; + $ctrl.styleChosen = $ctrl.styleChoices[0]; + }; + + $ctrl.fonts = EditService.settings.FONTS; + $ctrl.fontChosen = $ctrl.fonts[0]; + $ctrl.fontColors = EditService.settings.COLORS; + $ctrl.fontColorChosen = $ctrl.fontColors[$ctrl.fontChosen.color][0]; + + $ctrl.colors = (EditService.settings.COLORS.transparent) + .concat(EditService.settings.COLORS.other); + + $ctrl.colorChosen = $ctrl.colors[0]; + $ctrl.featureIcon = EditService.featureIcon; + $ctrl.formats = EditService.settings.FORMATS; + $ctrl.backgroundStyleChoices = EditService.settings.STYLES.polygon; + $ctrl.mapFormat = $location.search().mapFormat + ? $location.search().mapFormat + : 'landscapeA4'; + $ctrl.legendFormat = $location.search().legendFormat + ? $location.search().legendFormat + : 'landscapeA4'; + $ctrl.checkboxModel = { contour: true}; + $ctrl.getFeatures = EditService.getFeatures; + + $ctrl.model = { + title : 'Nouveau dessin', + isMapVisible : false, + comment : 'Pas de commentaire', + mapFormat : 'landscapeA4', + legendFormat : 'landscapeA4', + backgroundColor : $ctrl.colors[0], // transparent + backgroundStyle : EditService.settings.STYLES.polygon[EditService.settings.STYLES.polygon.length - 1], + } + + // general state parameters + $ctrl.isHomeVisible = true; // initial state = home + $ctrl.isParametersVisible = false; + $ctrl.isMapParametersVisible = false; + $ctrl.isDrawingParametersVisible = false; + $ctrl.isLegendParametersVisible = false; + $ctrl.isInteractionParametersVisible = false; + $ctrl.isBackgroundParametersVisible = false; + + // map state parameters + $ctrl.isAddressVisible = false; + $ctrl.isPoiCreationVisible = false; + $ctrl.isFeatureCreationVisible = false; + $ctrl.isFeatureManagementVisible = true; + + $ctrl.isDrawingFreezed = false; + + // states of right side : drawing (workspace) or legend ? + $ctrl.isWorkspaceVisible = true; + $ctrl.isLegendVisible = false; + + $ctrl.isBrailleDisplayed = true; + + $ctrl.markerStartChoices = EditService.settings.markerStart; + $ctrl.markerStopChoices = EditService.settings.markerStop; + + $ctrl.isUndoAvailable = EditService.isUndoAvailable; + + $ctrl.exportData = function() { + + ToasterService.info('Téléchargement du dessin en cours...\n' + + 'Merci de patienter', {timeout: 0, tapToDismiss: false}) + EditService.exportData($ctrl.model) + .then(function () { + ToasterService.remove() + ToasterService.success('Téléchargement terminée !') + }) + .catch(function(error) { + ToasterService.remove() + ToasterService.error(error, 'Erreur lors de la génération...') + }); + }; + $ctrl.rotateMap = EditService.rotateMap; + + $ctrl.changeDrawingFormat = function(format) { + EditService.changeDrawingFormat(format); + EditService.updateBackgroundStyleAndColor($ctrl.model.backgroundStyle, $ctrl.model.backgroundColor); + } + $ctrl.changeLegendFormat = EditService.changeLegendFormat; + + $ctrl.interactions = EditService.interactions; + + $ctrl.mapCategories = EditService.settings.mapCategories; + + $ctrl.importBackground = EditService.importBackground; + $ctrl.importImage = EditService.importImage; + $ctrl.appendSvg = EditService.appendSvg; + + $ctrl.importDER = function(file) { + + ToasterService.info('Import du fichier... merci de patienter', {timeout: 0, tapToDismiss: false}) + + EditService.importDER(file) + .then(function definedModel(model) { + ToasterService.remove() + ToasterService.success('Import terminé !') + $ctrl.model = model; + }) + .catch(function(error) { + ToasterService.remove() + ToasterService.error(error, 'Erreur lors de l\'import...') + }); + } + + /** + * @ngdoc method + * @name showMap + * @methodOf accessimapEditeurDerApp.controller:EditController + * + * @description + * Show the map layer + */ + $ctrl.showMap = function() { + $ctrl.model.isMapVisible = true; + EditService.showMapLayer(); + } + + /** + * @ngdoc method + * @name hideMap + * @methodOf accessimapEditeurDerApp.controller:EditController + * + * @description + * Hide the map layer + */ + $ctrl.hideMap = function() { + $ctrl.model.isMapVisible = false; + EditService.hideMapLayer() + } + + /** + * @ngdoc method + * @name showFontBraille + * @methodOf accessimapEditeurDerApp.controller:EditController + * + * @description + * Show the map layer + */ + $ctrl.showFontBraille = function() { + $ctrl.isBrailleDisplayed = true; + EditService.showFontBraille(); + } + + /** + * @ngdoc method + * @name hideFontBraille + * @methodOf accessimapEditeurDerApp.controller:EditController + * + * @description + * Hide the map layer + */ + $ctrl.hideFontBraille = function() { + $ctrl.isBrailleDisplayed = false; + EditService.hideFontBraille() + } + + /** + * Map parameters + */ + $ctrl.displayAddPOIForm = function() { + $ctrl.isAddressVisible = false; + $ctrl.isPoiCreationVisible = true; + $ctrl.isFeatureCreationVisible = false; + $ctrl.isFeatureManagementVisible = false; + + $ctrl.queryChosen = EditService.settings.QUERY_POI; + $ctrl.styleChoices = EditService.settings.STYLES[$ctrl.queryChosen.type]; + $ctrl.styleChosen = $ctrl.styleChoices[0]; + + EditService.enableAddPOI(ToasterService.warning, ToasterService.error, getDrawingParameters ); + } + + $ctrl.displaySearchAddressForm = function() { + $ctrl.isAddressVisible = true; + $ctrl.isPoiCreationVisible = false; + $ctrl.isFeatureCreationVisible = false; + $ctrl.isFeatureManagementVisible = false; + } + + $ctrl.displayGetDataFromOSMForm = function() { + $ctrl.isAddressVisible = false; + $ctrl.isPoiCreationVisible = false; + $ctrl.isFeatureCreationVisible = true; + $ctrl.isFeatureManagementVisible = false; + } + + $ctrl.insertOSMData = function() { + EditService.insertOSMData($ctrl.queryChosen, + ToasterService.warning, + ToasterService.error, + ToasterService.info, + getDrawingParameters) + } + + $ctrl.displayFeatureManagement = function() { + $ctrl.isAddressVisible = false; + $ctrl.isPoiCreationVisible = false; + $ctrl.isFeatureCreationVisible = false; + $ctrl.isFeatureManagementVisible = true; + } + + /** + * General parameters + */ + $ctrl.displayHome = function() { + $ctrl.isHomeVisible = true; + $ctrl.isParametersVisible = false; + $ctrl.isMapParametersVisible = false; + $ctrl.isDrawingParametersVisible = false; + $ctrl.isLegendParametersVisible = false; + $ctrl.isInteractionParametersVisible = false; + $ctrl.isBackgroundParametersVisible = false; + + EditService.resetState(); + + } + $ctrl.displayParameters = function() { + $ctrl.isHomeVisible = false; + $ctrl.isParametersVisible = true; + $ctrl.isMapParametersVisible = false; + $ctrl.isDrawingParametersVisible = false; + $ctrl.isLegendParametersVisible = false; + $ctrl.isInteractionParametersVisible = false; + $ctrl.isBackgroundParametersVisible = false; + + EditService.resetState(); + + } + $ctrl.displayMapParameters = function() { + $ctrl.isWorkspaceVisible = true; + $ctrl.isLegendVisible = false; + + $ctrl.isHomeVisible = false; + $ctrl.isParametersVisible = false; + $ctrl.isMapParametersVisible = true; + $ctrl.isDrawingParametersVisible = false; + $ctrl.isLegendParametersVisible = false; + $ctrl.isInteractionParametersVisible = false; + $ctrl.isBackgroundParametersVisible = false; + + $ctrl.displayFeatureManagement(); + } + $ctrl.displayDrawingParameters = function() { + $ctrl.isWorkspaceVisible = true; + $ctrl.isLegendVisible = false; + + $ctrl.isHomeVisible = false; + $ctrl.isParametersVisible = false; + $ctrl.isMapParametersVisible = false; + $ctrl.isDrawingParametersVisible = true; + $ctrl.isLegendParametersVisible = false; + $ctrl.isInteractionParametersVisible = false; + $ctrl.isBackgroundParametersVisible = false; + + $ctrl.enableDrawingMode('default'); + + // Display for the first time the drawing is freezed + if (! $ctrl.isDrawingFreezed) + ToasterService.info('Lorsque vous passez en mode dessin, la zone du dessin est automatiquement figée.', + 'La zone du dessin est figée') + + $ctrl.isDrawingFreezed = true; + + EditService.freezeMap(); + } + $ctrl.displayLegendParameters = function() { + $ctrl.isWorkspaceVisible = false; + $ctrl.isLegendVisible = true; + + $ctrl.isHomeVisible = false; + $ctrl.isParametersVisible = false; + $ctrl.isMapParametersVisible = false; + $ctrl.isDrawingParametersVisible = false; + $ctrl.isLegendParametersVisible = true; + $ctrl.isInteractionParametersVisible = false; + $ctrl.isBackgroundParametersVisible = false; + } + $ctrl.displayInteractionParameters = function() { + $ctrl.isHomeVisible = false; + $ctrl.isParametersVisible = false; + $ctrl.isMapParametersVisible = false; + $ctrl.isDrawingParametersVisible = false; + $ctrl.isLegendParametersVisible = false; + $ctrl.isInteractionParametersVisible = true; + $ctrl.isBackgroundParametersVisible = false; + } + $ctrl.displayBackgroundParameters = function() { + $ctrl.isHomeVisible = false; + $ctrl.isParametersVisible = false; + $ctrl.isMapParametersVisible = false; + $ctrl.isDrawingParametersVisible = false; + $ctrl.isLegendParametersVisible = false; + $ctrl.isInteractionParametersVisible = false; + $ctrl.isBackgroundParametersVisible = true; + } + + $ctrl.removeFeature = EditService.removeFeature; + $ctrl.updateFeature = EditService.updateFeature; + $ctrl.rotateFeature = EditService.rotateFeature; + + $ctrl.updatePoint = EditService.updatePoint; + + $ctrl.updateMarker = EditService.updateMarker; + + $ctrl.updateColor = function(color) { + EditService.updateFeatureStyleAndColor(null, color); + } + + $ctrl.updateStyle = function(style) { + EditService.updateFeatureStyleAndColor(style, null); + } + + $ctrl.updateBackgroundColor = function(color) { + EditService.updateBackgroundStyleAndColor($ctrl.model.backgroundStyle, color); + } + + $ctrl.updateBackgroundStyle = function(style) { + EditService.updateBackgroundStyleAndColor(style, $ctrl.model.backgroundColor); + } + + function getDrawingParameters() { + return { + style: $ctrl.styleChosen, + color: $ctrl.colorChosen, + font: $ctrl.fontChosen, + fontColor: $ctrl.fontColorChosen, + contour: $ctrl.checkboxModel ? $ctrl.checkboxModel.contour : false, + mode: $ctrl.mode + } + } + + // switch of editor's mode + // adapt user's interactions + $ctrl.enableDrawingMode = function(mode) { + + EditService.resetState(); + + $ctrl.mode = mode; + + function setStyles(styleSetting) { + $ctrl.styleChoices = EditService.settings.STYLES[styleSetting]; + $ctrl.styleChosen = $ctrl.styleChoices[0]; + } + + switch ($ctrl.mode) { + + case 'default': + EditService.enableDefaultMode(); + break; + + case 'select': + EditService.enableSelectMode(); + break; + + case 'undo': + EditService.undo(); + break; + + case 'point': + setStyles($ctrl.mode); + EditService.enablePointMode(getDrawingParameters); + break; + + case 'circle': + setStyles('polygon'); + EditService.enableCircleMode(getDrawingParameters); + break; + + case 'square': + setStyles('polygon'); + EditService.enableSquareMode(getDrawingParameters); + break; + + case 'triangle': + setStyles('polygon'); + EditService.enableTriangleMode(getDrawingParameters); + break; + + case 'line': + case 'polygon': + setStyles($ctrl.mode); + EditService.enableLineOrPolygonMode(getDrawingParameters); + break; + + case 'addtext': + EditService.enableTextMode(getDrawingParameters); + break; + + case 'image': + EditService.enableImageMode(getDrawingParameters); + break; + } + + } + + $ctrl.resetView = EditService.resetView; + + $ctrl.searchAddress = function() { + + var promises = []; + + if($ctrl.address.start) { + promises.push( + EditService.searchAndDisplayAddress($ctrl.address.start, + 'startPoint', + 'Point de départ', + $ctrl.styleChosen, + $ctrl.colorChosen)); + } + + if($ctrl.address.stop) { + promises.push( + EditService.searchAndDisplayAddress($ctrl.address.stop, + 'stopPoint', + 'Point d\'arrivée', + $ctrl.styleChosen, + $ctrl.colorChosen)); + } + + // center the map or display both of addresses + $q.all(promises) + .then(function(results) { + if (results.length > 1) { + // fitBounds + EditService.fitBounds([ + [results[0].lat, results[0].lon], + [results[1].lat, results[1].lon], + ]) + } else { + // pan + EditService.panTo([results[0].lat, results[0].lon]) + } + }) + .catch(function(error) { + ToasterService.error(error); + }) + }; + + // Initialisation of the view + EditService.init($ctrl.mapFormat, $ctrl.legendFormat); + + } + + angular.module(moduleApp).controller('EditController', EditController); + + EditController.$inject = ['EditService', 'ToasterService', '$location', '$q'] +})(); + +/** + * @ngdoc controller + * @name accessimapEditeurDerApp.controller:HomeController + * @requires $rootScope + * @requires $location + * + * @description + * Controller of the Home View + */ +(function() { + 'use strict'; + + function HomeController($rootScope, $location) { + + var $ctrl = this; + + $ctrl.goToEdit = goToEdit; + + function goToEdit() { + $location.path('/edit'); + } + } + + angular.module(moduleApp).controller('HomeController', HomeController); + + HomeController.$inject = ['$rootScope', '$location']; +})(); + +;(function(){ + +'use strict'; + +angular.module('accessimapEditeurDerApp').run(['$templateCache', function($templateCache) { + + $templateCache.put('scripts/404.html', 'Page Not Found :(

Not found :(

Sorry, but the page you were trying to view does not exist.

It looks like this was the result of either:

'); + + $templateCache.put('scripts/index.html', 'Accessimap
'); + + $templateCache.put('scripts/routes/edit/aside.html', '
'); + + $templateCache.put('scripts/routes/edit/aside_background_parameters.html', '

Trame de fond

{{$select.selected.name}}
{{$select.selected.name}}
'); + + $templateCache.put('scripts/routes/edit/aside_drawing_parameters.html', '

Dessin





Choisissez un outil de dessin pour paramétrer le style, la couleur, ...

{{$select.selected.name}}
{{$select.selected.name}}
{{$select.selected.name}}
{{$select.selected.name}}
'); + + $templateCache.put('scripts/routes/edit/aside_home.html', '


Ouvrir
'); + + $templateCache.put('scripts/routes/edit/aside_interaction_parameters.html', '

Interaction

Pas encore d\'interaction définie !
FiltresValeur
{{filter.name}}
'); + + $templateCache.put('scripts/routes/edit/aside_legend_parameters.html', '

Légende


'); + + $templateCache.put('scripts/routes/edit/aside_map_address.html', '

Chercher une adresse

'); + + $templateCache.put('scripts/routes/edit/aside_map_feature_creation.html', '

Obtenir des données d\'OSM

{{$select.selected.name}}
{{$select.selected.name}}
{{$select.selected.name}}
Contour de forme
'); + + $templateCache.put('scripts/routes/edit/aside_map_feature_management.html', '

Listing des éléments

Pas encore d\'éléments !
Vous verrez ici les éléments que vous allez créer via les boutons d\'ajouts de POI, d\'adresse ou de données OSM !

{{$select.selected.name}}
{{$select.selected.name}}
Contour de forme
'); + + $templateCache.put('scripts/routes/edit/aside_map_parameters.html', '

Carte


'); + + $templateCache.put('scripts/routes/edit/aside_map_poi_creation.html', '

Ajouter POI

{{$select.selected.name}}
'); + + $templateCache.put('scripts/routes/edit/aside_parameters.html', '

Paramètres

Nom
Type
Protocole
PointValeur
{{interaction.id}}
Créer un nouveau filtre
Nom
Type
Protocole
'); + + $templateCache.put('scripts/routes/edit/modalchangearrows.html', ''); + + $templateCache.put('scripts/routes/edit/modalchangecolor.html', ''); + + $templateCache.put('scripts/routes/edit/modalchangepattern.html', ''); + + $templateCache.put('scripts/routes/edit/modalchangepoint.html', ''); + + $templateCache.put('scripts/routes/edit/template.html', '
'); + + $templateCache.put('scripts/routes/home/template.html', '

Ajoutez de l\'interaction à vos dessins en reliefs (DER)

Configurez et personnalisez facilement vos documents avant de les imprimer !


Partenaires




  Si l\'affichage vous paraît trop gros, réglez le zoom de votre navigateur. (Ctrl + molette souris)

Projet Accessimap  Sources GitHub  Documentation  ContactEditeur v1
'); + +}]); + +})(); \ No newline at end of file