private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
              graphicsLayer.ClearGraphics();

              e.MapPoint.SpatialReference = MyMap.SpatialReference;
              Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
              {
            Geometry = e.MapPoint,
            Symbol = LayoutRoot.Resources["DefaultClickSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
              };
              graphic.SetZIndex(1);
              graphicsLayer.Graphics.Add(graphic);

              GeometryService geometryService =
            new GeometryService("http://serverapps101.esri.com/arcgis/rest/services/Geometry/GeometryServer");
              geometryService.BufferCompleted += GeometryService_BufferCompleted;
              geometryService.Failed += GeometryService_Failed;

              // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
              BufferParameters bufferParams = new BufferParameters()
              {
            Unit = chkGeodesic.IsChecked.HasValue && chkGeodesic.IsChecked.Value ? LinearUnit.StatuteMile : (LinearUnit?)null,
            BufferSpatialReference = new SpatialReference(4326),
            OutSpatialReference = MyMap.SpatialReference
              };
              bufferParams.Features.Add(graphic);
              bufferParams.Distances.Add(5);
              bufferParams.Geodesic = chkGeodesic.IsChecked == true ? true : false;

              geometryService.BufferAsync(bufferParams);
        }
        void myDrawObject_DrawComplete(object sender, DrawEventArgs e)
        {
            myDrawObject.IsEnabled = false;
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.ClearGraphics();

            Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = e.Geometry,
                Symbol   = LayoutRoot.Resources["DefaultClickSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
            };

            graphic.SetZIndex(1);
            graphicsLayer.Graphics.Add(graphic);

            GeometryService geometryService =
                new GeometryService("http://serverapps101.esri.com/arcgis/rest/services/Geometry/GeometryServer");

            geometryService.BufferCompleted += GeometryService_BufferCompleted;
            geometryService.Failed          += GeometryService_Failed;

            BufferParameters bufferParams = new BufferParameters()
            {
                Unit = LinearUnit.StatuteMile,
                OutSpatialReference = MyMap.SpatialReference,
                Geodesic            = true
            };

            bufferParams.Features.Add(graphic);
            bufferParams.Distances.Add(5);

            geometryService.BufferAsync(bufferParams);
        }
        void myDrawObject_DrawComplete(object sender, DrawEventArgs e)
        {
            myDrawObject.IsEnabled = false;
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.ClearGraphics();

            Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = e.Geometry,
                Symbol = LayoutRoot.Resources["DefaultClickSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
            };
            graphic.SetZIndex(1);
            graphicsLayer.Graphics.Add(graphic);

            GeometryService geometryService =
              new GeometryService("http://serverapps101.esri.com/arcgis/rest/services/Geometry/GeometryServer");
            geometryService.BufferCompleted += GeometryService_BufferCompleted;
            geometryService.Failed += GeometryService_Failed;

            BufferParameters bufferParams = new BufferParameters()
            {
                Unit = LinearUnit.StatuteMile,
                OutSpatialReference = MyMap.SpatialReference,
                Geodesic = true
            };
            bufferParams.Features.Add(graphic);
            bufferParams.Distances.Add(5);

            geometryService.BufferAsync(bufferParams);
        }
Esempio n. 4
0
        public static IGeometry BufferOffsetCurveWithParams(IGeometry g, Double?distance,
                                                            int?quadrantSegments, int?capStyle, int?joinStyle,
                                                            Double?mitreLimit)
        {
            double dist = 0;

            if (distance != null)
            {
                dist = distance.Value;
            }

            var bufParams = new BufferParameters();

            if (quadrantSegments != null)
            {
                bufParams.QuadrantSegments = quadrantSegments.Value;
            }
            if (capStyle != null)
            {
                bufParams.EndCapStyle = (EndCapStyle)capStyle.Value;
            }
            if (joinStyle != null)
            {
                bufParams.JoinStyle = (JoinStyle)joinStyle.Value;
            }
            if (mitreLimit != null)
            {
                bufParams.MitreLimit = mitreLimit.Value;
            }

            return(BuildCurveSet(g, dist, bufParams));
        }
Esempio n. 5
0
        private void AddBufferedPoint()
        {
            GraphicsLayer graphicsLayer = myMap.Layers["zoneLayer"] as GraphicsLayer;

            rightClickedPoint.SpatialReference = myMap.SpatialReference;
            Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = rightClickedPoint,
                Symbol   = SimplePointSymbol
            };

            graphic.SetZIndex(1);
            graphicsLayer.Graphics.Add(graphic);

            GeometryService geometryService =
                new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

            geometryService.BufferCompleted += GeometryService_BufferCompleted;
            geometryService.Failed          += GeometryService_Failed;

            // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
            BufferParameters bufferParams = new BufferParameters()
            {
                Unit = selectedUnit,
                BufferSpatialReference = new SpatialReference(4326),
                OutSpatialReference    = myMap.SpatialReference
            };

            bufferParams.Features.Add(graphic);
            bufferParams.Distances.Add(selectedRadius);

            geometryService.BufferAsync(bufferParams);
        }
