Exemple #1
0
        private void ShowProjectedExtent(Map thisMap)
        {
            if (thisMap != null)
            {
                System.Console.WriteLine("Current extent {0}", thisMap.Extent);
            }

            if (_xmlConfiguation.OutputSpatialReference == null || thisMap == null)
            {
                return;
            }

            // if we are in Web Mercator, project the extent back into the output spatial reference.
            //
            // This is for debugging only.

            GeometryService geometryServiceProject = new GeometryService(_xmlConfiguation.GeometryServerUrl);

            if (geometryServiceProject == null)
            {
                return;
            }

            geometryServiceProject.ProjectCompleted += GeometryService_CalculateOutputCoords;
            geometryServiceProject.Failed           += GeometryService_FailedWebMercatorScale;
            geometryServiceProject.CancelAsync();

            var graphicList = new List <Graphic>();

            double   x          = thisMap.Extent.XMin;
            double   y          = thisMap.Extent.YMin;
            MapPoint minPoint   = new MapPoint(x, y, ParcelMap.SpatialReference);
            Graphic  minGraphic = new Graphic();

            minGraphic.Symbol   = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
            minGraphic.Geometry = minPoint;
            graphicList.Add(minGraphic);

            x = thisMap.Extent.XMax;
            y = thisMap.Extent.YMax;
            MapPoint maxPoint   = new MapPoint(x, y, ParcelMap.SpatialReference);
            Graphic  maxGraphic = new Graphic();

            maxGraphic.Symbol   = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
            maxGraphic.Geometry = maxPoint;
            graphicList.Add(maxGraphic);

            if (_xmlConfiguation.HasDatumTransformation)
            {
                DatumTransform transformation = new DatumTransform();
                if (_xmlConfiguation.DatumTransformationWKID > 0)
                {
                    transformation.WKID = _xmlConfiguation.DatumTransformationWKID;
                }
                else
                {
                    transformation.WKT = _xmlConfiguation.DatumTransformationWKT;
                }

                geometryServiceProject.ProjectAsync(graphicList, _xmlConfiguation.OutputSpatialReference,
                                                    transformation, _xmlConfiguation.DatumTransformationForward);
            }
            else
            {
                geometryServiceProject.ProjectAsync(graphicList, _xmlConfiguation.OutputSpatialReference);
            }
        }
Exemple #2
0
        private void ShowProjectedExtent(Map thisMap)
        {
            if (thisMap != null)
            System.Console.WriteLine("Current extent {0}", thisMap.Extent);

              if (_xmlConfiguation.OutputSpatialReference == null || thisMap == null)
              return;

              // if we are in Web Mercator, project the extent back into the output spatial reference.
              //
              // This is for debugging only.

              GeometryService geometryServiceProject = new GeometryService(_xmlConfiguation.GeometryServerUrl);
              if (geometryServiceProject == null)
            return;

              geometryServiceProject.ProjectCompleted += GeometryService_CalculateOutputCoords;
              geometryServiceProject.Failed += GeometryService_FailedWebMercatorScale;
              geometryServiceProject.CancelAsync();

              var graphicList = new List<Graphic>();

              double x = thisMap.Extent.XMin;
              double y = thisMap.Extent.YMin;
              MapPoint minPoint = new MapPoint(x, y, ParcelMap.SpatialReference);
              Graphic minGraphic = new Graphic();
              minGraphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
              minGraphic.Geometry = minPoint;
              graphicList.Add(minGraphic);

              x = thisMap.Extent.XMax;
              y = thisMap.Extent.YMax;
              MapPoint maxPoint = new MapPoint(x, y, ParcelMap.SpatialReference);
              Graphic maxGraphic = new Graphic();
              maxGraphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
              maxGraphic.Geometry = maxPoint;
              graphicList.Add(maxGraphic);

              if (_xmlConfiguation.HasDatumTransformation)
              {
            DatumTransform transformation = new DatumTransform();
            if (_xmlConfiguation.DatumTransformationWKID > 0)
              transformation.WKID = _xmlConfiguation.DatumTransformationWKID;
            else
              transformation.WKT = _xmlConfiguation.DatumTransformationWKT;

            geometryServiceProject.ProjectAsync(graphicList, _xmlConfiguation.OutputSpatialReference,
              transformation, _xmlConfiguation.DatumTransformationForward);
              }
              else
            geometryServiceProject.ProjectAsync(graphicList, _xmlConfiguation.OutputSpatialReference);
        }