当前位置: 首页>>代码示例>>C#>>正文


C# Envelope类代码示例

本文整理汇总了C#中Envelope的典型用法代码示例。如果您正苦于以下问题:C# Envelope类的具体用法?C# Envelope怎么用?C# Envelope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Envelope类属于命名空间,在下文中一共展示了Envelope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ComputeVertexEnvelope

 private static Envelope ComputeVertexEnvelope(IEnumerable<Vertex> vertices)
 {
     Envelope env = new Envelope();
     foreach (Vertex v in vertices)
         env.ExpandToInclude(v.Coordinate);
     return env;
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:7,代码来源:ConformingDelaunayTriangulator.cs

示例2: Grid

        public static IGeometry Grid(IGeometry g, int nCells)
        {
            var geoms = new List<IGeometry>();

            var env = FunctionsUtil.GetEnvelopeOrDefault(g);
            var geomFact = FunctionsUtil.GetFactoryOrDefault(g);

            var nCellsOnSide = (int) Math.Sqrt(nCells) + 1;
            var cellSizeX = env.Width/nCellsOnSide;
            var cellSizeY = env.Height/nCellsOnSide;

            for (var i = 0; i < nCellsOnSide; i++)
            {
                for (var j = 0; j < nCellsOnSide; j++)
                {
                    var x1 = env.MinX + i * cellSizeX;
                    var y1 = env.MinY + j * cellSizeY;
                    var x2 = env.MinX + (i+1) * cellSizeX;
                    var y2 = env.MinY + (j+1) * cellSizeY;
                    var cellEnv = new Envelope(x1, x2, y1, y2);

                    geoms.Add(geomFact.ToGeometry(cellEnv));
                }
            }
            return geomFact.BuildGeometry(geoms);
        }
开发者ID:jcarasick,项目名称:NetTopologySuite,代码行数:26,代码来源:CreateShapeFunctions.cs

示例3: GetSource

        protected override void GetSource( Envelope extent, int width, int height, DynamicLayer.OnImageComplete onComplete )
        {
            _currentWidth = width;
            _currentHeight = height;

            MapPoints = new List<MapPoint>();

            //Make up some dummy data
            int count = 0;
            while( count < 1000 )
            {
                MapPoints.Add( new MapPoint( extent.XMin + ( extent.Width * ( _random.Next( 100 ) / 100.00 ) ),
                    extent.YMin + ( extent.Height * ( _random.Next( 100 ) / 100.00 ) ),
                    extent.SpatialReference ) );
                count++;
            }
            //Make up some dummy data

            _pngRenderer = new PixelPngRenderer( _currentWidth, _currentHeight, MapPoints );

            ParameterizedThreadStart starter = new ParameterizedThreadStart( ( pngRenderer ) =>
            {
                Stream imageStream = InitalizeImage( pngRenderer as PixelPngRenderer );

                Dispatcher.BeginInvoke( () =>
                {
                    _image = new BitmapImage();
                    _image.SetSource( imageStream );
                    onComplete( _image, width, height, extent );
                } );
            } );
            new Thread( starter ).Start( _pngRenderer );
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:33,代码来源:PixelLayer.cs

示例4: Serialize

        /// <summary>
        /// Serialize an envelope
        /// to a string
        /// </summary>
        /// <param name="envelope"></param>
        /// <returns></returns>
        public string Serialize(Envelope envelope)
        {            
            if (envelope == null)
            {
                throw new ArgumentNullException("envelope");
            }

            if (envelope is Notification)
            {
                return JsonSerializer<Notification>.Serialize((Notification)envelope);
            }
            else if (envelope is Message)
            {
                return JsonSerializer<Message>.Serialize((Message)envelope);
            }
            else if (envelope is Command)
            {
                return JsonSerializer<Command>.Serialize((Command)envelope);
            }
            else if (envelope is Session)
            {
                return JsonSerializer<Session>.Serialize((Session)envelope);
            }
            else
            {
                throw new ArgumentException("The envelope type is unknown");
            }
        }
开发者ID:guitcastro,项目名称:lime,代码行数:34,代码来源:EnvelopeSerializer.cs

示例5: FindContinuation

        // virtual for testing as usual
        public virtual async Task<IContinuation> FindContinuation(Envelope envelope, IEnvelopeContext context)
        {
            foreach (var handler in _handlers)
            {
                var continuation = await handler.Handle(envelope).ConfigureAwait(false);
                if (continuation != null)
                {
                    context.DebugMessage(() => new EnvelopeContinuationChosen
                    {   
                        ContinuationType = continuation.GetType(),
                        HandlerType = handler.GetType(),
                        Envelope = envelope.ToToken()
                    });

                    return continuation;
                }
            }

            // TODO - add rules for what to do when we have no handler
            context.DebugMessage(() => new EnvelopeContinuationChosen
            {
                ContinuationType = typeof(MoveToErrorQueue),
                HandlerType = typeof(HandlerPipeline),
                Envelope = envelope.ToToken()
            });

            return new MoveToErrorQueue(new NoHandlerException(envelope.Message.GetType()));
        }
开发者ID:DarthFubuMVC,项目名称:fubumvc,代码行数:29,代码来源:HandlerPipeline.cs

示例6: Initialize

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map area
            Envelope initialLocation = new Envelope(
                -1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
                SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation);

            // Create uri to the used feature service
            var serviceUri = new Uri(
               "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");

            // Create feature table for the pools feature service
            ServiceFeatureTable poolsFeatureTable = new ServiceFeatureTable(serviceUri);

            // Define the request mode
            poolsFeatureTable.FeatureRequestMode = FeatureRequestMode.OnInteractionNoCache;

            // Create FeatureLayer that uses the created table
            FeatureLayer poolsFeatureLayer = new FeatureLayer(poolsFeatureTable);

            // Add created layer to the map
            myMap.OperationalLayers.Add(poolsFeatureLayer);

            // Assign the map to the MapView
            MyMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:30,代码来源:ServiceFeatureTableNoCache.xaml.cs

示例7: Process

        protected override void Process(object state)
        {
            Initialize();

            Successful = false;

            if (ReceivedEnvelope != null && ValidateProcessState())
            {
                ProcessRequest();
                Envelope reply = new Envelope()
                {
                    Message = CreateReply(),
                    Ep = ReceivedEnvelope.Ep
                };
                // the msgNr is the next one for this process
                // the convId is the same as the requester's convId
                reply.Message.SetMessageAndConversationNumbers(MessageNumber.Create(), ReceivedEnvelope.Message.ConvId);

                CommSubsystem.Communicator.Send(reply);
                Successful = true;
            }

            if (!Successful)
                ProcessFailure();
            
            Stop();
        }
开发者ID:drewtorg,项目名称:MyDSoak,代码行数:27,代码来源:ResponderRRConversation.cs

示例8: Should_Not_Continue_Processing_If_Processor_Does_Not_Call_Continuation

        public void Should_Not_Continue_Processing_If_Processor_Does_Not_Call_Continuation()
        {
            // create an envelope and context
            Envelope env = new Envelope() { Payload = Encoding.UTF8.GetBytes("Test") };
            EnvelopeContext ctx = new EnvelopeContext(EnvelopeContext.Directions.In, env);

            // mock a transport provider and envelope processor
            Mock<ITransportProvider> txMock = _mocker.Create<ITransportProvider>();
            Mock<IEnvelopeProcessor> procMock = _mocker.Create<IEnvelopeProcessor>();

            // create a processor chain and add the mock processor to it
            List<IEnvelopeProcessor> processorChain = new List<IEnvelopeProcessor>();
            processorChain.Add(procMock.Object);

            // the continuation that, if called, fails the test
            Action continuation = new Action( () =>
                Assert.Fail("The continuation action should not have been called"));

            // this is what we're testing (extended class gives public access to protected method)
            ExtendedDefaultEnvelopeBus bus = new ExtendedDefaultEnvelopeBus(txMock.Object);
            bus.PublicProcessEnvelope(ctx, processorChain, continuation);

            // make sure that the processor was called once
            procMock.Verify(proc => proc.ProcessEnvelope(ctx, It.IsAny<Action>()), Times.Once());

            // and that since it did nothing, the transport provider didn't get the envelope
            txMock.Verify(tx => tx.Send(env), Times.Never());
        }
开发者ID:berico-tpinney,项目名称:AMP,代码行数:28,代码来源:DefaultEnvelopeBusTests.cs

示例9: FindGeoNearPoint

        public static FeatureDataRow FindGeoNearPoint(GeoAPI.Geometries.IPoint point, VectorLayer layer, double amountGrow)
        {
            var box = new Envelope(point.Coordinate);
            box.ExpandBy(amountGrow);

            var fds = new FeatureDataSet();
            layer.DataSource.ExecuteIntersectionQuery(box, fds);

            FeatureDataRow result = null;
            var minDistance = double.MaxValue;

            foreach (FeatureDataTable fdt in fds.Tables)
            {
                foreach (FeatureDataRow fdr in fdt.Rows)
                {
                    if (fdr.Geometry != null)
                    {
                        var distance = point.Distance(fdr.Geometry);
                        if (distance < minDistance)
                        {
                            result = fdr;
                            minDistance = distance;
                        }
                    }
                }
            }

            return result;
        }
开发者ID:haoye1985,项目名称:Oasis-V1.2,代码行数:29,代码来源:GeospatialHelper.cs

示例10: Send

        public async override Task Send(Envelope envelope, params string[] messages)
        {
            await base.Send(envelope, messages);
            

            if (messages == null)
            {
                return;
            }

            foreach (var message in messages.Where(message => !string.IsNullOrWhiteSpace(message)))
            {
                var escapedMessage = WebUtility.HtmlEncode(message);
                var args = JsonConvert.SerializeObject(new
                {
                    username = Robot.Name,
                    channel =
                        string.IsNullOrEmpty(envelope.User.Room)
                            ? envelope.User.Name
                            : _channelMapping.GetValueOrDefault(envelope.User.Room, envelope.User.Room),
                    text = escapedMessage,
                    link_names = _linkNames ? 1 : 0
                });

                await Post("/services/hooks/hubot", args);
            }
        }
开发者ID:kiwidev,项目名称:mmbot,代码行数:27,代码来源:SlackAdapter.cs

示例11: EnvelopeSizeCheck

        public void EnvelopeSizeCheck()
        {
            double w = 0;
            // Measure starting point memory use
            var start = GC.GetTotalMemory(true);

            // Allocate a new array of 100000 Extent classes.
            // If methods don't count, should be about 3,200,000 bytes.
            var memhog = new Envelope[100000];

            for (var i = 0; i < 100000; i++)
            {
                memhog[i] = new Envelope(new Coordinate(0, 0, 0), new Coordinate(1, 1, 1));
            }

            // Obtain measurements after creating the new byte[]
            var end = GC.GetTotalMemory(true);
            Debug.WriteLine("width: " + w);
            var size = (end - start) / 100000;

            // Ensure that the Array stays in memory and doesn't get optimized away
            Debug.WriteLine("Memory size of Extent = " + size);
            // Size of Envelope = 104

        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:25,代码来源:EnvelopeUnitTests.cs

示例12: Initialize

        public override void Initialize()
        {
            FullExtent = new Envelope(-cornerCoordinate, -cornerCoordinate, cornerCoordinate, cornerCoordinate)
            {
                SpatialReference = new SpatialReference(WKID)
            };
            //This layer's spatial reference
            //Set up tile information. Each tile is 256x256px, 19 levels.
            TileInfo = new TileInfo
            {
                Height = 256,
                Width = 256,
                Origin = new MapPoint(-cornerCoordinate, cornerCoordinate) { SpatialReference = new SpatialReference(WKID) },
                Lods = new Lod[6]
            };
            //Set the resolutions for each level. Each level is half the resolution of the previous one.
            var resolution = cornerCoordinate * 2 / 256;
            for (var i = 0; i < TileInfo.Lods.Length; i++)
            {
                TileInfo.Lods[i] = new Lod { Resolution = resolution };
                resolution /= 2;
            }
            //Call base initialize to raise the initialization event
            base.Initialize();

            base.Initialize();
        }
开发者ID:TNOCS,项目名称:csTouch,代码行数:27,代码来源:LocalTileLayer.cs

示例13: ExecuteGeometryReader

 public IGeometryReader ExecuteGeometryReader(SpatialPredicate predicate, Envelope envelope)
 {
     if (predicate != SpatialPredicate.Intersects)
         throw new NotSupportedException();
     
     return new ProviderGeometryReader(_provider.GetGeometriesInView(envelope));
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:7,代码来源:ProviderProxy.cs

示例14: WorldFileLoaded

        private void WorldFileLoaded(object sender, DownloadStringCompletedEventArgs e)
        {
            //Checks to see if there was an error
            if (e.Error == null)
            {
                //grab the data from the world file
                string myData = e.Result;
                //split string into an array based on new line characters
                string[] lines = myData.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
                //convert the strings into doubles
                double[] coordValues = new double[6];
                for(int i = 0; i < 6; i++) {
                    coordValues[i] = Convert.ToDouble(lines[i]);
                }
                //calculate the pixel height and width in real world coordinates
                double pixelWidth = Math.Sqrt(Math.Pow(coordValues[0], 2) + Math.Pow(coordValues[1], 2));
                double pixelHeight = Math.Sqrt(Math.Pow(coordValues[2], 2) + Math.Pow(coordValues[3], 2));

                //Create a map point for the top left and bottom right
                MapPoint topLeft = new MapPoint(coordValues[4], coordValues[5]);
                MapPoint bottomRight = new MapPoint(coordValues[4] + (pixelWidth * imageWidth), coordValues[5] + (pixelHeight * imageHeight));
                //create an envelope for the elmently layer
                Envelope extent = new Envelope(topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y);
                ElementLayer.SetEnvelope(image, extent);
                //Zoom to the extent of the image
                MyMap.Extent = extent;
            }
        }
开发者ID:ApexGIS,项目名称:developer-support,代码行数:28,代码来源:MainPage.xaml.cs

示例15: Send

        public void Send(object message, IDictionary<string, string> headers)
        {
            // create an envelope for the message
            Envelope newEnvelope = new Envelope();
            newEnvelope.Headers = headers ?? new Dictionary<string, string>();

            // create a message context for message processing
            MessageContext ctx = new MessageContext(
                MessageContext.Directions.Out, newEnvelope, message);

            // process the message
            this.ProcessMessage(ctx, () =>
            {
                try
                {
                    _envelopeSender.Send(ctx.Envelope);
                }
                catch (Exception ex)
                {
                    string msg = "Failed to send an envelope.";
                    Log.Error(msg, ex);
                    throw new MessageException(msg, ex);
                }
            });
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:25,代码来源:MessageSender.cs


注:本文中的Envelope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。