Beispiel #1
0
 public static void createLinkedLoop(
     ref LinkedGeo.LinkedGeoLoop loop, List <GeoCoord> verts, int numVerts)
 {
     loop = new LinkedGeo.LinkedGeoLoop();
     for (int i = 0; i < numVerts; i++)
     {
         var vi = verts[i];
         LinkedGeo.addLinkedCoord(ref loop, ref vi);
     }
 }
Beispiel #2
0
        public void createLinkedGeo()
        {
            LinkedGeo.LinkedGeoPolygon polygon = new LinkedGeo.LinkedGeoPolygon();
            LinkedGeo.LinkedGeoLoop    loop    = new LinkedGeo.LinkedGeoLoop();
            LinkedGeo.LinkedGeoCoord   coord   = new LinkedGeo.LinkedGeoCoord();

            loop = LinkedGeo.addNewLinkedLoop(ref polygon);
            Assert.True(loop != null, "Loop created");
            coord = LinkedGeo.addLinkedCoord(ref loop, ref vertex1);
            Assert.True(coord != null, "Coord created");
            coord = LinkedGeo.addLinkedCoord(ref loop, ref vertex2);
            Assert.True(coord != null, "Coord created");
            coord = LinkedGeo.addLinkedCoord(ref loop, ref vertex3);
            Assert.True(coord != null, "Coord created");

            loop = LinkedGeo.addNewLinkedLoop(ref polygon);
            Assert.True(loop != null, "Loop createed");
            coord = LinkedGeo.addLinkedCoord(ref loop, ref vertex2);
            Assert.True(coord != null, "Coord created");
            coord = LinkedGeo.addLinkedCoord(ref loop, ref vertex4);
            Assert.True(coord != null, "Coord created");

            Assert.True(LinkedGeo.countLinkedPolygons(ref polygon) == 1, "Polygon count correct");
            Assert.True(LinkedGeo.countLinkedLoops(ref polygon) == 2, "Loop count correct");
            Assert.True(LinkedGeo.countLinkedCoords(ref polygon.first) == 3,
                        "Coord count 1 correct");
            Assert.True(LinkedGeo.countLinkedCoords(ref polygon.last) == 2,
                        "Coord count 2 correct");

            LinkedGeo.LinkedGeoPolygon nextPolygon = LinkedGeo.addNewLinkedPolygon(ref polygon);
            Assert.True(nextPolygon != null, "polygon created");

            Assert.True(LinkedGeo.countLinkedPolygons(ref polygon) == 2, "Polygon count correct");

            LinkedGeo.destroyLinkedPolygon(ref polygon);
            polygon = null;
        }