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


C# GeometryFactory.CreatePoint方法代码示例

本文整理汇总了C#中NetTopologySuite.Geometries.GeometryFactory.CreatePoint方法的典型用法代码示例。如果您正苦于以下问题:C# GeometryFactory.CreatePoint方法的具体用法?C# GeometryFactory.CreatePoint怎么用?C# GeometryFactory.CreatePoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NetTopologySuite.Geometries.GeometryFactory的用法示例。


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

示例1: main

		public static void main(string[] args)
		{
			// create a factory using default values (e.g. floating precision)
			GeometryFactory fact = new GeometryFactory();
			
			IPoint p1 = fact.CreatePoint(new Coordinate(0, 0));
			Console.WriteLine(p1);
			
			IPoint p2 = fact.CreatePoint(new Coordinate(1, 1));
			Console.WriteLine(p1);
			
			IMultiPoint mpt = fact.CreateMultiPoint(new Coordinate[]{ new Coordinate(0, 0), new Coordinate(1, 1), });
			Console.WriteLine(mpt);
		}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:14,代码来源:constructionexample.cs

示例2: FormMovingObjectOverTileLayer_Load

        private void FormMovingObjectOverTileLayer_Load(object sender, EventArgs e)
        {

            //Lisbon...
#if DotSpatialProjections
            var mathTransform = LayerTools.Wgs84toGoogleMercator;
            var geom = GeometryTransform.TransformBox(
                new Envelope(-9.205626, -9.123736, 38.690993, 38.740837),
                mathTransform.Source, mathTransform.Target);
#else
            var mathTransform = LayerTools.Wgs84toGoogleMercator.MathTransform;
            GeoAPI.Geometries.Envelope geom = GeometryTransform.TransformBox(
                new Envelope(-9.205626, -9.123736, 38.690993, 38.740837),
                mathTransform);
#endif


            //Google Background
            TileAsyncLayer layer2 = new TileAsyncLayer(new OsmTileSource(), "TileLayer - OSM");


            this.mapBox1.Map.BackgroundLayer.Add(layer2);
            var gf = new GeometryFactory(new PrecisionModel(), 3857);

            //Adds a static layer
            var staticLayer = new VectorLayer("Fixed Marker");
            //position = geom.GetCentroid();
            var aux = new List<IGeometry>();
            aux.Add(gf.CreatePoint(geom.Centre));
            staticLayer.Style.Symbol = Resources.PumpSmall;
            var geoProviderFixed = new SharpMap.Data.Providers.FeatureProvider(aux);
            staticLayer.DataSource = geoProviderFixed;
            this.mapBox1.Map.Layers.Add(staticLayer);

            
            //Adds a moving variable layer
            VectorLayer pushPinLayer = new VectorLayer("PushPins");
            position = geom.Centre;
            geos.Add(gf.CreatePoint(position));
            pushPinLayer.Style.Symbol = Resources.OutfallSmall;
            var geoProvider = new SharpMap.Data.Providers.FeatureProvider(geos);
            pushPinLayer.DataSource = geoProvider;
            this.mapBox1.Map.VariableLayers.Add(pushPinLayer);

            this.mapBox1.Map.ZoomToBox(geom);
            this.mapBox1.Refresh();

        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:48,代码来源:FormMovingObjectOverTileLayer.cs

示例3: Form2_Load

        private void Form2_Load(object sender, EventArgs e)
        {
            //TileAsyncLayer osmLayer= new TileAsyncLayer(new OsmTileSource(), "TileLayer - OSM");
            TileAsyncLayer bingLayer = new TileAsyncLayer(new BingTileSource(BingRequest.UrlBing, "", BingMapType.Roads), "TileLayer - Bing");

            this.mapBox1.Map.BackgroundLayer.Add(bingLayer);
            GeometryFactory gf = new GeometryFactory(new PrecisionModel(), 3857);

#if DotSpatialProjections
            var mathTransform = LayerTools.Wgs84toGoogleMercator;
            var geom = GeometryTransform.TransformBox(
                new Envelope(-9.205626, -9.123736, 38.690993, 38.740837), 
                mathTransform.Source, mathTransform.Target);
#else
            IMathTransform mathTransform = LayerTools.Wgs84toGoogleMercator.MathTransform;
            Envelope geom = GeometryTransform.TransformBox(
                new Envelope(-9.205626, -9.123736, 38.690993, 38.740837),
                mathTransform);
#endif

            //Adds a pushpin layer
            VectorLayer pushPinLayer = new VectorLayer("PushPins");
            List<IGeometry> geos = new List<IGeometry>();
            geos.Add(gf.CreatePoint(geom.Centre));
            var geoProvider = new FeatureProvider(geos);
            pushPinLayer.DataSource = geoProvider;
            //this.mapBox1.Map.Layers.Add(pushPinLayer);

            this.mapBox1.Map.ZoomToBox(geom);
            this.mapBox1.Map.Zoom = 8500;
            this.mapBox1.Refresh();
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:32,代码来源:Form2.cs

示例4: TestCopyGeometryWithNonDefaultDimension

        public void TestCopyGeometryWithNonDefaultDimension()
        {
            GeometryFactory gf = new GeometryFactory(CoordinateArraySequenceFactory.Instance);
            ICoordinateSequence mpSeq = gf.CoordinateSequenceFactory.Create(1, 2);
            mpSeq.SetOrdinate(0, Ordinate.X, 50);
            mpSeq.SetOrdinate(0, Ordinate.Y, -2);

            IPoint g = gf.CreatePoint(mpSeq);
            IPoint geometryN = (IPoint)g.GetGeometryN(0);
            ICoordinateSequence gSeq = geometryN.CoordinateSequence;
            Assert.AreEqual(2, gSeq.Dimension);

            IPoint g2 = (IPoint)Factory.CreateGeometry(g);
            ICoordinateSequence g2Seq = g2.CoordinateSequence;
            Assert.AreEqual(2, g2Seq.Dimension);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:16,代码来源:GeometryFactoryTest.cs

示例5: CreateGeometryLayer

    public VectorLayer CreateGeometryLayer()
    {
        var gf = new NetTopologySuite.Geometries.GeometryFactory();
        var fdt = new FeatureDataTable();
        fdt.Columns.Add(new DataColumn("Name", typeof (String)));

        fdt.BeginLoadData();
        var fdr = (FeatureDataRow)fdt.LoadDataRow(new[] {(object) "Mayence"}, true);
        fdr.Geometry = gf.CreatePoint(new Point(8.1, 50.0));
        fdt.EndLoadData();

        var vLayer = new VectorLayer("GeometryProvider");
        vLayer.DataSource = new FeatureProvider(fdt);
        vLayer.SRID = 4326;

        return vLayer;
    }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:17,代码来源:GeometryFeature.aspx.cs

示例6: TestReadLargeNumbers

 public void TestReadLargeNumbers()
 {
     var precisionModel = new PrecisionModel(1E9);
     var geometryFactory = new GeometryFactory(precisionModel, 0);
     var reader = new WKTReader(geometryFactory);
     var point1 = reader.Read("POINT (123456789.01234567890 10)");
     var point2 = geometryFactory.CreatePoint(new Coordinate(123456789.01234567890, 10));
     Assert.AreEqual(point1.Coordinate.X, point2.Coordinate.X, 1E-7);
     Assert.AreEqual(point1.Coordinate.Y, point2.Coordinate.Y, 1E-7);
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:10,代码来源:WKTReaderTest.cs

示例7: TestWrite3D

 public void TestWrite3D()
 {
     IGeometryFactory geometryFactory = new GeometryFactory();
     IPoint point = geometryFactory.CreatePoint(new Coordinate(1, 1, 1));
     String wkt = _writer3D.Write(point);
     Assert.AreEqual("POINT (1 1 1)", wkt);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:7,代码来源:WKTWriterTest.cs

示例8: TestWriteLargeNumbers3

 public void TestWriteLargeNumbers3()
 {
     IPrecisionModel precisionModel = new PrecisionModel(1E9);
     IGeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
     IPoint point1 = geometryFactory.CreatePoint(new Coordinate(123456789012345678000000E9d, 10E9));
     Assert.AreEqual(123456789012345690000000000000000d, point1.X);
     Assert.AreEqual(10000000000d, point1.Y);
     Assert.AreNotEqual("POINT (123456789012345690000000000000000 10000000000)", point1.AsText());
     Assert.AreEqual("POINT (123456789012346000000000000000000 10000000000)", point1.AsText());
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:10,代码来源:WKTWriterTest.cs

示例9: TestWriteLargeNumbers2

 public void TestWriteLargeNumbers2()
 {
     IPrecisionModel precisionModel = new PrecisionModel(1E9);
     IGeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
     IPoint point1 = geometryFactory.CreatePoint(new Coordinate(1234d, 10E9));
     Assert.AreEqual("POINT (1234 10000000000)", point1.AsText());
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:7,代码来源:WKTWriterTest.cs

示例10: AddVectorLayers

        /// <summary>        
        /// /// Add a list of vector layers to the map.
        /// </summary>
        /// <param name="vectorLayers"></param>
        public void AddVectorLayers(List<FeatureInfo> vectorLayers)
        {
            int counter = 0;
            if (vectorLayers == null) return;
            vectorLayers.ForEach(layer => {

                VectorLayer vectorLayer = new VectorLayer("VectorLayer-" + counter);
                GeometryFactory factory = new GeometryFactory();
                List<IGeometry> geometries = new List<IGeometry>();

                FeatureDataTable featureData = new FeatureDataTable();
                featureData.Columns.Add("text", typeof(String));
                featureData.Columns.Add("style", typeof(MapExport.Style));

                layer.features.ForEach(feature =>
                {
                    FeatureDataRow dataRow = featureData.NewRow();
                    dataRow["text"] = feature.attributes.text;
                    dataRow["style"] = feature.attributes.style;

                    List<GeoAPI.Geometries.Coordinate> vertices = new List<GeoAPI.Geometries.Coordinate>();

                    feature.coordinates.ForEach(coordinate =>
                    {
                        double x = coordinate[0];
                        double y = coordinate[1];
                        vertices.Add((new GeoAPI.Geometries.Coordinate(x, y)));
                    });

                    switch (feature.type)
                    {
                        case "Text":
                        case "Point":
                            if (vertices.Count > 0)
                            {
                                var point = factory.CreatePoint(new GeoAPI.Geometries.Coordinate(vertices[0]));
                                dataRow.Geometry = point;
                            }
                            break;
                        case "LineString":
                            var lineString = factory.CreateLineString(vertices.ToArray());
                            dataRow.Geometry = lineString;
                            break;
                        case "Polygon":
                            var polygon = factory.CreatePolygon(vertices.ToArray());
                            dataRow.Geometry = polygon;
                            break;
                    }

                    featureData.AddRow(dataRow);
                });

                vectorLayer.DataSource = new SharpMap.Data.Providers.GeometryFeatureProvider(featureData);
                //vectorLayer.DataSource = new SharpMap.Data.Providers.FeatureProvider(featureData);

                //vectorLayer.Theme = new CustomTheme(GetFeatureStyle);
                vectorLayer.Theme = new CustomTheme(GetFeatureStyle);
                map.Layers.Add(vectorLayer);

                LabelLayer labels = new LabelLayer("Labels");

                labels.DataSource = vectorLayer.DataSource;
                labels.Enabled = true;
                labels.LabelColumn = "text";
                labels.Theme = new CustomTheme(GetLabelStyle);
                labels.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                labels.SmoothingMode = SmoothingMode.HighQuality;
                labels.SRID = vectorLayer.SRID;

                map.Layers.Add(labels);
                counter++;
            });
        }
开发者ID:Johkar,项目名称:Hajk2,代码行数:77,代码来源:MapExporter.cs


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