소스 검색

Formulaire de création d'une nouvelle rando.

Jeje 6 년 전
부모
커밋
608650c62e

+ 0 - 4
src/app/dialog/dialog.component.html

@@ -1,9 +1,5 @@
 
 <mat-card class="card1">
-  <mat-card-header>
-    <mat-card-title><h1>Dialog Demo</h1></mat-card-title>
-  </mat-card-header>
-  <hr>
   <mat-card-content>
     <button mat-raised-button (click)="openDialog()">Open Dialog</button>
     <hr>

+ 2 - 4
src/app/my-dialog/my-dialog.component.html

@@ -1,11 +1,9 @@
 <div>
-  <h2 md-dialog-title>MY DIALOG</h2>
+  <h2 md-dialog-title>Add new trace!</h2>
   <hr>
   <mat-dialog-content>
-    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam maxime cum dolorem officiis assumenda rem alias, omnis nobis nam. Ratione soluta libero architecto cupiditate at fugit consectetur sit dignissimos vitae.
-    <br>
-    <br>
     <strong>{{data}}</strong>
+    <app-vtt-form-new-trace></app-vtt-form-new-trace>
   </mat-dialog-content>
   <hr>
   <mat-dialog-actions>

+ 65 - 73
src/app/vtt-trace/vtt-trace/vtt-trace.component.html

@@ -1,87 +1,79 @@
-<div style="min-height: 1000px;">
-  <p  style="height: 100%;">
-    Coming soon: my GPS traces referenced on a map.
-  </p>
-  <div class="row">
-    <form class="col">
 
-      <button type="button"
-              class="btn btn-primary"
-              (click)="addMarker()">Add Marker</button>
+<mat-card class="card1">
+  <mat-card-header>
+    <mat-card-title><h1>My GPS traces referenced on a map.</h1></mat-card-title>
+  </mat-card-header>
+  <hr>
+  <mat-card-content>
+    <div style="min-height: 1000px;">
+      <app-dialog></app-dialog>
+      <div leaflet
+           style="height: 500px;"
+           [leafletOptions]="options"
+           [leafletLayers]="layers"
+           [leafletZoom]="zoom"
+           [leafletCenter]="center"
+           [leafletLayersControl]="layersControl"
+           [leafletLayersControlOptions]="layersControlOptions">
 
-      <!--button type="button"
-              class="btn btn-primary"
-              (click)="removeMarker()">Remove Marker</button-->
+      </div>
+      <div class="row">
 
-    </form>
-  </div>
-  <div leaflet
-       style="height: 500px;"
-       [leafletOptions]="options"
-       [leafletLayers]="layers"
-       [leafletZoom]="zoom"
-       [leafletCenter]="center"
-       [leafletLayersControl]="layersControl"
-       [leafletLayersControlOptions]="layersControlOptions">
+        <!-- Control Form -->
+        <div class="col-sm-12 col-md-6 col-lg-4">
+          angular  data refresh event
+          <form>
 
-  </div>
+            <div class="form-group">
+              <label class="col-form-label">Options:</label>
+              <small class="form-text">{{ optionsSpec | json }}</small>
+            </div>
 
+            <!-- Zoom Levels -->
+            <div class="form-group row">
+              <div class="col-4">
+                <label class="col-form-label float-right">
+                  Zoom
+                </label>
+              </div>
+              <div class="col">
+                <select class="form-control" name="zoom" [(ngModel)]="zoom" required>
+                  <option *ngFor="let z of zoomLevels" [value]="z">{{z}}</option>
+                </select>
+              </div>
 
-  <div class="row">
+              <div class="col-4">
+                <label class="col-form-label float-right">
+                  Latitude
+                </label>
+              </div>
+              <div class="col">
+                <input type="text" class="form-control" name="latitude" [(ngModel)]="latitude" required>
+              </div>
+            </div>
+            <div class="form-group row">
+              <div class="col-4">
+                <label class="col-form-label float-right">
+                  Longitude
+                </label>
+              </div>
+              <div class="col">
+                <input type="text" class="form-control" name="longitude" [(ngModel)]="longitude" required>
+              </div>
+            </div>
 
-    <!-- Control Form -->
-    <div class="col-sm-12 col-md-6 col-lg-4">
-angular  data refresh event
-      <form>
+            <button type="button"
+                    class="btn btn-primary float-right"
+                    (click)="onApply()">Apply</button>
 