Esempio n. 6
0
        public void ProcessBuffer()   // 传入空间对象进行buffer计算,
        {
            try
            {
                _geometryService.CancelAsync();

                Graphic TempGraphic = new Graphic();
                TempGraphic.Geometry = bgeom;
                TempGraphic.Geometry.SpatialReference = new SpatialReference(4326);

                BufferParameters bufferParams = new BufferParameters()
                {
                    BufferSpatialReference = new SpatialReference(102113),
                    OutSpatialReference    = new SpatialReference(4326),
                    Unit = LinearUnit.Meter
                };
                //       double degree = Distance / (106 * 1000);
                //      bufferParams.Distances.AddRange(new double[] { degree  , degree   });
                bufferParams.Distances.Add(Distance);
                bufferParams.Features.Add(TempGraphic);
                _geometryService.BufferAsync(bufferParams);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Esempio n. 7
0
        public static int GetBufferParameteriv(BufferTarget target, BufferParameters pname)
        {
            int tmp = 0;

            Delegates.glGetBufferParameteriv(target, pname, ref tmp);
            return(tmp);
        }
        private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.ClearGraphics();

            e.MapPoint.SpatialReference = MyMap.SpatialReference;
            Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = e.MapPoint,
                Symbol   = LayoutRoot.Resources["DefaultClickSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
            };

            graphic.SetZIndex(1);
            graphicsLayer.Graphics.Add(graphic);

            GeometryService geometryService =
                new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

            geometryService.BufferCompleted += GeometryService_BufferCompleted;
            geometryService.Failed          += GeometryService_Failed;

            // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
            BufferParameters bufferParams = new BufferParameters()
            {
                Unit = LinearUnit.StatuteMile,
                BufferSpatialReference = new SpatialReference(4326),
                OutSpatialReference    = MyMap.SpatialReference
            };

            bufferParams.Features.Add(graphic);
            bufferParams.Distances.Add(5);

            geometryService.BufferAsync(bufferParams);
        }
Esempio n. 9
0
        public void Buffer3()
        {
            var geometry = reader.Read(
                @"LINESTRING(1250.7665 446.9385,1137.8786 170.4488,1136.3666106287267 
166.74557327980631,1139.485009866369 125.36515638486206,1137.8786 121.7019)");

            Assert.IsNotNull(geometry);
            Assert.IsTrue(geometry.IsValid);

            BufferParameters parameters = new BufferParameters()
            {
                EndCapStyle = EndCapStyle.Round
            };

            var curveBuilder = new OffsetCurveBuilder(
                geometry.PrecisionModel, parameters);
            var curveSetBuilder = new OffsetCurveSetBuilder(geometry, 5, curveBuilder);

            var bufferSegStrList = curveSetBuilder.GetCurves();

            Assert.AreEqual(1, bufferSegStrList.Count);

            var segmentString = (NodedSegmentString)bufferSegStrList[0];

            Assert.AreEqual(45, segmentString.Count);

            for (var i = 0; i < segmentString.Coordinates.Length; i++)
            {
                var coord = segmentString.Coordinates[i];
                Debug.WriteLine(String.Format("{1:R} {2:R}", i, coord.X, coord.Y));
            }
        }
Esempio n. 10
0
        public static int GetNamedBufferParameterivEXT(uint BufferID, BufferParameters pname)
        {
            int tmp = 0;

            Delegates.glGetNamedBufferParameterivEXT(BufferID, pname, ref tmp);
            return(tmp);
        }
Esempio n. 11
0
        public static IGeometry SingleSidedBuffer(IGeometry geom, double distance)
        {
            var bufParams = new BufferParameters {
                IsSingleSided = true
            };

            return(BufferOp.Buffer(geom, distance, bufParams));
        }
Esempio n. 12
0
        public static Geometry bufferMitredJoin(Geometry g, double distance)
        {
            var bufParams = new BufferParameters();

            bufParams.JoinStyle = JoinStyle.Mitre;

            return(BufferOp.Buffer(g, distance, bufParams));
        }
Esempio n. 13
0
        public static IGeometry LogoBuffer(IGeometry g, double distance)
        {
            var lines     = LogoLines(g);
            var bufParams = new BufferParameters();

            bufParams.EndCapStyle = EndCapStyle.Square;
            return(BufferOp.Buffer(lines, distance, bufParams));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CaiMCT.Clients.Portable.Geofence"/> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="location">Location.</param>
        /// <param name="meterRadius">Meter radius.</param>
        public Geofence(string name, Point location, double meterRadius)
        {
            Name = name;

            BufferParameters bufferParams = new BufferParameters(16, GeoAPI.Operation.Buffer.EndCapStyle.Round, GeoAPI.Operation.Buffer.JoinStyle.Round, meterRadius);
            Polygon          polygon      = (Polygon)location.Buffer(meterRadius * metersToBufferDistanceConversionFactor, bufferParams);

            Geometry = polygon;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CaiMCT.Clients.Portable.Geofence"/> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="coordinate">Coordinate.</param>
        /// <param name="meterRadius">Meter radius.</param>
        public Geofence(string name, GeoAPI.Geometries.Coordinate coordinate, double meterRadius)
        {
            Name = name;

            Point            point        = new Point(coordinate.X, coordinate.Y);
            BufferParameters bufferParams = new BufferParameters(16, GeoAPI.Operation.Buffer.EndCapStyle.Round, GeoAPI.Operation.Buffer.JoinStyle.Round, meterRadius);
            Polygon          polygon      = (Polygon)point.Buffer(meterRadius * metersToBufferDistanceConversionFactor, bufferParams);

            Geometry = polygon;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CaiMCT.Clients.Portable.Geofence"/> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="lineStringWellKnownText">Line string well known text.</param>
        /// <param name="bufferDistance">Buffer distance.</param>
        public Geofence(string name, string lineStringWellKnownText, double bufferDistance)
        {
            Name = name;

            WKTReader        reader           = new WKTReader();
            LineString       lineString       = (LineString)reader.Read(lineStringWellKnownText);
            BufferParameters bufferParameters = new BufferParameters(8, GeoAPI.Operation.Buffer.EndCapStyle.Round, GeoAPI.Operation.Buffer.JoinStyle.Round, 5);

            Geometry = (Polygon)lineString.Buffer(bufferDistance * metersToBufferDistanceConversionFactor, bufferParameters);
        }
Esempio n. 17
0
        public static IGeometry SingleSidedBufferCurve(IGeometry geom, double distance)
        {
            var bufParam = new BufferParameters();

            bufParam.IsSingleSided = true;
            var ocb = new OffsetCurveBuilder(
                geom.Factory.PrecisionModel, bufParam
                );
            var pts   = ocb.GetLineCurve(geom.Coordinates, distance);
            var curve = geom.Factory.CreateLineString(pts);

            return(curve);
        }
Esempio n. 18
0
        private void CreateBufferZone(double bufferDistance, Graphic graphic, string units)
        {
            if (geometryService != null)
            {
                int bufferSRWKID           = widgetConfig.ProjectToWKID;
                BufferParameters bufParams = new BufferParameters();
                bufParams.BufferSpatialReference = new SpatialReference((bufferSRWKID == 0) ? 102003 : bufferSRWKID);
                bufParams.OutSpatialReference    = new SpatialReference(this.MapSRWKID);
                bufParams.Distances.Add(bufferDistance);
                bufParams.UnionResults = true;

                // Make the geometry's Spatial Reference consistent with Map's
                // QueryTask returns 3857 instead of 102100 when BING layers are used in the base map
                graphic.Geometry.SpatialReference = new SpatialReference(this.MapSRWKID);

                if (RadioBufferCenter.IsChecked.Value && !(graphic.Geometry is MapPoint))
                {
                    MapPoint center = graphic.Geometry.Extent.GetCenter();
                    center.SpatialReference = new SpatialReference(this.MapSRWKID);
                    Graphic graphic1 = new Graphic();
                    graphic1.Geometry = center;

                    bufParams.Features.Add(graphic1);
                }
                else
                {
                    bufParams.Features.Add(graphic);
                }

                switch (units)
                {
                case "Feet": bufParams.Unit = LinearUnit.Foot; break;

                case "Yards": bufParams.Unit = LinearUnit.SurveyYard; break;

                case "Miles": bufParams.Unit = LinearUnit.StatuteMile; break;

                case "Meters": bufParams.Unit = LinearUnit.Meter; break;

                default: bufParams.Unit = LinearUnit.Foot; break;
                }

                geometryService.BufferAsync(bufParams);
            }
            else
            {
                MessageBox.Show("Geometry Service must be configurated to create a buffer zone.");
            }
        }
        // ***********************************************************************************
        // * ...Set the map mouseclick event so that user can enter the incident
        // ***********************************************************************************
        private void btnSolve_Click(object sender, RoutedEventArgs e)
        {
            // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
            _bufferParams      = new BufferParameters();
            _bufferParams.Unit = currentLinearUnit();
            _bufferParams.BufferSpatialReference = new SpatialReference(4326);
            _bufferParams.OutSpatialReference    = _mapWidget.Map.SpatialReference;

            _bufferParams.Features.Clear();
            if (_selectedRadioButtonName == "rbDrawPoints" || _selectedRadioButtonName == "rbSelectedFeaturesFromLayer")
            {
                _bufferParams.Features.AddRange(_bufferPointLayer.Graphics);
            }
            else if (_selectedRadioButtonName == "rbSelectedFeaturesOnMap")
            {
                _bufferPointLayer.ClearGraphics();

                IEnumerable <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                {
                    client.FeatureLayer featureL = _mapWidget.FindFeatureLayer(d);
                    if (featureL.SelectionCount > 0)
                    {
                        _bufferParams.Features.AddRange(featureL.SelectedGraphics);
                    }
                }
            }

            if (_bufferParams.Features.Count == 0)
            {
                MessageBox.Show("Please select features on the map first", "Error");
                return;
            }

            var bufferDistance = Convert.ToDouble(ringInterval.Text);
            var ringDistance   = bufferDistance;

            var numRings = Convert.ToInt32(numberOfRings.Text);

            for (var i = 0; i < numRings; i++)
            {
                _bufferParams.Distances.Add(ringDistance);
                ringDistance = ringDistance + bufferDistance;
            }

            _geometryService.BufferAsync(_bufferParams);
        }
Esempio n. 20
0
        private static Geometry BuildCurveSet(Geometry g, double dist, BufferParameters bufParams)
        {
            // --- now construct curve
            var ocb    = new OffsetCurveBuilder(g.Factory.PrecisionModel, bufParams);
            var ocsb   = new OffsetCurveSetBuilder(g, dist, ocb);
            var curves = ocsb.GetCurves();

            var lines = new List <Geometry>();

            foreach (var ss in curves)
            {
                var pts = ss.Coordinates;
                lines.Add(g.Factory.CreateLineString(pts));
            }
            var curve = g.Factory.BuildGeometry(lines);

            return(curve);
        }
Esempio n. 21
0
        public static Geometry BufferWithSimplify(Geometry g, double?distance,
                                                  double?simplifyFactor)
        {
            double dist = 0;

            if (distance != null)
            {
                dist = distance.Value;
            }

            var bufParams = new BufferParameters();

            if (simplifyFactor != null)
            {
                bufParams.SimplifyFactor = simplifyFactor.Value;
            }
            return(BufferOp.Buffer(g, dist, bufParams));
        }
Esempio n. 22
0
        public ManualObject CreateNode(string name, SceneManager sceneMgr, bool isClosed)
        {
            if (lineNode == null)
            {
                lineNode = sceneMgr.CreateManualObject(name);
                MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                                                        ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                material.GetTechnique(0).GetPass(0).VertexColourTracking =
                    (int)TrackVertexColourEnum.TVC_AMBIENT;

                int nSeg = 5; // Number of segments on the cap or join pieces
                BufferParameters param       = new BufferParameters(nSeg, BufferParameters.BufferEndCapStyle.CapRound, BufferParameters.BufferJoinStyle.JoinRound, 2);
                IGeometry        coordBuffer = line1.Buffer(0.5, param);

                Tesselate(coordBuffer.Coordinates);
            }
            return(lineNode);
        }
Esempio n. 23
0
        void drawBuffer_DrawComplete(object sender, DrawEventArgs e)
        {
            if (e.Geometry == null)
            {
                return;
            }

            Graphic graphic = new Graphic()
            {
                Geometry = e.Geometry, Symbol = activeSymbolBuffer
            };

            switch (e.Geometry.GetType().Name)
            {
            case "Polyline":    //根据画线类型,如果为line类型,则对line添加buffer
                BufferParameters bufferParams = new BufferParameters()
                {
                    BufferSpatialReference = new SpatialReference(102113), OutSpatialReference = new SpatialReference(4326), Unit = LinearUnit.Meter
                };
                bufferParams.Distances.Add(PublicParams.BufferRadius);
                bufferParams.Features.Add(graphic);
                GeoServHelper gshPolyline = new GeoServHelper();
                gshPolyline.geometryTask.BufferAsync(bufferParams);
                break;

            case "Polygon":
                this.Dispatcher.BeginInvoke(new Action(() => {
                    GeoServHelper gshPolygon = new GeoServHelper();
                    gshPolygon.ExecuteAsyncQueryForDrawing(e.Geometry, PublicParams.urlCamerasLayer);
                }));
                break;

            default:
                break;
            }
            MapLayers.AddGraphicToGLayerByLayerID(graphic, PublicParams.gLayerDrawing);

            MapMethods.SendGraphic(graphic);//同步画线到大屏
            drawBuffer.DrawMode = DrawMode.None;
            PublicParams.pubCanvasChild1.BeginStoryboard(App.Current.FindResource("StoryboardForPadCamerasOpen") as Storyboard);
            MapMethods.SendOpenPadVideos();//大屏同步弹出视频背景板
        }
Esempio n. 24
0
        public void BufferAroundLine()
        {
            var form = new Form {
                BackColor = Color.White, Size = new Size(500, 200)
            };

            form.Paint += delegate
            {
                Graphics g = form.CreateGraphics();

                List <Coordinate> vertices = new List <Coordinate>();

                vertices.Add(new Coordinate(0, 4));
                vertices.Add(new Coordinate(40, 15));
                vertices.Add(new Coordinate(50, 50));
                vertices.Add(new Coordinate(100, 62));
                vertices.Add(new Coordinate(240, 45));
                vertices.Add(new Coordinate(350, 5));

                IGeometry geometry = new LineString(vertices.ToArray());

                g.DrawLines(new Pen(Color.Blue, 1), GetPoints(geometry));

                BufferParameters bp = new BufferParameters
                {
                    QuadrantSegments = 6,
                    EndCapStyle      = EndCapStyle.Flat
                };

                IGeometry bufGeo = BufferOp.Buffer(geometry, 5d, bp);

                bufGeo = bufGeo.Union(geometry);
                g.FillPolygon(new SolidBrush(Color.Pink), GetPoints(bufGeo));
            };

            WindowsFormsTestHelper.ShowModal(form);
        }
        void buffer(string agsGeometryServerUrl, BufferParameters bufferParams, FindNearbyEventArgs findNearbyRequest)
        {
            if (string.IsNullOrEmpty(agsGeometryServerUrl))
            {
                return;
            }

            GeometryService geomService = new GeometryService
            {
                Url = agsGeometryServerUrl
            };

            geomService.BufferCompleted += GeometryService_BufferCompleted;
            geomService.Failed          += (o, e) =>
            {
                if (findNearbyToolWindow != null)
                {
                    findNearbyToolWindow.StopBusyIndicator();
                    MapApplication.Current.HideWindow(findNearbyToolWindow);
                }
                MessageBoxDialog.Show(Resources.Strings.MsgErrorExecutingBufferOperation + Environment.NewLine + e.Error.ToString());
            };
            geomService.BufferAsync(bufferParams, findNearbyRequest);
        }
Esempio n. 26
0
        private void RunButton_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_graphicsLayer != null)
                {
                    _graphicsLayer.Graphics.Clear();
                }
                // Find the map layer in the map widget that contains the data source.
                IEnumerable <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                {
                    if (_mapWidget != null && d.IsSelectable == true)
                    {
                        // Get the feature layer in the map for the data source.
                        client.FeatureLayer featureL = _mapWidget.FindFeatureLayer(d);

                        //Clear Selection on Feature Layers in map
                        featureL.ClearSelection();
                    }
                }
                if (txtAddress.Text == "Enter Address")
                {
                    int BuildingEvacDistance = 0;
                    int OutdoorEvacDistance  = 0;

                    if (bombType.Text == "Pipe bomb")
                    {
                        BuildingEvacDistance = 70;
                        OutdoorEvacDistance  = 1200;
                    }
                    else if (bombType.Text == "Suicide vest")
                    {
                        BuildingEvacDistance = 110;
                        OutdoorEvacDistance  = 1750;
                    }
                    else if (bombType.Text == "Briefcase/suitcase bomb")
                    {
                        BuildingEvacDistance = 150;
                        OutdoorEvacDistance  = 1850;
                    }
                    else if (bombType.Text == "Sedan")
                    {
                        BuildingEvacDistance = 320;
                        OutdoorEvacDistance  = 1900;
                    }
                    else if (bombType.Text == "SUV/van")
                    {
                        BuildingEvacDistance = 400;
                        OutdoorEvacDistance  = 2400;
                    }
                    else if (bombType.Text == "Small delivery truck")
                    {
                        BuildingEvacDistance = 640;
                        OutdoorEvacDistance  = 3800;
                    }
                    else if (bombType.Text == "Container/water truck")
                    {
                        BuildingEvacDistance = 860;
                        OutdoorEvacDistance  = 5100;
                    }
                    else if (bombType.Text == "Semi-trailer")
                    {
                        BuildingEvacDistance = 1570;
                        OutdoorEvacDistance  = 9300;
                    }
                    if (BuildingEvacDistance == 0 || OutdoorEvacDistance == 0)
                    {
                        return;
                    }



                    //e.MapPoint.SpatialReference = _mapWidget.Map.SpatialReference;
                    //location = e.MapPoint;
                    if (location == null)
                    {
                        return;
                    }
                    Graphic graphic = new ESRI.ArcGIS.Client.Graphic();
                    graphic.Geometry = location;

                    GeometryService geometryTask = new GeometryService();
                    geometryTask.Url              = _serviceURL;
                    geometryTask.BufferCompleted += GeometryService_BufferCompleted;
                    geometryTask.Failed          += GeometryService_Failed;

                    // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
                    BufferParameters bufferParams = new BufferParameters()
                    {
                        Unit = LinearUnit.SurveyFoot,
                        BufferSpatialReference = new SpatialReference(102004),
                        OutSpatialReference    = _mapWidget.Map.SpatialReference
                    };
                    bufferParams.Features.Add(graphic);
                    double[] theDistances = new double[] { BuildingEvacDistance, OutdoorEvacDistance };
                    bufferParams.Distances.AddRange(theDistances);
                    geometryTask.BufferAsync(bufferParams);
                }
                else
                {
                    findAddress();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error in run: " + ex.Message);
            }
        }
Esempio n. 27
0
 public static int GetBufferParameteriv(BufferTarget target, BufferParameters pname)
 {
     int tmp = 0;
     Delegates.glGetBufferParameteriv(target, pname, ref tmp);
     return tmp;
 }
Esempio n. 28
0
 public static void GetBufferParameteriv(BufferTarget target, BufferParameters pname, int[] @params)
 {
     Delegates.glGetBufferParameteriv(target, pname, ref @params[0]);
 }
Esempio n. 29
0
 public static void GetNamedBufferParameterivEXT(uint BufferID, BufferParameters pname, int[] @params)
 {
     Delegates.glGetNamedBufferParameterivEXT(BufferID, pname, ref @params[0]);
 }
Esempio n. 30
0
            private static unsafe void ProcessImpl(IntPtr thisObject,
                int inputProcessParameterCount, BufferParameters* pInputProcessParameters, int outputProcessParameterCount, BufferParameters* pOutputProcessParameters,
                int isEnabled)
            {
                var shadow = ToShadow<AudioProcessorShadow>(thisObject);
                var callback = (AudioProcessor)shadow.Callback;

                var inputProcessParameters = new BufferParameters[inputProcessParameterCount];
                for (int i = 0; i < inputProcessParameters.Length; i++)
                    inputProcessParameters[i] = pInputProcessParameters[i];

                var outputProcessParameters = new BufferParameters[outputProcessParameterCount];
                for (int i = 0; i < outputProcessParameters.Length; i++)
                    outputProcessParameters[i] = pOutputProcessParameters[i];

                //// NOTE: because XAudio currently support only 1 input and 1 output buffer at a time, don't waste our time
                //BufferParameters outputParameter = *pOutputProcessParameters;

                callback.Process(inputProcessParameters, outputProcessParameters, isEnabled == 1);

                //Update BufferParameters output (see doc for IXAPO::Process
                //ValidFrameCount must be fill by the Process method. Most of the time ValidFrameCount in input == ValidFrameCount in output (effectively written)
                for (int i = 0; i < outputProcessParameters.Length; i++)
                    pOutputProcessParameters[i].ValidFrameCount = outputProcessParameters[i].ValidFrameCount;
            }
Esempio n. 31
0
 public static void GetBufferParameteriv(BufferTarget target, BufferParameters pname, int[] @params)
 {
     Delegates.glGetBufferParameteriv(target, pname, ref @params[0]);
 }
 private void ZoomToBufferExtent(MapPoint point)
 {
     if (point == null) return;
     #region GeometryService - Zooms to search extent
     var geometryService = new GeometryService(GEOMETRY_URL);
     geometryService.BufferCompleted += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         MyMap.ZoomTo(Expand(e.Results.FirstOrDefault().Geometry.Extent));
     };
     geometryService.Failed += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         MessageBox.Show(string.Format("Get buffer for '{0}' failed with error '{1}'", point, e.Error.Message));
         ShowElement(MyMap);
     };
     MyProgressBar.IsIndeterminate = true;
     BufferParameters parameters = new BufferParameters()
     {
         Unit = LinearUnit.StatuteMile,
         BufferSpatialReference = new SpatialReference(4326),
         OutSpatialReference = MyMap.SpatialReference,
         Geodesic = true
     };
     parameters.Features.Add(new Graphic() { Geometry = point });
     parameters.Distances.Add(DISTANCE);
     geometryService.BufferAsync(parameters);
     #endregion
 }
 private BufferParameters CreateBufferParameters(SpatialReference spRef, double Distance, LinearUnit Unit)
 {
   BufferParameters bufferParameters = new BufferParameters()
   {
     Unit = Unit,
     BufferSpatialReference = spRef,
     OutSpatialReference = spRef,
     UnionResults = false, //We want a separate buffer for each SourceFeatures, so UnionResults = false
   };
   bufferParameters.Distances.AddRange(new List<double> { Distance });
   bufferParameters.Features.AddRange(SourceFeatures);
   return bufferParameters;
 }
