Skip to content

Commit

Permalink
FIX merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvullings committed Oct 14, 2015
2 parents 0f96764 + 6216643 commit 50750b6
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 6 deletions.
6 changes: 3 additions & 3 deletions csComp/directives/LegendList/LegendList.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ <h4 class="leftpanel-header" translate="LEGEND"></h4>
<div class="legend">
<div ng-repeat="legendItem in legendItems" class="legendItem">
<span style="display:inline-block;padding-bottom:5px">
<div ng-hide="!legendItem.hasOwnProperty(html) || legendItem.html === ''" ng-bind-html="vm.toTrusted(legendItem.html)" style="display:inline-block" />
<div ng-show="!legendItem.hasOwnProperty(html) || legendItem.html === ''" class="legendIcon">
<div ng-hide="legendItem.html === ''" ng-bind-html="vm.toTrusted(legendItem.html)" style="display:inline-block" />
<div ng-show="legendItem.html === ''" class="legendIcon">
<img ng-src="{{legendItem.uri}}" class="legendImage" />
</div>
<div class="legendText" ng-bind-html="vm.toTrusted(legendItem.title)"></div>
<div ng-hide="!legendItem.title"class="legendText" ng-bind-html="vm.toTrusted(legendItem.title)"></div>
</span>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions csComp/directives/Widgets/MCAWidget/MCAWidget.tpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div style="margin-top: 20px;">
<div class="row" style="margin: 5px;">
<h4 class="col-md-12">
{{'MCA.NAME' | translate}}
</h4>
</div>
<div data-ng-repeat="mca in data.availableMcas" class="row" style="margin: 5px;">
<div class="col-md-12">
{{mca.title}}
<div class="fa fa-paint-brush makeNarrow" ng-click="vm.setMcaAsStyle($index)" style="float:right; cursor:pointer" popover="{{'MCA.SET_STYLE' | translate}}" popover-placement="right" popover-trigger="mouseenter" popover-append-to-body="true" />
</div>
</div>
</div>
33 changes: 33 additions & 0 deletions csComp/directives/Widgets/MCAWidget/MCAWidget.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module MCAWidget {
/**
* Config
*/
var moduleName = 'csComp';

/**
* Module
*/
export var myModule;
try {
myModule = angular.module(moduleName);
} catch (err) {
// named module does not exist, so create one
myModule = angular.module(moduleName, []);
}

/**
* Directive to display the available map layers.
*/
myModule.directive('mcawidget', [function() : ng.IDirective {
return {
restrict : 'E', // E = elements, other options are A=attributes and C=classes
scope : {
}, // isolated scope, separated from parent. Is however empty, as this directive is self contained by using the messagebus.
templateUrl: 'directives/Widgets/MCAWidget/MCAWidget.tpl.html',
replace : true, // Remove the directive from the DOM
transclude : false, // Add elements and attributes to the template
controller : MCAWidget.MCAWidgetCtrl
}
}
]);
}
116 changes: 116 additions & 0 deletions csComp/directives/Widgets/MCAWidget/MCAWidgetCtrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
module MCAWidget {
export class MCAWidgetData {
title: string;
/**
* If provided, indicates the layer that needs to be enabled in order to show the widget.
*/
layerId: string;
/**
* The available mca's
*/
availableMcas: Mca.Models.Mca[];
}

export interface IMCAWidgetScope extends ng.IScope {
vm: MCAWidgetCtrl;
data: MCAWidgetData;
}

export class MCAWidgetCtrl {
private scope: IMCAWidgetScope;
private widget: csComp.Services.IWidget;
private parentWidget: JQuery;
private mcaScope: Mca.IMcaScope;

public static $inject = [
'$scope',
'$timeout',
'$controller',
'layerService',
'messageBusService',
'mapService'
];

constructor(
private $scope: IMCAWidgetScope,
private $timeout: ng.ITimeoutService,
private $controller: ng.IControllerService,
private $layerService: csComp.Services.LayerService,
private $messageBus: csComp.Services.MessageBusService,
private $mapService: csComp.Services.MapService
) {
$scope.vm = this;
var par = <any>$scope.$parent;
this.widget = par.widget;

$scope.data = <MCAWidgetData>this.widget.data;

if (typeof $scope.data.layerId !== 'undefined') {
// Hide widget
this.parentWidget = $("#" + this.widget.elementId).parent();
this.parentWidget.hide();
this.$messageBus.subscribe('layer', (action: string, layer: csComp.Services.ProjectLayer) => {
switch (action) {
case 'activated':
case 'deactivate':
this.activateLayer(layer);
break;
default:
break;
}
});
}
}

private activateLayer(layer: csComp.Services.ProjectLayer) {
this.mcaScope = this.getMcaScope();
if (!this.mcaScope) return;

if (layer.id !== this.$scope.data.layerId || (layer.id === this.$scope.data.layerId && !layer.enabled)) {
this.parentWidget.hide();
return;
}
this.$timeout(() => {
this.parentWidget.show();
}, 0);
}

private getMcaScope() {
var mcaElm = angular.element('div[id="mca"]');
if (!mcaElm) {
console.log('Mca element not found.');
return;
}
var mcaScope = <Mca.IMcaScope>mcaElm.scope();
if (!mcaScope) {
console.log('Mca controller scope not found.');
return;
} else {
this.$scope.data.availableMcas = mcaScope.vm.availableMcas;
return mcaScope;
}
}

private setMcaAsStyle(mcaNr: number) {
if (!this.mcaScope || !this.mcaScope.vm.mca) {
console.log('Mca controller scope not found.');
return;
} else {
var vm = this.mcaScope.vm;
if (!vm.showFeature) {
this.$messageBus.notifyWithTranslation('SELECT_A_FEATURE', 'SELECT_FEATURE_FOR_STYLE');
return;
}
if (vm.properties.length > 0) {
var availableMcas = vm.availableMcas.length;
if (mcaNr <= availableMcas) {
vm.mca = vm.availableMcas[mcaNr];
vm.updateMca();
}
console.log('Set mca style.');
vm.setStyle(vm.properties[0]);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module MarkdownWidget {
this.parentWidget.hide();
this.$messageBus.subscribe('feature', (action: string, feature: csComp.Services.IFeature) => {
switch (action) {
case 'onFeatureDeselect':
case 'onFeatureSelect':
this.selectFeature(feature);
break;
Expand All @@ -84,7 +85,7 @@ module MarkdownWidget {
}

private selectFeature(feature: csComp.Services.IFeature) {
if (feature.featureTypeName !== this.$scope.data.featureTypeName) {
if (!feature || !feature.isSelected || feature.featureTypeName !== this.$scope.data.featureTypeName) {
this.parentWidget.hide();
return;
}
Expand Down
6 changes: 6 additions & 0 deletions csComp/includes/css/csStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,12 @@ html, body, #container {
.panel-heading:hover .icons-on-hover {
display: block;
}
#featureprops-content:before {
display: block;
content: "";
height: 50px;
margin: -50px 0 0;
}
#featureprops-content:hover leftpanel-header-button-container {
opacity: 0.5;
}
Expand Down
1 change: 1 addition & 0 deletions csComp/services/dashboard/DashboardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ module csComp.Services {
this.widgetTypes["indicators"] = <IWidget>{ id: "indicators", icon: "cs/images/widgets/indicators.png", description: "Showing sensor data using charts" };
this.widgetTypes["charts"] = <IWidget>{ id: "charts", icon: "cs/images/widgets/markdown.png", description: "Show custom chart" };
this.widgetTypes["markdownwidget"] = <IWidget>{ id: "markdownwidget", icon: "cs/images/widgets/markdown.png", description: "Show custom markdown or html content" };
this.widgetTypes["mcawidget"] = <IWidget>{ id: "mcawidget", icon: "cs/images/widgets/mca.png", description: "Show available MCA's" };
this.widgetTypes["iframewidget"] = <IWidget>{ id: "iframewidget", icon: "cs/images/widgets/markdown.png", description: "Show custom iframe" };
this.widgetTypes["kanbanboard"] = <IWidget>{ id: "kanbanboard", icon: "cs/images/widgets/markdown.png", description: "Show kanbanboard" };
this.widgetTypes["navigator"] = <IWidget>{ id: "navigatorwidget", icon: "cs/images/widgets/markdown.png", description: "Show navigator" };
Expand Down
5 changes: 4 additions & 1 deletion csComp/translations/locale-en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ module Translations {
CHOOSE_DROPDOWN: 'Choose...',
ENABLE_LOCATION_FILTER: 'Enable location filter',
DISABLE_LOCATION_FILTER: 'Disable location filter',
SELECT_A_FEATURE: 'Select a feature',
SELECT_FEATURE_FOR_WIDGET: 'Please select a feature to show the widget.',
SELECT_FEATURE_FOR_STYLE: 'Please select a feature to before setting the style.',
NO_RELATIONS_FOUND: 'No relations can be shown for the selected feature. Either the zoom level is too low, there are too many features in the view or there are no relations defined.',
BASESTYLES: 'Baselayers',
MAP: 'Maps',
Expand Down Expand Up @@ -133,7 +135,8 @@ module Translations {
GAUSSIAN: 'Normal distribution increasing function between min and max.',
ADD_MCA: 'Add a new MCA.',
DELETE_MCA: 'Delete the MCA.',
EDIT_MCA: 'Edit the MCA.'
EDIT_MCA: 'Edit the MCA.',
SET_STYLE: 'Set style'
},
PROJECTSETTINGS: {
TITLE: 'Project Settings',
Expand Down
5 changes: 4 additions & 1 deletion csComp/translations/locale-nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ module Translations {
SELECT_ALL: 'Selecteer alles',
DESELECT_ALL: 'Deselecteer alles',
ENABLE_LOCATION_FILTER: 'Activeer locatiefilter',
SELECT_A_FEATURE: 'Selecteer een feature',
DISABLE_LOCATION_FILTER: 'Deactiveer locatiefilter',
SELECT_FEATURE_FOR_WIDGET: 'Selecteer een gebied om de widget te tonen.',
SELECT_FEATURE_FOR_STYLE: 'Selecteer een gebied om de stijl te activeren.',
NO_RELATIONS_FOUND: 'Geen relaties voor het geselecteerde item gevonden. Ofwel het zoomniveau is te laag, er zijn teveel items zichtbaar of er zijn geen relaties gedefiniëerd.',
CHOOSE_DROPDOWN: 'Kies...',
BASESTYLES: 'Basiskaarten',
Expand Down Expand Up @@ -133,7 +135,8 @@ module Translations {
GAUSSIAN: 'Normale verdeling tussen onder- en bovengrens.',
ADD_MCA: 'Maak een nieuwe MCA.',
DELETE_MCA: 'Verwijder de MCA.',
EDIT_MCA: 'Bewerk de MCA.'
EDIT_MCA: 'Bewerk de MCA.',
SET_STYLE: 'Activeer stijl'
},
PROJECTSETTINGS: {
TITLE: 'Project instellingen',
Expand Down
2 changes: 2 additions & 0 deletions csComp/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
"directives/Widgets/MarkdownWidget/Markdown-edit.ts",
"directives/Widgets/MarkdownWidget/MarkdownWidget.ts",
"directives/Widgets/MarkdownWidget/MarkdownWidgetCtrl.ts",
"directives/Widgets/MCAWidget/MCAWidget.ts",
"directives/Widgets/MCAWidget/MCAWidgetCtrl.ts",
"directives/Widgets/Navigator/Navigator-edit.ts",
"directives/Widgets/Navigator/NavigatorWidget.ts",
"directives/Widgets/Navigator/NavigatorWidgetCtrl.ts",
Expand Down

0 comments on commit 50750b6

Please sign in to comment.