@boundlessgeo/storytools
Advanced tools
Comparing version 1.0.0-alpha10 to 1.0.0-alpha11
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";var e=angular.module("storytools.edit.boxes.controllers",[]);e.controller("boxesEditorController",function(){var e=null;this.boxes=[{title:"Default"}],this.currentBox={},this.editingBox=null,this.editBox=function(t){e=angular.copy(t),this.editingBox=t},this.newStoryBox=function(){this.editingBox={isNew:!0},e=null},this.deleteBox=function(){alert("implement me!")},this.acceptEdit=function(){this.editingBox.isNew&&this.boxes.push(this.editingBox),e=null,this.editingBox=null},this.cancelEdit=function(){e&&angular.copy(e,this.editingBox),e=null,this.editingBox=null}}),e.controller("boxEditorController",["$scope",function(){}])}(),function(){"use strict";var e=angular.module("storytools.edit.boxes.directives",["storytools.edit.boxes.controllers"]);e.directive("boxChooser",function(){return{restrict:"E",require:"^boxesEditor",templateUrl:"boxes/box-chooser.html",link:function(){}}}),e.directive("boxesEditor",function(){return{restrict:"A",controller:"boxesEditorController",controllerAs:"boxesCtrl",link:function(){}}}),e.directive("boxEditor",function(){return{restrict:"E",controller:"boxEditorController",controllerAs:"boxCtrl",require:"^boxesEditor",templateUrl:"boxes/box-editor.html",link:function(e,t,r,o){e.$watch(function(){return o.editingBox},function(){e.editBox=o.editingBox})}}}),e.directive("boxBoundsEditor",["$timeout",function(){return{restrict:"E",templateUrl:"boxes/bounds-editor.html",link:function(e,t){var r=t[0].querySelector(".box-bounds-map"),o=new ol.Map({target:r,pixelRatio:1});o.setView(new ol.View({center:[0,0],zoom:3})),o.addLayer(new ol.layer.Tile({source:new ol.source.MapQuest({layer:"osm"})})),e.$watch("boxBoundsEditorSelected",function(e){e&&o.updateSize()})}}}]),e.directive("boxContentsEditor",function(){return{restrict:"E",templateUrl:"boxes/contents-editor.html"}}),e.directive("boxLayersEditor",function(){return{restrict:"E",templateUrl:"boxes/layers-editor.html"}}),e.directive("boxLayoutEditor",function(){return{restrict:"E",templateUrl:"boxes/layout-editor.html"}})}(),function(){"use strict";angular.module("storytools.edit.boxes",["storytools.edit.boxes.directives","storytools.edit.boxes.controllers","ui.bootstrap"])}(),function(){"use strict";var e=angular.module("storytools.edit.pins.controllers",[]);e.controller("pinsEditorController",["$scope","$timeout","StoryPin","StoryPinLayerManager","MapManager",function(e,t,r,o,n){function i(){return n.storyMap.getMap()}function l(){return n.storyMap.overlay.getFeatures()}function s(){for(var e in y)y[e].setActive(!1)}function a(){d.activeDrawTool=null,l().clear()}function c(){l().clear()}function u(){t(function(){d.activeDrawTool=null;var e=l(),t=e.getLength()>0?e.item(0).getGeometry():null;d.editingCopy.setGeometry(t),t&&null===d.editingCopy.in_map&&(d.editingCopy.in_map=!0)})}function f(e){s(),y[e]||("Modify"==e?y[e]=new ol.interaction.Modify({features:l()}):(y[e]=new ol.interaction.Draw({features:l(),type:e}),y[e].on("drawstart",c)),i().addInteraction(y[e]),y[e].on("drawend",u)),y[e].setActive(!0)}var y={},d=this;this.currentPin=null,this.editingCopy=new r,this.StoryPinLayerManager=o,this.deleteStoryPin=function(e){o.pinsChanged([e],"delete")},this.saveStoryPin=function(){var e=this.currentPin,t=this.editingCopy.getProperties();if(e instanceof r)e.setProperties(t),o.pinsChanged([e],"change");else{var n=new r(t);o.pinsChanged([n],"add")}this.currentPin=this.editingCopy=null,a()},this.editStoryPin=function(e){if(a(),this.currentPin=e,this.editingCopy=new r(this.currentPin?this.currentPin.getProperties():{}),e&&e.getGeometry()){l().push(e);var t=e.getGeometry().getExtent(),o=ol.extent.getCenter(t);i().getView().setCenter(o)}},this.deleteGeometry=function(){this.editingCopy.setGeometry(null),a()},this.isEditing=function(){return this.currentPin instanceof r},Object.defineProperty(this,"activeDrawTool",{get:function(){return this._activeDrawTool},set:function(e){this._activeDrawTool=e,angular.isString(e)?f(e):s()}}),e.$on("$destroy",function(){for(var e in y){var t=y[e];t.setActive(!1),i().removeInteraction(t)}})}]),e.controller("pinEditorController",["$scope",function(e){function t(){var t=e.pinsCtrl.editingCopy,r=!0;t&&null!=t.start_time&&null!=t.end_time&&(r=t.start_time<=t.end_time),e.pinForm.$setValidity("range",r)}e.$watch(function(){return e.pinsCtrl.editingCopy},function(t){e.storyPin=t}),e.$watch("pinsCtrl.editingCopy.start_time",t),e.$watch("pinsCtrl.editingCopy.end_time",t),this.isFormValid=function(){return e.pinForm.$valid},this.finish=function(){var t=e.storyPin;return e.storyPin=null,t}}])}(),function(){"use strict";var e=angular.module("storytools.edit.pins.directives",["storytools.core.pins"]);e.directive("pinsEditor",function(){return{restrict:"A",controller:"pinsEditorController",controllerAs:"pinsCtrl",link:function(e,t,r){var o=e.pinsCtrl;if(o.overlay=e.$eval(r.pinsOverlay),null===o.overlay)throw Error("pinsEditor needs pinsOverlay attribute")}}}),e.directive("pinChooser",function(){return{require:"^pinsEditor",restrict:"E",templateUrl:"pins/pin-chooser.html",link:function(e,t,r,o){e.editPin=function(t){o.editStoryPin(t),e.$eval(r.pinSelected,e.$parent)}}}}),e.directive("pinEditor",function(){return{require:"^pinsEditor",controller:"pinEditorController",controllerAs:"pinCtrl",restrict:"A"}}),e.directive("pinEditorForm",function(){return{require:"^pinEditor",restrict:"E",templateUrl:"pins/pin-editor-form.html",link:function(e,t){function r(){if(e.point.latitude&&e.point.longitude){new ol.geom.Point([parseFloat(e.point.longitude),parseFloat(e.point.latitude)]).transform("EPSG:4326",e.map.map.getView().getProjection())}}e.point={},e.showPointCoordinates=function(){return"Point"===e.pinsCtrl.activeDrawTool},e.$watch("storyPin",function(e,r){e!=r&&t[0].querySelector("input[name=title]").focus()}),e.$watch("point",r,!0)}}})}(),function(){"use strict";angular.module("storytools.edit.pins",["storytools.edit.time.directives","storytools.edit.pins.directives","storytools.edit.pins.controllers","ui.bootstrap"])}(),function(){"use strict";angular.module("storytools.edit.style",["storytools.edit.style.services","storytools.edit.style.directives","storytools.edit.style.controllers","storytools.edit.templates","ui.bootstrap"])}(),function(){"use strict";var e=angular.module("storytools.edit.time.directives",[]);e.directive("stDateTimeField",function(){return{restrict:"E",templateUrl:"time/date-time-field.html",scope:{dateTime:"=",currentTime:"="},link:function(e){e.open=function(t){t.preventDefault(),t.stopPropagation(),e.opened=!0}}}}),e.directive("isoDateTime",["$log",function(e){return{restrict:"A",require:"ngModel",link:function(t,r,o,n){n.$formatters.push(function(e){var t=null!=e?new Date(e).toISOString():"";return t}),n.$parsers.push(function(e){var t=Date.parse(e),r=!isNaN(t);return n.$setValidity("dateTime",r),r?t:null}),t.setFromCurrentTime=function(){t.currentTime?n.$modelValue=t.currentTime:e.error("no current time provided!")}}}}])}(),function(){"use strict";angular.module("storytools.edit.time",["storytools.edit.time.directives","storytools.edit.templates"])}(),function(){"use strict";function e(e,t,r,o){for(var n={},i=t.getElementsByTagName(e+"CssParameter"),l=0,s=i.length;s>l;l++){var a=i[l],c=a.getAttribute("name");if(void 0!==r[c]){var u=a.childNodes[0].nodeValue;void 0!==o[c]&&(u=o[c](u)),n[r[c]]=u}}return n}function t(e,t){var r=e.getElementsByTagName(t)[0];return r.childNodes[0].nodeValue}function r(e,t){return e.getElementsByTagName(t).length>0}function o(e,r){var o=r.getElementsByTagName(e+"Rotation")[0];return t(o,"ogc:PropertyName")}function n(n,i){if(!r(i,n+"Fill"))return{};var l=i.getElementsByTagName(n+"Fill")[0],s=e(n,l,{fill:"fillColor","fill-opacity":"fillOpacity"},{"fill-opacity":function(e){return 100*parseFloat(e)}});return r(i,n+"Size")&&(s.size=parseInt(t(i,n+"Size"))),r(i,n+"WellKnownName")&&(s.shape=t(i,n+"WellKnownName")),r(i,n+"Rotation")&&(s.rotationAttribute=o(n,i)),s}function i(t,o){if(!r(o,t+"Stroke"))return{};var n=o.getElementsByTagName(t+"Stroke")[0];return e(t,n,{stroke:"strokeColor","stroke-opacity":"strokeOpacity","stroke-dasharray":"strokeStyle","stroke-width":"strokeWidth"},{"stroke-opacity":function(e){return 100*parseFloat(e)},"stroke-width":function(e){return parseInt(e)},"stroke-dasharray":function(e){return"5.0"===e?"dashed":"1.0 2.0"===e?"dotted":"solid"}})}function l(e){if(!r(e,"ogc:Filter"))return{};var o=e.getElementsByTagName("ogc:Filter")[0];return{name:t(e,"sld:Name"),property:t(o,"ogc:PropertyName"),value:t(o,"ogc:Literal")}}function s(o,n){var i=n.getElementsByTagName(o,"TextSymbolizer"),l={};if(i.length>0){i=i[0],r(i,o+"Label")&&(l.attribute=t(i.getElementsByTagName(o+"Label")[0],"ogc:PropertyName"));for(var s=0,a=i.childNodes.length;a>s;s++){var c=i.childNodes[s];c.tagName===o+"Fill"&&(l=Object.assign(l,e(o,c,{fill:"fillColor"},{})))}if(r(i,o+"Font")){var u=i.getElementsByTagName(o+"Font")[0];l=Object.assign(l,e(o,u,{"font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight"},{"font-size":parseInt}))}}return l}var a=angular.module("storytools.edit.style.controllers",[]);a.controller("styleEditorController",["$scope","stStyleTypes","stStyleChoices","stLayerClassificationService","stStyleRuleBuilder",function(e,t,r,o,a){function c(){var t=e.activeStyle;o.classify(e.layer,t.classify.attribute,t.classify.method,t.classify.maxClasses).then(function(e){t.rules=e,a.buildRuleStyles(t)})}function u(t){for(var r=0,o=0,n=e.styleTypes.length;n>o;o++){var i=e.styleTypes[o].name;e.styleTypes[o].active=!1,i.indexOf(t)>=0&&(r=o)}return e.styleTypes[r]}function f(e,t){var r=function(r){return t.getElementsByTagName(e+r).length};return r("RasterSymbolizer")>0||r("Transformation")>0||r("Rule")>13}function y(t){var r=t.defaultStyle.href;r&&(r="/gs/"+r.split("/geoserver/")[1],r=r.replace(".json",".sld"),fetch(r,{credentials:"same-origin"}).then(function(t){t.text().then(function(t){var r=new DOMParser,o=r.parseFromString(t,"application/xml"),a="";"sld:"===o.documentElement.tagName.substring(0,4)&&(a="sld:"),e.warning=!1,f(a,o)&&(e.warning="WARNING! This style is complex and any changes saved here will cause that style to be LOST!");var c,y,d,p,g,h=o.getElementsByTagName(a+"Rule");if(1===h.length){y=h[0],d=i(a,y);for(c in d)e.activeStyle.stroke[c]=d[c];p=n(a,y);for(c in p)e.activeStyle.symbol[c]=p[c];g=s(a,y);for(c in g)e.activeStyle.label[c]=g[c]}else if(h.length>1){y=h[0],p=n(a,y);for(c in p)e.activeStyle.symbol[c]=p[c];d=i(a,y);for(c in d)e.activeStyle.stroke[c]=d[c];g=s(a,y);for(c in g)e.activeStyle.label[c]=g[c];var v=l(y);e.activeStyle.classify={attribute:v.property,method:"unique",maxClasses:h.length};var b=u("unique-");b.active=!0,e.activeStyle.typeName=b.name,p.fillOpacity&&(e.activeStyle.classify.opacity=p.fillOpacity);for(var S=[],C=0,x=h.length;x>C;C++){y=h[C],v=l(y);var E={name:v.name,value:v.value,style:{}};"unique-point"===b.name||"unique-polygon"===b.name?(E.style.symbol=n(a,y),delete E.style.symbol.size):"unique-line"===b.name&&(E.style.stroke=i(a,y)),S.push(E)}e.activeStyle.rules=S,e.layer.set("style",e.activeStyle),m(b)}})}))}function d(r){e.layer=r,e.meta=r.get("metadata"),e.hasStyle=!1,e.styleTypes=t.getTypes(r,e.layerstyles);for(var o=0,n=e.styleTypes.length;n>o;o++)e.styleTypes[o].active=!1;if(e.styleTypes.length>0){var i=p();e.styleTypes[i].active=!0,m(e.styleTypes[i])}console.log("style types...",e.styleTypes),e.$watch("meta",function(t){!e.hasStyle&&t.defaultStyle&&(e.hasStyle=!0,y(t))},!0)}function p(){var t=e.layer.get("style")||b.getSavedStyle(e.layer);if(t)for(var r=0;r<e.styleTypes.length;r++)if(t.typeName===e.styleTypes[r].name)return r;return 0}function m(t){e.currentEditor=t,e.activeStyle=g(t)}function g(r){var o,n=e.layer.get("style")||b.getSavedStyle(e.layer);if(r.name in v)o=v[r.name];else{var i=e.styleTypes.filter(function(e){return e.name==r.name});if(0===i.length)throw"invalid style type: "+r.name;o=t.createStyle(i[0])}return goog.isDefAndNotNull(n)&&n.typeName==o.typeName&&(o.symbol=n.symbol,o.stroke=n.stroke,o.classify=n.classify||null,o.rules=n.rules||null),o}function h(t){var r=e.styleTypes.length,o=p(),n=o+t;0>n?n=r-1:n>=r&&(n=0);for(var i=0;r>i;i++)e.styleTypes[i].active=i===n;m(e.styleTypes[n])}var v={},b=storytools.edit.styleStorageService.styleStorageService();e.styleChoices=r,void 0!==e.updateStyleChoices&&(e.styleChoices=e.updateStyleChoices(r)),d(e.layer),e.setActiveStyle=m,e.$watch(function(){var t=e.styleTypes.filter(function(e){return e.active});return t[0]},function(e,t){e&&e!==t&&m(e)}),e.$watch("layer",function(e,t){e!=t&&d(e)}),e.$on("featuretype-added",function(){d(e.layer)}),e.changeClassifyProperty=function(t,r){t&&(e.activeStyle.classify[t]=r),c()},e.$watch("activeStyle",function(){if(e.editorForm.$valid){var t=e.layer.get("style");t&&t.readOnly===!0?(delete t.readOnly,e.activeStyle=t):e.layer.set("style",e.activeStyle),(e.onChange||angular.noop)(e.layer)}},!0),e.onPrev=function(){h(-1)},e.onNext=function(){h(1)},e.$watch("editorForm.$valid",function(){(e.formChanged||angular.noop)(e.editorForm)})}])}(),function(){"use strict";function e(e,r,o,n){t.directive(e,["stStyleChoices",function(){return{restrict:"E",scope:{stModel:"=",property:"@",popover:"@popoverText"},templateUrl:"style/widgets/"+r,link:function(e,t,r){if(e.layer=e.$parent.layer,e.$parent.activeStyle){var i=e.$parent.activeStyle.typeName;e.hideStrokeWidth="graduated-line"===i?!0:!1}e.$watch(function(){return e.$parent.layer},function(t){e.layer=t}),e.model=e.stModel[o||e.property],e.updateProperty=function(t){e.$parent.activeStyle[[o||e.property]]=t},e.styleChoices=e.$parent.styleChoices,n&&n(e,t,r)}}}])}var t=angular.module("storytools.edit.style.directives",[]);t.directive("carouselNext",function(){return{restrict:"A",scope:{onNext:"="},require:["^carousel"],link:function(e,t,r,o){function n(){return i.indexOfSlide(i.currentSlide)+1===i.slides.length?0:i.indexOfSlide(i.currentSlide)+1}var i=o[0];t.bind("click",function(){var t=n(),r=i.slides[t];e.onNext&&e.onNext(r.$parent.styleType),i.select(r)})}}}),t.directive("carouselPrev",function(){return{restrict:"A",scope:{onPrev:"="},require:["^carousel"],link:function(e,t,r,o){function n(){return 0===i.indexOfSlide(i.currentSlide)?i.slides.length-1:i.indexOfSlide(i.currentSlide)-1}var i=o[0];t.bind("click",function(){var t=n(),r=i.slides[t];e.onPrev&&e.onPrev(r.$parent.styleType),i.select(r)})}}}),t.directive("styleEditor",function(){return{restrict:"E",templateUrl:"style/style-editor.html",controller:"styleEditorController",require:"?styleEditorController",scope:{layer:"=",onChange:"=",formChanged:"=",control:"=",layerstyles:"=",updateStyleChoices:"="}}}),t.directive("attributeCombo",["$log",function(e){return{restrict:"E",templateUrl:"style/widgets/attribute-combo.html",scope:{layer:"=",model:"=stModel",onChange:"=?",css:"@css"},link:function(t,r,o){function n(){var r=[];t.layer?(t.layer.get("attributes").forEach(function(t){var n=!0;"nogeom"===o.filter?n="http://www.opengis.net/gml"!==t.typeNS:"number"===o.filter?n="integer"===t.type||"int"===t.type||"double"===t.type||"long"===t.type:"unique"===o.filter?n="string"===t.type:o.filter&&e.warn("unknown filter",o.filter),o.include&&(n=o.include.indexOf(t.type)>=0),n&&r.push(t.name)}),r.sort(),t.attributes=r):t.attributes=[]}t.$watch("layer",function(e,t){e!=t&&n()}),n(),t.property=o.property||"attribute",t.onChange||(t.onChange=function(e,r){t.model[e]=r})}}}]),e("symbolEditor","symbol-editor.html","symbol",function(e,t,r){["showGraphic","showRotation","hideColor"].forEach(function(t){e[t]=r[t]}),e.getSymbolizerText=function(e){return e.shape||e.graphic},e.getSymbolizerImage=function(){return""}}),e("strokeEditor","stroke-editor.html","stroke"),e("numberEditor","number-editor.html",null,function(e,t,r){function o(r){var o=t.find("input"),n=Number(o.attr("min"))||0,i=Number(o.attr("max")),l=Number(o.attr("step"))||1,s=e.stModel[e.property],a=r.detail||r.wheelDelta;s=Math.min(i,s+(a>0?-l:l)),s=Math.max(n,s),e.$apply(function(){e.stModel[e.property]=s})}var n={max:30,min:0,step:1};Object.keys(n).forEach(function(t){e[t]=r[t]||n[t]}),t[0].addEventListener("DOMMouseScroll",o,!1),t[0].addEventListener("mousewheel",o,!1),t[0].addEventListener("change",function(){var r=t.find("input"),o=Number(r.attr("min"))||0,n=Number(r.attr("max")),i=e.stModel[e.property];o>i?e.$apply(function(){e.stModel[e.property]=o}):i>n&&e.$apply(function(){e.stModel[e.property]=n})})}),e("colorEditor","color-editor.html"),e("labelEditor","label-editor.html","label",function(e){e.toggleValue=function(t){"fontWeight"===t?e.model.fontWeight="bold"===e.model.fontWeight?"normal":"bold":"fontStyle"===t&&(e.model.fontStyle="italic"===e.model.fontStyle?"normal":"italic")}}),t.directive("graphicEditor",["stStyleChoices","ol3MarkRenderer","iconCommons","iconCommonsSearch","stSvgIcon",function(e,t,r,o,n){return{restrict:"E",templateUrl:"style/widgets/graphic-editor.html",scope:{symbol:"="},link:function(i,l){function s(e){var r=angular.element(t(e,24));return r.addClass("symbol-icon"),r.attr("mark",e),r}function a(e){var t=angular.element("<img>");return t.attr("src",e.dataURI),t.addClass("symbol-icon"),t.attr("graphic",e.uri),t}function c(){var e=angular.element(l[0].querySelector("[data-current-symbol]"));e.find("*").remove(),i.symbol.shape?e.append(s(i.symbol.shape)):i.symbol.graphic&&n.getImage(i.symbol.graphic,"#000","#fff").then(function(t){e.append(a(t))})}function u(){y=angular.element(l[0].getElementsByClassName("recent-icons")),y.html(""),r.defaults().then(function(e){e.forEach(function(e){var t=a(e);t.on("click",f),y.append(t)}),i.recent=e})}var f=function(){var e=angular.element(this);e.attr("shape")?(i.symbol.shape=e.attr("shape"),i.symbol.graphic=null):e.attr("graphic")&&(i.symbol.shape=null,i.symbol.graphic=e.attr("graphic")),c()},y=angular.element(l[0].getElementsByClassName("ol-marks"));e.symbolizers.forEach(function(e){var t=s(e);t.attr("shape",e),t.on("click",f),y.append(t)}),i._updateRecent=function(){u(),c()},i._updateRecent(),i.showIconCommons=function(){o.search().then(function(e){n.getImageData(e.href).then(function(){i.symbol.shape=null,i.symbol.graphic=e.href,i._updateRecent()})})},i.$watch("symbol.shape",function(){c()})}}}]),t.directive("classifyEditor",function(){return{restrict:"E",templateUrl:"style/widgets/classify-editor.html",scope:!0,link:function(e,t,r){["showMethod","showMaxClasses","showRange","showColorRamp","showColorPalette","attributeFilter"].forEach(function(t){e[t]=r[t]})}}}),t.directive("colorRamp",function(){return{restrict:"A",scope:{ramp:"=ramp"},link:function(e,t,r){function o(){var o=t[0].getContext("2d"),n=o.createLinearGradient(0,0,r.width,0);Object.getOwnPropertyNames(e.ramp).forEach(function(t){t=parseFloat(t),isNaN(t)||n.addColorStop(t,e.ramp[t])}),o.fillStyle=n,o.fillRect(0,0,r.width,r.height)}e.$watch("ramp",o),o()}}}),t.directive("colorField",function(){function e(e){return t.exec(e)}var t=/(^#[0-9a-f]{6}$)|(^#[0-9a-f]{3}$)/i;return{restrict:"A",require:"ngModel",link:function(t,r,o,n){n.$parsers.push(function(t){return n.$setValidity("color",e(t)),t}),n.$formatters.push(function(t){return n.$setValidity("color",e(t)),t})}}}),t.directive("noClose",function(){return{link:function(e,t){t.on("click",function(e){e.stopPropagation()})}}}),t.directive("styleTypeEditor",["$compile","$templateCache",function(e,t){return{restrict:"E",link:function(r,o){r.$watch("currentEditor",function(){var n=r.currentEditor;if(r.currentEditor){var i="style/types/"+n.name.replace(" ","-")+".html";o.html(t.get(i)),e(o.contents())(r)}else o.html("")})}}}]),t.directive("rulesEditor",function(){return{restrict:"E",templateUrl:"style/rules-editor.html",link:function(e){e.deleteRule=function(t){e.activeStyle.rules=e.activeStyle.rules.filter(function(e){return e!==t})}}}})}(),function(){"use strict";var e=angular.module("storytools.edit.style.iconCommons",[]);e.factory("iconCommons",["$q","stSvgIcon","stRecentChoices",function(e,t,r){return{defaults:function(){return e.all(r.icons.recent.map(function(e){return t.getImage(e)}))}}}]),e.factory("iconCommonsSearch",["$http","$modal","$injector","$location",function(e,t,r,o){function n(e){for(var t=e.icons||e,r=0,o=t.length;o>r;r++)t[r].href=i+t[r].href;return e}var i=r.has("iconCommonsHost")?r.get("iconCommonsHost"):o.protocol()+"://"+o.host();return{tagEndpoint:i+"/icons/icon",search:function(){return this.modal=t.open({size:"lg",controller:"iconCommonsController",templateUrl:"style/widgets/icon-commons-search.html"}),this.modal?this.modal.result:null},getCollections:function(){return e.get(i+"/icons/collections").success(function(e){return n(e)})},getMore:function(t){var r=t.href;return 0!==r.indexOf(i)&&(r=i+r),e.get(r,{params:{page:t._nextPage}}).success(function(e){return n(e)})},getCollectionIcons:function(t){var r={};return t._nextPage&&(r.page=t._nextPage),e.get(i+t.href,{params:r}).success(function(e){return n(e)})},getByTag:function(t){return e.get(this.tagEndpoint,{params:{tag:t}}).success(function(e){return n(e)})},getTags:function(t){return e.get(i+"/icons/search/tags",{params:{query:t}}).then(function(e){return e.data.tags})}}}]),e.controller("iconCommonsController",["$scope","iconCommonsSearch","stRecentChoices",function(e,t,r){function o(t,r){var o=r.data.icons;t._icons=t._icons?t._icons.concat(o):o,t._more=r.data.page<r.data.pages,t._nextPage=r.data.page+1,e.icons=t}var n={href:t.tagEndpoint},i={};e.loadMore=function(){t.getMore(e.icons).then(function(t){o(e.icons,t)})},e.close=function(){r.icons.add(e.selectedIcon.href),t.modal.close(e.selectedIcon)},e.dismiss=function(){t.modal.dismiss()},e.tagSelect=function(e){n._icons=[],t.getByTag(e).then(function(e){o(n,e)})},e.viewCollections=function(){e.icons=i},e.viewTags=function(){e.icons=n},e.collectionSelect=function(e){e._icons=[],t.getCollectionIcons(e).then(function(t){o(e,t)})},e.iconSelected=function(t,r){e.selectedIcon=t,r&&e.close()},e.selectedClass=function(t){return t===e.selectedIcon?"active":null},e.getTags=t.getTags,t.getCollections().then(function(t){e.collections=t.data.collections})}])}(),function(){"use strict";var e=angular.module("storytools.edit.style.layerClassificationService",[]);e.factory("stLayerClassificationService",["$q","$http","$modal","$sce","$log",function(e,t,r,o,n){return{classify:function(i,l,s,a){this.cache||(this.cache={});var c;if(null===l||null===s)return c=e.defer(),c.reject("Not enough info to perform WPS request."),c.promise;var u=i.get("id")+"|"+l+"|"+s+"|"+a;if(this.cache[u])return c=e.defer(),c.resolve(this.cache[u]),c.promise;var f,y=this,d=new storytools.edit.WPSClassify.WPSClassify,p=i.get("path")+"wps";if("unique"===s)return f=d.getUniqueValues({featureNS:i.get("featureNS"),typeName:i.get("typeName"),featurePrefix:i.get("featurePrefix"),attribute:l},!0),t({url:p,method:"POST",data:f,headers:{"Content-Type":"application/xml"}}).then(function(e){var t=[];if(e.data&&e.data.features)for(var r=0,o=Math.min(e.data.features.length,a);o>r;++r){var n=e.data.features[r];t.push({name:n.properties.value,value:n.properties.value})}return y.cache[u]=t,t});var m;return"Natural Breaks"===s?m="NATURAL_BREAKS":"Equal Interval"===s?m="EQUAL_INTERVAL":"Quantile"===s&&(m="QUANTILE"),void 0!==m?(f=d.classifyVector({featureNS:i.get("featureNS"),typeName:i.get("typeName"),featurePrefix:i.get("featurePrefix"),attribute:l,numClasses:a,method:m},!0),t({url:p,method:"POST",data:f,headers:{"Content-Type":"application/xml"}}).then(function(e){var t=d.parseResult(e.data);return t.success===!0?(y.cache[u]=t.rules,t.rules):(r.open({templateUrl:"error-dialog.html",controller:["$scope",function(e){e.title="Error",e.msg=o.trustAsHtml("An error occurred when communicating with the classification service: <br/>"+t.msg)}]}),n.warn(t.msg),[])})):void 0}}}])}(),function(){"use strict";var e=angular.module("storytools.edit.style.services",["storytools.core.style","storytools.edit.style.styleRuleBuilder","storytools.edit.style.styleChoices","storytools.edit.style.styleTypes","storytools.edit.style.layerClassificationService","storytools.edit.style.iconCommons"]);e.factory("WPSClassify",[storytools.edit.WPSClassify]),e.factory("SLDStyleConverter",[storytools.edit.SLDStyleConverter]),e.factory("WFSDescribeFeatureType",[storytools.edit.WFSDescribeFeatureType]),e.factory("StyleComplete",[storytools.edit.StyleComplete]),e.factory("styleStorageService",[storytools.edit.styleStorageService])}(),function(){"use strict";function e(e,t){this._max=t,this._key="stRecentChoices-"+e;var r=localStorage.getItem(this._key);this.recent=r?JSON.parse(r):[]}var t=angular.module("storytools.edit.style.styleChoices",[]);t.factory("stStyleChoices",function(){return{symbolizers:["circle","square","triangle","star","cross","x"],rotationUnits:["degrees","radians"],strokeStyle:["solid","dashed","dotted"],fontFamily:["serif","sans-serif","cursive","monospace"],colorRamps:[{0:"#fff7ec",1:"#7f0000"},{0:"#fff7fb",1:"#023858"},{0:"#ffffe5",1:"#004529"},{0:"#ffffff",1:"#000000"},{0:"#ffffe5",1:"#662506"},{0:"#fff7f3",1:"#49006a"},{0:"#f7fb77",1:"#08306b"}],colorPalettes:[{name:"Basic",vals:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"]},{name:"Light",vals:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},{name:"Dark",vals:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},{name:"Pastel",vals:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"]}],classMethods:["Natural Breaks","Equal Interval","Quantile"],getPalette:function(e){var t=this.colorPalettes.filter(function(t){return t.name===e});return t.length?t[0]:null}}}),t.factory("stRecentChoices",function(){return{icons:new e("icons",24)}}),e.prototype.clear=function(){this.recent=[],localStorage.setItem(this._key,JSON.stringify(this.recent))},e.prototype.add=function(e){-1===this.recent.indexOf(e)&&(this.recent.push(e),this.recent.length>this._max&&this.recent.shift(),localStorage.setItem(this._key,JSON.stringify(this.recent)))}}(),function(){"use strict";var e=angular.module("storytools.edit.style.styleRuleBuilder",["storytools.edit.style.styleTypes","storytools.edit.style.styleChoices"]);e.factory("stStyleRuleBuilder",["stStyleTypes","stStyleChoices",function(e,t){function r(e){return("00"+e.toString(16)).slice(-2)}function o(e,t){function o(){return[i[0],i[1]]}if(1===t)return[e[0]];var n=[],i=Object.keys(e).filter(function(e){return"$"!=e.toString().charAt(0)});i.sort();for(var l=i.map(function(t){var r=e[t];return[parseInt("0x"+r.substr(1,2)),parseInt("0x"+r.substr(3,2)),parseInt("0x"+r.substr(5,2))]}),s=1/(t-1),a=0;t>a;a++){var c=a*s,u=o(c),f=(c-u[0])/(u[1]-u[0]),y=l[u[0]],d=l[u[1]],p=Math.floor(y[0]+(d[0]-y[0])*f),m=Math.floor(y[1]+(d[1]-y[1])*f),g=Math.floor(y[2]+(d[2]-y[2])*f);n.push("#"+r(p)+r(m)+r(g))}return n}function n(e,t){var r=t.styleType.rule,o={};angular.forEach(r,function(e,r){var n={};angular.forEach(e,function(e,r){var o=null;switch(e){case"color":t.colors&&(o=t.colors[t.index%t.colors.length]);break;case"range":t.rangeStep&&(o=Math.round(t.rangeStep*t.index));break;case"opacity":t.style.classify.opacity&&(o=t.style.classify.opacity);break;default:throw"invalid copySource "+e}null!==o&&(n[r]=o)}),o[r]=n}),e.style=o}return{_colorRampValues:o,buildRuleStyles:function(r){var i,l;if(r.classify){if(r.classify.colorRamp)i=o(r.classify.colorRamp,r.rules.length);else if(r.classify.colorPalette){var s=t.getPalette(r.classify.colorPalette);i=s.vals}r.classify.range&&(l=(r.classify.range.max-r.classify.range.min)/r.rules.length)}var a={colors:i,rangeStep:l,style:r,styleType:e.getStyleType(r.typeName)};r.rules.forEach(function(e,t){a.index=t,n(e,a)})}}}])}(),function(){"use strict";var e=angular.module("storytools.edit.style.styleTypes",[]),t={size:10,shape:"circle",graphic:null,graphicType:null,fillColor:"#dd1c77",fillOpacity:70,rotationAttribute:null,rotationUnits:"degrees"},r={strokeColor:"#000000",strokeWidth:1,strokeStyle:"solid",strokeOpacity:100},o={attribute:null,fillColor:"#333333",fontFamily:"Serif",fontSize:10,fontStyle:"normal",fontWeight:"normal",placement:"point"},n={method:"unique",opacity:100,attribute:null,maxClasses:5,colorRamp:null},i={method:null,attribute:null,maxClasses:5,colorRamp:null},l={method:null,attribute:null,maxClasses:5,range:{min:0,max:16}},s=[{name:"simple-point",displayName:"Simple",prototype:{geomType:"point"}},{name:"unique-point",displayName:"Unique",prototype:{geomType:"point",classify:n},rule:{symbol:{fillOpacity:"opacity",fillColor:"color"}}},{name:"class-point",displayName:"Choropleth",prototype:{geomType:"point",classify:i},rule:{symbol:{fillColor:"color"}}},{name:"graduated-point",displayName:"Graduated",prototype:{geomType:"point",classify:l},rule:{symbol:{size:"range"}}},{name:"simple-line",displayName:"Simple",prototype:{geomType:"line"}},{name:"unique-line",displayName:"Unique",prototype:{geomType:"line",classify:n},rule:{stroke:{strokeColor:"color"}}},{name:"graduated-line",displayName:"Graduated",prototype:{geomType:"line",classify:l},rule:{stroke:{strokeColor:"color",strokeWidth:"range"}}},{name:"simple-polygon",displayName:"Simple",prototype:{geomType:"polygon"}},{name:"unique-polygon",displayName:"Unique",prototype:{geomType:"polygon",classify:n},rule:{symbol:{fillOpacity:"opacity",fillColor:"color"}}},{name:"class-polygon",displayName:"Choropleth",prototype:{geomType:"polygon",classify:i},rule:{symbol:{fillColor:"color"}}}];e.run(["$injector",function(e){if(e.has("stStyleDefaults")){var o=e.get("stStyleDefaults");[t,r].forEach(function(e){Object.keys(e).forEach(function(t){t in o&&(e[t]=o[t])})})}}]),e.factory("stStyleTypes",function(){return{getTypes:function(e,t){var r=angular.copy(s).filter(function(t){var r=e.get("geomType")||e.get("metadata").geomType;return t.prototype.geomType===r});return void 0!==t&&(r=r.filter(function(e){return t.indexOf(e.name)>=0})),r},getStyleType:function(e){var t=s.filter(function(t){return t.name==e});if(t.length>1)throw"duplicate type names!";return 0===t.length?null:t[0]},createStyle:function(e){var n={symbol:e.symbol||t,stroke:e.stroke||r,label:o,typeName:e.name},i=angular.extend({},angular.copy(n),e.prototype);return"classify"in i&&(i.rules=e.rules||[]),i}}})}(); | ||
!function(){"use strict";var e=angular.module("storytools.edit.boxes.controllers",[]);e.controller("boxesEditorController",function(){var e=null;this.boxes=[{title:"Default"}],this.currentBox={},this.editingBox=null,this.editBox=function(t){e=angular.copy(t),this.editingBox=t},this.newStoryBox=function(){this.editingBox={isNew:!0},e=null},this.deleteBox=function(){alert("implement me!")},this.acceptEdit=function(){this.editingBox.isNew&&this.boxes.push(this.editingBox),e=null,this.editingBox=null},this.cancelEdit=function(){e&&angular.copy(e,this.editingBox),e=null,this.editingBox=null}}),e.controller("boxEditorController",["$scope",function(){}])}(),function(){"use strict";var e=angular.module("storytools.edit.boxes.directives",["storytools.edit.boxes.controllers"]);e.directive("boxChooser",function(){return{restrict:"E",require:"^boxesEditor",templateUrl:"boxes/box-chooser.html",link:function(){}}}),e.directive("boxesEditor",function(){return{restrict:"A",controller:"boxesEditorController",controllerAs:"boxesCtrl",link:function(){}}}),e.directive("boxEditor",function(){return{restrict:"E",controller:"boxEditorController",controllerAs:"boxCtrl",require:"^boxesEditor",templateUrl:"boxes/box-editor.html",link:function(e,t,r,o){e.$watch(function(){return o.editingBox},function(){e.editBox=o.editingBox})}}}),e.directive("boxBoundsEditor",["$timeout",function(){return{restrict:"E",templateUrl:"boxes/bounds-editor.html",link:function(e,t){var r=t[0].querySelector(".box-bounds-map"),o=new ol.Map({target:r,pixelRatio:1});o.setView(new ol.View({center:[0,0],zoom:3})),o.addLayer(new ol.layer.Tile({source:new ol.source.MapQuest({layer:"osm"})})),e.$watch("boxBoundsEditorSelected",function(e){e&&o.updateSize()})}}}]),e.directive("boxContentsEditor",function(){return{restrict:"E",templateUrl:"boxes/contents-editor.html"}}),e.directive("boxLayersEditor",function(){return{restrict:"E",templateUrl:"boxes/layers-editor.html"}}),e.directive("boxLayoutEditor",function(){return{restrict:"E",templateUrl:"boxes/layout-editor.html"}})}(),function(){"use strict";angular.module("storytools.edit.boxes",["storytools.edit.boxes.directives","storytools.edit.boxes.controllers","ui.bootstrap"])}(),function(){"use strict";var e=angular.module("storytools.edit.pins.controllers",[]);e.controller("pinsEditorController",["$scope","$timeout","StoryPin","StoryPinLayerManager","MapManager",function(e,t,r,o,n){function i(){return n.storyMap.getMap()}function l(){return n.storyMap.overlay.getFeatures()}function s(){for(var e in y)y[e].setActive(!1)}function a(){d.activeDrawTool=null,l().clear()}function c(){l().clear()}function u(){t(function(){d.activeDrawTool=null;var e=l(),t=e.getLength()>0?e.item(0).getGeometry():null;d.editingCopy.setGeometry(t),t&&null===d.editingCopy.in_map&&(d.editingCopy.in_map=!0)})}function f(e){s(),y[e]||("Modify"==e?y[e]=new ol.interaction.Modify({features:l()}):(y[e]=new ol.interaction.Draw({features:l(),type:e}),y[e].on("drawstart",c)),i().addInteraction(y[e]),y[e].on("drawend",u)),y[e].setActive(!0)}var y={},d=this;this.currentPin=null,this.editingCopy=new r,this.StoryPinLayerManager=o,this.deleteStoryPin=function(e){o.pinsChanged([e],"delete")},this.saveStoryPin=function(){var e=this.currentPin,t=this.editingCopy.getProperties();if(e instanceof r)e.setProperties(t),o.pinsChanged([e],"change");else{var n=new r(t);o.pinsChanged([n],"add")}this.currentPin=this.editingCopy=null,a()},this.editStoryPin=function(e){if(a(),this.currentPin=e,this.editingCopy=new r(this.currentPin?this.currentPin.getProperties():{}),e&&e.getGeometry()){l().push(e);var t=e.getGeometry().getExtent(),o=ol.extent.getCenter(t);i().getView().setCenter(o)}},this.deleteGeometry=function(){this.editingCopy.setGeometry(null),a()},this.isEditing=function(){return this.currentPin instanceof r},Object.defineProperty(this,"activeDrawTool",{get:function(){return this._activeDrawTool},set:function(e){this._activeDrawTool=e,angular.isString(e)?f(e):s()}}),e.$on("$destroy",function(){for(var e in y){var t=y[e];t.setActive(!1),i().removeInteraction(t)}})}]),e.controller("pinEditorController",["$scope",function(e){function t(){var t=e.pinsCtrl.editingCopy,r=!0;t&&null!=t.start_time&&null!=t.end_time&&(r=t.start_time<=t.end_time),e.pinForm.$setValidity("range",r)}e.$watch(function(){return e.pinsCtrl.editingCopy},function(t){e.storyPin=t}),e.$watch("pinsCtrl.editingCopy.start_time",t),e.$watch("pinsCtrl.editingCopy.end_time",t),this.isFormValid=function(){return e.pinForm.$valid},this.finish=function(){var t=e.storyPin;return e.storyPin=null,t}}])}(),function(){"use strict";var e=angular.module("storytools.edit.pins.directives",["storytools.core.pins"]);e.directive("pinsEditor",function(){return{restrict:"A",controller:"pinsEditorController",controllerAs:"pinsCtrl",link:function(e,t,r){var o=e.pinsCtrl;if(o.overlay=e.$eval(r.pinsOverlay),null===o.overlay)throw Error("pinsEditor needs pinsOverlay attribute")}}}),e.directive("pinChooser",function(){return{require:"^pinsEditor",restrict:"E",templateUrl:"pins/pin-chooser.html",link:function(e,t,r,o){e.editPin=function(t){o.editStoryPin(t),e.$eval(r.pinSelected,e.$parent)}}}}),e.directive("pinEditor",function(){return{require:"^pinsEditor",controller:"pinEditorController",controllerAs:"pinCtrl",restrict:"A"}}),e.directive("pinEditorForm",function(){return{require:"^pinEditor",restrict:"E",templateUrl:"pins/pin-editor-form.html",link:function(e,t){function r(){if(e.point.latitude&&e.point.longitude){new ol.geom.Point([parseFloat(e.point.longitude),parseFloat(e.point.latitude)]).transform("EPSG:4326",e.map.map.getView().getProjection())}}e.point={},e.showPointCoordinates=function(){return"Point"===e.pinsCtrl.activeDrawTool},e.$watch("storyPin",function(e,r){e!=r&&t[0].querySelector("input[name=title]").focus()}),e.$watch("point",r,!0)}}})}(),function(){"use strict";angular.module("storytools.edit.pins",["storytools.edit.time.directives","storytools.edit.pins.directives","storytools.edit.pins.controllers","ui.bootstrap"])}(),function(){"use strict";angular.module("storytools.edit.style",["storytools.edit.style.services","storytools.edit.style.directives","storytools.edit.style.controllers","storytools.edit.templates","ui.bootstrap"])}(),function(){"use strict";var e=angular.module("storytools.edit.time.directives",[]);e.directive("stDateTimeField",function(){return{restrict:"E",templateUrl:"time/date-time-field.html",scope:{dateTime:"=",currentTime:"="},link:function(e){e.open=function(t){t.preventDefault(),t.stopPropagation(),e.opened=!0}}}}),e.directive("isoDateTime",["$log",function(e){return{restrict:"A",require:"ngModel",link:function(t,r,o,n){n.$formatters.push(function(e){var t=null!=e?new Date(e).toISOString():"";return t}),n.$parsers.push(function(e){var t=Date.parse(e),r=!isNaN(t);return n.$setValidity("dateTime",r),r?t:null}),t.setFromCurrentTime=function(){t.currentTime?n.$modelValue=t.currentTime:e.error("no current time provided!")}}}}])}(),function(){"use strict";angular.module("storytools.edit.time",["storytools.edit.time.directives","storytools.edit.templates"])}(),function(){"use strict";function e(e,t,r,o){for(var n={},i=t.getElementsByTagName(e+"CssParameter"),l=0,s=i.length;s>l;l++){var a=i[l],c=a.getAttribute("name");if(void 0!==r[c]){var u=a.childNodes[0].nodeValue;void 0!==o[c]&&(u=o[c](u)),n[r[c]]=u}}return n}function t(e,t){var r=e.getElementsByTagName(t)[0];return r.childNodes[0].nodeValue}function r(e,t){return e.getElementsByTagName(t).length>0}function o(e,r){var o=r.getElementsByTagName(e+"Rotation")[0];return t(o,"ogc:PropertyName")}function n(n,i){if(!r(i,n+"Fill"))return{};var l=i.getElementsByTagName(n+"Fill")[0],s=e(n,l,{fill:"fillColor","fill-opacity":"fillOpacity"},{"fill-opacity":function(e){return 100*parseFloat(e)}});return r(i,n+"Size")&&(s.size=parseInt(t(i,n+"Size"))),r(i,n+"WellKnownName")&&(s.shape=t(i,n+"WellKnownName")),r(i,n+"Rotation")&&(s.rotationAttribute=o(n,i)),s}function i(t,o){if(!r(o,t+"Stroke"))return{};var n=o.getElementsByTagName(t+"Stroke")[0];return e(t,n,{stroke:"strokeColor","stroke-opacity":"strokeOpacity","stroke-dasharray":"strokeStyle","stroke-width":"strokeWidth"},{"stroke-opacity":function(e){return 100*parseFloat(e)},"stroke-width":function(e){return parseInt(e)},"stroke-dasharray":function(e){return"5.0"===e?"dashed":"1.0 2.0"===e?"dotted":"solid"}})}function l(e){if(!r(e,"ogc:Filter"))return{};var o=e.getElementsByTagName("ogc:Filter")[0];return{name:t(e,"sld:Name"),property:t(o,"ogc:PropertyName"),value:t(o,"ogc:Literal")}}function s(o,n){var i=n.getElementsByTagName(o,"TextSymbolizer"),l={};if(i.length>0){i=i[0],r(i,o+"Label")&&(l.attribute=t(i.getElementsByTagName(o+"Label")[0],"ogc:PropertyName"));for(var s=0,a=i.childNodes.length;a>s;s++){var c=i.childNodes[s];c.tagName===o+"Fill"&&(l=Object.assign(l,e(o,c,{fill:"fillColor"},{})))}if(r(i,o+"Font")){var u=i.getElementsByTagName(o+"Font")[0];l=Object.assign(l,e(o,u,{"font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight"},{"font-size":parseInt}))}}return l}var a=angular.module("storytools.edit.style.controllers",[]);a.controller("styleEditorController",["$scope","stStyleTypes","stStyleChoices","stLayerClassificationService","stStyleRuleBuilder",function(e,t,r,o,a){function c(){var t=e.activeStyle;o.classify(e.layer,t.classify.attribute,t.classify.method,t.classify.maxClasses).then(function(e){t.rules=e,a.buildRuleStyles(t)})}function u(t){for(var r=0,o=0,n=e.styleTypes.length;n>o;o++){var i=e.styleTypes[o].name;e.styleTypes[o].active=!1,i.indexOf(t)>=0&&(r=o)}return e.styleTypes[r]}function f(e,t){var r=function(r){return t.getElementsByTagName(e+r).length};return r("RasterSymbolizer")>0||r("Transformation")>0||r("Rule")>13}function y(t){var r=t.defaultStyle.href;r&&(r="/gs/"+r.split("/geoserver/")[1],r=r.replace(".json",".sld"),fetch(r,{credentials:"same-origin"}).then(function(t){t.text().then(function(t){var r=new DOMParser,o=r.parseFromString(t,"application/xml"),a="";"sld:"===o.documentElement.tagName.substring(0,4)&&(a="sld:"),e.warning=!1,f(a,o)&&(e.warning="WARNING! This style is complex and any changes saved here will cause that style to be LOST!");var c,y,d,p,h,g=o.getElementsByTagName(a+"Rule");if(1===g.length){y=g[0],d=i(a,y);for(c in d)e.activeStyle.stroke[c]=d[c];p=n(a,y);for(c in p)e.activeStyle.symbol[c]=p[c];h=s(a,y);for(c in h)e.activeStyle.label[c]=h[c]}else if(g.length>1){y=g[0],p=n(a,y);for(c in p)e.activeStyle.symbol[c]=p[c];d=i(a,y);for(c in d)e.activeStyle.stroke[c]=d[c];h=s(a,y);for(c in h)e.activeStyle.label[c]=h[c];var v=l(y);e.activeStyle.classify={attribute:v.property,method:"unique",maxClasses:g.length};var b=u("unique-");b.active=!0,e.activeStyle.typeName=b.name,p.fillOpacity&&(e.activeStyle.classify.opacity=p.fillOpacity);for(var S=[],C=0,x=g.length;x>C;C++){y=g[C],v=l(y);var E={name:v.name,value:v.value,style:{}};"unique-point"===b.name||"unique-polygon"===b.name?(E.style.symbol=n(a,y),delete E.style.symbol.size):"unique-line"===b.name&&(E.style.stroke=i(a,y)),S.push(E)}e.activeStyle.rules=S,e.layer.set("style",e.activeStyle),m(b)}})}))}function d(r){e.layer=r,e.meta=r.get("metadata"),e.hasStyle=!1,e.styleTypes=t.getTypes(r,e.layerstyles);for(var o=0,n=e.styleTypes.length;n>o;o++)e.styleTypes[o].active=!1;if(e.styleTypes.length>0){var i=p();e.styleTypes[i].active=!0,m(e.styleTypes[i])}e.$watch("meta",function(t){!e.hasStyle&&t.defaultStyle&&(e.hasStyle=!0,y(t))},!0)}function p(){var t=e.layer.get("style")||b.getSavedStyle(e.layer);if(t)for(var r=0;r<e.styleTypes.length;r++)if(t.typeName===e.styleTypes[r].name)return r;return 0}function m(t){e.currentEditor=t,e.activeStyle=h(t)}function h(r){var o,n=e.layer.get("style")||b.getSavedStyle(e.layer);if(r.name in v)o=v[r.name];else{var i=e.styleTypes.filter(function(e){return e.name==r.name});if(0===i.length)throw"invalid style type: "+r.name;o=t.createStyle(i[0])}return goog.isDefAndNotNull(n)&&n.typeName==o.typeName&&(o.symbol=n.symbol,o.stroke=n.stroke,o.classify=n.classify||null,o.rules=n.rules||null),o}function g(t){var r=e.styleTypes.length,o=p(),n=o+t;0>n?n=r-1:n>=r&&(n=0);for(var i=0;r>i;i++)e.styleTypes[i].active=i===n;m(e.styleTypes[n])}var v={},b=storytools.edit.styleStorageService.styleStorageService();e.styleChoices=r,void 0!==e.updateStyleChoices&&(e.styleChoices=e.updateStyleChoices(r)),d(e.layer),e.setActiveStyle=m,e.$watch(function(){var t=e.styleTypes.filter(function(e){return e.active});return t[0]},function(e,t){e&&e!==t&&m(e)}),e.$watch("layer",function(e,t){e!=t&&d(e)}),e.$on("featuretype-added",function(){d(e.layer)}),e.changeClassifyProperty=function(t,r){t&&(e.activeStyle.classify[t]=r),c()},e.$watch("activeStyle",function(){if(e.editorForm.$valid){var t=e.layer.get("style");t&&t.readOnly===!0?(delete t.readOnly,e.activeStyle=t):e.layer.set("style",e.activeStyle),(e.onChange||angular.noop)(e.layer)}},!0),e.onPrev=function(){g(-1)},e.onNext=function(){g(1)},e.$watch("editorForm.$valid",function(){(e.formChanged||angular.noop)(e.editorForm)})}])}(),function(){"use strict";function e(e,r,o,n){t.directive(e,["stStyleChoices",function(){return{restrict:"E",scope:{stModel:"=",property:"@",popover:"@popoverText"},templateUrl:"style/widgets/"+r,link:function(e,t,r){if(e.layer=e.$parent.layer,e.$parent.activeStyle){var i=e.$parent.activeStyle.typeName;e.hideStrokeWidth="graduated-line"===i?!0:!1}e.$watch(function(){return e.$parent.layer},function(t){e.layer=t}),e.model=e.stModel[o||e.property],e.updateProperty=function(t){e.$parent.activeStyle[[o||e.property]]=t},e.styleChoices=e.$parent.styleChoices,n&&n(e,t,r)}}}])}var t=angular.module("storytools.edit.style.directives",[]);t.directive("carouselNext",function(){return{restrict:"A",scope:{onNext:"="},require:["^carousel"],link:function(e,t,r,o){function n(){return i.indexOfSlide(i.currentSlide)+1===i.slides.length?0:i.indexOfSlide(i.currentSlide)+1}var i=o[0];t.bind("click",function(){var t=n(),r=i.slides[t];e.onNext&&e.onNext(r.$parent.styleType),i.select(r)})}}}),t.directive("carouselPrev",function(){return{restrict:"A",scope:{onPrev:"="},require:["^carousel"],link:function(e,t,r,o){function n(){return 0===i.indexOfSlide(i.currentSlide)?i.slides.length-1:i.indexOfSlide(i.currentSlide)-1}var i=o[0];t.bind("click",function(){var t=n(),r=i.slides[t];e.onPrev&&e.onPrev(r.$parent.styleType),i.select(r)})}}}),t.directive("styleEditor",function(){return{restrict:"E",templateUrl:"style/style-editor.html",controller:"styleEditorController",require:"?styleEditorController",scope:{layer:"=",onChange:"=",formChanged:"=",control:"=",layerstyles:"=",updateStyleChoices:"="}}}),t.directive("attributeCombo",["$log",function(e){return{restrict:"E",templateUrl:"style/widgets/attribute-combo.html",scope:{layer:"=",model:"=stModel",onChange:"=?",css:"@css"},link:function(t,r,o){function n(){var r=[];t.layer?(t.layer.get("attributes").forEach(function(t){var n=!0;"nogeom"===o.filter?n="http://www.opengis.net/gml"!==t.typeNS:"number"===o.filter?n="integer"===t.type||"int"===t.type||"double"===t.type||"long"===t.type:"unique"===o.filter?n="string"===t.type:o.filter&&e.warn("unknown filter",o.filter),o.include&&(n=o.include.indexOf(t.type)>=0),n&&r.push(t.name)}),r.sort(),t.attributes=r):t.attributes=[]}t.$watch("layer",function(e,t){e!=t&&n()}),n(),t.property=o.property||"attribute",t.onChange||(t.onChange=function(e,r){t.model[e]=r})}}}]),e("symbolEditor","symbol-editor.html","symbol",function(e,t,r){["showGraphic","showRotation","hideColor"].forEach(function(t){e[t]=r[t]}),e.getSymbolizerText=function(e){return e.shape||e.graphic},e.getSymbolizerImage=function(){return""}}),e("strokeEditor","stroke-editor.html","stroke"),e("numberEditor","number-editor.html",null,function(e,t,r){function o(r){var o=t.find("input"),n=Number(o.attr("min"))||0,i=Number(o.attr("max")),l=Number(o.attr("step"))||1,s=e.stModel[e.property],a=r.detail||r.wheelDelta;s=Math.min(i,s+(a>0?-l:l)),s=Math.max(n,s),e.$apply(function(){e.stModel[e.property]=s})}var n={max:30,min:0,step:1};Object.keys(n).forEach(function(t){e[t]=r[t]||n[t]}),t[0].addEventListener("DOMMouseScroll",o,!1),t[0].addEventListener("mousewheel",o,!1),t[0].addEventListener("change",function(){var r=t.find("input"),o=Number(r.attr("min"))||0,n=Number(r.attr("max")),i=e.stModel[e.property];o>i?e.$apply(function(){e.stModel[e.property]=o}):i>n&&e.$apply(function(){e.stModel[e.property]=n})})}),e("colorEditor","color-editor.html"),e("labelEditor","label-editor.html","label",function(e){e.toggleValue=function(t){"fontWeight"===t?e.model.fontWeight="bold"===e.model.fontWeight?"normal":"bold":"fontStyle"===t&&(e.model.fontStyle="italic"===e.model.fontStyle?"normal":"italic")}}),t.directive("graphicEditor",["stStyleChoices","ol3MarkRenderer","iconCommons","iconCommonsSearch","stSvgIcon",function(e,t,r,o,n){return{restrict:"E",templateUrl:"style/widgets/graphic-editor.html",scope:{symbol:"="},link:function(i,l){function s(e){var r=angular.element(t(e,24));return r.addClass("symbol-icon"),r.attr("mark",e),r}function a(e){var t=angular.element("<img>");return t.attr("src",e.dataURI),t.addClass("symbol-icon"),t.attr("graphic",e.uri),t}function c(){var e=angular.element(l[0].querySelector("[data-current-symbol]"));e.find("*").remove(),i.symbol.shape?e.append(s(i.symbol.shape)):i.symbol.graphic&&n.getImage(i.symbol.graphic,"#000","#fff").then(function(t){e.append(a(t))})}function u(){y=angular.element(l[0].getElementsByClassName("recent-icons")),y.html(""),r.defaults().then(function(e){e.forEach(function(e){var t=a(e);t.on("click",f),y.append(t)}),i.recent=e})}var f=function(){var e=angular.element(this);e.attr("shape")?(i.symbol.shape=e.attr("shape"),i.symbol.graphic=null):e.attr("graphic")&&(i.symbol.shape=null,i.symbol.graphic=e.attr("graphic")),c()},y=angular.element(l[0].getElementsByClassName("ol-marks"));e.symbolizers.forEach(function(e){var t=s(e);t.attr("shape",e),t.on("click",f),y.append(t)}),i._updateRecent=function(){u(),c()},i._updateRecent(),i.showIconCommons=function(){o.search().then(function(e){n.getImageData(e.href).then(function(){i.symbol.shape=null,i.symbol.graphic=e.href,i._updateRecent()})})},i.$watch("symbol.shape",function(){c()})}}}]),t.directive("classifyEditor",function(){return{restrict:"E",templateUrl:"style/widgets/classify-editor.html",scope:!0,link:function(e,t,r){["showMethod","showMaxClasses","showRange","showColorRamp","showColorPalette","attributeFilter"].forEach(function(t){e[t]=r[t]})}}}),t.directive("colorRamp",function(){return{restrict:"A",scope:{ramp:"=ramp"},link:function(e,t,r){function o(){var o=t[0].getContext("2d"),n=o.createLinearGradient(0,0,r.width,0);Object.getOwnPropertyNames(e.ramp).forEach(function(t){t=parseFloat(t),isNaN(t)||n.addColorStop(t,e.ramp[t])}),o.fillStyle=n,o.fillRect(0,0,r.width,r.height)}e.$watch("ramp",o),o()}}}),t.directive("colorField",function(){function e(e){return t.exec(e)}var t=/(^#[0-9a-f]{6}$)|(^#[0-9a-f]{3}$)/i;return{restrict:"A",require:"ngModel",link:function(t,r,o,n){n.$parsers.push(function(t){return n.$setValidity("color",e(t)),t}),n.$formatters.push(function(t){return n.$setValidity("color",e(t)),t})}}}),t.directive("noClose",function(){return{link:function(e,t){t.on("click",function(e){e.stopPropagation()})}}}),t.directive("styleTypeEditor",["$compile","$templateCache",function(e,t){return{restrict:"E",link:function(r,o){r.$watch("currentEditor",function(){var n=r.currentEditor;if(r.currentEditor){var i="style/types/"+n.name.replace(" ","-")+".html";o.html(t.get(i)),e(o.contents())(r)}else o.html("")})}}}]),t.directive("rulesEditor",function(){return{restrict:"E",templateUrl:"style/rules-editor.html",link:function(e){e.deleteRule=function(t){e.activeStyle.rules=e.activeStyle.rules.filter(function(e){return e!==t})}}}})}(),function(){"use strict";var e=angular.module("storytools.edit.style.iconCommons",[]);e.factory("iconCommons",["$q","stSvgIcon","stRecentChoices",function(e,t,r){return{defaults:function(){return e.all(r.icons.recent.map(function(e){return t.getImage(e)}))}}}]),e.factory("iconCommonsSearch",["$http","$modal","$injector","$location",function(e,t,r,o){function n(e){for(var t=e.icons||e,r=0,o=t.length;o>r;r++)t[r].href=i+t[r].href;return e}var i=r.has("iconCommonsHost")?r.get("iconCommonsHost"):o.protocol()+"://"+o.host();return{tagEndpoint:i+"/icons/icon",search:function(){return this.modal=t.open({size:"lg",controller:"iconCommonsController",templateUrl:"style/widgets/icon-commons-search.html"}),this.modal?this.modal.result:null},getCollections:function(){return e.get(i+"/icons/collections").success(function(e){return n(e)})},getMore:function(t){var r=t.href;return 0!==r.indexOf(i)&&(r=i+r),e.get(r,{params:{page:t._nextPage}}).success(function(e){return n(e)})},getCollectionIcons:function(t){var r={};return t._nextPage&&(r.page=t._nextPage),e.get(i+t.href,{params:r}).success(function(e){return n(e)})},getByTag:function(t){return e.get(this.tagEndpoint,{params:{tag:t}}).success(function(e){return n(e)})},getTags:function(t){return e.get(i+"/icons/search/tags",{params:{query:t}}).then(function(e){return e.data.tags})}}}]),e.controller("iconCommonsController",["$scope","iconCommonsSearch","stRecentChoices",function(e,t,r){function o(t,r){var o=r.data.icons;t._icons=t._icons?t._icons.concat(o):o,t._more=r.data.page<r.data.pages,t._nextPage=r.data.page+1,e.icons=t}var n={href:t.tagEndpoint},i={};e.loadMore=function(){t.getMore(e.icons).then(function(t){o(e.icons,t)})},e.close=function(){r.icons.add(e.selectedIcon.href),t.modal.close(e.selectedIcon)},e.dismiss=function(){t.modal.dismiss()},e.tagSelect=function(e){n._icons=[],t.getByTag(e).then(function(e){o(n,e)})},e.viewCollections=function(){e.icons=i},e.viewTags=function(){e.icons=n},e.collectionSelect=function(e){e._icons=[],t.getCollectionIcons(e).then(function(t){o(e,t)})},e.iconSelected=function(t,r){e.selectedIcon=t,r&&e.close()},e.selectedClass=function(t){return t===e.selectedIcon?"active":null},e.getTags=t.getTags,t.getCollections().then(function(t){e.collections=t.data.collections})}])}(),function(){"use strict";var e=angular.module("storytools.edit.style.layerClassificationService",[]);e.factory("stLayerClassificationService",["$q","$http","$modal","$sce","$log",function(e,t,r,o,n){return{classify:function(i,l,s,a){this.cache||(this.cache={});var c;if(null===l||null===s)return c=e.defer(),c.reject("Not enough info to perform WPS request."),c.promise;var u=i.get("id")+"|"+l+"|"+s+"|"+a;if(this.cache[u])return c=e.defer(),c.resolve(this.cache[u]),c.promise;var f,y=this,d=new storytools.edit.WPSClassify.WPSClassify,p=i.get("path")+"wps";if("unique"===s)return f=d.getUniqueValues({featureNS:i.get("featureNS"),typeName:i.get("typeName"),featurePrefix:i.get("featurePrefix"),attribute:l},!0),t({url:p,method:"POST",data:f,headers:{"Content-Type":"application/xml"}}).then(function(e){var t=[];if(e.data&&e.data.features)for(var r=0,o=Math.min(e.data.features.length,a);o>r;++r){var n=e.data.features[r];t.push({name:n.properties.value,value:n.properties.value})}return y.cache[u]=t,t});var m;return"Natural Breaks"===s?m="NATURAL_BREAKS":"Equal Interval"===s?m="EQUAL_INTERVAL":"Quantile"===s&&(m="QUANTILE"),void 0!==m?(f=d.classifyVector({featureNS:i.get("featureNS"),typeName:i.get("typeName"),featurePrefix:i.get("featurePrefix"),attribute:l,numClasses:a,method:m},!0),t({url:p,method:"POST",data:f,headers:{"Content-Type":"application/xml"}}).then(function(e){var t=d.parseResult(e.data);return t.success===!0?(y.cache[u]=t.rules,t.rules):(r.open({templateUrl:"error-dialog.html",controller:["$scope",function(e){e.title="Error",e.msg=o.trustAsHtml("An error occurred when communicating with the classification service: <br/>"+t.msg)}]}),n.warn(t.msg),[])})):void 0}}}])}(),function(){"use strict";var e=angular.module("storytools.edit.style.services",["storytools.core.style","storytools.edit.style.styleRuleBuilder","storytools.edit.style.styleChoices","storytools.edit.style.styleTypes","storytools.edit.style.layerClassificationService","storytools.edit.style.iconCommons"]);e.factory("WPSClassify",[storytools.edit.WPSClassify]),e.factory("SLDStyleConverter",[storytools.edit.SLDStyleConverter]),e.factory("WFSDescribeFeatureType",[storytools.edit.WFSDescribeFeatureType]),e.factory("StyleComplete",[storytools.edit.StyleComplete]),e.factory("styleStorageService",[storytools.edit.styleStorageService])}(),function(){"use strict";function e(e,t){this._max=t,this._key="stRecentChoices-"+e;var r=localStorage.getItem(this._key);this.recent=r?JSON.parse(r):[]}var t=angular.module("storytools.edit.style.styleChoices",[]);t.factory("stStyleChoices",function(){return{symbolizers:["circle","square","triangle","star","cross","x"],rotationUnits:["degrees","radians"],strokeStyle:["solid","dashed","dotted"],fontFamily:["serif","sans-serif","cursive","monospace"],colorRamps:[{0:"#fff7ec",1:"#7f0000"},{0:"#fff7fb",1:"#023858"},{0:"#ffffe5",1:"#004529"},{0:"#ffffff",1:"#000000"},{0:"#ffffe5",1:"#662506"},{0:"#fff7f3",1:"#49006a"},{0:"#f7fb77",1:"#08306b"}],colorPalettes:[{name:"Basic",vals:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"]},{name:"Light",vals:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},{name:"Dark",vals:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},{name:"Pastel",vals:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"]}],classMethods:["Natural Breaks","Equal Interval","Quantile"],getPalette:function(e){var t=this.colorPalettes.filter(function(t){return t.name===e});return t.length?t[0]:null}}}),t.factory("stRecentChoices",function(){return{icons:new e("icons",24)}}),e.prototype.clear=function(){this.recent=[],localStorage.setItem(this._key,JSON.stringify(this.recent))},e.prototype.add=function(e){-1===this.recent.indexOf(e)&&(this.recent.push(e),this.recent.length>this._max&&this.recent.shift(),localStorage.setItem(this._key,JSON.stringify(this.recent)))}}(),function(){"use strict";var e=angular.module("storytools.edit.style.styleRuleBuilder",["storytools.edit.style.styleTypes","storytools.edit.style.styleChoices"]);e.factory("stStyleRuleBuilder",["stStyleTypes","stStyleChoices",function(e,t){function r(e){return("00"+e.toString(16)).slice(-2)}function o(e,t){function o(){return[i[0],i[1]]}if(1===t)return[e[0]];var n=[],i=Object.keys(e).filter(function(e){return"$"!=e.toString().charAt(0)});i.sort();for(var l=i.map(function(t){var r=e[t];return[parseInt("0x"+r.substr(1,2)),parseInt("0x"+r.substr(3,2)),parseInt("0x"+r.substr(5,2))]}),s=1/(t-1),a=0;t>a;a++){var c=a*s,u=o(c),f=(c-u[0])/(u[1]-u[0]),y=l[u[0]],d=l[u[1]],p=Math.floor(y[0]+(d[0]-y[0])*f),m=Math.floor(y[1]+(d[1]-y[1])*f),h=Math.floor(y[2]+(d[2]-y[2])*f);n.push("#"+r(p)+r(m)+r(h))}return n}function n(e,t){var r=t.styleType.rule,o={};angular.forEach(r,function(e,r){var n={};angular.forEach(e,function(e,r){var o=null;switch(e){case"color":t.colors&&(o=t.colors[t.index%t.colors.length]);break;case"range":t.rangeStep&&(o=Math.round(t.rangeStep*t.index));break;case"opacity":t.style.classify.opacity&&(o=t.style.classify.opacity);break;default:throw"invalid copySource "+e}null!==o&&(n[r]=o)}),o[r]=n}),e.style=o}return{_colorRampValues:o,buildRuleStyles:function(r){var i,l;if(r.classify){if(r.classify.colorRamp)i=o(r.classify.colorRamp,r.rules.length);else if(r.classify.colorPalette){var s=t.getPalette(r.classify.colorPalette);i=s.vals}r.classify.range&&(l=(r.classify.range.max-r.classify.range.min)/r.rules.length)}var a={colors:i,rangeStep:l,style:r,styleType:e.getStyleType(r.typeName)};r.rules.forEach(function(e,t){a.index=t,n(e,a)})}}}])}(),function(){"use strict";var e=angular.module("storytools.edit.style.styleTypes",[]),t={size:10,shape:"circle",graphic:null,graphicType:null,fillColor:"#dd1c77",fillOpacity:70,rotationAttribute:null,rotationUnits:"degrees"},r={strokeColor:"#000000",strokeWidth:1,strokeStyle:"solid",strokeOpacity:100},o={attribute:null,fillColor:"#333333",fontFamily:"Serif",fontSize:10,fontStyle:"normal",fontWeight:"normal",placement:"point"},n={method:"unique",opacity:100,attribute:null,maxClasses:5,colorRamp:null},i={method:null,attribute:null,maxClasses:5,colorRamp:null},l={method:null,attribute:null,maxClasses:5,range:{min:0,max:16}},s=[{name:"simple-point",displayName:"Simple",prototype:{geomType:"point"}},{name:"unique-point",displayName:"Unique",prototype:{geomType:"point",classify:n},rule:{symbol:{fillOpacity:"opacity",fillColor:"color"}}},{name:"class-point",displayName:"Choropleth",prototype:{geomType:"point",classify:i},rule:{symbol:{fillColor:"color"}}},{name:"graduated-point",displayName:"Graduated",prototype:{geomType:"point",classify:l},rule:{symbol:{size:"range"}}},{name:"simple-line",displayName:"Simple",prototype:{geomType:"line"}},{name:"unique-line",displayName:"Unique",prototype:{geomType:"line",classify:n},rule:{stroke:{strokeColor:"color"}}},{name:"graduated-line",displayName:"Graduated",prototype:{geomType:"line",classify:l},rule:{stroke:{strokeColor:"color",strokeWidth:"range"}}},{name:"simple-polygon",displayName:"Simple",prototype:{geomType:"polygon"}},{name:"unique-polygon",displayName:"Unique",prototype:{geomType:"polygon",classify:n},rule:{symbol:{fillOpacity:"opacity",fillColor:"color"}}},{name:"class-polygon",displayName:"Choropleth",prototype:{geomType:"polygon",classify:i},rule:{symbol:{fillColor:"color"}}}];e.run(["$injector",function(e){if(e.has("stStyleDefaults")){var o=e.get("stStyleDefaults");[t,r].forEach(function(e){Object.keys(e).forEach(function(t){t in o&&(e[t]=o[t])})})}}]),e.factory("stStyleTypes",function(){return{getTypes:function(e,t){var r=angular.copy(s).filter(function(t){var r=e.get("geomType")||e.get("metadata").geomType;return t.prototype.geomType===r});return void 0!==t&&(r=r.filter(function(e){return t.indexOf(e.name)>=0})),r},getStyleType:function(e){var t=s.filter(function(t){return t.name==e});if(t.length>1)throw"duplicate type names!";return 0===t.length?null:t[0]},createStyle:function(e){var n={symbol:e.symbol||t,stroke:e.stroke||r,label:o,typeName:e.name},i=angular.extend({},angular.copy(n),e.prototype);return"classify"in i&&(i.rules=e.rules||[]),i}}})}(); |
@@ -7,6 +7,6 @@ angular.module("storytools.edit.templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("boxes/bounds-editor.html","<div><div class=\"box-bounds-map col-lg-4\" style=\"height: 10em;\"></div><button>Use Current Map Bounds</button> <button>Use Combined Bounds of Selected Layers</button></div>"); | ||
$templateCache.put("boxes/layout-editor.html","<div class=todo>Customize layout for the box.</div>"); | ||
$templateCache.put("pins/pin-chooser.html","<div><table class=\"table table-condensed\"><thead><tr><th></th><th>Title</th><th>Start Time</th><th>End Time</th><th>Geometry</th><th>In Map</th><th>In Timeline</th><th></th></tr></thead><tbody><tr ng-repeat=\"pin in pinsCtrl.StoryPinLayerManager.storyPins\" ng-class=\"pinsCtrl.currentPin == pin ? \'active\' : \'\'\"><td><i ng-click=editPin(pin) style=\"cursor: pointer;\" class=\"glyphicon glyphicon-edit\"></i></td><td>{{ pin.title }}</td><td>{{ pin.start_time|isodate }}</td><td>{{ pin.end_time|isodate }}</td><td>{{ pin.getGeometry().getType() }}</td><td>{{ pin.in_map }}</td><td>{{ pin.in_timeline }}</td><td><i ng-click=pinsCtrl.deleteStoryPin(pin) style=\"cursor: pointer;\" class=\"glyphicon glyphicon-trash\"></i></td></tr></tbody></table></div>"); | ||
$templateCache.put("pins/pin-editor-form.html","<form name=pinForm class=\"form form-horizontal pin-editor-form\"><div class=form-group><label for=storyPinTitle>StoryPin Title</label> <input name=title ng-required=true ng-model=storyPin.title class=form-control type=text id=storyPinTitle placeholder=Title></div><div class=form-group><label for=storyPinAbstract>Content</label> <textarea ng-model=storyPin.content id=storyPinAbstract class=form-control rows=2 placeholder=Content></textarea></div><hr><div class=form-group><label>Location</label><div><div class=\"btn-group nopad\"><button class=btn ng-model=pinsCtrl.activeDrawTool btn-radio=\"\'Point\'\">Point</button> <button class=btn ng-model=pinsCtrl.activeDrawTool btn-radio=\"\'LineString\'\">Line</button> <button class=btn ng-model=pinsCtrl.activeDrawTool btn-radio=\"\'Polygon\'\">Polygon</button></div><div ng-if=storyPin.getGeometry() class=\"btn-group nopad pull-right\"><button class=btn ng-class=\"pinsCtrl.activeDrawTool == \'Modify\' ? \'active\' : null\" ng-click=\"pinsCtrl.activeDrawTool = \'Modify\'\">Edit</button> <button class=btn ng-click=pinsCtrl.deleteGeometry()>Delete</button></div></div></div><hr><div class=form-group><label>Start Time</label><st-date-time-field date-time=storyPin.start_time></st-date-time-field></div><div class=form-group><label>End Time</label><st-date-time-field date-time=storyPin.end_time></st-date-time-field></div><div ng-if=pinForm.$error.range class=ng-invalid>Start must be before End</div><table ng-if=showPointCoordinates() class=\"table table-bordered table-condensed table-hover\" style=\"background-color: white\"><tbody><tr><td>Latitude</td><td><input ng-model=point.latitude class=form-control type=number placeholder=DD.MMSSSS></td></tr><tr><td>Longitude</td><td><input ng-model=point.longitude class=form-control type=number placeholder=DD.MMSSSS></td></tr></tbody></table><hr><div class=form-group><label>Options</label><div><div class=checkbox><input ng-model=storyPin.in_timeline id=showInTimeline type=checkbox> <label for=showInTimeline>Show in Timeline</label></div><div class=checkbox><input ng-model=storyPin.in_map id=showInMap type=checkbox> <label for=showInMap>Show in Map</label></div></div></div></form>"); | ||
$templateCache.put("style/rules-editor.html","<div class=style-editor-item><div class=title>Rules</div><table class=controls><tbody><tr ng-repeat=\"rule in activeStyle.rules\" class=style-rule><td>{{ rule.name}}</td><td><color-editor st-model=rule.style.symbol property=fillColor ng-if=rule.style.symbol.fillColor></color-editor><color-editor st-model=rule.style.stroke property=strokeColor ng-if=rule.style.stroke.strokeColor></color-editor><number-editor st-model=rule.style.symbol property=size ng-if=\"rule.style.symbol.size != null\"></number-editor></td><td><button type=button ng-click=deleteRule(rule)>×</button></td></tr></tbody></table></div>"); | ||
$templateCache.put("style/style-editor.html","<form name=editorForm><div class=style-panel ng-repeat=\"styleType in styleTypes\" ng-show=styleType.active><div class=slide-title><a class=prev ng-click=onPrev()><i class=\"glyphicon glyphicon-chevron-left\"></i></a> {{ styleType.displayName }} <a class=next ng-click=onNext()><i class=\"glyphicon glyphicon-chevron-right\"></i></a></div><div class=\"item {{styleType.displayName|lowercase}}\" data-slide-number={{$index}}></div></div><div><div class=\"warning text-danger\" ng-if=warning>{{ warning }}</div><style-type-editor ng-if=layer></style-type-editor><rules-editor ng-if=activeStyle.rules></rules-editor></div></form>"); | ||
$templateCache.put("pins/pin-chooser.html","<div><table class=\"table table-condensed\"><thead><tr><th></th><th>Title</th><th>Start Time</th><th>End Time</th><th>Geometry</th><th>In Map</th><th>In Timeline</th><th></th></tr></thead><tbody><tr ng-repeat=\"pin in pinsCtrl.StoryPinLayerManager.storyPins\" ng-class=\"pinsCtrl.currentPin == pin ? \'active\' : \'\'\"><td><i ng-click=editPin(pin) style=\"cursor: pointer;\" class=\"glyphicon glyphicon-edit\"></i></td><td>{{ pin.title }}</td><td>{{ pin.start_time|isodate }}</td><td>{{ pin.end_time|isodate }}</td><td>{{ pin.getGeometry().getType() }}</td><td>{{ pin.in_map }}</td><td>{{ pin.in_timeline }}</td><td><i ng-click=pinsCtrl.deleteStoryPin(pin) style=\"cursor: pointer;\" class=\"glyphicon glyphicon-trash\"></i></td></tr></tbody></table></div>"); | ||
$templateCache.put("pins/pin-editor-form.html","<form name=pinForm class=\"form form-horizontal pin-editor-form\"><div class=form-group><label for=storyPinTitle>StoryPin Title</label> <input name=title ng-required=true ng-model=storyPin.title class=form-control type=text id=storyPinTitle placeholder=Title></div><div class=form-group><label for=storyPinAbstract>Content</label> <textarea ng-model=storyPin.content id=storyPinAbstract class=form-control rows=2 placeholder=Content></textarea></div><hr><div class=form-group><label>Location</label><div><div class=\"btn-group nopad\"><button class=btn ng-model=pinsCtrl.activeDrawTool btn-radio=\"\'Point\'\">Point</button> <button class=btn ng-model=pinsCtrl.activeDrawTool btn-radio=\"\'LineString\'\">Line</button> <button class=btn ng-model=pinsCtrl.activeDrawTool btn-radio=\"\'Polygon\'\">Polygon</button></div><div ng-if=storyPin.getGeometry() class=\"btn-group nopad pull-right\"><button class=btn ng-class=\"pinsCtrl.activeDrawTool == \'Modify\' ? \'active\' : null\" ng-click=\"pinsCtrl.activeDrawTool = \'Modify\'\">Edit</button> <button class=btn ng-click=pinsCtrl.deleteGeometry()>Delete</button></div></div></div><hr><div class=form-group><label>Start Time</label><st-date-time-field date-time=storyPin.start_time></st-date-time-field></div><div class=form-group><label>End Time</label><st-date-time-field date-time=storyPin.end_time></st-date-time-field></div><div ng-if=pinForm.$error.range class=ng-invalid>Start must be before End</div><table ng-if=showPointCoordinates() class=\"table table-bordered table-condensed table-hover\" style=\"background-color: white\"><tbody><tr><td>Latitude</td><td><input ng-model=point.latitude class=form-control type=number placeholder=DD.MMSSSS></td></tr><tr><td>Longitude</td><td><input ng-model=point.longitude class=form-control type=number placeholder=DD.MMSSSS></td></tr></tbody></table><hr><div class=form-group><label>Options</label><div><div class=checkbox><input ng-model=storyPin.in_timeline id=showInTimeline type=checkbox> <label for=showInTimeline>Show in Timeline</label></div><div class=checkbox><input ng-model=storyPin.in_map id=showInMap type=checkbox> <label for=showInMap>Show in Map</label></div></div></div></form>"); | ||
$templateCache.put("time/date-time-field.html","<p class=input-group><input type=text iso-date-time class=form-control ng-model=dateTime placeholder=YYYY-MM-DDTHH:mm:ss> <span class=input-group-btn><button ng-click=setFromCurrentTime() title=\"Set From Current Time\"><i class=\"glyphicon glyphicon-time\"></i></button></span></p>"); | ||
@@ -13,0 +13,0 @@ $templateCache.put("style/types/class-point.html","<classify-editor attribute-filter=number show-method=true show-max-classes=true show-color-ramp=true></classify-editor><symbol-editor hide-color=true st-model=activeStyle show-graphic=true show-rotation=true></symbol-editor><stroke-editor st-model=activeStyle></stroke-editor><label-editor st-model=activeStyle></label-editor>"); |
@@ -579,3 +579,3 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof global?o=global:"undefined"!=typeof self&&(o=self),(o.storytools||(o.storytools={})).edit=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
identifier: { | ||
value: "results" | ||
value: "result" | ||
}, | ||
@@ -582,0 +582,0 @@ mimeType: mimeType |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),(t.storytools||(t.storytools={})).edit=e()}}(function(){return function e(t,n,a){function o(s,l){if(!n[s]){if(!t[s]){var i="function"==typeof require&&require;if(!l&&i)return i(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var m=n[s]={exports:{}};t[s][0].call(m.exports,function(e){var n=t[s][1][e];return o(n?n:e)},m,m.exports,e,t,n,a)}return n[s].exports}for(var r="function"==typeof require&&require,s=0;s<a.length;s++)o(a[s]);return o}({1:[function(e,t,n){n.WPSClassify=e("./style/WPSClassify"),n.SLDStyleConverter=e("./style/SLDStyleConverter"),n.WFSDescribeFeatureType=e("./style/WFSDescribeFeatureType"),n.StyleComplete=e("./style/StyleComplete"),n.styleStorageService=e("./style/styleStorageService")},{"./style/SLDStyleConverter":2,"./style/StyleComplete":3,"./style/WFSDescribeFeatureType":4,"./style/WPSClassify":5,"./style/styleStorageService":6}],2:[function(e,t,n){n.SLDStyleConverter=function(){return{generateStyle:function(e,t,n){var a=this.convertJSON(e,t);return this.context||(this.context=new owsjs.Jsonix.Context([owsjs.mappings.XLink_1_0,owsjs.mappings.Filter_1_0_0,owsjs.mappings.GML_2_1_2,owsjs.mappings.SLD_1_0_0],{namespacePrefixes:{"http://www.w3.org/1999/xlink":"xlink","http://www.opengis.net/sld":"sld","http://www.opengis.net/ogc":"ogc"}}),this.marshaller=this.context.createMarshaller()),n===!0?this.marshaller.marshalString(a):this.marshaller.marshalDocument(a)},createFill:function(e,t){return{cssParameter:[{name:"fill",content:[t&&t.style.symbol.fillColor?t.style.symbol.fillColor:e.symbol.fillColor]},{name:"fill-opacity",content:[String(t?(t.style.symbol.fillOpacity||100)/100:(e.symbol.fillOpacity||100)/100)]}]}},createStroke:function(e,t){var n;return"dashed"===e.stroke.strokeStyle?n="5":"dotted"===e.stroke.strokeStyle&&(n="1 2"),{cssParameter:[{name:"stroke",content:[t&&t.style.stroke.strokeColor?t.style.stroke.strokeColor:e.stroke.strokeColor]},{name:"stroke-width",content:t&&t.style.stroke.strokeWidth?[String(t.style.stroke.strokeWidth)]:[String(e.stroke.strokeWidth)]},{name:"stroke-opacity",content:e.stroke.strokeOpacity?[String(e.stroke.strokeOpacity/100)]:void 0},{name:"stroke-dasharray",content:n?[n]:void 0}]}},createPolygonSymbolizer:function(e,t){var n=this.createFill(e,t),a=this.createStroke(e),o={name:{localPart:"PolygonSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{fill:n,stroke:a}};return o},createPointSymbolizer:function(e,t){var n,a=this.createFill(e,t),o=this.createStroke(e);if(e.symbol&&e.symbol.graphic){var r=document.createElement("a");r.href=e.symbol.graphic+"?fill="+encodeURIComponent(t&&t.style.symbol.fillColor?t.style.symbol.fillColor:e.symbol.fillColor)+"&stroke="+encodeURIComponent(e.stroke.strokeColor),n=[{TYPE_NAME:"SLD_1_0_0.ExternalGraphic",fill:a,stroke:o,format:"image/svg+xml",onlineResource:{href:r.href}}]}else n=[{TYPE_NAME:"SLD_1_0_0.Mark",fill:a,stroke:o,wellKnownName:e.symbol&&e.symbol.shape||"circle"}];var s=1;return e.symbol&&angular.isDefined(e.symbol.fillOpacity)&&(s=Math.max(.01,e.symbol.fillOpacity)/100),{name:{localPart:"PointSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{graphic:{externalGraphicOrMark:n,opacity:{content:[String(s)]},size:{content:[String(t&&t.style.symbol&&t.style.symbol.size||e.symbol&&e.symbol.size||10)]},rotation:e.symbol&&e.symbol.rotationAttribute?{content:["degrees"===e.symbol.rotationUnits?{name:{localPart:"PropertyName",namespaceURI:"http://www.opengis.net/ogc"},value:{content:[e.symbol.rotationAttribute]}}:{name:{localPart:"Div",namespaceURI:"http://www.opengis.net/ogc"},value:{expression:[{name:{localPart:"PropertyName",namespaceURI:"http://www.opengis.net/ogc"},value:{content:[e.symbol.rotationAttribute]}},{name:{localPart:"Div",namespaceURI:"http://www.opengis.net/ogc"},value:{expression:[{name:{localPart:"Function",namespaceURI:"http://www.opengis.net/ogc"},value:{name:"pi"}},{name:{localPart:"Literal",namespaceURI:"http://www.opengis.net/ogc"},value:{content:["360"]}}]}}]}}]}:void 0}}}},createLineSymbolizer:function(e,t){return{name:{localPart:"LineSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{stroke:this.createStroke(e,t)}}},createTextSymbolizer:function(e){var t,n=e.label.fontFamily.toLowerCase();return"serif"===n?t="Serif":"sans-serif"===n?t="SansSerif":"cursive"===n?t="Comic Sans MS":"monospace"===n&&(t="Courier New"),{name:{localPart:"TextSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{fill:{cssParameter:[{name:"fill",content:[e.label.fillColor]}]},halo:{fill:{cssParameter:[{name:"fill",content:["#FFFFFF"]}]},radius:{content:["1"]}},labelPlacement:{linePlacement:{}},font:{cssParameter:[{name:"font-family",content:t?[t]:void 0},{name:"font-size",content:[String(e.label.fontSize)]},{name:"font-style",content:[e.label.fontStyle]},{name:"font-weight",content:[e.label.fontWeight]}]},label:{content:[{name:{localPart:"PropertyName",namespaceURI:"http://www.opengis.net/ogc"},value:{content:[e.label.attribute]}}]},vendorOption:[{name:"maxDisplacement",content:"40"},{name:"autoWrap",content:"40"},{name:"spaceAround",content:"0"},{name:"followLine",content:"false"},{name:"group",content:"yes"},{name:"goodnessOfFit",content:"0.2"},{name:"conflictResolution",content:"true"}]}}},convertJSON:function(e,t){var n={name:{namespaceURI:"http://www.opengis.net/sld",localPart:"StyledLayerDescriptor"}};n.value={version:"1.0.0",namedLayerOrUserLayer:[{TYPE_NAME:"SLD_1_0_0.NamedLayer",name:t,namedStyleOrUserStyle:[{TYPE_NAME:"SLD_1_0_0.UserStyle",name:e.name,featureTypeStyle:[{rule:[]}]}]}]};var a,o=n.value.namedLayerOrUserLayer[0].namedStyleOrUserStyle[0].featureTypeStyle[0].rule;if(e.rules)for(var r=0,s=e.rules.length;s>r;++r){var l,i=e.rules[r];i.value?l={comparisonOps:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyIsEqualTo"},value:{expression:[{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyName"},value:{content:[e.classify.attribute]}},{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"Literal"},value:{content:[String(i.value)]}}]}}}:i.range&&(l={comparisonOps:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyIsBetween"},value:{expression:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyName"},value:{content:[e.classify.attribute]}},lowerBoundary:{expression:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"Literal"},value:{content:[String(i.range.min)]}}},upperBoundary:{expression:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"Literal"},value:{content:[String(i.range.max)]}}}}}}),a={title:i.name,name:i.name,filter:l,symbolizer:[]},"point"===e.geomType?a.symbolizer.push(this.createPointSymbolizer(e,i)):"line"===e.geomType?a.symbolizer.push(this.createLineSymbolizer(e,i)):"polygon"===e.geomType&&a.symbolizer.push(this.createPolygonSymbolizer(e,i)),e.label&&null!==e.label.attribute&&a.symbolizer.push(this.createTextSymbolizer(e)),o.push(a)}else a={symbolizer:[]},o.push(a),"point"===e.geomType?a.symbolizer.push(this.createPointSymbolizer(e)):"line"===e.geomType?a.symbolizer.push(this.createLineSymbolizer(e)):"polygon"===e.geomType&&a.symbolizer.push(this.createPolygonSymbolizer(e)),e.label&&null!==e.label.attribute&&a.symbolizer.push(this.createTextSymbolizer(e));return n}}}},{}],3:[function(e,t,n){n.StyleComplete=function(){return{isComplete:function(e){if(void 0===e)return!1;if(e.classify)if("unique"===e.classify.method){if(null===e.classify.attribute||null===e.classify.maxClasses)return!1}else if(null===e.classify.method||null===e.classify.attribute||null===e.classify.colorRamp||0===e.rules.length)return!1;return!0}}}},{}],4:[function(e,t,n){n.WFSDescribeFeatureType=function(){this.parseResult=function(e){this.context||(this.context=new owsjs.Jsonix.Context([owsjs.mappings.XSD_1_0]),this.unmarshaller=this.context.createUnmarshaller());for(var t,n,a=this.unmarshaller.unmarshalString(e).value,o=a.targetNamespace,r=a.complexType[0].complexContent.extension.sequence.element,s=[],l=0,i=r.length;i>l;++l){var c=r[l];if("http://www.opengis.net/gml"===c.type.namespaceURI){var m=c.type.localPart;-1!==m.indexOf("Polygon")?t="polygon":-1!==m.indexOf("LineString")?t="line":-1!==m.indexOf("Point")&&(t="point")}else"dateTime"===c.type.localPart&&(n=void 0===n?c.name:null);s.push({name:c.name,type:c.type.localPart,typeNS:c.type.namespaceURI})}return{timeAttribute:n,featureNS:o,geomType:t,attributes:s}}}},{}],5:[function(e,t,n){n.WPSClassify=function(){this.parseResult=function(e){var t=(new DOMParser).parseFromString(e,"application/xml"),n=t.getElementsByTagNameNS("http://www.opengis.net/ows/1.1","ExceptionText");if(0===n.length){for(var a=t.getElementsByTagName("Class"),o=[],r=0,s=a.length;s>r;++r){var l=a[r].getAttribute("lowerBound"),i=a[r].getAttribute("upperBound");o.push({name:l+"-"+i,range:{min:l,max:i}})}return{success:!0,rules:o}}return{success:!1,msg:n[0].textContent}},this.createContext=function(){this.context=new owsjs.Jsonix.Context([owsjs.mappings.XLink_1_0,owsjs.mappings.OWS_1_1_0,owsjs.mappings.Filter_1_1_0,owsjs.mappings.OWS_1_0_0,owsjs.mappings.SMIL_2_0,owsjs.mappings.SMIL_2_0_Language,owsjs.mappings.GML_3_1_1,owsjs.mappings.WFS_1_1_0,owsjs.mappings.WPS_1_0_0],{namespacePrefixes:{"http://www.w3.org/1999/xlink":"xlink","http://www.opengis.net/wps/1.0.0":"wps","http://www.opengis.net/ows/1.1":"ows","http://www.opengis.net/wfs":"wfs"}}),this.marshaller=this.context.createMarshaller()},this.getUniqueValues=function(e,t){this.context||this.createContext();var n=this.generateMainConfig("gs:Unique","application/json",e);return n.value.dataInputs.input.push({identifier:{value:"attribute"},data:{literalData:{value:e.attribute}}}),t===!0?this.marshaller.marshalString(n):this.marshaller.marshalDocument(n)},this.generateMainConfig=function(e,t,n){return{name:{localPart:"Execute",namespaceURI:"http://www.opengis.net/wps/1.0.0"},value:{service:"WPS",version:"1.0.0",identifier:{value:e},responseForm:{rawDataOutput:{identifier:{value:"results"},mimeType:t}},dataInputs:{input:[{identifier:{value:"features"},reference:{method:"POST",mimeType:"text/xml",href:"http://geoserver/wfs",body:{content:[{name:{namespaceURI:"http://www.opengis.net/wfs",localPart:"GetFeature"},value:{outputFormat:"GML2",service:"WFS",version:"1.1.0",query:[{typeName:[{ns:n.featureNS,lp:n.typeName.split(":")[1]||n.typeName,p:n.featurePrefix}]}]}}]}}}]}}}},this.classifyVector=function(e,t){this.context||this.createContext();var n=this.generateMainConfig("vec:FeatureClassStats",void 0,e);return n.value.dataInputs.input.push({identifier:{value:"attribute"},data:{literalData:{value:e.attribute}}},{identifier:{value:"classes"},data:{literalData:{value:String(e.numClasses)}}},{identifier:{value:"method"},data:{literalData:{value:e.method}}},{identifier:{value:"stats"},data:{literalData:{value:"mean"}}}),t===!0?this.marshaller.marshalString(n):this.marshaller.marshalDocument(n)}}},{}],6:[function(e,t,n){n.styleStorageService=function(){var e={},t=function(e){return void 0!==e&&null!==e?!0:!1};return e.getSavedStyle=function(e,n){var a,o=null,r="object"==typeof e,s="string"==typeof e;r?a=e.get("metadata").name:s&&(a=e);var l=n||window.config.chapter_index;if(t(window.config.stylestore)&&t(l)&&t(window.config.stylestore[l])&&t(window.config.stylestore[l][a]))o=window.config.stylestore[l][a];else if(t(window.config.chapters)&&t(window.config.chapters[l]))for(var i=window.config.chapters[l].map.layers,c=0;c<i.length;c++)i[c].name===a&&t(i[c].jsonstyle)&&(o=i[c].jsonstyle);else r&&e.get("metadata").jsonstyle&&(o=e.get("metadata").jsonstyle);return o},e.saveStyle=function(e){if(t(window.config)){var n=window.config.chapter_index,a=e.get("style")||e.get("metadata").style;t(window.config.stylestore)?t(window.config.stylestore[n])?window.config.stylestore[n][e.get("metadata").name]=a:(window.config.stylestore[n]={},window.config.stylestore[n][e.get("metadata").name]=a):(window.config.stylestore={},window.config.stylestore[n]={},window.config.stylestore[n][e.get("metadata").name]=a)}},e}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),(t.storytools||(t.storytools={})).edit=e()}}(function(){return function e(t,n,a){function o(s,l){if(!n[s]){if(!t[s]){var i="function"==typeof require&&require;if(!l&&i)return i(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var m=n[s]={exports:{}};t[s][0].call(m.exports,function(e){var n=t[s][1][e];return o(n?n:e)},m,m.exports,e,t,n,a)}return n[s].exports}for(var r="function"==typeof require&&require,s=0;s<a.length;s++)o(a[s]);return o}({1:[function(e,t,n){n.WPSClassify=e("./style/WPSClassify"),n.SLDStyleConverter=e("./style/SLDStyleConverter"),n.WFSDescribeFeatureType=e("./style/WFSDescribeFeatureType"),n.StyleComplete=e("./style/StyleComplete"),n.styleStorageService=e("./style/styleStorageService")},{"./style/SLDStyleConverter":2,"./style/StyleComplete":3,"./style/WFSDescribeFeatureType":4,"./style/WPSClassify":5,"./style/styleStorageService":6}],2:[function(e,t,n){n.SLDStyleConverter=function(){return{generateStyle:function(e,t,n){var a=this.convertJSON(e,t);return this.context||(this.context=new owsjs.Jsonix.Context([owsjs.mappings.XLink_1_0,owsjs.mappings.Filter_1_0_0,owsjs.mappings.GML_2_1_2,owsjs.mappings.SLD_1_0_0],{namespacePrefixes:{"http://www.w3.org/1999/xlink":"xlink","http://www.opengis.net/sld":"sld","http://www.opengis.net/ogc":"ogc"}}),this.marshaller=this.context.createMarshaller()),n===!0?this.marshaller.marshalString(a):this.marshaller.marshalDocument(a)},createFill:function(e,t){return{cssParameter:[{name:"fill",content:[t&&t.style.symbol.fillColor?t.style.symbol.fillColor:e.symbol.fillColor]},{name:"fill-opacity",content:[String(t?(t.style.symbol.fillOpacity||100)/100:(e.symbol.fillOpacity||100)/100)]}]}},createStroke:function(e,t){var n;return"dashed"===e.stroke.strokeStyle?n="5":"dotted"===e.stroke.strokeStyle&&(n="1 2"),{cssParameter:[{name:"stroke",content:[t&&t.style.stroke.strokeColor?t.style.stroke.strokeColor:e.stroke.strokeColor]},{name:"stroke-width",content:t&&t.style.stroke.strokeWidth?[String(t.style.stroke.strokeWidth)]:[String(e.stroke.strokeWidth)]},{name:"stroke-opacity",content:e.stroke.strokeOpacity?[String(e.stroke.strokeOpacity/100)]:void 0},{name:"stroke-dasharray",content:n?[n]:void 0}]}},createPolygonSymbolizer:function(e,t){var n=this.createFill(e,t),a=this.createStroke(e),o={name:{localPart:"PolygonSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{fill:n,stroke:a}};return o},createPointSymbolizer:function(e,t){var n,a=this.createFill(e,t),o=this.createStroke(e);if(e.symbol&&e.symbol.graphic){var r=document.createElement("a");r.href=e.symbol.graphic+"?fill="+encodeURIComponent(t&&t.style.symbol.fillColor?t.style.symbol.fillColor:e.symbol.fillColor)+"&stroke="+encodeURIComponent(e.stroke.strokeColor),n=[{TYPE_NAME:"SLD_1_0_0.ExternalGraphic",fill:a,stroke:o,format:"image/svg+xml",onlineResource:{href:r.href}}]}else n=[{TYPE_NAME:"SLD_1_0_0.Mark",fill:a,stroke:o,wellKnownName:e.symbol&&e.symbol.shape||"circle"}];var s=1;return e.symbol&&angular.isDefined(e.symbol.fillOpacity)&&(s=Math.max(.01,e.symbol.fillOpacity)/100),{name:{localPart:"PointSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{graphic:{externalGraphicOrMark:n,opacity:{content:[String(s)]},size:{content:[String(t&&t.style.symbol&&t.style.symbol.size||e.symbol&&e.symbol.size||10)]},rotation:e.symbol&&e.symbol.rotationAttribute?{content:["degrees"===e.symbol.rotationUnits?{name:{localPart:"PropertyName",namespaceURI:"http://www.opengis.net/ogc"},value:{content:[e.symbol.rotationAttribute]}}:{name:{localPart:"Div",namespaceURI:"http://www.opengis.net/ogc"},value:{expression:[{name:{localPart:"PropertyName",namespaceURI:"http://www.opengis.net/ogc"},value:{content:[e.symbol.rotationAttribute]}},{name:{localPart:"Div",namespaceURI:"http://www.opengis.net/ogc"},value:{expression:[{name:{localPart:"Function",namespaceURI:"http://www.opengis.net/ogc"},value:{name:"pi"}},{name:{localPart:"Literal",namespaceURI:"http://www.opengis.net/ogc"},value:{content:["360"]}}]}}]}}]}:void 0}}}},createLineSymbolizer:function(e,t){return{name:{localPart:"LineSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{stroke:this.createStroke(e,t)}}},createTextSymbolizer:function(e){var t,n=e.label.fontFamily.toLowerCase();return"serif"===n?t="Serif":"sans-serif"===n?t="SansSerif":"cursive"===n?t="Comic Sans MS":"monospace"===n&&(t="Courier New"),{name:{localPart:"TextSymbolizer",namespaceURI:"http://www.opengis.net/sld"},value:{fill:{cssParameter:[{name:"fill",content:[e.label.fillColor]}]},halo:{fill:{cssParameter:[{name:"fill",content:["#FFFFFF"]}]},radius:{content:["1"]}},labelPlacement:{linePlacement:{}},font:{cssParameter:[{name:"font-family",content:t?[t]:void 0},{name:"font-size",content:[String(e.label.fontSize)]},{name:"font-style",content:[e.label.fontStyle]},{name:"font-weight",content:[e.label.fontWeight]}]},label:{content:[{name:{localPart:"PropertyName",namespaceURI:"http://www.opengis.net/ogc"},value:{content:[e.label.attribute]}}]},vendorOption:[{name:"maxDisplacement",content:"40"},{name:"autoWrap",content:"40"},{name:"spaceAround",content:"0"},{name:"followLine",content:"false"},{name:"group",content:"yes"},{name:"goodnessOfFit",content:"0.2"},{name:"conflictResolution",content:"true"}]}}},convertJSON:function(e,t){var n={name:{namespaceURI:"http://www.opengis.net/sld",localPart:"StyledLayerDescriptor"}};n.value={version:"1.0.0",namedLayerOrUserLayer:[{TYPE_NAME:"SLD_1_0_0.NamedLayer",name:t,namedStyleOrUserStyle:[{TYPE_NAME:"SLD_1_0_0.UserStyle",name:e.name,featureTypeStyle:[{rule:[]}]}]}]};var a,o=n.value.namedLayerOrUserLayer[0].namedStyleOrUserStyle[0].featureTypeStyle[0].rule;if(e.rules)for(var r=0,s=e.rules.length;s>r;++r){var l,i=e.rules[r];i.value?l={comparisonOps:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyIsEqualTo"},value:{expression:[{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyName"},value:{content:[e.classify.attribute]}},{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"Literal"},value:{content:[String(i.value)]}}]}}}:i.range&&(l={comparisonOps:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyIsBetween"},value:{expression:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"PropertyName"},value:{content:[e.classify.attribute]}},lowerBoundary:{expression:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"Literal"},value:{content:[String(i.range.min)]}}},upperBoundary:{expression:{name:{namespaceURI:"http://www.opengis.net/ogc",localPart:"Literal"},value:{content:[String(i.range.max)]}}}}}}),a={title:i.name,name:i.name,filter:l,symbolizer:[]},"point"===e.geomType?a.symbolizer.push(this.createPointSymbolizer(e,i)):"line"===e.geomType?a.symbolizer.push(this.createLineSymbolizer(e,i)):"polygon"===e.geomType&&a.symbolizer.push(this.createPolygonSymbolizer(e,i)),e.label&&null!==e.label.attribute&&a.symbolizer.push(this.createTextSymbolizer(e)),o.push(a)}else a={symbolizer:[]},o.push(a),"point"===e.geomType?a.symbolizer.push(this.createPointSymbolizer(e)):"line"===e.geomType?a.symbolizer.push(this.createLineSymbolizer(e)):"polygon"===e.geomType&&a.symbolizer.push(this.createPolygonSymbolizer(e)),e.label&&null!==e.label.attribute&&a.symbolizer.push(this.createTextSymbolizer(e));return n}}}},{}],3:[function(e,t,n){n.StyleComplete=function(){return{isComplete:function(e){if(void 0===e)return!1;if(e.classify)if("unique"===e.classify.method){if(null===e.classify.attribute||null===e.classify.maxClasses)return!1}else if(null===e.classify.method||null===e.classify.attribute||null===e.classify.colorRamp||0===e.rules.length)return!1;return!0}}}},{}],4:[function(e,t,n){n.WFSDescribeFeatureType=function(){this.parseResult=function(e){this.context||(this.context=new owsjs.Jsonix.Context([owsjs.mappings.XSD_1_0]),this.unmarshaller=this.context.createUnmarshaller());for(var t,n,a=this.unmarshaller.unmarshalString(e).value,o=a.targetNamespace,r=a.complexType[0].complexContent.extension.sequence.element,s=[],l=0,i=r.length;i>l;++l){var c=r[l];if("http://www.opengis.net/gml"===c.type.namespaceURI){var m=c.type.localPart;-1!==m.indexOf("Polygon")?t="polygon":-1!==m.indexOf("LineString")?t="line":-1!==m.indexOf("Point")&&(t="point")}else"dateTime"===c.type.localPart&&(n=void 0===n?c.name:null);s.push({name:c.name,type:c.type.localPart,typeNS:c.type.namespaceURI})}return{timeAttribute:n,featureNS:o,geomType:t,attributes:s}}}},{}],5:[function(e,t,n){n.WPSClassify=function(){this.parseResult=function(e){var t=(new DOMParser).parseFromString(e,"application/xml"),n=t.getElementsByTagNameNS("http://www.opengis.net/ows/1.1","ExceptionText");if(0===n.length){for(var a=t.getElementsByTagName("Class"),o=[],r=0,s=a.length;s>r;++r){var l=a[r].getAttribute("lowerBound"),i=a[r].getAttribute("upperBound");o.push({name:l+"-"+i,range:{min:l,max:i}})}return{success:!0,rules:o}}return{success:!1,msg:n[0].textContent}},this.createContext=function(){this.context=new owsjs.Jsonix.Context([owsjs.mappings.XLink_1_0,owsjs.mappings.OWS_1_1_0,owsjs.mappings.Filter_1_1_0,owsjs.mappings.OWS_1_0_0,owsjs.mappings.SMIL_2_0,owsjs.mappings.SMIL_2_0_Language,owsjs.mappings.GML_3_1_1,owsjs.mappings.WFS_1_1_0,owsjs.mappings.WPS_1_0_0],{namespacePrefixes:{"http://www.w3.org/1999/xlink":"xlink","http://www.opengis.net/wps/1.0.0":"wps","http://www.opengis.net/ows/1.1":"ows","http://www.opengis.net/wfs":"wfs"}}),this.marshaller=this.context.createMarshaller()},this.getUniqueValues=function(e,t){this.context||this.createContext();var n=this.generateMainConfig("gs:Unique","application/json",e);return n.value.dataInputs.input.push({identifier:{value:"attribute"},data:{literalData:{value:e.attribute}}}),t===!0?this.marshaller.marshalString(n):this.marshaller.marshalDocument(n)},this.generateMainConfig=function(e,t,n){return{name:{localPart:"Execute",namespaceURI:"http://www.opengis.net/wps/1.0.0"},value:{service:"WPS",version:"1.0.0",identifier:{value:e},responseForm:{rawDataOutput:{identifier:{value:"result"},mimeType:t}},dataInputs:{input:[{identifier:{value:"features"},reference:{method:"POST",mimeType:"text/xml",href:"http://geoserver/wfs",body:{content:[{name:{namespaceURI:"http://www.opengis.net/wfs",localPart:"GetFeature"},value:{outputFormat:"GML2",service:"WFS",version:"1.1.0",query:[{typeName:[{ns:n.featureNS,lp:n.typeName.split(":")[1]||n.typeName,p:n.featurePrefix}]}]}}]}}}]}}}},this.classifyVector=function(e,t){this.context||this.createContext();var n=this.generateMainConfig("vec:FeatureClassStats",void 0,e);return n.value.dataInputs.input.push({identifier:{value:"attribute"},data:{literalData:{value:e.attribute}}},{identifier:{value:"classes"},data:{literalData:{value:String(e.numClasses)}}},{identifier:{value:"method"},data:{literalData:{value:e.method}}},{identifier:{value:"stats"},data:{literalData:{value:"mean"}}}),t===!0?this.marshaller.marshalString(n):this.marshaller.marshalDocument(n)}}},{}],6:[function(e,t,n){n.styleStorageService=function(){var e={},t=function(e){return void 0!==e&&null!==e?!0:!1};return e.getSavedStyle=function(e,n){var a,o=null,r="object"==typeof e,s="string"==typeof e;r?a=e.get("metadata").name:s&&(a=e);var l=n||window.config.chapter_index;if(t(window.config.stylestore)&&t(l)&&t(window.config.stylestore[l])&&t(window.config.stylestore[l][a]))o=window.config.stylestore[l][a];else if(t(window.config.chapters)&&t(window.config.chapters[l]))for(var i=window.config.chapters[l].map.layers,c=0;c<i.length;c++)i[c].name===a&&t(i[c].jsonstyle)&&(o=i[c].jsonstyle);else r&&e.get("metadata").jsonstyle&&(o=e.get("metadata").jsonstyle);return o},e.saveStyle=function(e){if(t(window.config)){var n=window.config.chapter_index,a=e.get("style")||e.get("metadata").style;t(window.config.stylestore)?t(window.config.stylestore[n])?window.config.stylestore[n][e.get("metadata").name]=a:(window.config.stylestore[n]={},window.config.stylestore[n][e.get("metadata").name]=a):(window.config.stylestore={},window.config.stylestore[n]={},window.config.stylestore[n][e.get("metadata").name]=a)}},e}},{}]},{},[1])(1)}); |
{ | ||
"name": "@boundlessgeo/storytools", | ||
"version": "1.0.0-alpha10", | ||
"version": "1.0.0-alpha11", | ||
"description": "Additional maploom tools", | ||
@@ -5,0 +5,0 @@ "homepage": "", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6
15596877
187030