Esempio n. 34
0
        public ManualObject CreateNode(string name, SceneManager sceneMgr, bool isClosed)
        {
            if (lineNode == null)
            {
                lineNode = sceneMgr.CreateManualObject(name);
                MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                         ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                material.GetTechnique(0).GetPass(0).VertexColourTracking =
                               (int)TrackVertexColourEnum.TVC_AMBIENT;

                int nSeg = 5; // Number of segments on the cap or join pieces
                BufferParameters param = new BufferParameters(nSeg, BufferParameters.BufferEndCapStyle.CapRound, BufferParameters.BufferJoinStyle.JoinRound, 2);
                IGeometry coordBuffer = line1.Buffer(0.5, param);

                Tesselate(coordBuffer.Coordinates);
            }
            return lineNode;
        }
        void locatorTask_AddressToLocationsCompleted(object sender, AddressToLocationsEventArgs e)
        {
            try
            {
                List<AddressCandidate> returnedCandidates = e.Results;
                int BuildingEvacDistance = 0;
                int OutdoorEvacDistance = 0;

                if (bombType.Text == "Pipe bomb")
                {
                    BuildingEvacDistance = 70;
                    OutdoorEvacDistance = 1200;
                }
                else if (bombType.Text == "Suicide vest")
                {
                    BuildingEvacDistance = 110;
                    OutdoorEvacDistance = 1750;
                }
                else if (bombType.Text == "Briefcase/suitcase bomb")
                {
                    BuildingEvacDistance = 150;
                    OutdoorEvacDistance = 1850;
                }
                else if (bombType.Text == "Sedan")
                {
                    BuildingEvacDistance = 320;
                    OutdoorEvacDistance = 1900;
                }
                else if (bombType.Text == "SUV/van")
                {
                    BuildingEvacDistance = 400;
                    OutdoorEvacDistance = 2400;
                }
                else if (bombType.Text == "Small delivery truck")
                {
                    BuildingEvacDistance = 640;
                    OutdoorEvacDistance = 3800;
                }
                else if (bombType.Text == "Container/water truck")
                {
                    BuildingEvacDistance = 860;
                    OutdoorEvacDistance = 5100;
                }
                else if (bombType.Text == "Semi-trailer")
                {
                    BuildingEvacDistance = 1570;
                    OutdoorEvacDistance = 9300;
                }

                if (BuildingEvacDistance == 0 || OutdoorEvacDistance == 0)
                    return;

                if (e.Results.Count > 0)
                {
                    AddressCandidate candidate = returnedCandidates[0];

                    ResourceDictionary mydictionary = new ResourceDictionary();
                    mydictionary.Source = new Uri("/BombThreatAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);
                    Graphic graphic = new ESRI.ArcGIS.Client.Graphic();
                    graphic.Geometry = candidate.Location;
                    graphic.Symbol = mydictionary["DefaultClickSymbol"] as client.Symbols.MarkerSymbol;

                    location = candidate.Location;
                    graphic.SetZIndex(1);
                    if (_graphicsLayer == null)
                    {
                        _graphicsLayer = new ESRI.ArcGIS.Client.GraphicsLayer();
                        _graphicsLayer.ID = "BombThreatGraphics";
                        client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                        if (aclyrs.Count() > 0)
                        {
                            aclyrs.ChildLayers.Add(_graphicsLayer);
                        }
                    }

                    _graphicsLayer.Graphics.Add(graphic);

                    GeometryService geometryTask = new GeometryService();
                    geometryTask.Url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"; geometryTask.BufferCompleted += GeometryService_BufferCompleted;
                    geometryTask.Failed += GeometryService_Failed;

                    // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
                    BufferParameters bufferParams = new BufferParameters()
                    {
                        Unit = LinearUnit.SurveyFoot,
                        BufferSpatialReference = new SpatialReference(102004),
                        OutSpatialReference = _mapWidget.Map.SpatialReference
                    };
                    bufferParams.Features.Add(graphic);
                    double[] theDistances = new double[] { BuildingEvacDistance, OutdoorEvacDistance };
                    bufferParams.Distances.AddRange(theDistances);
                    geometryTask.BufferAsync(bufferParams);

                }
                else
                {
                    MessageBox.Show("No address found.  Example schema: 380 New York Ave., Redlands, CA or click on the map");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in Address location complete: " + ex.Message);
            }
        }
        private void RunButton_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_graphicsLayer != null)
                    _graphicsLayer.Graphics.Clear();
                // Find the map layer in the map widget that contains the data source.
                IEnumerable<ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                {

                    if (_mapWidget != null && d.IsSelectable == true)
                    {
                        // Get the feature layer in the map for the data source.
                        client.FeatureLayer featureL = _mapWidget.FindFeatureLayer(d);

                        //Clear Selection on Feature Layers in map
                        featureL.ClearSelection();

                    }
                }
                if (txtAddress.Text == "Enter Address")
                {
                    int BuildingEvacDistance = 0;
                    int OutdoorEvacDistance = 0;

                    if (bombType.Text == "Pipe bomb")
                    {
                        BuildingEvacDistance = 70;
                        OutdoorEvacDistance = 1200;
                    }
                    else if (bombType.Text == "Suicide vest")
                    {
                        BuildingEvacDistance = 110;
                        OutdoorEvacDistance = 1750;
                    }
                    else if (bombType.Text == "Briefcase/suitcase bomb")
                    {
                        BuildingEvacDistance = 150;
                        OutdoorEvacDistance = 1850;
                    }
                    else if (bombType.Text == "Sedan")
                    {
                        BuildingEvacDistance = 320;
                        OutdoorEvacDistance = 1900;
                    }
                    else if (bombType.Text == "SUV/van")
                    {
                        BuildingEvacDistance = 400;
                        OutdoorEvacDistance = 2400;
                    }
                    else if (bombType.Text == "Small delivery truck")
                    {
                        BuildingEvacDistance = 640;
                        OutdoorEvacDistance = 3800;
                    }
                    else if (bombType.Text == "Container/water truck")
                    {
                        BuildingEvacDistance = 860;
                        OutdoorEvacDistance = 5100;
                    }
                    else if (bombType.Text == "Semi-trailer")
                    {
                        BuildingEvacDistance = 1570;
                        OutdoorEvacDistance = 9300;
                    }
                    if (BuildingEvacDistance == 0 || OutdoorEvacDistance == 0)
                        return;



                    //e.MapPoint.SpatialReference = _mapWidget.Map.SpatialReference;
                    //location = e.MapPoint;
                    if (location == null)
                        return;
                    Graphic graphic = new ESRI.ArcGIS.Client.Graphic();
                    graphic.Geometry = location;

                    GeometryService geometryTask = new GeometryService();
                    geometryTask.Url = _serviceURL;
                    geometryTask.BufferCompleted += GeometryService_BufferCompleted;
                    geometryTask.Failed += GeometryService_Failed;

                    // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
                    BufferParameters bufferParams = new BufferParameters()
                    {
                        Unit = LinearUnit.SurveyFoot,
                        BufferSpatialReference = new SpatialReference(102004),
                        OutSpatialReference = _mapWidget.Map.SpatialReference
                    };
                    bufferParams.Features.Add(graphic);
                    double[] theDistances = new double[] { BuildingEvacDistance, OutdoorEvacDistance };
                    bufferParams.Distances.AddRange(theDistances);
                    geometryTask.BufferAsync(bufferParams);
                }
                else
                {
                    findAddress();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error in run: " + ex.Message);
            }
        }
