Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove PlotRegistry type #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/viewer/Band.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/viewer/Fallback.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
/// <reference path="../../typings/jquery/jquery.d.ts" />
/// <reference path="Utils.ts" />
/// <reference path="PlotRegistry.ts" />

module InteractiveDataDisplay {
PlotRegistry["fallback"] = {
initialize(plotDefinition: PlotInfo, viewState: ViewState, chart: IDDPlot) {
var div = $("<div></div>")
.attr("data-idd-name", plotDefinition.displayName)
.appendTo(chart.host);
var plot = new FallbackPlot(div, chart.master);
chart.addChild(plot);
return [plot];
},

draw(plots: IDDPlot[], plotDefinition: PlotInfo) {
var drawArgs = {
kind: plotDefinition.kind,
error: plotDefinition["error"]
}
plots[0].draw(drawArgs);

}
}

export function FallbackPlot(div, master) {
var that = this;

Expand Down
23 changes: 0 additions & 23 deletions src/viewer/Heatmap.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/viewer/Line.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/viewer/Markers.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/viewer/Plot.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/// <reference path="Utils.ts" />
/// <reference path="ViewState.ts" />
/// <reference path="onScreenNavigation.ts" />
/// <reference path="PlotRegistry.ts" />
/// <reference path="PlotViewer.ts" />
module Plot {
export module MarkerShape {
Expand Down
1 change: 0 additions & 1 deletion src/viewer/PlotList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference path="ViewState.ts" />
/// <reference path="Utils.ts" />
/// <reference path="PlotRegistry.ts" />
/// <reference path="PlotViewer.ts" />

module InteractiveDataDisplay {
Expand Down
13 changes: 0 additions & 13 deletions src/viewer/PlotRegistry.ts

This file was deleted.

36 changes: 27 additions & 9 deletions src/viewer/PlotViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,34 @@ module InteractiveDataDisplay {
}

private addPlot(p: PlotViewerItem) {
var factory = PlotRegistry[p.Definition.kind] ? PlotRegistry[p.Definition.kind] : PlotRegistry["fallback"];
p.Plots = factory.initialize(p.Definition, this.persistentViewState, this.iddChart);
var div = $("<div></div>")
.attr("data-idd-name", p.Definition.displayName)
.appendTo(this.iddChart.host);
var new_plot;
switch (p.Definition.kind) {
case "line":
new_plot = new InteractiveDataDisplay.Polyline(div, this.iddChart.master);
break;
case "markers":
new_plot = new InteractiveDataDisplay.Markers(div, this.iddChart.master);
break;
case "heatmap":
new_plot = new InteractiveDataDisplay.Heatmap(div, this.iddChart.master);
break;
case "area":
new_plot = new InteractiveDataDisplay.Area(div, this.iddChart.master);
break;
default:
new_plot = new InteractiveDataDisplay.FallbackPlot(div, this.iddChart.master);
}
this.iddChart.addChild(new_plot);
p.Plots = [new_plot];
try {
factory.draw(p.Plots, p.Definition);
p.Plots[0].draw(p.Definition, p.Definition.titles);
} catch (ex) {
if (p.Plots !== undefined) p.Plots.forEach(function (graph) { graph.remove(); });
factory = PlotRegistry["fallback"];
p.Definition["error"] = ex.message;
p.Plots = factory.initialize(p.Definition, this.persistentViewState, this.iddChart);
factory.draw(p.Plots, p.Definition);
p.Plots = new_plot = new InteractiveDataDisplay.FallbackPlot(div, this.iddChart.master);
}
}

Expand Down Expand Up @@ -341,7 +359,7 @@ module InteractiveDataDisplay {
if (this.persistentViewState.mapType)
this.bingMapsPlot.setMap(this.persistentViewState.mapType);
else
this.bingMapsPlot.setMap(Microsoft.Maps.MapTypeId.road);//InteractiveDataDisplay.BingMaps.ESRI.GetWorldShadedRelief());
this.bingMapsPlot.setMap(Microsoft.Maps.MapTypeId.road);
this.iddChart.yDataTransform = InteractiveDataDisplay.mercatorTransform;
this.iddChart.xDataTransform = undefined;
} else {
Expand All @@ -364,7 +382,7 @@ module InteractiveDataDisplay {
function (id: string, oldPlot: PlotViewerItem, newPlot: PlotViewerItem): PlotViewerItem {
if (oldPlot.Definition.kind == newPlot.Definition.kind) {
if (syncProps(oldPlot.Definition, newPlot.Definition)) // if some properties of new plot are updated
InteractiveDataDisplay.PlotRegistry[oldPlot.Definition.kind].draw(oldPlot.Plots, oldPlot.Definition);
oldPlot.Plots[0].draw(oldPlot.Definition, oldPlot.Definition.titles);
return oldPlot;
}
else { // plot kind is changed
Expand Down Expand Up @@ -417,4 +435,4 @@ module InteractiveDataDisplay {
}
}
}
}
}
1 change: 1 addition & 0 deletions test/manual/mainGlobal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
///<reference path="../../dist/idd.d.ts"/>
var main;
(function (main) {
function start() {
Expand Down