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

Draft: Workspace edition #1157

Draft
wants to merge 3 commits into
base: next
Choose a base branch
from
Draft
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
29 changes: 18 additions & 11 deletions src/app/pages/portal/portal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import {
sourceCanReverseSearch,
sourceCanSearch
} from '@igo2/geo';
import { NewEditionWorkspace } from '@igo2/geo';
import {
AnalyticsListenerService,
ContextState,
Expand Down Expand Up @@ -636,26 +637,32 @@ export class PortalComponent implements OnInit, OnDestroy {
}

isEditionWorkspace(workspace) {
return (
workspace instanceof EditionWorkspace ||
workspace instanceof NewEditionWorkspace
);
}

addFeature(workspace: EditionWorkspace | NewEditionWorkspace) {
if (workspace instanceof EditionWorkspace) {
return true;
let feature = {
type: 'Feature',
properties: {}
};
feature.properties = this.createFeatureProperties(workspace.layer);
this.workspaceState.rowsInMapExtentCheckCondition$.next(false);
workspace.editFeature(feature, workspace);
return;
}
return false;
}

addFeature(workspace: EditionWorkspace) {
let feature = {
type: 'Feature',
properties: {}
};
feature.properties = this.createFeatureProperties(workspace.layer);
this.workspaceState.rowsInMapExtentCheckCondition$.next(false);
workspace.editFeature(feature, workspace);
workspace.createFeature();
}

createFeatureProperties(layer: ImageLayer | VectorLayer) {
let properties = {};
layer.options.sourceOptions.sourceFields.forEach((field) => {
if (!field.primary && field.visible) {
if (!field.primary) {
properties[field.name] = '';
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"nbVisitToShowAgain": 30
},
"edition": {
"url": "/apis/inedit/"
"url": "http://localhost/"
},
"wakeLockApiButton": false,
"offlineButton": false,
Expand Down
49 changes: 49 additions & 0 deletions src/contexts/_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,55 @@
}
},
"layers": [
{
"title": "Montreal Parking Terminals",
"id": "parking",
"visible": true,
"editable": true,
"sourceOptions": {
"queryable": true,
"params": {
"featureTypes": "parking",
"fieldNameGeometry": "msGeometry",
"maxFeatures": 10000,
"version": "1.0.0"
},
"edition": {
"enabled": true,
"baseUrl": "parking_terminal_on_roads",
"addUrl": "",
"deleteUrl": "?id=eq.",
"modifyUrl": "?id=eq.",
"geomType": "Point",
"modifyButton": true,
"addWithDraw": false,
"hasGeometry": false
},
"sourceFields": [
{
"name": "id",
"primary": true,
"validation": {
"readonly": true
}
},
{
"name": "status"
},
{
"name": "roadname"
},
{
"name": "exploitationtype"
},
{
"name": "zonegroupcode"
}
],
"type": "wfs",
"url": "http://localhost:8080/?map=/etc/mapserver/parking.map"
}
},
{
"id": "fond_osm",
"title": "Open Street Map",
Expand Down
Loading