-        <div class="form-group">
-          <label class="col-form-label">Options:</label>
-          <small class="form-text">{{ optionsSpec | json }}</small>
+          </form>
+          {{zoom}}
         </div>
 
-        <!-- Zoom Levels -->
-        <div class="form-group row">
-          <div class="col-4">
-            <label class="col-form-label float-right">
-              Zoom
-            </label>
-          </div>
-          <div class="col">
-            <select class="form-control" name="zoom" [(ngModel)]="zoom" required>
-              <option *ngFor="let z of zoomLevels" [value]="z">{{z}}</option>
-            </select>
-          </div>
-
-          <div class="col-4">
-            <label class="col-form-label float-right">
-              Latitude
-            </label>
-          </div>
-          <div class="col">
-            <input type="text" class="form-control" name="latitude" [(ngModel)]="latitude" required>
-          </div>
-        </div>
-        <div class="form-group row">
-          <div class="col-4">
-            <label class="col-form-label float-right">
-              Longitude
-            </label>
-          </div>
-          <div class="col">
-            <input type="text" class="form-control" name="longitude" [(ngModel)]="longitude" required>
-          </div>
-        </div>
-
-        <button type="button"
-                class="btn btn-primary float-right"
-                (click)="onApply()">Apply</button>
-
-      </form>
-      {{zoom}}
+      </div>
     </div>
 
-    <app-dialog></app-dialog>
+  </mat-card-content>
+</mat-card>
 
-  </div>
-</div>
 

+ 26 - 87
src/app/vtt-trace/vtt-trace/vtt-trace.component.ts

@@ -132,12 +132,6 @@ export class VttTraceComponent implements OnInit {
     this.addRoute6();
   }
 
