在Angular 6/7中使用AGM显示多个多边形路径

时间:2019-03-18 07:26:30

标签: angular typescript google-maps angular6 angular-google-maps

我正在使用Angular Google Mapsagm-drawing-manager图形管理器 AGM-POLYGON

现在有两个问题,一个是无法在内部使用多个多边形

<agm-map [latitude]="latitude" [longitude]="longitude" [zoom]="zoom" class="cardMapH" #agmMap>
                        <agm-polygon [paths]="pathsOfPoly"></agm-polygon>
                        <agm-drawing-manager (polygonComplete)="polygonCreated($event)" [drawingControl]="managerOptions.drawingControl" [drawingControlOptions]="managerOptions.drawingControlOptions" [polygonOptions]='managerOptions.polygonOptions' [drawingMode]='managerOptions.drawingMode'>
                        </agm-drawing-manager>
                    </agm-map>

绘制多边形后没有得到坐标

请帮助我解决这些问题,在此先感谢

1 个答案:

答案 0 :(得分:0)

最后,我确实喜欢这样,并且对我有用

<mat-card class="cardMapHcard">
                    <!-- yes {{plraw}} -->
                    <agm-map [latitude]="latitude" [longitude]="longitude" [zoom]="zoom" class="cardMapH" #agmMap>
                        <agm-polygon [paths]="pathsOfPol" fillColor="#f44195" fillOpacity=".35" strokeColor="#f44195" *ngFor="let pathsOfPol of pathsOfPolyArr">
                            <!-- <agm-snazzy-info-window [maxWidth]="200" [closeWhenOthersOpen]="true">
                                <ng-template>
                                    My first Snazzy Info Window!
                                </ng-template>
                            </agm-snazzy-info-window> -->
                        </agm-polygon>
                        <agm-drawing-manager (overlayComplete)="overlayCreated($event)" (polygonComplete)="polygonCreated($event)" [drawingControl]="managerOptions.drawingControl" [drawingControlOptions]="managerOptions.drawingControlOptions" [polygonOptions]='managerOptions.polygonOptions' [drawingMode]='managerOptions.drawingMode'>
                        </agm-drawing-manager>
                    </agm-map>
                </mat-card>
            </mat-card-content>
        </mat-card>