public virtual void TestPoint() { string s = " PoInT emPty "; com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); wktParser.ResetParser(s); int currentToken; double value; currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.point); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); s = " POINT ZM ( 5. +1.e+0004 13 17) "; wktParser.ResetParser(s); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.point); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_zm); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 5.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 1.0e4); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.not_available); s = " PoInt "; wktParser.ResetParser(s); wktParser.NextToken(); }
public virtual void TestMultiPolygon() { string s = " MultIPolYgOn emPty "; com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); wktParser.ResetParser(s); int currentToken; double value; currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.multipolygon); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); s = " MULTIpolyGON zM ( empty , ( empty, ( 5. +1.e+0004 13 17, -.1e07 .006 13 17 ) , empty , (4 003. 13 17, 02E-3 .3e2 13 17) ) , empty, ( ( 5. +1.e+0004 13 17, -.1e07 .006 13 17) , (4 003. 13 17 , 02E-3 .3e2 13 17) ) ) "; wktParser.ResetParser(s); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.multipolygon); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_zm); // Start first polygon currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 5.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 1.0e4); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == -0.1e7); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.006); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 4.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 3.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 2.0e-3); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.3e2); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); // End of First polygon // Start Second Polygon currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 5.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 1.0e4); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == -0.1e7); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.006); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 4.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 3.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 2.0e-3); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.3e2); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.not_available); }
public virtual void TestLineString() { string s = " LineString emPty "; com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); wktParser.ResetParser(s); int currentToken; double value; currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.linestring); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); s = " LineString ( 5. +1.e+0004 , -.1e07 .006 ) "; wktParser.ResetParser(s); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.linestring); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 5.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 1.0e4); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == -0.1e7); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.006); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.not_available); }
public virtual void TestGeometryCollection() { string s = " geometrycollection emPty "; com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); wktParser.ResetParser(s); int currentToken; double value; currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.geometrycollection); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.not_available); s = " geometrycollection zm ( geometrycollection zm ( POINT ZM ( 5. +1.e+0004 13 17) ), LineString zm emPty, MULTIpolyGON zM (((1 1 1 1))) ) "; wktParser.ResetParser(s); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.geometrycollection); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_zm); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.geometrycollection); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_zm); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.point); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_zm); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 5.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 1.0e4); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 17); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.linestring); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_zm); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.multipolygon); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_zm); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.z_literal); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.not_available); }
public virtual void TestPolygon() { string s = " Polygon emPty "; com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); wktParser.ResetParser(s); int currentToken; double value; currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.polygon); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); s = " polyGON M ( empty, ( 5. +1.e+0004 13, -.1e07 .006 13 ) , empty , (4 003. 13 , 02E-3 .3e2 13 ) , empty, ( 5. +1.e+0004 13 , -.1e07 .006 13) , (4 003. 13 , 02E-3 .3e2 13 ) ) "; wktParser.ResetParser(s); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.polygon); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.attribute_m); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 5.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 1.0e4); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == -0.1e7); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.006); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 4.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 3.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 2.0e-3); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.3e2); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.empty); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 5.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 1.0e4); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == -0.1e7); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.006); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.left_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 4.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 3.0); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.x_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 2.0e-3); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.y_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 0.3e2); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.m_literal); value = wktParser.CurrentNumericLiteral(); NUnit.Framework.Assert.IsTrue(value == 13); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.right_paren); currentToken = wktParser.NextToken(); NUnit.Framework.Assert.IsTrue(currentToken == com.esri.core.geometry.WktParser.WktToken.not_available); }
public static void TestImportExportWktMultiPolygon() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); com.esri.core.geometry.OperatorExportToWkt exporterWKT = (com.esri.core.geometry.OperatorExportToWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ExportToWkt); com.esri.core.geometry.Polygon polygon; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); // Test Import from MultiPolygon wktString = "Multipolygon M empty"; polygon = (com.esri.core.geometry.Polygon)importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.IsEmpty()); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); polygon = (com.esri.core.geometry.Polygon)com.esri.core.geometry.GeometryEngine.GeometryFromWkt(wktString, 0, com.esri.core.geometry.Geometry.Type.Unknown); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.IsEmpty()); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(0, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON M EMPTY")); wktString = com.esri.core.geometry.GeometryEngine.GeometryToWkt(polygon, 0); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON M EMPTY")); wktString = "Multipolygon Z (empty, (empty, (10 10 5, 20 10 5, 20 20 5, 10 20 5, 10 10 5), (12 12 3), empty, (10 10 1, 12 12 1)), empty, ((90 90 88, 60 90 7, 60 60 7), empty, (70 70 7, 80 80 7, 70 80 7, 70 70 7)), empty)"; polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); polygon.QueryEnvelope2D(envelope); NUnit.Framework.Assert.IsTrue(envelope.xmin == 10 && envelope.xmax == 90 && envelope.ymin == 10 && envelope.ymax == 90); NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() == 14); NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == 5); // assertTrue(polygon.calculate_area_2D() > 0.0); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); double z = polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0); NUnit.Framework.Assert.IsTrue(z == 5); // Test Export to WKT MultiPolygon wktString = exporterWKT.Execute(0, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z (((10 10 5, 20 10 5, 20 20 5, 10 20 5, 10 10 5), (12 12 3, 12 12 3, 12 12 3), (10 10 1, 12 12 1, 10 10 1)), ((90 90 88, 60 90 7, 60 60 7, 90 90 88), (70 70 7, 70 80 7, 80 80 7, 70 70 7)))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } // Test import Polygon wktString = "POLYGON z (EMPTY, EMPTY, (10 10 5, 10 20 5, 20 20 5, 20 10 5), (12 12 3), EMPTY, (10 10 1, 12 12 1), EMPTY, (60 60 7, 60 90 7, 90 90 7, 60 60 7), EMPTY, (70 70 7, 70 80 7, 80 80 7), EMPTY)"; polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() == 14); NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == 5); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); // Test Export to WKT Polygon wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPolygon, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POLYGON Z ((10 10 5, 20 10 5, 20 20 5, 10 20 5, 10 10 5), (12 12 3, 12 12 3, 12 12 3), (10 10 1, 12 12 1, 10 10 1), (60 60 7, 60 90 7, 90 90 7, 60 60 7), (70 70 7, 70 80 7, 80 80 7, 70 70 7))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(); env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z); polygon.QueryEnvelope(env); wktString = exporterWKT.Execute(0, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POLYGON Z ((10 10 1, 90 10 7, 90 90 1, 10 90 7, 10 10 1))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPolygon, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z (((10 10 1, 90 10 7, 90 90 1, 10 90 7, 10 10 1)))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } env.SetEmpty(); wktString = exporterWKT.Execute(0, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POLYGON Z EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPolygon, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = "MULTIPOLYGON (((5 10, 8 10, 10 10, 10 0, 0 0, 0 10, 2 10, 5 10)))"; // ring // is // oriented // clockwise polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.CalculateArea2D() > 0); wktString = "MULTIPOLYGON Z (((90 10 7, 10 10 1, 10 90 7, 90 90 1, 90 10 7)))"; // ring // is // oriented // clockwise polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() == 4); NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == 1); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(polygon.CalculateArea2D() > 0); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPolygon, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z (((90 10 7, 90 90 1, 10 90 7, 10 10 1, 90 10 7)))")); }
public static void TestImportExportWktPoint() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); com.esri.core.geometry.OperatorExportToWkt exporterWKT = (com.esri.core.geometry.OperatorExportToWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ExportToWkt); com.esri.core.geometry.Point point; string wktString; com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); // Test Import from Point wktString = "Point ZM empty"; point = (com.esri.core.geometry.Point)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(point != null); NUnit.Framework.Assert.IsTrue(point.IsEmpty()); NUnit.Framework.Assert.IsTrue(point.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(point.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(0, point, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POINT ZM EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPoint, point, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ZM EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = "Point zm (30.1 10.6 5.1 33.1)"; point = (com.esri.core.geometry.Point)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(point != null); NUnit.Framework.Assert.IsTrue(point.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(point.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); double x = point.GetX(); double y = point.GetY(); double z = point.GetZ(); double m = point.GetM(); NUnit.Framework.Assert.IsTrue(x == 30.1); NUnit.Framework.Assert.IsTrue(y == 10.6); NUnit.Framework.Assert.IsTrue(z == 5.1); NUnit.Framework.Assert.IsTrue(m == 33.1); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPrecision15, point, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POINT ZM (30.1 10.6 5.1 33.1)")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPoint | com.esri.core.geometry.WktExportFlags.wktExportPrecision15, point, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ZM ((30.1 10.6 5.1 33.1))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } }
public static void TestImportExportWktMultiPoint() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); com.esri.core.geometry.OperatorExportToWkt exporterWKT = (com.esri.core.geometry.OperatorExportToWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ExportToWkt); com.esri.core.geometry.MultiPoint multipoint; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); // Test Import from Multi_point wktString = " MultiPoint ZM empty"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(multipoint != null); NUnit.Framework.Assert.IsTrue(multipoint.IsEmpty()); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(0, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ZM EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPoint, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POINT ZM EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } multipoint = new com.esri.core.geometry.MultiPoint(); multipoint.Add(118.15114354234563, 33.82234433423462345); multipoint.Add(88, 88); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPrecision10, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ((118.1511435 33.82234433), (88 88))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } multipoint = new com.esri.core.geometry.MultiPoint(); multipoint.Add(88, 2); multipoint.Add(88, 88); wktString = exporterWKT.Execute(0, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ((88 2), (88 88))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = "Multipoint zm (empty, empty, (10 88 88 33), (10 20 5 33), (20 20 5 33), (20 10 5 33), (12 12 3 33), empty, (10 10 1 33), (12 12 1 33), empty, (60 60 7 33), (60 90.1 7 33), (90 90 7 33), empty, (70 70 7 33), (70 80 7 33), (80 80 7 33), empty)"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(multipoint != null); multipoint.QueryEnvelope2D(envelope); // assertTrue(envelope.xmin == 10 && envelope.xmax == 90 && // envelope.ymin == 10 && Math.abs(envelope.ymax - 90.1) <= 0.001); NUnit.Framework.Assert.IsTrue(multipoint.GetPointCount() == 13); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = "Multipoint zm (10 88 88 33, 10 20 5 33, 20 20 5 33, 20 10 5 33, 12 12 3 33, 10 10 1 33, 12 12 1 33, 60 60 7 33, 60 90.1 7 33, 90 90 7 33, 70 70 7 33, 70 80 7 33, 80 80 7 33)"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(multipoint != null); // assertTrue(envelope.xmin == 10 && envelope.xmax == 90 && // envelope.ymin == 10 && ::fabs(envelope.ymax - 90.1) <= 0.001); NUnit.Framework.Assert.IsTrue(multipoint.GetPointCount() == 13); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPrecision15, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ZM ((10 88 88 33), (10 20 5 33), (20 20 5 33), (20 10 5 33), (12 12 3 33), (10 10 1 33), (12 12 1 33), (60 60 7 33), (60 90.1 7 33), (90 90 7 33), (70 70 7 33), (70 80 7 33), (80 80 7 33))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = "Multipoint zm (empty, empty, (10 10 5 33))"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPoint, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POINT ZM (10 10 5 33)")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } }
public static void TestImportExportWktMultiLineString() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); com.esri.core.geometry.OperatorExportToWkt exporterWKT = (com.esri.core.geometry.OperatorExportToWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ExportToWkt); com.esri.core.geometry.Polyline polyline; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); // Test Import from MultiLineString wktString = "MultiLineStringZMempty"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline != null); NUnit.Framework.Assert.IsTrue(polyline.IsEmpty()); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = "MultiLineStringm(empty, empty, (10 10 5, 10 20 5, 20 88 5, 20 10 5), (12 88 3), empty, (10 10 1, 12 12 1), empty, (88 60 7, 60 90 7, 90 90 7), empty, (70 70 7, 70 80 7, 80 80 7), empty)"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline != null); polyline.QueryEnvelope2D(envelope); NUnit.Framework.Assert.IsTrue(envelope.xmin == 10 && envelope.xmax == 90 && envelope.ymin == 10 && envelope.ymax == 90); NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == 14); NUnit.Framework.Assert.IsTrue(polyline.GetPathCount() == 5); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(0, polyline, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTILINESTRING M ((10 10 5, 10 20 5, 20 88 5, 20 10 5), (12 88 3, 12 88 3), (10 10 1, 12 12 1), (88 60 7, 60 90 7, 90 90 7), (70 70 7, 70 80 7, 80 80 7))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } // Test Import LineString wktString = "Linestring Z(10 10 5, 10 20 5, 20 20 5, 20 10 5)"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == 4); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportLineString, polyline, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("LINESTRING Z (10 10 5, 10 20 5, 20 20 5, 20 10 5)")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(0, polyline, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTILINESTRING Z ((10 10 5, 10 20 5, 20 20 5, 20 10 5))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } }