コード例 #1
0
		public virtual void TestBufferPoint()
		{
			com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326);
			com.esri.core.geometry.Point inputGeom = new com.esri.core.geometry.Point(12, 120);
			com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Buffer);
			com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Simplify);
			com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 40.0, null);
			NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
			com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)result;
			int pathCount = poly.GetPathCount();
			NUnit.Framework.Assert.IsTrue(pathCount == 1);
			int pointCount = poly.GetPointCount();
			NUnit.Framework.Assert.IsTrue(System.Math.Abs(pointCount - 100.0) < 10);
			com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
			result.QueryEnvelope2D(env2D);
			NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() - 80) < 0.01 && System.Math.Abs(env2D.GetHeight() - 80) < 0.01);
			NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 12) < 0.001 && System.Math.Abs(env2D.GetCenterY() - 120) < 0.001);
			com.esri.core.geometry.NonSimpleResult nsr = new com.esri.core.geometry.NonSimpleResult();
			bool is_simple = simplify.IsSimpleAsFeature(result, sr, true, nsr, null);
			NUnit.Framework.Assert.IsTrue(is_simple);
			{
				result = buffer.Execute(inputGeom, sr, 0, null);
				NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
				NUnit.Framework.Assert.IsTrue(result.IsEmpty());
			}
			{
				result = buffer.Execute(inputGeom, sr, -1, null);
				NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon);
				NUnit.Framework.Assert.IsTrue(result.IsEmpty());
			}
		}
コード例 #2
0
        public virtual void testBufferPoint()
        {
            com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference
                                                         .create(4326);
            com.esri.core.geometry.Point inputGeom = new com.esri.core.geometry.Point(12, 120
                                                                                      );
            com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer
                                                            )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                                   .Buffer);
            com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify
                                                                )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type
                                                                                                                                       .Simplify);
            com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 40.0, null
                                                                    );
            NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                          .Polygon);
            com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)result;
            int pathCount = poly.getPathCount();

            NUnit.Framework.Assert.IsTrue(pathCount == 1);
            int pointCount = poly.getPointCount();

            NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 100.0) < 10);
            com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D();
            result.queryEnvelope2D(env2D);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 80) < 0.01 && System.Math
                                          .abs(env2D.getHeight() - 80) < 0.01);
            NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 12) < 0.001 &&
                                          System.Math.abs(env2D.getCenterY() - 120) < 0.001);
            com.esri.core.geometry.NonSimpleResult nsr = new com.esri.core.geometry.NonSimpleResult
                                                             ();
            bool is_simple = simplify.isSimpleAsFeature(result, sr, true, nsr, null);

            NUnit.Framework.Assert.IsTrue(is_simple);
            {
                result = buffer.execute(inputGeom, sr, 0, null);
                NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                              .Polygon);
                NUnit.Framework.Assert.IsTrue(result.isEmpty());
            }
            {
                result = buffer.execute(inputGeom, sr, -1, null);
                NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType
                                              .Polygon);
                NUnit.Framework.Assert.IsTrue(result.isEmpty());
            }
        }
コード例 #3
0
		public virtual void TestMultiPointSR4326_CR184439()
		{
			com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance();
			com.esri.core.geometry.OperatorSimplify simpOp = (com.esri.core.geometry.OperatorSimplify)engine.GetOperator(com.esri.core.geometry.Operator.Type.Simplify);
			com.esri.core.geometry.NonSimpleResult nonSimpResult = new com.esri.core.geometry.NonSimpleResult();
			nonSimpResult.m_reason = com.esri.core.geometry.NonSimpleResult.Reason.NotDetermined;
			com.esri.core.geometry.MultiPoint multiPoint = new com.esri.core.geometry.MultiPoint();
			multiPoint.Add(0, 0);
			multiPoint.Add(0, 1);
			multiPoint.Add(0, 0);
			bool multiPointIsSimple = simpOp.IsSimpleAsFeature(multiPoint, com.esri.core.geometry.SpatialReference.Create(4326), true, nonSimpResult, null);
			NUnit.Framework.Assert.IsFalse(multiPointIsSimple);
			NUnit.Framework.Assert.IsTrue(nonSimpResult.m_reason == com.esri.core.geometry.NonSimpleResult.Reason.Clustering);
			NUnit.Framework.Assert.IsTrue(nonSimpResult.m_vertexIndex1 == 0);
			NUnit.Framework.Assert.IsTrue(nonSimpResult.m_vertexIndex2 == 2);
		}
コード例 #4
0
		public virtual void TestisSimpleOGC()
		{
			com.esri.core.geometry.Polyline poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(0, 0);
			poly.LineTo(10, 0);
			bool result = simplifyOpOGC.IsSimpleOGC(poly, sr4326, true, null, null);
			NUnit.Framework.Assert.IsTrue(result);
			poly = new com.esri.core.geometry.Polyline();
			poly.StartPath(0, 0);
			poly.LineTo(10, 10);
			poly.LineTo(0, 10);
			poly.LineTo(10, 0);
			com.esri.core.geometry.NonSimpleResult nsr = new com.esri.core.geometry.NonSimpleResult();
			result = simplifyOpOGC.IsSimpleOGC(poly, sr4326, true, nsr, null);
			NUnit.Framework.Assert.IsTrue(!result);
			NUnit.Framework.Assert.IsTrue(nsr.m_reason == com.esri.core.geometry.NonSimpleResult.Reason.Cracking);
			com.esri.core.geometry.MultiPoint mp = new com.esri.core.geometry.MultiPoint();
			mp.Add(0, 0);
			mp.Add(10, 0);
			result = simplifyOpOGC.IsSimpleOGC(mp, sr4326, true, null, null);
			NUnit.Framework.Assert.IsTrue(result);
			mp = new com.esri.core.geometry.MultiPoint();
			mp.Add(10, 0);
			mp.Add(10, 0);
			nsr = new com.esri.core.geometry.NonSimpleResult();
			result = simplifyOpOGC.IsSimpleOGC(mp, sr4326, true, nsr, null);
			NUnit.Framework.Assert.IsTrue(!result);
			NUnit.Framework.Assert.IsTrue(nsr.m_reason == com.esri.core.geometry.NonSimpleResult.Reason.Clustering);
		}