Commit 229df2847d68d03406c6860701107aae4bd67b43
1 parent
90d0b43c
Big map commit
Showing
25 changed files
with
824 additions
and
220 deletions
Show diff stats
src/app/app.module.ts
1 | -import { NgModule, Type } from '@angular/core'; | ||
2 | -import { BrowserModule, Title } from '@angular/platform-browser'; | 1 | +import {NgModule, Type} from '@angular/core'; |
2 | +import {BrowserModule, Title} from '@angular/platform-browser'; | ||
3 | 3 | ||
4 | -import { CovalentCoreModule, CovalentLoadingModule } from '@covalent/core'; | ||
5 | -import { CovalentHttpModule, IHttpInterceptor } from '@covalent/http'; | ||
6 | -import { CovalentHighlightModule } from '@covalent/highlight'; | ||
7 | -import { CovalentMarkdownModule } from '@covalent/markdown'; | ||
8 | -import { CovalentChartsModule } from '@covalent/charts'; | 4 | +import {CovalentCoreModule, CovalentLoadingModule} from '@covalent/core'; |
5 | +import {CovalentHttpModule, IHttpInterceptor} from '@covalent/http'; | ||
6 | +import {CovalentHighlightModule} from '@covalent/highlight'; | ||
7 | +import {CovalentMarkdownModule} from '@covalent/markdown'; | ||
8 | +import {CovalentChartsModule} from '@covalent/charts'; | ||
9 | 9 | ||
10 | -import { AppComponent } from './app.component'; | ||
11 | -import { MainComponent } from './main/main.component'; | ||
12 | -import { LoginComponent } from './login/login.component'; | ||
13 | -import { DataComponent } from './data/data.component'; | ||
14 | -import { TemplatesComponent } from './templates/templates.component'; | ||
15 | -import { appRoutes, appRoutingProviders } from './app.routes'; | ||
16 | -import { AgGridModule } from 'ag-grid-ng2/main'; | ||
17 | -import { ChartComponent } from '../components/chart/chart.component'; | 10 | +import {AppComponent} from './app.component'; |
11 | +import {MainComponent} from './main/main.component'; | ||
12 | +import {LoginComponent} from './login/login.component'; | ||
13 | +import {DataComponent} from './data/data.component'; | ||
14 | +import {TemplatesComponent} from './templates/templates.component'; | ||
15 | +import {appRoutes, appRoutingProviders} from './app.routes'; | ||
16 | +import {AgGridModule} from 'ag-grid-ng2/main'; | ||
17 | +import {ChartComponent} from '../components/chart/chart.component'; | ||
18 | 18 | ||
19 | 19 | ||
20 | -import { RequestInterceptor } from '../config/interceptors/request.interceptor'; | 20 | +import {RequestInterceptor} from '../config/interceptors/request.interceptor'; |
21 | 21 | ||
22 | -import { NgxChartsModule } from '@swimlane/ngx-charts'; | 22 | +import {NgxChartsModule} from '@swimlane/ngx-charts'; |
23 | 23 | ||
24 | -import { BusStopComponent } from './data/bus-stop/bus-stop.component'; | ||
25 | -import { ServiceObjectComponent } from './data/service-object/service-object.component'; | ||
26 | -import { RoadSurfaceComponent } from './data/road-surface/road-surface.component'; | ||
27 | -import { RoadWidthComponent } from './data/road-width/road-width.component'; | ||
28 | -import { RoadToCategoryComponent } from './data/road-to-category/road-to-category.component'; | ||
29 | -import { CrossSectionComponent } from './data/cross-section/cross-section.component'; | ||
30 | -import { EditorComponent } from '../helpers/editor.component'; | ||
31 | -import { RendererComponent } from '../helpers/renderer.component'; | ||
32 | -import { MapEditorComponent } from '../helpers/map-editor.component'; | ||
33 | -import { MapRendererComponent } from '../helpers/map-renderer.component'; | ||
34 | -import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; | ||
35 | -import { RoadComponent } from './data/road/road.component'; | ||
36 | -import { RoadServiceComponent } from './data/road-service/road-service.component'; | ||
37 | -import { SettlementAddressLinkComponent } from './data/settlement-address-link/settlement-address-link.component'; | ||
38 | -import { MapComponent } from './data/map/map.component'; | ||
39 | -import { MapItemsComponent } from './data/map-items/map-items.component'; | ||
40 | -import { RoadMapComponent } from '../components/road-map.component'; | 24 | +import {BusStopComponent} from './data/bus-stop/bus-stop.component'; |
25 | +import {ServiceObjectComponent} from './data/service-object/service-object.component'; | ||
26 | +import {RoadSurfaceComponent} from './data/road-surface/road-surface.component'; | ||
27 | +import {RoadWidthComponent} from './data/road-width/road-width.component'; | ||
28 | +import {RoadToCategoryComponent} from './data/road-to-category/road-to-category.component'; | ||
29 | +import {CrossSectionComponent} from './data/cross-section/cross-section.component'; | ||
30 | +import {EditorComponent} from '../helpers/editor.component'; | ||
31 | +import {RendererComponent} from '../helpers/renderer.component'; | ||
32 | +import {MapEditorComponent} from '../helpers/map-editor.component'; | ||
33 | +import {MapRendererComponent} from '../helpers/map-renderer.component'; | ||
34 | +import {FlowIntensityComponent} from './data/flow-intensity/flow-intensity.component'; | ||
35 | +import {RoadComponent} from './data/road/road.component'; | ||
36 | +import {RoadServiceComponent} from './data/road-service/road-service.component'; | ||
37 | +import {SettlementAddressLinkComponent} from './data/settlement-address-link/settlement-address-link.component'; | ||
38 | +import {AuthorityComponent} from './data/authority/authority.component'; | ||
39 | +import {MapComponent} from './data/map/map.component'; | ||
40 | +import {MapItemsComponent} from './data/map-items/map-items.component'; | ||
41 | +import {RoadMapComponent} from '../components/road-map.component'; | ||
41 | 42 | ||
42 | // Services | 43 | // Services |
43 | -import { BusStopCreateService } from '../services/bus-stop-create.service'; | ||
44 | -import { BusStopService } from '../services/bus-stop.service'; | ||
45 | -import { ServiceObjectCreateService } from '../services/service-object-create.service'; | ||
46 | -import { ServiceObjectService } from '../services/service-object.service'; | ||
47 | -import { RoadSurfaceService } from '../services/road-surface.service'; | ||
48 | -import { RoadSurfaceCreateService } from '../services/road-surface-create.service'; | ||
49 | -import { RoadWidthService } from '../services/road-width.service'; | ||
50 | -import { RoadWidthCreateService } from '../services/road-width-create.service'; | ||
51 | -import { RoadToCategoryService } from '../services/road-to-category.service'; | ||
52 | -import { RoadToCategoryCreateService } from '../services/road-to-category-create.service'; | ||
53 | -import { CrossSectionService } from '../services/cross-section.service'; | ||
54 | -import { CrossSectionCreateService } from '../services/cross-section-create.service'; | ||
55 | -import { BooleanSelectListService } from '../services/boolean-select-list.service'; | ||
56 | -import { FlowIntensityCreateService } from '../services/flow-intensity-create.service'; | ||
57 | -import { FlowIntensityService } from '../services/flow-intensity.service'; | ||
58 | -import { RoadCreateService } from '../services/road-create.service'; | ||
59 | -import { RoadService } from '../services/road.service'; | ||
60 | -import { RoadServiceService } from '../services/road-service.service'; | ||
61 | -import { RoadServiceCreateService } from '../services/road-service-create.service'; | ||
62 | -import { SettlementAddressLinkService } from '../services/settlement-address-link.service'; | ||
63 | -import { SettlementAddressLinkCreateService } from '../services/settlement-address-link-create.service'; | 44 | +import {BusStopCreateService} from '../services/bus-stop-create.service'; |
45 | +import {BusStopService} from '../services/bus-stop.service'; | ||
46 | +import {ServiceObjectCreateService} from '../services/service-object-create.service'; | ||
47 | +import {ServiceObjectService} from '../services/service-object.service'; | ||
48 | +import {RoadSurfaceService} from '../services/road-surface.service'; | ||
49 | +import {RoadSurfaceCreateService} from '../services/road-surface-create.service'; | ||
50 | +import {RoadWidthService} from '../services/road-width.service'; | ||
51 | +import {RoadWidthCreateService} from '../services/road-width-create.service'; | ||
52 | +import {RoadToCategoryService} from '../services/road-to-category.service'; | ||
53 | +import {RoadToCategoryCreateService} from '../services/road-to-category-create.service'; | ||
54 | +import {CrossSectionService} from '../services/cross-section.service'; | ||
55 | +import {CrossSectionCreateService} from '../services/cross-section-create.service'; | ||
56 | +import {BooleanSelectListService} from '../services/boolean-select-list.service'; | ||
57 | +import {FlowIntensityCreateService} from '../services/flow-intensity-create.service'; | ||
58 | +import {FlowIntensityService} from '../services/flow-intensity.service'; | ||
59 | +import {RoadCreateService} from '../services/road-create.service'; | ||
60 | +import {RoadService} from '../services/road.service'; | ||
61 | +import {RoadServiceService} from '../services/road-service.service'; | ||
62 | +import {RoadServiceCreateService} from '../services/road-service-create.service'; | ||
63 | +import {SettlementAddressLinkService} from '../services/settlement-address-link.service'; | ||
64 | +import {SettlementAddressLinkCreateService} from '../services/settlement-address-link-create.service'; | ||
65 | +import {AuthorityService} from '../services/authority.service'; | ||
66 | +import {AuthorityCreateService} from '../services/authority-create.service'; | ||
67 | +import {ContractorService} from "../services/contractor.service"; | ||
68 | +import {ContractorCreateService} from "../services/contractor-create.service"; | ||
69 | +import {ContractorComponent} from "./data/contractor/contractor.component"; | ||
70 | +import {CovalentExpansionPanelModule} from "@covalent/core/expansion-panel/expansion-panel.module"; | ||
64 | 71 | ||
65 | const httpInterceptorProviders: Type<any>[] = [ | 72 | const httpInterceptorProviders: Type<any>[] = [ |
66 | - RequestInterceptor, | 73 | + RequestInterceptor, |
67 | ]; | 74 | ]; |
68 | 75 | ||
69 | @NgModule({ | 76 | @NgModule({ |
70 | - declarations: [ | ||
71 | - AppComponent, | ||
72 | - MainComponent, | ||
73 | - DataComponent, | ||
74 | - LoginComponent, | ||
75 | - ChartComponent, | ||
76 | - TemplatesComponent, | ||
77 | - BusStopComponent, | ||
78 | - ServiceObjectComponent, | ||
79 | - RoadSurfaceComponent, | ||
80 | - EditorComponent, | ||
81 | - RendererComponent, | ||
82 | - MapEditorComponent, | ||
83 | - MapRendererComponent, | ||
84 | - MapItemsComponent, | ||
85 | - RoadWidthComponent, | ||
86 | - RoadToCategoryComponent, | ||
87 | - FlowIntensityComponent, | ||
88 | - RoadComponent, | ||
89 | - CrossSectionComponent, | ||
90 | - RoadServiceComponent, | ||
91 | - SettlementAddressLinkComponent, | ||
92 | - MapComponent, | ||
93 | - RoadMapComponent | ||
94 | - ], // directives, components, and pipes owned by this NgModule | ||
95 | - imports: [ | ||
96 | - BrowserModule, | ||
97 | - AgGridModule.withComponents([ | ||
98 | - BusStopComponent, | ||
99 | - ServiceObjectComponent, | ||
100 | - EditorComponent, | ||
101 | - RendererComponent, | ||
102 | - MapEditorComponent, | ||
103 | - MapRendererComponent, | ||
104 | - RoadSurfaceComponent, | ||
105 | - RoadWidthComponent, | ||
106 | - RoadToCategoryComponent, | ||
107 | - FlowIntensityComponent, | ||
108 | - RoadComponent, | ||
109 | - CrossSectionComponent, | ||
110 | - RoadServiceComponent, | ||
111 | - SettlementAddressLinkComponent, | ||
112 | - ]), | ||
113 | - CovalentCoreModule.forRoot(), | ||
114 | - CovalentChartsModule.forRoot(), | ||
115 | - CovalentHttpModule.forRoot({ | ||
116 | - interceptors: [{ | ||
117 | - interceptor: RequestInterceptor, paths: ['**'], | ||
118 | - }], | ||
119 | - }), | ||
120 | - CovalentHighlightModule.forRoot(), | ||
121 | - CovalentMarkdownModule.forRoot(), | ||
122 | - CovalentLoadingModule.forRoot(), | ||
123 | - appRoutes, | ||
124 | - NgxChartsModule, | ||
125 | - ], // modules needed to run this module | ||
126 | - providers: [ | ||
127 | - appRoutingProviders, | ||
128 | - httpInterceptorProviders, | ||
129 | - Title, | ||
130 | - BooleanSelectListService, | ||
131 | - BusStopCreateService, | ||
132 | - BusStopService, | ||
133 | - ServiceObjectCreateService, | ||
134 | - ServiceObjectService, | ||
135 | - RoadSurfaceCreateService, | ||
136 | - RoadSurfaceService, | ||
137 | - RoadWidthCreateService, | ||
138 | - RoadWidthService, | ||
139 | - RoadToCategoryCreateService, | ||
140 | - RoadToCategoryService, | ||
141 | - FlowIntensityCreateService, | ||
142 | - FlowIntensityService, | ||
143 | - RoadCreateService, | ||
144 | - RoadService, | ||
145 | - CrossSectionCreateService, | ||
146 | - CrossSectionService, | ||
147 | - RoadServiceService, | ||
148 | - RoadServiceCreateService, | ||
149 | - SettlementAddressLinkService, | ||
150 | - SettlementAddressLinkCreateService | ||
151 | - ], // additional providers needed for this module | ||
152 | - entryComponents: [ ], | ||
153 | - bootstrap: [ AppComponent ], | 77 | + declarations: [ |
78 | + AppComponent, | ||
79 | + MainComponent, | ||
80 | + DataComponent, | ||
81 | + LoginComponent, | ||
82 | + ChartComponent, | ||
83 | + TemplatesComponent, | ||
84 | + BusStopComponent, | ||
85 | + ServiceObjectComponent, | ||
86 | + RoadSurfaceComponent, | ||
87 | + EditorComponent, | ||
88 | + RendererComponent, | ||
89 | + MapEditorComponent, | ||
90 | + MapRendererComponent, | ||
91 | + MapItemsComponent, | ||
92 | + RoadWidthComponent, | ||
93 | + RoadToCategoryComponent, | ||
94 | + FlowIntensityComponent, | ||
95 | + RoadComponent, | ||
96 | + CrossSectionComponent, | ||
97 | + RoadServiceComponent, | ||
98 | + SettlementAddressLinkComponent, | ||
99 | + AuthorityComponent, | ||
100 | + ContractorComponent, | ||
101 | + MapComponent, | ||
102 | + RoadMapComponent | ||
103 | + ], // directives, components, and pipes owned by this NgModule | ||
104 | + imports: [ | ||
105 | + BrowserModule, | ||
106 | + AgGridModule.withComponents([ | ||
107 | + BusStopComponent, | ||
108 | + ServiceObjectComponent, | ||
109 | + EditorComponent, | ||
110 | + RendererComponent, | ||
111 | + MapEditorComponent, | ||
112 | + MapRendererComponent, | ||
113 | + RoadSurfaceComponent, | ||
114 | + RoadWidthComponent, | ||
115 | + RoadToCategoryComponent, | ||
116 | + FlowIntensityComponent, | ||
117 | + RoadComponent, | ||
118 | + CrossSectionComponent, | ||
119 | + RoadServiceComponent, | ||
120 | + SettlementAddressLinkComponent, | ||
121 | + AuthorityComponent, | ||
122 | + ContractorComponent | ||
123 | + ]), | ||
124 | + CovalentCoreModule.forRoot(), | ||
125 | + CovalentChartsModule.forRoot(), | ||
126 | + CovalentHttpModule.forRoot({ | ||
127 | + interceptors: [{ | ||
128 | + interceptor: RequestInterceptor, paths: ['**'], | ||
129 | + }], | ||
130 | + }), | ||
131 | + CovalentHighlightModule.forRoot(), | ||
132 | + CovalentMarkdownModule.forRoot(), | ||
133 | + CovalentLoadingModule.forRoot(), | ||
134 | + appRoutes, | ||
135 | + NgxChartsModule, | ||
136 | + ], // modules needed to run this module | ||
137 | + providers: [ | ||
138 | + appRoutingProviders, | ||
139 | + httpInterceptorProviders, | ||
140 | + Title, | ||
141 | + BooleanSelectListService, | ||
142 | + BusStopCreateService, | ||
143 | + BusStopService, | ||
144 | + ServiceObjectCreateService, | ||
145 | + ServiceObjectService, | ||
146 | + RoadSurfaceCreateService, | ||
147 | + RoadSurfaceService, | ||
148 | + RoadWidthCreateService, | ||
149 | + RoadWidthService, | ||
150 | + RoadToCategoryCreateService, | ||
151 | + RoadToCategoryService, | ||
152 | + FlowIntensityCreateService, | ||
153 | + FlowIntensityService, | ||
154 | + RoadCreateService, | ||
155 | + RoadService, | ||
156 | + CrossSectionCreateService, | ||
157 | + CrossSectionService, | ||
158 | + RoadServiceService, | ||
159 | + RoadServiceCreateService, | ||
160 | + SettlementAddressLinkService, | ||
161 | + SettlementAddressLinkCreateService, | ||
162 | + AuthorityService, | ||
163 | + AuthorityCreateService, | ||
164 | + ContractorService, | ||
165 | + ContractorCreateService | ||
166 | + ], // additional providers needed for this module | ||
167 | + entryComponents: [], | ||
168 | + bootstrap: [AppComponent], | ||
154 | }) | 169 | }) |
155 | -export class AppModule {} | 170 | +export class AppModule { |
171 | +} |
src/app/app.routes.ts
@@ -15,6 +15,8 @@ import { RoadComponent } from './data/road/road.component'; | @@ -15,6 +15,8 @@ import { RoadComponent } from './data/road/road.component'; | ||
15 | import { RoadServiceComponent } from './data/road-service/road-service.component'; | 15 | import { RoadServiceComponent } from './data/road-service/road-service.component'; |
16 | import { SettlementAddressLinkComponent } from './data/settlement-address-link/settlement-address-link.component'; | 16 | import { SettlementAddressLinkComponent } from './data/settlement-address-link/settlement-address-link.component'; |
17 | import { MapComponent } from './data/map/map.component'; | 17 | import { MapComponent } from './data/map/map.component'; |
18 | +import {AuthorityComponent} from "./data/authority/authority.component"; | ||
19 | +import {ContractorComponent} from "./data/contractor/contractor.component"; | ||
18 | 20 | ||
19 | const routes: Routes = [ | 21 | const routes: Routes = [ |
20 | {path: 'login', component: LoginComponent}, | 22 | {path: 'login', component: LoginComponent}, |
@@ -31,6 +33,8 @@ const routes: Routes = [ | @@ -31,6 +33,8 @@ const routes: Routes = [ | ||
31 | {path: 'road-service', component: RoadServiceComponent}, | 33 | {path: 'road-service', component: RoadServiceComponent}, |
32 | {path: 'road-to-category', component: RoadToCategoryComponent}, | 34 | {path: 'road-to-category', component: RoadToCategoryComponent}, |
33 | {path: 'settlement-address-link', component: SettlementAddressLinkComponent}, | 35 | {path: 'settlement-address-link', component: SettlementAddressLinkComponent}, |
36 | + {path: 'authority', component: AuthorityComponent}, | ||
37 | + {path: 'contractor', component: ContractorComponent}, | ||
34 | {path: 'map', component: MapComponent}, | 38 | {path: 'map', component: MapComponent}, |
35 | ]}, | 39 | ]}, |
36 | ]}, | 40 | ]}, |
1 | +<div class="grid_containert" *ngIf="showGrid"> | ||
2 | + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-blue" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | ||
3 | + toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" | ||
4 | + (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" | ||
5 | + (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged($event)" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | ||
6 | + </ag-grid-ng2> | ||
7 | + <div class="control_button"> | ||
8 | + <div *tdLoading="'loading'; mode:'indeterminate'; type:'circle'; strategy:'replace'; color:'accent'"></div> | ||
9 | + <button md-fab color="accent" [disabled]="isNew || isSelected" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | ||
10 | + <button md-fab color="warn" [disabled]="!isSelected" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> | ||
11 | + </div> | ||
12 | +</div> | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
1 | +import {Component, ViewEncapsulation, AfterViewInit, ViewChild} from '@angular/core'; | ||
2 | +import {TdLoadingService} from '@covalent/core'; | ||
3 | + | ||
4 | +import {StatementBase} from '../../../models/statement.base'; | ||
5 | + | ||
6 | +import {AuthorityService} from '../../../services/authority.service'; | ||
7 | +import {EditorComponent} from '../../../helpers/editor.component'; | ||
8 | +import {RendererComponent} from '../../../helpers/renderer.component'; | ||
9 | +import {AuthorityCreateService} from '../../../services/authority-create.service'; | ||
10 | +import {RoadSelectList} from '../../../models/road-select-list'; | ||
11 | +import {CrossSectionSelectList} from "../../../models/cross-section-select-list"; | ||
12 | + | ||
13 | +@Component({ | ||
14 | + // tslint:disable-next-line:component-selector | ||
15 | + selector: 'authority-grid', | ||
16 | + templateUrl: 'authority.component.html', | ||
17 | + styleUrls: ['authority.scss'], | ||
18 | + encapsulation: ViewEncapsulation.None, | ||
19 | +}) | ||
20 | +export class AuthorityComponent extends StatementBase { | ||
21 | + public roads: RoadSelectList[]; | ||
22 | + public crosssections: CrossSectionSelectList[]; | ||
23 | + | ||
24 | + constructor(protected service: AuthorityService, | ||
25 | + protected dataService: AuthorityCreateService, | ||
26 | + protected loadingService: TdLoadingService,) { | ||
27 | + super(); | ||
28 | + } | ||
29 | + | ||
30 | + protected createColumnDefs(): any[] { | ||
31 | + return [ | ||
32 | + { | ||
33 | + headerName: '#', | ||
34 | + width: 30, | ||
35 | + checkboxSelection: true, | ||
36 | + suppressSorting: true, | ||
37 | + suppressMenu: true, | ||
38 | + pinned: true, | ||
39 | + }, | ||
40 | + { | ||
41 | + headerName: 'ID', | ||
42 | + field: 'id', | ||
43 | + }, | ||
44 | + { | ||
45 | + headerName: 'ะะฐะทะฒะฐ ะดะพัะพะณะธ', | ||
46 | + field: 'roadId', | ||
47 | + editable: true, | ||
48 | + cellEditorFramework: EditorComponent, | ||
49 | + cellRendererFramework: RendererComponent, | ||
50 | + cellEditorParams: { | ||
51 | + data: this.roads, | ||
52 | + valueCol: 'roadId', | ||
53 | + labelCol: 'name', | ||
54 | + }, | ||
55 | + }, | ||
56 | + { | ||
57 | + headerName: 'ะะพะผะตั ะท\'ัะทะดั ััะฐะฝัะฟะพััะฝะพั ัะพะทะฒ\'ัะทะบะธ', | ||
58 | + field: 'crossSectionId', | ||
59 | + editable: true, | ||
60 | + cellEditorFramework: EditorComponent, | ||
61 | + cellRendererFramework: RendererComponent, | ||
62 | + cellEditorParams: { | ||
63 | + data: this.crosssections, | ||
64 | + valueCol: 'id', | ||
65 | + labelCol: 'name', | ||
66 | + }, | ||
67 | + }, | ||
68 | + { | ||
69 | + headerName: 'ะะฐะทะฒะฐ ะพัะณะฐะฝั ัะฟัะฐะฒะปัะฝะฝั (ะฑะฐะปะฐะฝัะพัััะธะผัะฒะฐัะฐ)', | ||
70 | + field: 'authorityName', | ||
71 | + editable: true, | ||
72 | + }, | ||
73 | + { | ||
74 | + headerName: 'ะะพะผะตั ะดัะปัะฝะบะธ ะดะพัะพะณะธ', | ||
75 | + field: 'roadSectionNumber', | ||
76 | + editable: true, | ||
77 | + }, | ||
78 | + { | ||
79 | + headerName: 'ะะพัะฐัะพะบ (ะฟัะตะฒะดะพะณะตะพะดะฐะฝั)', | ||
80 | + field: 'begin', | ||
81 | + editable: true, | ||
82 | + }, | ||
83 | + { | ||
84 | + headerName: 'ะัะฝะตัั (ะฟัะตะฒะดะพะณะตะพะดะฐะฝั)', | ||
85 | + field: 'end', | ||
86 | + editable: true, | ||
87 | + }, | ||
88 | + { | ||
89 | + headerName: 'ะะพะฒะถะธะฝะฐ (ั ะผะตััะฐั )', | ||
90 | + field: 'length', | ||
91 | + editable: false, | ||
92 | + }, | ||
93 | + { | ||
94 | + headerName: 'ะะพะพัะดะธะฝะฐัะธ ะฒััั ะฟัะฐะฒะพะณะพ ะฟัะพัะทะดั', | ||
95 | + field: 'rightCoords', | ||
96 | + editable: true, | ||
97 | + }, | ||
98 | + { | ||
99 | + headerName: 'ะกั ะตะผะฐ ะฟะพัะฐัะบั/ะผะตะถั ะทะฑััะฝะพะณะพ ะพะฑโัะบัั', | ||
100 | + field: 'beginScheme', | ||
101 | + editable: true, | ||
102 | + }, | ||
103 | + { | ||
104 | + headerName: 'ะกั ะตะผะฐ ะบัะฝัั/ะผะตะถั ะทะฑััะฝะพะณะพ ะพะฑโัะบัั', | ||
105 | + field: 'endScheme', | ||
106 | + editable: true, | ||
107 | + }, | ||
108 | + ]; | ||
109 | + } | ||
110 | + | ||
111 | + protected initFunction(): void { | ||
112 | + this.dataService.getModels().then((models: any) => { | ||
113 | + this.roads = models.roadSelectListDsM as RoadSelectList[]; | ||
114 | + this.crosssections = models.crossSectionSelectListDsM as CrossSectionSelectList[]; | ||
115 | + }).then(() => { | ||
116 | + this.bootstrapGrid(); | ||
117 | + }); | ||
118 | + } | ||
119 | +} |
src/app/data/contractor/contractor.component.html
0 โ 100644
1 | +<div class="grid_containert" *ngIf="showGrid"> | ||
2 | + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-blue" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | ||
3 | + toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" | ||
4 | + (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" | ||
5 | + (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged($event)" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | ||
6 | + </ag-grid-ng2> | ||
7 | + <div class="control_button"> | ||
8 | + <div *tdLoading="'loading'; mode:'indeterminate'; type:'circle'; strategy:'replace'; color:'accent'"></div> | ||
9 | + <button md-fab color="accent" [disabled]="isNew || isSelected" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | ||
10 | + <button md-fab color="warn" [disabled]="!isSelected" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> | ||
11 | + </div> | ||
12 | +</div> | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
1 | +import {Component, ViewEncapsulation, AfterViewInit, ViewChild} from '@angular/core'; | ||
2 | +import {TdLoadingService} from '@covalent/core'; | ||
3 | + | ||
4 | +import {StatementBase} from '../../../models/statement.base'; | ||
5 | + | ||
6 | +import {ContractorService} from '../../../services/contractor.service'; | ||
7 | +import {EditorComponent} from '../../../helpers/editor.component'; | ||
8 | +import {RendererComponent} from '../../../helpers/renderer.component'; | ||
9 | +import {ContractorCreateService} from '../../../services/contractor-create.service'; | ||
10 | +import {RoadSelectList} from '../../../models/road-select-list'; | ||
11 | +import {CrossSectionSelectList} from "../../../models/cross-section-select-list"; | ||
12 | + | ||
13 | +@Component({ | ||
14 | + // tslint:disable-next-line:component-selector | ||
15 | + selector: 'contractor-grid', | ||
16 | + templateUrl: 'contractor.component.html', | ||
17 | + styleUrls: ['contractor.scss'], | ||
18 | + encapsulation: ViewEncapsulation.None, | ||
19 | +}) | ||
20 | +export class ContractorComponent extends StatementBase { | ||
21 | + public roads: RoadSelectList[]; | ||
22 | + public crosssections: CrossSectionSelectList[]; | ||
23 | + | ||
24 | + constructor(protected service: ContractorService, | ||
25 | + protected dataService: ContractorCreateService, | ||
26 | + protected loadingService: TdLoadingService,) { | ||
27 | + super(); | ||
28 | + } | ||
29 | + | ||
30 | + protected createColumnDefs(): any[] { | ||
31 | + return [ | ||
32 | + { | ||
33 | + headerName: '#', | ||
34 | + width: 30, | ||
35 | + checkboxSelection: true, | ||
36 | + suppressSorting: true, | ||
37 | + suppressMenu: true, | ||
38 | + pinned: true, | ||
39 | + }, | ||
40 | + { | ||
41 | + headerName: 'ID', | ||
42 | + field: 'id', | ||
43 | + }, | ||
44 | + { | ||
45 | + headerName: 'ะะฐะทะฒะฐ ะดะพัะพะณะธ', | ||
46 | + field: 'roadId', | ||
47 | + editable: true, | ||
48 | + cellEditorFramework: EditorComponent, | ||
49 | + cellRendererFramework: RendererComponent, | ||
50 | + cellEditorParams: { | ||
51 | + data: this.roads, | ||
52 | + valueCol: 'roadId', | ||
53 | + labelCol: 'name', | ||
54 | + }, | ||
55 | + }, | ||
56 | + { | ||
57 | + headerName: 'ะะพะผะตั ะท\'ัะทะดั ััะฐะฝัะฟะพััะฝะพั ัะพะทะฒ\'ัะทะบะธ', | ||
58 | + field: 'crossSectionId', | ||
59 | + editable: true, | ||
60 | + cellEditorFramework: EditorComponent, | ||
61 | + cellRendererFramework: RendererComponent, | ||
62 | + cellEditorParams: { | ||
63 | + data: this.crosssections, | ||
64 | + valueCol: 'id', | ||
65 | + labelCol: 'name', | ||
66 | + }, | ||
67 | + }, | ||
68 | + { | ||
69 | + headerName: 'ะะฐะทะฒะฐ ะพัะณะฐะฝั ัะฟัะฐะฒะปัะฝะฝั (ะฑะฐะปะฐะฝัะพัััะธะผัะฒะฐัะฐ)', | ||
70 | + field: 'contractorName', | ||
71 | + editable: true, | ||
72 | + }, | ||
73 | + { | ||
74 | + headerName: 'ะะพะผะตั ะดัะปัะฝะบะธ ะดะพัะพะณะธ', | ||
75 | + field: 'roadSectionNumber', | ||
76 | + editable: true, | ||
77 | + }, | ||
78 | + { | ||
79 | + headerName: 'ะะพัะฐัะพะบ (ะฟัะตะฒะดะพะณะตะพะดะฐะฝั)', | ||
80 | + field: 'begin', | ||
81 | + editable: true, | ||
82 | + }, | ||
83 | + { | ||
84 | + headerName: 'ะัะฝะตัั (ะฟัะตะฒะดะพะณะตะพะดะฐะฝั)', | ||
85 | + field: 'end', | ||
86 | + editable: true, | ||
87 | + }, | ||
88 | + { | ||
89 | + headerName: 'ะะพะฒะถะธะฝะฐ (ั ะผะตััะฐั )', | ||
90 | + field: 'length', | ||
91 | + editable: false, | ||
92 | + }, | ||
93 | + { | ||
94 | + headerName: 'ะะพะพัะดะธะฝะฐัะธ ะฒััั ะฟัะฐะฒะพะณะพ ะฟัะพัะทะดั', | ||
95 | + field: 'rightCoords', | ||
96 | + editable: true, | ||
97 | + }, | ||
98 | + { | ||
99 | + headerName: 'ะกั ะตะผะฐ ะฟะพัะฐัะบั/ะผะตะถั ะทะฑััะฝะพะณะพ ะพะฑโัะบัั', | ||
100 | + field: 'beginScheme', | ||
101 | + editable: true, | ||
102 | + }, | ||
103 | + { | ||
104 | + headerName: 'ะกั ะตะผะฐ ะบัะฝัั/ะผะตะถั ะทะฑััะฝะพะณะพ ะพะฑโัะบัั', | ||
105 | + field: 'endScheme', | ||
106 | + editable: true, | ||
107 | + }, | ||
108 | + ]; | ||
109 | + } | ||
110 | + | ||
111 | + protected initFunction(): void { | ||
112 | + this.dataService.getModels().then((models: any) => { | ||
113 | + this.roads = models.roadSelectListDsM as RoadSelectList[]; | ||
114 | + this.crosssections = models.crossSectionSelectListDsM as CrossSectionSelectList[]; | ||
115 | + }).then(() => { | ||
116 | + this.bootstrapGrid(); | ||
117 | + }); | ||
118 | + } | ||
119 | +} |
src/app/data/road/road.component.ts
@@ -38,11 +38,14 @@ export class RoadComponent extends StatementBase { | @@ -38,11 +38,14 @@ export class RoadComponent extends StatementBase { | ||
38 | public showOnMap(): void { | 38 | public showOnMap(): void { |
39 | let selectedRows: any[] = this.gridOptions.api.getSelectedRows(); | 39 | let selectedRows: any[] = this.gridOptions.api.getSelectedRows(); |
40 | if (selectedRows.length) { | 40 | if (selectedRows.length) { |
41 | - let id = selectedRows[0].id; | ||
42 | - this.service.getRelation(id).then(x => { | ||
43 | - this.mapComponent.setWays(x); | ||
44 | - return x; | 41 | + this.mapComponent.clearWays(); |
42 | + selectedRows.forEach((row) => { | ||
43 | + this.service.getRelation(row.id).then(x => { | ||
44 | + this.mapComponent.setWays(x); | ||
45 | + return x; | ||
46 | + }); | ||
45 | }); | 47 | }); |
48 | + this.gridOptions.api.deselectAll(); | ||
46 | } | 49 | } |
47 | } | 50 | } |
48 | 51 |
1 | +<div class="map-controls"> | ||
2 | + <md-icon class="tc-dark-red-B65" mdTooltip="ะะพะบะฐะทะฐัั ัะพัะบะธ" mdTooltipPosition="left" (click)="toggleNodes()">blur_circular</md-icon> | ||
3 | + <md-icon class="tc-dark-red-B65" mdTooltip="ะะพะบะฐะทะฐัั ะปะตะณะตะฝะดั" mdTooltipPosition="below" (click)="toggleLegend()">info</md-icon> | ||
4 | +</div> | ||
5 | +<div class="map-legend" *ngIf="isLegend && legend"> | ||
6 | + <div class="legend-header"> | ||
7 | + <md-icon class="tc-dark-red-B65" (click)="toggleLegend()">close</md-icon> | ||
8 | + <div style="clear:both"></div> | ||
9 | + </div> | ||
10 | + <div class="legend-summary"> | ||
11 | + <td-expansion-panel (expanded)="expandedEvent()" (collapsed)="collapsedEvent()"> | ||
12 | + <template td-expansion-panel-header > | ||
13 | + <p class="expansion-header" *ngIf="isExpanded">ะกะบัััั ะธะฝัะพัะผะฐัะธั ะพ ะฒัะฑะพัะต</p> | ||
14 | + <p class="expansion-header" *ngIf="!isExpanded">ะะพะบะฐะทะฐัั ะธะฝัะพัะผะฐัะธั ะพ ะฒัะฑะพัะต</p> | ||
15 | + </template> | ||
16 | + <div [innerHtml]="legendSummary"></div> | ||
17 | + </td-expansion-panel> | ||
18 | + </div> | ||
19 | + <div class="legend-body" [innerHtml]="legend"></div> | ||
20 | +</div> | ||
21 | +<div id="{{identificator}}" [style.height]="getHeight()" ></div> | ||
0 | \ No newline at end of file | 22 | \ No newline at end of file |
src/components/road-map.component.ts
1 | -import { Component, Input, AfterViewInit } from '@angular/core'; | 1 | +import {Component, Input, AfterViewInit, ViewChild} from '@angular/core'; |
2 | import * as L from 'leaflet'; | 2 | import * as L from 'leaflet'; |
3 | import { Way } from '../models/way'; | 3 | import { Way } from '../models/way'; |
4 | +import {WayPolyline} from "../models/way-polyline"; | ||
5 | +import {NodeMarker} from "../models/node-marker"; | ||
6 | +import {Node} from "../models/node"; | ||
7 | +import {RoadService} from "../services/road.service"; | ||
8 | +import {TdExpansionPanelComponent} from "@covalent/core/expansion-panel/expansion-panel.component"; | ||
4 | 9 | ||
5 | @Component({ | 10 | @Component({ |
6 | // tslint:disable-next-line:component-selector | 11 | // tslint:disable-next-line:component-selector |
7 | selector: 'road-map', | 12 | selector: 'road-map', |
8 | - template: '<div id="{{identificator}}" [style.height]="getHeight()" ></div>', | 13 | + templateUrl: 'road-map.component.html', |
9 | }) | 14 | }) |
10 | export class RoadMapComponent implements AfterViewInit { | 15 | export class RoadMapComponent implements AfterViewInit { |
11 | protected isVisible: boolean = false; | 16 | protected isVisible: boolean = false; |
17 | + protected isNodesVisible: boolean = false; | ||
18 | + protected isLegend: boolean = false; | ||
19 | + protected isExpanded: boolean = false; | ||
12 | protected map: L.Map; | 20 | protected map: L.Map; |
13 | - protected ways: Way[]; | 21 | + protected ways: Way[] = []; |
22 | + protected legend: string; | ||
23 | + protected legendSummary: string; | ||
14 | @Input() identificator: string = 'mapID'; | 24 | @Input() identificator: string = 'mapID'; |
15 | 25 | ||
26 | + constructor( | ||
27 | + protected service: RoadService | ||
28 | + ) {} | ||
29 | + | ||
16 | public ngAfterViewInit(): void { | 30 | public ngAfterViewInit(): void { |
17 | this.map = L.map(this.identificator).setView([51.505, -0.09], 13); | 31 | this.map = L.map(this.identificator).setView([51.505, -0.09], 13); |
18 | L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', { | 32 | L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
19 | maxZoom: 18, | 33 | maxZoom: 18, |
20 | }).addTo(this.map); | 34 | }).addTo(this.map); |
35 | + let controls: L.Control = new L.Control({ | ||
36 | + position: 'topright' | ||
37 | + }); | ||
38 | + controls.onAdd = function (map: L.Map): HTMLElement { | ||
39 | + return L.DomUtil.create('md-icon', 'material-icons mat-icon'); | ||
40 | + }; | ||
41 | + controls.addTo(this.map); | ||
21 | } | 42 | } |
22 | public showMap(): void { | 43 | public showMap(): void { |
23 | this.isVisible = true; | 44 | this.isVisible = true; |
@@ -26,16 +47,15 @@ export class RoadMapComponent implements AfterViewInit { | @@ -26,16 +47,15 @@ export class RoadMapComponent implements AfterViewInit { | ||
26 | return this.isVisible ? '100%' : '100%'; | 47 | return this.isVisible ? '100%' : '100%'; |
27 | } | 48 | } |
28 | public setWays(ways: Way[]): void { | 49 | public setWays(ways: Way[]): void { |
29 | - this.ways = ways; | ||
30 | - this.showWays(); | 50 | + this.ways = this.ways.concat(ways); |
51 | + this.showWays(ways); | ||
31 | } | 52 | } |
32 | - protected showWays(): void { | 53 | + protected showWays(ways: Way[]): void { |
33 | let minLat: number = 0; | 54 | let minLat: number = 0; |
34 | let maxLat: number = 0; | 55 | let maxLat: number = 0; |
35 | let minLon: number = 0; | 56 | let minLon: number = 0; |
36 | let maxLon: number = 0; | 57 | let maxLon: number = 0; |
37 | - console.log(this.ways); | ||
38 | - this.ways.forEach((way) => { | 58 | + ways.forEach((way) => { |
39 | let nodes: L.LatLng[] = []; | 59 | let nodes: L.LatLng[] = []; |
40 | way.nodes.forEach((node) => { | 60 | way.nodes.forEach((node) => { |
41 | if (minLat == 0) { | 61 | if (minLat == 0) { |
@@ -53,16 +73,102 @@ export class RoadMapComponent implements AfterViewInit { | @@ -53,16 +73,102 @@ export class RoadMapComponent implements AfterViewInit { | ||
53 | maxLon = (maxLon < node.lon)?node.lon:maxLon; | 73 | maxLon = (maxLon < node.lon)?node.lon:maxLon; |
54 | } | 74 | } |
55 | let latLng = node.getLatLng(); | 75 | let latLng = node.getLatLng(); |
76 | + node.marker = new NodeMarker(latLng); | ||
77 | + node.marker.node = node; | ||
56 | nodes.push(latLng); | 78 | nodes.push(latLng); |
57 | }); | 79 | }); |
58 | - way.polyline = L.polyline(nodes, {color: 'red'}).addTo(this.map); | ||
59 | - console.log(way.polyline); | 80 | + way.polyline = new WayPolyline(nodes, {color: 'red'}); |
81 | + way.polyline.way = way; | ||
82 | + way.polyline.addTo(this.map).on('click', (event) => { | ||
83 | + console.log(event); | ||
84 | + this.service.getRoadByWay(event.target.way.id).then(road => { | ||
85 | + this.setWaySummary(way); | ||
86 | + this.showLegend(road, 'ะะพัะพะณะฐ'); | ||
87 | + }); | ||
88 | + }); | ||
60 | }); | 89 | }); |
61 | this.map.fitBounds([ | 90 | this.map.fitBounds([ |
62 | [minLat, minLon], | 91 | [minLat, minLon], |
63 | [maxLat, maxLon] | 92 | [maxLat, maxLon] |
64 | ]); | 93 | ]); |
65 | - console.log(minLat, maxLat, minLon, maxLon); | ||
66 | this.showMap(); | 94 | this.showMap(); |
67 | } | 95 | } |
96 | + protected showNodes(): void { | ||
97 | + this.ways.forEach(way => { | ||
98 | + way.nodes.forEach(node => { | ||
99 | + node.marker.addTo(this.map).on('click', (event) => { | ||
100 | + this.service.getRoadByNode(event.target.node.id).then(road => { | ||
101 | + this.setNodeSummary(node); | ||
102 | + this.showLegend(road, 'ะะพัะพะณะฐ'); | ||
103 | + }); | ||
104 | + console.log(event); | ||
105 | + }); | ||
106 | + }); | ||
107 | + }); | ||
108 | + } | ||
109 | + protected hideNodes(): void { | ||
110 | + this.ways.forEach(way => { | ||
111 | + way.nodes.forEach(node => { | ||
112 | + node.marker.remove(); | ||
113 | + }); | ||
114 | + }); | ||
115 | + } | ||
116 | + protected toggleNodes(): void { | ||
117 | + if (this.isNodesVisible) { | ||
118 | + this.hideNodes(); | ||
119 | + this.isNodesVisible = false; | ||
120 | + } else { | ||
121 | + this.showNodes(); | ||
122 | + this.isNodesVisible = true | ||
123 | + } | ||
124 | + } | ||
125 | + protected toggleLegend(): void { | ||
126 | + this.isLegend = !this.isLegend; | ||
127 | + } | ||
128 | + protected showLegend(model: Object, name: string): void { | ||
129 | + let result: string = ''; | ||
130 | + result += '<h3>ะะฝัะพัะผะฐัะธั ะพะฑ ะพะฑัะตะบัะต ' + name; | ||
131 | + if (model.hasOwnProperty('id')) { | ||
132 | + result += ' (id: ' + model['id'] + ')'; | ||
133 | + } | ||
134 | + result += '</h3><ul>'; | ||
135 | + for (let property in model) { | ||
136 | + result += '<li><strong>' + property + '</strong>: ' + (model[property]?model[property]:'ะะต ัะบะฐะทะฐะฝะพ') + '</li>'; | ||
137 | + } | ||
138 | + result += '</ul>'; | ||
139 | + this.isLegend = true; | ||
140 | + this.legend = result; | ||
141 | + } | ||
142 | + protected setNodeSummary(node: Node): void { | ||
143 | + let result: string = '<p>ะั ะฝะฐะถะฐะปะธ ะฝะฐ ัะพัะบั ั ID = ' + node.id + '.</p>'; | ||
144 | + result += '<p>ะะพะพัะดะธะฝะฐัั ัะพัะบะธ: lat = ' + node.lat + ', lon = ' + node.lon + '.</p>'; | ||
145 | + this.legendSummary = result; | ||
146 | + } | ||
147 | + protected setWaySummary(way: Way): void { | ||
148 | + let result: string = '<p>ะั ะฝะฐะถะฐะปะธ ะฝะฐ ะปะธะฝะธั ั ID = ' + way.id + '.</p>'; | ||
149 | + result += '<p>ะะพะปะธัะตััะฒะพ ัะพัะตะบ ะฝะฐ ะปะธะฝะธะธ: ' + way.nodes.length + '.</p>'; | ||
150 | + this.legendSummary = result; | ||
151 | + } | ||
152 | + protected setLegend(legend: string) { | ||
153 | + this.legend = legend; | ||
154 | + this.isLegend = true; | ||
155 | + } | ||
156 | + public clearWays(): void { | ||
157 | + this.ways.forEach(way => { | ||
158 | + way.nodes.forEach(node => { | ||
159 | + node.marker.remove(); | ||
160 | + }); | ||
161 | + way.polyline.remove(); | ||
162 | + }); | ||
163 | + this.ways = []; | ||
164 | + this.legend = undefined; | ||
165 | + this.isLegend = false; | ||
166 | + this.isNodesVisible = false; | ||
167 | + } | ||
168 | + protected collapsedEvent() { | ||
169 | + this.isExpanded = false; | ||
170 | + } | ||
171 | + protected expandedEvent() { | ||
172 | + this.isExpanded = true; | ||
173 | + } | ||
68 | } | 174 | } |
1 | +export class Authority { | ||
2 | + id: number; | ||
3 | + roadId: number; | ||
4 | + crossSectionId: number; | ||
5 | + authorityName: string; | ||
6 | + info: string; | ||
7 | + roadSectionNumber: number; | ||
8 | + begin: number; | ||
9 | + end: number; | ||
10 | + length: number; | ||
11 | + rightCoords: string; | ||
12 | + beginScheme: string; | ||
13 | + endScheme: string; | ||
14 | +} |
1 | +export class Contractor { | ||
2 | + id: number; | ||
3 | + roadId: number; | ||
4 | + crossSectionId: number; | ||
5 | + contractorName: string; | ||
6 | + info: string; | ||
7 | + roadSectionNumber: number; | ||
8 | + begin: number; | ||
9 | + end: number; | ||
10 | + length: number; | ||
11 | + rightCoords: string; | ||
12 | + beginScheme: string; | ||
13 | + endScheme: string; | ||
14 | +} |
src/models/node.ts
1 | import * as L from 'leaflet'; | 1 | import * as L from 'leaflet'; |
2 | +import {NodeMarker} from "./node-marker"; | ||
2 | 3 | ||
3 | export class Node { | 4 | export class Node { |
4 | id: number; | 5 | id: number; |
@@ -6,6 +7,7 @@ export class Node { | @@ -6,6 +7,7 @@ export class Node { | ||
6 | lat: number; | 7 | lat: number; |
7 | lon: number; | 8 | lon: number; |
8 | latLng: L.LatLng; | 9 | latLng: L.LatLng; |
10 | + marker: NodeMarker; | ||
9 | protected createLatLng(): void { | 11 | protected createLatLng(): void { |
10 | this.latLng = L.latLng(this.lat, this.lon); | 12 | this.latLng = L.latLng(this.lat, this.lon); |
11 | } | 13 | } |
src/models/road.ts
src/models/way.ts
1 | import { Node } from './node'; | 1 | import { Node } from './node'; |
2 | import * as L from 'leaflet'; | 2 | import * as L from 'leaflet'; |
3 | +import {WayPolyline} from "./way-polyline"; | ||
3 | 4 | ||
4 | export class Way { | 5 | export class Way { |
5 | id: number; | 6 | id: number; |
6 | nodes: Node[]; | 7 | nodes: Node[]; |
7 | - polyline: L.Polyline; | 8 | + polyline: WayPolyline; |
8 | } | 9 | } |
9 | \ No newline at end of file | 10 | \ No newline at end of file |
1 | +import { Injectable } from '@angular/core'; | ||
2 | +import { Http } from '@angular/http'; | ||
3 | + | ||
4 | +import { CreateBaseService } from './create.base.service'; | ||
5 | + | ||
6 | +@Injectable() | ||
7 | +export class AuthorityCreateService extends CreateBaseService { | ||
8 | + protected apiUrl: string = 'http://localhost:5000/authority/directory'; | ||
9 | + constructor(protected http: Http) { | ||
10 | + super(http); | ||
11 | + } | ||
12 | +} |
1 | +import { Injectable } from '@angular/core'; | ||
2 | +import { Http } from '@angular/http'; | ||
3 | + | ||
4 | +import { StatementBaseService } from './statement.base.service'; | ||
5 | + | ||
6 | +import { Authority } from '../models/authority'; | ||
7 | + | ||
8 | +@Injectable() | ||
9 | +export class AuthorityService extends StatementBaseService { | ||
10 | + protected url: string = 'http://localhost:5000/authority'; | ||
11 | + constructor(protected http: Http) { | ||
12 | + super(http); | ||
13 | + } | ||
14 | + public createModel(): Object { | ||
15 | + return new Authority(); | ||
16 | + } | ||
17 | + protected parseModels(json: any): any[] { | ||
18 | + return json.authorityEditDsM as Authority[]; | ||
19 | + }; | ||
20 | + protected parseModel(json: any): any { | ||
21 | + return json as Authority; | ||
22 | + }; | ||
23 | +} |
1 | +import { Injectable } from '@angular/core'; | ||
2 | +import { Http } from '@angular/http'; | ||
3 | + | ||
4 | +import { CreateBaseService } from './create.base.service'; | ||
5 | + | ||
6 | +@Injectable() | ||
7 | +export class ContractorCreateService extends CreateBaseService { | ||
8 | + protected apiUrl: string = 'http://localhost:5000/contractor/directory'; | ||
9 | + constructor(protected http: Http) { | ||
10 | + super(http); | ||
11 | + } | ||
12 | +} |
1 | +import { Injectable } from '@angular/core'; | ||
2 | +import { Http } from '@angular/http'; | ||
3 | + | ||
4 | +import { StatementBaseService } from './statement.base.service'; | ||
5 | + | ||
6 | +import { Contractor } from '../models/contractor'; | ||
7 | + | ||
8 | +@Injectable() | ||
9 | +export class ContractorService extends StatementBaseService { | ||
10 | + protected url: string = 'http://localhost:5000/contractor'; | ||
11 | + constructor(protected http: Http) { | ||
12 | + super(http); | ||
13 | + } | ||
14 | + public createModel(): Object { | ||
15 | + return new Contractor(); | ||
16 | + } | ||
17 | + protected parseModels(json: any): any[] { | ||
18 | + return json.contractorEditDsM as Contractor[]; | ||
19 | + }; | ||
20 | + protected parseModel(json: any): any { | ||
21 | + return json as Contractor; | ||
22 | + }; | ||
23 | +} |
src/services/road.service.ts
1 | -import { Injectable } from '@angular/core'; | ||
2 | -import { Http } from '@angular/http'; | 1 | +import {Injectable} from '@angular/core'; |
2 | +import {Http} from '@angular/http'; | ||
3 | 3 | ||
4 | -import { StatementBaseService } from './statement.base.service'; | 4 | +import {StatementBaseService} from './statement.base.service'; |
5 | 5 | ||
6 | -import { Road } from '../models/road'; | 6 | +import {Road} from '../models/road'; |
7 | import {Way} from "../models/way"; | 7 | import {Way} from "../models/way"; |
8 | import {Node} from "../models/node"; | 8 | import {Node} from "../models/node"; |
9 | import {id} from "@swimlane/ngx-charts/release/utils/id"; | 9 | import {id} from "@swimlane/ngx-charts/release/utils/id"; |
10 | 10 | ||
11 | @Injectable() | 11 | @Injectable() |
12 | export class RoadService extends StatementBaseService { | 12 | export class RoadService extends StatementBaseService { |
13 | - protected url: string = 'http://localhost:5000/road'; | ||
14 | - constructor(protected http: Http) { | ||
15 | - super(http); | ||
16 | - } | ||
17 | - public createModel(): Object { | ||
18 | - return new Road(); | ||
19 | - } | ||
20 | - public getRelation(id: number): Promise<any> { | ||
21 | - return this.http.get(this.url + '/relation?id=' + id, { headers: this.headers }) | ||
22 | - .toPromise() | ||
23 | - .then(x => this.decodeWays(x.json())) | ||
24 | - .catch(this.handleError); | ||
25 | - } | ||
26 | - protected parseModels(json: any): any[] { | ||
27 | - return json.roadEditDsM as Road[]; | ||
28 | - }; | ||
29 | - protected parseModel(json: any): any { | ||
30 | - return json as Road; | ||
31 | - }; | ||
32 | - protected decodeWays(json: Object[]): Way[] { | ||
33 | - let result: Way[] = []; | ||
34 | - json.forEach((way: Way) => { | ||
35 | - let nodes: Node[] = []; | ||
36 | - way.nodes.forEach((node: Node) => { | ||
37 | - let nodeObj: Node = new Node(); | ||
38 | - nodeObj.id = node.id; | ||
39 | - nodeObj.index = node.index; | ||
40 | - nodeObj.lat = node.lat; | ||
41 | - nodeObj.lon = node.lon; | ||
42 | - nodes.push(nodeObj); | ||
43 | - }); | ||
44 | - let wayObj: Way = new Way(); | ||
45 | - wayObj.id = way.id; | ||
46 | - wayObj.nodes = nodes; | ||
47 | - result.push(wayObj); | ||
48 | - }); | ||
49 | - return result; | ||
50 | - } | 13 | + protected url: string = 'http://localhost:5000/road'; |
14 | + | ||
15 | + constructor(protected http: Http) { | ||
16 | + super(http); | ||
17 | + } | ||
18 | + | ||
19 | + public createModel(): Object { | ||
20 | + return new Road(); | ||
21 | + } | ||
22 | + | ||
23 | + public getRelation(id: number): Promise<any> { | ||
24 | + return this.http.get(this.url + '/relation?id=' + id, {headers: this.headers}) | ||
25 | + .toPromise() | ||
26 | + .then(x => this.decodeWays(x.json())) | ||
27 | + .catch(this.handleError); | ||
28 | + } | ||
29 | + | ||
30 | + public getRoadByWay(id: number): Promise<any> { | ||
31 | + return this.http.get(this.url + '/roadbyway?id=' + id, {headers: this.headers}) | ||
32 | + .toPromise() | ||
33 | + .then(x => this.parseModel(x.json())) | ||
34 | + .catch(this.handleError); | ||
35 | + }; | ||
36 | + | ||
37 | + public getRoadByNode(id: number): Promise<any> { | ||
38 | + return this.http.get(this.url + '/roadbynode?id=' + id, {headers: this.headers}) | ||
39 | + .toPromise() | ||
40 | + .then(x => this.parseModel(x.json())) | ||
41 | + .catch(this.handleError); | ||
42 | + }; | ||
43 | + | ||
44 | + protected parseModels(json: any): any[] { | ||
45 | + return json.roadEditDsM as Road[]; | ||
46 | + }; | ||
47 | + | ||
48 | + protected parseModel(json: any): any { | ||
49 | + return json as Road; | ||
50 | + }; | ||
51 | + | ||
52 | + protected decodeWays(json: Object[]): Way[] { | ||
53 | + let result: Way[] = []; | ||
54 | + json.forEach((way: Way) => { | ||
55 | + let nodes: Node[] = []; | ||
56 | + way.nodes.forEach((node: Node) => { | ||
57 | + let nodeObj: Node = new Node(); | ||
58 | + nodeObj.id = node.id; | ||
59 | + nodeObj.index = node.index; | ||
60 | + nodeObj.lat = node.lat; | ||
61 | + nodeObj.lon = node.lon; | ||
62 | + nodes.push(nodeObj); | ||
63 | + }); | ||
64 | + let wayObj: Way = new Way(); | ||
65 | + wayObj.id = way.id; | ||
66 | + wayObj.nodes = nodes; | ||
67 | + result.push(wayObj); | ||
68 | + }); | ||
69 | + return result; | ||
70 | + } | ||
51 | } | 71 | } |
src/styles.scss
1 | // Custom style for loading elements without height | 1 | // Custom style for loading elements without height |
2 | .will-load { | 2 | .will-load { |
3 | - min-height: 80px; | 3 | + min-height: 80px; |
4 | } | 4 | } |
5 | 5 | ||
6 | // Href line height wasn't right for md-icon-button | 6 | // Href line height wasn't right for md-icon-button |
7 | a[md-icon-button] { | 7 | a[md-icon-button] { |
8 | - line-height: 36px; | 8 | + line-height: 36px; |
9 | } | 9 | } |
10 | 10 | ||
11 | // Capitalize | 11 | // Capitalize |
12 | .text-capital { | 12 | .text-capital { |
13 | - text-transform: capitalize; | 13 | + text-transform: capitalize; |
14 | } | 14 | } |
15 | 15 | ||
16 | .grid_containert { | 16 | .grid_containert { |
17 | - height: 100%; | 17 | + height: 100%; |
18 | } | 18 | } |
19 | 19 | ||
20 | .control_button { | 20 | .control_button { |
21 | - position: fixed; | ||
22 | - bottom: 40px; | ||
23 | - right: 40px; | ||
24 | - td-loading { | ||
25 | - width: 56px; | ||
26 | - height: 56px; | ||
27 | - float: left; | ||
28 | - margin-right: 20px; | ||
29 | - .td-loading-wrapper { | ||
30 | - margin-top: -10px; | ||
31 | - } | 21 | + position: fixed; |
22 | + bottom: 40px; | ||
23 | + right: 40px; | ||
24 | + td-loading { | ||
25 | + width: 56px; | ||
26 | + height: 56px; | ||
27 | + float: left; | ||
28 | + margin-right: 20px; | ||
29 | + .td-loading-wrapper { | ||
30 | + margin-top: -10px; | ||
32 | } | 31 | } |
32 | + } | ||
33 | } | 33 | } |
34 | 34 | ||
35 | .map-container { | 35 | .map-container { |
36 | - height: 400px; | ||
37 | - width: 400px; | 36 | + height: 400px; |
37 | + width: 400px; | ||
38 | } | 38 | } |
39 | 39 | ||
40 | #mapId { | 40 | #mapId { |
41 | - height: 400px; | ||
42 | - width: 400px; | 41 | + height: 400px; |
42 | + width: 400px; | ||
43 | } | 43 | } |
44 | 44 | ||
45 | -road-map>div { | ||
46 | - transition: height 1s ease-out; | 45 | +road-map > div { |
46 | + transition: height 1s ease-out; | ||
47 | +} | ||
48 | + | ||
49 | +.map-controls { | ||
50 | + z-index: 1500; | ||
51 | + position: absolute; | ||
52 | + right: 10px; | ||
53 | + top: 10px; | ||
54 | + padding: 10px; | ||
55 | + background: rgba(255,255,255,0.7); | ||
56 | + border-radius: 5px; | ||
57 | + md-icon { | ||
58 | + cursor: pointer; | ||
59 | + margin: 0 5px; | ||
60 | + } | ||
61 | +} | ||
62 | +.map-legend { | ||
63 | + z-index: 700; | ||
64 | + position: absolute; | ||
65 | + left: 60px; | ||
66 | + top: 10px; | ||
67 | + max-width: 300px; | ||
68 | + padding: 10px; | ||
69 | + background: rgba(255,255,255,0.7); | ||
70 | + border-radius: 5px; | ||
71 | + max-height: calc(100% - 50px); | ||
72 | + overflow-y: auto; | ||
73 | + td-expansion-panel { | ||
74 | + text-align: center; | ||
75 | + .expansion-header { | ||
76 | + width: 100%; | ||
77 | + } | ||
78 | + } | ||
79 | + .legend-summary { | ||
80 | + .expansion-header { | ||
81 | + text-align: center; | ||
82 | + font-size: 15px; | ||
83 | + margin: 5px 0; | ||
84 | + } | ||
85 | + } | ||
86 | + .legend-header { | ||
87 | + width: 100%; | ||
88 | + md-icon { | ||
89 | + float: right; | ||
90 | + cursor: pointer; | ||
91 | + } | ||
92 | + } | ||
47 | } | 93 | } |
48 | \ No newline at end of file | 94 | \ No newline at end of file |