Esempio n. 1
0
        public async void UpdateExtents(object sender, RoutedEventArgs e)
        {
            statusTextBlock.Text = "Updating Extents";

            QueryParameters queryParams = new QueryParameters();

            queryParams.WhereClause = "TaxID LIKE '" + _currTaxID + "'";

            FeatureQueryResult queryResult = await sfFeatTable.QueryFeaturesAsync(queryParams);

            List <Feature> features = queryResult.ToList();

            if (features.Any())
            {
                EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReference.Create(102715));

                foreach (Feature feature in features)
                {
                    envBuilder.UnionOf(feature.Geometry.Extent);
                    newFeatureLayer.ClearSelection();
                    newFeatureLayer.SelectFeature(feature);
                }

                await MyMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 20);

                statusTextBlock.Text = "";
            }

            else
            {
                statusTextBlock.Text = "No parcel found for current query";
            }
        }
Esempio n. 2
0
        // 관리번호로 해당Feature 객체찾기
        public async void SelectFct(string _FTR_CDE, string _FTR_IDN, FeatureLayer _featureLayer)
        {
            // 0.Feature 테이블 가져오기
            //FeatureLayer __featureLayer = _featureLayer.Clone() as FeatureLayer;
            FeatureTable _featureTable = _featureLayer.FeatureTable;



            // Create a query parameters that will be used to Query the feature table.
            QueryParameters queryParams = new QueryParameters();


            // Construct and assign the where clause that will be used to query the feature table.
            queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' ORDER BY FTR_IDN DESC";
            if (!FmsUtil.IsNull(_FTR_IDN))
            {
                queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' AND FTR_IDN like '%' ||  " + _FTR_IDN + " || '%'";
            }


            List <Feature> features;

            try
            {
                // Query the feature table.
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                features = queryResult.ToList();
            }
            catch (Exception e)
            {
                Messages.ShowErrMsgBox(e.Message);
                return;
            }

            if (features.Any())
            {
                // Create an envelope.
                EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);



                if (features.Count == 1)
                {
                    //한건인 경우 선택처리
                    ShowFctPage(features[0]);
                }
                else
                {
                    //피쳐영역 Extent 위치이동
                    foreach (Feature feature in features)
                    {
                        envBuilder.UnionOf(feature.Geometry.Extent); //복수의 피처영역 합치기
                    }
                    // Zoom to the extent of the selected feature(s).
                    await mapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
            }
        }
Esempio n. 3
0
        private async void ArtistListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Get the selected track info
            TrackInfo ti = ArtistListBox.SelectedItem as TrackInfo;

            // If the track info is good, show it in the info panel
            if (ti == null)
            {
                return;
            }
            ArtistInfoPanel.DataContext = ti;

            // Filter the layers by artist ID
            string artistFilter = "artistid = '" + ti.ArtistId + "'";

            _artistHometownLayer.DefinitionExpression = artistFilter;
            _listenerLayer.DefinitionExpression       = artistFilter;
            _otherLocationsLayer.DefinitionExpression = artistFilter;

            // Make sure all layers are visible except tours
            _artistHometownLayer.IsVisible = true;
            _listenerLayer.IsVisible       = true;
            _otherLocationsLayer.IsVisible = true;
            _tourLayer.IsVisible           = false;

            // Dismiss any tour event callouts
            ArtistMapView.DismissCallout();

            // Zoom the main map to the artist hometown
            await ArtistMapView.SetViewpointCenterAsync(ti.HometownLocation, 250000);

            // Zoom the listener map to the extent of features in the listener layer
            QueryParameters query = new QueryParameters
            {
                WhereClause = artistFilter
            };

            FeatureQueryResult listenerQueryResult = await _listenerLayer.FeatureTable.QueryFeaturesAsync(query);

            EnvelopeBuilder extentBuilder = new EnvelopeBuilder(ListenersMapView.SpatialReference);

            foreach (Feature f in listenerQueryResult)
            {
                extentBuilder.UnionOf(f.Geometry.Extent);
            }

            Envelope extent = extentBuilder.ToGeometry();

            if (extent.IsEmpty)
            {
                return;
            }

            await ListenersMapView.SetViewpointGeometryAsync(extentBuilder.ToGeometry(), 30);
        }
        private async Task QueryStateFeature(string stateName)
        {
            // Create dialog to display alert information
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            try
            {
                // Create a query parameters that will be used to Query the feature table
                QueryParameters queryParams = new QueryParameters
                {
                    // Construct and assign the where clause that will be used to query the feature table
                    WhereClause = "upper(STATE_NAME) LIKE '%" + stateName.Trim().ToUpper() + "%'"
                };

                // Query the feature table
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Create an envelope.
                    EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);

                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        // Add the extent of each matching feature to the envelope.
                        envBuilder.UnionOf(feature.Geometry.Extent);

                        // Select each feature.
                        _featureLayer.SelectFeature(feature);
                    }

                    // Zoom to the extent of the selected feature(s).
                    await _myMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
                else
                {
                    alert.SetTitle("State Not Found!");
                    alert.SetMessage("Add a valid state name.");
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                alert.SetTitle("Sample Error");
                alert.SetMessage(ex.Message);
                alert.Show();
            }
        }
        private async Task QueryStateFeature(string stateName)
        {
            try
            {
                // Hide keyboard.
                _queryTextView.ResignFirstResponder();

                // Create a query parameters that will be used to Query the feature table.
                QueryParameters queryParams = new QueryParameters();

                // Trim whitespace on the state name to prevent broken queries.
                string formattedStateName = stateName.Trim().ToUpper();

                // Construct and assign the where clause that will be used to query the feature table.
                queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

                // Query the feature table.
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Create an envelope.
                    EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);

                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        // Add the extent of each matching feature to the envelope.
                        envBuilder.UnionOf(feature.Geometry.Extent);

                        // Select each feature.
                        _featureLayer.SelectFeature(feature);
                    }

                    // Zoom to the extent of the selected feature(s).
                    await _myMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
                else
                {
                    UIAlertView alert = new UIAlertView("State Not Found!", "Add a valid state name.", (IUIAlertViewDelegate)null, "OK", null);
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                UIAlertView alert = new UIAlertView("Sample error", ex.ToString(), (IUIAlertViewDelegate)null, "OK", null);
                alert.Show();
            }
        }
