Пример #1
0
        public static void GetEdgeNodes(TabHandle feature, int part, out double startLongX, out double startLatY,
                                        out double endLongX, out double endLatY)
        {
            int vCount = Mitab.mitab_c_get_vertex_count(feature, part);

            startLongX = (double)Mitab.mitab_c_get_vertex_x(feature, part, 0);
            startLatY  = (double)Mitab.mitab_c_get_vertex_y(feature, part, 0);

            endLongX = (double)Mitab.mitab_c_get_vertex_x(feature, part, vCount - 1);
            endLatY  = (double)Mitab.mitab_c_get_vertex_y(feature, part, vCount - 1);
        }
Пример #2
0
        public static double[][] GetCoordsD(TabHandle feature, int part)
        {
            int vCount = Mitab.mitab_c_get_vertex_count(feature, part);

            double[][] result = new double[vCount][];

            for (int k = 0; k < vCount; k++)
            {
                double x = (double)Mitab.mitab_c_get_vertex_x(feature, part, k);
                double y = (double)Mitab.mitab_c_get_vertex_y(feature, part, k);

                result[k] = new double[2] {
                    x, y
                };
            }

            return(result);
        }
Пример #3
0
        public static float[][] GetCoordsF(TabHandle feature, int part)
        {
            int vCount = Mitab.mitab_c_get_vertex_count(feature, part);

            float[][] result = new float[vCount][];

            for (int k = 0; k < vCount; k++)
            {
                float x = (float)Mitab.mitab_c_get_vertex_x(feature, part, k);
                float y = (float)Mitab.mitab_c_get_vertex_y(feature, part, k);

                result[k] = new float[2] {
                    x, y
                };
            }

            return(result);
        }
Пример #4
0
        public static void GetCurrentCentroid(TabHandle feature, int part, out double cx, out double cy)
        {
            double x = 0, y = 0;

            cx = 0; cy = 0;

            int c = Mitab.mitab_c_get_vertex_count(feature, part);

            cx = Mitab.mitab_c_get_vertex_x(feature, part, 0);
            cy = Mitab.mitab_c_get_vertex_y(feature, part, 0);

            for (int k = 1; k < c; k++)
            {
                x = Mitab.mitab_c_get_vertex_x(feature, part, k);
                y = Mitab.mitab_c_get_vertex_y(feature, part, k);

                cx = (cx + x) / 2;
                cy = (cy + y) / 2;
            }
        }
Пример #5
0
        public static int GetBiggestPart(TabHandle feature)
        {
            int partCount = Mitab.mitab_c_get_parts(feature);

            int biggestPart   = 0;
            int biggestVCount = 0;

            for (int part = 0; part < partCount; part++)
            {
                int vCount = Mitab.mitab_c_get_vertex_count(feature, part);

                if (vCount >= biggestVCount)
                {
                    biggestPart   = part;
                    biggestVCount = vCount;
                }
            }

            return(biggestPart);
        }