-  resetLayers () {
-    console.log('Resetting layers');
-    // console.log(`Here\'s the counter: ${this.counter}`);
-    this.layers = [];
-  }
-
   private getMarkersObs() {
     this.vttTraceWs.gettVttRandosDescFromServerObs()
       .subscribe((response: Array<string>) => {
@@ -171,17 +165,6 @@ export class VttTraceComponent implements OnInit {
     this.layers.push(newMarker);
   }
 
-  zoomAndCenter(latitude, longitude) {
-    const window: Window = self;
-    // console.log('parent' + this);
-
-    this.zoom = 15;
-    console.log(this.zoom);
-    this.center = latLng(this.latitude, this.longitude);
-    // this.options.center = e.latlng;
-    // console.log(this.center);
-  }
-
   markerOnClick(e) {
     console.log(e.sourceTarget._latlng);
     const attributes = e.sourceTarget.options;
@@ -189,93 +172,43 @@ export class VttTraceComponent implements OnInit {
     // do some stuff…
     // this.addTrace('' + attributes.title);
     console.log(attributes);
-    this.centerAndZoom(e.sourceTarget._latlng.lat, e.sourceTarget._latlng.lng, 9);
-    this.zoom = 9;
-    this.latitude = e.sourceTarget._latlng.lat;
-    this.longitude = e.sourceTarget._latlng.lng;
     this.onApply();
-    this.resetLayers();
-    // How to refresh automaticaly the map???
-    // this._onResize();
-    // this.geoJSON.layer.addEventParent(geoJSON.);
-
-    this.vttTraceWs.getTraceFromFile(attributes.title)
-      .subscribe(data => {
-        // console.log(data);
-        const featureCollection: GeoJSON.FeatureCollection<Point | LineString | MultiLineString> = data;
-        // const g = featureCollection.features[0].geometry.coordinates;
-        // console.log(featureCollection.features[0].geometry.coordinates[0]);
-        // this.layers.push(polyline(GeoJSON.coordsToLatLngs(g, 1)));
-        // this.geoJSON.layer.addLayer(polyline(GeoJSON.coordsToLatLngs(g, 1))) ;
-        console.log(this.geoJSON.layer.addData(featureCollection.features[0].geometry));
-        /*this.geoJSON.layer = geoJSON(
-            featureCollection.features[0].geometry as any,
-            { style: () => ({ color: '#ff7800' })});*/
 
+    this.addTrace(attributes.title);
+    this.centerAndZoom(e.sourceTarget._latlng.lat, e.sourceTarget._latlng.lng, 9);
 
-        // this.geoJSON.layer = new Layer(polyline(GeoJSON.coordsToLatLngs(g, 1)));
-        // console.log(this.geoJSON.layer.options);
-      });
-    return false;
+    return true;
   }
 
+  /**
+   * ajout d'une trace à la map, dans le tableau de layers
+   *
+   * TODO: reset layer fonctionne mais doit imérativement avoir réussi à charger la trace demandée avant de tout éffacer
+   * autrement la carte se retrouve vide this.resetLayers();
+   * How to refresh automaticaly the map???
+   * this._onResize();
+   * this.geoJSON.layer.addEventParent(geoJSON.);
+   * @param {string} fileName
+   * @returns {boolean}
+   */
   addTrace(fileName: string) {
+
     this.vttTraceWs.getTraceFromFile(fileName)
       .subscribe(data => {
-        console.log(data);
         const featureCollection: GeoJSON.FeatureCollection<Point | LineString | MultiLineString> = data;
-        const g = featureCollection.features[0].geometry.coordinates;
-        console.log(featureCollection.features[0].geometry.coordinates[0]);
-        this.layers.push(polyline(GeoJSON.coordsToLatLngs(g, 1)));
+        console.log(this.geoJSON.layer.addData(featureCollection.features[0].geometry));
       });
-    return false;
+    return true;
   }
 
   centerAndZoom(lat, lng, zoom) {
     this.zoom = zoom;
     this.center = latLng(lat, lng);
+    this.zoom = 9;
+    this.latitude = lat;
+    this.longitude = lng;
 
     return false;
-
-  }
-
-  addRoute() {
-    // create a red polyline from an array of LatLng points
-    const route = polyline(this.vttTraceWs.getMockRoute1());
-    this.layers.push(route);
-  }
-
-  addRoute2() {
-    this.layers.push(polyline(this.vttTraceWs.getMockRoute2()));
-  }
-
-  addRoute3() {
-    this.layers.push(polyline(this.vttTraceWs.getMockRoute3()));
-  }
-
-  addRoute4() {
-    this.vttTraceWs.getMockRoute4()
-      .subscribe(data => {
-        console.log(data);
-        const featureCollection: GeoJSON.FeatureCollection<Point | LineString | MultiLineString> = data;
-        const g = featureCollection.features[1].geometry.coordinates;
-        //     console.log(g);
-        console.log(featureCollection.features[1].geometry.coordinates[0]);
-        //     // return featureCollection.features[0].geometry.coordinates[0];
-        //     resul =  GeoJSON.coordsToLatLngs(g, 0);
-        this.layers.push(polyline(GeoJSON.coordsToLatLngs(g, 0)));
-      });
-  }
-
-  addRoute5() {
-    this.vttTraceWs.getMockRoute5()
-      .subscribe(data => {
-        console.log(data);
-        const featureCollection: GeoJSON.FeatureCollection<Point | LineString | MultiLineString> = data;
-        const g = featureCollection.features[0].geometry.coordinates;
-        console.log(featureCollection.features[0].geometry.coordinates[0]);
-        this.layers.push(polyline(GeoJSON.coordsToLatLngs(g, 1)));
-      });
   }
 
   addRoute6() {
@@ -289,6 +222,12 @@ export class VttTraceComponent implements OnInit {
       });
   }
 
+  resetLayers () {
+    console.log('Resetting layers');
+    // console.log(`Here\'s the counter: ${this.counter}`);
+    this.layers = [];
+  }
+
 
   /*  private showRoute() {
         this.fitBounds(this.layers.getBounds(), {

+ 2 - 0
src/app/vtt-trace/vtt-trace/vtt-trace.formNewTraceComponent.ts

@@ -52,6 +52,8 @@ export class VttTraceFormNewTraceComponent {
           console.log(response);
         });
       });
+
+    return false;
   }
 }
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 5016 - 0
src/assets/2009-10-18_LigniereDeTouraine.json


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 4916 - 0
src/assets/2011-08-02-02_StGeniezdOltRandoVttFix.json


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 5016 - 0
src/assets/2012-04-30_StPaul.json


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 5016 - 0
src/assets/2015-05-05-Sanary-sur-Mer.json


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 4841 - 0
src/assets/2015-05-08-Sanary-sur-Mer_fix.json