Esempio n. 6
0
        private async Task QueryStateFeature(string stateName)
        {
            try
            {
                // Create a query parameters that will be used to Query the feature table
                QueryParameters queryParams = new QueryParameters();

                // Trim whitespace on the state name to prevent broken queries
                string formattedStateName = stateName.Trim().ToUpper();

                // Construct and assign the where clause that will be used to query the feature table
                queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

                // Query the feature table
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Create an envelope.
                    EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);

                    foreach (Feature feature in features)
                    {
                        // Add the extent of each matching feature to the envelope.
                        envBuilder.UnionOf(feature.Geometry.Extent);

                        // Select each feature.
                        _featureLayer.SelectFeature(feature);
                    }

                    // Zoom to the extent of the selected feature(s).
                    await MyMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
                else
                {
                    MessageDialog message = new MessageDialog("State Not Found!", "Add a valid state name.");
                    await message.ShowAsync();
                }
            }
            catch (Exception ex)
            {
                MessageDialog message = new MessageDialog("Sample error: " + ex, "An error occurred");
                await message.ShowAsync();
            }
        }
Esempio n. 7
0
        private Geometry GetExtentOfGraphicsOverlay(GraphicsOverlay inputGraphicsOverlay, double expansionFactor, SpatialReference spatialReferenceType)
        {
            // Get all of the graphics contained in the graphics overlay.
            GraphicCollection inputGraphicCollection = inputGraphicsOverlay.Graphics;

            // Create a new envelope builder using the same spatial reference as the graphics.
            EnvelopeBuilder unionEnvelopeBuilder = new EnvelopeBuilder(spatialReferenceType);

            // Loop through each graphic in the graphic collection.
            foreach (Graphic oneGraphic in inputGraphicCollection)
            {
                // Union the extent of each graphic in the envelope builder.
                unionEnvelopeBuilder.UnionOf(oneGraphic.Geometry.Extent);
            }

            // Expand the envelope builder by the expansion factor.
            unionEnvelopeBuilder.Expand(expansionFactor);

            // Return the unioned extent plus the expansion factor.
            return(unionEnvelopeBuilder.Extent);
        }
        private void SetExtent()
        {
            // Get all of the graphics contained in the graphics overlay
            GraphicCollection myGraphicCollection = _overlay.Graphics;

            // Create a new envelope builder using the same spatial reference as the graphics
            EnvelopeBuilder myEnvelopeBuilder = new EnvelopeBuilder(SpatialReferences.Wgs84);

            // Loop through each graphic in the graphic collection
            foreach (Graphic oneGraphic in myGraphicCollection)
            {
                // Union the extent of each graphic in the envelope builder
                myEnvelopeBuilder.UnionOf(oneGraphic.Geometry.Extent);
            }

            // Expand the envelope builder by 30%
            myEnvelopeBuilder.Expand(1.3);

            // Adjust the viewable area of the map to encompass all of the graphics in the
            // graphics overlay plus an extra 30% margin for better viewing
            _myMapView.SetViewpointAsync(new Viewpoint(myEnvelopeBuilder.Extent));
        }