public void TestMultipatchConversionWithTriangleStrip()
        {
            Rectangular[] positions = new[]
                                          {
                                              new Rectangular(0.0, 0.0),
                                              new Rectangular(0.0, 1.0),
                                              new Rectangular(1.0, 0.0),
                                              new Rectangular(1.0, 1.0),
                                              new Rectangular(2.0, 0.0),
                                              new Rectangular(2.0, 1.0),
                                              new Rectangular(3.0, 0.0)
                                          };

            CartographicExtent extent = new CartographicExtent(0.0, 0.0, 3.0, 1.0);
            int[] parts = new[] { 0 };
            MultiPatchPartType[] partTypes = new[] { MultiPatchPartType.TriangleStrip };

            double[] zValues = new[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 };
            double[] measures = new[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

            MultiPatchShape multipatch = new MultiPatchShape(0, m_metadata, extent, parts, partTypes, positions, 0.0, 0.0, zValues, 0.0, 0.0, measures);
            MultiPatch patch = new MultiPatch(multipatch, m_document, Color.Blue);
            patch.Write();
            string result = m_stringWriter.ToString();
            Regex trianglePattern = new Regex(m_trianglePattern);
            Assert.AreEqual(5, trianglePattern.Matches(result).Count);
        }
        public void TestMultipatchConversionWithInnerAndOuterRings()
        {
            Rectangular[] positions = new[]
                                          {
                                              new Rectangular(0.0, 5.0),
                                              new Rectangular(5.0, 10.0),
                                              new Rectangular(10.0, 5.0),
                                              new Rectangular(5.0, 0.0),
                                              new Rectangular(0.0, 5.0),
                                              new Rectangular(2.0, 5.0),
                                              new Rectangular(5.0, 2.0),
                                              new Rectangular(8.0, 5.0),
                                              new Rectangular(5.0, 8.0),
                                              new Rectangular(2.0, 5.0)
                                          };

            CartographicExtent extent = new CartographicExtent(0.0, 0.0, 10.0, 10.0);
            int[] parts = new[] { 0, 5 };
            MultiPatchPartType[] partTypes = new[] { MultiPatchPartType.OuterRing, MultiPatchPartType.InnerRing };

            double[] zValues = new[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
            double[] measures = new[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

            MultiPatchShape multipatch = new MultiPatchShape(0, m_metadata, extent, parts, partTypes, positions, 0.0, 0.0, zValues, 0.0, 0.0, measures);
            MultiPatch patch = new MultiPatch(multipatch, m_document, Color.Blue);
            patch.Write();
            string result = m_stringWriter.ToString();
            Assert.IsTrue(Regex.IsMatch(result, m_polygonPattern));
        }
        public void TestMultipatchConversionWithMultipleRings()
        {
            Rectangular[] positions = new[]
                                          {
                                              new Rectangular(0.0, 5.0),
                                              new Rectangular(5.0, 10.0),
                                              new Rectangular(10.0, 5.0),
                                              new Rectangular(5.0, 0.0),
                                              new Rectangular(0.0, 5.0),
                                              new Rectangular(2.0, 5.0),
                                              new Rectangular(5.0, 2.0),
                                              new Rectangular(8.0, 5.0),
                                              new Rectangular(5.0, 8.0),
                                              new Rectangular(2.0, 5.0)
                                          };

            CartographicExtent extent = new CartographicExtent(0.0, 0.0, 10.0, 10.0);
            int[] parts = new[] { 0, 5 };
            MultiPatchPartType[] partTypes = new[] { MultiPatchPartType.Ring, MultiPatchPartType.Ring };

            double[] zValues = new[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
            double[] measures = new[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

            MultiPatchShape multipatch = new MultiPatchShape(0, m_metadata, extent, parts, partTypes, positions, 0.0, 0.0, zValues, 0.0, 0.0, measures);
            MultiPatch patch = new MultiPatch(multipatch, m_document, Color.Blue);
            patch.Write();
            string result = m_stringWriter.ToString();
            Regex polygonPattern = new Regex(m_polygonPattern);
            Assert.AreEqual(2, polygonPattern.Matches(result).Count);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Constructs a new multipatch <see cref="CzmlShape"/> from a <see cref="MultiPatchShape"/>.
 /// </summary>
 /// <param name="multiPatch">The shapefile multipatch shape</param>.
 /// <param name="document">The <see cref="CzmlDocument"/> to which the shape's CZML is written.</param>
 /// <param name="color">A color for the shape's visualization.</param>
 public MultiPatch(MultiPatchShape multiPatch, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = multiPatch;
 }