Esempio n. 1
0
 public void Redraw(GisViewer v)
 {
     lineRenderer.Reset();
     props.Radius = 1.5f * (float)v.GetResolution();
     foreach (var item in lst)
     {
         var geo = item.fea.GetGeometryRef().Clone();
         v.TransformGeometry2View(ref geo);
         DrawGeometry(geo);
         geo.Dispose();
     }
     lineRenderer.Apply();
 }
Esempio n. 2
0
    public void Redraw()
    {
        fastrenderer.Clear();
        fastrenderer.BeginDraw();

        var      lst = model.GetSpatialResult();
        Geometry geo = null;

        for (int i = 0; i < lst.Count; i++)
        {
            geo = lst[i].fea.GetGeometryRef().Clone();
            viewer.TransformGeometry2View(ref geo);
            fastrenderer.DrawGeometry(geo);
            geo.Dispose();
        }
        fastrenderer.EndDraw();
    }
Esempio n. 3
0
    public static GameObject CreateModel(GisViewer viewer, Transform parent, Feature fea)
    {
        string dlmcx     = "1";//fea.GetFieldAsString("DLMCX");
        int    dlmxctype = int.Parse(dlmcx) - 1;

        /*
         * 建筑基底  1
         * 绿地      2
         * 马路牙    3
         * 人行道    4
         * 水面      5
         * 水泥路    6
         * 停车位    7
         * 装饰路    8
         */

        var geom = fea.GetGeometryRef(); // fea.GetGeometryRef().Buffer(1, 1).Simplify(0.5);

        viewer.TransformGeometry2View(ref geom);

        float ypos = 0;

        switch (dlmxctype)
        {
        case 0:
            ypos = UnityEngine.Random.Range(50.0f, 100.0f);
            ypos = UnityEngine.Random.Range(5.0f, 10.0f);
            break;

        case 1:
            ypos = 5;
            break;

        case 2:
            ypos = 8;
            break;

        case 3:
            ypos = 4;
            break;

        case 4:
            ypos = 3;
            break;

        case 5:
            ypos = 6;
            break;

        case 6:
            ypos = 6;
            break;

        case 7:
            ypos = 6;
            break;

        default:
            break;
        }



        // 创建顶面
        var        name = "fea_" + fea.GetFID().ToString();
        GameObject go   = new GameObject(name);

        go.transform.parent = parent;

        wkbGeometryType t = Ogr.GT_Flatten(geom.GetGeometryType());

        switch (t)
        {
        case wkbGeometryType.wkbUnknown:
            break;

        case wkbGeometryType.wkbPoint:
            break;

        case wkbGeometryType.wkbPolygon:
        {
            Geometry linestring = geom.GetGeometryRef(0);
            AttachModel(go, linestring, ypos, dlmxctype);
        }
        break;

        case wkbGeometryType.wkbLineString:
        {
            AttachModel(go, geom, ypos, dlmxctype);
        }
        break;

        default:
            break;
        }
        geom.Dispose();
        return(go);
    }