Esempio n. 37
0
        // FragmentFilter overrides
        public override FragmentList process(FeatureList input, FilterEnv env)
        {
            FragmentList output = new FragmentList();

            //cuidado con las entidades dentro del for

            int i = 0;
            Vector3 scale;
            Vector3 distanceScale;
            Vector3 mScale = new Vector3 (1,1,1);
            float lWidth = 1;

            if (Scale != null)
            {
                scale = Registry.instance().GetEngine("Python").run(Scale).asVec3();
            }
            else
            {
                scale = new Vector3(1, 1, 1);
            }

            if (CoordScale != null)
            {
                distanceScale = Registry.instance().GetEngine("Python").run(CoordScale).asVec3();
            }
            else
            {
                distanceScale = new Vector3(1, 1, 1);
            }
            if (LineWidth != null)
            {
                lWidth = Registry.instance().GetEngine("Python").run(LineWidth).asFloat();
            }
            if (MaterialScale != null)
            {
                mScale = Registry.instance().GetEngine("Python").run(MaterialScale).asVec3();
            }

            SceneNode nodeIni = point3d(env.getName(), i, 0, 0, 0, null, env.getSceneMgr());
            #if ESCALA_NODO_INICIAL
            if (Scale != null)
            {
                nodeIni.SetScale(Registry.instance().GetEngine("Python").run(Scale).asVec3());
            }
            if (coordScale != null)
            {
                Vector3 vec3 = Registry.instance().GetEngine("Python").run(Scale).asVec3();
                nodeIni.SetPosition(nodeIni.Position.x * vec3.x, nodeIni.Position.y * vec3.y, nodeIni.Position.z * vec3.z);
            #if TRACE_BUILDGEOMFILTER
                        System.Console.WriteLine("(" + n.Position.x + "," + n.Position.y + ")");
            #endif
            }
            #endif
            Fragment fIni = new Fragment(nodeIni);
            output.Add(fIni);

            foreach (Feature feature in input)
            {
                //if type of features is Point
                if (feature.row.Geometry is SharpMap.Geometries.Point)
                {
                    SharpMap.Geometries.Point p = (SharpMap.Geometries.Point)feature.row.Geometry;

                    i++;
                    SceneNode n = point3d(env.getName(), i, (float)p.X, (float)p.Y, 0, nodeIni, env.getSceneMgr());

                    n.SetScale(scale);
                    n.SetPosition(n.Position.x * distanceScale.x, n.Position.y * distanceScale.y, n.Position.z * distanceScale.z);

                    Fragment f = new Fragment(n);
                    output.Add(f);
                }

                //if type of features is Polygon
                else if (feature.row.Geometry is SharpMap.Geometries.Polygon)
                {
                    SharpMap.Geometries.Polygon polygon = (SharpMap.Geometries.Polygon)feature.row.Geometry;

                    ManualObject polygonNode = null;

                    if (polygonNode == null)
                    {
                        polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                        MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                     ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        material.GetTechnique(0).GetPass(0).VertexColourTracking =
                                       (int)TrackVertexColourEnum.TVC_AMBIENT;

                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                        if (nameMaterial != null)
                        {
                            callback.Material = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();

                        int numVertices = polygon.ExteriorRing.NumPoints/*/10+1*/;
                        int numValores = 3;
                        double[][] data = new double[numVertices][];

                        for (int j = 0; j < numVertices; j++)
                        {
                            data[j] = new double[numValores];
                        }

                        int k = 0;
                        //1 polygon = N vertices
                        foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                        {
                            //if (k % 10 == 0)
                            {
                                data[k/*/10*/][0] = point.X;
                                data[k/*/10*/][1] = point.Y;
                                data[k/*/10*/][2] = 0;
                            }
                            k++;

                            //SceneNode n = point3d(env.getName()+i+k, k + 10, (float)point.X * 10.0f, (float)point.Y * 10.0f, 0, nodeIni, env.getSceneMgr());

                        }
                        for (int j = 0; j < data.GetLength(0); j++)
                        {
                            Glu.gluTessVertex(data[j], 0, new Vector3((float)(data[j][1] * distanceScale.y), (float)(data[j][2] * distanceScale.z), (float)(data[j][0] * distanceScale.x)));
                        }

                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();

                        nodeIni.AttachObject(polygonNode);

                    }
                    i++;
                }

                //if type of features is MultiPolygon
                else if (feature.row.Geometry is SharpMap.Geometries.MultiPolygon)
                {
                    SharpMap.Geometries.MultiPolygon mp = (SharpMap.Geometries.MultiPolygon)feature.row.Geometry;

                    // 1 MultiPolygon = N polygon
                    foreach (SharpMap.Geometries.Polygon polygon in mp.Polygons)
                    {

                        ManualObject polygonNode = null;

                        if (polygonNode == null)
                        {
                            polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                            MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                     ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                            material.GetTechnique(0).GetPass(0).VertexColourTracking =
                                           (int)TrackVertexColourEnum.TVC_AMBIENT;

                            //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                            MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                            if (nameMaterial != null)
                            {
                                callback.Material = nameMaterial; // "Test/ColourPolygon2";
                                callback.MaterialScale = mScale;
                            }

                            GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                            Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                            Glu.gluTessBeginPolygon(null);
                            Glu.gluTessBeginContour();

                            int numVertices = polygon.ExteriorRing.NumPoints;
                            int numValores = 3;
                            double[][] data = new double[numVertices][];

                            for (int j = 0; j < numVertices; j++)
                            {
                                data[j] = new double[numValores];
                            }

                            int k = 0;
                            //1 polygon = N vertices
                            foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                            {

                                data[k][0] = point.X;
                                data[k][1] = point.Y;
                                data[k][2] = 0;

                                k++;

                                //SceneNode n = point3d(env.getName(), i, (float)point.X, (float)point.Y, 0, nodeIni, env.getSceneMgr());

                            }
                            for (int j = 0; j < data.GetLength(0); j++)
                            {
                                Glu.gluTessVertex(data[j], 0, new Vector3(((float)data[j][1]) * distanceScale.y, ((float)data[j][2]) * distanceScale.z, ((float)data[j][0]) * distanceScale.x));
                            }

                            Glu.gluTessEndContour();
                            Glu.gluTessNormal(0, 0, 1);
                            Glu.gluTessEndPolygon();

                            nodeIni.AttachObject(polygonNode);

                        }
                        i++;
                    }
                }

                //if type of features is Line
                else if (feature.row.Geometry is SharpMap.Geometries.ILineal/*SharpMap.Geometries.LineString*/)
                {
                    System.Collections.Generic.List<SharpMap.Geometries.ILineal> lineas = new System.Collections.Generic.List<SharpMap.Geometries.ILineal>();
                    if (feature.row.Geometry is SharpMap.Geometries.MultiLineString)
                    {
                        foreach (SharpMap.Geometries.LineString l in ((SharpMap.Geometries.MultiLineString)(feature.row.Geometry)).LineStrings)
                        {
                            lineas.Add(l);
                        }
                    }
                    else
                    {
                        lineas.Add((SharpMap.Geometries.ILineal)(feature.row.Geometry));
                    }
                    foreach (SharpMap.Geometries.ILineal line in lineas)
                    {
                        ManualObject lineNode = env.getSceneMgr().CreateManualObject("line" + i);

                        //MaterialPtr material = MaterialManager.Singleton.Create(nameMaterial,
                        //ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        //material.GetTechnique(0).GetPass(0).VertexColourTracking =
                        //               (int)TrackVertexColourEnum.TVC_AMBIENT;
                        //material.GetTechnique(0).GetPass(0).SetDepthBias(100);
                        //material.GetTechnique(0).GetPass(0).LightingEnabled = false;

                        int nSeg = 5; // Number of segments on the cap or join pieces
                        BufferParameters param = new BufferParameters(nSeg, BufferParameters.BufferEndCapStyle.CapRound, BufferParameters.BufferJoinStyle.JoinRound, 2);
                        IGeometryFactory<Coord> geometryFactory = new GeometryFactory<Coord>(new CoordSeqFac(new CoordFac(PrecisionModelType.DoubleFloating)));
                        //IWktGeometryReader<Coord> reader = geometryFactory.WktReader;
                        //string txt = feature.row.Geometry.AsText();
                        ILineString line1 = (ILineString)GeometryConverter.ToNTSGeometry((SharpMap.Geometries.LineString)line, geometryFactory); // (ILineString<Coord>)reader.Read(txt);
                        IGeometry coordBuffer = line1.Buffer(lWidth, param);
                        ICoordinateSequence coords = coordBuffer.Coordinates;
                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(lineNode, Color, feature);
                        if (nameMaterial != null)
                        {
                            callback.Material = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();
                        foreach (Coord coord in coords)
                        {
                            double[] data = new double[] { coord.X * distanceScale.x, coord.Y * distanceScale.y, (double.IsNaN(coord.Z) ? 0 : coord.Z) * distanceScale.z };

                            Glu.gluTessVertex(data, 0, new Vector3((float)data[1], (float)data[2], (float)data[0]));
                        }
                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();
                        i++;
                        nodeIni.AttachObject(lineNode);
                    }
                    if ((feature.row.Geometry is SharpMap.Geometries.Polygon) | (feature.row.Geometry is SharpMap.Geometries.MultiPolygon))
                    {
                        Fragment f = new Fragment(nodeIni);
                        output.Add(f);
                    }

                }
            }
            i = 0;//breakpoint

            /*foreach (Fragment fragment in output)
            {
                fragment.Node.Scale(0,0,0);
            }*/

            #if TODO
            // if features are arriving in batch, resolve the color here.
            // otherwise we will resolve it later in process(feature,env).
            is_batch = input.Count > 1;
            batch_feature_color = overall_color;
            if (is_batch && getColorScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getColorScript(), env);
                if (r.isValid())
                    batch_feature_color = r.asVec4();
                else
                    env.getReport().error(r.asString());
            }

            return base.process(input, env);
            #endif
            //throw new NotImplementedException();

            if (successor != null)
            {
                if (successor is FeatureFilter)
                {
                    FeatureFilter filter = (FeatureFilter)successor;
                    FeatureList l = filter.process(input, env);
                    //FeatureList l = successor.process(input, env);
                }
                else if (successor is FragmentFilter)
                {
                    FragmentFilter filter = (FragmentFilter)successor;
                    FragmentList l = filter.process(output, env);
                }
            }

            return output;
        }
        void buffer(string agsGeometryServerUrl, BufferParameters bufferParams, FindNearbyEventArgs findNearbyRequest)
        {
            if (string.IsNullOrEmpty(agsGeometryServerUrl))
                return;

            GeometryService geomService = new GeometryService
            {
                Url = agsGeometryServerUrl
            };
            geomService.BufferCompleted += GeometryService_BufferCompleted;
            geomService.Failed += (o, e) =>
            {
                if (findNearbyToolWindow != null)
                {
                    findNearbyToolWindow.StopBusyIndicator();
                    MapApplication.Current.HideWindow(findNearbyToolWindow);
                }
                MessageBoxDialog.Show(Resources.Strings.MsgErrorExecutingBufferOperation + Environment.NewLine + e.Error.ToString());                
            };
            geomService.BufferAsync(bufferParams, findNearbyRequest);
        }
        private void RunButton_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtAddress.Text == "Enter Address")
                {
                    int BuildingEvacDistance = 0;
                    int OutdoorEvacDistance  = 0;

                    if (bombType.Text == "Pipe bomb")
                    {
                        BuildingEvacDistance = 70;
                        OutdoorEvacDistance  = 1200;
                    }
                    else if (bombType.Text == "Suicide vest")
                    {
                        BuildingEvacDistance = 110;
                        OutdoorEvacDistance  = 1750;
                    }
                    else if (bombType.Text == "Briefcase/suitcase bomb")
                    {
                        BuildingEvacDistance = 150;
                        OutdoorEvacDistance  = 1850;
                    }
                    else if (bombType.Text == "Sedan")
                    {
                        BuildingEvacDistance = 320;
                        OutdoorEvacDistance  = 1900;
                    }
                    else if (bombType.Text == "SUV/van")
                    {
                        BuildingEvacDistance = 400;
                        OutdoorEvacDistance  = 2400;
                    }
                    else if (bombType.Text == "Small delivery truck")
                    {
                        BuildingEvacDistance = 640;
                        OutdoorEvacDistance  = 3800;
                    }
                    else if (bombType.Text == "Container/water truck")
                    {
                        BuildingEvacDistance = 860;
                        OutdoorEvacDistance  = 5100;
                    }
                    else if (bombType.Text == "Semi-trailer")
                    {
                        BuildingEvacDistance = 1570;
                        OutdoorEvacDistance  = 9300;
                    }
                    if (BuildingEvacDistance == 0 || OutdoorEvacDistance == 0)
                    {
                        return;
                    }



                    //e.MapPoint.SpatialReference = _mapWidget.Map.SpatialReference;
                    //location = e.MapPoint;
                    if (location == null)
                    {
                        return;
                    }
                    Graphic graphic = new ESRI.ArcGIS.Client.Graphic();
                    graphic.Geometry = location;

                    GeometryService geometryTask = new GeometryService();
                    geometryTask.Url              = "http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer";
                    geometryTask.BufferCompleted += GeometryService_BufferCompleted;
                    geometryTask.Failed          += GeometryService_Failed;

                    // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
                    BufferParameters bufferParams = new BufferParameters()
                    {
                        Unit = LinearUnit.SurveyFoot,
                        BufferSpatialReference = new SpatialReference(102004),
                        OutSpatialReference    = _mapWidget.Map.SpatialReference
                    };
                    bufferParams.Features.Add(graphic);
                    double[] theDistances = new double[] { BuildingEvacDistance, OutdoorEvacDistance };
                    bufferParams.Distances.AddRange(theDistances);
                    geometryTask.BufferAsync(bufferParams);
                }
                else
                {
                    findAddress();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error in run: " + ex.Message);
            }
        }
