Exemplo n.º 1
0
 public void Intersect(CPPOGREnvelope sOther)
 {
     if (Intersects(sOther))
     {
         if (IsInit())
         {
             MinX = Math.Max(MinX, sOther.MinX);
             MaxX = Math.Min(MaxX, sOther.MaxX);
             MinY = Math.Max(MinY, sOther.MinY);
             MaxY = Math.Min(MaxY, sOther.MaxY);
         }
         else
         {
             MinX = sOther.MinX;
             MaxX = sOther.MaxX;
             MinY = sOther.MinY;
             MaxY = sOther.MaxY;
         }
     }
     else
     {
         MinX = double.MinValue;
         MaxX = -double.MaxValue;
         MinY = double.MaxValue;
         MaxY = -double.MaxValue;
     }
 }
Exemplo n.º 2
0
 public void Merge(CPPOGREnvelope sOther)
 {
     MinX = Math.Min(MinX, sOther.MinX);
     MaxX = Math.Max(MaxX, sOther.MaxX);
     MinY = Math.Min(MinY, sOther.MinY);
     MaxY = Math.Max(MaxY, sOther.MaxY);
 }
Exemplo n.º 3
0
    public List <NoteData> SpatialQuery(CPPOGREnvelope env)
    {
        var r = new List <NoteData>();

        Enyim.Collections.Envelope e = new Enyim.Collections.Envelope(env.MinX, env.MinY, env.MaxX, env.MaxY);
        spatialquery.Find(e, true, ref r);
        return(r);
    }
Exemplo n.º 4
0
    public void ResetResolution(CPPOGREnvelope m, CPPOGREnvelope v)
    {
        view = v;
        map  = m;
        double RoH = map.GetHeight() / view.GetHeight();
        double RoW = map.GetWidth() / view.GetWidth();

        resolution = RoH > RoW ? RoH : RoW;
    }
Exemplo n.º 5
0
    public void FullExtent()
    {
        var            env      = model.GetEnvelpoe();
        CPPOGREnvelope viewsize = new CPPOGREnvelope(0, 0, Screen.width, Screen.height);

        viewer.ResetResolution(utils.ECEnvlope2CPP(env), viewsize);
        viewer.Init();
        model.SetSpatialFilterRect(env);
        viewer.ResetStandardRate();
    }
Exemplo n.º 6
0
    public static CPPOGREnvelope GetViewerEnvelope()
    {
        CPPOGREnvelope env = new CPPOGREnvelope();

        env.MinX = 0;
        env.MaxX = Screen.width;
        env.MinY = 0;
        env.MaxY = Screen.height;
        return(env);
    }
Exemplo n.º 7
0
    public static CPPOGREnvelope GetOrthographicCameraEnvelope()
    {
        var            pos = Camera.main.transform.position;
        var            wh  = GetCameraWH();
        CPPOGREnvelope env = new CPPOGREnvelope();

        env.MinX = pos.x - wh.x * 0.5f;
        env.MaxX = env.MinX + wh.x;
        env.MinY = pos.y - wh.y * 0.5f;
        env.MaxY = env.MinY + wh.y;
        return(env);
    }
Exemplo n.º 8
0
    void SurfaceSpatialQuery(List <Vector2D> lst, SpatialRelation_TYPE t)
    {
        Geometry poly = new Geometry(wkbGeometryType.wkbPolygon);
        Geometry lr   = new Geometry(wkbGeometryType.wkbLinearRing);

        foreach (var item in lst)
        {
            lr.AddPoint_2D(item.x, item.y);
        }
        lr.CloseRings();
        poly.AddGeometryDirectly(lr);

        Envelope ogrenv = new Envelope();

        poly.GetEnvelope(ogrenv);
        CPPOGREnvelope env = new CPPOGREnvelope();

        env.MinX = ogrenv.MinX;
        env.MinY = ogrenv.MinY;
        env.MaxX = ogrenv.MaxX;
        env.MaxY = ogrenv.MaxY;
        var r = model.SpatialQuery(env);

        ogrenv.Dispose();

        foreach (var item in r)
        {
            var  other = item.fea.GetGeometryRef();
            bool r2    = false;
            if (t == SpatialRelation_TYPE.hhhwSRT_Intersect)
            {
                r2 = utils.Intersects(poly, other);
            }
            else if (t == SpatialRelation_TYPE.hhhwSRT_Within)
            {
                r2 = utils.Within(poly, other);
            }
            if (r2)
            {
                ss.Add(item);
            }
        }
        poly.Dispose();
    }
Exemplo n.º 9
0
    void PointSpatialQuery(Vector2D pt)
    {
        CPPOGREnvelope env = new CPPOGREnvelope();

        env.MinX = pt.x;
        env.MinY = pt.y;
        env.MaxX = pt.x;
        env.MaxY = pt.y;
        var r = model.SpatialQuery(env);

        Geometry point = new Geometry(wkbGeometryType.wkbPoint);

        point.SetPoint_2D(0, pt.x, pt.y);
        foreach (var item in r)
        {
            var  other = item.fea.GetGeometryRef();
            bool r2    = utils.Within(other, point);
            if (r2)
            {
                ss.Add(item);
            }
        }
        point.Dispose();
    }
Exemplo n.º 10
0
 public bool Contains(CPPOGREnvelope other)
 {
     return(MinX <= other.MinX && MinY <= other.MinY &&
            MaxX >= other.MaxX && MaxY >= other.MaxY);
 }
Exemplo n.º 11
0
 public bool Intersects(CPPOGREnvelope other)
 {
     return(MinX <= other.MaxX && MaxX >= other.MinX &&
            MinY <= other.MaxY && MaxY >= other.MinY);
 }