示例#1
0
        internal static com.epl.geometry.Geometry Calculate(com.epl.geometry.Geometry geom, com.epl.geometry.ProgressTracker progress_tracker)
        {
            int gt = geom.GetType().Value();

            if (gt == com.epl.geometry.Geometry.GeometryType.Polygon)
            {
                com.epl.geometry.Polyline dst = new com.epl.geometry.Polyline(geom.GetDescription());
                if (!geom.IsEmpty())
                {
                    ((com.epl.geometry.MultiPathImpl)geom._getImpl())._copyToUnsafe((com.epl.geometry.MultiPathImpl)dst._getImpl());
                }
                return(dst);
            }
            else
            {
                if (gt == com.epl.geometry.Geometry.GeometryType.Polyline)
                {
                    return(CalculatePolylineBoundary_(geom._getImpl(), progress_tracker, false, null));
                }
                else
                {
                    if (gt == com.epl.geometry.Geometry.GeometryType.Envelope)
                    {
                        com.epl.geometry.Polyline dst = new com.epl.geometry.Polyline(geom.GetDescription());
                        if (!geom.IsEmpty())
                        {
                            dst.AddEnvelope((com.epl.geometry.Envelope)geom, false);
                        }
                        return(dst);
                    }
                    else
                    {
                        if (com.epl.geometry.Geometry.IsSegment(gt))
                        {
                            com.epl.geometry.MultiPoint mp = new com.epl.geometry.MultiPoint(geom.GetDescription());
                            if (!geom.IsEmpty() && !((com.epl.geometry.Segment)geom).IsClosed())
                            {
                                com.epl.geometry.Point pt = new com.epl.geometry.Point();
                                ((com.epl.geometry.Segment)geom).QueryStart(pt);
                                mp.Add(pt);
                                ((com.epl.geometry.Segment)geom).QueryEnd(pt);
                                mp.Add(pt);
                            }
                            return(mp);
                        }
                        else
                        {
                            if (com.epl.geometry.Geometry.IsPoint(gt))
                            {
                                // returns empty point for points and multipoints.
                                return(null);
                            }
                        }
                    }
                }
            }
            throw new System.ArgumentException();
        }