Esempio n. 40
0
        void locatorTask_AddressToLocationsCompleted(object sender, AddressToLocationsEventArgs e)
        {
            try
            {
                List <AddressCandidate> returnedCandidates = e.Results;
                int BuildingEvacDistance = 0;
                int OutdoorEvacDistance  = 0;

                if (bombType.Text == "Pipe bomb")
                {
                    BuildingEvacDistance = 70;
                    OutdoorEvacDistance  = 1200;
                }
                else if (bombType.Text == "Suicide vest")
                {
                    BuildingEvacDistance = 110;
                    OutdoorEvacDistance  = 1750;
                }
                else if (bombType.Text == "Briefcase/suitcase bomb")
                {
                    BuildingEvacDistance = 150;
                    OutdoorEvacDistance  = 1850;
                }
                else if (bombType.Text == "Sedan")
                {
                    BuildingEvacDistance = 320;
                    OutdoorEvacDistance  = 1900;
                }
                else if (bombType.Text == "SUV/van")
                {
                    BuildingEvacDistance = 400;
                    OutdoorEvacDistance  = 2400;
                }
                else if (bombType.Text == "Small delivery truck")
                {
                    BuildingEvacDistance = 640;
                    OutdoorEvacDistance  = 3800;
                }
                else if (bombType.Text == "Container/water truck")
                {
                    BuildingEvacDistance = 860;
                    OutdoorEvacDistance  = 5100;
                }
                else if (bombType.Text == "Semi-trailer")
                {
                    BuildingEvacDistance = 1570;
                    OutdoorEvacDistance  = 9300;
                }

                if (BuildingEvacDistance == 0 || OutdoorEvacDistance == 0)
                {
                    return;
                }

                if (e.Results.Count > 0)
                {
                    AddressCandidate candidate = returnedCandidates[0];

                    ResourceDictionary mydictionary = new ResourceDictionary();
                    mydictionary.Source = new Uri("/BombThreatAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);
                    Graphic graphic = new ESRI.ArcGIS.Client.Graphic();
                    graphic.Geometry = candidate.Location;
                    graphic.Symbol   = mydictionary["DefaultClickSymbol"] as client.Symbols.MarkerSymbol;

                    location = candidate.Location;
                    graphic.SetZIndex(1);
                    if (_graphicsLayer == null)
                    {
                        _graphicsLayer    = new ESRI.ArcGIS.Client.GraphicsLayer();
                        _graphicsLayer.ID = "BombThreatGraphics";
                        client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                        if (aclyrs.Count() > 0)
                        {
                            aclyrs.ChildLayers.Add(_graphicsLayer);
                        }
                    }

                    _graphicsLayer.Graphics.Add(graphic);

                    GeometryService geometryTask = new GeometryService();
                    geometryTask.Url     = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"; geometryTask.BufferCompleted += GeometryService_BufferCompleted;
                    geometryTask.Failed += GeometryService_Failed;

                    // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
                    BufferParameters bufferParams = new BufferParameters()
                    {
                        Unit = LinearUnit.SurveyFoot,
                        BufferSpatialReference = new SpatialReference(102004),
                        OutSpatialReference    = _mapWidget.Map.SpatialReference
                    };
                    bufferParams.Features.Add(graphic);
                    double[] theDistances = new double[] { BuildingEvacDistance, OutdoorEvacDistance };
                    bufferParams.Distances.AddRange(theDistances);
                    geometryTask.BufferAsync(bufferParams);
                }
                else
                {
                    MessageBox.Show("No address found.  Example schema: 380 New York Ave., Redlands, CA or click on the map");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in Address location complete: " + ex.Message);
            }
        }
Esempio n. 41
0
 public static int GetNamedBufferParameterivEXT(uint BufferID, BufferParameters pname)
 {
     int tmp = 0;
     Delegates.glGetNamedBufferParameterivEXT(BufferID, pname, ref tmp);
     return tmp;
 }
Esempio n. 42
0
        // FragmentFilter overrides
        public override FragmentList process(FeatureList input, FilterEnv env)
        {
            FragmentList output = new FragmentList();

            //cuidado con las entidades dentro del for

            int     i = 0;
            Vector3 scale;
            Vector3 distanceScale;
            Vector3 mScale = new Vector3(1, 1, 1);
            float   lWidth = 1;

            if (Scale != null)
            {
                scale = Registry.instance().GetEngine("Python").run(Scale).asVec3();
            }
            else
            {
                scale = new Vector3(1, 1, 1);
            }

            if (CoordScale != null)
            {
                distanceScale = Registry.instance().GetEngine("Python").run(CoordScale).asVec3();
            }
            else
            {
                distanceScale = new Vector3(1, 1, 1);
            }
            if (LineWidth != null)
            {
                lWidth = Registry.instance().GetEngine("Python").run(LineWidth).asFloat();
            }
            if (MaterialScale != null)
            {
                mScale = Registry.instance().GetEngine("Python").run(MaterialScale).asVec3();
            }

            SceneNode nodeIni = point3d(env.getName(), i, 0, 0, 0, null, env.getSceneMgr());

#if ESCALA_NODO_INICIAL
            if (Scale != null)
            {
                nodeIni.SetScale(Registry.instance().GetEngine("Python").run(Scale).asVec3());
            }
            if (coordScale != null)
            {
                Vector3 vec3 = Registry.instance().GetEngine("Python").run(Scale).asVec3();
                nodeIni.SetPosition(nodeIni.Position.x * vec3.x, nodeIni.Position.y * vec3.y, nodeIni.Position.z * vec3.z);
#if TRACE_BUILDGEOMFILTER
                System.Console.WriteLine("(" + n.Position.x + "," + n.Position.y + ")");
#endif
            }
#endif
            Fragment fIni = new Fragment(nodeIni);
            output.Add(fIni);

            foreach (Feature feature in input)
            {
                //if type of features is Point
                if (feature.row.Geometry is SharpMap.Geometries.Point)
                {
                    SharpMap.Geometries.Point p = (SharpMap.Geometries.Point)feature.row.Geometry;

                    i++;
                    SceneNode n = point3d(env.getName(), i, (float)p.X, (float)p.Y, 0, nodeIni, env.getSceneMgr());

                    n.SetScale(scale);
                    n.SetPosition(n.Position.x * distanceScale.x, n.Position.y * distanceScale.y, n.Position.z * distanceScale.z);

                    Fragment f = new Fragment(n);
                    output.Add(f);
                }

                //if type of features is Polygon
                else if (feature.row.Geometry is SharpMap.Geometries.Polygon)
                {
                    SharpMap.Geometries.Polygon polygon = (SharpMap.Geometries.Polygon)feature.row.Geometry;

                    ManualObject polygonNode = null;

                    if (polygonNode == null)
                    {
                        polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                        MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                                                                ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        material.GetTechnique(0).GetPass(0).VertexColourTracking =
                            (int)TrackVertexColourEnum.TVC_AMBIENT;

                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                        if (nameMaterial != null)
                        {
                            callback.Material      = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();

                        int        numVertices = polygon.ExteriorRing.NumPoints /*/10+1*/;
                        int        numValores  = 3;
                        double[][] data        = new double[numVertices][];

                        for (int j = 0; j < numVertices; j++)
                        {
                            data[j] = new double[numValores];
                        }

                        int k = 0;
                        //1 polygon = N vertices
                        foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                        {
                            //if (k % 10 == 0)
                            {
                                data[k /*/10*/][0] = point.X;
                                data[k /*/10*/][1] = point.Y;
                                data[k /*/10*/][2] = 0;
                            }
                            k++;

                            //SceneNode n = point3d(env.getName()+i+k, k + 10, (float)point.X * 10.0f, (float)point.Y * 10.0f, 0, nodeIni, env.getSceneMgr());
                        }
                        for (int j = 0; j < data.GetLength(0); j++)
                        {
                            Glu.gluTessVertex(data[j], 0, new Vector3((float)(data[j][1] * distanceScale.y), (float)(data[j][2] * distanceScale.z), (float)(data[j][0] * distanceScale.x)));
                        }

                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();

                        nodeIni.AttachObject(polygonNode);
                    }
                    i++;
                }

                //if type of features is MultiPolygon
                else if (feature.row.Geometry is SharpMap.Geometries.MultiPolygon)
                {
                    SharpMap.Geometries.MultiPolygon mp = (SharpMap.Geometries.MultiPolygon)feature.row.Geometry;

                    // 1 MultiPolygon = N polygon
                    foreach (SharpMap.Geometries.Polygon polygon in mp.Polygons)
                    {
                        ManualObject polygonNode = null;

                        if (polygonNode == null)
                        {
                            polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                            MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                                                                    ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                            material.GetTechnique(0).GetPass(0).VertexColourTracking =
                                (int)TrackVertexColourEnum.TVC_AMBIENT;


                            //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                            MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                            if (nameMaterial != null)
                            {
                                callback.Material      = nameMaterial; // "Test/ColourPolygon2";
                                callback.MaterialScale = mScale;
                            }

                            GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                            Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                            Glu.gluTessBeginPolygon(null);
                            Glu.gluTessBeginContour();

                            int        numVertices = polygon.ExteriorRing.NumPoints;
                            int        numValores  = 3;
                            double[][] data        = new double[numVertices][];

                            for (int j = 0; j < numVertices; j++)
                            {
                                data[j] = new double[numValores];
                            }

                            int k = 0;
                            //1 polygon = N vertices
                            foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                            {
                                data[k][0] = point.X;
                                data[k][1] = point.Y;
                                data[k][2] = 0;

                                k++;

                                //SceneNode n = point3d(env.getName(), i, (float)point.X, (float)point.Y, 0, nodeIni, env.getSceneMgr());
                            }
                            for (int j = 0; j < data.GetLength(0); j++)
                            {
                                Glu.gluTessVertex(data[j], 0, new Vector3(((float)data[j][1]) * distanceScale.y, ((float)data[j][2]) * distanceScale.z, ((float)data[j][0]) * distanceScale.x));
                            }

                            Glu.gluTessEndContour();
                            Glu.gluTessNormal(0, 0, 1);
                            Glu.gluTessEndPolygon();

                            nodeIni.AttachObject(polygonNode);
                        }
                        i++;
                    }
                }

                //if type of features is Line
                else if (feature.row.Geometry is SharpMap.Geometries.ILineal /*SharpMap.Geometries.LineString*/)
                {
                    System.Collections.Generic.List <SharpMap.Geometries.ILineal> lineas = new System.Collections.Generic.List <SharpMap.Geometries.ILineal>();
                    if (feature.row.Geometry is SharpMap.Geometries.MultiLineString)
                    {
                        foreach (SharpMap.Geometries.LineString l in ((SharpMap.Geometries.MultiLineString)(feature.row.Geometry)).LineStrings)
                        {
                            lineas.Add(l);
                        }
                    }
                    else
                    {
                        lineas.Add((SharpMap.Geometries.ILineal)(feature.row.Geometry));
                    }
                    foreach (SharpMap.Geometries.ILineal line in lineas)
                    {
                        ManualObject lineNode = env.getSceneMgr().CreateManualObject("line" + i);

                        //MaterialPtr material = MaterialManager.Singleton.Create(nameMaterial,
                        //ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        //material.GetTechnique(0).GetPass(0).VertexColourTracking =
                        //               (int)TrackVertexColourEnum.TVC_AMBIENT;
                        //material.GetTechnique(0).GetPass(0).SetDepthBias(100);
                        //material.GetTechnique(0).GetPass(0).LightingEnabled = false;

                        int nSeg = 5; // Number of segments on the cap or join pieces
                        BufferParameters         param           = new BufferParameters(nSeg, BufferParameters.BufferEndCapStyle.CapRound, BufferParameters.BufferJoinStyle.JoinRound, 2);
                        IGeometryFactory <Coord> geometryFactory = new GeometryFactory <Coord>(new CoordSeqFac(new CoordFac(PrecisionModelType.DoubleFloating)));
                        //IWktGeometryReader<Coord> reader = geometryFactory.WktReader;
                        //string txt = feature.row.Geometry.AsText();
                        ILineString         line1       = (ILineString)GeometryConverter.ToNTSGeometry((SharpMap.Geometries.LineString)line, geometryFactory); // (ILineString<Coord>)reader.Read(txt);
                        IGeometry           coordBuffer = line1.Buffer(lWidth, param);
                        ICoordinateSequence coords      = coordBuffer.Coordinates;
                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(lineNode, Color, feature);
                        if (nameMaterial != null)
                        {
                            callback.Material      = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();
                        foreach (Coord coord in coords)
                        {
                            double[] data = new double[] { coord.X *distanceScale.x, coord.Y *distanceScale.y, (double.IsNaN(coord.Z) ? 0 : coord.Z) * distanceScale.z };

                            Glu.gluTessVertex(data, 0, new Vector3((float)data[1], (float)data[2], (float)data[0]));
                        }
                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();
                        i++;
                        nodeIni.AttachObject(lineNode);
                    }
                    if ((feature.row.Geometry is SharpMap.Geometries.Polygon) | (feature.row.Geometry is SharpMap.Geometries.MultiPolygon))
                    {
                        Fragment f = new Fragment(nodeIni);
                        output.Add(f);
                    }
                }
            }
            i = 0;//breakpoint

            /*foreach (Fragment fragment in output)
             * {
             *  fragment.Node.Scale(0,0,0);
             * }*/

#if TODO
            // if features are arriving in batch, resolve the color here.
            // otherwise we will resolve it later in process(feature,env).
            is_batch            = input.Count > 1;
            batch_feature_color = overall_color;
            if (is_batch && getColorScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getColorScript(), env);
                if (r.isValid())
                {
                    batch_feature_color = r.asVec4();
                }
                else
                {
                    env.getReport().error(r.asString());
                }
            }

            return(base.process(input, env));
#endif
            //throw new NotImplementedException();

            if (successor != null)
            {
                if (successor is FeatureFilter)
                {
                    FeatureFilter filter = (FeatureFilter)successor;
                    FeatureList   l      = filter.process(input, env);
                    //FeatureList l = successor.process(input, env);
                }
                else if (successor is FragmentFilter)
                {
                    FragmentFilter filter = (FragmentFilter)successor;
                    FragmentList   l      = filter.process(output, env);
                }
            }

            return(output);
        }
Esempio n. 43
0
 public static void GetNamedBufferParameterivEXT(uint BufferID, BufferParameters pname, int[] @params)
 {
     Delegates.glGetNamedBufferParameterivEXT(BufferID, pname, ref @params[0]);
 }
 private void BufferPathGeometry(Graphic pathGraphic)
 {
     var l = MyMap.Layers["BufferResultsLayer"] as GraphicsLayer;
     l.Graphics.Clear();
     #region GeometryService - Buffers path geometry
     var geometryService = new GeometryService(GEOMETRY_URL);
     geometryService.BufferCompleted += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         var g = e.Results.FirstOrDefault();
         l.Graphics.Add(g);
         MyMap.ZoomTo(Expand(l.FullExtent));
         QueryTornadoTracks(g); // Retrieves tornado tracks and finds intersection.
     };
     geometryService.Failed += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         MessageBox.Show(string.Format("Buffer failed with error '{0}'", e.Error.Message));
     };
     MyProgressBar.IsIndeterminate = true;
     BufferParameters parameters = new BufferParameters()
     {
         Unit = LinearUnit.StatuteMile,
         BufferSpatialReference = new SpatialReference(4326),
         OutSpatialReference = MyMap.SpatialReference,
         Geodesic = true
     };
     parameters.Features.Add(pathGraphic);
     parameters.Distances.Add(100);
     geometryService.BufferAsync(parameters);
     #endregion
 }
Esempio n. 45
0
        private void AddBufferedPoint()
        {
            GraphicsLayer graphicsLayer = myMap.Layers[layerId.ToString()] as GraphicsLayer;

            point.SpatialReference = myMap.SpatialReference;
            Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = point,
                Symbol = SimplePointSymbol
            };
            graphic.SetZIndex(1);
            graphicsLayer.Graphics.Add(graphic);

            GeometryService geometryService =
              new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
            geometryService.BufferCompleted += GeometryService_BufferCompleted;
            geometryService.Failed += GeometryService_Failed;

            // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
            BufferParameters bufferParams = new BufferParameters()
            {
                Unit = StandardUnit,
                BufferSpatialReference = new SpatialReference(4326),
                OutSpatialReference = myMap.SpatialReference
            };
            bufferParams.Features.Add(graphic);
            bufferParams.Distances.Add(radius);

            geometryService.BufferAsync(bufferParams);
        }
