Skip to content

Commit

Permalink
code improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Munkh-Altai Chuluunbaatar authored and Munkh-Altai Chuluunbaatar committed Jan 15, 2022
1 parent 2f6aa09 commit 6718ac5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion example/lib/main copy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';

@override
void initState() {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';


@override
void initState() {
Expand Down
16 changes: 6 additions & 10 deletions lib/layers/feature_layer.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:collection/collection.dart';
import 'package:latlong2/latlong.dart';
Expand All @@ -9,11 +8,8 @@ import 'package:tuple/tuple.dart';
import 'package:flutter_map_arcgis/utils/util.dart' as util;
import 'package:dio/dio.dart';
import 'dart:convert';

import 'dart:async';

//import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';

class FeatureLayer extends StatefulWidget {
final FeatureLayerOptions options;
final MapState map;
Expand Down Expand Up @@ -217,8 +213,8 @@ class _FeatureLayerState extends State<FeatureLayer> {
for (var i = 0; i < queue.length; i++) {
var coordsNew = _wrapCoords(queue[i]);

var Bounds = _CoordsToBounds(coordsNew);
requestFeatures(Bounds);
var bounds = coordsToBounds(coordsNew);
requestFeatures(bounds);
}
}
} else {
Expand All @@ -228,7 +224,7 @@ class _FeatureLayerState extends State<FeatureLayer> {
}
}

LatLngBounds _CoordsToBounds(Coords coords) {
LatLngBounds coordsToBounds(Coords coords) {
var map = widget.map;
var cellSize = 256.0;
var nwPoint = coords.multiplyBy(cellSize);
Expand Down Expand Up @@ -258,9 +254,9 @@ class _FeatureLayerState extends State<FeatureLayer> {
try {
String bounds_ = '"xmin":${bounds.southWest!.longitude},"ymin":${bounds.southWest!.latitude},"xmax":${bounds.northEast!.longitude},"ymax":${bounds.northEast?.latitude}';

String URL = '${widget.options.url}/query?f=json&geometry={"spatialReference":{"wkid":4326},${bounds_}}&maxRecordCountFactor=30&outFields=*&outSR=4326&resultType=tile&returnExceededLimitFeatures=false&spatialRel=esriSpatialRelIntersects&where=1=1&geometryType=esriGeometryEnvelope';
String url = '${widget.options.url}/query?f=json&geometry={"spatialReference":{"wkid":4326},$bounds_}&maxRecordCountFactor=30&outFields=*&outSR=4326&resultType=tile&returnExceededLimitFeatures=false&spatialRel=esriSpatialRelIntersects&where=1=1&geometryType=esriGeometryEnvelope';

Response response = await Dio().get(URL);
Response response = await Dio().get(url);

var features_ = <dynamic>[];

Expand Down Expand Up @@ -493,7 +489,7 @@ class PolygonEsri extends Polygon {
final double borderStrokeWidth;
final Color borderColor;
final bool isDotted;
final dynamic? attributes;
final dynamic attributes;
late final LatLngBounds boundingBox;

PolygonEsri({
Expand Down
1 change: 0 additions & 1 deletion lib/layers/feature_layer_options.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:math';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: flutter_map_arcgis
description: Arcgis plugin for flutter map. Features Support unique render, ontap event, ontap with atttributes, geometry types (point, polgyon)
version: 2.0.0
author: Khan Khulgun Team
homepage: https://github.com/khankhulgun/flutter_map_arcgis

environment:
Expand Down
1 change: 0 additions & 1 deletion test/flutter_map_arcgis_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_map_arcgis/flutter_map_arcgis.dart';

void main() {
const MethodChannel channel = MethodChannel('flutter_map_arcgis');
Expand Down

0 comments on commit 6718ac5

Please sign in to comment.