Ejemplo n.º 1
0
        // final Point openString[] = { new Point(1220, 1320),
        // new Point(1220, 2320), new Point(3000, 2320),
        // new Point(3520, 1720), new Point(3000, 1320), };
        //
        // final Point3D openString3[] = { new Point3D(1220, 1320, 11),
        // new Point3D(1220, 2320, 2), new Point3D(3000, 2320, 3),
        // new Point3D(3520, 1720, 4), new Point3D(3000, 1320, 5), };
        internal virtual com.epl.geometry.Point _GenerateNewPoint()
        {
            if (points.Count == maxcount)
            {
                return(_RandomizeExisting());
            }
            com.epl.geometry.Point pt;
            double f = random.NextDouble() - 0.5;

            if (points.Count == 0)
            {
                pt = env.GetCenter();
            }
            else
            {
                pt = points.Last();
            }
            // pt.x = pt.x + env.Width() * f;
            pt.SetX(pt.GetX() + maxlen * f);
            f = 1.0 * random.NextDouble() - 0.5;
            pt.SetY(pt.GetY() + env.GetHeight() * f);
            pt.SetY(pt.GetY() + maxlen * f);
            pt = _snapClip(pt, env);
            points.Add(pt);
            return(pt);
        }
        internal static com.epl.geometry.Geometry PolylineMinusArea_(com.epl.geometry.Geometry geometry, com.epl.geometry.Geometry area, int area_type, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progress_tracker)
        {
            // construct the complement of the Polygon (or Envelope)
            com.epl.geometry.Envelope envelope = new com.epl.geometry.Envelope();
            geometry.QueryEnvelope(envelope);
            com.epl.geometry.Envelope2D env_2D = new com.epl.geometry.Envelope2D();
            area.QueryEnvelope2D(env_2D);
            envelope.Merge(env_2D);
            double dw = 0.1 * envelope.GetWidth();
            double dh = 0.1 * envelope.GetHeight();

            envelope.Inflate(dw, dh);
            com.epl.geometry.Polygon complement = new com.epl.geometry.Polygon();
            complement.AddEnvelope(envelope, false);
            com.epl.geometry.MultiPathImpl complementImpl = (com.epl.geometry.MultiPathImpl)(complement._getImpl());
            if (area_type == com.epl.geometry.Geometry.GeometryType.Polygon)
            {
                com.epl.geometry.MultiPathImpl polygonImpl = (com.epl.geometry.MultiPathImpl)(area._getImpl());
                complementImpl.Add(polygonImpl, true);
            }
            else
            {
                complementImpl.AddEnvelope((com.epl.geometry.Envelope)(area), true);
            }
            com.epl.geometry.OperatorFactoryLocal projEnv = com.epl.geometry.OperatorFactoryLocal.GetInstance();
            com.epl.geometry.OperatorIntersection operatorIntersection = (com.epl.geometry.OperatorIntersection)projEnv.GetOperator(com.epl.geometry.Operator.Type.Intersection);
            com.epl.geometry.Geometry             difference           = operatorIntersection.Execute(geometry, complement, sr, progress_tracker);
            return(difference);
        }
Ejemplo n.º 3
0
 public RandomCoordinateGenerator(int count, com.epl.geometry.Envelope e, double tol)
 {
     env             = e;
     maxlen          = (env.GetWidth() + env.GetHeight()) / 2 * 0.1;
     points          = new System.Collections.Generic.List <com.epl.geometry.Point>();
     points.Capacity = count;
     tolerance       = tol;
     maxcount        = count;
 }