Esempio n. 46
0
 /// <summary>	
 /// Runs the XAPO's digital signal processing (DSP) code on the given input and output buffers.	
 /// </summary>	
 /// <param name="inputProcessParameters">[in]          Input array of  <see cref="SharpDX.XAPO.BufferParameters"/> structures.         </param>
 /// <param name="outputProcessParameters">[in, out]          Output array of <see cref="SharpDX.XAPO.BufferParameters"/> structures.  On input, the value of <see cref="SharpDX.XAPO.BufferParameters"/>.ValidFrameCount indicates the number of frames  that the XAPO should write to the output buffer.  On output, the value of <see cref="SharpDX.XAPO.BufferParameters"/>.ValidFrameCount indicates the actual number of frames written.         </param>
 /// <param name="isEnabled"> TRUE to process normally; FALSE to process thru.  See Remarks for additional information.         </param>
 /// <unmanaged>void IXAPO::Process([None] UINT32 InputProcessParameterCount,[In, Buffer, Optional] const XAPO_PROCESS_BUFFER_PARAMETERS* pInputProcessParameters,[None] UINT32 OutputProcessParameterCount,[InOut, Buffer, Optional] XAPO_PROCESS_BUFFER_PARAMETERS* pOutputProcessParameters,[None] BOOL IsEnabled)</unmanaged>
 public void Process(BufferParameters[] inputProcessParameters, BufferParameters[] outputProcessParameters, bool isEnabled)
 {
     Process_(inputProcessParameters.Length, inputProcessParameters, outputProcessParameters.Length, outputProcessParameters, isEnabled);
 }
        void findNearbyToolWindow_FindNearby(object sender, FindNearbyEventArgs e)
        {
            if (Layer == null)
            {
                return;
            }

            GraphicsLayer graphicsLayer = Layer as GraphicsLayer;

            if (graphicsLayer == null)
            {
                return;
            }

            if (graphicsLayer.SelectionCount < 1)
            {
                findNearbyToolWindow.StopBusyIndicator();
                MessageBoxDialog.Show(Resources.Strings.MsgNoFeaturesSelected, Resources.Strings.ErrorCaption, MessageBoxButton.OK);
                return;
            }

            BufferParameters bufferParams = new BufferParameters();

            switch (e.LinearUnit)
            {
            case LinearUnit.Miles:
                bufferParams.Unit = ESRI.ArcGIS.Client.Tasks.LinearUnit.StatuteMile;
                break;

            case LinearUnit.Meters:
                bufferParams.Unit = ESRI.ArcGIS.Client.Tasks.LinearUnit.Meter;
                break;

            case LinearUnit.Kilometers:
                bufferParams.Unit = ESRI.ArcGIS.Client.Tasks.LinearUnit.Kilometer;
                break;
            }
            bufferParams.UnionResults        = true;
            bufferParams.OutSpatialReference = Map.SpatialReference;
            SpatialReference gcs = new SpatialReference(4326);

            bufferParams.BufferSpatialReference = gcs;
            bufferParams.Geodesic = true;
            bufferParams.Distances.Add(e.Distance);

            // Check the spatial reference of the first graphic
            Graphic firstGraphic = graphicsLayer.SelectedGraphics.ElementAt(0);
            bool    isInGcs      = firstGraphic.Geometry != null &&
                                   firstGraphic.Geometry.SpatialReference != null &&
                                   firstGraphic.Geometry.SpatialReference.Equals(gcs);

            // In order to perform geodesic buffering we need to pass geometries in GCS to the geom service
            if (isInGcs)
            {
                foreach (Graphic selectedGraphic in graphicsLayer.SelectedGraphics)
                {
                    bufferParams.Features.Add(selectedGraphic);
                }

                buffer(GeometryServiceUrl, bufferParams, e);
            }
            else
            {
                GeometryServiceOperationHelper helper = new GeometryServiceOperationHelper(GeometryServiceUrl);
                helper.ProjectGraphicsCompleted += (o, args) => {
                    foreach (Graphic selectedGraphic in args.Graphics)
                    {
                        bufferParams.Features.Add(selectedGraphic);
                    }
                    buffer(GeometryServiceUrl, bufferParams, e);
                };
                helper.ProjectGraphics(graphicsLayer.SelectedGraphics.ToList(), new SpatialReference(4326));
            }
        }
        void findNearbyToolWindow_FindNearby(object sender, FindNearbyEventArgs e)
        {
            if (Layer == null)
                return;

            GraphicsLayer graphicsLayer = Layer as GraphicsLayer;
            if (graphicsLayer == null)
                return;

            if (graphicsLayer.SelectionCount < 1)
            {
                findNearbyToolWindow.StopBusyIndicator();
                MessageBoxDialog.Show(Resources.Strings.MsgNoFeaturesSelected, Resources.Strings.ErrorCaption, MessageBoxButton.OK);
                return;
            }

            BufferParameters bufferParams = new BufferParameters();
            switch (e.LinearUnit)
            {
                case LinearUnit.Miles:
                    bufferParams.Unit = ESRI.ArcGIS.Client.Tasks.LinearUnit.StatuteMile;
                    break;
                case LinearUnit.Meters:
                    bufferParams.Unit = ESRI.ArcGIS.Client.Tasks.LinearUnit.Meter;
                    break;
                case LinearUnit.Kilometers:
                    bufferParams.Unit = ESRI.ArcGIS.Client.Tasks.LinearUnit.Kilometer;
                    break;
            }
            bufferParams.UnionResults = true;
            bufferParams.OutSpatialReference = Map.SpatialReference;
            SpatialReference gcs = new SpatialReference(4326);
            bufferParams.BufferSpatialReference = gcs;
            bufferParams.Geodesic = true;
            bufferParams.Distances.Add(e.Distance);

            // Check the spatial reference of the first graphic
            Graphic firstGraphic = graphicsLayer.SelectedGraphics.ElementAt(0);
            bool isInGcs = firstGraphic.Geometry != null
                             && firstGraphic.Geometry.SpatialReference != null
                             && firstGraphic.Geometry.SpatialReference.Equals(gcs);

            // In order to perform geodesic buffering we need to pass geometries in GCS to the geom service
            if (isInGcs)
            {
                foreach (Graphic selectedGraphic in graphicsLayer.SelectedGraphics)
                    bufferParams.Features.Add(selectedGraphic);

                buffer(GeometryServiceUrl, bufferParams, e);
            }
            else
            {
                GeometryServiceOperationHelper helper = new GeometryServiceOperationHelper(GeometryServiceUrl);
                helper.ProjectGraphicsCompleted += (o, args) => {
                    foreach (Graphic selectedGraphic in args.Graphics)
                        bufferParams.Features.Add(selectedGraphic);
                    buffer(GeometryServiceUrl, bufferParams, e);
                };
                helper.ProjectGraphics(graphicsLayer.SelectedGraphics.ToList(), new SpatialReference(4326));
            }
        }        
        // ***********************************************************************************
        // * ...Set the map mouseclick event so that user can enter the incident
        // ***********************************************************************************
        private void btnSolve_Click(object sender, RoutedEventArgs e)
        {
            // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
            _bufferParams = new BufferParameters(); 
            _bufferParams.Unit = currentLinearUnit(); 
            _bufferParams.BufferSpatialReference = new SpatialReference(4326);
            _bufferParams.OutSpatialReference = _mapWidget.Map.SpatialReference;

            _bufferParams.Features.Clear();
            if (_selectedRadioButtonName == "rbDrawPoints" || _selectedRadioButtonName == "rbSelectedFeaturesFromLayer")
            {
                _bufferParams.Features.AddRange(_bufferPointLayer.Graphics);
            }
            else if (_selectedRadioButtonName == "rbSelectedFeaturesOnMap")
            {
                _bufferPointLayer.ClearGraphics();

                IEnumerable<ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                {
                    client.FeatureLayer featureL = _mapWidget.FindFeatureLayer(d);
                    if (featureL.SelectionCount > 0)
                        _bufferParams.Features.AddRange(featureL.SelectedGraphics);
                }
            }

            if (_bufferParams.Features.Count == 0)
            {
                MessageBox.Show("Please select features on the map first", "Error");
                return;
            }

            var bufferDistance = Convert.ToDouble(ringInterval.Text);
            var ringDistance = bufferDistance; 

            var numRings = Convert.ToInt32(numberOfRings.Text); 
            for (var i = 0; i < numRings; i++)
            {
                _bufferParams.Distances.Add(ringDistance);
                ringDistance = ringDistance + bufferDistance; 
            }

            _geometryService.BufferAsync(_bufferParams);
        }