diff options
Diffstat (limited to 'site/app/webroot/js/simile/timeline/ext/geochrono/scripts')
5 files changed, 870 insertions, 0 deletions
diff --git a/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/ether-painters.js b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/ether-painters.js new file mode 100755 index 0000000..c9c0453 --- /dev/null +++ b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/ether-painters.js @@ -0,0 +1,204 @@ +/*================================================== + * Geochrono Ether Painter + *================================================== + */ + +Timeline.GeochronoEtherPainter = function(params, band, timeline) { + this._params = params; + this._intervalUnit = params.intervalUnit; + this._multiple = ("multiple" in params) ? params.multiple : 1; + this._theme = params.theme; +}; + +Timeline.GeochronoEtherPainter.prototype.initialize = function(band, timeline) { + this._band = band; + this._timeline = timeline; + + this._backgroundLayer = band.createLayerDiv(0); + this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging + this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()]; + + this._markerLayer = null; + this._lineLayer = null; + + var align = ("align" in this._params && typeof this._params.align == "string") ? this._params.align : + this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"]; + var showLine = ("showLine" in this._params) ? this._params.showLine : + this._theme.ether.interval.line.show; + + this._intervalMarkerLayout = new Timeline.GeochronoEtherMarkerLayout( + this._timeline, this._band, this._theme, align, showLine); + + this._highlight = new Timeline.EtherHighlight( + this._timeline, this._band, this._theme, this._backgroundLayer); +} + +Timeline.GeochronoEtherPainter.prototype.setHighlight = function(startDate, endDate) { + this._highlight.position(startDate, endDate); +} + +Timeline.GeochronoEtherPainter.prototype.paint = function() { + if (this._markerLayer) { + this._band.removeLayerDiv(this._markerLayer); + } + this._markerLayer = this._band.createLayerDiv(100); + this._markerLayer.setAttribute("name", "ether-markers"); // for debugging + this._markerLayer.style.display = "none"; + + if (this._lineLayer) { + this._band.removeLayerDiv(this._lineLayer); + } + this._lineLayer = this._band.createLayerDiv(1); + this._lineLayer.setAttribute("name", "ether-lines"); // for debugging + this._lineLayer.style.display = "none"; + + var minDate = Math.ceil(Timeline.GeochronoUnit.toNumber(this._band.getMinDate())); + var maxDate = Math.floor(Timeline.GeochronoUnit.toNumber(this._band.getMaxDate())); + + var increment; + var hasMore; + (function(intervalUnit, multiple) { + var dates; + + switch (intervalUnit) { + case Timeline.GeochronoUnit.AGE: + dates = Timeline.Geochrono.ages; break; + case Timeline.GeochronoUnit.EPOCH: + dates = Timeline.Geochrono.epoches; break; + case Timeline.GeochronoUnit.PERIOD: + dates = Timeline.Geochrono.periods; break; + case Timeline.GeochronoUnit.ERA: + dates = Timeline.Geochrono.eras; break; + case Timeline.GeochronoUnit.EON: + dates = Timeline.Geochrono.eons; break; + default: + hasMore = function() { + return minDate > 0 && minDate > maxDate; + } + increment = function() { + minDate -= multiple; + }; + return; + } + + var startIndex = dates.length - 1; + while (startIndex > 0) { + if (minDate <= dates[startIndex].start) { + break; + } + startIndex--; + } + + minDate = dates[startIndex].start; + hasMore = function() { + return startIndex < (dates.length - 1) && minDate > maxDate; + }; + increment = function() { + startIndex++; + minDate = dates[startIndex].start; + }; + })(this._intervalUnit, this._multiple); + + var labeller = this._band.getLabeller(); + while (true) { + this._intervalMarkerLayout.createIntervalMarker( + Timeline.GeochronoUnit.fromNumber(minDate), + labeller, + this._intervalUnit, + this._markerLayer, + this._lineLayer + ); + if (hasMore()) { + increment(); + } else { + break; + } + } + this._markerLayer.style.display = "block"; + this._lineLayer.style.display = "block"; +}; + +Timeline.GeochronoEtherPainter.prototype.softPaint = function() { +}; + + +/*================================================== + * Geochrono Ether Marker Layout + *================================================== + */ + +Timeline.GeochronoEtherMarkerLayout = function(timeline, band, theme, align, showLine) { + var horizontal = timeline.isHorizontal(); + if (horizontal) { + if (align == "Top") { + this.positionDiv = function(div, offset) { + div.style.left = offset + "px"; + div.style.top = "0px"; + }; + } else { + this.positionDiv = function(div, offset) { + div.style.left = offset + "px"; + div.style.bottom = "0px"; + }; + } + } else { + if (align == "Left") { + this.positionDiv = function(div, offset) { + div.style.top = offset + "px"; + div.style.left = "0px"; + }; + } else { + this.positionDiv = function(div, offset) { + div.style.top = offset + "px"; + div.style.right = "0px"; + }; + } + } + + var markerTheme = theme.ether.interval.marker; + var lineTheme = theme.ether.interval.line; + + var stylePrefix = (horizontal ? "h" : "v") + align; + var labelStyler = markerTheme[stylePrefix + "Styler"]; + var emphasizedLabelStyler = markerTheme[stylePrefix + "EmphasizedStyler"]; + + this.createIntervalMarker = function(date, labeller, unit, markerDiv, lineDiv) { + var offset = Math.round(band.dateToPixelOffset(date)); + + if (showLine) { + var divLine = timeline.getDocument().createElement("div"); + divLine.style.position = "absolute"; + + if (lineTheme.opacity < 100) { + SimileAjax.Graphics.setOpacity(divLine, lineTheme.opacity); + } + + if (horizontal) { + divLine.style.borderLeft = "1px solid " + lineTheme.color; + divLine.style.left = offset + "px"; + divLine.style.width = "1px"; + divLine.style.top = "0px"; + divLine.style.height = "100%"; + } else { + divLine.style.borderTop = "1px solid " + lineTheme.color; + divLine.style.top = offset + "px"; + divLine.style.height = "1px"; + divLine.style.left = "0px"; + divLine.style.width = "100%"; + } + lineDiv.appendChild(divLine); + } + + var label = labeller.labelInterval(date, unit); + + var div = timeline.getDocument().createElement("div"); + div.innerHTML = label.text; + div.style.position = "absolute"; + (label.emphasized ? emphasizedLabelStyler : labelStyler)(div); + + this.positionDiv(div, offset); + markerDiv.appendChild(div); + + return div; + }; +};
\ No newline at end of file diff --git a/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/geochrono.js b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/geochrono.js new file mode 100755 index 0000000..dc9716a --- /dev/null +++ b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/geochrono.js @@ -0,0 +1,518 @@ +/*================================================== + * Geochrono + *================================================== + */ +Timeline.Geochrono = new Object(); +Timeline.Geochrono.eons = [ + { name: "Proterozoic", + start: 2500.000 + }, + { name: "Phanerozoic", + start: 542.000 + } +]; +Timeline.Geochrono.eras = [ + { name: "Paleoarchean", + start: 3600.000 + }, + { name: "Mesoarchean", + start: 3200.000 + }, + { name: "Neoarchean", + start: 2800.000 + }, + { name: "Paleoproterozoic", + start: 2500.000 + }, + { name: "Mesoproterozoic", + start: 1600.000 + }, + { name: "Neoproterozoic", + start: 1000.000 + }, + { name: "Paleozoic", + start: 542.000 + }, + { name: "Mesozoic", + start: 251.000 + }, + { name: "Cenozoic", + start: 65.500 + } +]; +Timeline.Geochrono.periods = [ + { name: "Siderian", + start: 2500.000 + }, + { name: "Rhyacian", + start: 2300.000 + }, + { name: "Orosirian", + start: 2050.000 + }, + { name: "Statherian", + start: 1800.000 + }, + { name: "Calymmian", + start: 1600.000 + }, + { name: "Ectasian", + start: 1400.000 + }, + { name: "Stenian", + start: 1200.000 + }, + { name: "Tonian", + start: 1000.000 + }, + { name: "Cryogenian", + start: 850.000 + }, + { name: "Ediacaran", + start: 600.000 + }, + { name: "Cambrian", + start: 542.000 + }, + { name: "Ordovician", + start: 488.300 + }, + { name: "Silurian", + start: 443.700 + }, + { name: "Devonian", + start: 416.000 + }, + { name: "Carboniferous", + start: 359.200 + }, + { name: "Permian", + start: 299.000 + }, + { name: "Triassic", + start: 251.000 + }, + { name: "Jurassic", + start: 199.600 + }, + { name: "Cretaceous", + start: 145.500 + }, + { name: "Paleogene", + start: 65.500 + }, + { name: "Neogene", + start: 23.030 + } +]; +Timeline.Geochrono.epoches = [ + { name: "Lower Cambrian", + start: 542.000 + }, + { name: "Middle Cambrian", + start: 513.000 + }, + { name: "Furongian", + start: 501.000 + }, + { name: "Lower Ordovician", + start: 488.300 + }, + { name: "Middle Ordovician", + start: 471.800 + }, + { name: "Upper Ordovician", + start: 460.900 + }, + { name: "Llandovery", + start: 443.700 + }, + { name: "Wenlock", + start: 428.200 + }, + { name: "Ludlow", + start: 422.900 + }, + { name: "Pridoli", + start: 418.700 + }, + { name: "Lower Devonian", + start: 416.000 + }, + { name: "Middle Devonian", + start: 397.500 + }, + { name: "Upper Devonian", + start: 385.300 + }, + { name: "Mississippian", + start: 359.200 + }, + { name: "Pennsylvanian", + start: 318.100 + }, + { name: "Cisuralian", + start: 299.000 + }, + { name: "Guadalupian", + start: 270.600 + }, + { name: "Lopingian", + start: 260.400 + }, + { name: "Lower Triassic", + start: 251.000 + }, + { name: "Middle Triassic", + start: 245.000 + }, + { name: "Upper Triassic", + start: 228.000 + }, + { name: "Lower Jurassic", + start: 199.600 + }, + { name: "Middle Jurassic", + start: 175.600 + }, + { name: "Upper Jurassic", + start: 161.200 + }, + { name: "Lower Cretaceous", + start: 145.500 + }, + { name: "Upper Cretaceous", + start: 99.600 + }, + { name: "Paleocene", + start: 65.500 + }, + { name: "Eocene", + start: 55.800 + }, + { name: "Oligocene", + start: 33.900 + }, + { name: "Miocene", + start: 23.030 + }, + { name: "Pliocene", + start: 5.332 + }, + { name: "Pleistocene", + start: 1.806 + }, + { name: "Holocene", + start: 0.012 + } +]; +Timeline.Geochrono.ages = [ + { name: "-", + start: 542.000 + }, + { name: "-", + start: 513.000 + }, + { name: "Paibian", + start: 501.000 + }, + { name: "Tremadocian", + start: 488.300 + }, + { name: "-", + start: 478.600 + }, + { name: "-", + start: 471.800 + }, + { name: "Darriwilian", + start: 468.100 + }, + { name: "-", + start: 460.900 + }, + { name: "-", + start: 455.800 + }, + { name: "Hirnantian", + start: 445.600 + }, + { name: "Rhuddanian", + start: 443.700 + }, + { name: "Aeronian", + start: 439.000 + }, + { name: "Telychian", + start: 436.100 + }, + { name: "Sheinwoodian", + start: 428.200 + }, + { name: "Homerian", + start: 426.200 + }, + { name: "Gorstian", + start: 422.900 + }, + { name: "Ludfordian", + start: 421.300 + }, + { name: "-", + start: 418.700 + }, + { name: "Lochkovian", + start: 416.000 + }, + { name: "Pragian", + start: 411.200 + }, + { name: "Emsian", + start: 407.000 + }, + { name: "Eifelian", + start: 397.500 + }, + { name: "Givetian", + start: 391.800 + }, + { name: "Frasnian", + start: 385.300 + }, + { name: "Famennian", + start: 374.500 + }, + { name: "Tournaisian", + start: 359.200 + }, + { name: "Visean", + start: 345.300 + }, + { name: "Serpukhovian", + start: 326.400 + }, + { name: "Bashkirian", + start: 318.100 + }, + { name: "Moscovian", + start: 311.700 + }, + { name: "Kazimovian", + start: 306.500 + }, + { name: "Gzhelian", + start: 303.900 + }, + { name: "Asselian", + start: 299.000 + }, + { name: "Sakmarian", + start: 294.600 + }, + { name: "Artinskian", + start: 284.400 + }, + { name: "Kungurian", + start: 275.600 + }, + { name: "Roadian", + start: 270.600 + }, + { name: "Wordian", + start: 268.000 + }, + { name: "Capitanian", + start: 265.800 + }, + { name: "Wuchiapingian", + start: 260.400 + }, + { name: "Changhsingian", + start: 253.800 + }, + { name: "Induan", + start: 251.000 + }, + { name: "Olenekian", + start: 249.700 + }, + { name: "Anisian", + start: 245.000 + }, + { name: "Ladinian", + start: 237.000 + }, + { name: "Carnian", + start: 228.000 + }, + { name: "Norian", + start: 216.500 + }, + { name: "Rhaetian", + start: 203.600 + }, + { name: "Hettangian", + start: 199.600 + }, + { name: "Sinemurian", + start: 196.500 + }, + { name: "Pliensbachian", + start: 189.600 + }, + { name: "Toarcian", + start: 183.000 + }, + { name: "Aalenian", + start: 175.600 + }, + { name: "Bajocian", + start: 171.600 + }, + { name: "Bathonian", + start: 167.700 + }, + { name: "Callovian", + start: 164.700 + }, + { name: "Oxfordian", + start: 161.200 + }, + { name: "Kimmeridgian", + start: 155.000 + }, + { name: "Tithonian", + start: 150.800 + }, + { name: "Berriasian", + start: 145.500 + }, + { name: "Valanginian", + start: 140.200 + }, + { name: "Hauterivian", + start: 136.400 + }, + { name: "Barremian", + start: 130.000 + }, + { name: "Aptian", + start: 125.000 + }, + { name: "Albian", + start: 112.000 + }, + { name: "Cenomanian", + start: 99.600 + }, + { name: "Turonian", + start: 93.500 + }, + { name: "Coniacian", + start: 89.300 + }, + { name: "Santonian", + start: 85.800 + }, + { name: "Campanian", + start: 83.500 + }, + { name: "Maastrichtian", + start: 70.600 + }, + { name: "Danian", + start: 65.500 + }, + { name: "Selandian", + start: 61.700 + }, + { name: "Thanetian", + start: 58.700 + }, + { name: "Ypresian", + start: 55.800 + }, + { name: "Lutetian", + start: 48.600 + }, + { name: "Bartonian", + start: 40.400 + }, + { name: "Priabonian", + start: 37.200 + }, + { name: "Rupelian", + start: 33.900 + }, + { name: "Chattian", + start: 28.400 + }, + { name: "Aquitanian", + start: 23.030 + }, + { name: "Burdigalian", + start: 20.430 + }, + { name: "Langhian", + start: 15.970 + }, + { name: "Serravallian", + start: 13.650 + }, + { name: "Tortonian", + start: 11.608 + }, + { name: "Messinian", + start: 7.246 + }, + { name: "Zanclean", + start: 5.332 + }, + { name: "Piacenzian", + start: 3.600 + }, + { name: "Gelasian", + start: 2.588 + } +]; + +Timeline.Geochrono.createBandInfo = function(params) { + var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme(); + + var eventSource = ("eventSource" in params) ? params.eventSource : null; + + var ether = new Timeline.LinearEther({ + centersOn: ("date" in params) ? params.date : Timeline.GeochronoUnit.makeDefaultValue(), + interval: 1, + pixelsPerInterval: params.intervalPixels + }); + + var etherPainter = new Timeline.GeochronoEtherPainter({ + intervalUnit: params.intervalUnit, + multiple: ("multiple" in params) ? params.multiple : 1, + align: params.align, + theme: theme + }); + + var eventPainterParams = { + theme: theme + }; + if ("trackHeight" in params) { + eventPainterParams.trackHeight = params.trackHeight; + } + if ("trackGap" in params) { + eventPainterParams.trackGap = params.trackGap; + } + var eventPainter = ("overview" in params && params.overview) ? + new Timeline.OverviewEventPainter(eventPainterParams) : + new Timeline.DetailedEventPainter(eventPainterParams); + + return { + width: params.width, + eventSource: eventSource, + timeZone: ("timeZone" in params) ? params.timeZone : 0, + ether: ether, + etherPainter: etherPainter, + eventPainter: eventPainter + }; +};
\ No newline at end of file diff --git a/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/l10n/en/labellers.js b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/l10n/en/labellers.js new file mode 100755 index 0000000..7e66701 --- /dev/null +++ b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/l10n/en/labellers.js @@ -0,0 +1,10 @@ +/*================================================== + * Localization of Geochrono Labeller + *================================================== + */ + +Timeline.GeochronoLabeller.eonNames["en"] = Timeline.Geochrono.eons; +Timeline.GeochronoLabeller.eraNames["en"] = Timeline.Geochrono.eras; +Timeline.GeochronoLabeller.periodNames["en"] = Timeline.Geochrono.periods; +Timeline.GeochronoLabeller.epochNames["en"] = Timeline.Geochrono.epoches; +Timeline.GeochronoLabeller.ageNames["en"] = Timeline.Geochrono.ages; diff --git a/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/labellers.js b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/labellers.js new file mode 100755 index 0000000..3aabd15 --- /dev/null +++ b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/labellers.js @@ -0,0 +1,52 @@ +/*================================================== + * Geochrono Labeller + *================================================== + */ + +Timeline.GeochronoLabeller = function(locale) { + this._locale = locale; +}; + +Timeline.GeochronoLabeller.eonNames = []; +Timeline.GeochronoLabeller.eraNames = []; +Timeline.GeochronoLabeller.periodNames = []; +Timeline.GeochronoLabeller.epochNames = []; +Timeline.GeochronoLabeller.ageNames = []; + +Timeline.GeochronoLabeller.prototype.labelInterval = function(date, intervalUnit) { + var n = Timeline.GeochronoUnit.toNumber(date); + var dates, names; + switch (intervalUnit) { + case Timeline.GeochronoUnit.AGE: + dates = Timeline.Geochrono.ages; + names = Timeline.GeochronoLabeller.ageNames; break; + case Timeline.GeochronoUnit.EPOCH: + dates = Timeline.Geochrono.epoches; + names = Timeline.GeochronoLabeller.epochNames; break; + case Timeline.GeochronoUnit.PERIOD: + dates = Timeline.Geochrono.periods; + names = Timeline.GeochronoLabeller.periodNames; break; + case Timeline.GeochronoUnit.ERA: + dates = Timeline.Geochrono.eras; + names = Timeline.GeochronoLabeller.eraNames; break; + case Timeline.GeochronoUnit.EON: + dates = Timeline.Geochrono.eons; + names = Timeline.GeochronoLabeller.eonNames; break; + default: + return { text: n, emphasized: false }; + } + + for (var i = dates.length - 1; i >= 0; i--) { + if (n <= dates[i].start) { + return { + text: names[this._locale][i].name, + emphasized: n == dates[i].start + } + } + } + return { text: n, emphasized: false }; +}; + +Timeline.GeochronoLabeller.prototype.labelPrecise = function(date) { + return Timeline.GeochronoUnit.toNumber(date) + "ma"; +}; diff --git a/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/units.js b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/units.js new file mode 100755 index 0000000..86182ff --- /dev/null +++ b/site/app/webroot/js/simile/timeline/ext/geochrono/scripts/units.js @@ -0,0 +1,86 @@ +/*==================================================
+ * Geochrono Unit
+ *==================================================
+ */
+
+Timeline.GeochronoUnit = new Object();
+
+Timeline.GeochronoUnit.MA = 0;
+Timeline.GeochronoUnit.AGE = 1;
+Timeline.GeochronoUnit.EPOCH = 2;
+Timeline.GeochronoUnit.PERIOD = 3;
+Timeline.GeochronoUnit.ERA = 4;
+Timeline.GeochronoUnit.EON = 5;
+
+Timeline.GeochronoUnit.getParser = function(format) {
+ return Timeline.GeochronoUnit.parseFromObject;
+};
+
+Timeline.GeochronoUnit.createLabeller = function(locale, timeZone) {
+ return new Timeline.GeochronoLabeller(locale);
+};
+
+Timeline.GeochronoUnit.wrapMA = function (n) {
+ return new Timeline.GeochronoUnit._MA(n);
+};
+
+Timeline.GeochronoUnit.makeDefaultValue = function () {
+ return Timeline.GeochronoUnit.wrapMA(0);
+};
+
+Timeline.GeochronoUnit.cloneValue = function (v) {
+ return new Timeline.GeochronoUnit._MA(v._n);
+};
+
+Timeline.GeochronoUnit.parseFromObject = function(o) {
+ if (o instanceof Timeline.GeochronoUnit._MA) {
+ return o;
+ } else if (typeof o == "number") {
+ return Timeline.GeochronoUnit.wrapMA(o);
+ } else if (typeof o == "string" && o.length > 0) {
+ return Timeline.GeochronoUnit.wrapMA(Number(o));
+ } else {
+ return null;
+ }
+};
+
+Timeline.GeochronoUnit.toNumber = function(v) {
+ return v._n;
+};
+
+Timeline.GeochronoUnit.fromNumber = function(n) {
+ return new Timeline.GeochronoUnit._MA(n);
+};
+
+Timeline.GeochronoUnit.compare = function(v1, v2) {
+ var n1, n2;
+ if (typeof v1 == "object") {
+ n1 = v1._n;
+ } else {
+ n1 = Number(v1);
+ }
+ if (typeof v2 == "object") {
+ n2 = v2._n;
+ } else {
+ n2 = Number(v2);
+ }
+
+ return n2 - n1;
+};
+
+Timeline.GeochronoUnit.earlier = function(v1, v2) {
+ return Timeline.GeochronoUnit.compare(v1, v2) < 0 ? v1 : v2;
+};
+
+Timeline.GeochronoUnit.later = function(v1, v2) {
+ return Timeline.GeochronoUnit.compare(v1, v2) > 0 ? v1 : v2;
+};
+
+Timeline.GeochronoUnit.change = function(v, n) {
+ return new Timeline.GeochronoUnit._MA(v._n - n);
+};
+
+Timeline.GeochronoUnit._MA = function(n) {
+ this._n = n;
+};
+
|