| New file |
| | |
| | | /** |
| | | * 时间轴widget |
| | | * @author Liuyl |
| | | * @date 2015/10/15 |
| | | */ |
| | | define([ |
| | | "dojo/_base/declare", "dojo/_base/array", "dojo/_base/lang", |
| | | "dojo/dom", "dojo/dom-style", "dojo/dom-class", "dojo/dom-attr", "dojo/dom-construct", |
| | | "dojo/topic", |
| | | "dijit/_WidgetBase", "dijit/_TemplatedMixin", |
| | | "dojo/text!controls/timeliner/TimeLinerControl.html", |
| | | "base/BaseControl", "base/AppEvent","base/ConfigData", |
| | | "controls/timeliner/js/jquery.timeliner.min" |
| | | ], function( |
| | | declare, arrayUtil, lang, |
| | | dom, domStyle, domClass, domAttr, domConstruct, |
| | | topic, |
| | | _WidgetBase, _TemplatedMixin, |
| | | template, |
| | | BaseControl, AppEvent,ConfigData |
| | | ) { |
| | | var Widget = declare("TimeLinerControl", [BaseControl], { |
| | | templateString: template, |
| | | baseClass: "timeliner-base", |
| | | constructor: function(options) { |
| | | this._map = options.map; |
| | | }, |
| | | startup: function() { |
| | | var thisobj = this; |
| | | this.inherited(arguments); |
| | | AppEvent.addAppEventListener(AppEvent.LOAD_OTHERTIMELAYER, lang.hitch(this, function(evt) { |
| | | if(dojo.byId("all")){ |
| | | dojo.destroy("all"); |
| | | } |
| | | if(dojo.byId("bar_div")){ |
| | | dojo.destroy("bar_div"); |
| | | } |
| | | var all=domConstruct.create("div", { |
| | | id: "all", |
| | | style:"height: 106px;width:100%;", |
| | | }, this.domNode); |
| | | var bar_div=domConstruct.create("div", { |
| | | id: "bar_div", |
| | | style:"height: 53px;width:100%;background-color: #fff;margin-top: -43px;", |
| | | }, this.domNode); |
| | | var all_div=domConstruct.create("div", { |
| | | style:"width: 600px;margin: 0px auto;height: 88px;", |
| | | }, all); |
| | | domConstruct.create("div", { |
| | | id: "start", |
| | | style:"float:left;margin-top: 77px;" |
| | | }, all_div); |
| | | domConstruct.create("ul", { |
| | | id: "example1", |
| | | class: "timeliner", |
| | | style:"float:left;" |
| | | },all_div); |
| | | domConstruct.create("div", { |
| | | id: "end", |
| | | style:"float:left;margin-top: 77px;" |
| | | }, all_div); |
| | | var close_btn=domConstruct.create("div", { |
| | | id: "butt", |
| | | }, all_div); |
| | | $("#start").html("起始年份"); |
| | | $("#end").html("结束年份"); |
| | | $("#butt").html("X"); |
| | | for ( var int = 0; int < evt.times.length; int++) { |
| | | domConstruct.create("li", { |
| | | title: evt.times[int].name |
| | | }, "example1"); |
| | | } |
| | | var lay=evt.times; |
| | | $("#butt").on("click",function(event,clear) { |
| | | for ( var y = 0; y <lay.length; y++) { |
| | | if(!lay[y].init){ |
| | | thisobj._map.removeLayer(lay[y].layer); |
| | | } |
| | | } |
| | | if(!clear){ |
| | | for ( var y = 0; y <lay.length; y++) { |
| | | if(lay[y].init){ |
| | | thisobj._map.addLayer(lay[y].layer); |
| | | } |
| | | } |
| | | } |
| | | |
| | | dojo.destroy("all"); |
| | | dojo.destroy("bar_div"); |
| | | }); |
| | | $('#example1').timeliner({times:evt.times,map:thisobj._map}); |
| | | $.fn.timeliner.inityear(2); |
| | | })); |
| | | }, |
| | | show: function() { |
| | | |
| | | }, |
| | | hide: function() { |
| | | |
| | | } |
| | | }); |
| | | return Widget; |
| | | }); |