Skip to content

Commit

Permalink
Began code for populating readable sources list
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercamp committed Nov 20, 2014
1 parent e3b2dc6 commit 0e5cbee
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ public IEnumerable<Source> GetAssociatedSources(DataType adapter)

public IEnumerable<HumanReadableSensor> GetHumanReadableSensors()
{

ModelClient client = GetModel();
return client.GetHumanReadableSensors();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public View(ApplicationSessionInfo sessionInfo)

Visualizations = ((viewModel)ViewModel).GetVisualizations();

this.Sources = InitializeSources().Distinct();
this.Properties = InitializeProperties().Distinct();
this.Sources = InitializeSources().Distinct().ToList();
this.Properties = InitializeProperties().Distinct().ToList();

//((viewModel)ViewModel)

Expand Down Expand Up @@ -144,7 +144,36 @@ private void InitializeMembers()
private void InitializeSubscriptionTranslator()
{
subscriptionTranslator = new SubscriptionTranslator();
// TODO: Fill in

var model = (viewModel) ViewModel;

var humanReadableSensors = model.GetHumanReadableSensors().ToList();
foreach (var dataType in DataTypes)
{
var dataTypeName = dataType.Name;
var dataProperties = Properties.Cast<PropertyParent>().Where((p) => p.ParentDataTypeID == dataType.ID).ToList();
var sources = Sources.Where((s) => s.DataTypeSourceID == dataType.ID);

foreach (var emittingSource in sources)
{
var sensor = humanReadableSensors.Single(s => s.ID == emittingSource.ID);
foreach (var property in dataProperties)
{
var newTranslation = new SubscriptionLabel();
var newSubscriptionType = new DataSubscription();

newTranslation.DataTypeName = dataTypeName;
newTranslation.PropertyName = property.Name;
newTranslation.SourceName = sensor.CurrentRendezvous;
newTranslation.SourceTypeName = sensor.Name;

newSubscriptionType.PropertyId = property.ID;
newSubscriptionType.SourceId = emittingSource.ID;

subscriptionTranslator.AddTranslation(newSubscriptionType, newTranslation);
}
}
}
}

public void InitializeViewModel(ApplicationSessionInfo theApplicationSessionInfo)
Expand Down

0 comments on commit 0e5cbee

Please sign in to comment.