예제 #1
0
        /*
         * (non-Javadoc)
         *
         * @see org.hibernatespatial.mgeom.IMGeometry#GetMinM()
         */
        public double GetMinM()
        {
            double minM = Double.PositiveInfinity;

            for (int i = 0; i < this.NumGeometries; i++)
            {
                MLineString ml = (MLineString)this.GetGeometryN(i);
                double      d  = ml.GetMinM();
                if (d < minM)
                {
                    minM = d;
                }
            }
            return(minM);
        }
예제 #2
0
        /**
         * TODO Improve this, and add more unit tests
         */
        private void DetermineMonotone()
        {
            this.monotone       = true;
            this.strictMonotone = true;
            if (this.IsEmpty)
            {
                return;
            }
            MGeometryType mdir = ((MLineString)this.geometries[0]).GetMeasureDirection();

            for (int i = 0; i < this.geometries.Length; i++)
            {
                MLineString ml = (MLineString)this.geometries[i];
                // check whether mlinestrings are all pointing in same direction,
                // and
                // are monotone
                if (!ml.IsMonotone(false) ||
                    (ml.GetMeasureDirection() != mdir && !(ml
                                                           .GetMeasureDirection() == MGeometryType.Constant)))
                {
                    this.monotone = false;
                    break;
                }

                if (!ml.IsMonotone(true) || (ml.GetMeasureDirection() != mdir))
                {
                    this.strictMonotone = false;
                    break;
                }

                // check whether the geometry measures do not overlap or
                // are inconsistent with previous parts
                if (i > 0)
                {
                    MLineString mlp = (MLineString)this.geometries[i - 1];
                    if (mdir == MGeometryType.Increasing)
                    {
                        if (mlp.GetMaxM() > ml.GetMinM())
                        {
                            monotone = false;
                        }
                        else if (mlp.GetMaxM() >= ml.GetMinM())
                        {
                            strictMonotone = false;
                        }
                    }
                    else
                    {
                        if (mlp.GetMinM() < ml.GetMaxM())
                        {
                            monotone = false;
                        }
                        else if (mlp.GetMinM() <= ml.GetMaxM())
                        {
                            strictMonotone = false;
                        }
                    }
                }
            }
            if (!monotone)
            {
                this.strictMonotone = false;
            }
        }