Skip to content

Commit

Permalink
Merge branch 'master' into query-req
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap committed Jul 31, 2017
2 parents 0749a78 + 2030835 commit e8a46e9
Show file tree
Hide file tree
Showing 178 changed files with 7,060 additions and 1,469 deletions.
3 changes: 3 additions & 0 deletions docma-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"web/client/components/notifications/NotificationContainer.jsx",
"web/client/components/buttons/ToggleButton.jsx",
"web/client/components/data/query/AutocompleteField.jsx",
"web/client/components/map/leaflet/DrawSupport.jsx",
"web/client/components/plugins/PluginsContainer.jsx",

"web/client/actions/index.jsdoc",
Expand All @@ -137,6 +138,7 @@
"web/client/reducers/search.js",

"web/client/epics/index.jsdoc",
"web/client/epics/automapupdate.js",
"web/client/epics/cookies.js",
"web/client/epics/fullscreen.js",
"web/client/epics/globeswitcher.js",
Expand All @@ -158,6 +160,7 @@
"jsapi": "web/client/jsapi/MapStore2.js",
"plugins": [
"web/client/plugins/index.jsdoc",
"web/client/plugins/AutoMapUpdate.jsx",
"web/client/plugins/BackgroundSelector.jsx",
"web/client/plugins/BackgroundSwitcher.jsx",
"web/client/plugins/DrawerMenu.jsx",
Expand Down
14 changes: 14 additions & 0 deletions docs/developer-guide/API-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# MapStore2 API usage
You can include MapStore2 in your application and interact with it via its JavaScript API

## How to use

1. Create a map using the standard installation
1. Go to Share -> Embed
1. Copy the API html code and paste it in your application page

The map will now load inside your application

NOTE: If the map is using a Google Maps background you will have to provide your own API key.
Add `&key=YOUR_API_KEY` in the <script> src value

29 changes: 29 additions & 0 deletions docs/developer-guide/custom-search-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Custom search service
MapStore2 Searchbox uses [OpenStreetMap Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) service but you can set it up to use your own WFS service.
The results will be fetched from every service you set, plus OSM Nominatim, and displayed in the order you specified.

## How to use

We assume you already have a WFS service set up.
For example it can be on the same server you are using to display your data, so you can make the data easily searchable.

1. Open the Burger Menu (top right corner) and select "Settings"
1. In the Settings popup you should see a big button "Configure Search Settings", click it
1. You will see a list of services, click "Add"
1. Here you have to input the info on how the search will be performed
1. Input a name for the new service, it will not be displayed as it is for your own reference
1. Input the url to your WFS service. For example, if you are using GeoServer on the same host you can just omit the hostname: `/geoserver/wfs`
1. Input the layername where to search
1. Input a comma-separated list of attribute names where to search
1. Hit Next
1. Here you have to define how the results will be displayed
1. Input the title template, to show a feature property (must be a string) the syntax is `${properties.nameoftheproperty}`.
For example you can create complex templates like: `Woo, I found a ${properties.buildingname} with ${properties.animaltypes} in it!`, but you probably want to just have a simple string like `${properties.title}`
1. Input the description template, it will displayed underneath the title in a different font, the syntax is the same as the title
1. Input the priority of this service, the results from all the services will be ordered by the service priority. Higher priority results will be displayed on top of the list (Priority 5 is higher than priority 1)
1. In the next page there are some optional settings
- Order By: Input the feature attribute to order the results of this specific service
- Max Features: Input the maximum number of features to fetch when searching on this service
1. Save

Once saved, the service will be queried by the search box.
27 changes: 27 additions & 0 deletions docs/developer-guide/customize-theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# How to Customize the Theme

The look and feel is completely customizable either using one of the included themes, or building your own. Themes are built using [less](http://lesscss.org/).
You can find the default theme here: https://github.com/geosolutions-it/MapStore2/tree/master/web/client/themes/default

In the [themes folder](https://github.com/geosolutions-it/MapStore2/tree/master/web/client/themes) you can also find other ones that you can study.

To add a new theme:
1. create a new folder in the themes folder with the name of your theme
1. create less files in the folder (at least `theme.less`, the main file, and `variables.less`, to customize standard variables)
1. add the new theme to the [index file](https://github.com/geosolutions-it/MapStore2/blob/master/web/client/themes/index.js), with the id corresponding to the theme folder name

You can then switch your application to use the theme adding a new section in the `appConfig.js` file:

```
initialState: {
defaultState: {
...
theme: {
selectedTheme: {
id: <your theme id>
}
},
...
}
}
```
2 changes: 2 additions & 0 deletions docs/developer-guide/developing-with-mapstore-2-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This section is about developing your own application using the MapStore2 framew

* [Introduction](developing-with-mapstore-2)
* [How to use a CDN](how-to-use-a-cdn)
* [How to add a custom search service](custom-search-service.md)
* [How to customize the Theme](customize-theme.md)

## Developing using plugins

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Deploy the generated mapstore.war file (in web/target) to your favourite J2EE co
# Developers documentation
* [Infrastructure](infrastructure-and-general-architecture)
* [Building and deploying](building-and-developing)
* [Developing with MapStore 2](developing-with-mapstore-2-intro)
* [Developing with MapStore2](developing-with-mapstore-2-intro)
* [Configuration](configuration-files)
* [Migration](mapstore-migration-guide)
* [How to Release](release-checklist)
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"//": "replace react-sortable-items with official on npm when it will support React 15",
"dependencies": {
"@carnesen/redux-add-action-listener-enhancer": "0.0.1",
"@turf/bbox": "4.1.0",
"@turf/inside": "4.1.0",
"@turf/line-intersect": "4.1.0",
"@turf/polygon-to-linestring": "4.1.0",
Expand Down Expand Up @@ -160,6 +161,7 @@
"react-twitter-widgets": "1.3.0",
"react-widgets": "3.4.8",
"recharts": "0.22.4",
"recompose": "0.24.0",
"redux": "3.6.0",
"redux-logger": "2.6.1",
"redux-observable": "0.13.0",
Expand Down Expand Up @@ -188,6 +190,7 @@
"compile": "npm run clean && mkdirp ./web/client/dist && webpack --progress --config prod-webpack.config.js",
"analyze": "npm run clean && mkdirp ./web/client/dist && webpack --json | webpack-bundle-size-analyzer",
"start": "webpack-dev-server --progress --colors --port 8081 --hot --inline --content-base web/client",
"startprod": "webpack-dev-server --progress --colors --port 8081 --hot --inline --content-base web/client --config prod-webpack.config.js",
"examples": "webpack-dev-server --progress --colors --port 8081 --hot --inline --content-base web/client --config examples-webpack.config.js",
"test": "karma start ./karma.conf.single-run.js",
"pretest": "npm run cleandoc && npm run lint",
Expand Down
42 changes: 35 additions & 7 deletions web/client/actions/__tests__/draw-test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/**
* Copyright 2016, GeoSolutions Sas.
/*
* Copyright 2017, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
*/

const expect = require('expect');
const {
CHANGE_DRAWING_STATUS,
END_DRAWING,
changeDrawingStatus,
endDrawing
CHANGE_DRAWING_STATUS, changeDrawingStatus,
END_DRAWING, endDrawing,
geometryChanged, GEOMETRY_CHANGED,
drawStopped, DRAW_SUPPORT_STOPPED,
setCurrentStyle, SET_CURRENT_STYLE
} = require('../draw');

describe('Test correctness of the draw actions', () => {
Expand Down Expand Up @@ -43,4 +44,31 @@ describe('Test correctness of the draw actions', () => {
expect(retval.geometry).toBe("geometry");
expect(retval.owner).toBe("queryform");
});

it('Test geometryChanged action creator', () => {
const features = [{
geometry: {
type: "Point",
coordinates: []
}
}];

const retval = geometryChanged(features);

expect(retval).toExist();
expect(retval.type).toBe(GEOMETRY_CHANGED);
expect(retval.features).toExist();
expect(retval.features).toBe(features);
});
it('Test drawStopped action creator', () => {
const retval = drawStopped();
expect(retval).toExist();
expect(retval.type).toBe(DRAW_SUPPORT_STOPPED);
});
it('Test setCurrentStyle action creator', () => {
const retval = setCurrentStyle("somestyle");
expect(retval).toExist();
expect(retval.type).toBe(SET_CURRENT_STYLE);
expect(retval.currentStyle).toBe("somestyle");
});
});
168 changes: 162 additions & 6 deletions web/client/actions/__tests__/featuregrid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,177 @@

const expect = require('expect');
const {
SELECT_FEATURES,
selectFeatures
SELECT_FEATURES, selectFeatures,
changePage, CHANGE_PAGE,
sort, SORT_BY,
setSelectionOptions, SET_SELECTION_OPTIONS,
MODES, TOGGLE_MODE, toggleEditMode, toggleViewMode,
featureModified, FEATURES_MODIFIED,
createNewFeatures, CREATE_NEW_FEATURE,
saveChanges, SAVE_CHANGES,
saveSuccess, SAVE_SUCCESS,
deleteFeatures, DELETE_SELECTED_FEATURES,
startEditingFeature, START_EDITING_FEATURE,
featureSaving, SAVING,
saveError, SAVE_ERROR,
clearChanges, CLEAR_CHANGES,
geometryChanged, GEOMETRY_CHANGED,
startDrawingFeature, START_DRAWING_FEATURE,
deleteGeometry, DELETE_GEOMETRY,
deleteGeometryFeature, DELETE_GEOMETRY_FEATURE,
clearChangeConfirmed, CLEAR_CHANGES_CONFIRMED,
deleteFeaturesConfirm, DELETE_SELECTED_FEATURES_CONFIRM,
closeFeatureGridConfirmed, FEATURE_GRID_CLOSE_CONFIRMED
} = require('../featuregrid');

const idFeature = "2135";
const feature = {
type: "Feature",
id: idFeature,
properties: {
name: "f.name"
},
geometry: {
type: "Point",
coordinates: [1, 2]
}
};
const features = [feature, feature];
const options = {editEnabled: true};
describe('Test correctness of featurgrid actions', () => {

it('Test deleteGeometryFeature action creator', () => {
const retval = deleteGeometryFeature(features);
expect(retval).toExist();
expect(retval.features).toExist();
expect(retval.features.length).toBe(features.length);
expect(retval.type).toBe(DELETE_GEOMETRY_FEATURE);
});
it('Test deleteGeometry action creator', () => {
const retval = deleteGeometry();
expect(retval).toExist();
expect(retval.type).toBe(DELETE_GEOMETRY);
});
it('Test closeFeatureGridConfirmed action creator', () => {
const retval = closeFeatureGridConfirmed();
expect(retval).toExist();
expect(retval.type).toBe(FEATURE_GRID_CLOSE_CONFIRMED);
});
it('Test clearChangeConfirmed action creator', () => {
const retval = clearChangeConfirmed();
expect(retval).toExist();
expect(retval.type).toBe(CLEAR_CHANGES_CONFIRMED);
});
it('Test startDrawingFeature action creator', () => {
const retval = startDrawingFeature();
expect(retval).toExist();
expect(retval.type).toBe(START_DRAWING_FEATURE);
});
it('Test geometryChanged action creator', () => {
const retval = geometryChanged([feature]);
expect(retval).toExist();
expect(retval.type).toBe(GEOMETRY_CHANGED);
expect(retval.features).toExist();
expect(retval.features[0].id).toBe(idFeature);
expect(retval.features.length).toBe(1);
});
it('Test selectFeature action creator', () => {
const features = [1, 2];
const someFeatures = [1, 2];
const retval = selectFeatures(someFeatures);
expect(retval).toExist();
expect(retval.type).toBe(SELECT_FEATURES);
expect(retval.features).toExist();
expect(retval.features).toBe(someFeatures);
});
it('Test changePage action creator', () => {
const retval = changePage(1, 2);
expect(retval).toExist();
expect(retval.type).toBe(CHANGE_PAGE);
expect(retval.page).toBe(1);
expect(retval.size).toBe(2);
});
it('Test sort action creator', () => {
const retval = sort("attr", "ASC");
expect(retval).toExist();
expect(retval.type).toBe(SORT_BY);
expect(retval.sortBy).toBe("attr");
expect(retval.sortOrder).toBe("ASC");
});
it('Test startEditingFeature', () => {
const retval = startEditingFeature(feature, options);
expect(retval).toExist();
expect(retval.type).toBe(START_EDITING_FEATURE);
});
it('Test setSelectionOptions', () => {
const retval = setSelectionOptions({multiselect: true});
expect(retval).toExist();
expect(retval.type).toBe(SET_SELECTION_OPTIONS);
expect(retval.multiselect).toExist();
expect(retval.multiselect).toBeTruthy();
});
it('Test toggleEditMode AND toggleViewMode', () => {
let retval = toggleEditMode();
expect(retval).toExist();
expect(retval.type).toBe(TOGGLE_MODE);
expect(retval.mode).toExist();
expect(retval.mode).toBe(MODES.EDIT);

const retval = selectFeatures(features);
retval = toggleViewMode();
expect(retval).toExist();
expect(retval.type).toBe(TOGGLE_MODE);
expect(retval.mode).toExist();
expect(retval.mode).toBe(MODES.VIEW);
});

it('Test featureModified', () => {
const retval = featureModified([feature, feature], true);
expect(retval).toExist();
expect(retval.type).toBe(SELECT_FEATURES);
expect(retval.type).toBe(FEATURES_MODIFIED);
expect(retval.features).toExist();
expect(retval.features).toBe(features);
expect(retval.features.length).toBe(2);
expect(retval.updated).toBeTruthy();
});
it('Test createNewFeatures', () => {
const retval = createNewFeatures(features);
expect(retval).toExist();
expect(retval.type).toBe(CREATE_NEW_FEATURE);
expect(retval.features).toExist();
expect(retval.features.length).toBe(2);
});
it('Test saveChanges', () => {
const retval = saveChanges();
expect(retval).toExist();
expect(retval.type).toBe(SAVE_CHANGES);
});
it('Test saveSuccess', () => {
const retval = saveSuccess();
expect(retval).toExist();
expect(retval.type).toBe(SAVE_SUCCESS);
});
it('Test deleteFeatures', () => {
const retval = deleteFeatures();
expect(retval).toExist();
expect(retval.type).toBe(DELETE_SELECTED_FEATURES);
});
it('Test featureSaving', () => {
const retval = featureSaving();
expect(retval).toExist();
expect(retval.type).toBe(SAVING);
});
it('Test clearChanges', () => {
const retval = clearChanges();
expect(retval).toExist();
expect(retval.type).toBe(CLEAR_CHANGES);
});
it('Test deleteFeaturesConfirm', () => {
const retval = deleteFeaturesConfirm();
expect(retval).toExist();
expect(retval.type).toBe(DELETE_SELECTED_FEATURES_CONFIRM);
});
it('Test saveError', () => {
const retval = saveError();
expect(retval).toExist();
expect(retval.type).toBe(SAVE_ERROR);
});

});
Loading

0 comments on commit e8a46e9

Please sign in to comment.