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

Introduce the query panel component #5120

Merged
merged 5 commits into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions contribs/gmf/apps/desktop/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
data-toggle="tooltip" data-placement="left" data-original-title="{{'Profile'|translate}}">
<span class="fa fa-chart-area"></span>
</button>
<button ngeo-btn class="btn btn-default" ng-model="mainCtrl.queryPanelActive"
data-toggle="tooltip" data-placement="left" data-original-title="{{'Selection'|translate}}">
<span class="fa fa-info"></span>
</button>
<button ngeo-btn class="btn btn-default" ng-model="mainCtrl.importDataSourceActive"
data-toggle="tooltip" data-placement="left" data-original-title="{{'Import Layer'|translate}}">
<span class="fa fa-upload"></span>
Expand Down Expand Up @@ -193,6 +197,15 @@
</div>
</div>
</div>
<div ng-show="mainCtrl.queryPanelActive" class="row">
<div class="col-sm-12">
<div class="gmf-app-tools-content-heading">
{{'Selection'|translate}}
<a class="btn close" ng-click="mainCtrl.queryPanelActive = false">&times;</a>
</div>
<ngeo-query-panel></ngeo-query-panel>
</div>
</div>
<div ng-show="mainCtrl.importDataSourceActive" class="row">
<div class="col-sm-12">
<div class="gmf-app-tools-content-heading">
Expand Down
13 changes: 13 additions & 0 deletions contribs/gmf/apps/desktop_alt/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
data-toggle="tooltip" data-placement="left" data-original-title="{{'Street View'|translate}}">
<span class="fa fa-street-view"></span>
</button>
<button ngeo-btn class="btn btn-default" ng-model="mainCtrl.queryPanelActive"
data-toggle="tooltip" data-placement="left" data-original-title="{{'Selection'|translate}}">
<span class="fa fa-info"></span>
</button>
<button ngeo-btn class="btn btn-default" ng-model="mainCtrl.importDataSourceActive"
data-toggle="tooltip" data-placement="left" data-original-title="{{'Import Layer'|translate}}">
<span class="fa fa-upload"></span>
Expand Down Expand Up @@ -225,6 +229,15 @@
</ngeo-googlestreetview>
</div>
</div>
<div ng-show="mainCtrl.queryPanelActive" class="row">
<div class="col-sm-12">
<div class="gmf-app-tools-content-heading">
{{'Selection'|translate}}
<a class="btn close" ng-click="mainCtrl.queryPanelActive = false">&times;</a>
</div>
<ngeo-query-panel></ngeo-query-panel>
</div>
</div>
<div ng-show="mainCtrl.importDataSourceActive" class="row">
<div class="col-sm-12">
<div class="gmf-app-tools-content-heading">
Expand Down
7 changes: 7 additions & 0 deletions contribs/gmf/src/controllers/AbstractDesktopController.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import gmfRasterComponent from 'gmf/raster/component.js';
import ngeoMapswipeModule from 'ngeo/map/swipe.js';
import ngeoDrawFeatures from 'ngeo/draw/features.js';
import ngeoMiscToolActivate from 'ngeo/misc/ToolActivate.js';
import ngeoQueryPanelComponent from 'ngeo/query/panelComponent.js';
import gmfImportModule from 'gmf/import/module.js';
import olCollection from 'ol/Collection.js';
import {listen} from 'ol/events.js';
Expand Down Expand Up @@ -62,6 +63,11 @@ export class AbstractDesktopController extends AbstractAPIController {
*/
this.editFeatureActive = false;

/**
* @type {boolean}
*/
this.queryPanelActive = false;

/**
* @type {boolean}
*/
Expand Down Expand Up @@ -270,6 +276,7 @@ export class AbstractDesktopController extends AbstractAPIController {
* @hidden
*/
const module = angular.module('GmfAbstractDesktopControllerModule', [
ngeoQueryPanelComponent.name,
gmfControllersAbstractAPIController.name,
gmfContextualdataModule.name,
gmfEditingModule.name,
Expand Down
9 changes: 9 additions & 0 deletions contribs/gmf/src/controllers/desktop.scss
Original file line number Diff line number Diff line change
Expand Up @@ -873,3 +873,12 @@ ngeo-googlestreetview {
height: calc(100% - 3.75rem);
width: $streeview-width;
}

/**
* Ngeo Query Panel Component
*/
ngeo-query-panel {
.ngeo-query-panel-actions {
margin: 2rem 0 0 0;
}
}
15 changes: 15 additions & 0 deletions examples/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.btn.btn-default {
background-color: white;
border-color: #ccc;
color: #333;
}

.btn.btn-default.active {
box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
}

.btn.btn-default.active,
.btn.btn-default.hover {
background-color: #e6e6e6;
border-color: #adadad;
}
22 changes: 22 additions & 0 deletions examples/query.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@

#map,
.app-query {
float: left;
}

#map {
width: 600px;
height: 400px;
}

.app-query {
margin: 1rem;
}

#desc {
clear: both;
}

ngeo-query-panel {
display: block;
margin: 1rem 0 0 0;
}

ngeo-query-panel .ngeo-query-panel-actions {
margin: 1rem 0 0 0;
}
53 changes: 35 additions & 18 deletions examples/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,59 @@
ngeo-map="ctrl.map">
</div>

<ngeo-query
<div class='app-query'>
<ngeo-query
active="ctrl.queryActive"
autoclear="ctrl.queryAutoClear"
map="::ctrl.map">
</ngeo-query>
</ngeo-query>

<button
ngeo-btn=""
class="btn btn-default"
ng-model="ctrl.getSetQueryActive"
ng-model-options="{getterSetter: true}">Query</button>

<ngeo-query-panel ng-if="ctrl.queryActive"></ngeo-query-panel>
</div>

<p id="desc">
This example shows how to use the
This example shows how to configure and use the
<code>
<a
href="../apidoc/ngeo.query.component.html"
title="Read our documentation">ngeo-query</a>
</code>
component. It also shows how the
and
<code>
<a
href="../apidoc/ngeo.query.panelComponent.html"
title="Read our documentation">ngeo-query-panel</a>
</code>
components. It also shows how the
<code>
<a
href="../apidoc/ngeo.misc.ToolActivateMgr.html"
title="Read our documentation">ngeo.misc.ToolActivate</a>
</code>
can be used to make the component inactive when an other tool
becomes active. The "Dummy" button here does nothing, but when
toggled the query component becomes inactive. Click on the map to
issue a query. Hold down the "ctrl" key (meta on MAC) then click twice
in the map to draw a box instead. Hold the A key to add the results to
existing ones. Hold the X key to remove the results from the existing
ones.
becomes active. You can how queries are made on the map and what
to do with the results using the panel. You can also temporarily
change them using keyboard shortcuts:
<ul>
<li>
Hold down the "ctrl" key (meta on MAC) to set the query mode
to drawing boxes on the map.
</li>
<li>
Hold the A key to add the results to existing ones.
</li>
<li>
Hold the X key to remove the results from the existing ones.
</li>
</ul>
</p>

<button
ngeo-btn=""
class="btn btn-info"
ng-model="ctrl.getSetDummyActive"
ng-model-options="{getterSetter: true}">Dummy</button>

<span>Mode: {{ ctrl.ngeoQueryModeSelector.mode }}</span>,
<span>Action: {{ ctrl.ngeoQueryModeSelector.action }}</span>
<br />

<app-queryresult></app-queryresult>
Expand Down
13 changes: 8 additions & 5 deletions examples/query.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import angular from 'angular';
import {MAPSERVER_PROXY, MAPSERVER_WFS_FEATURE_NS} from './url.js';
import './base.css';
import './query.css';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';

Expand All @@ -12,6 +13,7 @@ import ngeoMiscBtnComponent from 'ngeo/misc/btnComponent.js';
import ngeoMiscToolActivate from 'ngeo/misc/ToolActivate.js';
import ngeoMiscToolActivateMgr from 'ngeo/misc/ToolActivateMgr.js';
import ngeoQueryComponent from 'ngeo/query/component.js';
import ngeoQueryPanelComponent from 'ngeo/query/panelComponent.js';
import ngeoQueryModule from 'ngeo/query/module.js';

import olMap from 'ol/Map.js';
Expand All @@ -30,6 +32,7 @@ const module = angular.module('app', [
ngeoMiscBtnComponent.name,
ngeoMiscToolActivateMgr.name,
ngeoQueryComponent.name,
ngeoQueryPanelComponent.name,
ngeoQueryModule.name,
]);

Expand Down Expand Up @@ -192,10 +195,10 @@ function MainController(
}));

const queryToolActivate = new ngeoMiscToolActivate(this, 'queryActive');
ngeoToolActivateMgr.registerTool('mapTools', queryToolActivate, true);
ngeoToolActivateMgr.registerTool('mapTools', queryToolActivate);

const dummyToolActivate = new ngeoMiscToolActivate(this, 'dummyActive');
ngeoToolActivateMgr.registerTool('mapTools', dummyToolActivate);
ngeoToolActivateMgr.registerTool('mapTools', dummyToolActivate, true);

}

Expand All @@ -204,11 +207,11 @@ function MainController(
* @param {boolean|undefined} val Value.
* @return {boolean|undefined} Value.
*/
MainController.prototype.getSetDummyActive = function(val) {
MainController.prototype.getSetQueryActive = function(val) {
if (val !== undefined) {
this.dummyActive = val;
this.queryActive = val;
} else {
return this.dummyActive;
return this.queryActive;
}
};

Expand Down
58 changes: 58 additions & 0 deletions src/icons/point.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions src/icons/polygon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.