Пример #1
0
        /// <summary>
        /// Calls XAML Service
        ///     Initializes input parameters
        ///     Calls Asynch service
        /// </summary>
        /// <remarks>
        ///     Provides Viewport Area of Interest
        ///     Reduce factor is only used for levels 1-8
        /// </remarks>
        public void ShowLayersXAML()
        {
            // get list of checked layers
            List <string> layers = GetLayers();

            layerCnt = layers.Count;
            if (layers.Count > 0)
            {
                totalFeatures = 0;
                totalPoints   = 0;
                totalByteSize = 0;

                string queryType = null;
                string area      = null;
                double radius    = 0.0;
                double reduce    = 4000 - MainMap.ZoomLevel * 500;
                if (reduce < 0)
                {
                    reduce = 0;
                }

                queryType = "bbox";
                StringBuilder sb     = new StringBuilder();
                LocationRect  bounds = MainMap.BoundingRectangle;
                // check for hemisphere overrun
                if (WithinHemisphere(bounds.Southeast, bounds.Northwest))
                {
                    sb.Append(bounds.Southeast.Longitude + " ");
                    sb.Append(bounds.Southeast.Latitude + ",");
                    sb.Append(bounds.Northeast.Longitude + " ");
                    sb.Append(bounds.Northeast.Latitude + ",");
                    sb.Append(bounds.Northwest.Longitude + " ");
                    sb.Append(bounds.Northwest.Latitude + ",");
                    sb.Append(bounds.Southwest.Longitude + " ");
                    sb.Append(bounds.Southwest.Latitude + ",");
                    sb.Append(bounds.Southeast.Longitude + " ");
                    sb.Append(bounds.Southeast.Latitude);
                    area = sb.ToString();
                }
                if (area != null)
                {
                    // disable side menu and start load spinner until call returns
                    SidePanelBorder.IsHitTestVisible = false;
                    loaderStart();

                    foreach (string layer in layers)
                    {
                        XAMLClient svc = new XAMLClient("CustomBinding_IXAML");
                        svc.GetSQLDataXAMLCompleted += new EventHandler <GetSQLDataXAMLCompletedEventArgs>(XAMLService_GetSQLDataXAMLCompleted);
                        XAMLParameters parameters = new XAMLParameters();
                        parameters.table     = layer.Replace("layer", "").ToLower();
                        parameters.querytype = queryType;
                        parameters.reduce    = reduce;
                        parameters.radius    = radius;
                        parameters.points    = area;
                        svc.GetSQLDataXAMLAsync(parameters, layer);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Calls WKT Service 
        ///     Initializes input parameters
        ///     Calls Asynch service
        /// </summary>
        /// <remarks>
        /// Drawtools leaves the area of interest definition on MapLayer 'layerDraw'
        /// </remarks>
        public void ShowLayers()
        {
            // get list of checked layers
            List<string> layers = GetLayers();
            layerCnt = layers.Count;
            if (layers.Count > 0)
            {
                totalFeatures = 0;
                totalPoints = 0;
                totalByteSize = 0;

                string queryType = null;
                string area = null;
                double radius = 0.0;
                double reduce = 4000 - MainMap.ZoomLevel * 500;
                if (reduce < 0) reduce = 0;
                if ((bool)drawtools.Proximity.IsChecked)
                {
                    queryType = "buffer";
                    Ellipse pt = (Ellipse)layerDraw.FindName("Proximity");
                    if (pt != null && pt.Tag != null)
                    {
                        Location loc = MapLayer.GetPosition(pt);
                        //radius(meters) longitude,latitude
                        if (pt.Tag != null) radius = Double.Parse(pt.Tag.ToString());
                        else radius = 1.0;
                        area = loc.Longitude + " " + loc.Latitude;
                    }
                }
                else if ((bool)drawtools.PolyBuffer.IsChecked)
                {
                    queryType = "buffer";
                    //buffer width(meters)  lon,lat lon,lat ... lon,lat
                    MapPolyline poly = (MapPolyline)layerDraw.FindName("Buffer");
                    if (poly != null)
                    {
                        Slider s = (Slider)drawtools.FindName("BufferSlider");
                        radius = (s.Value * 1000);
                        StringBuilder sb = new StringBuilder();
                        bool first = true;
                        foreach (Location l in poly.Locations)
                        {
                            if (!first) sb.Append(",");
                            sb.Append(l.Longitude + " " + l.Latitude);
                            first = false;
                        }
                        area = sb.ToString();
                    }
                }
                else if ((bool)drawtools.AOI.IsChecked)
                {
                    queryType = "bbox";
                    StringBuilder sb = new StringBuilder();
                    MapPolygon drawrect = ((MapPolygon)layerDraw.FindName("AOI"));

                    if (drawrect != null)
                    {
                        // check for hemisphere overrun
                        if (validAOI(drawrect.Locations[0], drawrect.Locations[2]) && 
                            WithinHemisphere(drawrect.Locations[0], drawrect.Locations[2]))
                        {
                            foreach (Location l in drawrect.Locations)
                            {
                                sb.Append(l.Longitude + " " + l.Latitude + ",");
                            }
                            sb.Append(drawrect.Locations[0].Longitude + " " + drawrect.Locations[0].Latitude);
                            area = sb.ToString();
                        }
                        else
                        {
                            drawtools.draw = true;
                        }
                    }
                }
                else if ((bool)drawtools.Viewport.IsChecked)
                {
                    queryType = "bbox";
                    StringBuilder sb = new StringBuilder();
                    LocationRect bounds = MainMap.BoundingRectangle;
                    // check for hemisphere overrun
                    if (validAOI(bounds.Southeast, bounds.Northwest) && 
                        WithinHemisphere(bounds.Southeast, bounds.Northwest))
                    {
                        sb.Append(bounds.Southeast.Longitude + " ");
                        sb.Append(bounds.Southeast.Latitude + ",");
                        sb.Append(bounds.Northeast.Longitude + " ");
                        sb.Append(bounds.Northeast.Latitude + ",");
                        sb.Append(bounds.Northwest.Longitude + " ");
                        sb.Append(bounds.Northwest.Latitude + ",");
                        sb.Append(bounds.Southwest.Longitude + " ");
                        sb.Append(bounds.Southwest.Latitude + ",");
                        sb.Append(bounds.Southeast.Longitude + " ");
                        sb.Append(bounds.Southeast.Latitude);
                        area = sb.ToString();
                    }
                    else
                    {
                        drawtools.draw = true;
                    }
                }
                if (area != null)
                {
                    // disable side menu and start load spinner until call returns
                    SidePanelBorder.IsHitTestVisible = false;
                    loaderStart();

                    foreach (string layer in layers)
                    {
                        XAMLClient svc = new XAMLClient("CustomBinding_IXAML");
                        svc.GetSQLDataXAMLCompleted += new EventHandler<GetSQLDataXAMLCompletedEventArgs>(XAMLService_GetSQLDataXAMLCompleted);
                        XAMLParameters parameters = new XAMLParameters();
                        parameters.table = layer.Replace("layer", "").ToLower();
                        parameters.querytype = queryType;
                        parameters.reduce = reduce;
                        parameters.radius = radius;
                        parameters.points = area;
                        svc.GetSQLDataXAMLAsync(parameters,layer);
                    }
                }
            }
            else
            {
                drawtools.draw = true;
            }
        }
Пример #3
0
        /// <summary>
        /// Calls XAML Service 
        ///     Initializes input parameters
        ///     Calls Asynch service
        /// </summary>
        /// <remarks>
        ///     Provides Viewport Area of Interest 
        ///     Reduce factor is only used for levels 1-8
        /// </remarks>
        public void ShowLayersXAML()
        {
            // get list of checked layers
            List<string> layers = GetLayers();
            layerCnt = layers.Count;
            if (layers.Count > 0)
            {
                totalFeatures = 0;
                totalPoints = 0;
                totalByteSize = 0;

                string queryType = null;
                string area = null;
                double radius = 0.0;
                double reduce = 4000 - MainMap.ZoomLevel * 500;
                if (reduce < 0) reduce = 0;

                queryType = "bbox";
                StringBuilder sb = new StringBuilder();
                LocationRect bounds = MainMap.BoundingRectangle;
                // check for hemisphere overrun
                if (WithinHemisphere(bounds.Southeast, bounds.Northwest))
                {
                    sb.Append(bounds.Southeast.Longitude + " ");
                    sb.Append(bounds.Southeast.Latitude + ",");
                    sb.Append(bounds.Northeast.Longitude + " ");
                    sb.Append(bounds.Northeast.Latitude + ",");
                    sb.Append(bounds.Northwest.Longitude + " ");
                    sb.Append(bounds.Northwest.Latitude + ",");
                    sb.Append(bounds.Southwest.Longitude + " ");
                    sb.Append(bounds.Southwest.Latitude + ",");
                    sb.Append(bounds.Southeast.Longitude + " ");
                    sb.Append(bounds.Southeast.Latitude);
                    area = sb.ToString();
                }
                if (area != null)
                {
                    // disable side menu and start load spinner until call returns
                    SidePanelBorder.IsHitTestVisible = false;
                    loaderStart();

                    foreach (string layer in layers)
                    {
                        XAMLClient svc = new XAMLClient("CustomBinding_IXAML");
                        svc.GetSQLDataXAMLCompleted += new EventHandler<GetSQLDataXAMLCompletedEventArgs>(XAMLService_GetSQLDataXAMLCompleted);
                        XAMLParameters parameters = new XAMLParameters();
                        parameters.table = layer.Replace("layer", "").ToLower();
                        parameters.querytype = queryType;
                        parameters.reduce = reduce;
                        parameters.radius = radius;
                        parameters.points = area;
                        svc.GetSQLDataXAMLAsync(parameters,layer);
                    }
                }
            }

        }